| java.lang.Object com.ibm.icu.text.CanonicalIterator
CanonicalIterator | final public class CanonicalIterator (Code) | | This class allows one to iterate through all the strings that are canonically equivalent to a given
string. For example, here are some sample results:
Results for: {A WITH RING ABOVE}{d}{DOT ABOVE}{CEDILLA}
1: {A}{RING ABOVE}{d}{DOT ABOVE}{CEDILLA}
2: {A}{RING ABOVE}{d}{CEDILLA}{DOT ABOVE}
3: {A}{RING ABOVE}{d WITH DOT ABOVE}{CEDILLA}
4: {A}{RING ABOVE}{d WITH CEDILLA}{DOT ABOVE}
5: {A WITH RING ABOVE}{d}{DOT ABOVE}{CEDILLA}
6: {A WITH RING ABOVE}{d}{CEDILLA}{DOT ABOVE}
7: {A WITH RING ABOVE}{d WITH DOT ABOVE}{CEDILLA}
8: {A WITH RING ABOVE}{d WITH CEDILLA}{DOT ABOVE}
9: {ANGSTROM SIGN}{d}{DOT ABOVE}{CEDILLA}
10: {ANGSTROM SIGN}{d}{CEDILLA}{DOT ABOVE}
11: {ANGSTROM SIGN}{d WITH DOT ABOVE}{CEDILLA}
12: {ANGSTROM SIGN}{d WITH CEDILLA}{DOT ABOVE}
Note: the code is intended for use with small strings, and is not suitable for larger ones,
since it has not been optimized for that situation.
author: M. Davis |
Method Summary | |
public String | getSource() Gets the NFD form of the current source we are iterating over. | public String | next() Get the next canonically equivalent string.
Warning: The strings are not guaranteed to be in any particular order.
the next string that is canonically equivalent. | public static void | permute(String source, boolean skipZeros, Set output) Simple implementation of permutation. | public void | reset() Resets the iterator so that one can start again from the beginning. | public void | setSource(String newSource) Set a new source for this iterator. |
CanonicalIterator | public CanonicalIterator(String source)(Code) | | Construct a CanonicalIterator object
Parameters: source - string to get results for |
getSource | public String getSource()(Code) | | Gets the NFD form of the current source we are iterating over.
gets the source: NOTE: it is the NFD form of the source originally passed in |
next | public String next()(Code) | | Get the next canonically equivalent string.
Warning: The strings are not guaranteed to be in any particular order.
the next string that is canonically equivalent. The value null is returned whenthe iteration is done. |
permute | public static void permute(String source, boolean skipZeros, Set output)(Code) | | Simple implementation of permutation.
Warning: The strings are not guaranteed to be in any particular order.
Parameters: source - the string to find permutations for Parameters: skipZeros - set to true to skip characters with canonical combining class zero Parameters: output - the set to add the results to |
reset | public void reset()(Code) | | Resets the iterator so that one can start again from the beginning.
|
setSource | public void setSource(String newSource)(Code) | | Set a new source for this iterator. Allows object reuse.
Parameters: newSource - the source string to iterate against. This allows the same iterator to be usedwhile changing the source string, saving object creation. |
|
|