|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCrystalValue
com.crystaldecisions.reports.common.value.FormulaValue
com.crystaldecisions.reports.common.value.NumericValue
public abstract class 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.
Field Summary | |
---|---|
static int |
nExactDecimalPlaces
Two decimal places are used for a NumericValue . |
static double |
scalingFactor
The actual value of a NumericValue is multiplied by the
scalingFactor in order to produce a scaled value. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object obj)
Internal use only. |
int |
compareTo(java.lang.Object obj,
java.util.Comparator stringComparator)
Internal use only. |
boolean |
equals(java.lang.Object obj,
boolean caseInsensitive)
Returns true if obj has the same class and value as this NumericValue object. |
static NumericValue |
fromDouble(double value,
FormulaValueType valueType)
Returns a NumberValue or CurrencyValue which
represents the given double value. |
static NumericValue |
fromLong(long value,
FormulaValueType valueType)
Returns a NumberValue or CurrencyValue which
represents the given long value. |
static NumericValue |
fromNumericValue(NumericValue numericValue,
FormulaValueType valueType)
Returns a NumberValue or CurrencyValue that represents
the given NumericValue object. |
static NumericValue |
fromScaledDouble(double scaledDouble,
FormulaValueType valueType)
Returns a NumericValue object that represents the value of scaledDouble / scalingFactor . |
static NumericValue |
fromScaledLong(long scaledLong,
FormulaValueType valueType)
Returns a NumericValue object that represents the value of scaledLong / scalingFactor . |
static double |
getAsDouble(CrystalValue value,
double defaultValue)
|
static int |
getAsInteger(CrystalValue value,
int defaultValue)
|
double |
getDouble()
Gets the unscaled value as a double . |
int |
getInt()
Gets the unscaled value as an int . |
long |
getLong()
Gets the unscaled value as a long . |
NumericValue |
getNormalizedNumericValue()
Returns a NumericValue object that contains a normalized double value. |
double |
getScaledDouble()
Gets the scaled value as a double . |
int |
getScaledInt()
Gets the scaled value as an int . |
long |
getScaledLong()
Gets the scaled value as a long . |
int |
hashCode(boolean caseInsensitive)
Returns a hash code for this NumericValue object. |
boolean |
isIntegerValue()
Returns true if the value of this NumericValue object can be represented
as an integer without any loss of magnitude or precision. |
java.lang.String |
toString()
Returns a String representation of this NumericValue object. |
Methods inherited from class com.crystaldecisions.reports.common.value.FormulaValue |
---|
coerce, coerceToArray, coerceToArray, coerceToBoolean, coerceToBoolean, coerceToCurrency, coerceToCurrency, coerceToDate, coerceToDate, coerceToDateTime, coerceToDateTime, coerceToNumber, coerceToNumber, coerceToRange, coerceToRange, coerceToRangeArray, coerceToRangeArray, coerceToString, coerceToString, coerceToTime, coerceToTime, getFormulaValueType, Load, LoadFromArchive, makeZeroValue |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double scalingFactor
The actual value of a NumericValue
is multiplied by the
scalingFactor
in order to produce a scaled value.
public static final int nExactDecimalPlaces
Two decimal places are used for a NumericValue
.
Method Detail |
---|
public static NumericValue fromScaledDouble(double scaledDouble, FormulaValueType valueType)
Returns a NumericValue
object that represents the value of scaledDouble / scalingFactor
.
scaledDouble
- a double
with a value equal to actualValue * scalingFactor
valueType
- either FormulaValueType.number
or FormulaValueType.currency
NumericValue
object that represents the value of scaledDouble / scalingFactor
java.lang.UnsupportedOperationException
- if valueType
is neither
FormulaValueType.number
nor FormulaValueType.currency
public static NumericValue fromScaledLong(long scaledLong, FormulaValueType valueType)
Returns a NumericValue
object that represents the value of scaledLong / scalingFactor
.
scaledLong
- a long
with a value equal to actualValue * scalingFactor
valueType
- either FormulaValueType.number
or FormulaValueType.currency
NumericValue
object that represents the value of scaledLong / scalingFactor
java.lang.UnsupportedOperationException
- if valueType
is neither
FormulaValueType.number
nor FormulaValueType.currency
public static NumericValue fromDouble(double value, FormulaValueType valueType)
Returns a NumberValue
or CurrencyValue
which
represents the given double
value.
value
- the double
value to be represented (no scaling has been applied)valueType
- either FormulaValueType.number
or FormulaValueType.currency
NumericValue
that represents the given double
value
java.lang.UnsupportedOperationException
- if valueType
is neither
FormulaValueType.number
nor FormulaValueType.currency
public static NumericValue fromLong(long value, FormulaValueType valueType)
Returns a NumberValue
or CurrencyValue
which
represents the given long
value.
NumericValue
uses a double to store its value. As a result,
there is a potential for a loss of precision when creating a NumericValue
from a large long
value.
value
- the long
value to be represented (no scaling has been applied)valueType
- either FormulaValueType.number
or FormulaValueType.currency
NumericValue
that represents the given long
value
java.lang.UnsupportedOperationException
- if valueType
is neither
FormulaValueType.number
nor FormulaValueType.currency
public static NumericValue fromNumericValue(NumericValue numericValue, FormulaValueType valueType)
Returns a NumberValue
or CurrencyValue
that represents
the given NumericValue
object.
numericValue
- the NumericValue
to be representedvalueType
- either FormulaValueType.number
or FormulaValueType.currency
NumericValue
object
java.lang.UnsupportedOperationException
- if valueType
is neither
FormulaValueType.number
nor FormulaValueType.currency
public final NumericValue getNormalizedNumericValue()
Returns a NumericValue
object that contains a normalized double
value.
NumericValue
object that contains a normalized double
valuepublic final double getScaledDouble()
Gets the scaled value as a double
.
double
public final long getScaledLong()
Gets the scaled value as a long
.
long
public final int getScaledInt()
Gets the scaled value as an int
.
int
public final double getDouble()
Gets the unscaled value as a double
.
double
public final long getLong()
Gets the unscaled value as a long
.
long
public final int getInt()
Gets the unscaled value as an int
.
int
public final boolean isIntegerValue()
Returns true
if the value of this NumericValue
object can be represented
as an integer without any loss of magnitude or precision.
true
if the value of this NumericValue
object can be represented
as an integer without any loss of magnitude or precision, otherwise false
public int hashCode(boolean caseInsensitive)
Returns a hash code for this NumericValue
object.
int
that is a hash code for this NumericValue
objectpublic boolean equals(java.lang.Object obj, boolean caseInsensitive)
Returns true
if obj
has the same class and value as this NumericValue
object.
obj
- the Object
to compare this NumericValue
object to
true
if obj
has the same class and value as this NumericValue
object, otherwise false
public int compareTo(java.lang.Object obj, java.util.Comparator stringComparator)
Internal use only.
public int compareTo(java.lang.Object obj)
Internal use only.
compareTo
in interface java.lang.Comparable
public java.lang.String toString()
Returns a String
representation of this NumericValue
object. The String
is of the form: "(42.37)".
String
representation of this NumericValue
objectpublic static int getAsInteger(CrystalValue value, int defaultValue)
public static double getAsDouble(CrystalValue value, double defaultValue)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |