Package com.gengoai.math
Enum NumericComparison
- java.lang.Object
-
- java.lang.Enum<NumericComparison>
-
- com.gengoai.math.NumericComparison
-
- All Implemented Interfaces:
SerializableBiFunction<Number,Number,Boolean>
,Serializable
,Comparable<NumericComparison>
,BiFunction<Number,Number,Boolean>
public enum NumericComparison extends Enum<NumericComparison> implements SerializableBiFunction<Number,Number,Boolean>
Methods for comparing numeric (double) values.- Author:
- David B. Bracewell
-
-
Enum Constant Summary
Enum Constants Enum Constant Description EQ
IsbeingCompared
equal tocomparedAgainst
GT
IsbeingCompared
greater thancomparedAgainst
GTE
IsbeingCompared
greater than or equal tocomparedAgainst
LT
IsbeingCompared
less thancomparedAgainst
LTE
IsbeingCompared
less than or equal tocomparedAgainst
NE
IsbeingCompared
not equal tocomparedAgainst
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Boolean
apply(Number number, Number number2)
String
asString()
abstract boolean
compare(double beingCompared, double comparedAgainst)
Compares two given numeric valuesstatic NumericComparison
fromString(@NonNull String string)
static NumericComparison
valueOf(String name)
Returns the enum constant of this type with the specified name.static NumericComparison[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface java.util.function.BiFunction
andThen
-
-
-
-
Enum Constant Detail
-
GT
public static final NumericComparison GT
IsbeingCompared
greater thancomparedAgainst
-
GTE
public static final NumericComparison GTE
IsbeingCompared
greater than or equal tocomparedAgainst
-
LT
public static final NumericComparison LT
IsbeingCompared
less thancomparedAgainst
-
LTE
public static final NumericComparison LTE
IsbeingCompared
less than or equal tocomparedAgainst
-
EQ
public static final NumericComparison EQ
IsbeingCompared
equal tocomparedAgainst
-
NE
public static final NumericComparison NE
IsbeingCompared
not equal tocomparedAgainst
-
-
Method Detail
-
values
public static NumericComparison[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (NumericComparison c : NumericComparison.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static NumericComparison valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
fromString
public static NumericComparison fromString(@NonNull @NonNull String string)
-
apply
public Boolean apply(Number number, Number number2)
- Specified by:
apply
in interfaceBiFunction<Number,Number,Boolean>
-
asString
public String asString()
-
compare
public abstract boolean compare(double beingCompared, double comparedAgainst)
Compares two given numeric values- Parameters:
beingCompared
- The number being comparedcomparedAgainst
- The number being compared against- Returns:
- true if the inequality holds
-
-