All Implemented Interfaces:
FieldI, IntegerConvertor, Serializable

public class ShortField extends GenericPowerField<Short>
An integer field where overflows are ignored.
Author:
Richard Morris
See Also:
  • Constructor Details

    • ShortField

      public ShortField()
  • Method Details

    • cast

      public Short cast(Object l)
      Description copied from class: GenericField
      Convert the input to type E.
      Specified by:
      cast in class GenericField<Short>
      Parameters:
      l -
      Returns:
      l cast to type E if possible or null if casting is not possible
    • addG

      public Short addG(Short l, Short r)
      Description copied from class: GenericField
      Adds two elements of type E.
      Specified by:
      addG in class GenericField<Short>
      Parameters:
      l - lhs argument
      r - rhs argument
      Returns:
      the sum
    • subG

      public Short subG(Short l, Short r)
      Description copied from class: GenericField
      Subtracts two elements of type E.
      Specified by:
      subG in class GenericField<Short>
      Parameters:
      l - lhs argument
      r - rhs argument
      Returns:
      the difference
    • negG

      public Short negG(Short l)
      Description copied from class: GenericField
      Negates an elements of type E.
      Specified by:
      negG in class GenericField<Short>
      Parameters:
      l - the argument
      Returns:
      the negation
    • mulG

      public Short mulG(Short l, Short r)
      Description copied from class: GenericField
      Multiplies two elements of type E.
      Specified by:
      mulG in class GenericField<Short>
      Parameters:
      l - lhs argument
      r - rhs argument
      Returns:
      the product
    • divG

      public Short divG(Short l, Short r)
      Description copied from class: GenericField
      Divides two elements of type E.
      Specified by:
      divG in class GenericField<Short>
      Parameters:
      l - numerator
      r - denominator
      Returns:
      the division
    • modG

      public Short modG(Short l, Short r)
      Description copied from class: GenericField
      Modulus of two elements of type E.
      Specified by:
      modG in class GenericField<Short>
      Parameters:
      l - lhs argument
      r - rhs argument
      Returns:
      the modulus
    • powNonInt

      public Short powNonInt(Short l, Short r) throws EvaluationException
      Description copied from class: GenericPowerField
      Called when the power is not an integer
      Specified by:
      powNonInt in class GenericPowerField<Short>
      Parameters:
      l -
      r -
      Returns:
      Throws:
      EvaluationException
    • cmpG

      public Integer cmpG(Short l, Short r)
      Description copied from class: GenericField
      Compare two objects of the same type.
      Specified by:
      cmpG in class GenericField<Short>
      Parameters:
      l - left argument
      r - right argument
      Returns:
      -1, 0, 1 or null
    • convertFromInt

      public Short convertFromInt(Integer l)
      Description copied from interface: IntegerConvertor
      Attempt to convert argument from an integer
      Specified by:
      convertFromInt in interface IntegerConvertor
      Specified by:
      convertFromInt in class GenericField<Short>
      Parameters:
      l - value to convert
      Returns:
      corresponding value in this field or null if it cannot be converted
    • getOne

      public Short getOne()
      Description copied from interface: FieldI
      Get the multiplicative identity for this field.
      Specified by:
      getOne in interface FieldI
      Specified by:
      getOne in class GenericField<Short>
      Returns:
      object representing one or null if undefined for this field
    • getZero

      public Short getZero()
      Description copied from interface: FieldI
      Get the additive identity for this field
      Specified by:
      getZero in interface FieldI
      Specified by:
      getZero in class GenericField<Short>
      Returns:
      object representing zero or null if undefined for this field
    • convertToIntE

      public Integer convertToIntE(Short l)
      Description copied from class: GenericField
      If possible convert the argument to an Integer to enable integral powers. If the argument cannot be converted null should be returned and the powG(E,E) method will be called.
      Specified by:
      convertToIntE in class GenericField<Short>
      Parameters:
      l - argument to convert.
      Returns:
      an integer or null if argument cannot be converted