ExampleReplacement Class Reference

Plug-in for InputManager. More...

Inheritance diagram for ExampleReplacement:

InputReplacement ReplacementFactory List of all members.

Public Member Functions

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

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

String[] isContinuationOf (String input)
 Checks, whether input contains only occurences of <char>.

String replacesPrefixOf (String input)
 Checks for the longest prefix of input of length at least two containing only occurences of <char>.

String getReplacement (String input)
 Find the prefix as in replacesPrefixOf.

 ExampleReplacement (BufferedReader config) throws IOException, FileFormatException
 Creates a new instance of ExampleReplacement.


Package Attributes

char character

Private Attributes

final char digits []

Detailed Description

Plug-in for InputManager.

Use the following config file syntax:

<blockquote>

 =JAVAREPLACE
 <dir>
 ExampleReplacement
 <char>

where <dir> denotes the directory where the class file is loaded and <char> is a single character.

Then typing several (at least two) times <char> in a row yields <char>ⁿ, where ⁿ is the number of times you typed <char>.

See also:
InputManager

Definition at line 24 of file ExampleReplacement.java.


Constructor & Destructor Documentation

ExampleReplacement BufferedReader  config  )  throws IOException, FileFormatException [inline]
 

Creates a new instance of ExampleReplacement.

The <char> is assumed to be on the first line read from config.

Parameters:
config a reader on the config file.
Exceptions:
FileFormatException on EOF or if the line has not length 1.

Definition at line 108 of file ExampleReplacement.java.

References character.


Member Function Documentation

String getInputInfo  )  [inline, virtual]
 

Returns a typical input for documentation purposes.

Returns:
"<char><char><char><char><char> (n times)".

Implements InputReplacement.

Definition at line 33 of file ExampleReplacement.java.

References character.

String getReplacement String  input  )  [inline, virtual]
 

Find the prefix as in replacesPrefixOf.

We assume that replacesPrefixOf(input)!=null, otherwise the results of this method are be undefined.

Returns:
"<i>&lt;char&gt;</i>ⁿ", where ⁿ is the length of the prefix.
See also:
replacesPrefixOf(String)

Implements InputReplacement.

Definition at line 85 of file ExampleReplacement.java.

References character, digits, and getReplacement().

Referenced by getReplacement().

String getReplacementInfo  )  [inline]
 

Returns a typical replacement for documentation purposes.

Returns:
"<i>&lt;char&gt;</i>ⁿ"

Reimplemented from InputReplacement.

Definition at line 41 of file ExampleReplacement.java.

References character.

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

Checks, whether input contains only occurences of <char>.

Returns:
input+"<char>..." if that check yielded true, or null otherwise.

Implements InputReplacement.

Definition at line 51 of file ExampleReplacement.java.

References character, and isContinuationOf().

Referenced by isContinuationOf().

String replacesPrefixOf String  input  )  [inline, virtual]
 

Checks for the longest prefix of input of length at least two containing only occurences of <char>.

Returns:
that prefix, or null if there is none.

Implements InputReplacement.

Definition at line 63 of file ExampleReplacement.java.

References character, and replacesPrefixOf().

Referenced by replacesPrefixOf().


Member Data Documentation

char character [package]
 

Definition at line 26 of file ExampleReplacement.java.

Referenced by ExampleReplacement(), getInputInfo(), getReplacement(), getReplacementInfo(), isContinuationOf(), and replacesPrefixOf().

final char digits[] [private]
 

Initial value:

{ '⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹' }

Definition at line 74 of file ExampleReplacement.java.

Referenced by getReplacement().


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