IMC Epclient 5.0.3

at.spardat.enterprise.fmt
Class AStringFmtRange

java.lang.Object
  extended byat.spardat.enterprise.fmt.IFmt
      extended byat.spardat.enterprise.fmt.AStringFmt
          extended byat.spardat.enterprise.fmt.AStringFmtRange
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
AStringFmtRangeRegEx

public class AStringFmtRange
extends AStringFmt

This class defines a formatter which accepts characters from character ranges. Since the regexp implementation is not yet available in JDKs less than 1.4, we use a simple implementation here.

Character ranges are specified as string. The characters in the string are either the allowed character themselves, or lower and upper character separated by an hypen. Note that for these ranges to work you must know the Unicode table and what characters are included between particular upper and lower characters. Some examples:

 ABCDEF             denotes the characters A through F
 A-F                the same as before
 a-fA-F             denotes the character set abcdefABCDEF
 1a-f               denotes 1abcdef
 a-zA-Z0-9          denotes the letters a through z, case insensitive and digits
 ]-                 denotes the character '-'. A ']' is used to escape the '-'.
 ]]                 denotes the character ']'. A ']' is used to escape itself.
 ]t                 horizontal tab, '\u0009'
 ]n                 new line, '\u000A'
 ]f                 form feed, '\u000C'
 ]r                 carriage return, '\u000D'


Field Summary
static java.lang.String DIGITS
          Range string denoting the digits 0-9
static java.lang.String INA
          Range string denoting characters which may be safely transmitted over INA/ACNS to z/OS
 
Fields inherited from class at.spardat.enterprise.fmt.AStringFmt
LOWER_CASE, MAX_MAX_LEN, UPPER_CASE
 
Fields inherited from class at.spardat.enterprise.fmt.IFmt
DEFAULT, LAST_STYLE, MANDATORY, style_
 
Constructor Summary
AStringFmtRange(int maxLen, java.lang.String range)
          Constructs a String range formatter.
AStringFmtRange(int maxLen, java.lang.String range, int style)
          Constructs a String range formatter.
 
Method Summary
protected  int getNumRanges()
           
 boolean isLegalExternalChar(char aChar)
          Examines whether a given character may be part of an external representation.
 boolean isLegalInternal(java.lang.String internal)
          Determines if the given string is a legal internal representation.
 java.lang.String parse(java.lang.String external)
          Tries to transform an external encoding to an internal.
 
Methods inherited from class at.spardat.enterprise.fmt.AStringFmt
format, getInstance, getInstance, getInstance, getInstance, getInstance, getMaxLen, getMinLen, isOneWay, maxLenOfExternal, mayBeAppliedTo, parse2, setMaxLen, setMinLen
 
Methods inherited from class at.spardat.enterprise.fmt.IFmt
checkMandatory, clone, getStyle, isMandatory, setMandatory
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIGITS

public static final java.lang.String DIGITS
Range string denoting the digits 0-9

See Also:
Constant Field Values

INA

public static final java.lang.String INA
Range string denoting characters which may be safely transmitted over INA/ACNS to z/OS

See Also:
Constant Field Values
Constructor Detail

AStringFmtRange

public AStringFmtRange(int maxLen,
                       java.lang.String range)
Constructs a String range formatter.

Parameters:
maxLen - the maximum length; -1 if unlimited;
range - a range specification as defined in the class description above.

AStringFmtRange

public AStringFmtRange(int maxLen,
                       java.lang.String range,
                       int style)
Constructs a String range formatter.

Parameters:
maxLen - the maximum length; -1 if unlimited;
range - a range specification as defined in the class description above.
style - may be MANDATORY
Method Detail

isLegalExternalChar

public boolean isLegalExternalChar(char aChar)
Description copied from class: IFmt
Examines whether a given character may be part of an external representation.

Overrides:
isLegalExternalChar in class AStringFmt
See Also:
IFmt.isLegalExternalChar(char)

isLegalInternal

public boolean isLegalInternal(java.lang.String internal)
Description copied from class: IFmt
Determines if the given string is a legal internal representation.

Overrides:
isLegalInternal in class AStringFmt
See Also:
IFmt.isLegalInternal(String)

parse

public java.lang.String parse(java.lang.String external)
                       throws FmtParseException
Description copied from class: IFmt
Tries to transform an external encoding to an internal. Must not be called if isOneWay() yields true.

Overrides:
parse in class AStringFmt
Throws:
FmtParseException
See Also:
IFmt.parse(String)

getNumRanges

protected int getNumRanges()
Returns:
the lenght of the range string (without escape chars)
Since:
version_number

IMC Epclient 5.0.3