Package com.primavera.common.value
Class PrmNumber
java.lang.Object
java.lang.Number
com.primavera.common.value.PrmNumber
- All Implemented Interfaces:
Serializable,Comparable<PrmNumber>
- Direct Known Subclasses:
Cost,Duration,Percent,Unit,UnitsPerTime
This value type is used to define a Number object. It is a wrapper class of
Number.- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbyteReturns the value of the specified number as abyte.intcompareTo(double value) Compare thisPrmNumberobject to adouble.intCompare twoPrmNumberobjects.doubleReturns the value of the specified number as adouble.booleanCompares thisPrmNumberto the specified object.floatReturns the value of the specified number as afloat.inthashCode()Returns a hash code for this object.intintValue()Returns the value of the specified number as anint.longReturns the value of the specified number as along.voidsetDoubleValue(double v) Set the value of this object with a given value.shortReturns the value of the specified number as ashort.toString()Returns a string representation of the object.
-
Field Details
-
ZERO
-
-
Method Details
-
toString
Returns a string representation of the object. -
doubleValue
public double doubleValue()Returns the value of the specified number as adouble. This may involve rounding.- Specified by:
doubleValuein classNumber- Returns:
- the numeric value represented by this object after conversion to type
double.
-
hashCode
public int hashCode()Returns a hash code for this object. -
floatValue
public float floatValue()Returns the value of the specified number as afloat. This may involve rounding.- Specified by:
floatValuein classNumber- Returns:
- the numeric value represented by this object after conversion to type
float.
-
longValue
public long longValue()Returns the value of the specified number as along. This may involve rounding or truncation. -
intValue
public int intValue()Returns the value of the specified number as anint. This may involve rounding or truncation. -
shortValue
public short shortValue()Returns the value of the specified number as ashort. This may involve rounding or truncation.- Overrides:
shortValuein classNumber- Returns:
- the numeric value represented by this object after conversion to type
short.
-
byteValue
public byte byteValue()Returns the value of the specified number as abyte. This may involve rounding or truncation. -
compareTo
Compare twoPrmNumberobjects.- Specified by:
compareToin interfaceComparable<PrmNumber>- Parameters:
obj- theObjectto be compared.- Returns:
- the value
0if the argument is aPrmNumbernumerically equal to thisPrmNumber; a value less than0if the argument is aPrmNumbernumerically greater than thisPrmNumber, or if the argument is not aPrmNumber; and a value greater than0if the argument is aPrmNumbernumerically less than thisPrmNumber.
-
compareTo
public int compareTo(double value) Compare thisPrmNumberobject to adouble.- Parameters:
value- thedoubleto be compared.- Returns:
- the value
0if the argument is numerically equal to the value presented by thisPrmNumber; a value less than0if the argument is numerically greater than the value presented by thisPrmNumber; and a value greater than0if the argument is numerically less than the value presented by thisPrmNumber.
-
equals
Compares thisPrmNumberto the specified object. The result is true if compareTo(obj) is 0 -
setDoubleValue
public void setDoubleValue(double v) Set the value of this object with a given value.- Parameters:
v- the value.
-