Ignore:
Timestamp:
12/04/12 11:50:39 (12 years ago)
Author:
fglaser
Message:
  • identifier in GUIElementTree changed to long. Corresponding changes were made in JFCSimplifiedLogParser
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIElementTree.java

    r1002 r1004  
    3939 */ 
    4040public class GUIElementTree { 
    41         /* Note that in the current version the id of a GUI element is assumed to be an Integer. For future 
     41        /* Note that in the current version the id of a GUI element is assumed to be a long. For future 
    4242        versions it might be more suitable to change to some generic id type. */ 
    4343         
     
    4545     * <p> 
    4646     * Map of all GUI elements that are part of the tree for efficient searching. The keys of the 
    47      * map are the hash values of the GUI elements. 
    48      * </p> 
    49      */ 
    50     private Map<Integer, IGUIElement> guiElements; 
     47     * map are the ids of the GUI elements. 
     48     * </p> 
     49     */ 
     50    private Map<Long, IGUIElement> guiElements; 
    5151 
    5252    /** 
    5353     * <p> 
    5454     * Map of all GUI element specifications that are part of the tree for efficient searching. The 
    55      * keys of the map are the hash values of the GUI elements. 
    56      * </p> 
    57      */ 
    58     private Map<Integer, IGUIElementSpec> guiElementSpecs; 
     55     * keys of the map are the ids of the GUI elements. 
     56     * </p> 
     57     */ 
     58    private Map<Long, IGUIElementSpec> guiElementSpecs; 
    5959 
    6060    /** 
    6161     * <p> 
    6262     * Map of all children of GUI elements that are part of the tree. The keys of the map are the 
    63      * hash values of the parent GUI elements. 
    64      * </p> 
    65      */ 
    66     private Map<Integer, List<Integer>> childRelations; 
     63     * ids of the parent GUI elements. 
     64     * </p> 
     65     */ 
     66    private Map<Long, List<Long>> childRelations; 
    6767 
    6868    /** 
    6969     * <p> 
    7070     * Map of all parents of GUI elements that are part of the tree. The keys of the map are the 
    71      * hash values of the child GUI elements. 
    72      * </p> 
    73      */ 
    74     private Map<Integer, Integer> parentRelations; 
     71     * ids of the child GUI elements. 
     72     * </p> 
     73     */ 
     74    private Map<Long, Long> parentRelations; 
    7575 
    7676    /** 
     
    9696     */ 
    9797    public GUIElementTree() { 
    98         guiElementSpecs = new HashMap<Integer, IGUIElementSpec>(); 
    99         childRelations = new HashMap<Integer, List<Integer>>(); 
    100         parentRelations = new HashMap<Integer, Integer>(); 
    101         guiElements = new HashMap<Integer, IGUIElement>(); 
     98        guiElementSpecs = new HashMap<Long, IGUIElementSpec>(); 
     99        childRelations = new HashMap<Long, List<Long>>(); 
     100        parentRelations = new HashMap<Long, Long>(); 
     101        guiElements = new HashMap<Long, IGUIElement>(); 
    102102        guiModel = new GUIModel(); 
    103103    } 
     
    110110     */ 
    111111    public GUIElementTree(GUIModel guiModel){ 
    112         guiElementSpecs = new HashMap<Integer, IGUIElementSpec>(); 
    113         childRelations = new HashMap<Integer, List<Integer>>(); 
    114         parentRelations = new HashMap<Integer, Integer>(); 
    115         guiElements = new HashMap<Integer, IGUIElement>(); 
     112        guiElementSpecs = new HashMap<Long, IGUIElementSpec>(); 
     113        childRelations = new HashMap<Long, List<Long>>(); 
     114        parentRelations = new HashMap<Long, Long>(); 
     115        guiElements = new HashMap<Long, IGUIElement>(); 
    116116        this.guiModel = guiModel; 
    117117    } 
     
    129129     *                    the GUI element specification 
    130130     */ 
    131     public void add(Integer guiElementID, 
    132                                 Integer parentID, 
     131    public void add(Long guiElementID, 
     132                                Long parentID, 
    133133                    IGUIElementSpec guiElementSpec) 
    134134    { 
     
    138138                IGUIElementSpec parent = guiElementSpecs.get(parentID); 
    139139            if (parent != null) { 
    140                 List<Integer> otherChildren = childRelations.get(parentID); 
     140                List<Long> otherChildren = childRelations.get(parentID); 
    141141 
    142142                if (otherChildren == null) { 
    143                     otherChildren = new ArrayList<Integer>(); 
     143                    otherChildren = new ArrayList<Long>(); 
    144144                    childRelations.put(parentID, otherChildren); 
    145145                } 
     
    153153            List<IGUIElementSpec> guiElementPath = new ArrayList<IGUIElementSpec>(); 
    154154 
    155             Integer currentElementID = guiElementID; 
     155            Long currentElementID = guiElementID; 
    156156            while (guiElementSpec != null) { 
    157157                guiElementPath.add(0, guiElementSpec); 
     
    180180     * @return {@link IGUIElementSpec} of the GUI element with the given id if found, null otherwise 
    181181     */ 
    182     public IGUIElement find(int id) { 
     182    public IGUIElement find(long id) { 
    183183        IGUIElement guiElement = guiElements.get(id); 
    184184        if (guiElement == null) { 
     
    191191            } 
    192192 
    193             Integer currentElementID = id; 
     193            Long currentElementID = id; 
    194194            while (elementSpec != null) { 
    195195                guiElementPath.add(0, elementSpec); 
     
    219219     * @return number of GUI elements that were removed 
    220220     */ 
    221     public int remove(int id) { 
     221    public int remove(long id) { 
    222222        IGUIElementSpec node = guiElementSpecs.remove(id); 
    223223        int removedCounter = 1; 
    224224 
    225225        if (node != null) { 
    226             List<Integer> nodesToBeRemoved = childRelations.remove(id); 
     226            List<Long> nodesToBeRemoved = childRelations.remove(id); 
    227227 
    228228            // remove all children and sub-children, if any 
    229229            if (nodesToBeRemoved != null) { 
    230230                for (int i = 0; i < nodesToBeRemoved.size(); i++) { 
    231                     Integer nodeToBeRemoved = nodesToBeRemoved.get(i); 
    232                     List<Integer> children = 
     231                    Long nodeToBeRemoved = nodesToBeRemoved.get(i); 
     232                    List<Long> children = 
    233233                        childRelations.remove(nodeToBeRemoved); 
    234234 
     
    245245            /* the node may be a child node of a parent. So search for it in the child relations 
    246246            of the parent and remove it */ 
    247             Integer parent = parentRelations.remove(id); 
     247            Long parent = parentRelations.remove(id); 
    248248            if (parent != null) { 
    249                 List<Integer> children = childRelations.get(parent); 
     249                List<Long> children = childRelations.get(parent); 
    250250 
    251251                if (children != null) { 
Note: See TracChangeset for help on using the changeset viewer.