Changeset 1282 for trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/SymbolComparator.java
- Timestamp:
- 07/30/13 09:38:43 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/SymbolComparator.java
r1251 r1282 29 29 * <p> 30 30 * compares two symbols and returns true, if the concrete comparison strategy sees both 31 * symbols as equal. The method must be commutative, i.e., 32 * <code>equals(symbol1, symbol2) == equals(symbol2, symbol1)</code>. 31 * symbols as equal. The method must be commutative and transitive, i.e., 32 * <code>equals(symbol1, symbol2) == equals(symbol2, symbol1)</code> and 33 * <code>if (equals(symbol1, symbol2) && equals(symbol2, symbol3)) then 34 * equals(symbol1, symbol3)</code>. 33 35 * </p> 34 36 * … … 39 41 */ 40 42 public boolean equals(T symbol1, T symbol2); 41 42 /** 43 * <p> 44 * returns a search order for buckets. This method can be used for optimizing a search for 45 * equal symbols. The client of this class can store symbols in buckets of similar symbols. 46 * Those buckets get an id denoted by an integer. The most appropriate bucket for a symbol is 47 * the first element in the array returned by this method. The symbol should therefore be put 48 * into that bucket. 49 * </p> 50 * <p> 51 * In case a search for an equal symbol shall be performed at the client side, the client 52 * checks the available buckets in the order given as return value of this method. All other 53 * buckets are searched afterwards. In this scenario it is ensured, that the equal symbol is 54 * found as soon as possible as the search always starts in the most appropriate bucket. 55 * However, the other buckets are searched, as well, if no equal symbol is found. Therefore, 56 * in the worst case, all buckets are searched. In the optimal case, the equal symbol is found 57 * in the first bucket. 58 * </p> 59 * <p> 60 * The returned array should contain different integers in each field. This allows a most 61 * efficient search. If an integer is repeated, it is up to the clien, if this is ignored. 62 * </p> 63 * 64 * @param symbol the symbol for which the bucket order is to be returned 65 * 66 * @return a search order for buckets as described 67 * 68 * @see SymbolMap 69 */ 70 public int[] getBucketSearchOrder(T symbol); 43 71 44 }
Note: See TracChangeset
for help on using the changeset viewer.