Changeset 1217 for trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/TextInputUtil.java
- Timestamp:
- 06/06/13 17:08:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/TextInputUtil.java
r1152 r1217 31 31 /** 32 32 * <p> 33 * TODO comment33 * Util class to handle text input events/tasks. 34 34 * </p> 35 35 * … … 42 42 } 43 43 44 /** 45 * 46 * <p> 47 * Returns all entered words and signs of text input events. 48 * </p> 49 * 50 * @param tasksWithTextInputEvents 51 * tasks with event type {@link TextInput} 52 * @return set of all entered word and signs with unique entries 53 */ 44 54 public static Multiset<String> aggregateEnteredTextFromTextInputs(List<ITask> tasksWithTextInputEvents) 45 55 { … … 52 62 } 53 63 64 /** 65 * 66 * <p> 67 * Splits entered text into words and signs. 68 * </p> 69 * 70 * @param enteredText 71 * entered text (e.g. from text input event) 72 * @return collection of words and signs 73 */ 54 74 public static Iterable<String> splitTextIntoWordsAndSigns(String enteredText) { 55 75 CharMatcher onlyWords = 56 CharMatcher.WHITESPACE.or(CharMatcher 57 .forPredicate(characterIsJavaIdentifierPartPredicate())); 76 CharMatcher.WHITESPACE.or(CharMatcher.forPredicate(characterIsNoJavaIdentifierPart())); 58 77 CharMatcher onlySigns = 59 CharMatcher.WHITESPACE.or(CharMatcher 60 . forPredicate(characterIsJavaIdentifierPartPredicate()).negate());78 CharMatcher.WHITESPACE.or(CharMatcher.forPredicate(characterIsNoJavaIdentifierPart()) 79 .negate()); 61 80 Iterable<String> words = 62 81 Splitter.on(onlyWords).omitEmptyStrings().trimResults().split(enteredText); … … 66 85 } 67 86 68 public static Predicate<Character> characterIsJavaIdentifierPartPredicate() { 87 /** 88 * 89 * <p> 90 * Determines, if a character is not part of a Java identifier. 91 * </p> 92 * 93 * @return true, iff no part of Java identifier 94 */ 95 public static Predicate<Character> characterIsNoJavaIdentifierPart() { 69 96 return new Predicate<Character>() { 70 97 … … 77 104 } 78 105 79 public static Predicate<Character> characterIsLetterOrDigitPredicate() { 106 /** 107 * 108 * <p> 109 * Determines if the specified character is not a letter or digit. 110 * </p> 111 * 112 * @return 113 */ 114 public static Predicate<Character> characterIsNoLetterOrDigitPredicate() { 80 115 return new Predicate<Character>() { 81 116
Note: See TracChangeset
for help on using the changeset viewer.