Class Value

java.lang.Object
com.sparsity.sparksee.gdb.Value

public class Value extends Object
Value class.

It is a container which stores a value and its data type (domain). A Value can be NULL.

Author:
Sparsity Technologies http://www.sparsity-technologies.com
  • Field Details

    • MaxLengthString

      public static int MaxLengthString
      Maximum number of characters allowed for a String.

  • Constructor Details

    • Value

      public Value()
      Creates a new instance.

      It creates a NULL Value.

    • Value

      public Value(Value value)
      Copy constructor.

      Parameters:
      value - [in] Value to be copied.
  • Method Details

    • equals

      public boolean equals(Object other)

      Overrides:
      equals in class Object
      Parameters:
      other - null
    • getTimestamp

      public long getTimestamp()
      Gets Timestamp Value.

      This must be a non-NULL Timestamp Value.

      Returns:
      The Timestamp Value.
    • getLong

      public long getLong()
      Gets Long Value.

      This must be a non-NULL Long Value.

      Returns:
      The Long Value.
    • setNull

      public Value setNull()
      Sets the Value to NULL.

      Returns:
      The calling instance.
    • setInteger

      public Value setInteger(int value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.
    • setDoubleVoid

      public void setDoubleVoid(double value)
      Sets the Value.

      Parameters:
      value - [in] New Double value.
    • toString

      public String toString(String str)
      Gets a string representation of the Value.

      Parameters:
      str - String to be used. It is cleared and set with the string representation of the Value.
      Returns:
      The given string which has been updated.
    • setOID

      public Value setOID(long value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.
    • getInteger

      public int getInteger()
      Gets Integer Value.

      This must be a non-NULL Integer Value.

      Returns:
      The Integer Value.
    • getTimestampAsCalendar

      public Calendar getTimestampAsCalendar()
      Gets the Value as a Calendar instance.

      Returns:
      The returning Calendar instance.
    • setDouble

      public Value setDouble(double value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.
    • getTimestampAsDate

      public Date getTimestampAsDate()
      Gets the Value as a Date instance.

      Returns:
      The returning Date instance.
    • setTimestampVoid

      public void setTimestampVoid(int year, int month, int day, int hour, int minutes, int seconds, int millisecs)
      Sets the Value.

      year[in] The year (>=1970).

      Parameters:
      year - [in] The year (>=1970).
      month - [in] The month ([1..12]).
      day - [in] The of the month ([1..31]).
      hour - [in] The hour ([0..23]).
      minutes - [in] The minutes ([0..59]).
      seconds - [in] The seconds ([0..59]).
      millisecs - [in] The milliseconds ([0..999]).
    • equals

      public boolean equals(Value value)
      Compares with the given Value.

      It does not work if the given Value objects does not have the same DataType.

      Parameters:
      value - Given value to compare to.
      Returns:
      TRUE if this Value is equal to the given one; FALSE otherwise.
    • setBooleanVoid

      public void setBooleanVoid(boolean value)
      Sets the Value.

      Parameters:
      value - [in] New Boolean value.
    • hashCode

      public int hashCode()

      Overrides:
      hashCode in class Object
    • setOIDVoid

      public void setOIDVoid(long value)
      Sets the OID Value.

      Parameters:
      value - [in] New OID value.
    • compareTo

      public int compareTo(Value value)
      See compare().

      Parameters:
      value - null
    • setLongVoid

      public void setLongVoid(long value)
      Sets the Value.

      Parameters:
      value - [in] New Long value.
    • setTimestamp

      public Value setTimestamp(int year, int month, int day, int hour, int minutes, int seconds, int millisec)
      Sets the Value.

      Parameters:
      year - The year (>=1970).
      month - The month ([1..12]).
      day - The day of the month ([1..31]).
      hour - The hour ([0..23]).
      minutes - The minutes ([0..59]).
      seconds - The seconds ([0..59]).
      millisec - The milliseconds ([0..999]).
      Returns:
      The calling instance.
    • compare

      public int compare(Value value)
      Compares with the given Value.

      It does not work if the given Value objects does not have the same DataType.

      Parameters:
      value - Given value to compare to.
      Returns:
      0 if this Value is equal to the given one; a value less than 0 if this Value is less than the given one; and a value greater than 0 if this Value is greater than the given one.
    • getOID

      public long getOID()
      Gets OID Value.

      This must be an non-NULL OID Value.

      Returns:
      The OID Value.
    • getBoolean

      public boolean getBoolean()
      Gets Boolean Value.

      This must be a non-NULL Boolean Value.

      Returns:
      The Boolean Value.
    • set

      public Value set(Value value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.
    • setTimestamp

      public Value setTimestamp(Calendar value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.
    • getDataType

      public DataType getDataType()
      Gets the DataType.

      Value cannot be NULL.

      Returns:
      The DataType.
    • setTimestamp

      public Value setTimestamp(Date value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.
    • compareTo

      public int compareTo(Object value)
      See compare().

      This just works if the given object is a Value instance.

      Parameters:
      value - null
    • setLong

      public Value setLong(long value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.
    • setString

      public Value setString(String value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.
    • getDouble

      public double getDouble()
      Gets Double Value.

      This must be a non-NULL Double Value.

      Returns:
      The Double Value.
    • setStringVoid

      public void setStringVoid(String value)
      Sets the Value.

      Parameters:
      value - [in] New String value.
    • setVoid

      public void setVoid(Value value)
      Sets the Value.

      Parameters:
      value - [in] New value.
    • setTimestampVoid

      public void setTimestampVoid(long value)
      Sets the Value.

      Parameters:
      value - [in] New Timestamp value.
    • toString

      public String toString()
      Gets a String representation of the Value.

      Overrides:
      toString in class Object
    • setIntegerVoid

      public void setIntegerVoid(int value)
      Sets the Value.

      Parameters:
      value - [in] New Integer value.
    • isNull

      public boolean isNull()
      Gets if this is a NULL Value.

      Returns:
      TRUE if this is a NULL Value, FALSE otherwise.
    • getString

      public String getString()
      Gets String Value.

      This must be a non-NULL String Value.

      Returns:
      The String Value.
    • setNullVoid

      public void setNullVoid()
      Sets the Value to NULL.

    • setBoolean

      public Value setBoolean(boolean value)
      Sets the Value.

      Parameters:
      value - New value.
      Returns:
      The calling instance.