Package com.yahoo.searchlib.expression
Class IntegerResultNode
java.lang.Object
com.yahoo.vespa.objects.Selectable
com.yahoo.vespa.objects.Identifiable
com.yahoo.searchlib.expression.ResultNode
com.yahoo.searchlib.expression.SingleResultNode
com.yahoo.searchlib.expression.NumericResultNode
com.yahoo.searchlib.expression.IntegerResultNode
- All Implemented Interfaces:
Cloneable,Comparable<ResultNode>
This result holds an integer value.
- Author:
- baldersheim, Simon Thoresen Hult
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty result node.IntegerResultNode(long value) Constructs an instance of this class with given value. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ResultNode rhs) In-place addition of this result with another.voiddivide(ResultNode rhs) In-place division of this result with another.doublegetFloat()Returns the float representation of this result.longReturns the integer representation of this result.static IntegerResultNodeWill provide the smallest possible valueReturn a java numeric, either Double or Long, depending on the underlying container.static IntegerResultNodeWill provide the largest possible valuebyte[]getRaw()Returns the raw byte array representation of this result.Returns the string representation of this result.inthashCode()voidmax(ResultNode rhs) Swaps the numerical value of this node with the larger of this and the other.voidmin(ResultNode rhs) Swaps the numerical value of this node with the smaller of this and the other.voidmodulo(ResultNode rhs) In-place modulo of this result with another.voidmultiply(ResultNode rhs) In-place multiplication of this result with another.voidnegate()Negate the value contained within the result node.protected intonCmp(ResultNode rhs) This method must be implemented by all subclasses of this to allow ordering of results.protected voidonDeserialize(com.yahoo.vespa.objects.Deserializer buf) protected intprotected voidonSerialize(com.yahoo.vespa.objects.Serializer buf) voidset(ResultNode rhs) This method must be implemented by all subclasses of this to allow new results to be calculated.setValue(long value) Sets the value of this result.voidvisitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor) Methods inherited from class com.yahoo.searchlib.expression.NumericResultNode
getValueMethods inherited from class com.yahoo.searchlib.expression.ResultNode
compareTo, equalsMethods inherited from class com.yahoo.vespa.objects.Identifiable
clone, create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, putUtf8, registerClass, serialize, serializeOptional, serializeWithId, toStringMethods inherited from class com.yahoo.vespa.objects.Selectable
select, select, selectMembers
-
Field Details
-
classId
public static final int classId
-
-
Constructor Details
-
IntegerResultNode
public IntegerResultNode()Constructs an empty result node. -
IntegerResultNode
public IntegerResultNode(long value) Constructs an instance of this class with given value.- Parameters:
value- The value to assign to this.
-
-
Method Details
-
setValue
Sets the value of this result.- Parameters:
value- The value to set.- Returns:
- This, to allow chaining.
-
onGetClassId
protected int onGetClassId()- Overrides:
onGetClassIdin classNumericResultNode
-
onSerialize
protected void onSerialize(com.yahoo.vespa.objects.Serializer buf) - Overrides:
onSerializein classcom.yahoo.vespa.objects.Identifiable
-
onDeserialize
protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf) - Overrides:
onDeserializein classcom.yahoo.vespa.objects.Identifiable
-
getInteger
public long getInteger()Description copied from class:ResultNodeReturns the integer representation of this result.- Specified by:
getIntegerin classResultNode- Returns:
- The value of this.
-
getFloat
public double getFloat()Description copied from class:ResultNodeReturns the float representation of this result.- Specified by:
getFloatin classResultNode- Returns:
- The value of this.
-
getString
Description copied from class:ResultNodeReturns the string representation of this result.- Specified by:
getStringin classResultNode- Returns:
- The value of this.
-
getRaw
public byte[] getRaw()Description copied from class:ResultNodeReturns the raw byte array representation of this result.- Specified by:
getRawin classResultNode- Returns:
- The value of this.
-
add
Description copied from class:SingleResultNodeIn-place addition of this result with another.- Specified by:
addin classSingleResultNode- Parameters:
rhs- The result to add to this.
-
negate
public void negate()Description copied from class:ResultNodeNegate the value contained within the result node.- Overrides:
negatein classResultNode
-
multiply
Description copied from class:NumericResultNodeIn-place multiplication of this result with another.- Specified by:
multiplyin classNumericResultNode- Parameters:
rhs- The result to multiply with this.
-
divide
Description copied from class:NumericResultNodeIn-place division of this result with another.- Specified by:
dividein classNumericResultNode- Parameters:
rhs- The result to divide this by.
-
modulo
Description copied from class:NumericResultNodeIn-place modulo of this result with another.- Specified by:
moduloin classNumericResultNode- Parameters:
rhs- The result to modulo this with.
-
min
Description copied from class:SingleResultNodeSwaps the numerical value of this node with the smaller of this and the other.- Specified by:
minin classSingleResultNode- Parameters:
rhs- The other result to evaluate.
-
max
Description copied from class:SingleResultNodeSwaps the numerical value of this node with the larger of this and the other.- Specified by:
maxin classSingleResultNode- Parameters:
rhs- The other result to evaluate.
-
getNumber
Description copied from class:NumericResultNodeReturn a java numeric, either Double or Long, depending on the underlying container.- Specified by:
getNumberin classNumericResultNode- Returns:
- The underlying numeric value.
-
onCmp
Description copied from class:ResultNodeThis method must be implemented by all subclasses of this to allow ordering of results. This method is used by theCloneableimplementation.- Specified by:
onCmpin classResultNode- Parameters:
rhs- The other node to compare with.- Returns:
- Comparable result.
-
hashCode
public int hashCode()- Overrides:
hashCodein classcom.yahoo.vespa.objects.Identifiable
-
visitMembers
public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor) - Overrides:
visitMembersin classcom.yahoo.vespa.objects.Identifiable
-
set
Description copied from class:ResultNodeThis method must be implemented by all subclasses of this to allow new results to be calculated.- Specified by:
setin classResultNode- Parameters:
rhs- The node to get the result from.
-
getNegativeInfinity
Will provide the smallest possible value- Returns:
- the smallest possible IntegerResultNode
-
getPositiveInfinity
Will provide the largest possible value- Returns:
- the smallest largest IntegerResultNode
-