com.objsys.asn1j.runtime
Class Asn1CharSet

java.lang.Object
  extended by com.objsys.asn1j.runtime.Asn1CharSet
Direct Known Subclasses:
Asn1CharRange, Asn1DiscreteCharSet

public abstract class Asn1CharSet
extends java.lang.Object

This is the base class for representing character sets that are defined in ASN.1 permitted alphabet constraints.


Field Summary
protected  int mABitsPerChar
          This variable holds number of bits-per-character (PER aligned).
protected  int mUBitsPerChar
          This variable holds number of bits-per-character (PER unaligned).
 
Constructor Summary
protected Asn1CharSet(int nchars)
          This constructor sets the number of bits-per-character values based on the given number of characters in the character set.
 
Method Summary
abstract  int getCharAtIndex(int index)
          This method will fetch the character from the permitted alphabet at the given index.
abstract  int getCharIndex(int charValue)
          This method will determine the index of the given character within the permitted alphabet character set.
abstract  int getMaxValue()
          This method will determine the maximum value of the given character within the permitted alphabet character set.
 int getNumBitsPerChar(boolean aligned)
          This method will return the number of bits-per-character.
abstract  boolean validate(java.lang.String s)
          This method will validate a character string by comparing its contents to the character set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mABitsPerChar

protected int mABitsPerChar
This variable holds number of bits-per-character (PER aligned).


mUBitsPerChar

protected int mUBitsPerChar
This variable holds number of bits-per-character (PER unaligned).

Constructor Detail

Asn1CharSet

protected Asn1CharSet(int nchars)
This constructor sets the number of bits-per-character values based on the given number of characters in the character set.

Parameters:
nchars - Number of characters in the character set
Method Detail

getCharAtIndex

public abstract int getCharAtIndex(int index)
                            throws Asn1ConsVioException
This method will fetch the character from the permitted alphabet at the given index.

Parameters:
index - Index of character within the character set
Returns:
Character at given index
Throws:
Asn1ConsVioException - Index not within define range

getCharIndex

public abstract int getCharIndex(int charValue)
                          throws Asn1ConsVioException
This method will determine the index of the given character within the permitted alphabet character set.

Parameters:
charValue - Character value to search for
Returns:
Index of character
Throws:
Asn1ConsVioException - Character not found in set

getMaxValue

public abstract int getMaxValue()
This method will determine the maximum value of the given character within the permitted alphabet character set.

Returns:
Upper Bound Character or Character with max int value

getNumBitsPerChar

public int getNumBitsPerChar(boolean aligned)
This method will return the number of bits-per-character.

Parameters:
aligned - Boolean value indicating whether number of aligned (true) or unaligned (false) characters should be returned.

validate

public abstract boolean validate(java.lang.String s)
This method will validate a character string by comparing its contents to the character set. If a character string contains characters that are not in the character set, this method will return false. Otherwise it returns true.

Parameters:
s - The string to be validated.
Returns:
False if the string contains invalid characters; true otherwise.