jp.bitmeister.asn1.type
Class AbstractInteger<T extends java.lang.Number & java.lang.Comparable<T>>

java.lang.Object
  extended by jp.bitmeister.asn1.type.ASN1Type
      extended by jp.bitmeister.asn1.type.PrimitiveType<T>
          extended by jp.bitmeister.asn1.type.AbstractInteger<T>
All Implemented Interfaces:
java.lang.Cloneable, ValueComparable<AbstractInteger<T>>
Direct Known Subclasses:
BigINTEGER, INTEGER

public abstract class AbstractInteger<T extends java.lang.Number & java.lang.Comparable<T>>
extends PrimitiveType<T>
implements ValueComparable<AbstractInteger<T>>

The base class for ASN.1 'INTEGER' types.

This class provides generic interfaces and common methods for classes that represents ASN.1 'INTEGER' type.

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

Author:
WATANABE, Jun.
See Also:
ASN1Enumeration, INTEGER, BigINTEGER

Field Summary
 
Fields inherited from class jp.bitmeister.asn1.type.ASN1Type
stringBuilder
 
Constructor Summary
AbstractInteger()
           
 
Method Summary
 int compareTo(AbstractInteger<T> other)
          Compares the value of this instance to the value of the other instance.
protected abstract  java.util.Map<T,java.lang.String> getNamedNumberMap()
          Returns map of enumerations related to this type.
 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.
protected abstract  boolean isEnum()
          Tests if base type of this data is ASN.1 'ENUMERATED'.
abstract  boolean isIntValue()
          Tests if the value of this data is in the range of int value.
abstract  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.lang.String nameOfNumber)
          Sets the value specified by the name of number to this data.
 void set(T value)
          Sets the 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
accept, equals, instantiate, matches, specification, toString, validate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractInteger

public AbstractInteger()
Method Detail

set

public void set(java.lang.String nameOfNumber)
Sets the value specified by the name of number to this data.

Parameters:
nameOfNumber - The name of number.

set

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

Overrides:
set in class PrimitiveType<T extends java.lang.Number & java.lang.Comparable<T>>
Parameters:
value - The value to be set.

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 abstract 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 abstract 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(AbstractInteger<T> 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<AbstractInteger<T extends java.lang.Number & java.lang.Comparable<T>>>
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.

getNamedNumberMap

protected abstract java.util.Map<T,java.lang.String> getNamedNumberMap()
Returns map of enumerations related to this type.

Returns:
The map of enumerations.

isEnum

protected abstract boolean isEnum()
Tests if base type of this data is ASN.1 'ENUMERATED'.

Returns:
true if base type of this data is ASN.1 'ENUMERATED'.


Copyright © 2012 BitMeister Inc. All Rights Reserved.