com.objsys.asn1j.runtime
Class Asn1CharRange

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

public class Asn1CharRange
extends Asn1CharSet

This class is used to represent a permitted alphabet that is specified as a large, continuous range of characters. An example of this can be found in the following extract from T.124:

simpleTextFirstCharacter UniversalString ::= {0, 0, 0, 0}

simpleTextLastCharacter UniversalString ::= {0, 0, 0, 255}

SimpleTextString ::= BMPString (SIZE (0..255)) (FROM (simpleTextFirstCharacter..simpleTextLastCharacter))

This class is mainly for internal use by the compiler when generating methods that encode/decode PER charater string components containing permitted alphabet constraints.


Field Summary
protected  int mLower
          This variable represents the lower value of the range.
protected  int mUpper
          This variable represents the upper value of the range.
 
Fields inherited from class com.objsys.asn1j.runtime.Asn1CharSet
mABitsPerChar, mUBitsPerChar
 
Constructor Summary
Asn1CharRange(int lower, int upper)
          This constructor sets the range values.
 
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.
 boolean validate(java.lang.String s)
          This method will validate a character string by comparing its contents to the character range.
 
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
 

Field Detail

mLower

protected int mLower
This variable represents the lower value of the range.


mUpper

protected int mUpper
This variable represents the upper value of the range.

Constructor Detail

Asn1CharRange

public Asn1CharRange(int lower,
                     int upper)
This constructor sets the range values.

Parameters:
lower - Range lower value
upper - Range upper value
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.

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 range. Each character in the string is checked against the range. If it exceeds the upper or lower limit of the range, false is returned. Otherwise true is returned.

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