[1118] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
| 2 | // |
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 4 | // you may not use this file except in compliance with the License. |
---|
| 5 | // You may obtain a copy of the License at |
---|
| 6 | // |
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 8 | // |
---|
| 9 | // Unless required by applicable law or agreed to in writing, software |
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 12 | // See the License for the specific language governing permissions and |
---|
| 13 | // limitations under the License. |
---|
| 14 | |
---|
| 15 | package de.ugoe.cs.autoquest.usageprofiles; |
---|
| 16 | |
---|
| 17 | import java.util.List; |
---|
| 18 | |
---|
| 19 | /** |
---|
| 20 | * <p> |
---|
[1186] | 21 | * A trie processor can be used to recursively process a trie. It will be called for each path |
---|
| 22 | * stored in the trie. The method called is the {@link #process(List, int)} method. It is provided |
---|
| 23 | * with the symbol path and the number of its occurrences. The processor may decide for each |
---|
| 24 | * call to the method using its return value, if the processing shall continue, if the path and all |
---|
| 25 | * its subsequent symbols can be skipped, or if the whole processing shall be broken up. |
---|
[1118] | 26 | * </p> |
---|
| 27 | * |
---|
| 28 | * @author Patrick Harms |
---|
| 29 | */ |
---|
| 30 | public interface TrieProcessor<T> { |
---|
| 31 | |
---|
| 32 | /** |
---|
[1186] | 33 | * <p> |
---|
| 34 | * potential results for a call to the {@link TrieProcessor#process(List, int)} method. The |
---|
| 35 | * processor may decide for each call to the method using its return value, if the processing |
---|
| 36 | * shall continue, if the path and all its subsequent symbols can be skipped, or if the whole |
---|
| 37 | * processing shall be broken up. |
---|
| 38 | * </p> |
---|
[1118] | 39 | */ |
---|
| 40 | public enum Result { |
---|
| 41 | CONTINUE, SKIP_NODE, BREAK |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | /** |
---|
[1186] | 45 | * <p> |
---|
| 46 | * called for each path of symbols stored in the trie which is processed. The method is |
---|
| 47 | * provided with the symbol path and the number of its occurrences. The processor may decide |
---|
| 48 | * for each call to the method using its return value, if the processing shall continue, if |
---|
| 49 | * the path and all its subsequent symbols can be skipped, or if the whole processing shall |
---|
| 50 | * be broken up. |
---|
| 51 | * </p> |
---|
[1118] | 52 | * |
---|
[1186] | 53 | * @param sequence the symbol path to be processed |
---|
| 54 | * @param count the number of occurrences of the provided symbol path in the trained |
---|
| 55 | * sequence |
---|
| 56 | * |
---|
| 57 | * @return as described |
---|
[1118] | 58 | */ |
---|
| 59 | public Result process(List<T> sequence, int count); |
---|
| 60 | |
---|
| 61 | } |
---|