InputManager::StringReplacement Class Reference

Inheritance diagram for InputManager::StringReplacement:

InputReplacement InputManager::SwitchReplacement List of all members.

Public Member Functions

 StringReplacement (String _string, String _repl)
 StringReplacement (String _string, String _tr, String _fr)
String getReplacement (String input)
 Gives the temporary replacement for the prefix of input.

String getFinalReplacement (String input)
 Gives the final replacement for the prefix of input.

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

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

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


Package Attributes

String string
String tempReplacement
String replacement
String cont []

Constructor & Destructor Documentation

StringReplacement String  _string,
String  _repl
[inline]
 

Definition at line 28 of file InputManager.java.

References replacement, string, and tempReplacement.

StringReplacement String  _string,
String  _tr,
String  _fr
[inline]
 

Definition at line 30 of file InputManager.java.

References replacement, string, and tempReplacement.


Member Function Documentation

String getFinalReplacement String  input  )  [inline]
 

Gives the final replacement for the prefix of input.

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

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

The default implementation of this method is to yield the same result as does getReplacement(input)

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

getReplacement(String)

Reimplemented from InputReplacement.

Reimplemented in InputManager::SwitchReplacement.

Definition at line 33 of file InputManager.java.

References getFinalReplacement(), and replacement.

Referenced by getFinalReplacement().

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 35 of file InputManager.java.

References string.

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.

Reimplemented in InputManager::SwitchReplacement.

Definition at line 32 of file InputManager.java.

References getReplacement(), and tempReplacement.

Referenced by getReplacement().

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 36 of file InputManager.java.

References cont, isContinuationOf(), and string.

Referenced by isContinuationOf().

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 42 of file InputManager.java.

References replacesPrefixOf(), and string.

Referenced by replacesPrefixOf().


Member Data Documentation

String cont[] [package]
 

Definition at line 27 of file InputManager.java.

Referenced by isContinuationOf().

String replacement [package]
 

Definition at line 26 of file InputManager.java.

Referenced by getFinalReplacement(), and StringReplacement().

String string [package]
 

Definition at line 24 of file InputManager.java.

Referenced by getInputInfo(), isContinuationOf(), replacesPrefixOf(), and StringReplacement().

String tempReplacement [package]
 

Definition at line 25 of file InputManager.java.

Referenced by getReplacement(), and StringReplacement().


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