jp.bitmeister.asn1.type.builtin
Class INTEGER

java.lang.Object
  extended by jp.bitmeister.asn1.type.ASN1Type
      extended by jp.bitmeister.asn1.type.PrimitiveType<java.math.BigInteger>
          extended by jp.bitmeister.asn1.type.builtin.INTEGER
All Implemented Interfaces:
java.lang.Cloneable, ValueComparable
Direct Known Subclasses:
BuiltInModule.UnknownEnumerated, ENUMERATED

public class INTEGER
extends PrimitiveType<java.math.BigInteger>
implements ValueComparable

Represents ASN.1 'INTEGER' type.

An instance of this class represents an 'INTEGER' type data, and has a BigInteger value.

A sub-class of INTEGER can contain one or more fields annotated as @ASN1Enumeration. If a sub-class of INTEGER contains @ASN1Enumeration fields, the value of the data must be same as one of the @ASN1Enumeration fields.

Author:
WATANABE, Jun.
See Also:
ASN1Enumeration

Field Summary
 
Fields inherited from class jp.bitmeister.asn1.type.ASN1Type
stringBuilder
 
Constructor Summary
INTEGER()
          Instantiates an empty INTEGER.
INTEGER(java.math.BigInteger value)
          Instantiates an INTEGER and initialize it with the BigInteger value.
INTEGER(long value)
          Instantiates an INTEGER and initialize it with the long value.
 
Method Summary
<E extends java.lang.Throwable>
void
accept(ASN1Visitor<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.
 java.lang.String identifier()
          Returns an identifier related to the value of this data if the type has @ASN1Enumeration fields.
 int intValue()
          Returns an int value that converted from the value of this data.
 boolean isIntValue()
          Tests if the value of this data is in the range of int value.
 boolean isLongValue()
          Tests if the value of this data is in the range of long value.
 long longValue()
          Returns a long value that converted from the value of this data.
 void set(java.math.BigInteger value)
          Sets the value to this data.
 void set(long value)
          Sets the long value to this data.
 
Methods inherited from class jp.bitmeister.asn1.type.PrimitiveType
clear, clone, cloneValue, hashCode, hasValue, 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

INTEGER

public INTEGER()
Instantiates an empty INTEGER.


INTEGER

public INTEGER(java.math.BigInteger value)
Instantiates an INTEGER and initialize it with the BigInteger value.

Parameters:
value - The value to be assigned.

INTEGER

public INTEGER(long value)
Instantiates an INTEGER and initialize it with the long value.

Parameters:
value - The value to be assigned.
Method Detail

set

public void set(java.math.BigInteger value)
Description copied from class: PrimitiveType
Sets the value to this data.

Overrides:
set in class PrimitiveType<java.math.BigInteger>
Parameters:
value - The value to be set.

set

public void set(long value)
Sets the long value to this data.

Parameters:
value - The value to be assigned.

identifier

public java.lang.String identifier()
Returns an identifier related to the value of this data if the type has @ASN1Enumeration fields.

Returns:
An identifier related to the value.

isLongValue

public boolean isLongValue()
Tests if the value of this data is in the range of long value.

Returns:
true when the value of this data is in the range of long.

isIntValue

public boolean isIntValue()
Tests if the value of this data is in the range of int value.

Returns:
true when the value of this data is in the range of int.

longValue

public long longValue()
Returns a long value that converted from the value of this data.

Returns:
A long value.

intValue

public int intValue()
Returns an int value that converted from the value of this data.

Returns:
An int value.

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 <E extends java.lang.Throwable> void accept(ASN1Visitor<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.
Throws:
E extends java.lang.Throwable