|
20 | 20 |
|
21 | 21 | publicinterfaceAcceptor { |
22 | 22 |
|
| 23 | +/** |
| 24 | + * Checks whether or not this {@link Acceptor} accepts the given <code>sequence</code>. |
| 25 | + * |
| 26 | + * @param sequence The {@link CharSequence} to check. |
| 27 | + * @return <code>true</code> if and only if this {@link Acceptor} accepts the given <code>sequence</code> |
| 28 | + */ |
23 | 29 | booleanaccepts(CharSequencesequence); |
24 | 30 |
|
| 31 | +/** |
| 32 | + * Performs the same opeation as {@link #accepts(CharSequence)} but on the part of <code>sequence</code> denoted by |
| 33 | + * <code>start</code> and <code>length</code>. |
| 34 | + * |
| 35 | + * @see #accepts(CharSequence) |
| 36 | + */ |
25 | 37 | booleanaccepts(CharSequencesequence,intstart,intlength); |
26 | 38 |
|
| 39 | +/** |
| 40 | + * Find all accepted inputs at the beginning of given <code>charSequence</code>.<br/> |
| 41 | + * <br/> |
| 42 | + * Given the sequence <code>aa bbb cccc ddddd</code><br/> |
| 43 | + * and the accepted inputs <code>a</code>, <code>aa</code>, <code>aaa</code>, <code>b</code>, <code>bb</code>, |
| 44 | + * <code>bbb</code><br/> |
| 45 | + * the matches will be <code>a</code> and <code>aa</code> |
| 46 | + * |
| 47 | + * @param charSequence The {@link CharSequence} to examine. |
| 48 | + * @return All accepted inputs at the beginning of the charSequence. |
| 49 | + */ |
27 | 50 | String[]getAllMatches(CharSequencesequence); |
28 | 51 |
|
| 52 | +/** |
| 53 | + * Performs the same opeation as {@link #getAllMatches(CharSequence, int, int)} but on the part of <code>sequence</code> denoted by |
| 54 | + * <code>start</code> and <code>length</code>. |
| 55 | + * |
| 56 | + * @see #getAllMatches(CharSequence) |
| 57 | + */ |
29 | 58 | String[]getAllMatches(CharSequencesequence,intstart,intlength); |
30 | 59 |
|
| 60 | +/** |
| 61 | + * Find all accepted inputs in the given <code>charSequence</code>.<br/> |
| 62 | + * <p> |
| 63 | + * The only difference to {@link #getAllTokens(CharSequence)} is that the accepted input may occur at any position within the |
| 64 | + * <code>charSequence</code> (specifically start and end inside a token). |
| 65 | + * </p> |
| 66 | + * |
| 67 | + * @param charSequence The {@link CharSequence} to examine. |
| 68 | + * @return all occurrences of accepted input |
| 69 | + */ |
31 | 70 | List<Token>getAllOccurrences(CharSequencesequence); |
32 | 71 |
|
| 72 | +/** |
| 73 | + * Performs the same operation as {@link #getAllOccurrences(CharSequence)} but on the part of <code>sequence</code> denoted by |
| 74 | + * <code>start</code> and <code>length</code>. |
| 75 | + * |
| 76 | + * @see #getAllOccurrences(CharSequence) |
| 77 | + */ |
33 | 78 | List<Token>getAllOccurrences(CharSequencesequence,intstart,intlength); |
34 | 79 |
|
| 80 | +/** |
| 81 | + * Find all accepted inputs that are tokens in the given <code>charSequence</code>.<br/> |
| 82 | + * <p> |
| 83 | + * A part of the given sequence is considered to be a <code>token</code>, when it starts and ends at a token boundary.<br/> |
| 84 | + * A token boundary is the change from a non-word character to a word character (or vice-versa), as well as the beginning and end |
| 85 | + * of the whole sequence.<br/> |
| 86 | + * Please note that a token may contain token boundaries. |
| 87 | + * </p> |
| 88 | + * |
| 89 | + * @param charSequence The {@link CharSequence} to examine. |
| 90 | + * @return All tokens of accepted inputs. |
| 91 | + */ |
35 | 92 | List<Token>getAllTokens(CharSequencesequence); |
36 | 93 |
|
| 94 | +/** |
| 95 | + * Performs the same operation as {@link #getAllTokens(CharSequence)} but on the part of <code>sequence</code> denoted by |
| 96 | + * <code>start</code> and <code>length</code>. |
| 97 | + * |
| 98 | + * @see #getAllTokens(CharSequence) |
| 99 | + */ |
37 | 100 | List<Token>getAllTokens(CharSequencesequence,intstart,intlength); |
38 | 101 |
|
| 102 | +/** |
| 103 | + * Find the longest accepted input at the beginning of given <code>charSequence</code>.<br/> |
| 104 | + * <br/> |
| 105 | + * Given the sequence <code>aa bbb cccc ddddd</code><br/> |
| 106 | + * and the accepted inputs <code>a</code>, <code>aa</code>, <code>aaa</code>, <code>b</code>, <code>bb</code>, |
| 107 | + * <code>bbb</code><br/> |
| 108 | + * the longest match will be <code>aa</code> |
| 109 | + * |
| 110 | + * @param charSequence The charSequence to examine. |
| 111 | + * @return The longest accepted input at the beginning of the charSequence. |
| 112 | + */ |
39 | 113 | StringgetLongestMatch(CharSequencesequence); |
40 | 114 |
|
| 115 | +/** |
| 116 | + * Performs the same operation as {@link #getLongestMatch(CharSequence)} but on the part of <code>sequence</code> denoted by |
| 117 | + * <code>start</code> and <code>length</code>. |
| 118 | + * |
| 119 | + * @see #getLongestMatch(CharSequence) |
| 120 | + */ |
41 | 121 | StringgetLongestMatch(CharSequencesequence,intstart,intlength); |
42 | 122 |
|
| 123 | +/** |
| 124 | + * Performs {@link #getAllOccurrences(CharSequence)} and then eliminates overlapping {@link Token Tokens} by only keeping the |
| 125 | + * longest. |
| 126 | + * |
| 127 | + * @param charSequence The {@link CharSequence} to examine. |
| 128 | + * @return The longest occurrences of accepted input. |
| 129 | + */ |
43 | 130 | List<Token>getLongestOccurrences(CharSequencesequence); |
44 | 131 |
|
| 132 | +/** |
| 133 | + * Performs the same operation as {@link #getLongestOccurrences(CharSequence)} but on the part of <code>sequence</code> denoted by |
| 134 | + * <code>start</code> and <code>length</code>. |
| 135 | + * |
| 136 | + * @see #getLongestOccurrences(CharSequence) |
| 137 | + */ |
45 | 138 | List<Token>getLongestOccurrences(CharSequencesequence,intstart,intlength); |
46 | 139 |
|
| 140 | +/** |
| 141 | + * Performs {@link #getAllTokens(CharSequence)} and then eliminates overlapping {@link Token Tokens} by only keeping the longest. |
| 142 | + * |
| 143 | + * @param charSequence The {@link CharSequence} to examine. |
| 144 | + * @return The longest tokens of accepted input. |
| 145 | + */ |
47 | 146 | List<Token>getLongestTokens(CharSequencesequence); |
48 | 147 |
|
| 148 | +/** |
| 149 | + * Performs the same operation as {@link #getLongestTokens(CharSequence)} but on the part of <code>sequence</code> denoted by |
| 150 | + * <code>start</code> and <code>length</code>. |
| 151 | + * |
| 152 | + * @see #getLongestTokens(CharSequence) |
| 153 | + */ |
49 | 154 | List<Token>getLongestTokens(CharSequencesequence,intstart,intlength); |
50 | 155 |
|
51 | 156 | } |