Package com.singularsys.extensions.field
Class FieldCollection
java.lang.Object
com.singularsys.extensions.field.FieldCollection
- All Implemented Interfaces:
FieldI,IntegerConvertor,Serializable
- Direct Known Subclasses:
MatrixFieldCollection
Groups a set of fields together.
Fields can be added to the collection by calling
addField(SetI).
When evaluating each field is evaluated in turn, if the result is non-null then
that value is returned. Otherwise, the next field is checked.
The collection also implements the FieldMethodsI encapsulating the operations as Binary/Unary Methods, so it can be used directly with a FieldOperatorTable.
- Author:
- Richard Morris
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStandard constructor with no fields.FieldCollection(FieldI... fields) Constructor from a set of fields. -
Method Summary
Modifier and TypeMethodDescriptionAdd two members of the field.voidAdd a new field to the collection.Logical and.voidAttempt to convert argument from an integerAttempt to convert argument to an integerDivides two members of the field.EqualsGreater or equal toFieldI[]getOne()Get the multiplicative identity for this field.getZero()Get the additive identity for this fieldGreater thanLess than or equals toLess thanThe modulus of two members of the field.Multiplies two members of the field.Not EqualsThe negation -x of an element.Logical not.Logical or.The power operator.booleanSubtract two members of the field.
-
Field Details
-
fields
-
-
Constructor Details
-
FieldCollection
public FieldCollection()Standard constructor with no fields. -
FieldCollection
Constructor from a set of fields.- Parameters:
fields- a list of fields in order
-
-
Method Details
-
addField
Add a new field to the collection.- Parameters:
f- the field to add
-
removeField
-
clearFields
public void clearFields() -
getFields
-
add
Description copied from interface:FieldIAdd two members of the field.- Specified by:
addin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
sub
Description copied from interface:FieldISubtract two members of the field.- Specified by:
subin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
neg
Description copied from interface:FieldIThe negation -x of an element.- Specified by:
negin interfaceFieldI- Parameters:
l- the argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
mul
Description copied from interface:FieldIMultiplies two members of the field.- Specified by:
mulin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
div
Description copied from interface:FieldIDivides two members of the field.- Specified by:
divin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
mod
Description copied from interface:FieldIThe modulus of two members of the field.- Specified by:
modin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
pow
Description copied from interface:FieldIThe power operator.- Specified by:
powin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
eq
Description copied from interface:FieldIEquals- Specified by:
eqin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
ne
Description copied from interface:FieldINot Equals- Specified by:
nein interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
gt
Description copied from interface:FieldIGreater than- Specified by:
gtin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
ge
Description copied from interface:FieldIGreater or equal to- Specified by:
gein interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
lt
Description copied from interface:FieldILess than- Specified by:
ltin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
le
Description copied from interface:FieldILess than or equals to- Specified by:
lein interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
and
Description copied from interface:FieldILogical and.- Specified by:
andin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
or
Description copied from interface:FieldILogical or.- Specified by:
orin interfaceFieldI- Parameters:
l- left-hand argumentr- right-hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
not
Description copied from interface:FieldILogical not.- Specified by:
notin interfaceFieldI- Parameters:
l- argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
getOne
Description copied from interface:FieldIGet the multiplicative identity for this field. -
getZero
Description copied from interface:FieldIGet the additive identity for this field -
convertToInt
Description copied from interface:IntegerConvertorAttempt to convert argument to an integer- Specified by:
convertToIntin interfaceIntegerConvertor- Parameters:
l- value to convert- Returns:
- corresponding integer or null if it cannot be converted
- Throws:
EvaluationException- on error
-
convertFromInt
Description copied from interface:IntegerConvertorAttempt to convert argument from an integer- Specified by:
convertFromIntin interfaceIntegerConvertor- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException- probably never
-