Ignore:
Timestamp:
02/01/13 12:08:09 (12 years ago)
Author:
pharms
Message:
  • extended comparison to also correctly compare mouse double clicks
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/nodeequality/GUIEventTaskComparisonRule.java

    r1043 r1056  
    33import de.ugoe.cs.autoquest.eventcore.gui.IInteraction; 
    44import de.ugoe.cs.autoquest.eventcore.gui.MouseClick; 
     5import de.ugoe.cs.autoquest.eventcore.gui.MouseDoubleClick; 
    56import de.ugoe.cs.autoquest.eventcore.gui.MouseDragAndDrop; 
    67import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
     
    9192            return compareMouseClicks((MouseClick) interaction1, (MouseClick) interaction2); 
    9293        } 
     94        else if ((interaction1 instanceof MouseDoubleClick) && 
     95                 (interaction2 instanceof MouseDoubleClick)) 
     96        { 
     97            return compareMouseDoubleClicks 
     98                ((MouseDoubleClick) interaction1, (MouseDoubleClick) interaction2); 
     99        } 
    93100        else if ((interaction1 instanceof MouseDragAndDrop) && 
    94101                 (interaction2 instanceof MouseDragAndDrop)) 
     
    187194    /** 
    188195     * <p> 
     196     * compares two mouse double clicks. If both double clicks have the same coordinates, they are 
     197     * lexically equal. Otherwise, they are semantically equal. 
     198     * </p> 
     199     * 
     200     * @param interaction1 the first mouse double click to compare 
     201     * @param interaction2 the second mouse double click to compare 
     202     *  
     203     * @return as described 
     204     */ 
     205    private NodeEquality compareMouseDoubleClicks(MouseDoubleClick interaction1, 
     206                                                  MouseDoubleClick interaction2) 
     207    { 
     208        int x1 = interaction1.getX(); 
     209        int x2 = interaction2.getX(); 
     210        int y1 = interaction1.getY(); 
     211        int y2 = interaction2.getY(); 
     212         
     213        if ((x1 == x2) && (y1 == y2)) { 
     214            return NodeEquality.LEXICALLY_EQUAL; 
     215        } 
     216        else { 
     217            return NodeEquality.SEMANTICALLY_EQUAL; 
     218        } 
     219    } 
     220 
     221    /** 
     222     * <p> 
    189223     * compares two mouse drag and drops. If both drag and drops have the same start and end 
    190224     * coordinates, they are lexically equal. Otherwise, they are semantically equal. 
Note: See TracChangeset for help on using the changeset viewer.