Changeset 786 for trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/TextInput.java
- Timestamp:
- 09/06/12 16:47:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/gui/TextInput.java
r751 r786 1 1 2 package de.ugoe.cs.quest.eventcore.gui; 2 3 … … 7 8 /** 8 9 * <p> 9 * A text input represents a list of key events that together represent entering text into a 10 * textfield or text area.10 * A text input represents a list of key events that together represent entering text into a text 11 * field or text area. 11 12 * </p> 12 13 * 13 * @version $Revision: $ $Date: $14 * @author 2011, last modified by $Author: $14 * @version 1.0 15 * @author Patrick Harms, Steffen Herbold 15 16 */ 16 17 public class TextInput implements IInteraction { 17 18 public enum TextEquality {LEXICAL, SYNTACTICAL, SEMANTICAL}; 19 20 /** */ 18 19 /** 20 * <p> 21 * Defines how the {@link TextInput}s are evaluated as equal. 22 * </p> 23 * 24 * @version 1.0 25 * @author Steffen Herbold 26 */ 27 public enum TextEquality { 28 /** 29 * <p> 30 * Two text inputs are equal if their {@link TextInput#textInputEvents} are equal. 31 * </p> 32 */ 33 LEXICAL, 34 /** 35 * <p> 36 * Two text inputs are equal if their {@link TextInput#enteredText}s are equal. 37 * </p> 38 */ 39 SYNTACTICAL, 40 /** 41 * <p> 42 * All text inputs are equal. 43 * </p> 44 */ 45 SEMANTICAL 46 }; 47 48 /** 49 * <p> 50 * Id for object serialization. 51 * </p> 52 */ 21 53 private static final long serialVersionUID = 1L; 22 23 /** the text resulting from the text input events */ 54 55 /** 56 * <p> 57 * The text resulting from the text input events. 58 * </p> 59 */ 24 60 private String enteredText; 25 61 26 /** the text input events that caused the entering of the text */ 62 /** 63 * <p> 64 * The text input events that caused the entering of the text. 65 * </p> 66 */ 27 67 private List<Event> textInputEvents; 28 68 69 /** 70 * <p> 71 * Defines how this TextInput event evaluates the equality. 72 * </p> 73 */ 29 74 private final TextEquality equalityType; 30 75 31 76 /** 32 77 * <p> 33 * TODO: comment34 * </p> 35 * 78 * Constructor. Creates a new {@link TextInput} with {@link TextEquality#LEXICAL} equality. 79 * </p> 80 * 36 81 * @param enteredText 82 * text resulting from the inputs 37 83 * @param textInputEvents 84 * text input events of which this input consists 38 85 */ 39 86 public TextInput(String enteredText, List<Event> textInputEvents) { 40 87 this(enteredText, textInputEvents, TextEquality.LEXICAL); 41 88 } 42 43 /** 44 * <p> 45 * TODO: comment46 * </p> 47 * 89 90 /** 91 * <p> 92 * Constructor. Creates a new {@link TextInput}.. 93 * </p> 94 * 48 95 * @param enteredText 96 * text resulting from the inputs 49 97 * @param textInputEvents 98 * text input events of which this input consists 50 99 * @param equalityType 100 * defines how this event evaluates the equality (@see {@link TextEquality}) 51 101 */ 52 102 public TextInput(String enteredText, List<Event> textInputEvents, TextEquality equalityType) { … … 76 126 77 127 /** 78 * @return the enteredText 128 * <p> 129 * Returns the entered text. 130 * </p> 131 * 132 * @return the entered text 79 133 */ 80 134 public String getEnteredText() { … … 83 137 84 138 /** 139 * <p> 140 * Returns the events of which this {@link TextInput} consists. 141 * </p> 142 * 85 143 * @return the textInputEvents 86 144 */ 87 145 public List<Event> getTextInputEvents() { 146 // TODO should return an immutable view on the list 88 147 return textInputEvents; 89 148 } … … 106 165 return false; 107 166 } 108 167 109 168 /* 110 169 * (non-Javadoc) … … 141 200 public int hashCode() { 142 201 int hashCode = getClass().hashCode(); 143 if ( equalityType==TextEquality.LEXICAL) {202 if (equalityType == TextEquality.LEXICAL) { 144 203 hashCode += enteredText.hashCode() + textInputEvents.size(); 145 204 } 146 else if ( equalityType==TextEquality.SYNTACTICAL) {205 else if (equalityType == TextEquality.SYNTACTICAL) { 147 206 hashCode += enteredText.hashCode(); 148 207 }
Note: See TracChangeset
for help on using the changeset viewer.