Class NumericTermComparator
java.lang.Object
org.projog.core.math.NumericTermComparator
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor to force use ofNUMERIC_TERM_COMPARATOR -
Method Summary
-
Field Details
-
NUMERIC_TERM_COMPARATOR
Singleton instance
-
-
Constructor Details
-
NumericTermComparator
private NumericTermComparator()Private constructor to force use ofNUMERIC_TERM_COMPARATOR
-
-
Method Details
-
compare
Compares the two arguments, representing arithmetic expressions, for order.Returns a negative integer, zero, or a positive integer as the numeric value represented by the first argument is less than, equal to, or greater than the second.
Unlike
compare(Numeric, Numeric)this method will work for arguments that represent arithmetic expressions (e.g. aStructureof the form+(1,2)) as well asNumericterms.- Parameters:
t1- the first term to be comparedt2- the second term to be compared- Returns:
- a negative integer, zero, or a positive integer as the first term is less than, equal to, or greater than the second
- Throws:
ProjogException- if either argument does not represent an arithmetic expression- See Also:
-
compare
Compares two arguments, representingNumericterms, for order.Returns a negative integer, zero, or a positive integer as the numeric value represented by the first argument is less than, equal to, or greater than the second.
- Parameters:
n1- the first term to be comparedn2- the second term to be compared- Returns:
- a negative integer, zero, or a positive integer as the first term is less than, equal to, or greater than the second
- See Also:
-