Package com.oss.asn1

Class DecimalReal

All Implemented Interfaces:
com.oss.asn1.Comparable, Serializable, Cloneable

public class DecimalReal extends AbstractReal
The DecimalReal class represents the ASN.1 REAL type with the DECIMAL directive.
Since:
ASN.1/Java 6.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final DecimalReal
    The constant used to specify the ASN.1 REAL value, MINUS-INFINITY.
    static final DecimalReal
    The constant used to specify the ASN.1 REAL value, NOT-A-NUMBER.
    static final DecimalReal
    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
    Constructor
    Description
    The default constructor.
    DecimalReal(double value)
    Construct from a double.
    DecimalReal(float value)
    Construct from a float.
    Construct from a String.
  • Method Summary

    Modifier and Type
    Method
    Description
    Clone 'this' object.
    final int
    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 'that' 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 'that' 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 'that' object.
    final String
    Get the value of 'this' object as a string in NR3 format.
    void
    Destroy the instance of the AbstractData.
    final double
    Get the value of 'this' object as a double.
    final boolean
    Compare 'this' object to 'that' object to see if their contents are the same.
    final boolean
    Compare 'this' object to 'that' object to see if their contents are the same.
    final boolean
    equalTo(Real that)
    Compare 'this' object to 'that' object to see if their contents are the same.
    final float
    Get the value of 'this' object as a float.
    int
    Returns the base of this representation of REAL that is 10.
    int
    Returns a hash code for this object
    boolean
    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
    Detect if the current value is zero (0).
    final void
    setValue(double value)
    Set the value of 'this' object from a double value.
    final void
    setValue(float value)
    Set the value of 'this' object from 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.AbstractReal

    getTypeName

    Methods inherited from class com.oss.asn1.AbstractData

    equals, isEncodable, isPDU, isValid, toString, toString

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • PLUS_INFINITY

      public static final DecimalReal PLUS_INFINITY
      The constant used to specify the ASN.1 REAL value, PLUS-INFINITY.
    • MINUS_INFINITY

      public static final DecimalReal MINUS_INFINITY
      The constant used to specify the ASN.1 REAL value, MINUS-INFINITY.
    • NOT_A_NUMBER

      public static final DecimalReal NOT_A_NUMBER
      The constant used to specify the ASN.1 REAL value, NOT-A-NUMBER.
  • Constructor Details

    • DecimalReal

      public DecimalReal()
      The default constructor.
    • DecimalReal

      public DecimalReal(String value)
      Construct from a String.
      Parameters:
      value - the String value to set 'this' object to.
    • DecimalReal

      public DecimalReal(double value)
      Construct from a double.
      Parameters:
      value - the double value to set 'this' object to.
    • DecimalReal

      public DecimalReal(float value)
      Construct from a float.
      Parameters:
      value - the float value to set 'this' object to.
  • Method Details

    • setValue

      public final void setValue(float value)
      Set the value of 'this' object from 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 from a double value.
      Parameters:
      value - the double value to set 'this' object to.
    • setValue

      public final void setValue(String value)
      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

      public final String decimalValue()
      Get the value of 'this' object as a string in NR3 format. The NR3 format is defined in the ISO 6093:1985.
      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

      public final boolean equalTo(Real that)
      Compare 'this' object to 'that' object to see if their contents are the same.
      Parameters:
      that - the Real object to compare 'this' object to.
      Returns:
      true if the contents of both objects are the same.
    • equalTo

      public final boolean equalTo(DecimalReal that)
      Compare 'this' object to 'that' object to see if their contents are the same.
      Parameters:
      that - the DecimalReal object to compare 'this' object to.
      Returns:
      true if the contents of both objects are the same.
    • equalTo

      public final boolean equalTo(MixedReal that)
      Compare 'this' object to 'that' 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

      public final int compareTo(Real that)
      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 'that' object.
      Parameters:
      that - Real object that is compared with 'this' object
      Returns:
      LESS_THAN, EQUALS, or GREATER_THAN to express the result of the comparison.
      Throws:
      NullPointerException - thrown when 'that' is null.
    • compareTo

      public final 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 'that' object.
      Parameters:
      that - DecimalReal object that is compared with 'this' object
      Returns:
      LESS_THAN if the double value of 'this' is less than
      the double value of the DecimalReal object.
      EQUALS if the double value of 'this' equals to the
      double value of the DecimalReal object
      GREATER_THAN if the double value of 'this' is greater than
      the double value of the DecimalReal object.
      Throws:
      NullPointerException - is thrown when 'that' is null.
    • compareTo

      public final int compareTo(MixedReal that)
      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 'that' object.
      Parameters:
      that - MixedReal object that is compared with 'this' object
      Returns:
      LESS_THAN (-1) if the double value of 'this' is less than the double value of the MixedReal object. EQUALS (0) if the double value of 'this' equals to the double value of the MixedReal object GREATER_THAN (1) if the double value of 'this' is greater than the double value of the MixedReal object.
      Throws:
      NullPointerException - is thrown when 'that' is null.
    • clone

      public DecimalReal clone()
      Clone 'this' object.
      Returns:
      a deep copy of 'this' object.
    • delete

      public void delete()
      Destroy the instance of the AbstractData. The contract of this method is to facilitate garbage collection by explicit destruction of the data that is no longer needed.
      Overrides:
      delete in class AbstractData
    • getBase

      public int getBase()
      Returns the base of this representation of REAL that is 10.
      Specified by:
      getBase in class AbstractReal
      Returns:
      the base of decimal real that is 10.
    • hashCode

      public int hashCode()
      Returns a hash code for this object
      Overrides:
      hashCode in class AbstractData
      Returns:
      a hash code for this object