jp.bitmeister.asn1.type.builtin
Class REAL

java.lang.Object
  extended by jp.bitmeister.asn1.type.ASN1Type
      extended by jp.bitmeister.asn1.type.PrimitiveType<java.lang.Double>
          extended by jp.bitmeister.asn1.type.builtin.REAL
All Implemented Interfaces:
java.lang.Cloneable, ValueComparable

public class REAL
extends PrimitiveType<java.lang.Double>
implements ValueComparable

Represents ASN.1 'REAL' type.

An instance of this class represents a 'REAL' type data, and contains a Double value. Encoding mode will be used when the data is encoded with BER or DER. Default value for encoding mode is decimal and it can be set to binary.

Author:
WATANABE, Jun.

Field Summary
 
Fields inherited from class jp.bitmeister.asn1.type.ASN1Type
stringBuilder
 
Constructor Summary
REAL()
          Instantiates an empty REAL.
REAL(boolean isBinary)
          Instantiates an empty REAL and sets encoding mode.
REAL(double value)
          Instantiates a REAL and initialize it with the double value.
REAL(double value, boolean isBinary)
          Instantiates a REAL, initializes it with the double value and sets encoding mode.
REAL(long mantissa, int base, int exponent)
          Instantiates a REAL and initializes it with the value specified by the M*B^E formula.
 
Method Summary
<R,E extends java.lang.Throwable>
R
accept(ASN1Visitor<R,E> visitor)
          Accepts the ASN1Visitor and calls a visit method of the visitor.
 int compareTo(ASN1Type other)
          Compares the value of this instance to the value of the other instance.
 boolean isBinary()
          Returns encoding mode for this data.
 void set(java.lang.Float value)
          Sets the Float value to the instance.
 void set(long mantissa, int base, int exponent)
          Sets the value specified by the M*B^E formula to the instance.
 void setBinaryEncoding()
          Sets binary encoding mode.
 void setDecimalEncoding()
          Sets decimal encoding mode.
 
Methods inherited from class jp.bitmeister.asn1.type.PrimitiveType
clear, clone, cloneValue, hashCode, hasValue, set, value, valueEquals
 
Methods inherited from class jp.bitmeister.asn1.type.ASN1Type
equals, instantiate, matches, specification, toString, validate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

REAL

public REAL()
Instantiates an empty REAL.


REAL

public REAL(boolean isBinary)
Instantiates an empty REAL and sets encoding mode.

Parameters:
isBinary - The encoding mode. true means this REAL data will be encoded in binary encoding.

REAL

public REAL(double value)
Instantiates a REAL and initialize it with the double value.

Parameters:
value - The value assigned to the instance.

REAL

public REAL(double value,
            boolean isBinary)
Instantiates a REAL, initializes it with the double value and sets encoding mode.

Parameters:
value - The value assigned to the instance.
isBinary - The encoding mode.

REAL

public REAL(long mantissa,
            int base,
            int exponent)
Instantiates a REAL and initializes it with the value specified by the M*B^E formula.

Parameters:
mantissa - Mantissa.
base - Base. It can take values 2 or 10.
exponent - Exponent.
Method Detail

set

public void set(java.lang.Float value)
Sets the Float value to the instance.

Parameters:
value - The value assigned to the instance.

set

public void set(long mantissa,
                int base,
                int exponent)
Sets the value specified by the M*B^E formula to the instance.

Parameters:
mantissa - Mantissa.
base - Base. It can take values 2 or 10.
exponent - Exponent.

setBinaryEncoding

public void setBinaryEncoding()
Sets binary encoding mode.


setDecimalEncoding

public void setDecimalEncoding()
Sets decimal encoding mode.


isBinary

public boolean isBinary()
Returns encoding mode for this data.

Returns:
The encoding mode.

compareTo

public int compareTo(ASN1Type other)
Description copied from interface: ValueComparable
Compares the value of this instance to the value of the other instance.

Specified by:
compareTo in interface ValueComparable
Parameters:
other - The instance whose value to be compared.
Returns:
A negative integer, zero, or a positive integer as this value is less than, equal to, or greater than the other value.

accept

public <R,E extends java.lang.Throwable> R accept(ASN1Visitor<R,E> visitor)
         throws E extends java.lang.Throwable
Description copied from class: ASN1Type
Accepts the ASN1Visitor and calls a visit method of the visitor.

Specified by:
accept in class ASN1Type
Parameters:
visitor - The visitor.
Returns:
Result.
Throws:
E - When an error occured in the visit method of the visitor.
E extends java.lang.Throwable


Copyright © 2012 BitMeister Inc. All Rights Reserved.