Class IntegerResultNode

java.lang.Object
com.yahoo.vespa.objects.Selectable
All Implemented Interfaces:
Cloneable, Comparable<ResultNode>

public class IntegerResultNode extends NumericResultNode
This result holds an integer value.
Author:
baldersheim, Simon Thoresen Hult
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty result node.
    IntegerResultNode(long value)
    Constructs an instance of this class with given value.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    In-place addition of this result with another.
    void
    In-place division of this result with another.
    double
    Returns the float representation of this result.
    long
    Returns the integer representation of this result.
    Will provide the smallest possible value
    Return a java numeric, either Double or Long, depending on the underlying container.
    Will provide the largest possible value
    byte[]
    Returns the raw byte array representation of this result.
    Returns the string representation of this result.
    int
     
    void
    Swaps the numerical value of this node with the larger of this and the other.
    void
    Swaps the numerical value of this node with the smaller of this and the other.
    void
    In-place modulo of this result with another.
    void
    In-place multiplication of this result with another.
    void
    Negate the value contained within the result node.
    protected int
    This method must be implemented by all subclasses of this to allow ordering of results.
    protected void
    onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
     
    protected int
     
    protected void
    onSerialize(com.yahoo.vespa.objects.Serializer buf)
     
    void
    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.
    void
    visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
     

    Methods inherited from class com.yahoo.searchlib.expression.NumericResultNode

    getValue

    Methods inherited from class com.yahoo.searchlib.expression.ResultNode

    compareTo, equals

    Methods inherited from class com.yahoo.vespa.objects.Identifiable

    clone, create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, putUtf8, registerClass, serialize, serializeOptional, serializeWithId, toString

    Methods inherited from class com.yahoo.vespa.objects.Selectable

    select, select, selectMembers

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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

      public IntegerResultNode setValue(long value)
      Sets the value of this result.
      Parameters:
      value - The value to set.
      Returns:
      This, to allow chaining.
    • onGetClassId

      protected int onGetClassId()
      Overrides:
      onGetClassId in class NumericResultNode
    • onSerialize

      protected void onSerialize(com.yahoo.vespa.objects.Serializer buf)
      Overrides:
      onSerialize in class com.yahoo.vespa.objects.Identifiable
    • onDeserialize

      protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
      Overrides:
      onDeserialize in class com.yahoo.vespa.objects.Identifiable
    • getInteger

      public long getInteger()
      Description copied from class: ResultNode
      Returns the integer representation of this result.
      Specified by:
      getInteger in class ResultNode
      Returns:
      The value of this.
    • getFloat

      public double getFloat()
      Description copied from class: ResultNode
      Returns the float representation of this result.
      Specified by:
      getFloat in class ResultNode
      Returns:
      The value of this.
    • getString

      public String getString()
      Description copied from class: ResultNode
      Returns the string representation of this result.
      Specified by:
      getString in class ResultNode
      Returns:
      The value of this.
    • getRaw

      public byte[] getRaw()
      Description copied from class: ResultNode
      Returns the raw byte array representation of this result.
      Specified by:
      getRaw in class ResultNode
      Returns:
      The value of this.
    • add

      public void add(ResultNode rhs)
      Description copied from class: SingleResultNode
      In-place addition of this result with another.
      Specified by:
      add in class SingleResultNode
      Parameters:
      rhs - The result to add to this.
    • negate

      public void negate()
      Description copied from class: ResultNode
      Negate the value contained within the result node.
      Overrides:
      negate in class ResultNode
    • multiply

      public void multiply(ResultNode rhs)
      Description copied from class: NumericResultNode
      In-place multiplication of this result with another.
      Specified by:
      multiply in class NumericResultNode
      Parameters:
      rhs - The result to multiply with this.
    • divide

      public void divide(ResultNode rhs)
      Description copied from class: NumericResultNode
      In-place division of this result with another.
      Specified by:
      divide in class NumericResultNode
      Parameters:
      rhs - The result to divide this by.
    • modulo

      public void modulo(ResultNode rhs)
      Description copied from class: NumericResultNode
      In-place modulo of this result with another.
      Specified by:
      modulo in class NumericResultNode
      Parameters:
      rhs - The result to modulo this with.
    • min

      public void min(ResultNode rhs)
      Description copied from class: SingleResultNode
      Swaps the numerical value of this node with the smaller of this and the other.
      Specified by:
      min in class SingleResultNode
      Parameters:
      rhs - The other result to evaluate.
    • max

      public void max(ResultNode rhs)
      Description copied from class: SingleResultNode
      Swaps the numerical value of this node with the larger of this and the other.
      Specified by:
      max in class SingleResultNode
      Parameters:
      rhs - The other result to evaluate.
    • getNumber

      public Object getNumber()
      Description copied from class: NumericResultNode
      Return a java numeric, either Double or Long, depending on the underlying container.
      Specified by:
      getNumber in class NumericResultNode
      Returns:
      The underlying numeric value.
    • onCmp

      protected int onCmp(ResultNode rhs)
      Description copied from class: ResultNode
      This method must be implemented by all subclasses of this to allow ordering of results. This method is used by the Cloneable implementation.
      Specified by:
      onCmp in class ResultNode
      Parameters:
      rhs - The other node to compare with.
      Returns:
      Comparable result.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class com.yahoo.vespa.objects.Identifiable
    • visitMembers

      public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
      Overrides:
      visitMembers in class com.yahoo.vespa.objects.Identifiable
    • set

      public void set(ResultNode rhs)
      Description copied from class: ResultNode
      This method must be implemented by all subclasses of this to allow new results to be calculated.
      Specified by:
      set in class ResultNode
      Parameters:
      rhs - The node to get the result from.
    • getNegativeInfinity

      public static IntegerResultNode getNegativeInfinity()
      Will provide the smallest possible value
      Returns:
      the smallest possible IntegerResultNode
    • getPositiveInfinity

      public static IntegerResultNode getPositiveInfinity()
      Will provide the largest possible value
      Returns:
      the smallest largest IntegerResultNode