Package com.oss.asn1
Class Real
java.lang.Object
com.oss.asn1.AbstractData
com.oss.asn1.AbstractReal
com.oss.asn1.Real
- All Implemented Interfaces:
com.oss.asn1.Comparable
,Serializable
,Cloneable
The Real class represents the ASN.1 REAL type.
- Since:
- ASN.1/Java 1.0-beta A
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Real
The constant used to specify the ASN.1 REAL value, MINUS-INFINITY.static final Real
The constant used to specify the ASN.1 REAL value, NOT-A-NUMBER.static final Real
The constant used to specify the ASN.1 REAL value, PLUS-INFINITY.Fields inherited from class com.oss.asn1.AbstractData
EQUALS, GREATER_THAN, LESS_THAN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal int
compareTo
(DecimalReal that) Compare 'this' object to a DecimalReal object by comparing their correspondent double values to see whether the double value of 'this' object is less than, equal to, or greater than the one of another object.final int
Compare 'this' object to a MixedReal object by comparing their correspondent double values to see whether the double value of 'this' object is less than, equal to, or greater than the one of another object.final int
Compare 'this' object to a Real object to determine whether the contents of 'this' object is less than, equal to, or greater than the contents of another object.final String
Get the value of 'this' object as a string in NR3 format.final double
Get the value of 'this' object as a double.final boolean
equalTo
(DecimalReal that) Compare 'this' object to another object to see if their contents are the same.final boolean
Compare 'this' object to another object to see if their contents are the same.final boolean
Compare 'this' object to another object to see if their contents are the same.final float
Get the value of 'this' object as a float.int
getBase()
Returns the base of the real number.int
hashCode()
Returns a hash code for this objectboolean
isNaN()
Detect if the current value is NaN (NOT-A-NUMBER).boolean
Detect if the current value is -INFINITY.boolean
Detect if the current value is negative zero (-0).boolean
Detect if the current value is +INFINITY.boolean
isZero()
Detect if the current value is zero (0).final void
setValue
(double value) Set the value of 'this' object to a double value.final void
setValue
(float value) Set the value of 'this' object to a float value.final void
Set the value of 'this' object by converting the input String value into a double.Methods inherited from class com.oss.asn1.AbstractData
clone, delete, equals, isEncodable, isPDU, isValid, toString, toString
-
Field Details
-
PLUS_INFINITY
The constant used to specify the ASN.1 REAL value, PLUS-INFINITY. -
MINUS_INFINITY
The constant used to specify the ASN.1 REAL value, MINUS-INFINITY. -
NOT_A_NUMBER
The constant used to specify the ASN.1 REAL value, NOT-A-NUMBER.
-
-
Constructor Details
-
Real
public Real()The default constructor. -
Real
public Real(float value) Construct from a float.- Parameters:
value
- the float value to set 'this' object to.
-
Real
public Real(double value) Construct from a double.- Parameters:
value
- the double value to set 'this' object to.
-
-
Method Details
-
setValue
public final void setValue(float value) Set the value of 'this' object to a float value.- Parameters:
value
- the value to set 'this' object to.
-
setValue
public final void setValue(double value) Set the value of 'this' object to a double value.- Parameters:
value
- the double value to set 'this' object to.
-
setValue
Set the value of 'this' object by converting the input String value into a double.- Parameters:
value
- the String value to set 'this' object to.
-
floatValue
public final float floatValue()Get the value of 'this' object as a float.- Returns:
- value of 'this' object as a float.
-
doubleValue
public final double doubleValue()Get the value of 'this' object as a double.- Returns:
- value of 'this' object as a double.
-
decimalValue
Get the value of 'this' object as a string in NR3 format.- Returns:
- value of 'this' object as a string in NR3 format.
-
isZero
public boolean isZero()Detect if the current value is zero (0).- Returns:
- true if the current value is zero.
- Since:
- ASN.1/Java 7.0
-
isNegativeZero
public boolean isNegativeZero()Detect if the current value is negative zero (-0).- Returns:
- true if the current value is zero.
- Since:
- ASN.1/Java 7.0
-
isPositiveInfinity
public boolean isPositiveInfinity()Detect if the current value is +INFINITY.- Returns:
- true if the current value is +INFINITY.
- Since:
- ASN.1/Java 7.0
-
isNegativeInfinity
public boolean isNegativeInfinity()Detect if the current value is -INFINITY.- Returns:
- true if the current value is -INFINITY.
- Since:
- ASN.1/Java 7.0
-
isNaN
public boolean isNaN()Detect if the current value is NaN (NOT-A-NUMBER).- Returns:
- true if the current value is NaN.
- Since:
- ASN.1/Java 7.0
-
equalTo
Compare 'this' object to another object to see if their contents are the same.- Parameters:
that
- the Real object to compare 'this' object to.- Returns:
- true if contents of both objects are the same.
-
equalTo
Compare 'this' object to another object to see if their contents are the same.- Parameters:
that
- the DecimalReal object to compare 'this' object to.- Returns:
- true if contents of both objects are the same.
-
equalTo
Compare 'this' object to another object to see if their contents are the same.- Parameters:
that
- the MixedReal object to compare 'this' object to.- Returns:
- true if contents of both objects are the same.
-
compareTo
Compare 'this' object to a Real object to determine whether the contents of 'this' object is less than, equal to, or greater than the contents of another object.- Parameters:
that
- Real object that is compared with 'this' object- Returns:
- LESS_THAN, EQUALS, GREATER_THAN values as the results of comparison.
- Throws:
NullPointerException
- thrown when 'that' is null.
-
compareTo
Compare 'this' object to a DecimalReal object by comparing their correspondent double values to see whether the double value of 'this' object is less than, equal to, or greater than the one of another object.- Parameters:
that
- DecimalReal object that is compared with 'this' object- Returns:
- LESS_THAN, EQUALS, GREATER_THAN values as the results of comparison.
- Throws:
NullPointerException
- thrown when 'that' is null.
-
compareTo
Compare 'this' object to a MixedReal object by comparing their correspondent double values to see whether the double value of 'this' object is less than, equal to, or greater than the one of another object.- Parameters:
that
- MixedReal object that is compared with 'this' object- Returns:
- LESS_THAN, EQUALS, GREATER_THAN values as the results of comparison.
- Throws:
NullPointerException
- thrown when 'that' is null.
-
getBase
public int getBase()Returns the base of the real number.- Specified by:
getBase
in classAbstractReal
- Returns:
- the base of the real number - 2 for binary real or 10 for decimal real
-
hashCode
public int hashCode()Returns a hash code for this object- Overrides:
hashCode
in classAbstractData
- Returns:
- a hash code for this object
-