Class ModulusField

    • Constructor Summary

      Constructors 
      Constructor Description
      ModulusField​(int modulus)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Integer addG​(java.lang.Integer l, java.lang.Integer r)
      Adds two elements of type E.
      java.lang.Integer cast​(java.lang.Object l)
      Convert input to an integer in the range [0,modulus)
      java.lang.Integer cmpG​(java.lang.Integer l, java.lang.Integer r)
      Not implemented for this field.
      java.lang.Integer convertFromInt​(java.lang.Integer l)
      Attempt to convert argument from an integer
      java.lang.Integer convertToIntE​(java.lang.Integer l)
      If possible convert the argument to an Integer to enable integral powers.
      java.lang.Integer divG​(java.lang.Integer l, java.lang.Integer r)
      Not implemented for this field.
      java.lang.Boolean eq​(java.lang.Object lo, java.lang.Object ro)
      Equals
      java.lang.Boolean ge​(java.lang.Object l, java.lang.Object r)
      Not implemented for this field.
      java.lang.Integer getOne()
      Get the multiplicative identity for this field.
      java.lang.Integer getZero()
      Get the additive identity for this field
      java.lang.Boolean gt​(java.lang.Object l, java.lang.Object r)
      Not implemented for this field.
      java.lang.Boolean le​(java.lang.Object l, java.lang.Object r)
      Not implemented for this field.
      java.lang.Boolean lt​(java.lang.Object l, java.lang.Object r)
      Not implemented for this field.
      java.lang.Integer modG​(java.lang.Integer l, java.lang.Integer r)
      Modulus of two elements of type E.
      java.lang.Integer mulG​(java.lang.Integer l, java.lang.Integer r)
      Multiplies two elements of type E.
      java.lang.Boolean ne​(java.lang.Object lo, java.lang.Object ro)
      Not Equals
      java.lang.Integer negG​(java.lang.Integer l)
      Negates an elements of type E.
      java.lang.Integer powG​(java.lang.Integer l, java.lang.Integer r)
      Raises l to the power of r
      java.lang.Integer subG​(java.lang.Integer l, java.lang.Integer r)
      Subtracts two elements of type E.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModulusField

        public ModulusField​(int modulus)
    • Method Detail

      • cast

        public java.lang.Integer cast​(java.lang.Object l)
        Convert input to an integer in the range [0,modulus)
        Specified by:
        cast in class GenericField<java.lang.Integer>
        Parameters:
        l - input
        Returns:
        value in range or null if it cannot be converted
      • addG

        public java.lang.Integer addG​(java.lang.Integer l,
                                      java.lang.Integer r)
                               throws EvaluationException
        Description copied from class: GenericField
        Adds two elements of type E.
        Specified by:
        addG in class GenericField<java.lang.Integer>
        Parameters:
        l - lhs argument
        r - rhs argument
        Returns:
        the sum
        Throws:
        EvaluationException - on error
      • subG

        public java.lang.Integer subG​(java.lang.Integer l,
                                      java.lang.Integer r)
                               throws EvaluationException
        Description copied from class: GenericField
        Subtracts two elements of type E.
        Specified by:
        subG in class GenericField<java.lang.Integer>
        Parameters:
        l - lhs argument
        r - rhs argument
        Returns:
        the difference
        Throws:
        EvaluationException - on error
      • mulG

        public java.lang.Integer mulG​(java.lang.Integer l,
                                      java.lang.Integer r)
                               throws EvaluationException
        Description copied from class: GenericField
        Multiplies two elements of type E.
        Specified by:
        mulG in class GenericField<java.lang.Integer>
        Parameters:
        l - lhs argument
        r - rhs argument
        Returns:
        the product
        Throws:
        EvaluationException - on error
      • divG

        public java.lang.Integer divG​(java.lang.Integer l,
                                      java.lang.Integer r)
                               throws EvaluationException
        Not implemented for this field.
        Specified by:
        divG in class GenericField<java.lang.Integer>
        Parameters:
        l - numerator
        r - denominator
        Returns:
        the division
        Throws:
        EvaluationException - on error
      • modG

        public java.lang.Integer modG​(java.lang.Integer l,
                                      java.lang.Integer r)
                               throws EvaluationException
        Description copied from class: GenericField
        Modulus of two elements of type E.
        Specified by:
        modG in class GenericField<java.lang.Integer>
        Parameters:
        l - lhs argument
        r - rhs argument
        Returns:
        the modulus
        Throws:
        EvaluationException - on error
      • powG

        public java.lang.Integer powG​(java.lang.Integer l,
                                      java.lang.Integer r)
                               throws EvaluationException
        Description copied from class: GenericField
        Raises l to the power of r
        Specified by:
        powG in class GenericField<java.lang.Integer>
        Parameters:
        l - lhs argument
        r - rhs argument
        Returns:
        the power
        Throws:
        EvaluationException - on error
      • cmpG

        public java.lang.Integer cmpG​(java.lang.Integer l,
                                      java.lang.Integer r)
                               throws EvaluationException
        Not implemented for this field.
        Specified by:
        cmpG in class GenericField<java.lang.Integer>
        Parameters:
        l - left argument
        r - right argument
        Returns:
        -1, 0, 1 or null
        Throws:
        EvaluationException
      • eq

        public java.lang.Boolean eq​(java.lang.Object lo,
                                    java.lang.Object ro)
                             throws EvaluationException
        Description copied from interface: FieldI
        Equals
        Specified by:
        eq in interface FieldI
        Overrides:
        eq in class AbstractComparativeField
        Parameters:
        lo - left hand argument
        ro - right hand argument
        Returns:
        an object representing the result or null if it can not be evaluated.
        Throws:
        EvaluationException - on error
      • ne

        public java.lang.Boolean ne​(java.lang.Object lo,
                                    java.lang.Object ro)
                             throws EvaluationException
        Description copied from interface: FieldI
        Not Equals
        Specified by:
        ne in interface FieldI
        Overrides:
        ne in class AbstractComparativeField
        Parameters:
        lo - left hand argument
        ro - right hand argument
        Returns:
        an object representing the result or null if it can not be evaluated.
        Throws:
        EvaluationException - on error
      • gt

        public java.lang.Boolean gt​(java.lang.Object l,
                                    java.lang.Object r)
                             throws EvaluationException
        Not implemented for this field.
        Specified by:
        gt in interface FieldI
        Overrides:
        gt in class AbstractComparativeField
        Parameters:
        l - left hand argument
        r - right hand argument
        Returns:
        an object representing the result or null if it can not be evaluated.
        Throws:
        EvaluationException - on error
      • ge

        public java.lang.Boolean ge​(java.lang.Object l,
                                    java.lang.Object r)
                             throws EvaluationException
        Not implemented for this field.
        Specified by:
        ge in interface FieldI
        Overrides:
        ge in class AbstractComparativeField
        Parameters:
        l - left hand argument
        r - right hand argument
        Returns:
        an object representing the result or null if it can not be evaluated.
        Throws:
        EvaluationException - on error
      • lt

        public java.lang.Boolean lt​(java.lang.Object l,
                                    java.lang.Object r)
                             throws EvaluationException
        Not implemented for this field.
        Specified by:
        lt in interface FieldI
        Overrides:
        lt in class AbstractComparativeField
        Parameters:
        l - left hand argument
        r - right hand argument
        Returns:
        an object representing the result or null if it can not be evaluated.
        Throws:
        EvaluationException - on error
      • le

        public java.lang.Boolean le​(java.lang.Object l,
                                    java.lang.Object r)
                             throws EvaluationException
        Not implemented for this field.
        Specified by:
        le in interface FieldI
        Overrides:
        le in class AbstractComparativeField
        Parameters:
        l - left hand argument
        r - right hand argument
        Returns:
        an object representing the result or null if it can not be evaluated.
        Throws:
        EvaluationException - on error
      • getOne

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

        public java.lang.Integer 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<java.lang.Integer>
        Returns:
        object representing zero or null if undefined for this field
      • convertToIntE

        public java.lang.Integer convertToIntE​(java.lang.Integer l)
                                        throws EvaluationException
        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<java.lang.Integer>
        Parameters:
        l - argument to convert.
        Returns:
        an integer or null if argument cannot be converted
        Throws:
        EvaluationException