|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.XObject
edu.neu.ccs.XNumber
edu.neu.ccs.XDouble
Object wrapper for the primitive
double type that also provides
capabilities.Stringable
The default value for this class is
the double representation of zero.
As of 2.5.0, added methods isInfinite and
isNaN in imitation of class Double,
and also added methods isFinite to make the test
for finiteness directly available to a caller.
| Field Summary | |
private double |
value
The wrapped value of this object. |
| Fields inherited from class edu.neu.ccs.XObject |
changeAdapter, VALUE |
| Constructor Summary | |
XDouble()
Constructs a wrapper for the default double value. |
|
XDouble(double d)
Constructs a wrapper for the given double value. |
|
XDouble(String s)
Constructs a wrapper for the double value
whose state information is encapsulated
in the given String data. |
|
| Method Summary | |
byte |
byteValue()
Returns the value of this number as a byte value. |
double |
doubleValue()
Returns the value of this number as a double value. |
boolean |
equals(Object other)
Returns true if the wrapped object
is equal to the given object, and false
if it is not. |
float |
floatValue()
Returns the value of this number as a float value. |
void |
fromStringData(String data)
Sets the state of this object using information contained in the given String. |
double |
getValue()
Returns the value wrapped by this object. |
int |
hashCode()
Returns an int hash code
appropriate for the wrapped object. |
int |
intValue()
Returns the value of this number as a int value. |
boolean |
isFinite()
Returns true if this XDouble is finite, that is, it is not positive or negative infinity nor is it NaN. |
static boolean |
isFinite(double v)
Returns true if the given double is finite, that is, it is not positive or negative infinity nor is it NaN. |
boolean |
isInfinite()
Returns true if this XDouble is either positive or negative infinity. |
static boolean |
isInfinite(double v)
Returns true if the given double is either positive or negative infinity. |
boolean |
isNaN()
Returns true if this XDouble is NaN, that is, "not a number". |
static boolean |
isNaN(double v)
Returns true if the given double is NaN, that is, "not a number". |
long |
longValue()
Returns the value of this number as a long value. |
static double |
parseDouble(String s)
Parses a double value from a String |
void |
setValue(double d)
Sets the value wrapped by this object to the given value. |
short |
shortValue()
Returns the value of this number as a short value. |
static double[] |
toPrimitiveArray(XDouble[] x)
Returns an array of primitive double values
copied from the given array
of XDouble objects. |
String |
toString()
Returns a String representation
of the wrapped value. |
String |
toStringData()
Returns a String encapsulation of this object
that contains information needed
to set the state of this object at a later time. |
static XDouble[] |
toXArray(double[] a)
Returns an array of XDouble objects
initialized from the given array
of double values. |
| Methods inherited from class edu.neu.ccs.XObject |
addPropertyChangeListener, addPropertyChangeListener, formatErrorMessage, removePropertyChangeListener, removePropertyChangeListener, toStringArray |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private double value
| Constructor Detail |
public XDouble()
double value.
XDouble(double),
XDouble(String)public XDouble(double d)
double value.
d - the value to be wrappedXDouble(),
XDouble(String)
public XDouble(String s)
throws ParseException
double value
whose state information is encapsulated
in the given String data.
s - a String representation
of the desired value
ParseException - if the data is malformedXDouble(),
XDouble(double)| Method Detail |
public void fromStringData(String data)
throws ParseException
StringableString.
fromStringData in interface StringablefromStringData in class XObjectParseExceptionpublic String toStringData()
StringableString encapsulation of this object
that contains information needed
to set the state of this object at a later time.
toStringData in interface StringabletoStringData in class XObjectpublic byte byteValue()
XNumberbyte value.
byteValue in class XNumberpublic short shortValue()
XNumbershort value.
shortValue in class XNumberpublic int intValue()
XNumberint value.
intValue in class XNumberpublic long longValue()
XNumberlong value.
longValue in class XNumberpublic float floatValue()
XNumberfloat value.
floatValue in class XNumberpublic double doubleValue()
XNumberdouble value.
doubleValue in class XNumberpublic boolean equals(Object other)
true if the wrapped object
is equal to the given object, and false
if it is not.
other - the object to be compared with the wrapped objectpublic int hashCode()
int hash code
appropriate for the wrapped object.
public String toString()
String representation
of the wrapped value.
public void setValue(double d)
d - the value to be wrappedgetValue()public double getValue()
setValue(double)public boolean isFinite()
public boolean isInfinite()
Returns true if this XDouble is either positive or negative infinity.
public boolean isNaN()
Returns true if this XDouble is NaN, that is, "not a number".
public static boolean isFinite(double v)
public static boolean isInfinite(double v)
Returns true if the given double is either positive or negative infinity.
Identical to Double.isInfinite.
public static boolean isNaN(double v)
Returns true if the given double is NaN, that is, "not a number".
Identical to Double.isNaN.
public static double parseDouble(String s)
throws NumberFormatException
double value from a String
using the current shared parser.
- Parameters:
s - the String data to parse
- Returns:
- the extracted
double value
- Throws:
NumberFormatException - if the data is malformed
public static double[] toPrimitiveArray(XDouble[] x)
double values
copied from the given array
of XDouble objects.
x - an array of XDoubles
double valuestoXArray(double[])public static XDouble[] toXArray(double[] a)
XDouble objects
initialized from the given array
of double values.
a - an array of doubles
XDouble objectstoPrimitiveArray(XDouble[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||