Ignore:
Timestamp:
09/06/12 16:47:00 (12 years ago)
Author:
sherbold
Message:
  • code documentation
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 
    12package de.ugoe.cs.quest.eventcore.gui; 
    23 
     
    78/** 
    89 * <p> 
    9  * A text input represents a list of key events that together represent entering text into a 
    10  * text field 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. 
    1112 * </p> 
    1213 *  
    13  * @version $Revision: $ $Date: $ 
    14  * @author 2011, last modified by $Author: $ 
     14 * @version 1.0 
     15 * @author Patrick Harms, Steffen Herbold 
    1516 */ 
    1617public 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     */ 
    2153    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     */ 
    2460    private String enteredText; 
    2561 
    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     */ 
    2767    private List<Event> textInputEvents; 
    28      
     68 
     69    /** 
     70     * <p> 
     71     * Defines how this TextInput event evaluates the equality. 
     72     * </p> 
     73     */ 
    2974    private final TextEquality equalityType; 
    3075 
    3176    /** 
    3277     * <p> 
    33      * TODO: comment 
    34      * </p> 
    35      * 
     78     * Constructor. Creates a new {@link TextInput} with {@link TextEquality#LEXICAL} equality. 
     79     * </p> 
     80     *  
    3681     * @param enteredText 
     82     *            text resulting from the inputs 
    3783     * @param textInputEvents 
     84     *            text input events of which this input consists 
    3885     */ 
    3986    public TextInput(String enteredText, List<Event> textInputEvents) { 
    4087        this(enteredText, textInputEvents, TextEquality.LEXICAL); 
    4188    } 
    42      
    43     /** 
    44      * <p> 
    45      * TODO: comment 
    46      * </p> 
    47      * 
     89 
     90    /** 
     91     * <p> 
     92     * Constructor. Creates a new {@link TextInput}.. 
     93     * </p> 
     94     *  
    4895     * @param enteredText 
     96     *            text resulting from the inputs 
    4997     * @param textInputEvents 
     98     *            text input events of which this input consists 
    5099     * @param equalityType 
     100     *            defines how this event evaluates the equality (@see {@link TextEquality}) 
    51101     */ 
    52102    public TextInput(String enteredText, List<Event> textInputEvents, TextEquality equalityType) { 
     
    76126 
    77127    /** 
    78      * @return the enteredText 
     128     * <p> 
     129     * Returns the entered text. 
     130     * </p> 
     131     *  
     132     * @return the entered text 
    79133     */ 
    80134    public String getEnteredText() { 
     
    83137 
    84138    /** 
     139     * <p> 
     140     * Returns the events of which this {@link TextInput} consists. 
     141     * </p> 
     142     *  
    85143     * @return the textInputEvents 
    86144     */ 
    87145    public List<Event> getTextInputEvents() { 
     146        // TODO should return an immutable view on the list 
    88147        return textInputEvents; 
    89148    } 
     
    106165        return false; 
    107166    } 
    108      
     167 
    109168    /* 
    110169     * (non-Javadoc) 
     
    141200    public int hashCode() { 
    142201        int hashCode = getClass().hashCode(); 
    143         if( equalityType==TextEquality.LEXICAL) { 
     202        if (equalityType == TextEquality.LEXICAL) { 
    144203            hashCode += enteredText.hashCode() + textInputEvents.size(); 
    145204        } 
    146         else if( equalityType==TextEquality.SYNTACTICAL) { 
     205        else if (equalityType == TextEquality.SYNTACTICAL) { 
    147206            hashCode += enteredText.hashCode(); 
    148207        } 
Note: See TracChangeset for help on using the changeset viewer.