com.objsys.asn1j.runtime
Class Asn1DiscreteCharSet

java.lang.Object
  extended by com.objsys.asn1j.runtime.Asn1CharSet
      extended by com.objsys.asn1j.runtime.Asn1DiscreteCharSet

public class Asn1DiscreteCharSet
extends Asn1CharSet

This class is used to represent a discrete set of characters from a permitted alphabet.


Field Summary
 
Fields inherited from class com.objsys.asn1j.runtime.Asn1CharSet
mABitsPerChar, mUBitsPerChar
 
Constructor Summary
Asn1DiscreteCharSet(int[] charSet)
          This constructor sets the permitted alphabet chracter set
Asn1DiscreteCharSet(java.lang.String charSet)
          This constructor sets the permitted alphabet chracter set
 
Method Summary
 int getCharAtIndex(int index)
          This method will fetch the character from the permitted alphabet at the given index.
 int getCharIndex(int charValue)
          This method will determine the index of the given character within the permitted alphabet character set.
 int getMaxValue()
          This method will determine the maximum value of the given character within the permitted alphabet character set.
protected  boolean helpValidate(char c)
          This function helps validate a character string by checking a character to see if it is in the character set.
 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 com.objsys.asn1j.runtime.Asn1CharSet
getNumBitsPerChar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Asn1DiscreteCharSet

public Asn1DiscreteCharSet(java.lang.String charSet)
This constructor sets the permitted alphabet chracter set

Parameters:
charSet - Permitted alphabet character set

Asn1DiscreteCharSet

public Asn1DiscreteCharSet(int[] charSet)
This constructor sets the permitted alphabet chracter set

Parameters:
charSet - Permitted alphabet character set
Method Detail

getCharAtIndex

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

Specified by:
getCharAtIndex in class Asn1CharSet
Parameters:
index - Index of character within the character set
Returns:
Character at given index
Throws:
Asn1ConsVioException - Index not within define range

getCharIndex

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

Specified by:
getCharIndex in class Asn1CharSet
Parameters:
charValue - Character value to search for
Returns:
Index of character
Throws:
Asn1ConsVioException - Character not found in set

getMaxValue

public int getMaxValue()
This method will determine the maximum value of the given character within the permitted alphabet character set. As the charset is canonical order, max value is of the last character.

Specified by:
getMaxValue in class Asn1CharSet
Returns:
Upper Bound Character or Character with max int value

validate

public 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.

Specified by:
validate in class Asn1CharSet
Parameters:
s - The string to be validated.
Returns:
False if the string contains invalid characters; true otherwise.

helpValidate

protected boolean helpValidate(char c)
This function helps validate a character string by checking a character to see if it is in the character set. It returns false if a character is not contained in the set and true otherwise.