com.crystaldecisions.reports.common.value
Class NumberValue

java.lang.Object
  extended byCrystalValue
      extended bycom.crystaldecisions.reports.common.value.FormulaValue
          extended bycom.crystaldecisions.reports.common.value.NumericValue
              extended bycom.crystaldecisions.reports.common.value.NumberValue
All Implemented Interfaces:
java.lang.Comparable

public final class NumberValue
extends NumericValue

Provides methods for converting native Java types to a format understood by the Crystal Reports Formula Language. All Java user defined functions must return a FormulaValue object.

See Also:
Serialized Form

Field Summary
static NumberValue one
           A NumberValue with a value of 1.
static NumberValue ten
           A NumberValue with a value of 10.
static NumberValue two
           A NumberValue with a value of 2.
static NumberValue zero
           A NumberValue with a value of 0.
 
Fields inherited from class com.crystaldecisions.reports.common.value.NumericValue
nExactDecimalPlaces, scalingFactor
 
Method Summary
 FormulaValue coerceToBoolean()
           Internal use only.
 FormulaValue coerceToCurrency()
           Internal use only.
 FormulaValue coerceToNumber()
           Internal use only.
 int compareTo(java.lang.Object obj)
           Internal use only.
static NumberValue fromCurrencyValue(CurrencyValue currencyValue)
           Returns a NumberValue object that represents the given CurrencyValue object.
static NumberValue fromDouble(double value)
           Returns a NumberValue object that represents the given double value.
static NumberValue fromLong(long value)
           Returns a NumberValue object that represents the given long value.
static NumberValue fromScaledDouble(double scaledDouble)
           Returns a NumberValue object that represents the value of scaledDouble / scalingFactor.
static NumberValue fromScaledLong(long scaledLong)
           Returns a NumberValue object that represents the value of scaledLong / scalingFactor.
 ValueType getValueType()
           Gets the ValueType of this NumberValue object.
 java.lang.String toString()
           Returns a String that represents this NumberValue as a String.
 
Methods inherited from class com.crystaldecisions.reports.common.value.NumericValue
compareTo, equals, fromDouble, fromLong, fromNumericValue, fromScaledDouble, fromScaledLong, getDouble, getInt, getLong, getNormalizedNumericValue, getScaledDouble, getScaledInt, getScaledLong, hashCode, isIntegerValue
 
Methods inherited from class com.crystaldecisions.reports.common.value.FormulaValue
coerce, coerceToArray, coerceToArray, coerceToBoolean, coerceToCurrency, coerceToDate, coerceToDate, coerceToDateTime, coerceToDateTime, coerceToNumber, coerceToRange, coerceToRange, coerceToRangeArray, coerceToRangeArray, coerceToString, coerceToString, coerceToTime, coerceToTime, getFormulaValueType, makeZeroValue
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

zero

public static final NumberValue zero

A NumberValue with a value of 0.


one

public static final NumberValue one

A NumberValue with a value of 1.


two

public static final NumberValue two

A NumberValue with a value of 2.


ten

public static final NumberValue ten

A NumberValue with a value of 10.

Method Detail

fromScaledDouble

public static NumberValue fromScaledDouble(double scaledDouble)

Returns a NumberValue object that represents the value of scaledDouble / scalingFactor.

Parameters:
scaledDouble - a double with a value equal to actualValue * scalingFactor
Returns:
a NumberValue object that represents the value of scaledDouble / scalingFactor

fromScaledLong

public static NumberValue fromScaledLong(long scaledLong)

Returns a NumberValue object that represents the value of scaledLong / scalingFactor.

Returns:
a NumberValue object that represents the value of scaledLong / scalingFactor

fromDouble

public static NumberValue fromDouble(double value)

Returns a NumberValue object that represents the given double value.

Parameters:
value - the double value to be represented
Returns:
a NumberValue object that represents the given double value

fromLong

public static NumberValue fromLong(long value)

Returns a NumberValue object that represents the given long value.

Parameters:
value - the long value to be represented
Returns:
a NumberValue object that represents the given long value

fromCurrencyValue

public static NumberValue fromCurrencyValue(CurrencyValue currencyValue)

Returns a NumberValue object that represents the given CurrencyValue object.

Parameters:
currencyValue - the CurrencyValue object to be represented
Returns:
a NumberValue object that represents the given CurrencyValue object

coerceToNumber

public FormulaValue coerceToNumber()

Internal use only.

Overrides:
coerceToNumber in class FormulaValue

coerceToCurrency

public FormulaValue coerceToCurrency()

Internal use only.

Overrides:
coerceToCurrency in class FormulaValue

coerceToBoolean

public FormulaValue coerceToBoolean()

Internal use only.

Overrides:
coerceToBoolean in class FormulaValue

getValueType

public ValueType getValueType()

Gets the ValueType of this NumberValue object.

Returns:
ValueType.number

compareTo

public int compareTo(java.lang.Object obj)

Internal use only.

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class NumericValue

toString

public java.lang.String toString()

Returns a String that represents this NumberValue as a String. The String is of the form: "c(42.37)".

Overrides:
toString in class NumericValue
Returns:
a String that represents this NumberValue as a String