org.apache.derby.iapi.types
Interface NumberDataValue

All Superinterfaces:
DataValueDescriptor, java.io.Externalizable, Formatable, Orderable, java.io.Serializable, Storable, TypedFormat
All Known Implementing Classes:
NumberDataType

public interface NumberDataValue
extends DataValueDescriptor


Field Summary
static int MAX_DECIMAL_PRECISION_SCALE
           
static int MIN_DECIMAL_DIVIDE_SCALE
          The minimum scale when dividing Decimals
 
Fields inherited from interface org.apache.derby.iapi.types.Orderable
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN
 
Method Summary
 NumberDataValue absolute(NumberDataValue result)
          The SQL ABSOLUTE operator.
 NumberDataValue divide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result)
          The SQL / operator.
 NumberDataValue divide(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result, int scale)
          The SQL / operator.
 NumberDataValue minus(NumberDataValue result)
          The SQL unary - operator.
 NumberDataValue minus(NumberDataValue left, NumberDataValue right, NumberDataValue result)
          The SQL - operator.
 NumberDataValue mod(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result)
          The SQL mod operator.
 NumberDataValue plus(NumberDataValue addend1, NumberDataValue addend2, NumberDataValue result)
          The SQL + operator.
 void setValue(java.lang.Boolean theValue)
          Set the value.
 void setValue(java.lang.Byte theValue)
          Set the value of this NumberDataValue to the given byte value
 void setValue(java.lang.Double theValue)
          Set the value of this NumberDataValue to the given double value
 void setValue(java.lang.Float theValue)
          Set the value of this NumberDataValue to the given float value
 void setValue(java.lang.Integer theValue)
          Set the value of this NumberDataValue to the given int value
 void setValue(java.lang.Long theValue)
          Set the value of this NumberDataValue to the given long value
 void setValue(java.lang.Short theValue)
          Set the value of this NumberDataValue to the given short value
 NumberDataValue sqrt(NumberDataValue result)
          The SQL SQRT operator.
 NumberDataValue times(NumberDataValue left, NumberDataValue right, NumberDataValue result)
          The SQL * operator.
 
Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor
checkHostVariable, coalesce, compare, compare, equals, estimateMemoryUsage, getBigDecimal, getBoolean, getByte, getBytes, getClone, getDate, getDouble, getFloat, getInt, getLength, getLong, getNewNull, getObject, getShort, getStream, getString, getTime, getTimestamp, getTypeName, greaterOrEquals, greaterThan, in, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, readExternalFromArray, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueFromResultSet, typePrecedence
 
Methods inherited from interface org.apache.derby.iapi.services.io.Storable
isNull, restoreToNull
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 
Methods inherited from interface org.apache.derby.iapi.services.io.TypedFormat
getTypeFormatId
 

Field Detail

MIN_DECIMAL_DIVIDE_SCALE

public static final int MIN_DECIMAL_DIVIDE_SCALE
The minimum scale when dividing Decimals

See Also:
Constant Field Values

MAX_DECIMAL_PRECISION_SCALE

public static final int MAX_DECIMAL_PRECISION_SCALE
See Also:
Constant Field Values
Method Detail

plus

public NumberDataValue plus(NumberDataValue addend1,
                            NumberDataValue addend2,
                            NumberDataValue result)
                     throws StandardException
The SQL + operator.

Parameters:
addend1 - One of the addends
addend2 - The other addend
result - The result of the previous call to this method, null if not called yet.
Returns:
The sum of the two addends
Throws:
StandardException - Thrown on error, if result is non-null then its value will be unchanged.

minus

public NumberDataValue minus(NumberDataValue left,
                             NumberDataValue right,
                             NumberDataValue result)
                      throws StandardException
The SQL - operator.

Parameters:
left - The left operand
right - The right operand
result - The result of the previous call to this method, null if not called yet.
Returns:
left - right
Throws:
StandardException - Thrown on error, if result is non-null then its value will be unchanged.

times

public NumberDataValue times(NumberDataValue left,
                             NumberDataValue right,
                             NumberDataValue result)
                      throws StandardException
The SQL * operator.

Parameters:
left - The left operand
right - The right operand
result - The result of the previous call to this method, null if not called yet.
Returns:
left * right
Throws:
StandardException - Thrown on error, if result is non-null then its value will be unchanged.

divide

