Class Value

java.lang.Object
net.quasardb.qdb.ts.Value
All Implemented Interfaces:
Serializable, Comparable<Value>

public class Value extends Object implements Serializable, Comparable<Value>
Represents a timeseries value.
See Also:
  • Constructor Details

    • Value

      public Value()
    • Value

      protected Value(Value.Type type)
    • Value

      public Value(Value value)
      Creates new value out of this value, that is, copies the underlying value.
  • Method Details

    • createNull

      public static Value createNull()
      Create a null / empty value.
    • setNative

      public void setNative(long batchTable, Value.Type columnType, int offset)
    • setNull

      public void setNull()
      Updates value to represent an unintialised value.
    • isNull

      public boolean isNull()
      Returns true if this value is null.
    • createInt64

      public static Value createInt64(long value)
      Represents a long integer
    • setInt64

      public void setInt64(long value)
      Updates value to take a certain long integer value;
    • createDouble

      public static Value createDouble(double value)
      Represents a double value.
    • setDouble

      public void setDouble(double value)
      Updates value to take a certain double value;
    • createTimestamp

      public static Value createTimestamp(Timespec value)
      Represents a timestamp
    • setTimestamp

      public void setTimestamp(Timespec value)
      Updates value to take a certain timestamp;
    • createBlob

      public static Value createBlob(byte[] value)
      Represents a blob value. Warning: assumes byte array will stay in memory for as long as this object lives.
    • createBlob

      public static Value createBlob(ByteBuffer value)
      Represents blob value. Warning: assumes bytebuffer will stay in memory for as long as this object lives.
    • setBlob

      public void setBlob(byte[] value)
      Updates value to take a certain blob value. Warning: assumes byte array will stay in memory for as long as this object lives.
    • setBlob

      public void setBlob(ByteBuffer value)
      Updates value to take a certain blob value;
    • setSafeBlob

      public void setSafeBlob(byte[] value)
      Updates value to take a certain blob value. Will create a copy of the byte array.
    • setSafeBlob

      public void setSafeBlob(ByteBuffer value)
      Updates value to take a certain blob value. Will create copy of the byte array.
    • createSafeBlob

      public static Value createSafeBlob(byte[] value)
      Represents a safe blob value that copies the byte array.
    • createSafeBlob

      public static Value createSafeBlob(ByteBuffer value)
      Creates a copy of a ByteBuffer into this Value.
    • setString

      public void setString(String value)
      Update this value to be a String.
    • createString

      public static Value createString(String value)
      Create a new String value.
      Parameters:
      value - String representation of value.
    • ensureByteBufferBackedString

      public Value ensureByteBufferBackedString()
      If this Value's type is a string, ensures that it creates a directly allocated ByteBuffer with a copy of the UTF-8 string representation. Because this implies that the String is then represented as a direct ByteBuffer with a 'stable' memory region behind it, it'll allow us to use this buffer in native code safely for extended periods of time without requiring a copy.
      Returns:
      Returns this value.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Value rhs)
      Specified by:
      compareTo in interface Comparable<Value>
    • getType

      public Value.Type getType()
    • getInt64

      public long getInt64()
    • getDouble

      public double getDouble()
    • getTimestamp

      public Timespec getTimestamp()
    • getBlob

      public ByteBuffer getBlob()
    • getString

      public String getString()
    • toString

      public String toString()
      Overrides:
      toString in class Object