Changeset 1189
- Timestamp:
- 04/29/13 16:29:53 (12 years ago)
- 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 15 15 package de.ugoe.cs.autoquest.tasktrees.manager; 16 16 17 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager;18 17 import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TemporalRelationshipRuleManager; 19 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; … … 50 49 /** 51 50 * <p> 52 * the default task equality rule manager53 * </p>54 */55 private TaskEqualityRuleManager taskEqualityRuleManager;56 57 /**58 * <p>59 51 * the default task builder 60 52 * </p> … … 78 70 public static TemporalRelationshipRuleManager getTemporalRelationshipRuleManager() { 79 71 return getInstance().temporalRelationshipRuleManager; 80 }81 82 /**83 * <p>84 * returns the default task equality rule manager85 * </p>86 *87 * @return as described88 */89 public static TaskEqualityRuleManager getTaskEqualityRuleManager() {90 return getInstance().taskEqualityRuleManager;91 72 } 92 73 … … 146 127 */ 147 128 private void init() { 148 taskEqualityRuleManager = new TaskEqualityRuleManager();149 taskEqualityRuleManager.init();150 151 129 taskBuilder = new TaskBuilder(); 152 130 taskFactory = new TaskFactory(); 153 131 154 temporalRelationshipRuleManager = new TemporalRelationshipRuleManager155 (taskEqualityRuleManager,taskFactory, taskBuilder);132 temporalRelationshipRuleManager = 133 new TemporalRelationshipRuleManager(taskFactory, taskBuilder); 156 134 temporalRelationshipRuleManager.init(); 157 135 } -
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEqualityRuleManager.java
r1154 r1189 32 32 */ 33 33 public class TaskEqualityRuleManager { 34 35 /** 36 * <p> 37 * the singleton instance of this class 38 * </p> 39 */ 40 private static final TaskEqualityRuleManager instance = new TaskEqualityRuleManager(); 34 41 35 42 /** … … 43 50 * <p> 44 51 * 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() { 49 55 mRuleIndex = new ArrayList<TaskComparisonRule>(); 50 56 mRuleIndex.add(new TaskIdentityRule()); … … 56 62 mRuleIndex.add(new TaskAndIterationComparisonRule(this)); 57 63 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; 58 76 } 59 77 -
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java
r1188 r1189 15 15 package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 16 16 17 import java.io.IOException; 18 import java.io.ObjectInputStream; 17 19 import java.util.HashMap; 18 20 import java.util.Iterator; … … 74 76 * </p> 75 77 */ 76 SequenceForTaskDetectionRule(TaskEqualityRuleManager taskEqualityRuleManager, 77 TaskEquality minimalTaskEquality, 78 ITaskFactory taskFactory, 79 ITaskBuilder taskBuilder) 78 SequenceForTaskDetectionRule(TaskEquality minimalTaskEquality, 79 ITaskFactory taskFactory, 80 ITaskBuilder taskBuilder) 80 81 { 81 82 this.taskFactory = taskFactory; 82 83 this.taskBuilder = taskBuilder; 83 84 84 this.taskComparator = new TaskComparator( taskEqualityRuleManager,minimalTaskEquality);85 this.taskComparator = new TaskComparator(minimalTaskEquality); 85 86 } 86 87 … … 887 888 */ 888 889 private static class TaskComparator implements SymbolComparator<ITaskInstance> { 889 890 890 891 /** */ 891 private Comparer comparer;892 private TaskEquality minimalNodeEquality; 892 893 893 894 /** */ 894 private Comparer lexicalComparer;895 private transient Comparer comparer; 895 896 896 897 /** */ 897 private HashMap<Long, Boolean> equalityBuffer = new HashMap<Long, Boolean>();898 private transient Comparer lexicalComparer; 898 899 899 900 /** */ 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; 901 905 902 906 /** 903 907 * 904 908 */ 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(); 931 912 } 932 913 … … 991 972 return result; 992 973 } 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 } 993 1011 } 994 1012 … … 1010 1028 1011 1029 /** 1012 * <p>1013 * the task equality manager needed for comparing tasks with each other1014 * </p>1015 */1016 private TaskEqualityRuleManager taskEqualityRuleManager;1017 1018 /**1019 *1020 */1021 public LexicalComparer(TaskEqualityRuleManager taskEqualityRuleManager) {1022 this.taskEqualityRuleManager = taskEqualityRuleManager;1023 }1024 1025 /**1026 1030 * 1027 1031 */ 1028 1032 public boolean compare(ITask task1, ITask task2) { 1029 return taskEqualityRuleManager.areLexicallyEqual(task1, task2);1033 return TaskEqualityRuleManager.getInstance().areLexicallyEqual(task1, task2); 1030 1034 } 1031 1035 } … … 1037 1041 1038 1042 /** 1039 * <p>1040 * the task equality manager needed for comparing tasks with each other1041 * </p>1042 */1043 private TaskEqualityRuleManager taskEqualityRuleManager;1044 1045 /**1046 *1047 */1048 public SyntacticalComparer(TaskEqualityRuleManager taskEqualityRuleManager) {1049 this.taskEqualityRuleManager = taskEqualityRuleManager;1050 }1051 1052 /**1053 1043 * 1054 1044 */ 1055 1045 public boolean compare(ITask task1, ITask task2) { 1056 return taskEqualityRuleManager.areSyntacticallyEqual(task1, task2);1046 return TaskEqualityRuleManager.getInstance().areSyntacticallyEqual(task1, task2); 1057 1047 } 1058 1048 } … … 1064 1054 1065 1055 /** 1066 * <p>1067 * the task equality manager needed for comparing tasks with each other1068 * </p>1069 */1070 private TaskEqualityRuleManager taskEqualityRuleManager;1071 1072 /**1073 *1074 */1075 public SemanticalComparer(TaskEqualityRuleManager taskEqualityRuleManager) {1076 this.taskEqualityRuleManager = taskEqualityRuleManager;1077 }1078 1079 /**1080 1056 * 1081 1057 */ 1082 1058 public boolean compare(ITask task1, ITask task2) { 1083 return taskEqualityRuleManager.areSemanticallyEqual(task1, task2);1059 return TaskEqualityRuleManager.getInstance().areSemanticallyEqual(task1, task2); 1084 1060 } 1085 1061 } … … 1090 1066 private static class DefaultComparer implements Comparer { 1091 1067 1092 /**1093 * <p>1094 * the task equality manager needed for comparing tasks with each other1095 * </p>1096 */1097 private TaskEqualityRuleManager taskEqualityRuleManager;1098 1099 1068 /** 1100 1069 * <p> … … 1107 1076 * 1108 1077 */ 1109 public DefaultComparer(TaskEqualityRuleManager taskEqualityRuleManager, 1110 TaskEquality minimalNodeEquality) 1111 { 1112 this.taskEqualityRuleManager = taskEqualityRuleManager; 1078 public DefaultComparer(TaskEquality minimalNodeEquality) { 1113 1079 this.minimalNodeEquality = minimalNodeEquality; 1114 1080 } … … 1118 1084 */ 1119 1085 public boolean compare(ITask task1, ITask task2) { 1120 return taskEqualityRuleManager.areAtLeastEqual(task1, task2, minimalNodeEquality); 1086 return TaskEqualityRuleManager.getInstance().areAtLeastEqual 1087 (task1, task2, minimalNodeEquality); 1121 1088 } 1122 1089 } -
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java
r1146 r1189 23 23 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 24 24 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager;26 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 27 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; … … 90 89 /** 91 90 * <p> 92 * the task equality manager needed by the rules to compare tasks with each other93 * </p>94 */95 private TaskEqualityRuleManager taskEqualityRuleManager;96 97 /**98 * <p>99 91 * the task factory to be used during rule application 100 92 * </p> … … 130 122 * </p> 131 123 * 132 * @param taskEqualityRuleManager the task equality rule manager to be used by the known rules133 * for task comparison during rule application134 124 * @param taskFactory the task factory to be used for instantiating new task tree 135 125 * tasks during rule application … … 137 127 * with each other during rule application 138 128 */ 139 public TemporalRelationshipRuleManager(TaskEqualityRuleManager taskEqualityRuleManager, 140 ITaskFactory taskFactory, 141 ITaskBuilder taskBuilder) 142 { 129 public TemporalRelationshipRuleManager(ITaskFactory taskFactory, ITaskBuilder taskBuilder) { 143 130 super(); 144 this.taskEqualityRuleManager = taskEqualityRuleManager;145 131 this.taskFactory = taskFactory; 146 132 this.taskBuilder = taskBuilder; … … 162 148 sessionScopeRules = new ISessionScopeRule[] { 163 149 new SequenceForTaskDetectionRule 164 (taskEqualityRuleManager, TaskEquality.SEMANTICALLY_EQUAL, 165 taskFactory, taskBuilder), 150 (TaskEquality.SEMANTICALLY_EQUAL, taskFactory, taskBuilder), 166 151 /*new DefaultTaskSequenceDetectionRule 167 (taskEqualityRuleManager, NodeEquality.SYNTACTICALLY_EQUAL, 168 taskFactory, taskTreeBuilder), 152 (NodeEquality.SYNTACTICALLY_EQUAL, taskFactory, taskTreeBuilder), 169 153 new DefaultTaskSequenceDetectionRule 170 (taskEqualityRuleManager, NodeEquality.LEXICALLY_EQUAL, 171 taskFactory, taskTreeBuilder),*/ 154 (NodeEquality.LEXICALLY_EQUAL, taskFactory, taskTreeBuilder),*/ 172 155 /*new TreeScopeWrapperRule 173 156 (new DefaultIterationDetectionRule 174 (taskEqualityRuleManager, NodeEquality.LEXICALLY_EQUAL, 175 taskFactory, taskTreeBuilder)), 157 (NodeEquality.LEXICALLY_EQUAL, taskFactory, taskTreeBuilder)), 176 158 new TreeScopeWrapperRule 177 159 (new DefaultIterationDetectionRule 178 (taskEqualityRuleManager, NodeEquality.SYNTACTICALLY_EQUAL, 179 taskFactory, taskTreeBuilder)), 160 (NodeEquality.SYNTACTICALLY_EQUAL, taskFactory, taskTreeBuilder)), 180 161 new TreeScopeWrapperRule 181 162 (new DefaultIterationDetectionRule 182 (taskEqualityRuleManager, NodeEquality.SEMANTICALLY_EQUAL, 183 taskFactory, taskTreeBuilder))*/ 163 (NodeEquality.SEMANTICALLY_EQUAL, taskFactory, taskTreeBuilder))*/ 184 164 }; 185 165 … … 189 169 //new SequenceOnGuiElementDetectionRule(taskFactory, taskTreeBuilder), 190 170 //new EventSequenceOnSameTargetDetectionRule(taskFactory, taskTreeBuilder), 191 //new TrackBarSelectionDetectionRule(task EqualityRuleManager, taskFactory, taskBuilder),171 //new TrackBarSelectionDetectionRule(taskFactory, taskBuilder), 192 172 //new DefaultGuiEventSequenceDetectionRule(taskFactory, taskTreeBuilder), 193 173 }; -
trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/Trie.java
r1188 r1189 69 69 * </p> 70 70 */ 71 private transientSymbolComparator<T> comparator;71 private SymbolComparator<T> comparator; 72 72 73 73 /** -
trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/TrieNode.java
r1188 r1189 74 74 * </p> 75 75 */ 76 private transientSymbolComparator<T> comparator;76 private SymbolComparator<T> comparator; 77 77 78 78 /**
Note: See TracChangeset
for help on using the changeset viewer.