Changeset 1189 for trunk


Ignore:
Timestamp:
04/29/13 16:29:53 (12 years ago)
Author:
pharms
Message:
  • remove a find bugs warning
Location:
trunk
Files:
6 edited

Legend:

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

    r1154 r1189  
    1515package de.ugoe.cs.autoquest.tasktrees.manager; 
    1616 
    17 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    1817import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TemporalRelationshipRuleManager; 
    1918import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     
    5049    /** 
    5150     * <p> 
    52      * the default task equality rule manager 
    53      * </p> 
    54      */ 
    55     private TaskEqualityRuleManager taskEqualityRuleManager; 
    56  
    57     /** 
    58      * <p> 
    5951     * the default task builder 
    6052     * </p> 
     
    7870    public static TemporalRelationshipRuleManager getTemporalRelationshipRuleManager() { 
    7971        return getInstance().temporalRelationshipRuleManager; 
    80     } 
    81  
    82     /** 
    83      * <p> 
    84      * returns the default task equality rule manager 
    85      * </p> 
    86      *  
    87      * @return as described 
    88      */ 
    89     public static TaskEqualityRuleManager getTaskEqualityRuleManager() { 
    90         return getInstance().taskEqualityRuleManager; 
    9172    } 
    9273 
     
    146127     */ 
    147128    private void init() { 
    148         taskEqualityRuleManager = new TaskEqualityRuleManager(); 
    149         taskEqualityRuleManager.init(); 
    150  
    151129        taskBuilder = new TaskBuilder(); 
    152130        taskFactory = new TaskFactory(); 
    153131 
    154         temporalRelationshipRuleManager = new TemporalRelationshipRuleManager 
    155             (taskEqualityRuleManager, taskFactory, taskBuilder); 
     132        temporalRelationshipRuleManager = 
     133            new TemporalRelationshipRuleManager(taskFactory, taskBuilder); 
    156134        temporalRelationshipRuleManager.init(); 
    157135    } 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEqualityRuleManager.java

    r1154 r1189  
    3232 */ 
    3333public class TaskEqualityRuleManager { 
     34     
     35    /** 
     36     * <p> 
     37     * the singleton instance of this class 
     38     * </p> 
     39     */ 
     40    private static final TaskEqualityRuleManager instance = new TaskEqualityRuleManager(); 
    3441 
    3542    /** 
     
    4350     * <p> 
    4451     * initializes the task equality rule manager by filling the internal list of comparison rules. 
    45      * This method must be called before any other method is called on the rule manager. 
    46      * </p> 
    47      */ 
    48     public void init() { 
     52     * </p> 
     53     */ 
     54    private TaskEqualityRuleManager() { 
    4955        mRuleIndex = new ArrayList<TaskComparisonRule>(); 
    5056        mRuleIndex.add(new TaskIdentityRule()); 
     
    5662        mRuleIndex.add(new TaskAndIterationComparisonRule(this)); 
    5763        mRuleIndex.add(new TaskAndSelectionComparisonRule(this)); 
     64    } 
     65 
     66 
     67    /** 
     68     * <p> 
     69     * returns the singleton instance of this class 
     70     * </p> 
     71     *  
     72     * @return as described 
     73     */ 
     74    public static TaskEqualityRuleManager getInstance() { 
     75        return instance; 
    5876    } 
    5977 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java

    r1188 r1189  
    1515package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 
    1616 
     17import java.io.IOException; 
     18import java.io.ObjectInputStream; 
    1719import java.util.HashMap; 
    1820import java.util.Iterator; 
     
    7476     * </p> 
    7577     */ 
    76     SequenceForTaskDetectionRule(TaskEqualityRuleManager taskEqualityRuleManager, 
    77                                  TaskEquality            minimalTaskEquality, 
    78                                  ITaskFactory            taskFactory, 
    79                                  ITaskBuilder            taskBuilder) 
     78    SequenceForTaskDetectionRule(TaskEquality minimalTaskEquality, 
     79                                 ITaskFactory taskFactory, 
     80                                 ITaskBuilder taskBuilder) 
    8081    { 
    8182        this.taskFactory = taskFactory; 
    8283        this.taskBuilder = taskBuilder; 
    8384         
    84         this.taskComparator = new TaskComparator(taskEqualityRuleManager, minimalTaskEquality); 
     85        this.taskComparator = new TaskComparator(minimalTaskEquality); 
    8586    } 
    8687 
     
    887888     */ 
    888889    private static class TaskComparator implements SymbolComparator<ITaskInstance> { 
    889  
     890         
    890891        /** */ 
    891         private Comparer comparer; 
     892        private TaskEquality minimalNodeEquality; 
    892893 
    893894        /** */ 
    894         private Comparer lexicalComparer; 
     895        private transient Comparer comparer; 
    895896 
    896897        /** */ 
    897         private HashMap<Long, Boolean> equalityBuffer = new HashMap<Long, Boolean>(); 
     898        private transient Comparer lexicalComparer; 
    898899 
    899900        /** */ 
    900         private HashMap<Long, Boolean> lexicalEqualityBuffer; 
     901        private transient HashMap<Long, Boolean> equalityBuffer = new HashMap<Long, Boolean>(); 
     902 
     903        /** */ 
     904        private transient HashMap<Long, Boolean> lexicalEqualityBuffer; 
    901905 
    902906        /** 
    903907         * 
    904908         */ 
    905         public TaskComparator(TaskEqualityRuleManager taskEqualityRuleManager, 
    906                               TaskEquality            minimalNodeEquality) 
    907         { 
    908             super(); 
    909              
    910             if (minimalNodeEquality == TaskEquality.LEXICALLY_EQUAL) { 
    911                 comparer = new LexicalComparer(taskEqualityRuleManager); 
    912             } 
    913             else if (minimalNodeEquality == TaskEquality.SYNTACTICALLY_EQUAL) { 
    914                 comparer = new SyntacticalComparer(taskEqualityRuleManager); 
    915             } 
    916             else if (minimalNodeEquality == TaskEquality.SEMANTICALLY_EQUAL) { 
    917                 comparer = new SemanticalComparer(taskEqualityRuleManager); 
    918             } 
    919             else { 
    920                 comparer = new DefaultComparer(taskEqualityRuleManager, minimalNodeEquality); 
    921             } 
    922              
    923             if (minimalNodeEquality == TaskEquality.LEXICALLY_EQUAL) { 
    924                 lexicalComparer = comparer; 
    925                 lexicalEqualityBuffer = equalityBuffer; 
    926             } 
    927             else { 
    928                 lexicalComparer = new LexicalComparer(taskEqualityRuleManager); 
    929                 lexicalEqualityBuffer = new HashMap<Long, Boolean>(); 
    930             } 
     909        public TaskComparator(TaskEquality minimalNodeEquality) { 
     910            this.minimalNodeEquality = minimalNodeEquality; 
     911            init(); 
    931912        } 
    932913 
     
    991972            return result; 
    992973        } 
     974         
     975        /** 
     976         *  
     977         */ 
     978        private void init() { 
     979            if (minimalNodeEquality == TaskEquality.LEXICALLY_EQUAL) { 
     980                comparer = new LexicalComparer(); 
     981            } 
     982            else if (minimalNodeEquality == TaskEquality.SYNTACTICALLY_EQUAL) { 
     983                comparer = new SyntacticalComparer(); 
     984            } 
     985            else if (minimalNodeEquality == TaskEquality.SEMANTICALLY_EQUAL) { 
     986                comparer = new SemanticalComparer(); 
     987            } 
     988            else { 
     989                comparer = new DefaultComparer(this.minimalNodeEquality); 
     990            } 
     991             
     992            if (minimalNodeEquality == TaskEquality.LEXICALLY_EQUAL) { 
     993                lexicalComparer = comparer; 
     994                lexicalEqualityBuffer = equalityBuffer; 
     995            } 
     996            else { 
     997                lexicalComparer = new LexicalComparer(); 
     998                lexicalEqualityBuffer = new HashMap<Long, Boolean>(); 
     999            } 
     1000        } 
     1001         
     1002        /** 
     1003         * <p> 
     1004         * deserialize this object and reinitialize the buffers 
     1005         * </p> 
     1006         */ 
     1007        private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { 
     1008            in.defaultReadObject(); 
     1009            init(); 
     1010        } 
    9931011    } 
    9941012 
     
    10101028         
    10111029        /** 
    1012          * <p> 
    1013          * the task equality manager needed for comparing tasks with each other 
    1014          * </p> 
    1015          */ 
    1016         private TaskEqualityRuleManager taskEqualityRuleManager; 
    1017          
    1018         /** 
    1019          * 
    1020          */ 
    1021         public LexicalComparer(TaskEqualityRuleManager taskEqualityRuleManager) { 
    1022            this.taskEqualityRuleManager = taskEqualityRuleManager; 
    1023         } 
    1024          
    1025         /** 
    10261030         *  
    10271031         */ 
    10281032        public boolean compare(ITask task1, ITask task2) { 
    1029             return taskEqualityRuleManager.areLexicallyEqual(task1, task2); 
     1033            return TaskEqualityRuleManager.getInstance().areLexicallyEqual(task1, task2); 
    10301034        } 
    10311035    } 
     
    10371041         
    10381042        /** 
    1039          * <p> 
    1040          * the task equality manager needed for comparing tasks with each other 
    1041          * </p> 
    1042          */ 
    1043         private TaskEqualityRuleManager taskEqualityRuleManager; 
    1044          
    1045         /** 
    1046          * 
    1047          */ 
    1048         public SyntacticalComparer(TaskEqualityRuleManager taskEqualityRuleManager) { 
    1049            this.taskEqualityRuleManager = taskEqualityRuleManager; 
    1050         } 
    1051          
    1052         /** 
    10531043         *  
    10541044         */ 
    10551045        public boolean compare(ITask task1, ITask task2) { 
    1056             return taskEqualityRuleManager.areSyntacticallyEqual(task1, task2); 
     1046            return TaskEqualityRuleManager.getInstance().areSyntacticallyEqual(task1, task2); 
    10571047        } 
    10581048    } 
     
    10641054         
    10651055        /** 
    1066          * <p> 
    1067          * the task equality manager needed for comparing tasks with each other 
    1068          * </p> 
    1069          */ 
    1070         private TaskEqualityRuleManager taskEqualityRuleManager; 
    1071          
    1072         /** 
    1073          * 
    1074          */ 
    1075         public SemanticalComparer(TaskEqualityRuleManager taskEqualityRuleManager) { 
    1076            this.taskEqualityRuleManager = taskEqualityRuleManager; 
    1077         } 
    1078          
    1079         /** 
    10801056         *  
    10811057         */ 
    10821058        public boolean compare(ITask task1, ITask task2) { 
    1083             return taskEqualityRuleManager.areSemanticallyEqual(task1, task2); 
     1059            return TaskEqualityRuleManager.getInstance().areSemanticallyEqual(task1, task2); 
    10841060        } 
    10851061    } 
     
    10901066    private static class DefaultComparer implements Comparer { 
    10911067         
    1092         /** 
    1093          * <p> 
    1094          * the task equality manager needed for comparing tasks with each other 
    1095          * </p> 
    1096          */ 
    1097         private TaskEqualityRuleManager taskEqualityRuleManager; 
    1098  
    10991068        /** 
    11001069         * <p> 
     
    11071076         * 
    11081077         */ 
    1109         public DefaultComparer(TaskEqualityRuleManager taskEqualityRuleManager, 
    1110                                TaskEquality            minimalNodeEquality) 
    1111         { 
    1112            this.taskEqualityRuleManager = taskEqualityRuleManager; 
     1078        public DefaultComparer(TaskEquality minimalNodeEquality) { 
    11131079           this.minimalNodeEquality = minimalNodeEquality; 
    11141080        } 
     
    11181084         */ 
    11191085        public boolean compare(ITask task1, ITask task2) { 
    1120             return taskEqualityRuleManager.areAtLeastEqual(task1, task2, minimalNodeEquality); 
     1086            return TaskEqualityRuleManager.getInstance().areAtLeastEqual 
     1087                (task1, task2, minimalNodeEquality); 
    11211088        } 
    11221089    } 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java

    r1146 r1189  
    2323import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 
    2424import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    2625import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    2726import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     
    9089    /** 
    9190     * <p> 
    92      * the task equality manager needed by the rules to compare tasks with each other 
    93      * </p> 
    94      */ 
    95     private TaskEqualityRuleManager taskEqualityRuleManager; 
    96  
    97     /** 
    98      * <p> 
    9991     * the task factory to be used during rule application 
    10092     * </p> 
     
    130122     * </p> 
    131123     *  
    132      * @param taskEqualityRuleManager the task equality rule manager to be used by the known rules 
    133      *                                for task comparison during rule application 
    134124     * @param taskFactory             the task factory to be used for instantiating new task tree 
    135125     *                                tasks during rule application 
     
    137127     *                                with each other during rule application 
    138128     */ 
    139     public TemporalRelationshipRuleManager(TaskEqualityRuleManager taskEqualityRuleManager, 
    140                                            ITaskFactory            taskFactory, 
    141                                            ITaskBuilder            taskBuilder) 
    142     { 
     129    public TemporalRelationshipRuleManager(ITaskFactory taskFactory, ITaskBuilder taskBuilder) { 
    143130        super(); 
    144         this.taskEqualityRuleManager = taskEqualityRuleManager; 
    145131        this.taskFactory = taskFactory; 
    146132        this.taskBuilder = taskBuilder; 
     
    162148        sessionScopeRules = new ISessionScopeRule[] { 
    163149            new SequenceForTaskDetectionRule 
    164                 (taskEqualityRuleManager, TaskEquality.SEMANTICALLY_EQUAL, 
    165                  taskFactory, taskBuilder), 
     150                (TaskEquality.SEMANTICALLY_EQUAL, taskFactory, taskBuilder), 
    166151            /*new DefaultTaskSequenceDetectionRule 
    167                 (taskEqualityRuleManager, NodeEquality.SYNTACTICALLY_EQUAL, 
    168                  taskFactory, taskTreeBuilder), 
     152                (NodeEquality.SYNTACTICALLY_EQUAL, taskFactory, taskTreeBuilder), 
    169153            new DefaultTaskSequenceDetectionRule 
    170                 (taskEqualityRuleManager, NodeEquality.LEXICALLY_EQUAL, 
    171                  taskFactory, taskTreeBuilder),*/ 
     154                (NodeEquality.LEXICALLY_EQUAL, taskFactory, taskTreeBuilder),*/ 
    172155            /*new TreeScopeWrapperRule 
    173156                (new DefaultIterationDetectionRule 
    174                     (taskEqualityRuleManager, NodeEquality.LEXICALLY_EQUAL, 
    175                      taskFactory, taskTreeBuilder)), 
     157                    (NodeEquality.LEXICALLY_EQUAL, taskFactory, taskTreeBuilder)), 
    176158            new TreeScopeWrapperRule 
    177159                (new DefaultIterationDetectionRule 
    178                     (taskEqualityRuleManager, NodeEquality.SYNTACTICALLY_EQUAL, 
    179                      taskFactory, taskTreeBuilder)), 
     160                    (NodeEquality.SYNTACTICALLY_EQUAL, taskFactory, taskTreeBuilder)), 
    180161            new TreeScopeWrapperRule 
    181162                (new DefaultIterationDetectionRule 
    182                     (taskEqualityRuleManager, NodeEquality.SEMANTICALLY_EQUAL, 
    183                      taskFactory, taskTreeBuilder))*/ 
     163                    (NodeEquality.SEMANTICALLY_EQUAL, taskFactory, taskTreeBuilder))*/ 
    184164        }; 
    185165         
     
    189169            //new SequenceOnGuiElementDetectionRule(taskFactory, taskTreeBuilder), 
    190170            //new EventSequenceOnSameTargetDetectionRule(taskFactory, taskTreeBuilder), 
    191             //new TrackBarSelectionDetectionRule(taskEqualityRuleManager, taskFactory, taskBuilder), 
     171            //new TrackBarSelectionDetectionRule(taskFactory, taskBuilder), 
    192172            //new DefaultGuiEventSequenceDetectionRule(taskFactory, taskTreeBuilder), 
    193173        }; 
  • trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/Trie.java

    r1188 r1189  
    6969     * </p> 
    7070     */ 
    71     private transient SymbolComparator<T> comparator; 
     71    private SymbolComparator<T> comparator; 
    7272 
    7373    /** 
  • trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/TrieNode.java

    r1188 r1189  
    7474     * </p> 
    7575     */ 
    76     private transient SymbolComparator<T> comparator; 
     76    private SymbolComparator<T> comparator; 
    7777 
    7878    /** 
Note: See TracChangeset for help on using the changeset viewer.