com.sparsity.sparksee.gdb
Class Value

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

public class Value
extends java.lang.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 Summary
static int MaxLengthString
          Maximum number of characters allowed for a String.
 
Constructor Summary
Value()
          Creates a new instance.
Value(Value value)
          Copy constructor.
 
Method Summary
 int compare(Value value)
          Compares with the given Value.
 int compareTo(java.lang.Object value)
          See compare().
 int compareTo(Value value)
          See compare().
 boolean equals(java.lang.Object other)
          
 boolean equals(Value value)
          Compares with the given Value.
 boolean getBoolean()
          Gets Boolean Value.
 DataType getDataType()
          Gets the DataType.
 double getDouble()
          Gets Double Value.
 int getInteger()
          Gets Integer Value.
 long getLong()
          Gets Long Value.
 long getOID()
          Gets OID Value.
 java.lang.String getString()
          Gets String Value.
 long getTimestamp()
          Gets Timestamp Value.
 java.util.Calendar getTimestampAsCalendar()
          Gets the Value as a Calendar instance.
 java.util.Date getTimestampAsDate()
          Gets the Value as a Date instance.
 int hashCode()
          
 boolean isNull()
          Gets if this is a NULL Value.
 Value set(Value value)
          Sets the Value.
 Value setBoolean(boolean value)
          Sets the Value.
 void setBooleanVoid(boolean value)
          Sets the Value.
 Value setDouble(double value)
          Sets the Value.
 void setDoubleVoid(double value)
          Sets the Value.
 Value setInteger(int value)
          Sets the Value.
 void setIntegerVoid(int value)
          Sets the Value.
 Value setLong(long value)
          Sets the Value.
 void setLongVoid(long value)
          Sets the Value.
 Value setNull()
          Sets the Value to NULL.
 void setNullVoid()
          Sets the Value to NULL.
 Value setOID(long value)
          Sets the Value.
 void setOIDVoid(long value)
          Sets the OID Value.
 Value setString(java.lang.String value)
          Sets the Value.
 void setStringVoid(java.lang.String value)
          Sets the Value.
 Value setTimestamp(java.util.Calendar value)
          Sets the Value.
 Value setTimestamp(java.util.Date value)
          Sets the Value.
 Value setTimestamp(int year, int month, int day, int hour, int minutes, int seconds, int millisec)
          Sets the Value.
 void setTimestampVoid(int year, int month, int day, int hour, int minutes, int seconds, int millisecs)
          Sets the Value.
 void setTimestampVoid(long value)
          Sets the Value.
 void setVoid(Value value)
          Sets the Value.
 java.lang.String toString()
          Gets a String representation of the Value.
 java.lang.String toString(java.lang.String str)
          Gets a string representation of the Value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MaxLengthString

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

Constructor Detail

Value

public Value(Value value)
Copy constructor.

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

Value

public Value()
Creates a new instance.

It creates a NULL Value.

Method Detail

setLongVoid

public void setLongVoid(long value)
Sets the Value.

Parameters:
value - [in] New Long value.

setTimestamp

public Value setTimestamp(java.util.Date value)
Sets the Value.

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

getTimestampAsCalendar

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

Returns:
The returning Calendar instance.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object
Parameters:
other - null

getOID

public long getOID()
Gets OID Value.

This must be an non-NULL OID Value.

Returns:
The OID Value.

set

public Value set(Value value)
Sets the Value.

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

setString

public Value setString(java.lang.String value)
Sets the Value.

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

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

setBoolean

public Value setBoolean(boolean value)
Sets the Value.

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

getBoolean

public boolean getBoolean()
Gets Boolean Value.

This must be a non-NULL Boolean Value.

Returns:
The Boolean Value.

setDouble

public Value setDouble(double value)
Sets the Value.

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

setNullVoid

public void setNullVoid()
Sets the Value to NULL.


setTimestampVoid

public void setTimestampVoid(long value)
Sets the Value.

Parameters:
value - [in] New Timestamp value.

setStringVoid

public void setStringVoid(java.lang.String value)
Sets the Value.

Parameters:
value - [in] New String value.

setIntegerVoid

public void setIntegerVoid(int value)
Sets the Value.

Parameters:
value - [in] New Integer value.

getDataType

public DataType getDataType()
Gets the DataType.

Value cannot be NULL.

Returns:
The DataType.

setLong

public Value setLong(long value)
Sets the Value.

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

getTimestampAsDate

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

Returns:
The returning Date instance.

getString

public java.lang.String getString()
Gets String Value.

This must be a non-NULL String Value.

Returns:
The String Value.

setDoubleVoid

public void setDoubleVoid(double value)
Sets the Value.

Parameters:
value - [in] New Double value.

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.

isNull

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

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

setVoid

public void setVoid(Value value)
Sets the Value.

Parameters:
value - [in] New 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.

setTimestampVoid

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

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]).

setOIDVoid

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

Parameters:
value - [in] New OID value.

getDouble

public double getDouble()
Gets Double Value.

This must be a non-NULL Double Value.

Returns:
The Double Value.

toString

public java.lang.String toString(java.lang.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.

setNull

public Value setNull()
Sets the Value to NULL.

Returns:
The calling instance.

setOID

public Value setOID(long value)
Sets the Value.

Parameters:
value - New value.
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.

getLong

public long getLong()
Gets Long Value.

This must be a non-NULL Long Value.

Returns:
The Long Value.

compareTo

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

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

Parameters:
value - null

setBooleanVoid

public void setBooleanVoid(boolean value)
Sets the Value.

Parameters:
value - [in] New Boolean value.

toString

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

Overrides:
toString in class java.lang.Object

getTimestamp

public long getTimestamp()
Gets Timestamp Value.

This must be a non-NULL Timestamp Value.

Returns:
The Timestamp Value.

setTimestamp

public Value setTimestamp(java.util.Calendar value)
Sets the Value.

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

setInteger

public Value setInteger(int 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.

compareTo

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

Parameters:
value - null