All Implemented Interfaces:
FieldI, IntegerConvertor, Serializable

public class LongField extends GenericPowerField<Long>
A field where all operations are implemented using Long.
See Also:
  • Constructor Details

    • LongField

      public LongField()
  • Method Details

    • addG

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

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

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

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

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

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

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

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

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

      public static long power(long l, long r)
    • convertToIntE

      public Integer convertToIntE(Long 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<Long>
      Parameters:
      l - argument to convert.
      Returns:
      an integer or null if argument cannot be converted
    • convertFromInt

      public Long 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<Long>
      Parameters:
      l - value to convert
      Returns:
      corresponding value in this field or null if it cannot be converted
    • getOne

      public Long 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<Long>
      Returns:
      object representing one or null if undefined for this field
    • getZero

      public Long 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<Long>
      Returns:
      object representing zero or null if undefined for this field