com.davisor.data
Class LongData

java.lang.Object
  extended byjava.lang.Number
      extended bycom.davisor.data.SimpleNumberValue
          extended bycom.davisor.data.LongData
All Implemented Interfaces:
java.lang.Comparable, Data, DataValue, com.davisor.core.Dupable, NumberValue, java.io.Serializable, SerializableData

public class LongData
extends SimpleNumberValue
implements com.davisor.core.Dupable

LongData represents long valued number data. The data value inside may also be null. This indicates that the number value of this object is undetermined.

Since:
JDK1.1
See Also:
LongType, Serialized Form

Field Summary
 
Fields inherited from class com.davisor.data.SimpleNumberValue
M_type, M_value
 
Constructor Summary
LongData()
          Construct a new long data object with the default type and value (0).
LongData(long value)
          Construct a new long data object with the default type and given value.
LongData(LongData data)
          Shallow copy constructor.
LongData(LongData data, boolean deep)
          Deep or shallow copy constructor.
LongData(LongType type, java.lang.String stringValue, java.text.ParsePosition status)
          Creates a long data value from a string value.
LongData(java.lang.Number value)
          Constructs a long data object with the default type and given value.
LongData(NumberType type)
          Construct a new long data object with the given type and default value (0).
LongData(NumberType type, long value)
          Construct a new long data object with the given type and value.
LongData(NumberType type, java.lang.Number value)
          Construct a new long data object with the given type and value.
 
Method Summary
 DataValue abs()
          Returns absolute data value of current value.
 com.davisor.core.Dupable dup()
          Makes a deep copy of this object.
 DataValue negate()
          Returns the negation of current value.
 void setValue(double value)
          Sets the data double value.
 void setValue(long value)
          Sets the data long value.
 void setValue(java.lang.Number value)
          Sets data Number value.
 void setValue(java.lang.String stringValue, java.text.ParsePosition status)
          Sets data value from a string value.
 void toStatement(java.sql.PreparedStatement statement, int parameter)
          Converts data to a prepared statement input parameter.
 
Methods inherited from class com.davisor.data.SimpleNumberValue
add, byteValue, ceil, compareTo, deinterpolate, div, doubleValue, equals, floatValue, floor, getFormat, getFormat, getType, hashCode, interpolate, intValue, isNull, longValue, max, min, mul, numberValue, setValue, setValue, setValue, setValue, shortValue, sub, toString, toXML, unit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongData

public LongData()
Construct a new long data object with the default type and value (0).

See Also:
LongData(NumberType,long)

LongData

public LongData(LongData data)
Shallow copy constructor.

Parameters:
data - source data (may be null)
See Also:
SimpleNumberValue.SimpleNumberValue(SimpleNumberValue,boolean)

LongData

public LongData(LongData data,
                boolean deep)
Deep or shallow copy constructor. If it is shallow, then the new object shares an underlying type with the original object. If it is deep, then the type is dupped.

Parameters:
data - source data (may be null)
deep - determines if the copying is deep or shallow
See Also:
SimpleNumberValue.SimpleNumberValue(SimpleNumberValue,boolean)

LongData

public LongData(java.lang.Number value)
Constructs a long data object with the default type and given value.

Parameters:
value - data value (may be null)
See Also:
SimpleNumberValue.SimpleNumberValue(NumberType,Number)

LongData

public LongData(long value)
Construct a new long data object with the default type and given value.

Parameters:
value - data value
See Also:
LongData(NumberType,long)

LongData

public LongData(NumberType type)
Construct a new long data object with the given type and default value (0).

Parameters:
type - the type of data (may be null)
See Also:
LongData(NumberType,long)

LongData

public LongData(NumberType type,
                java.lang.Number value)
Construct a new long data object with the given type and value.

Parameters:
type - the type of data (may be null)
value - data value (may be null)
See Also:
SimpleNumberValue.SimpleNumberValue(NumberType,Number)

LongData

public LongData(NumberType type,
                long value)
Construct a new long data object with the given type and value.

Parameters:
type - the type of data (may be null)
value - data value
See Also:
SimpleNumberValue.SimpleNumberValue(NumberType,Number)

LongData

public LongData(LongType type,
                java.lang.String stringValue,
                java.text.ParsePosition status)
         throws InvalidDataException
Creates a long data value from a string value.

Parameters:
type - the type of data (may be null)
stringValue - string value to be parsed (may be null)
status - parse status (may be null)
Throws:
InvalidDataException - if string value could not be parser
See Also:
setValue(String,ParsePosition)
Method Detail

abs

public DataValue abs()
              throws InvalidDataException
Returns absolute data value of current value.

Absolute values must satisfy a requirement that when added to any other value, the result must be greater than or equal to the original value.

Specified by:
abs in interface DataValue
Specified by:
abs in class SimpleNumberValue
Returns:
a new data object, sharing the current type of this object
Throws:
InvalidDataException - if absolute value can not be computed

negate

public DataValue negate()
                 throws InvalidDataException
Returns the negation of current value.

Specified by:
negate in interface DataValue
Specified by:
negate in class SimpleNumberValue
Returns:
a new data object, sharing the current type of this object
Throws:
InvalidDataException - if absolute value can not be computed

setValue

public void setValue(java.lang.String stringValue,
                     java.text.ParsePosition status)
              throws InvalidDataException
Sets data value from a string value.

Specified by:
setValue in interface DataValue
Parameters:
stringValue - string value to be parsed (may be null)
status - parse status (may be null)
Throws:
InvalidDataException - if string value could not be parser
See Also:
SimpleNumberType.longValue(String,ParsePosition)

toStatement

public void toStatement(java.sql.PreparedStatement statement,
                        int parameter)
                 throws java.sql.SQLException
Converts data to a prepared statement input parameter.

Specified by:
toStatement in interface DataValue
Throws:
java.sql.SQLException - if a SQL error occurs.

dup

public com.davisor.core.Dupable dup()
Makes a deep copy of this object.

Specified by:
dup in interface com.davisor.core.Dupable

setValue

public void setValue(double value)
              throws InvalidDataException
Sets the data double value.

Specified by:
setValue in interface NumberValue
Specified by:
setValue in class SimpleNumberValue
Throws:
InvalidDataException - if the value cannot be converted to an long value

setValue

public void setValue(long value)
              throws InvalidDataException
Sets the data long value.

Specified by:
setValue in interface NumberValue
Specified by:
setValue in class SimpleNumberValue
Throws:
InvalidDataException - never

setValue

public void setValue(java.lang.Number value)
              throws InvalidDataException
Sets data Number value.

Specified by:
setValue in interface NumberValue
Specified by:
setValue in class SimpleNumberValue
Throws:
InvalidDataException - never


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.