public final class InequalityNumberValue extends Object implements NumericalValue, Serializable
NumberValues.| Constructor and Description |
|---|
InequalityNumberValue(ValueComparator comparator,
BigDecimal val)
Creates a new
InequalityNumberValue with the given
comparator and value. |
InequalityNumberValue(ValueComparator comparator,
double val)
Creates a new
InequalityNumberValue with the given
comparator and value. |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ValueVisitor valueVisitor)
Performs some processing on a value.
|
InequalityNumberValueBuilder |
asBuilder() |
ValueComparator |
compare(Value d2)
Compares this value and another numerically, or checks this value
for membership in a value list.
|
double |
doubleValue()
Gets this value as a double.
|
boolean |
equals(Object obj) |
BigDecimal |
getBigDecimal()
Gets this value as a
BigDecimal. |
ValueComparator |
getComparator() |
String |
getFormatted()
Returns a string representing this value for display purposes.
|
ValueComparator |
getInequality() |
Number |
getNumber()
Gets this value as a number.
|
NumberValue |
getNumberValue()
Gets the number value component of this numerical value.
|
ValueType |
getType()
Returns this object's type, guaranteed not
null. |
int |
hashCode() |
static InequalityNumberValue |
parse(String str)
Parses a number with an inequality from a string, e.g., "> 100".
|
InequalityNumberValue |
replace()
Returns a value from a cache that is equal to this one, if such a value
exists.
|
String |
toString() |
public InequalityNumberValue(ValueComparator comparator, double val)
InequalityNumberValue with the given
comparator and value.comparator - a ValueComparator. If null,
the default comparator is used
(ValueComparator.EQUAL_TO).val - a double.public InequalityNumberValue(ValueComparator comparator, BigDecimal val)
InequalityNumberValue with the given
comparator and value.comparator - a ValueComparator. If null,
the default comparator is used (ValueComparator.EQUAL_TO).val - a BigDecimal. If null, a value
of 0 is used.public static InequalityNumberValue parse(String str)
str - a string representing a number prefixed with an inequality.InequalityNumberValue, or null if no
such number was found.public InequalityNumberValue replace()
Valuepublic Number getNumber()
NumericalValuegetNumber in interface NumericalValueNumber.public BigDecimal getBigDecimal()
NumericalValueBigDecimal.getBigDecimal in interface NumericalValueBigDecimal.public double doubleValue()
NumericalValuedoubleValue in interface NumericalValuedouble.public ValueComparator getInequality()
public String getFormatted()
ValuegetFormatted in interface ValueString. Guaranteed not null.public ValueComparator getComparator()
public ValueType getType()
Valuenull.public ValueComparator compare(Value d2)
compare in interface Valueo - a Value.NumericalValue, returns
ValueComparator.GREATER_THAN,
ValueComparator.LESS_THAN or ValueComparator.EQUAL_TO
depending on whether this value is numerically greater than,
less than or equal to the value provided as argument. IF the provided
value is a ValueList, returns ValueComparator.IN if this
object is a member of the value list, or ValueComparator.NOT_IN
if this object is not a member. Otherwise, returns
ValueComparator.UNKNOWN.public void accept(ValueVisitor valueVisitor)
ValueVisitableaccept in interface ValueVisitablepublic NumberValue getNumberValue()
NumericalValuegetNumberValue in interface NumericalValueNumberValue.public InequalityNumberValueBuilder asBuilder()
asBuilder in interface NumericalValueasBuilder in interface OrderedValueasBuilder in interface ValueCopyright © 2012–2016 Emory University. All rights reserved.