Class DoubleValue
- java.lang.Object
-
- com.yahoo.searchlib.rankingexpression.evaluation.Value
-
- com.yahoo.searchlib.rankingexpression.evaluation.DoubleCompatibleValue
-
- com.yahoo.searchlib.rankingexpression.evaluation.DoubleValue
-
public final class DoubleValue extends DoubleCompatibleValue
A double value result of a ranking expression evaluation. In a boolean context doubles are true if they are different from 0.0- Author:
- bratseth
-
-
Field Summary
Fields Modifier and Type Field Description static DoubleValue
NaN
The double value instance for NaNstatic DoubleValue
zero
The double value instance for 0
-
Constructor Summary
Constructors Constructor Description DoubleValue(double value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Value
add(Value value)
boolean
asBoolean()
Returns this value as a boolean.double
asDouble()
Returns this value as a double, or throws UnsupportedOperationException if it cannot be represented as a doubleDoubleValue
asDoubleValue()
Returns this value as a double value, or throws UnsupportedOperationException if it cannot be represented as a doubleDoubleValue
asMutable()
Returns this is mutable, or a mutable copy otherwiseValue
divide(Value value)
boolean
equals(Object other)
static DoubleValue
frozen(double value)
Create a double which is frozen at the outset.Value
function(Function function, Value value)
Perform the given binary function on this value and the given valueint
hashCode()
Returns a hash which only depends on the content of this value.Value
modulo(Value value)
Value
multiply(Value value)
DoubleValue
negate()
Value
subtract(Value value)
String
toString()
-
Methods inherited from class com.yahoo.searchlib.rankingexpression.evaluation.DoubleCompatibleValue
and, asTensor, compare, hasDouble, not, or, power, type
-
-
-
-
Field Detail
-
zero
public static final DoubleValue zero
The double value instance for 0
-
NaN
public static final DoubleValue NaN
The double value instance for NaN
-
-
Method Detail
-
frozen
public static DoubleValue frozen(double value)
Create a double which is frozen at the outset.
-
asDouble
public double asDouble()
Description copied from class:Value
Returns this value as a double, or throws UnsupportedOperationException if it cannot be represented as a double
-
asDoubleValue
public DoubleValue asDoubleValue()
Description copied from class:Value
Returns this value as a double value, or throws UnsupportedOperationException if it cannot be represented as a double- Overrides:
asDoubleValue
in classValue
-
asBoolean
public boolean asBoolean()
Description copied from class:Value
Returns this value as a boolean.
-
negate
public DoubleValue negate()
- Overrides:
negate
in classDoubleCompatibleValue
-
add
public Value add(Value value)
- Overrides:
add
in classDoubleCompatibleValue
-
subtract
public Value subtract(Value value)
- Overrides:
subtract
in classDoubleCompatibleValue
-
multiply
public Value multiply(Value value)
- Overrides:
multiply
in classDoubleCompatibleValue
-
divide
public Value divide(Value value)
- Overrides:
divide
in classDoubleCompatibleValue
-
modulo
public Value modulo(Value value)
- Overrides:
modulo
in classDoubleCompatibleValue
-
function
public Value function(Function function, Value value)
Description copied from class:Value
Perform the given binary function on this value and the given value- Overrides:
function
in classDoubleCompatibleValue
-
asMutable
public DoubleValue asMutable()
Description copied from class:Value
Returns this is mutable, or a mutable copy otherwise
-
-