CodepositionReplacement Class Reference

Inheritance diagram for CodepositionReplacement:

InputReplacement ReplacementFactory List of all members.

Public Member Functions

synchronized String getReplacement (String input)
 Gives the temporary replacement for the prefix of input.

synchronized String replacesPrefixOf (String input)
 Searches a prefix of input which is replaced by this mapping.

synchronized String[] isContinuationOf (String input)
 Checks, if the there is a matching continuation of input.

String getInputInfo ()
 Returns a typical input for documentation purposes.

String getReplacementInfo ()
 Returns a typical replacement for documentation purposes.

 CodepositionReplacement (BufferedReader input) throws IOException, FileFormatException

Static Public Attributes

final String REPLACEMENT_CHARACTER = "\uFFFD"

Package Attributes

String prefix = null
String suffix = null
String placeHolder = "XXXX"
String replinfo = null
boolean ignorecase = false
int radix = 16
String charset = null
int maxCodepos = 0xFFFF

Private Member Functions

void parseInput (String input)

Private Attributes

String cache = null
int pfxLength
int codepos
String continuation1
String continuation2

Detailed Description

Todo:
support surrogates

Definition at line 69 of file CodepositionReplacement.java.


Constructor & Destructor Documentation

CodepositionReplacement BufferedReader  input  )  throws IOException, FileFormatException [inline]
 

Definition at line 178 of file CodepositionReplacement.java.

References charset, ignorecase, maxCodepos, placeHolder, prefix, radix, replinfo, and suffix.


Member Function Documentation

String getInputInfo  )  [inline, virtual]
 

Returns a typical input for documentation purposes.

This methods yield a string representing a typical input of this InputReplacement. It may but does not need to be a prefix matched by replacesPrefixOf (i.e. replacesPrefixOf(getInputInfo()).equals(getInputInfo())).

Returns:
a prefix for replacesPrefixOf or any other string.
See also:
getReplacementInfo()

replacesPrefixOf(String)

Implements InputReplacement.

Definition at line 172 of file CodepositionReplacement.java.

References placeHolder, prefix, and suffix.

Referenced by parseInput().

synchronized String getReplacement String  input  )  [inline, virtual]
 

Gives the temporary replacement for the prefix of input.

This method yields a replacement for the prefix returned by replacesPrefixOf(input). This replacement is shown in the temporary output.

This method must not be called if replacesPrefixOf(input)==null.

Parameters:
input the input in which to replace.
Returns:
the replacement for the prefix
See also:
replacesPrefixOf(String)

Implements InputReplacement.

Definition at line 86 of file CodepositionReplacement.java.

References charset, codepos, getReplacement(), parseInput(), and REPLACEMENT_CHARACTER.

Referenced by getReplacement().

String getReplacementInfo  )  [inline]
 

Returns a typical replacement for documentation purposes.

This method returns the replacement counterpart of getInputInfo() (like getReplacementInfo(getInputInfo())).

The default behaviour of this method is to return getReplacement(getInputInfo()).

If getReplacement(getInputInfo())==null, then you must override this method in subclasses.

Returns:
a replacement of getInputInfo() or any other string.
See also:
getInputInfo()

getReplacement(String)

Reimplemented from InputReplacement.

Definition at line 175 of file CodepositionReplacement.java.

References replinfo.

synchronized String [] isContinuationOf String  input  )  [inline, virtual]
 

Checks, if the there is a matching continuation of input.

More formally, checks for the existence of a string cont, such that:

<blockquote>

 cont.startsWith(input) &&
 !cont.equals(input) &&
 replacesPrefixOf(input)!=null &&
 !replacesPrefixOf(input).equals(cont)

If this InputReplacement replaces only one single string str, than this is equivalent to checking whether input is a proper substring of input.

If there is a continuation, this methods returns an array of continuations to present the user. This may be the set of all strings cont matching the above condition (or the string str in the case of just a single mapping), but the array can take any other value representing intuitively the set of all continuations (e.g. a pattern). The array may also be empty, then the user will not be informed of possible continuations.

If there are no continuations, return null.

Parameters:
input the string to check for continuations.
Returns:
an array of continuations or null (see description).
See also:
replacesPrefixOf(String)

Implements InputReplacement.

Definition at line 165 of file CodepositionReplacement.java.

References continuation1, continuation2, and isContinuationOf().

Referenced by isContinuationOf().

void parseInput String  input  )  [inline, private]
 

Definition at line 106 of file CodepositionReplacement.java.

References cache, codepos, continuation1, continuation2, getInputInfo(), ignorecase, maxCodepos, parseInput(), pfxLength, placeHolder, prefix, radix, and suffix.

Referenced by getReplacement(), parseInput(), and replacesPrefixOf().

synchronized String replacesPrefixOf String  input  )  [inline, virtual]
 

Searches a prefix of input which is replaced by this mapping.

If this mapping can replace more than one prefix of input, the longest is to be chosen.

Parameters:
input the input in which to search.
Returns:
the prefix of input, or null if there is none.

Implements InputReplacement.

Definition at line 101 of file CodepositionReplacement.java.

References parseInput(), pfxLength, and replacesPrefixOf().

Referenced by replacesPrefixOf().


Member Data Documentation

String cache = null [private]
 

Definition at line 81 of file CodepositionReplacement.java.

Referenced by parseInput().

String charset = null [package]
 

Definition at line 79 of file CodepositionReplacement.java.

Referenced by CodepositionReplacement(), and getReplacement().

int codepos [private]
 

Definition at line 83 of file CodepositionReplacement.java.

Referenced by getReplacement(), and parseInput().

String continuation1 [private]
 

Definition at line 84 of file CodepositionReplacement.java.

Referenced by isContinuationOf(), and parseInput().

String continuation2 [private]
 

Definition at line 85 of file CodepositionReplacement.java.

Referenced by isContinuationOf(), and parseInput().

boolean ignorecase = false [package]
 

Definition at line 77 of file CodepositionReplacement.java.

Referenced by CodepositionReplacement(), and parseInput().

int maxCodepos = 0xFFFF [package]
 

Definition at line 80 of file CodepositionReplacement.java.

Referenced by CodepositionReplacement(), and parseInput().

int pfxLength [private]
 

Definition at line 82 of file CodepositionReplacement.java.

Referenced by parseInput(), and replacesPrefixOf().

String placeHolder = "XXXX" [package]
 

Definition at line 75 of file CodepositionReplacement.java.

Referenced by CodepositionReplacement(), getInputInfo(), and parseInput().

String prefix = null [package]
 

Definition at line 73 of file CodepositionReplacement.java.

Referenced by CodepositionReplacement(), getInputInfo(), and parseInput().

int radix = 16 [package]
 

Definition at line 78 of file CodepositionReplacement.java.

Referenced by CodepositionReplacement(), and parseInput().

final String REPLACEMENT_CHARACTER = "\uFFFD" [static]
 

Definition at line 72 of file CodepositionReplacement.java.

Referenced by getReplacement().

String replinfo = null [package]
 

Definition at line 76 of file CodepositionReplacement.java.

Referenced by CodepositionReplacement(), and getReplacementInfo().

String suffix = null [package]
 

Definition at line 74 of file CodepositionReplacement.java.

Referenced by CodepositionReplacement(), getInputInfo(), and parseInput().


The documentation for this class was generated from the following file:
Generated on Sun Aug 15 11:56:54 2004 for International Input by doxygen 1.3.7