Ignore:
Timestamp:
12/23/14 11:39:42 (10 years ago)
Author:
pharms
Message:
  • rename of task instance comparator to task comparator as it actually compares tasks
Location:
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation
Files:
5 edited
1 moved

Legend:

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

    r1401 r1853  
    2222import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    2323import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    24 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2524import de.ugoe.cs.autoquest.usageprofiles.SymbolComparator; 
    2625 
     
    3433 * </p> 
    3534 */ 
    36 public class TaskInstanceComparator implements SymbolComparator<ITaskInstance> { 
     35public class TaskComparator implements SymbolComparator<ITask> { 
    3736     
    3837    /**  */ 
     
    7675     * @param minimalTaskEquality the considered task equality level 
    7776     */ 
    78     public TaskInstanceComparator(TaskEquality minimalTaskEquality) { 
     77    public TaskComparator(TaskEquality minimalTaskEquality) { 
    7978        this.minimalTaskEquality = minimalTaskEquality; 
    8079        init(); 
    8180    } 
    8281 
    83     /* (non-Javadoc) 
    84      * @see SymbolComparator#equals(Object, Object) 
    85      */ 
    86     @Override 
    87     public boolean equals(ITaskInstance taskInstance1, ITaskInstance taskInstance2) { 
    88         return equals(taskInstance1.getTask(), taskInstance2.getTask()); 
    89     }         
    90  
    9182    /** 
    9283     * <p> 
     
    9990     * @return as described 
    10091     */ 
     92    @Override 
    10193    public boolean equals(ITask task1, ITask task2) { 
    10294        Boolean result; 
     
    113105                     
    114106                    if (equalityBuffer.size() < MAX_BUFFER_SIZE) { 
    115                         equalityBuffer.put(key, result); 
     107                        //equalityBuffer.put(key, result); 
    116108                    } 
    117109                } 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskHandlingStrategy.java

    r1401 r1853  
    1616 
    1717import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
     18import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    1919import de.ugoe.cs.autoquest.usageprofiles.SymbolComparator; 
    2020import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 
     
    3232 * @author Patrick Harms 
    3333 */ 
    34 public class TaskHandlingStrategy implements SymbolStrategy<ITaskInstance> { 
     34public class TaskHandlingStrategy implements SymbolStrategy<ITask> { 
    3535     
    3636    /**  */ 
     
    4949     * </p> 
    5050     */ 
    51     private TaskInstanceComparator comparator; 
     51    private TaskComparator comparator; 
    5252 
    5353    /** 
     
    6565        } 
    6666        else { 
    67             comparator = new TaskInstanceComparator(this.consideredEquality); 
     67            comparator = new TaskComparator(this.consideredEquality); 
    6868        } 
    6969    } 
     
    7373     */ 
    7474    @Override 
    75     public SymbolComparator<ITaskInstance> getSymbolComparator() { 
     75    public SymbolComparator<ITask> getSymbolComparator() { 
    7676        return comparator; 
    7777    } 
     
    8383     * </p> 
    8484     */ 
    85     public TaskInstanceComparator getTaskComparator() { 
     85    public TaskComparator getTaskComparator() { 
    8686        return comparator; 
    8787    } 
     
    9191     */ 
    9292    @Override 
    93     public <V> SymbolMap<ITaskInstance, V> createSymbolMap() { 
     93    public <V> SymbolMap<ITask, V> createSymbolMap() { 
    9494        if (consideredEquality == TaskEquality.IDENTICAL) { 
    9595            return new TaskSymbolIdentityMap<V>(); 
     
    104104     */ 
    105105    @Override 
    106     public <V> SymbolMap<ITaskInstance, V> copySymbolMap(SymbolMap<ITaskInstance, V> other) { 
     106    public <V> SymbolMap<ITask, V> copySymbolMap(SymbolMap<ITask, V> other) { 
    107107        if (consideredEquality == TaskEquality.IDENTICAL) { 
    108108            return new TaskSymbolIdentityMap<V>(other); 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskIdentityComparator.java

    r1767 r1853  
    1717import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    1818import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2019 
    2120/** 
     
    2524 * </p> 
    2625 */ 
    27 class TaskIdentityComparator extends TaskInstanceComparator { 
     26class TaskIdentityComparator extends TaskComparator { 
    2827 
    2928    /**  */ 
     
    3837        super(TaskEquality.IDENTICAL); 
    3938    } 
    40      
    41     /* (non-Javadoc) 
    42      * @see SymbolComparator#equals(Object, Object) 
    43      */ 
    44     @Override 
    45     public boolean equals(ITaskInstance taskInstance1, ITaskInstance taskInstance2) { 
    46         return equals(taskInstance1.getTask(), taskInstance2.getTask()); 
    47     } 
    4839 
    4940    /* (non-Javadoc) 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskInstanceTrie.java

    r1401 r1853  
    1919import java.util.List; 
    2020import java.util.Map; 
     21import java.util.logging.Level; 
    2122 
    2223import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     
    2627import de.ugoe.cs.autoquest.usageprofiles.Trie; 
    2728import de.ugoe.cs.autoquest.usageprofiles.TrieProcessor; 
     29import de.ugoe.cs.util.console.Console; 
    2830 
    2931/** 
     
    3941 * @author Patrick Harms 
    4042 */ 
    41 class TaskInstanceTrie extends Trie<ITaskInstance> { 
     43class TaskInstanceTrie extends Trie<ITask> { 
    4244 
    4345    /**  */ 
     
    7779        } 
    7880         
    79         SymbolMap<ITaskInstance, Counter> equalTaskInstancesMap = 
     81        SymbolMap<ITask, Counter> equalTaskInstancesMap = 
    8082            taskStrategy.createSymbolMap(); 
    8183         
    8284        Map<ITask, Counter> instanceCountMap = new HashMap<ITask, Counter>(); 
    8385         
    84         System.out.println("preparing training"); 
     86        Console.traceln(Level.FINEST, "preparing training"); 
    8587        int noOfTaskInstances = 0; 
    8688        for (IUserSession session : userSessions) { 
    8789            for (ITaskInstance taskInstance : session) { 
    88                 Counter counter = equalTaskInstancesMap.getValue(taskInstance); 
     90                Counter counter = equalTaskInstancesMap.getValue(taskInstance.getTask()); 
    8991                 
    9092                if (counter == null) { 
    9193                    counter = new Counter(); 
    92                     equalTaskInstancesMap.addSymbol(taskInstance, counter); 
     94                    equalTaskInstancesMap.addSymbol(taskInstance.getTask(), counter); 
    9395                } 
    9496                 
     
    100102        } 
    101103         
    102         System.out.println("performing training of " + noOfTaskInstances + " task instances"); 
     104        Console.traceln 
     105            (Level.FINEST, "performing training of " + noOfTaskInstances + " task instances"); 
     106         
    103107        Counter processedTaskInstances = new Counter(); 
    104108        int counterRecheckAt = noOfTaskInstances / 10; // recheck the maximum count after each 
     
    146150                       int                 counterRecheckAt) 
    147151    { 
    148         List<ITaskInstance> subsequence = new LinkedList<ITaskInstance>(); 
     152        List<ITask> subsequence = new LinkedList<ITask>(); 
    149153         
    150154        int sequenceMaxCount = 0; 
     
    172176            } 
    173177            else { 
    174                 subsequence.add(currentTaskInstance); 
     178                subsequence.add(currentTaskInstance.getTask()); 
    175179 
    176180                if (subsequence.size() == maxOrder) { 
     
    211215     * @author Patrick Harms 
    212216     */ 
    213     private static class MaxSequenceCountFinder implements TrieProcessor<ITaskInstance> { 
     217    private static class MaxSequenceCountFinder implements TrieProcessor<ITask> { 
    214218         
    215219        /** 
     
    224228         */ 
    225229        @Override 
    226         public TrieProcessor.Result process(List<ITaskInstance> foundTask, int count) { 
     230        public TrieProcessor.Result process(List<ITask> foundTask, int count) { 
    227231            if (foundTask.size() == 2) { 
    228232                this.currentCount = Math.max(this.currentCount, count); 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolBucketedMap.java

    r1408 r1853  
    2727 
    2828import de.ugoe.cs.autoquest.eventcore.Event; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    2930import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    32 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     33import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     35import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    3336import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    3437import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 
     
    5659 * @param <V> 
    5760 */ 
    58 class TaskSymbolBucketedMap<V> implements SymbolMap<ITaskInstance, V>, Serializable { 
     61class TaskSymbolBucketedMap<V> implements SymbolMap<ITask, V>, Serializable { 
    5962 
    6063    /** 
     
    7881     * </p> 
    7982     */ 
    80     private TaskInstanceComparator comparator; 
     83    private TaskComparator comparator; 
    8184 
    8285    /** 
     
    8588     * </p> 
    8689     */ 
    87     private List<Map.Entry<ITaskInstance, V>> symbolList; 
     90    private List<Map.Entry<ITask, V>> symbolList; 
    8891 
    8992    /** 
     
    9396     * </p> 
    9497     */ 
    95     private Map<Integer, List<Map.Entry<ITaskInstance, V>>> symbolBuckets; 
     98    private Map<Integer, List<Map.Entry<ITask, V>>> symbolBuckets; 
    9699     
    97100    /** 
     
    113116     * @throws IllegalArgumentException if the provided comparator is null 
    114117     */ 
    115     public TaskSymbolBucketedMap(TaskInstanceComparator comparator) { 
     118    public TaskSymbolBucketedMap(TaskComparator comparator) { 
    116119        if (comparator == null) { 
    117120            throw new IllegalArgumentException("comparator must not be null"); 
     
    119122         
    120123        this.comparator = comparator; 
    121         this.symbolList = new ArrayList<Map.Entry<ITaskInstance, V>>(); 
     124        this.symbolList = new ArrayList<Map.Entry<ITask, V>>(); 
    122125    } 
    123126 
     
    137140 
    138141        this.comparator = otherMap.comparator; 
    139         this.symbolList = new ArrayList<Map.Entry<ITaskInstance, V>>(otherMap.symbolList); 
     142        this.symbolList = new ArrayList<Map.Entry<ITask, V>>(otherMap.symbolList); 
    140143         
    141144        if (this.symbolList.size() > MAX_LIST_SIZE) { 
     
    177180     * @throws IllegalArgumentException if the provided task instance is null 
    178181     */ 
    179     public boolean containsSymbol(ITaskInstance symbol) { 
     182    public boolean containsSymbol(ITask symbol) { 
    180183        if (symbol == null) { 
    181184            throw new IllegalArgumentException("symbol must not be null"); 
     
    198201     * @throws IllegalArgumentException if the provided task instance is null 
    199202     */ 
    200     public V getValue(ITaskInstance symbol) { 
     203    public V getValue(ITask symbol) { 
    201204        if (symbol == null) { 
    202205            throw new IllegalArgumentException("symbol must not be null"); 
    203206        } 
    204207         
    205         Map.Entry<ITaskInstance, V> entry = getEntry(symbol); 
     208        Map.Entry<ITask, V> entry = getEntry(symbol); 
    206209         
    207210        if (entry != null) { 
     
    230233     * @throws IllegalArgumentException if the provided task instance is null 
    231234     */ 
    232     public void addSymbol(ITaskInstance symbol, V value) { 
     235    public void addSymbol(ITask symbol, V value) { 
    233236        if (symbol == null) { 
    234237            throw new IllegalArgumentException("symbol must not be null"); 
    235238        } 
    236239         
    237         Map.Entry<ITaskInstance, V> entry = new SymbolMapEntry(symbol, value); 
     240        Map.Entry<ITask, V> entry = new SymbolMapEntry(symbol, value); 
    238241         
    239242        symbolList.add(entry); 
     
    261264     * @throws IllegalArgumentException if the provided task instance is null 
    262265     */ 
    263     public V removeSymbol(ITaskInstance symbol) { 
     266    public V removeSymbol(ITask symbol) { 
    264267        if (symbol == null) { 
    265268            throw new IllegalArgumentException("symbol must not be null"); 
     
    289292     * @return as described 
    290293     */ 
    291     public Collection<ITaskInstance> getSymbols() { 
    292         return new ReadOnlyCollectionFacade<ITaskInstance>(symbolList, new SymbolFacade()); 
     294    public Collection<ITask> getSymbols() { 
     295        return new ReadOnlyCollectionFacade<ITask>(symbolList, new SymbolFacade()); 
    293296    } 
    294297     
     
    351354     */ 
    352355    private void createSymbolBuckets() { 
    353         //System.out.println("creating symbol buckets"); 
    354         symbolBuckets = new HashMap<Integer, List<Map.Entry<ITaskInstance, V>>>(); 
    355          
    356         for (Map.Entry<ITaskInstance, V> symbol : symbolList) { 
     356        symbolBuckets = new HashMap<Integer, List<Map.Entry<ITask, V>>>(); 
     357         
     358        for (Map.Entry<ITask, V> symbol : symbolList) { 
    357359            addToSymbolBucket(symbol); 
    358360        } 
     
    368370     * </p> 
    369371     */ 
    370     private void addToSymbolBucket(Map.Entry<ITaskInstance, V> symbolEntry) { 
     372    private void addToSymbolBucket(Map.Entry<ITask, V> symbolEntry) { 
    371373        int bucketId = defaultBucket; 
    372374        int[] bucketSearchOrder = getBucketSearchOrder(symbolEntry.getKey()); 
     
    380382        } 
    381383         
    382         List<Map.Entry<ITaskInstance, V>> list = symbolBuckets.get(bucketId); 
     384        List<Map.Entry<ITask, V>> list = symbolBuckets.get(bucketId); 
    383385         
    384386        if (list == null) { 
    385             list = new LinkedList<Map.Entry<ITaskInstance, V>>(); 
     387            list = new LinkedList<Map.Entry<ITask, V>>(); 
    386388            symbolBuckets.put(bucketId, list); 
    387389        } 
     
    396398     * </p> 
    397399     */ 
    398     private int[] getBucketSearchOrder(ITaskInstance taskInstance) { 
     400    private int[] getBucketSearchOrder(ITask task) { 
    399401        // 0 = sequence; 1 = selection; 2 = iteration; 3 = optional; 4 = event task in general; 
    400402        // other = hashCode of name of event type 
    401403         
    402         if (taskInstance instanceof IEventTaskInstance) { 
     404        if (task instanceof IEventTask) { 
    403405            // event tasks are most likely equal to those of the same type happening on the same 
    404406            // target. Afterwards, they should be equal to those of the event type with the same 
    405407            // name. Afterwards, they may be equal to iterations, optionals, other event tasks, 
    406408            // selections, and finally the rest. 
    407             Event event = ((IEventTaskInstance) taskInstance).getEvent(); 
    408             return new int[] { event.getTarget().hashCode() + event.getType().getName().hashCode(), 
    409                                event.getType().getName().hashCode(), 2, 3, 4, 1 };                        
    410         } 
    411         else if (taskInstance instanceof ISequenceInstance) { 
     409             
     410            if (task.getInstances().iterator().hasNext()) { 
     411                Event event = 
     412                    ((IEventTaskInstance) ((IEventTask) task).getInstances().iterator().next()).getEvent(); 
     413                 
     414                return new int[] { event.getTarget().hashCode() + event.getType().getName().hashCode(), 
     415                                   event.getType().getName().hashCode(), 2, 3, 4, 1 }; 
     416            } 
     417            else { 
     418                return new int[] { 4, 2, 3, 1 }; 
     419            } 
     420        } 
     421        else if (task instanceof ISequence) { 
    412422            return new int[] { 0, 2, 3, 1 };                        
    413423        } 
    414         else if (taskInstance instanceof ISelectionInstance) { 
     424        else if (task instanceof ISelection) { 
    415425            return new int[] { 1, 4, 2, 3 };                        
    416426        } 
    417         else if (taskInstance instanceof IIterationInstance) { 
     427        else if (task instanceof IIteration) { 
    418428            return new int[] { 2, 1, 4 };                        
     429        } 
     430        else if (task instanceof IOptional) { 
     431            return new int[] { 3, 4, 2, 1, 0 };                        
    419432        } 
    420433         
     
    428441     * </p> 
    429442     */ 
    430     private Map.Entry<ITaskInstance, V> removeFromSymbolBuckets(ITaskInstance symbol) { 
     443    private Map.Entry<ITask, V> removeFromSymbolBuckets(ITask symbol) { 
    431444        int bucketId = defaultBucket; 
    432445        int[] bucketSearchOrder = getBucketSearchOrder(symbol); 
     
    436449        } 
    437450         
    438         List<Map.Entry<ITaskInstance, V>> list = symbolBuckets.get(bucketId); 
    439         Map.Entry<ITaskInstance, V> result = null; 
     451        List<Map.Entry<ITask, V>> list = symbolBuckets.get(bucketId); 
     452        Map.Entry<ITask, V> result = null; 
    440453         
    441454        if (list != null) { 
     
    479492     * </p> 
    480493     */ 
    481     private Map.Entry<ITaskInstance, V> getEntry(ITaskInstance symbol) { 
    482         Map.Entry<ITaskInstance, V> entry = null; 
     494    private Map.Entry<ITask, V> getEntry(ITask symbol) { 
     495        Map.Entry<ITask, V> entry = null; 
    483496        if (symbolBuckets == null) { 
    484497            entry = lookup(symbol, symbolList); 
     
    487500            int[] bucketSearchOrder = getBucketSearchOrder(symbol); 
    488501            for (int bucketId : bucketSearchOrder) { 
    489                 List<Map.Entry<ITaskInstance, V>> list = symbolBuckets.get(bucketId); 
     502                List<Map.Entry<ITask, V>> list = symbolBuckets.get(bucketId); 
    490503                if (list != null) { 
    491504                    entry = lookup(symbol, list); 
     
    499512            if (entry == null) { 
    500513                Arrays.sort(bucketSearchOrder); 
    501                 for (Map.Entry<Integer, List<Map.Entry<ITaskInstance, V>>> bucket : symbolBuckets.entrySet()) { 
     514                for (Map.Entry<Integer, List<Map.Entry<ITask, V>>> bucket : symbolBuckets.entrySet()) { 
    502515                    if (Arrays.binarySearch(bucketSearchOrder, bucket.getKey()) < 0) { 
    503                         List<Map.Entry<ITaskInstance, V>> list = bucket.getValue(); 
     516                        List<Map.Entry<ITask, V>> list = bucket.getValue(); 
    504517                        if (list != null) { 
    505518                            entry = lookup(symbol, list); 
     
    521534     * </p> 
    522535     */ 
    523     private Map.Entry<ITaskInstance, V> lookup(ITaskInstance symbol, List<Map.Entry<ITaskInstance, V>> list) { 
    524         for (Map.Entry<ITaskInstance, V> candidate : list) { 
     536    private Map.Entry<ITask, V> lookup(ITask symbol, List<Map.Entry<ITask, V>> list) { 
     537        for (Map.Entry<ITask, V> candidate : list) { 
    525538            if (comparator.equals(candidate.getKey(), symbol)) { 
    526539                return candidate; 
     
    538551     * @author Patrick Harms 
    539552     */ 
    540     private class SymbolMapEntry implements Map.Entry<ITaskInstance, V> { 
     553    private class SymbolMapEntry implements Map.Entry<ITask, V> { 
    541554         
    542555        /** 
    543556         * the task instance to map to a value 
    544557         */ 
    545         private ITaskInstance symbol; 
     558        private ITask symbol; 
    546559         
    547560        /** 
     
    556569         * </p> 
    557570         */ 
    558         private SymbolMapEntry(ITaskInstance symbol, V value) { 
     571        private SymbolMapEntry(ITask symbol, V value) { 
    559572            super(); 
    560573            this.symbol = symbol; 
     
    566579         */ 
    567580        @Override 
    568         public ITaskInstance getKey() { 
     581        public ITask getKey() { 
    569582            return symbol; 
    570583        } 
     
    640653         * the list facaded by this facade 
    641654         */ 
    642         private List<Map.Entry<ITaskInstance, V>> list; 
     655        private List<Map.Entry<ITask, V>> list; 
    643656         
    644657        /** 
     
    652665         * </p> 
    653666         */ 
    654         private ReadOnlyCollectionFacade(List<Map.Entry<ITaskInstance, V>> list, 
    655                                          EntryFacade<TYPE>                 entryFacade) 
     667        private ReadOnlyCollectionFacade(List<Map.Entry<ITask, V>> list, 
     668                                         EntryFacade<TYPE>         entryFacade) 
    656669        { 
    657670            this.list = list; 
     
    681694        public boolean contains(Object o) { 
    682695            if (o == null) { 
    683                 for (Map.Entry<ITaskInstance, V> entry : list) { 
     696                for (Map.Entry<ITask, V> entry : list) { 
    684697                    if (entryFacade.getFacadedElement(entry) == null) { 
    685698                        return true; 
     
    688701            } 
    689702            else { 
    690                 for (Map.Entry<ITaskInstance, V> entry : list) { 
     703                for (Map.Entry<ITask, V> entry : list) { 
    691704                    if (o.equals(entryFacade.getFacadedElement(entry))) { 
    692705                        return true; 
     
    812825         * the facaded iterator 
    813826         */ 
    814         private Iterator<Map.Entry<ITaskInstance, V>> iterator; 
     827        private Iterator<Map.Entry<ITask, V>> iterator; 
    815828         
    816829        /** 
     
    825838         * </p> 
    826839         */ 
    827         private ReadOnlyCollectionIteratorFacade(Iterator<Map.Entry<ITaskInstance, V>> iterator, 
    828                                                  EntryFacade<TYPE>                     entryFacade) 
     840        private ReadOnlyCollectionIteratorFacade(Iterator<Map.Entry<ITask, V>> iterator, 
     841                                                 EntryFacade<TYPE>             entryFacade) 
    829842        { 
    830843            this.iterator = iterator; 
     
    877890         * @return the part of the entry to be returned 
    878891         */ 
    879         protected abstract T getFacadedElement(Entry<ITaskInstance, V> entry); 
     892        protected abstract T getFacadedElement(Entry<ITask, V> entry); 
    880893         
    881894    } 
     
    888901     * @author Patrick Harms 
    889902     */ 
    890     private class SymbolFacade extends EntryFacade<ITaskInstance> { 
     903    private class SymbolFacade extends EntryFacade<ITask> { 
    891904 
    892905        /* (non-Javadoc) 
     
    894907         */ 
    895908        @Override 
    896         protected ITaskInstance getFacadedElement(Entry<ITaskInstance, V> entry) { 
     909        protected ITask getFacadedElement(Entry<ITask, V> entry) { 
    897910            return entry.getKey(); 
    898911        } 
     
    913926         */ 
    914927        @Override 
    915         protected V getFacadedElement(Entry<ITaskInstance, V> entry) { 
     928        protected V getFacadedElement(Entry<ITask, V> entry) { 
    916929            return entry.getValue(); 
    917930        } 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolIdentityMap.java

    r1401 r1853  
    2020 
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2322import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 
    2423 
     
    3130 * @author Patrick Harms 
    3231 */ 
    33 public class TaskSymbolIdentityMap<V> implements SymbolMap<ITaskInstance, V> { 
     32public class TaskSymbolIdentityMap<V> implements SymbolMap<ITask, V> { 
    3433 
    3534    /**  */ 
     
    4847     * </p> 
    4948     */ 
    50     private Map<ITask, ITaskInstance> symbols; 
     49    private Map<ITask, ITask> symbols; 
    5150 
    5251    /** 
     
    5756    public TaskSymbolIdentityMap() { 
    5857        delegate = new HashMap<ITask, V>(); 
    59         symbols = new HashMap<ITask, ITaskInstance>(); 
     58        symbols = new HashMap<ITask, ITask>(); 
    6059    } 
    6160 
     
    6766     * @param other the map to be copied 
    6867     */ 
    69     public TaskSymbolIdentityMap(SymbolMap<ITaskInstance, V> other) { 
     68    public TaskSymbolIdentityMap(SymbolMap<ITask, V> other) { 
    7069        if (other == null) { 
    7170            throw new IllegalArgumentException("other map must not be null"); 
     
    7372         
    7473        delegate = new HashMap<ITask, V>(); 
    75         symbols = new HashMap<ITask, ITaskInstance>(); 
     74        symbols = new HashMap<ITask, ITask>(); 
    7675         
    77         for (ITaskInstance symbol : other.getSymbols()) { 
    78             delegate.put(symbol.getTask(), other.getValue(symbol)); 
    79             symbols.put(symbol.getTask(), symbol); 
     76        for (ITask symbol : other.getSymbols()) { 
     77            delegate.put(symbol, other.getValue(symbol)); 
     78            symbols.put(symbol, symbol); 
    8079        } 
    8180    } 
     
    101100     */ 
    102101    @Override 
    103     public boolean containsSymbol(ITaskInstance symbol) { 
     102    public boolean containsSymbol(ITask symbol) { 
    104103        if (symbol == null) { 
    105104            throw new IllegalArgumentException("symbol must not be null"); 
    106105        } 
    107106         
    108         return delegate.containsKey(symbol.getTask()); 
     107        return delegate.containsKey(symbol); 
    109108    } 
    110109 
     
    113112     */ 
    114113    @Override 
    115     public V getValue(ITaskInstance symbol) { 
     114    public V getValue(ITask symbol) { 
    116115        if (symbol == null) { 
    117116            throw new IllegalArgumentException("symbol must not be null"); 
    118117        } 
    119118         
    120         return delegate.get(symbol.getTask()); 
     119        return delegate.get(symbol); 
    121120    } 
    122121 
     
    125124     */ 
    126125    @Override 
    127     public void addSymbol(ITaskInstance symbol, V value) { 
     126    public void addSymbol(ITask symbol, V value) { 
    128127        if (symbol == null) { 
    129128            throw new IllegalArgumentException("symbol must not be null"); 
    130129        } 
    131130         
    132         delegate.put(symbol.getTask(), value); 
    133         symbols.put(symbol.getTask(), symbol); 
     131        delegate.put(symbol, value); 
     132        symbols.put(symbol, symbol); 
    134133    } 
    135134 
     
    138137     */ 
    139138    @Override 
    140     public V removeSymbol(ITaskInstance symbol) { 
     139    public V removeSymbol(ITask symbol) { 
    141140        if (symbol == null) { 
    142141            throw new IllegalArgumentException("symbol must not be null"); 
    143142        } 
    144143         
    145         symbols.remove(symbol.getTask()); 
    146         return delegate.remove(symbol.getTask()); 
     144        symbols.remove(symbol); 
     145        return delegate.remove(symbol); 
    147146    } 
    148147 
     
    151150     */ 
    152151    @Override 
    153     public Collection<ITaskInstance> getSymbols() { 
     152    public Collection<ITask> getSymbols() { 
    154153        return symbols.values(); 
    155154    } 
Note: See TracChangeset for help on using the changeset viewer.