com.davisor.data
Class IntegerData

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

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

IntegerData represents generic integer 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:
IntegerType, Serialized Form

Field Summary
 
Fields inherited from class com.davisor.data.SimpleNumberValue
M_type, M_value
 
Constructor Summary
IntegerData()
          Construct a new integer data object with the default type and value (0).
IntegerData(int value)
          Construct a new integer data object with the default type and given value.
IntegerData(IntegerData data)
          Shallow copy constructor.
IntegerData(IntegerData data, boolean deep)
          Deep or shallow copy constructor.
IntegerData(java.lang.Number value)
          Constructs a integer data object with the default type and given value.
IntegerData(NumberType type)
          Construct a new integer data object with the given type and default value (0).
IntegerData(NumberType type, int value)
          Construct a new integer data object with the given type and value.
IntegerData(NumberType type, java.lang.Number value)
          Construct a new integer data object with the given type and value.
IntegerData(NumberType type, java.lang.String stringValue, java.text.ParsePosition status)
          Creates a integer data value from a string 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(int value)
          Sets the data integer value.
 void setValue(long value)
          Sets the data integer 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, shortValue, sub, toString, toXML, unit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerData

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


IntegerData

public IntegerData(IntegerData data)
Shallow copy constructor.

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

IntegerData

public IntegerData(IntegerData 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)

IntegerData

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

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

IntegerData

public IntegerData(int value)
Construct a new integer data object with the default type and given value.

Parameters:
value - data value
See Also:
IntegerData(NumberType,int)

IntegerData

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

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

IntegerData

public IntegerData(NumberType type,
                   java.lang.Number value)
Construct a new integer 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)

IntegerData

public IntegerData(NumberType type,
                   int value)
Construct a new integer 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)

IntegerData

public IntegerData(NumberType type,
                   java.lang.String stringValue,
                   java.text.ParsePosition status)
            throws InvalidDataException
Creates a integer 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
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.intValue(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 integer value

setValue

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

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

setValue

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

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

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.