public NumberDataValue divide(NumberDataValue dividend,
                              NumberDataValue divisor,
                              NumberDataValue result)
                       throws StandardException
The SQL / operator.

Parameters:
dividend - The numerator
divisor - The denominator
result - The result of the previous call to this method, null if not called yet.
Returns:
dividend / divisor
Throws:
StandardException - Thrown on error, if result is non-null then its value will be unchanged.

divide

public NumberDataValue divide(NumberDataValue dividend,
                              NumberDataValue divisor,
                              NumberDataValue result,
                              int scale)
                       throws StandardException
The SQL / operator.

Parameters:
dividend - The numerator
divisor - The denominator
result - The result of the previous call to this method, null if not called yet.
scale - The scale of the result, for decimal type. If pass in value < 0, can calculate it dynamically.
Returns:
dividend / divisor
Throws:
StandardException - Thrown on error, if result is non-null then its value will be unchanged.

mod

public NumberDataValue mod(NumberDataValue dividend,
                           NumberDataValue divisor,
                           NumberDataValue result)
                    throws StandardException
The SQL mod operator.

Parameters:
dividend - The numerator
divisor - The denominator
result - The result of the previous call to this method, null if not called yet.
Returns:
dividend / divisor
Throws:
StandardException - Thrown on error, if result is non-null then its value will be unchanged.

minus

public NumberDataValue minus(NumberDataValue result)
                      throws StandardException
The SQL unary - operator. Negates this NumberDataValue.

Parameters:
result - The result of the previous call to this method, null if not called yet.
Returns:
- operand
Throws:
StandardException - Thrown on error, if result is non-null then its value will be unchanged.

absolute

public NumberDataValue absolute(NumberDataValue result)
                         throws StandardException
The SQL ABSOLUTE operator. Absolute value of this NumberDataValue.

Parameters:
result - The result of the previous call to this method, null if not called yet.
Throws:
StandardException - Thrown on error, if result is non-null then its value will be unchanged.

sqrt

public NumberDataValue sqrt(NumberDataValue result)
                     throws StandardException
The SQL SQRT operator. Sqrt value of this NumberDataValue.

Parameters:
result - The result of the previous call to this method, null if not call yet.
Throws:
StandardException - Thrown on error (a negative number), if result is non-null then its value will be unchanged.

setValue

public void setValue(java.lang.Integer theValue)
              throws StandardException
Set the value of this NumberDataValue to the given int value

Parameters:
theValue - An Integer containing the value to set this NumberDataValue to. Null means set the value to SQL null.
Returns:
This NumberDataValue
Throws:
StandardException - Thrown on error

setValue

public void setValue(java.lang.Double theValue)
              throws StandardException
Set the value of this NumberDataValue to the given double value

Parameters:
theValue - A Double containing the value to set this NumberDataValue to. Null means set the value to SQL null.
Returns:
This NumberDataValue
Throws:
StandardException - Thrown on error

setValue

public void setValue(java.lang.Float theValue)
              throws StandardException
Set the value of this NumberDataValue to the given float value

Parameters:
theValue - A Float containing the value to set this NumberDataValue to. Null means set the value to SQL null.
Returns:
This NumberDataValue
Throws:
StandardException - Thrown on error

setValue

public void setValue(java.lang.Short theValue)
              throws StandardException
Set the value of this NumberDataValue to the given short value

Parameters:
theValue - A Short containing the value to set this NumberDataValue to. Null means set the value to SQL null.
Returns:
This NumberDataValue
Throws:
StandardException - Thrown on error

setValue

public void setValue(java.lang.Long theValue)
              throws StandardException
Set the value of this NumberDataValue to the given long value

Parameters:
theValue - A Long containing the value to set this NumberDataValue to. Null means set the value to SQL null.
Returns:
This NumberDataValue
Throws:
StandardException - Thrown on error

setValue

public void setValue(java.lang.Byte theValue)
              throws StandardException
Set the value of this NumberDataValue to the given byte value

Parameters:
theValue - A Byte containing the value to set this NumberDataValue to. Null means set the value to SQL null.
Returns:
This NumberDataValue
Throws:
StandardException

setValue

public void setValue(java.lang.Boolean theValue)
              throws StandardException
Set the value.

Parameters:
theValue - Contains the boolean value to set this to
Returns:
This value
Throws:
StandardException


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.