|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Number
com.davisor.data.SimpleNumberValue
com.davisor.data.BigIntegerData
BigIntegerData represents arbitrary precision integer number data.
The data value inside may also be null. This indicates
that the number value of this object is undetermined.
BigIntegerType,
Serialized Form| Field Summary | |
static int |
PRECISION
Deinterpolation scale precision (10). |
static java.math.BigInteger |
TEN
Constant big integer value of 10. |
| Fields inherited from class com.davisor.data.SimpleNumberValue |
M_type, M_value |
| Constructor Summary | |
BigIntegerData()
Construct a new big integer data object with the default type and value (BigInteger.ZERO). |
|
BigIntegerData(BigIntegerData data)
Shallow copy constructor. |
|
BigIntegerData(BigIntegerData data,
boolean deep)
Deep or shallow copy constructor. |
|
BigIntegerData(BigIntegerType type,
java.lang.String stringValue,
java.text.ParsePosition status)
Creates a big integer data value from a string value. |
|
BigIntegerData(long value)
Construct a new big integer data object with the default type and given value. |
|
BigIntegerData(java.lang.Number value)
Constructs a big integer data object with the default type and given value. |
|
BigIntegerData(NumberType type)
Construct a new integer data object with the given big type and default value (BigInteger.ZERO). |
|
BigIntegerData(NumberType type,
long value)
Construct a new big integer data object with the given type and value. |
|
BigIntegerData(NumberType type,
java.lang.Number value)
Construct a new big integer data object with the given type and value. |
|
| Method Summary | |
DataValue |
abs()
Returns absolute data value of current value. |
DataValue |
add(DataValue value)
Adds data values. |
DataValue |
ceil(DataValue precision)
Quantizes the current value up to an even value within given precision. |
double |
deinterpolate(DataValue min,
DataValue max)
De-interpolates the current data value to a scalar value, in respect, with the given data value range. |
com.davisor.core.Dupable |
dup()
Makes a deep copy of this object. |
DataValue |
floor(DataValue precision)
Quantizes the current value down to an even value within given precision. |
DataValue |
interpolate(double value,
DataValue max)
Interpolates the given scalar value to data value, in respect, with the range defined by this value and the given maximum value. |
DataValue |
negate()
Returns the negation of current value. |
void |
setValue(double value)
Sets the data double value. |
void |
setValue(long value)
Sets the data integer value. |
void |
setValue(java.lang.Number value)
Sets the data Number value. |
void |
setValue(java.lang.String stringValue,
java.text.ParsePosition status)
Sets data value from a string value. |
DataValue |
sub(DataValue value)
Substracts a data value. |
void |
toStatement(java.sql.PreparedStatement statement,
int parameter)
Converts data to a prepared statement input parameter. |
DataValue |
unit(DataValue targetValue,
double maxSteps)
Gets the largest suitable unit step to represent a value change between this value and the given target value. |
| Methods inherited from class com.davisor.data.SimpleNumberValue |
byteValue, compareTo, div, doubleValue, equals, floatValue, getFormat, getFormat, getType, hashCode, intValue, isNull, longValue, max, min, mul, numberValue, setValue, setValue, setValue, setValue, shortValue, toString, toXML |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.math.BigInteger TEN
public static final int PRECISION
| Constructor Detail |
public BigIntegerData()
public BigIntegerData(BigIntegerData data)
data - source data (may be null)SimpleNumberValue.SimpleNumberValue(SimpleNumberValue,boolean)
public BigIntegerData(BigIntegerData data,
boolean deep)
data - source data (may be null)deep - determines if the copying is deep or shallowSimpleNumberValue.SimpleNumberValue(SimpleNumberValue,boolean)public BigIntegerData(java.lang.Number value)
value - data value (may be null)SimpleNumberValue.SimpleNumberValue(NumberType,Number)public BigIntegerData(long value)
value - data valueBigIntegerData(NumberType,long)public BigIntegerData(NumberType type)
BigIntegerData(NumberType,long)
public BigIntegerData(NumberType type,
java.lang.Number value)
type - the type of data (may be null)value - data value (may be null)SimpleNumberValue.SimpleNumberValue(NumberType,Number)
public BigIntegerData(NumberType type,
long value)
type - the type of data (may be null)value - data valueSimpleNumberValue.SimpleNumberValue(NumberType,Number)
public BigIntegerData(BigIntegerType type,
java.lang.String stringValue,
java.text.ParsePosition status)
throws InvalidDataException
type - the type of data (may be null)stringValue - string value to be parsed (may be null)status - parse status (may be null)
InvalidDataException - if string value could not be parsersetValue(String,ParsePosition)| Method Detail |
public DataValue abs()
throws InvalidDataException
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.
abs in interface DataValueabs in class SimpleNumberValueInvalidDataException - if absolute value can not be computed
public DataValue add(DataValue value)
throws InvalidDataException
add in interface DataValueadd in class SimpleNumberValuevalue - a data value to be added to this data value
InvalidDataException - if the data values cannot be added
public DataValue ceil(DataValue precision)
throws InvalidDataException
ceil in interface DataValueceil in class SimpleNumberValueprecision - the precision within the quantization occurs
InvalidDataException - if precision was of unacceptable typefloor(com.davisor.data.DataValue)
public double deinterpolate(DataValue min,
DataValue max)
throws InvalidDataException
Big integer values are de-interpolated with the equation:
(thisValue - minValue) / (maxValue - minValue)
deinterpolate in interface DataValuedeinterpolate in class SimpleNumberValuemin - a data value representing a range's lower limitmax - a data value representing a range's higher limit
InvalidDataException - if the de-interpolation fails
public DataValue floor(DataValue precision)
throws InvalidDataException
floor in interface DataValuefloor in class SimpleNumberValueprecision - the precision within the quantization occurs
InvalidDataException - if precision was of unacceptable typeceil(com.davisor.data.DataValue)
public DataValue interpolate(double value,
DataValue max)
throws InvalidDataException
All number values can interpolate with this simple equation:
minValue + value * (maxValue - minValue)
interpolate in interface DataValueinterpolate in class SimpleNumberValuevalue - the scalar value to be interpolatedmax - a data value representing a range's higher limit
InvalidDataException - if interpolation fails
public DataValue negate()
throws InvalidDataException
negate in interface DataValuenegate in class SimpleNumberValueInvalidDataException - if absolute value can not be computed
public void setValue(java.lang.String stringValue,
java.text.ParsePosition status)
throws InvalidDataException
setValue in interface DataValuestringValue - string value to be parsed (may be null)status - parse status (may be null)
InvalidDataException - if string value could not be parserBigIntegerType.decode(String,ParsePosition)
public DataValue sub(DataValue value)
throws InvalidDataException
sub in interface DataValuesub in class SimpleNumberValuevalue - a data value to be substracted from this data value
InvalidDataException - if value can not be
substracted.
public void toStatement(java.sql.PreparedStatement statement,
int parameter)
throws java.sql.SQLException
toStatement in interface DataValuejava.sql.SQLException - if a SQL error occurs.
public DataValue unit(DataValue targetValue,
double maxSteps)
throws InvalidDataException
unit in interface DataValueunit in class SimpleNumberValuetargetValue - target value to be reached (may be null)maxSteps - maximum number of steps (zero leaves the choise open)
InvalidDataException - if target value is unsuitablepublic com.davisor.core.Dupable dup()
dup in interface com.davisor.core.Dupable
public void setValue(double value)
throws InvalidDataException
setValue in interface NumberValuesetValue in class SimpleNumberValueInvalidDataException - if the value cannot
be converted to an integer value
public void setValue(long value)
throws InvalidDataException
setValue in interface NumberValuesetValue in class SimpleNumberValueInvalidDataException - if the value cannot
be converted to an integer value
public void setValue(java.lang.Number value)
throws InvalidDataException
setValue in interface NumberValuesetValue in class SimpleNumberValueInvalidDataException - never
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||