- Timestamp:
- 08/16/12 14:45:03 (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 deleted
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-assertions-test/src/test/java/de/ugoe/cs/quest/assertions/FileEqualsReplayTest.java
r518 r548 66 66 } 67 67 68 @Test69 public void testGetTarget_1() throws Exception {70 FileEqualsReplay fixture = new FileEqualsReplay("", "");71 72 String result = fixture.getTarget();73 74 assertEquals("targetNotUsed", result);75 }76 77 68 public static void main(String[] args) { 78 69 new org.junit.runner.JUnitCore().run(FileEqualsReplayTest.class); -
trunk/quest-core-assertions/.classpath
r518 r548 2 2 <classpath> 3 3 <classpathentry kind="src" output="target/classes" path="src/main/java"> 4 <attributes> 5 <attribute name="optional" value="true"/> 6 <attribute name="maven.pomderived" value="true"/> 7 </attributes> 8 </classpathentry> 9 <classpathentry kind="src" output="target/test-classes" path="src/test/java"> 4 10 <attributes> 5 11 <attribute name="optional" value="true"/> -
trunk/quest-core-assertions/src/main/java/de/ugoe/cs/quest/assertions/FileEqualsReplay.java
r518 r548 79 79 } 80 80 81 /*82 * (non-Javadoc)83 *84 * @see de.ugoe.cs.quest.eventcore.IReplayable#getTarget()85 */86 @Override87 public String getTarget() {88 return "targetNotUsed";89 }90 91 81 } -
trunk/quest-core-assertions/src/main/java/de/ugoe/cs/quest/assertions/TextEqualsReplay.java
r518 r548 87 87 * @see de.ugoe.cs.quest.eventcore.IReplayable#getTarget() 88 88 */ 89 @Override89 //@Override TODO 90 90 public String getTarget() { 91 91 return target; -
trunk/quest-core-coverage-test/src/test/java/de/ugoe/cs/quest/coverage/CoverageCalculatorObservedTest.java
r518 r548 6 6 import de.ugoe.cs.quest.eventcore.Event; 7 7 import de.ugoe.cs.quest.usageprofiles.MockTrieBasedModel; 8 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 8 9 9 10 import java.util.LinkedHashSet; … … 26 27 public class CoverageCalculatorObservedTest { 27 28 28 Collection<List< ? extends Event<?>>> sequencesObserved;29 30 Set<List< ? extends Event<?>>> sequencesCovered;31 Set<List< ? extends Event<?>>> sequencesCovered2;32 Set<List< ? extends Event<?>>> sequencesNewPossible;29 Collection<List<Event>> sequencesObserved; 30 31 Set<List<Event>> sequencesCovered; 32 Set<List<Event>> sequencesCovered2; 33 Set<List<Event>> sequencesNewPossible; 33 34 34 35 MockTrieBasedModel mockProcess; … … 257 258 @Before 258 259 public void setUp() throws Exception { 259 sequencesObserved = new LinkedList<List< ? extends Event<?>>>();260 List<Event <?>> sequence1 = new ArrayList<Event<?>>();261 sequence1.add(new Event <String>("a"));262 sequence1.add(new Event <String>("b"));263 sequence1.add(new Event <String>("r"));264 sequence1.add(new Event <String>("a"));265 List<Event <?>> sequence2 = new ArrayList<Event<?>>();266 sequence2.add(new Event <String>("c"));267 sequence2.add(new Event <String>("a"));268 sequence2.add(new Event <String>("d"));269 sequence2.add(new Event <String>("a"));270 sequence2.add(new Event <String>("b"));271 sequence2.add(new Event <String>("r"));272 sequence2.add(new Event <String>("a"));260 sequencesObserved = new LinkedList<List<Event>>(); 261 List<Event> sequence1 = new ArrayList<Event>(); 262 sequence1.add(new Event(new StringEventType("a"))); 263 sequence1.add(new Event(new StringEventType("b"))); 264 sequence1.add(new Event(new StringEventType("r"))); 265 sequence1.add(new Event(new StringEventType("a"))); 266 List<Event> sequence2 = new ArrayList<Event>(); 267 sequence2.add(new Event(new StringEventType("c"))); 268 sequence2.add(new Event(new StringEventType("a"))); 269 sequence2.add(new Event(new StringEventType("d"))); 270 sequence2.add(new Event(new StringEventType("a"))); 271 sequence2.add(new Event(new StringEventType("b"))); 272 sequence2.add(new Event(new StringEventType("r"))); 273 sequence2.add(new Event(new StringEventType("a"))); 273 274 sequencesObserved.add(sequence1); 274 275 sequencesObserved.add(sequence2); 275 276 276 sequencesCovered = new LinkedHashSet<List< ? extends Event<?>>>();277 List<Event <?>> tmpList = new ArrayList<Event<?>>();278 tmpList.add(new Event <String>("a"));279 tmpList.add(new Event <String>("b"));280 tmpList.add(new Event <String>("r"));277 sequencesCovered = new LinkedHashSet<List<Event>>(); 278 List<Event> tmpList = new ArrayList<Event>(); 279 tmpList.add(new Event(new StringEventType("a"))); 280 tmpList.add(new Event(new StringEventType("b"))); 281 tmpList.add(new Event(new StringEventType("r"))); 281 282 sequencesCovered.add(tmpList); 282 tmpList = new ArrayList<Event <?>>();283 tmpList.add(new Event <String>("b"));284 tmpList.add(new Event <String>("r"));285 tmpList.add(new Event <String>("a"));286 tmpList.add(new Event <String>("e"));283 tmpList = new ArrayList<Event>(); 284 tmpList.add(new Event(new StringEventType("b"))); 285 tmpList.add(new Event(new StringEventType("r"))); 286 tmpList.add(new Event(new StringEventType("a"))); 287 tmpList.add(new Event(new StringEventType("e"))); 287 288 sequencesCovered.add(tmpList); 288 289 289 sequencesCovered2 = new LinkedHashSet<List< ? extends Event<?>>>();290 tmpList = new ArrayList<Event <?>>();291 tmpList.add(new Event <String>("a"));292 tmpList.add(new Event <String>("b"));293 tmpList.add(new Event <String>("r"));290 sequencesCovered2 = new LinkedHashSet<List<Event>>(); 291 tmpList = new ArrayList<Event>(); 292 tmpList.add(new Event(new StringEventType("a"))); 293 tmpList.add(new Event(new StringEventType("b"))); 294 tmpList.add(new Event(new StringEventType("r"))); 294 295 sequencesCovered2.add(tmpList); 295 296 296 sequencesNewPossible = new LinkedHashSet<List< ? extends Event<?>>>();297 tmpList = new ArrayList<Event <?>>();298 tmpList.add(new Event <String>("r"));299 tmpList.add(new Event <String>("a"));300 tmpList.add(new Event <String>("b"));297 sequencesNewPossible = new LinkedHashSet<List<Event>>(); 298 tmpList = new ArrayList<Event>(); 299 tmpList.add(new Event(new StringEventType("r"))); 300 tmpList.add(new Event(new StringEventType("a"))); 301 tmpList.add(new Event(new StringEventType("b"))); 301 302 sequencesNewPossible.add(tmpList); 302 303 -
trunk/quest-core-coverage-test/src/test/java/de/ugoe/cs/quest/coverage/CoverageCalculatorProcessTest.java
r518 r548 12 12 import de.ugoe.cs.quest.eventcore.Event; 13 13 import de.ugoe.cs.quest.usageprofiles.MockTrieBasedModel; 14 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 14 15 15 16 import org.junit.*; … … 26 27 public class CoverageCalculatorProcessTest { 27 28 28 Set<List< ? extends Event<?>>> sequencesCovered;29 Set<List< ? extends Event<?>>> sequencesCovered2;29 Set<List<Event>> sequencesCovered; 30 Set<List<Event>> sequencesCovered2; 30 31 MockTrieBasedModel mockProcess; 31 32 … … 189 190 @Before 190 191 public void setUp() throws Exception { 191 Collection<List< ? extends Event<?>>> sequences = new LinkedList<List<? extends Event<?>>>();192 List<Event <?>> sequence1 = new ArrayList<Event<?>>();193 sequence1.add(new Event <String>("a"));194 sequence1.add(new Event <String>("b"));195 sequence1.add(new Event <String>("r"));196 sequence1.add(new Event <String>("a"));197 List<Event <?>> sequence2 = new ArrayList<Event<?>>();198 sequence2.add(new Event <String>("c"));199 sequence2.add(new Event <String>("a"));200 sequence2.add(new Event <String>("d"));201 sequence2.add(new Event <String>("a"));202 sequence2.add(new Event <String>("b"));203 sequence2.add(new Event <String>("r"));204 sequence2.add(new Event <String>("a"));192 Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 193 List<Event> sequence1 = new ArrayList<Event>(); 194 sequence1.add(new Event(new StringEventType("a"))); 195 sequence1.add(new Event(new StringEventType("b"))); 196 sequence1.add(new Event(new StringEventType("r"))); 197 sequence1.add(new Event(new StringEventType("a"))); 198 List<Event> sequence2 = new ArrayList<Event>(); 199 sequence2.add(new Event(new StringEventType("c"))); 200 sequence2.add(new Event(new StringEventType("a"))); 201 sequence2.add(new Event(new StringEventType("d"))); 202 sequence2.add(new Event(new StringEventType("a"))); 203 sequence2.add(new Event(new StringEventType("b"))); 204 sequence2.add(new Event(new StringEventType("r"))); 205 sequence2.add(new Event(new StringEventType("a"))); 205 206 sequences.add(sequence1); 206 207 sequences.add(sequence2); 207 208 208 sequencesCovered = new LinkedHashSet<List< ? extends Event<?>>>();209 List<Event <?>> tmpList = new ArrayList<Event<?>>();210 tmpList.add(new Event <String>("a"));211 tmpList.add(new Event <String>("b"));212 tmpList.add(new Event <String>("r"));209 sequencesCovered = new LinkedHashSet<List<Event>>(); 210 List<Event> tmpList = new ArrayList<Event>(); 211 tmpList.add(new Event(new StringEventType("a"))); 212 tmpList.add(new Event(new StringEventType("b"))); 213 tmpList.add(new Event(new StringEventType("r"))); 213 214 sequencesCovered.add(tmpList); 214 tmpList = new ArrayList<Event <?>>();215 tmpList.add(new Event <String>("b"));216 tmpList.add(new Event <String>("r"));217 tmpList.add(new Event <String>("a"));215 tmpList = new ArrayList<Event>(); 216 tmpList.add(new Event(new StringEventType("b"))); 217 tmpList.add(new Event(new StringEventType("r"))); 218 tmpList.add(new Event(new StringEventType("a"))); 218 219 sequencesCovered.add(tmpList); 219 220 220 sequencesCovered2 = new LinkedHashSet<List< ? extends Event<?>>>();221 tmpList = new ArrayList<Event <?>>();222 tmpList.add(new Event <String>("a"));223 tmpList.add(new Event <String>("b"));224 tmpList.add(new Event <String>("r"));221 sequencesCovered2 = new LinkedHashSet<List<Event>>(); 222 tmpList = new ArrayList<Event>(); 223 tmpList.add(new Event(new StringEventType("a"))); 224 tmpList.add(new Event(new StringEventType("b"))); 225 tmpList.add(new Event(new StringEventType("r"))); 225 226 sequencesCovered2.add(tmpList); 226 227 -
trunk/quest-core-coverage-test/src/test/java/de/ugoe/cs/quest/coverage/SequenceToolsTest.java
r518 r548 15 15 import de.ugoe.cs.quest.usageprofiles.IStochasticProcess; 16 16 import de.ugoe.cs.quest.usageprofiles.MockTrieBasedModel; 17 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 17 18 18 19 import org.junit.*; … … 28 29 public class SequenceToolsTest { 29 30 30 Collection<List< ? extends Event<?>>> sequences;31 Set<List< ? extends Event<?>>> subSequences;31 Collection<List<Event>> sequences; 32 Set<List<Event>> subSequences; 32 33 MockTrieBasedModel mockProcess; 33 34 … … 37 38 int length = 2; 38 39 39 Set<List< ? extends Event<?>>> result = SequenceTools.containedSubSequences(sequences, length);40 Set<List<Event>> result = SequenceTools.containedSubSequences(sequences, length); 40 41 41 42 assertNotNull(result); … … 49 50 int length = 2; 50 51 51 Set<List< ? extends Event<?>>> result = SequenceTools.containedSubSequences(null, length);52 Set<List<Event>> result = SequenceTools.containedSubSequences(null, length); 52 53 assertNotNull(result); 53 54 assertTrue(result.isEmpty()); … … 73 74 public void testGenerateWeights_1() 74 75 throws Exception { 75 Map<List< ? extends Event<?>>, Double> result = SequenceTools.generateWeights(mockProcess, subSequences);76 77 assertNotNull(result); 78 Set<Entry<List< ? extends Event<?>>, Double>> entrySet = result.entrySet();76 Map<List<Event>, Double> result = SequenceTools.generateWeights(mockProcess, subSequences); 77 78 assertNotNull(result); 79 Set<Entry<List<Event>, Double>> entrySet = result.entrySet(); 79 80 assertEquals(subSequences.size(),entrySet.size()); 80 for( Entry<List< ? extends Event<?>>, Double> entry : entrySet ) {81 for( Entry<List<Event>, Double> entry : entrySet ) { 81 82 assertEquals(Double.valueOf(2.0d), entry.getValue()); 82 83 assertTrue(subSequences.contains(entry.getKey())); … … 87 88 public void testGenerateWeights_2() 88 89 throws Exception { 89 Map<List< ? extends Event<?>>, Double> result = SequenceTools.generateWeights(null, subSequences);90 91 Set<Entry<List< ? extends Event<?>>, Double>> entrySet = result.entrySet();90 Map<List<Event>, Double> result = SequenceTools.generateWeights(null, subSequences); 91 92 Set<Entry<List<Event>, Double>> entrySet = result.entrySet(); 92 93 assertEquals(subSequences.size(),entrySet.size()); 93 for( Entry<List< ? extends Event<?>>, Double> entry : entrySet ) {94 for( Entry<List<Event>, Double> entry : entrySet ) { 94 95 assertEquals(Double.valueOf(0.0d), entry.getValue()); 95 96 assertTrue(subSequences.contains(entry.getKey())); … … 100 101 public void testGenerateWeights_3() 101 102 throws Exception { 102 Map<List< ? extends Event<?>>, Double> result = SequenceTools.generateWeights(mockProcess, null);103 Map<List<Event>, Double> result = SequenceTools.generateWeights(mockProcess, null); 103 104 104 105 assertNotNull(result); … … 148 149 public void setUp() 149 150 throws Exception { 150 sequences = new LinkedList<List< ? extends Event<?>>>();151 List<Event <?>> sequence1 = new ArrayList<Event<?>>();152 sequence1.add(new Event <String>("a"));153 sequence1.add(new Event <String>("b"));154 sequence1.add(new Event <String>("r"));155 sequence1.add(new Event <String>("a"));156 List<Event <?>> sequence2 = new ArrayList<Event<?>>();157 sequence2.add(new Event <String>("c"));158 sequence2.add(new Event <String>("a"));159 sequence2.add(new Event <String>("d"));160 sequence2.add(new Event <String>("a"));161 sequence2.add(new Event <String>("b"));162 sequence2.add(new Event <String>("r"));163 sequence2.add(new Event <String>("a"));151 sequences = new LinkedList<List<Event>>(); 152 List<Event> sequence1 = new ArrayList<Event>(); 153 sequence1.add(new Event(new StringEventType("a"))); 154 sequence1.add(new Event(new StringEventType("b"))); 155 sequence1.add(new Event(new StringEventType("r"))); 156 sequence1.add(new Event(new StringEventType("a"))); 157 List<Event> sequence2 = new ArrayList<Event>(); 158 sequence2.add(new Event(new StringEventType("c"))); 159 sequence2.add(new Event(new StringEventType("a"))); 160 sequence2.add(new Event(new StringEventType("d"))); 161 sequence2.add(new Event(new StringEventType("a"))); 162 sequence2.add(new Event(new StringEventType("b"))); 163 sequence2.add(new Event(new StringEventType("r"))); 164 sequence2.add(new Event(new StringEventType("a"))); 164 165 sequences.add(sequence1); 165 166 sequences.add(sequence2); 166 167 167 subSequences = new LinkedHashSet<List< ? extends Event<?>>>();168 List<Event <?>> tmpList = new ArrayList<Event<?>>();169 tmpList.add(new Event <String>("a"));170 tmpList.add(new Event <String>("b"));171 subSequences.add(tmpList); 172 tmpList = new ArrayList<Event <?>>();173 tmpList.add(new Event <String>("b"));174 tmpList.add(new Event <String>("r"));175 subSequences.add(tmpList); 176 tmpList = new ArrayList<Event <?>>();177 tmpList.add(new Event <String>("r"));178 tmpList.add(new Event <String>("a"));179 subSequences.add(tmpList); 180 tmpList = new ArrayList<Event <?>>();181 tmpList.add(new Event <String>("c"));182 tmpList.add(new Event <String>("a"));183 subSequences.add(tmpList); 184 tmpList = new ArrayList<Event <?>>();185 tmpList.add(new Event <String>("a"));186 tmpList.add(new Event <String>("d"));187 subSequences.add(tmpList); 188 tmpList = new ArrayList<Event <?>>();189 tmpList.add(new Event <String>("d"));190 tmpList.add(new Event <String>("a"));168 subSequences = new LinkedHashSet<List<Event>>(); 169 List<Event> tmpList = new ArrayList<Event>(); 170 tmpList.add(new Event(new StringEventType("a"))); 171 tmpList.add(new Event(new StringEventType("b"))); 172 subSequences.add(tmpList); 173 tmpList = new ArrayList<Event>(); 174 tmpList.add(new Event(new StringEventType("b"))); 175 tmpList.add(new Event(new StringEventType("r"))); 176 subSequences.add(tmpList); 177 tmpList = new ArrayList<Event>(); 178 tmpList.add(new Event(new StringEventType("r"))); 179 tmpList.add(new Event(new StringEventType("a"))); 180 subSequences.add(tmpList); 181 tmpList = new ArrayList<Event>(); 182 tmpList.add(new Event(new StringEventType("c"))); 183 tmpList.add(new Event(new StringEventType("a"))); 184 subSequences.add(tmpList); 185 tmpList = new ArrayList<Event>(); 186 tmpList.add(new Event(new StringEventType("a"))); 187 tmpList.add(new Event(new StringEventType("d"))); 188 subSequences.add(tmpList); 189 tmpList = new ArrayList<Event>(); 190 tmpList.add(new Event(new StringEventType("d"))); 191 tmpList.add(new Event(new StringEventType("a"))); 191 192 subSequences.add(tmpList); 192 193 -
trunk/quest-core-coverage/.classpath
r518 r548 2 2 <classpath> 3 3 <classpathentry kind="src" output="target/classes" path="src/main/java"> 4 <attributes> 5 <attribute name="optional" value="true"/> 6 <attribute name="maven.pomderived" value="true"/> 7 </attributes> 8 </classpathentry> 9 <classpathentry kind="src" output="target/test-classes" path="src/test/java"> 4 10 <attributes> 5 11 <attribute name="optional" value="true"/> -
trunk/quest-core-events-test/src/test/java/de/ugoe/cs/quest/SequenceInstanceOfTest.java
r547 r548 9 9 10 10 import static org.junit.Assert.*; 11 import static org.mockito.Mockito.*; 11 12 12 13 import de.ugoe.cs.quest.SequenceInstanceOf; 13 14 import de.ugoe.cs.quest.eventcore.Event; 15 import de.ugoe.cs.quest.eventcore.IEventType; 14 16 15 17 … … 27 29 Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 28 30 List<Event> sequence1 = new ArrayList<Event>(); 29 sequence1.add(new Event <String>("a"));31 sequence1.add(new Event(mock(IEventType.class))); 30 32 sequences.add(sequence1); 31 33 … … 67 69 public void TestIsEventSequence_1() throws Exception { 68 70 List<Event> sequence = new ArrayList<Event>(); 69 sequence.add(new Event <String>("a"));71 sequence.add(new Event(mock(IEventType.class))); 70 72 71 73 boolean result = SequenceInstanceOf.isEventSequence(sequence); -
trunk/quest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/EventTest.java
r547 r548 2 2 package de.ugoe.cs.quest.eventcore; 3 3 4 5 import java.util.LinkedList; 6 import java.util.List; 4 7 5 8 import org.junit.*; … … 225 228 assertEquals("(typeString;targetString)", result); 226 229 } 230 231 @Test 232 public void testAddReplayable_1() throws Exception { 233 IReplayable replayable = mock(IReplayable.class); 234 235 Event fixture = new Event(mock(IEventType.class)); 236 fixture.addReplayable(replayable); 237 238 assertEquals(1, fixture.getReplayables().size()); 239 assertEquals(replayable, fixture.getReplayables().get(0)); 240 } 241 242 @Test 243 public void testAddReplayEvent_2() throws Exception { 244 IReplayable replayable1 = mock(IReplayable.class); 245 IReplayable replayable2 = mock(IReplayable.class); 246 247 Event fixture = new Event(mock(IEventType.class)); 248 fixture.addReplayable(replayable1); 249 fixture.addReplayable(replayable2); 250 251 assertEquals(2, fixture.getReplayables().size()); 252 assertEquals(replayable1, fixture.getReplayables().get(0)); 253 assertEquals(replayable2, fixture.getReplayables().get(1)); 254 } 255 256 @Test(expected = java.security.InvalidParameterException.class) 257 public void testAddReplayEvent_fixture_3() throws Exception { 258 Event fixture = new Event(mock(IEventType.class)); 259 fixture.addReplayable(null); 260 } 261 262 @Test 263 public void testAddReplaySequence_1() throws Exception { 264 IReplayable replayable1 = mock(IReplayable.class); 265 IReplayable replayable2 = mock(IReplayable.class); 266 267 List<IReplayable> replayableSequences = new LinkedList<IReplayable>(); 268 replayableSequences.add(replayable1); 269 replayableSequences.add(replayable2); 270 271 Event fixture = new Event(mock(IEventType.class)); 272 273 fixture.addReplayableSequence(replayableSequences); 274 275 assertEquals(2, fixture.getReplayables().size()); 276 assertEquals(replayable1, fixture.getReplayables().get(0)); 277 assertEquals(replayable2, fixture.getReplayables().get(1)); 278 } 279 280 @Test(expected = java.security.InvalidParameterException.class) 281 public void testAddReplaySequence_2() throws Exception { 282 Event fixture = new Event(mock(IEventType.class)); 283 284 fixture.addReplayableSequence(null); 285 } 227 286 228 287 public static void main(String[] args) { -
trunk/quest-core-events/.classpath
r482 r548 2 2 <classpath> 3 3 <classpathentry kind="src" output="target/classes" path="src/main/java"> 4 <attributes> 5 <attribute name="optional" value="true"/> 6 <attribute name="maven.pomderived" value="true"/> 7 </attributes> 8 </classpathentry> 9 <classpathentry kind="src" output="target/test-classes" path="src/test/java"> 4 10 <attributes> 5 11 <attribute name="optional" value="true"/> -
trunk/quest-core-tasktrees/.classpath
r498 r548 2 2 <classpath> 3 3 <classpathentry kind="src" output="target/classes" path="src/main/java"> 4 <attributes> 5 <attribute name="optional" value="true"/> 6 <attribute name="maven.pomderived" value="true"/> 7 </attributes> 8 </classpathentry> 9 <classpathentry kind="src" output="target/test-classes" path="src/test/java"> 4 10 <attributes> 5 11 <attribute name="optional" value="true"/> -
trunk/quest-core-testgeneration/.classpath
r523 r548 2 2 <classpath> 3 3 <classpathentry kind="src" output="target/classes" path="src/main/java"> 4 <attributes> 5 <attribute name="optional" value="true"/> 6 <attribute name="maven.pomderived" value="true"/> 7 </attributes> 8 </classpathentry> 9 <classpathentry kind="src" output="target/test-classes" path="src/test/java"> 4 10 <attributes> 5 11 <attribute name="optional" value="true"/> -
trunk/quest-core-usability/.classpath
r495 r548 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 <classpathentry kind="src" path="src/main/java"/> 4 <classpathentry kind="src" path="src/main/resources"/> 5 <classpathentry kind="src" path="target/generated-sources/xjc"/> 3 <classpathentry kind="src" output="target/classes" path="src/main/java"> 4 <attributes> 5 <attribute name="optional" value="true"/> 6 <attribute name="maven.pomderived" value="true"/> 7 </attributes> 8 </classpathentry> 9 <classpathentry including="**/*.java" kind="src" path="src/main/resources"/> 10 <classpathentry including="**/*.java" kind="src" output="target/classes" path="target/generated-sources/xjc"> 11 <attributes> 12 <attribute name="optional" value="true"/> 13 <attribute name="maven.pomderived" value="true"/> 14 </attributes> 15 </classpathentry> 16 <classpathentry kind="src" output="target/test-classes" path="src/test/java"> 17 <attributes> 18 <attribute name="optional" value="true"/> 19 <attribute name="maven.pomderived" value="true"/> 20 </attributes> 21 </classpathentry> 6 22 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> 7 23 <attributes> -
trunk/quest-core-usageprofiles-test/src/test/java/de/ugoe/cs/quest/usageprofiles/DeterministicFiniteAutomatonTest.java
r518 r548 7 7 import de.ugoe.cs.quest.eventcore.Event; 8 8 import de.ugoe.cs.quest.usageprofiles.DeterministicFiniteAutomaton; 9 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 9 10 10 11 import java.util.Random; … … 22 23 public class DeterministicFiniteAutomatonTest { 23 24 24 Collection<List< ? extends Event<?>>> sequences;25 Collection<List<Event>> sequences; 25 26 26 27 @Test … … 46 47 fixture.train(sequences); 47 48 48 List<Event <String>> context = new ArrayList<Event<String>>();49 context.add(new Event <String>("a"));50 context.add(new Event <String>("b"));49 List<Event> context = new ArrayList<Event>(); 50 context.add(new Event(new StringEventType("a"))); 51 context.add(new Event(new StringEventType("b"))); 51 52 52 Event <String> symbol = new Event<String>("r");53 Event symbol = new Event(new StringEventType("r")); 53 54 54 55 double result = fixture.getProbability(context, symbol); … … 63 64 fixture.train(sequences); 64 65 65 List<Event <String>> context = new ArrayList<Event<String>>();66 context.add(new Event <String>("a"));66 List<Event> context = new ArrayList<Event>(); 67 context.add(new Event(new StringEventType("a"))); 67 68 68 Event <String> symbol = new Event<String>("b");69 Event symbol = new Event(new StringEventType("b")); 69 70 70 71 double result = fixture.getProbability(context, symbol); … … 79 80 fixture.train(sequences); 80 81 81 List<Event <String>> context = new ArrayList<Event<String>>();82 context.add(new Event <String>("a"));82 List<Event> context = new ArrayList<Event>(); 83 context.add(new Event(new StringEventType("a"))); 83 84 84 Event <String> symbol = new Event<String>("c");85 Event symbol = new Event(new StringEventType("c")); 85 86 86 87 double result = fixture.getProbability(context, symbol); … … 95 96 fixture.train(sequences); 96 97 97 List<Event <String>> context = new ArrayList<Event<String>>();98 context.add(new Event <String>("a"));98 List<Event> context = new ArrayList<Event>(); 99 context.add(new Event(new StringEventType("a"))); 99 100 100 Event <String> symbol = new Event<String>("e");101 Event symbol = new Event(new StringEventType("e")); 101 102 102 103 double result = fixture.getProbability(context, symbol); … … 111 112 fixture.train(sequences); 112 113 113 List<Event <String>> context = new ArrayList<Event<String>>();114 context.add(new Event <String>("a"));114 List<Event> context = new ArrayList<Event>(); 115 context.add(new Event(new StringEventType("a"))); 115 116 116 Event <String>symbol = null;117 Event symbol = null; 117 118 118 119 fixture.getProbability(context, symbol); … … 125 126 fixture.train(sequences); 126 127 127 List<Event <String>> context = null;128 List<Event> context = null; 128 129 129 Event <String> symbol = new Event<String>("a");130 Event symbol = new Event(new StringEventType("a")); 130 131 131 132 fixture.getProbability(context, symbol); … … 134 135 @Before 135 136 public void setUp() throws Exception { 136 List<Event <?>> sequence = new ArrayList<Event<?>>();137 sequence.add(new Event <String>("a"));138 sequence.add(new Event <String>("b"));139 sequence.add(new Event <String>("r"));140 sequence.add(new Event <String>("a"));141 sequence.add(new Event <String>("c"));142 sequence.add(new Event <String>("a"));143 sequence.add(new Event <String>("d"));144 sequence.add(new Event <String>("a"));145 sequence.add(new Event <String>("b"));146 sequence.add(new Event <String>("r"));147 sequence.add(new Event <String>("a"));137 List<Event> sequence = new ArrayList<Event>(); 138 sequence.add(new Event(new StringEventType("a"))); 139 sequence.add(new Event(new StringEventType("b"))); 140 sequence.add(new Event(new StringEventType("r"))); 141 sequence.add(new Event(new StringEventType("a"))); 142 sequence.add(new Event(new StringEventType("c"))); 143 sequence.add(new Event(new StringEventType("a"))); 144 sequence.add(new Event(new StringEventType("d"))); 145 sequence.add(new Event(new StringEventType("a"))); 146 sequence.add(new Event(new StringEventType("b"))); 147 sequence.add(new Event(new StringEventType("r"))); 148 sequence.add(new Event(new StringEventType("a"))); 148 149 149 sequences = new ArrayList<List< ? extends Event<?>>>();150 sequences = new ArrayList<List<Event>>(); 150 151 sequences.add(sequence); 151 152 } -
trunk/quest-core-usageprofiles-test/src/test/java/de/ugoe/cs/quest/usageprofiles/FirstOrderMarkovModelTest.java
r518 r548 10 10 import de.ugoe.cs.quest.usageprofiles.FirstOrderMarkovModel; 11 11 import de.ugoe.cs.quest.usageprofiles.FirstOrderMarkovModel.MarkovEdge; 12 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 12 13 import static org.junit.Assert.*; 13 14 … … 21 22 public class FirstOrderMarkovModelTest { 22 23 23 Collection<List< ? extends Event<?>>> sequences;24 Collection<List<Event>> sequences; 24 25 25 26 @Test … … 72 73 @Before 73 74 public void setUp() throws Exception { 74 List<Event <?>> sequence = new ArrayList<Event<?>>();75 sequence.add(new Event <String>("a"));76 sequence.add(new Event <String>("b"));77 sequence.add(new Event <String>("r"));78 sequence.add(new Event <String>("a"));79 sequence.add(new Event <String>("c"));80 sequence.add(new Event <String>("a"));81 sequence.add(new Event <String>("d"));82 sequence.add(new Event <String>("a"));83 sequence.add(new Event <String>("b"));84 sequence.add(new Event <String>("r"));85 sequence.add(new Event <String>("a"));75 List<Event> sequence = new ArrayList<Event>(); 76 sequence.add(new Event(new StringEventType("a"))); 77 sequence.add(new Event(new StringEventType("b"))); 78 sequence.add(new Event(new StringEventType("r"))); 79 sequence.add(new Event(new StringEventType("a"))); 80 sequence.add(new Event(new StringEventType("c"))); 81 sequence.add(new Event(new StringEventType("a"))); 82 sequence.add(new Event(new StringEventType("d"))); 83 sequence.add(new Event(new StringEventType("a"))); 84 sequence.add(new Event(new StringEventType("b"))); 85 sequence.add(new Event(new StringEventType("r"))); 86 sequence.add(new Event(new StringEventType("a"))); 86 87 87 sequences = new ArrayList<List< ? extends Event<?>>>();88 sequences = new ArrayList<List<Event>>(); 88 89 sequences.add(sequence); 89 90 } -
trunk/quest-core-usageprofiles-test/src/test/java/de/ugoe/cs/quest/usageprofiles/HighOrderMarkovModelTest.java
r518 r548 7 7 import de.ugoe.cs.quest.eventcore.Event; 8 8 import de.ugoe.cs.quest.usageprofiles.HighOrderMarkovModel; 9 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 9 10 10 11 import java.util.Random; … … 22 23 public class HighOrderMarkovModelTest { 23 24 24 Collection<List< ? extends Event<?>>> sequences;25 Collection<List<Event>> sequences; 25 26 26 27 @Test … … 71 72 fixture.train(sequences); 72 73 73 List<Event <String>> context = new ArrayList<Event<String>>();74 context.add(new Event <String>("a"));75 76 Event <String> symbol = new Event<String>("b");74 List<Event> context = new ArrayList<Event>(); 75 context.add(new Event(new StringEventType("a"))); 76 77 Event symbol = new Event(new StringEventType("b")); 77 78 78 79 double result = fixture.getProbability(context, symbol); … … 88 89 fixture.train(sequences); 89 90 90 List<Event <String>> context = new ArrayList<Event<String>>();91 context.add(new Event <String>("a"));92 93 Event <String> symbol = new Event<String>("r");91 List<Event> context = new ArrayList<Event>(); 92 context.add(new Event(new StringEventType("a"))); 93 94 Event symbol = new Event(new StringEventType("r")); 94 95 95 96 double result = fixture.getProbability(context, symbol); … … 105 106 fixture.train(sequences); 106 107 107 List<Event <String>> context = new ArrayList<Event<String>>();108 context.add(new Event <String>("a"));109 110 Event <String> symbol = new Event<String>("c");108 List<Event> context = new ArrayList<Event>(); 109 context.add(new Event(new StringEventType("a"))); 110 111 Event symbol = new Event(new StringEventType("c")); 111 112 112 113 double result = fixture.getProbability(context, symbol); … … 122 123 fixture.train(sequences); 123 124 124 List<Event <?>> context = new ArrayList<Event<?>>();125 context.add(Event.STARTEVENT); 126 context.add(new Event <String>("a"));127 128 Event <String> symbol = new Event<String>("b");125 List<Event> context = new ArrayList<Event>(); 126 context.add(Event.STARTEVENT); 127 context.add(new Event(new StringEventType("a"))); 128 129 Event symbol = new Event(new StringEventType("b")); 129 130 130 131 double result = fixture.getProbability(context, symbol); … … 140 141 fixture.train(sequences); 141 142 142 List<Event <?>> context = new ArrayList<Event<?>>();143 context.add(Event.STARTEVENT); 144 context.add(new Event <String>("a"));145 146 Event <String> symbol = new Event<String>("b");143 List<Event> context = new ArrayList<Event>(); 144 context.add(Event.STARTEVENT); 145 context.add(new Event(new StringEventType("a"))); 146 147 Event symbol = new Event(new StringEventType("b")); 147 148 148 149 double result = fixture.getProbability(context, symbol); … … 158 159 fixture.train(sequences); 159 160 160 List<Event <?>> context = new ArrayList<Event<?>>();161 context.add(Event.STARTEVENT); 162 context.add(new Event <String>("b"));163 164 Event <String> symbol = new Event<String>("b");161 List<Event> context = new ArrayList<Event>(); 162 context.add(Event.STARTEVENT); 163 context.add(new Event(new StringEventType("b"))); 164 165 Event symbol = new Event(new StringEventType("b")); 165 166 166 167 double result = fixture.getProbability(context, symbol); … … 176 177 fixture.train(sequences); 177 178 178 List<Event <?>> context = new ArrayList<Event<?>>();179 context.add(Event.STARTEVENT); 180 context.add(new Event <String>("b"));181 182 Event <String> symbol = new Event<String>("a");179 List<Event> context = new ArrayList<Event>(); 180 context.add(Event.STARTEVENT); 181 context.add(new Event(new StringEventType("b"))); 182 183 Event symbol = new Event(new StringEventType("a")); 183 184 184 185 double result = fixture.getProbability(context, symbol); … … 194 195 fixture.train(sequences); 195 196 196 List<Event <?>> context = new ArrayList<Event<?>>();197 context.add(Event.STARTEVENT); 198 context.add(new Event <String>("b"));199 200 Event <String>symbol = null;197 List<Event> context = new ArrayList<Event>(); 198 context.add(Event.STARTEVENT); 199 context.add(new Event(new StringEventType("b"))); 200 201 Event symbol = null; 201 202 202 203 fixture.getProbability(context, symbol); … … 210 211 fixture.train(sequences); 211 212 212 List<Event <?>> context = null;213 214 Event <String> symbol = new Event<String>("b");213 List<Event> context = null; 214 215 Event symbol = new Event(new StringEventType("b")); 215 216 216 217 fixture.getProbability(context, symbol); … … 219 220 @Before 220 221 public void setUp() throws Exception { 221 List<Event <?>> sequence = new ArrayList<Event<?>>();222 sequence.add(new Event <String>("a"));223 sequence.add(new Event <String>("b"));224 sequence.add(new Event <String>("r"));225 sequence.add(new Event <String>("a"));226 sequence.add(new Event <String>("c"));227 sequence.add(new Event <String>("a"));228 sequence.add(new Event <String>("d"));229 sequence.add(new Event <String>("a"));230 sequence.add(new Event <String>("b"));231 sequence.add(new Event <String>("r"));232 sequence.add(new Event <String>("a"));233 234 sequences = new ArrayList<List< ? extends Event<?>>>();222 List<Event> sequence = new ArrayList<Event>(); 223 sequence.add(new Event(new StringEventType("a"))); 224 sequence.add(new Event(new StringEventType("b"))); 225 sequence.add(new Event(new StringEventType("r"))); 226 sequence.add(new Event(new StringEventType("a"))); 227 sequence.add(new Event(new StringEventType("c"))); 228 sequence.add(new Event(new StringEventType("a"))); 229 sequence.add(new Event(new StringEventType("d"))); 230 sequence.add(new Event(new StringEventType("a"))); 231 sequence.add(new Event(new StringEventType("b"))); 232 sequence.add(new Event(new StringEventType("r"))); 233 sequence.add(new Event(new StringEventType("a"))); 234 235 sequences = new ArrayList<List<Event>>(); 235 236 sequences.add(sequence); 236 237 } -
trunk/quest-core-usageprofiles-test/src/test/java/de/ugoe/cs/quest/usageprofiles/MockTrieBasedModel.java
r518 r548 16 16 17 17 @Override 18 public double getProbability(List< ? extends Event<?>> context,19 Event <?>symbol) {20 List<Event <?>> list = new ArrayList<Event<?>>();18 public double getProbability(List<Event> context, 19 Event symbol) { 20 List<Event> list = new ArrayList<Event>(); 21 21 if( context.isEmpty() ) { 22 22 return 2; -
trunk/quest-core-usageprofiles-test/src/test/java/de/ugoe/cs/quest/usageprofiles/ModelFlattenerTest.java
r518 r548 1 1 2 package de.ugoe.cs.quest.usageprofiles; 2 3 … … 14 15 import de.ugoe.cs.quest.usageprofiles.PredictionByPartialMatch; 15 16 import de.ugoe.cs.quest.usageprofiles.TrieNode; 17 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 16 18 import static org.junit.Assert.*; 17 19 18 20 /** 19 * The class <code>ModelFlattenerTest</code> contains tests for the class <code>{@link ModelFlattener}</code>. 20 * 21 * The class <code>ModelFlattenerTest</code> contains tests for the class 22 * <code>{@link ModelFlattener}</code>. 23 * 21 24 * @author Steffen Herbold 22 25 * @version 1.0 23 26 */ 24 27 public class ModelFlattenerTest { 25 26 List<Event<?>> sequence;27 28 private static void assertCollectionContent(Collection<?> c1, Collection<?> c2) {29 assertEquals(c1.size(), c2.size());30 for( Object obj : c1 ) {31 assertTrue(c2.contains(obj));32 }33 }34 35 @Test36 public void testFlattenHighOrderMarkovModel_1()37 throws Exception {38 ModelFlattener fixture = new ModelFlattener();39 HighOrderMarkovModel model = new HighOrderMarkovModel(2, new Random());40 Collection<List<? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();41 sequences.add(sequence);42 model.train(sequences);43 44 Collection<Event<?>> expectedSymbols = new HashSet<Event<?>>();45 expectedSymbols.add(new Event<Object>("a-=-END"));46 expectedSymbols.add(new Event<Object>("a-=-b"));47 expectedSymbols.add(new Event<Object>("a-=-c"));48 expectedSymbols.add(new Event<Object>("a-=-d"));49 expectedSymbols.add(new Event<Object>("b-=-r"));50 expectedSymbols.add(new Event<Object>("c-=-a"));51 expectedSymbols.add(new Event<Object>("d-=-a"));52 expectedSymbols.add(new Event<Object>("r-=-a"));53 expectedSymbols.add(new Event<Object>("START-=-a"));54 28 55 FirstOrderMarkovModel result = fixture.flattenHighOrderMarkovModel(model); 56 57 assertCollectionContent(expectedSymbols, result.getEvents()); 58 59 TrieNode<Event<?>> root = result.trie.find(null); 60 TrieNode<Event<?>> root_aEnd = root.getChild(new Event<Object>("a-=-END")); 61 TrieNode<Event<?>> root_ab = root.getChild(new Event<Object>("a-=-b")); 62 TrieNode<Event<?>> root_ab_br = root_ab.getChild(new Event<Object>("b-=-r")); 63 TrieNode<Event<?>> root_ac = root.getChild(new Event<Object>("a-=-c")); 64 TrieNode<Event<?>> root_ac_ca = root_ac.getChild(new Event<Object>("c-=-a")); 65 TrieNode<Event<?>> root_ad = root.getChild(new Event<Object>("a-=-d")); 66 TrieNode<Event<?>> root_ad_da = root_ad.getChild(new Event<Object>("d-=-a")); 67 TrieNode<Event<?>> root_br = root.getChild(new Event<Object>("b-=-r")); 68 TrieNode<Event<?>> root_br_ra = root_br.getChild(new Event<Object>("r-=-a")); 69 TrieNode<Event<?>> root_ca = root.getChild(new Event<Object>("c-=-a")); 70 TrieNode<Event<?>> root_ca_ad = root_ca.getChild(new Event<Object>("a-=-d")); 71 TrieNode<Event<?>> root_da = root.getChild(new Event<Object>("d-=-a")); 72 TrieNode<Event<?>> root_da_ab = root_da.getChild(new Event<Object>("a-=-b")); 73 TrieNode<Event<?>> root_ra = root.getChild(new Event<Object>("r-=-a")); 74 TrieNode<Event<?>> root_ra_ac = root_ra.getChild(new Event<Object> ("a-=-c")); 75 TrieNode<Event<?>> root_ra_aEnd = root_ra.getChild(new Event<Object>("a-=-END")); 76 TrieNode<Event<?>> root_startA = root.getChild(new Event<Object>("START-=-a")); 77 TrieNode<Event<?>> root_startA_ab = root_startA.getChild(new Event<Object>("a-=-b")); 78 79 assertEquals(1, root_aEnd.getCount()); 80 assertTrue(root_aEnd.isLeaf()); 81 assertEquals(2, root_ab.getCount()); 82 assertEquals(1, root_ab.getChildren().size()); 83 assertEquals(2, root_ab_br.getCount()); 84 assertTrue(root_ab_br.isLeaf()); 85 assertEquals(1, root_ac.getCount()); 86 assertEquals(1, root_ac.getChildren().size()); 87 assertEquals(1, root_ac_ca.getCount()); 88 assertTrue(root_ac_ca.isLeaf()); 89 assertEquals(1, root_ad.getCount()); 90 assertEquals(1, root_ad.getChildren().size()); 91 assertEquals(1, root_ad_da.getCount()); 92 assertTrue(root_ad_da.isLeaf()); 93 assertEquals(2, root_br.getCount()); 94 assertEquals(1, root_br.getChildren().size()); 95 assertEquals(2, root_br_ra.getCount()); 96 assertTrue(root_br_ra.isLeaf()); 97 assertEquals(1, root_ca.getCount()); 98 assertEquals(1, root_ca.getChildren().size()); 99 assertEquals(1, root_ca_ad.getCount()); 100 assertTrue(root_ca_ad.isLeaf()); 101 assertEquals(1, root_da.getCount()); 102 assertEquals(1, root_da.getChildren().size()); 103 assertEquals(1, root_da_ab.getCount()); 104 assertTrue(root_da_ab.isLeaf()); 105 assertEquals(2, root_ra.getCount()); 106 assertEquals(2, root_ra.getChildren().size()); 107 assertEquals(1, root_ra_ac.getCount()); 108 assertTrue(root_ra_ac.isLeaf()); 109 assertEquals(1, root_ra_aEnd.getCount()); 110 assertTrue(root_ra_aEnd.isLeaf()); 111 assertEquals(1, root_startA.getCount()); 112 assertEquals(1, root_startA.getChildren().size()); 113 assertEquals(1, root_startA_ab.getCount()); 114 assertTrue(root_startA_ab.isLeaf()); 115 } 29 List<Event> sequence; 116 30 117 @Test 118 public void testFlattenPredictionByPartialMatch_1() 119 throws Exception { 120 ModelFlattener fixture = new ModelFlattener(); 121 PredictionByPartialMatch model = new PredictionByPartialMatch(1, new Random()); 31 private static void assertCollectionContent(Collection<?> c1, Collection<?> c2) { 32 assertEquals(c1.size(), c2.size()); 33 for (Object obj : c1) { 34 assertTrue(c2.contains(obj)); 35 } 36 } 122 37 123 FirstOrderMarkovModel result = fixture.flattenPredictionByPartialMatch(model); 124 125 assertEquals(null, result); 126 } 38 @Test 39 public void testFlattenHighOrderMarkovModel_1() throws Exception { 40 ModelFlattener fixture = new ModelFlattener(); 41 HighOrderMarkovModel model = new HighOrderMarkovModel(2, new Random()); 42 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 43 sequences.add(sequence); 44 model.train(sequences); 127 45 128 @Before 129 public void setUp() 130 throws Exception { 131 sequence = new ArrayList<Event<?>>(); 132 sequence.add(new Event<String>("a")); 133 sequence.add(new Event<String>("b")); 134 sequence.add(new Event<String>("r")); 135 sequence.add(new Event<String>("a")); 136 sequence.add(new Event<String>("c")); 137 sequence.add(new Event<String>("a")); 138 sequence.add(new Event<String>("d")); 139 sequence.add(new Event<String>("a")); 140 sequence.add(new Event<String>("b")); 141 sequence.add(new Event<String>("r")); 142 sequence.add(new Event<String>("a")); 143 } 46 Collection<Event> expectedSymbols = new HashSet<Event>(); 47 expectedSymbols.add(new Event(new StringEventType("a-=-END"))); 48 expectedSymbols.add(new Event(new StringEventType("a-=-b"))); 49 expectedSymbols.add(new Event(new StringEventType("a-=-c"))); 50 expectedSymbols.add(new Event(new StringEventType("a-=-d"))); 51 expectedSymbols.add(new Event(new StringEventType("b-=-r"))); 52 expectedSymbols.add(new Event(new StringEventType("c-=-a"))); 53 expectedSymbols.add(new Event(new StringEventType("d-=-a"))); 54 expectedSymbols.add(new Event(new StringEventType("r-=-a"))); 55 expectedSymbols.add(new Event(new StringEventType("START-=-a"))); 144 56 145 public static void main(String[] args) { 146 new org.junit.runner.JUnitCore().run(ModelFlattenerTest.class); 147 } 57 FirstOrderMarkovModel result = fixture.flattenHighOrderMarkovModel(model); 58 59 assertCollectionContent(expectedSymbols, result.getEvents()); 60 61 TrieNode<Event> root = result.trie.find(null); 62 TrieNode<Event> root_aEnd = root.getChild(new Event(new StringEventType("a-=-END"))); 63 TrieNode<Event> root_ab = root.getChild(new Event(new StringEventType("a-=-b"))); 64 TrieNode<Event> root_ab_br = root_ab.getChild(new Event(new StringEventType("b-=-r"))); 65 TrieNode<Event> root_ac = root.getChild(new Event(new StringEventType("a-=-c"))); 66 TrieNode<Event> root_ac_ca = root_ac.getChild(new Event(new StringEventType("c-=-a"))); 67 TrieNode<Event> root_ad = root.getChild(new Event(new StringEventType("a-=-d"))); 68 TrieNode<Event> root_ad_da = root_ad.getChild(new Event(new StringEventType("d-=-a"))); 69 TrieNode<Event> root_br = root.getChild(new Event(new StringEventType("b-=-r"))); 70 TrieNode<Event> root_br_ra = root_br.getChild(new Event(new StringEventType("r-=-a"))); 71 TrieNode<Event> root_ca = root.getChild(new Event(new StringEventType("c-=-a"))); 72 TrieNode<Event> root_ca_ad = root_ca.getChild(new Event(new StringEventType("a-=-d"))); 73 TrieNode<Event> root_da = root.getChild(new Event(new StringEventType("d-=-a"))); 74 TrieNode<Event> root_da_ab = root_da.getChild(new Event(new StringEventType("a-=-b"))); 75 TrieNode<Event> root_ra = root.getChild(new Event(new StringEventType("r-=-a"))); 76 TrieNode<Event> root_ra_ac = root_ra.getChild(new Event(new StringEventType("a-=-c"))); 77 TrieNode<Event> root_ra_aEnd = root_ra.getChild(new Event(new StringEventType("a-=-END"))); 78 TrieNode<Event> root_startA = root.getChild(new Event(new StringEventType("START-=-a"))); 79 TrieNode<Event> root_startA_ab = 80 root_startA.getChild(new Event(new StringEventType("a-=-b"))); 81 82 assertEquals(1, root_aEnd.getCount()); 83 assertTrue(root_aEnd.isLeaf()); 84 assertEquals(2, root_ab.getCount()); 85 assertEquals(1, root_ab.getChildren().size()); 86 assertEquals(2, root_ab_br.getCount()); 87 assertTrue(root_ab_br.isLeaf()); 88 assertEquals(1, root_ac.getCount()); 89 assertEquals(1, root_ac.getChildren().size()); 90 assertEquals(1, root_ac_ca.getCount()); 91 assertTrue(root_ac_ca.isLeaf()); 92 assertEquals(1, root_ad.getCount()); 93 assertEquals(1, root_ad.getChildren().size()); 94 assertEquals(1, root_ad_da.getCount()); 95 assertTrue(root_ad_da.isLeaf()); 96 assertEquals(2, root_br.getCount()); 97 assertEquals(1, root_br.getChildren().size()); 98 assertEquals(2, root_br_ra.getCount()); 99 assertTrue(root_br_ra.isLeaf()); 100 assertEquals(1, root_ca.getCount()); 101 assertEquals(1, root_ca.getChildren().size()); 102 assertEquals(1, root_ca_ad.getCount()); 103 assertTrue(root_ca_ad.isLeaf()); 104 assertEquals(1, root_da.getCount()); 105 assertEquals(1, root_da.getChildren().size()); 106 assertEquals(1, root_da_ab.getCount()); 107 assertTrue(root_da_ab.isLeaf()); 108 assertEquals(2, root_ra.getCount()); 109 assertEquals(2, root_ra.getChildren().size()); 110 assertEquals(1, root_ra_ac.getCount()); 111 assertTrue(root_ra_ac.isLeaf()); 112 assertEquals(1, root_ra_aEnd.getCount()); 113 assertTrue(root_ra_aEnd.isLeaf()); 114 assertEquals(1, root_startA.getCount()); 115 assertEquals(1, root_startA.getChildren().size()); 116 assertEquals(1, root_startA_ab.getCount()); 117 assertTrue(root_startA_ab.isLeaf()); 118 } 119 120 @Test 121 public void testFlattenPredictionByPartialMatch_1() throws Exception { 122 ModelFlattener fixture = new ModelFlattener(); 123 PredictionByPartialMatch model = new PredictionByPartialMatch(1, new Random()); 124 125 FirstOrderMarkovModel result = fixture.flattenPredictionByPartialMatch(model); 126 127 assertEquals(null, result); 128 } 129 130 @Before 131 public void setUp() throws Exception { 132 sequence = new ArrayList<Event>(); 133 sequence.add(new Event(new StringEventType("a"))); 134 sequence.add(new Event(new StringEventType("b"))); 135 sequence.add(new Event(new StringEventType("r"))); 136 sequence.add(new Event(new StringEventType("a"))); 137 sequence.add(new Event(new StringEventType("c"))); 138 sequence.add(new Event(new StringEventType("a"))); 139 sequence.add(new Event(new StringEventType("d"))); 140 sequence.add(new Event(new StringEventType("a"))); 141 sequence.add(new Event(new StringEventType("b"))); 142 sequence.add(new Event(new StringEventType("r"))); 143 sequence.add(new Event(new StringEventType("a"))); 144 } 145 146 public static void main(String[] args) { 147 new org.junit.runner.JUnitCore().run(ModelFlattenerTest.class); 148 } 148 149 } -
trunk/quest-core-usageprofiles-test/src/test/java/de/ugoe/cs/quest/usageprofiles/PredictionByPartialMatchTest.java
r518 r548 7 7 import de.ugoe.cs.quest.eventcore.Event; 8 8 import de.ugoe.cs.quest.usageprofiles.PredictionByPartialMatch; 9 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 9 10 10 11 import java.util.Random; … … 22 23 public class PredictionByPartialMatchTest { 23 24 24 Collection<List< ? extends Event<?>>> sequences;25 Collection<List<Event>> sequences; 25 26 26 27 @Test … … 209 210 fixture.train(sequences); 210 211 211 List<Event <?>> context = new ArrayList<Event<?>>();212 context.add(Event.STARTEVENT); 213 context.add(new Event <String>("a"));214 215 Event <String> symbol = new Event<String>("b");212 List<Event> context = new ArrayList<Event>(); 213 context.add(Event.STARTEVENT); 214 context.add(new Event(new StringEventType("a"))); 215 216 Event symbol = new Event(new StringEventType("b")); 216 217 217 218 double result = fixture.getProbability(context, symbol); … … 230 231 fixture.train(sequences); 231 232 232 List<Event <?>> context = new ArrayList<Event<?>>();233 context.add(Event.STARTEVENT); 234 context.add(new Event <String>("a"));235 236 Event <String> symbol = new Event<String>("c");233 List<Event> context = new ArrayList<Event>(); 234 context.add(Event.STARTEVENT); 235 context.add(new Event(new StringEventType("a"))); 236 237 Event symbol = new Event(new StringEventType("c")); 237 238 238 239 double result = fixture.getProbability(context, symbol); … … 251 252 fixture.train(sequences); 252 253 253 List<Event <?>> context = new ArrayList<Event<?>>();254 context.add(Event.STARTEVENT); 255 context.add(new Event <String>("a"));256 257 Event <String> symbol = new Event<String>("b");254 List<Event> context = new ArrayList<Event>(); 255 context.add(Event.STARTEVENT); 256 context.add(new Event(new StringEventType("a"))); 257 258 Event symbol = new Event(new StringEventType("b")); 258 259 259 260 double result = fixture.getProbability(context, symbol); … … 272 273 fixture.train(sequences); 273 274 274 List<Event <?>> context = new ArrayList<Event<?>>();275 context.add(Event.STARTEVENT); 276 context.add(new Event <String>("a"));277 278 Event <String> symbol = new Event<String>("c");275 List<Event> context = new ArrayList<Event>(); 276 context.add(Event.STARTEVENT); 277 context.add(new Event(new StringEventType("a"))); 278 279 Event symbol = new Event(new StringEventType("c")); 279 280 280 281 double result = fixture.getProbability(context, symbol); … … 293 294 fixture.train(sequences); 294 295 295 List<Event <?>> context = new ArrayList<Event<?>>();296 context.add(Event.STARTEVENT); 297 context.add(new Event <String>("a"));298 299 Event <String> symbol = new Event<String>("b");296 List<Event> context = new ArrayList<Event>(); 297 context.add(Event.STARTEVENT); 298 context.add(new Event(new StringEventType("a"))); 299 300 Event symbol = new Event(new StringEventType("b")); 300 301 301 302 double result = fixture.getProbability(context, symbol); … … 314 315 fixture.train(sequences); 315 316 316 List<Event <?>> context = new ArrayList<Event<?>>();317 context.add(Event.STARTEVENT); 318 context.add(new Event <String>("a"));319 320 Event <String> symbol = new Event<String>("c");317 List<Event> context = new ArrayList<Event>(); 318 context.add(Event.STARTEVENT); 319 context.add(new Event(new StringEventType("a"))); 320 321 Event symbol = new Event(new StringEventType("c")); 321 322 322 323 double result = fixture.getProbability(context, symbol); … … 342 343 @Before 343 344 public void setUp() throws Exception { 344 List<Event <?>> sequence = new ArrayList<Event<?>>();345 sequence.add(new Event <String>("a"));346 sequence.add(new Event <String>("b"));347 sequence.add(new Event <String>("r"));348 sequence.add(new Event <String>("a"));349 sequence.add(new Event <String>("c"));350 sequence.add(new Event <String>("a"));351 sequence.add(new Event <String>("d"));352 sequence.add(new Event <String>("a"));353 sequence.add(new Event <String>("b"));354 sequence.add(new Event <String>("r"));355 sequence.add(new Event <String>("a"));356 357 sequences = new ArrayList<List< ? extends Event<?>>>();345 List<Event> sequence = new ArrayList<Event>(); 346 sequence.add(new Event(new StringEventType("a"))); 347 sequence.add(new Event(new StringEventType("b"))); 348 sequence.add(new Event(new StringEventType("r"))); 349 sequence.add(new Event(new StringEventType("a"))); 350 sequence.add(new Event(new StringEventType("c"))); 351 sequence.add(new Event(new StringEventType("a"))); 352 sequence.add(new Event(new StringEventType("d"))); 353 sequence.add(new Event(new StringEventType("a"))); 354 sequence.add(new Event(new StringEventType("b"))); 355 sequence.add(new Event(new StringEventType("r"))); 356 sequence.add(new Event(new StringEventType("a"))); 357 358 sequences = new ArrayList<List<Event>>(); 358 359 sequences.add(sequence); 359 360 } -
trunk/quest-core-usageprofiles-test/src/test/java/de/ugoe/cs/quest/usageprofiles/TrieBasedModelTest.java
r518 r548 11 11 import de.ugoe.cs.quest.usageprofiles.TrieBasedModel; 12 12 import de.ugoe.cs.quest.usageprofiles.TrieNode; 13 import de.ugoe.cs.quest.usageprofiles.mock.StringEventType; 13 14 14 15 import org.junit.*; … … 24 25 public class TrieBasedModelTest { 25 26 26 List<Event <?>> sequence;27 Collection<Event <?>> symbols;28 29 private void assertTrieStructure(Trie<Event <?>> trie, int numSequences) {30 TrieNode<Event <?>> root = trie.find(null);31 TrieNode<Event <?>> root_a = root.getChild(new Event<String>("a"));32 TrieNode<Event <?>> root_a_a = root_a.getChild(new Event<String>("a"));33 TrieNode<Event <?>> root_a_b = root_a.getChild(new Event<String>("b"));34 TrieNode<Event <?>> root_a_b_a = root_a_b35 .getChild(new Event <String>("a"));36 TrieNode<Event <?>> root_a_b_b = root_a_b37 .getChild(new Event <String>("b"));38 TrieNode<Event <?>> root_a_b_c = root_a_b39 .getChild(new Event <String>("c"));40 TrieNode<Event <?>> root_a_b_d = root_a_b41 .getChild(new Event <String>("d"));42 TrieNode<Event <?>> root_a_b_r = root_a_b43 .getChild(new Event <String>("r"));44 TrieNode<Event <?>> root_a_c = root_a.getChild(new Event<String>("c"));45 TrieNode<Event <?>> root_a_c_a = root_a_c46 .getChild(new Event <String>("a"));47 TrieNode<Event <?>> root_a_c_b = root_a_c48 .getChild(new Event <String>("b"));49 TrieNode<Event <?>> root_a_c_c = root_a_c50 .getChild(new Event <String>("c"));51 TrieNode<Event <?>> root_a_c_d = root_a_c52 .getChild(new Event <String>("d"));53 TrieNode<Event <?>> root_a_c_r = root_a_c54 .getChild(new Event <String>("r"));55 TrieNode<Event <?>> root_a_d = root_a.getChild(new Event<String>("d"));56 TrieNode<Event <?>> root_a_d_a = root_a_d57 .getChild(new Event <String>("a"));58 TrieNode<Event <?>> root_a_d_b = root_a_d59 .getChild(new Event <String>("b"));60 TrieNode<Event <?>> root_a_d_c = root_a_d61 .getChild(new Event <String>("c"));62 TrieNode<Event <?>> root_a_d_d = root_a_d63 .getChild(new Event <String>("d"));64 TrieNode<Event <?>> root_a_d_r = root_a_d65 .getChild(new Event <String>("r"));66 TrieNode<Event <?>> root_a_r = root_a.getChild(new Event<String>("r"));67 TrieNode<Event <?>> root_b = root.getChild(new Event<String>("b"));68 TrieNode<Event <?>> root_b_a = root_b.getChild(new Event<String>("a"));69 TrieNode<Event <?>> root_b_b = root_b.getChild(new Event<String>("b"));70 TrieNode<Event <?>> root_b_c = root_b.getChild(new Event<String>("c"));71 TrieNode<Event <?>> root_b_d = root_b.getChild(new Event<String>("d"));72 TrieNode<Event <?>> root_b_r = root_b.getChild(new Event<String>("r"));73 TrieNode<Event <?>> root_b_r_a = root_b_r74 .getChild(new Event <String>("a"));75 TrieNode<Event <?>> root_b_r_b = root_b_r76 .getChild(new Event <String>("b"));77 TrieNode<Event <?>> root_b_r_c = root_b_r78 .getChild(new Event <String>("c"));79 TrieNode<Event <?>> root_b_r_d = root_b_r80 .getChild(new Event <String>("d"));81 TrieNode<Event <?>> root_b_r_r = root_b_r82 .getChild(new Event <String>("r"));83 TrieNode<Event <?>> root_c = root.getChild(new Event<String>("c"));84 TrieNode<Event <?>> root_c_a = root_c.getChild(new Event<String>("a"));85 TrieNode<Event <?>> root_c_a_a = root_c_a86 .getChild(new Event <String>("a"));87 TrieNode<Event <?>> root_c_a_b = root_c_a88 .getChild(new Event <String>("b"));89 TrieNode<Event <?>> root_c_a_c = root_c_a90 .getChild(new Event <String>("c"));91 TrieNode<Event <?>> root_c_a_d = root_c_a92 .getChild(new Event <String>("d"));93 TrieNode<Event <?>> root_c_a_r = root_c_a94 .getChild(new Event <String>("r"));95 TrieNode<Event <?>> root_c_b = root_c.getChild(new Event<String>("b"));96 TrieNode<Event <?>> root_c_c = root_c.getChild(new Event<String>("c"));97 TrieNode<Event <?>> root_c_d = root_c.getChild(new Event<String>("d"));98 TrieNode<Event <?>> root_c_r = root_c.getChild(new Event<String>("r"));99 TrieNode<Event <?>> root_d = root.getChild(new Event<String>("d"));100 TrieNode<Event <?>> root_d_a = root_d.getChild(new Event<String>("a"));101 TrieNode<Event <?>> root_d_a_a = root_d_a102 .getChild(new Event <String>("a"));103 TrieNode<Event <?>> root_d_a_b = root_d_a104 .getChild(new Event <String>("b"));105 TrieNode<Event <?>> root_d_a_c = root_d_a106 .getChild(new Event <String>("c"));107 TrieNode<Event <?>> root_d_a_d = root_d_a108 .getChild(new Event <String>("d"));109 TrieNode<Event <?>> root_d_a_r = root_d_a110 .getChild(new Event <String>("r"));111 TrieNode<Event <?>> root_d_b = root_d.getChild(new Event<String>("b"));112 TrieNode<Event <?>> root_d_c = root_d.getChild(new Event<String>("c"));113 TrieNode<Event <?>> root_d_d = root_d.getChild(new Event<String>("d"));114 TrieNode<Event <?>> root_d_r = root_d.getChild(new Event<String>("r"));115 TrieNode<Event <?>> root_r = root.getChild(new Event<String>("r"));116 TrieNode<Event <?>> root_r_a = root_r.getChild(new Event<String>("a"));117 TrieNode<Event <?>> root_r_a_a = root_r_a118 .getChild(new Event <String>("a"));119 TrieNode<Event <?>> root_r_a_b = root_r_a120 .getChild(new Event <String>("b"));121 TrieNode<Event <?>> root_r_a_c = root_r_a122 .getChild(new Event <String>("c"));123 TrieNode<Event <?>> root_r_a_d = root_r_a124 .getChild(new Event <String>("d"));125 TrieNode<Event <?>> root_r_a_r = root_r_a126 .getChild(new Event <String>("r"));127 TrieNode<Event <?>> root_r_a_end = root_r_a.getChild(Event.ENDEVENT);128 TrieNode<Event <?>> root_r_b = root_r.getChild(new Event<String>("b"));129 TrieNode<Event <?>> root_r_c = root_r.getChild(new Event<String>("c"));130 TrieNode<Event <?>> root_r_d = root_r.getChild(new Event<String>("d"));131 TrieNode<Event <?>> root_r_r = root_r.getChild(new Event<String>("r"));132 TrieNode<Event <?>> root_start = root.getChild(Event.STARTEVENT);133 TrieNode<Event <?>> root_start_a = root_start134 .getChild(new Event <String>("a"));135 TrieNode<Event <?>> root_start_a_a = root_start_a136 .getChild(new Event <String>("a"));137 TrieNode<Event <?>> root_start_a_b = root_start_a138 .getChild(new Event <String>("b"));139 TrieNode<Event <?>> root_start_a_c = root_start_a140 .getChild(new Event <String>("c"));141 TrieNode<Event <?>> root_start_a_d = root_start_a142 .getChild(new Event <String>("d"));143 TrieNode<Event <?>> root_start_a_r = root_start_a144 .getChild(new Event <String>("r"));145 TrieNode<Event <?>> root_start_b = root_start146 .getChild(new Event <String>("b"));147 TrieNode<Event <?>> root_start_c = root_start148 .getChild(new Event <String>("c"));149 TrieNode<Event <?>> root_start_d = root_start150 .getChild(new Event <String>("d"));151 TrieNode<Event <?>> root_start_r = root_start152 .getChild(new Event <String>("r"));27 List<Event> sequence; 28 Collection<Event> symbols; 29 30 private void assertTrieStructure(Trie<Event> trie, int numSequences) { 31 TrieNode<Event> root = trie.find(null); 32 TrieNode<Event> root_a = root.getChild(new Event(new StringEventType("a"))); 33 TrieNode<Event> root_a_a = root_a.getChild(new Event(new StringEventType("a"))); 34 TrieNode<Event> root_a_b = root_a.getChild(new Event(new StringEventType("b"))); 35 TrieNode<Event> root_a_b_a = root_a_b 36 .getChild(new Event(new StringEventType("a"))); 37 TrieNode<Event> root_a_b_b = root_a_b 38 .getChild(new Event(new StringEventType("b"))); 39 TrieNode<Event> root_a_b_c = root_a_b 40 .getChild(new Event(new StringEventType("c"))); 41 TrieNode<Event> root_a_b_d = root_a_b 42 .getChild(new Event(new StringEventType("d"))); 43 TrieNode<Event> root_a_b_r = root_a_b 44 .getChild(new Event(new StringEventType("r"))); 45 TrieNode<Event> root_a_c = root_a.getChild(new Event(new StringEventType("c"))); 46 TrieNode<Event> root_a_c_a = root_a_c 47 .getChild(new Event(new StringEventType("a"))); 48 TrieNode<Event> root_a_c_b = root_a_c 49 .getChild(new Event(new StringEventType("b"))); 50 TrieNode<Event> root_a_c_c = root_a_c 51 .getChild(new Event(new StringEventType("c"))); 52 TrieNode<Event> root_a_c_d = root_a_c 53 .getChild(new Event(new StringEventType("d"))); 54 TrieNode<Event> root_a_c_r = root_a_c 55 .getChild(new Event(new StringEventType("r"))); 56 TrieNode<Event> root_a_d = root_a.getChild(new Event(new StringEventType("d"))); 57 TrieNode<Event> root_a_d_a = root_a_d 58 .getChild(new Event(new StringEventType("a"))); 59 TrieNode<Event> root_a_d_b = root_a_d 60 .getChild(new Event(new StringEventType("b"))); 61 TrieNode<Event> root_a_d_c = root_a_d 62 .getChild(new Event(new StringEventType("c"))); 63 TrieNode<Event> root_a_d_d = root_a_d 64 .getChild(new Event(new StringEventType("d"))); 65 TrieNode<Event> root_a_d_r = root_a_d 66 .getChild(new Event(new StringEventType("r"))); 67 TrieNode<Event> root_a_r = root_a.getChild(new Event(new StringEventType("r"))); 68 TrieNode<Event> root_b = root.getChild(new Event(new StringEventType("b"))); 69 TrieNode<Event> root_b_a = root_b.getChild(new Event(new StringEventType("a"))); 70 TrieNode<Event> root_b_b = root_b.getChild(new Event(new StringEventType("b"))); 71 TrieNode<Event> root_b_c = root_b.getChild(new Event(new StringEventType("c"))); 72 TrieNode<Event> root_b_d = root_b.getChild(new Event(new StringEventType("d"))); 73 TrieNode<Event> root_b_r = root_b.getChild(new Event(new StringEventType("r"))); 74 TrieNode<Event> root_b_r_a = root_b_r 75 .getChild(new Event(new StringEventType("a"))); 76 TrieNode<Event> root_b_r_b = root_b_r 77 .getChild(new Event(new StringEventType("b"))); 78 TrieNode<Event> root_b_r_c = root_b_r 79 .getChild(new Event(new StringEventType("c"))); 80 TrieNode<Event> root_b_r_d = root_b_r 81 .getChild(new Event(new StringEventType("d"))); 82 TrieNode<Event> root_b_r_r = root_b_r 83 .getChild(new Event(new StringEventType("r"))); 84 TrieNode<Event> root_c = root.getChild(new Event(new StringEventType("c"))); 85 TrieNode<Event> root_c_a = root_c.getChild(new Event(new StringEventType("a"))); 86 TrieNode<Event> root_c_a_a = root_c_a 87 .getChild(new Event(new StringEventType("a"))); 88 TrieNode<Event> root_c_a_b = root_c_a 89 .getChild(new Event(new StringEventType("b"))); 90 TrieNode<Event> root_c_a_c = root_c_a 91 .getChild(new Event(new StringEventType("c"))); 92 TrieNode<Event> root_c_a_d = root_c_a 93 .getChild(new Event(new StringEventType("d"))); 94 TrieNode<Event> root_c_a_r = root_c_a 95 .getChild(new Event(new StringEventType("r"))); 96 TrieNode<Event> root_c_b = root_c.getChild(new Event(new StringEventType("b"))); 97 TrieNode<Event> root_c_c = root_c.getChild(new Event(new StringEventType("c"))); 98 TrieNode<Event> root_c_d = root_c.getChild(new Event(new StringEventType("d"))); 99 TrieNode<Event> root_c_r = root_c.getChild(new Event(new StringEventType("r"))); 100 TrieNode<Event> root_d = root.getChild(new Event(new StringEventType("d"))); 101 TrieNode<Event> root_d_a = root_d.getChild(new Event(new StringEventType("a"))); 102 TrieNode<Event> root_d_a_a = root_d_a 103 .getChild(new Event(new StringEventType("a"))); 104 TrieNode<Event> root_d_a_b = root_d_a 105 .getChild(new Event(new StringEventType("b"))); 106 TrieNode<Event> root_d_a_c = root_d_a 107 .getChild(new Event(new StringEventType("c"))); 108 TrieNode<Event> root_d_a_d = root_d_a 109 .getChild(new Event(new StringEventType("d"))); 110 TrieNode<Event> root_d_a_r = root_d_a 111 .getChild(new Event(new StringEventType("r"))); 112 TrieNode<Event> root_d_b = root_d.getChild(new Event(new StringEventType("b"))); 113 TrieNode<Event> root_d_c = root_d.getChild(new Event(new StringEventType("c"))); 114 TrieNode<Event> root_d_d = root_d.getChild(new Event(new StringEventType("d"))); 115 TrieNode<Event> root_d_r = root_d.getChild(new Event(new StringEventType("r"))); 116 TrieNode<Event> root_r = root.getChild(new Event(new StringEventType("r"))); 117 TrieNode<Event> root_r_a = root_r.getChild(new Event(new StringEventType("a"))); 118 TrieNode<Event> root_r_a_a = root_r_a 119 .getChild(new Event(new StringEventType("a"))); 120 TrieNode<Event> root_r_a_b = root_r_a 121 .getChild(new Event(new StringEventType("b"))); 122 TrieNode<Event> root_r_a_c = root_r_a 123 .getChild(new Event(new StringEventType("c"))); 124 TrieNode<Event> root_r_a_d = root_r_a 125 .getChild(new Event(new StringEventType("d"))); 126 TrieNode<Event> root_r_a_r = root_r_a 127 .getChild(new Event(new StringEventType("r"))); 128 TrieNode<Event> root_r_a_end = root_r_a.getChild(Event.ENDEVENT); 129 TrieNode<Event> root_r_b = root_r.getChild(new Event(new StringEventType("b"))); 130 TrieNode<Event> root_r_c = root_r.getChild(new Event(new StringEventType("c"))); 131 TrieNode<Event> root_r_d = root_r.getChild(new Event(new StringEventType("d"))); 132 TrieNode<Event> root_r_r = root_r.getChild(new Event(new StringEventType("r"))); 133 TrieNode<Event> root_start = root.getChild(Event.STARTEVENT); 134 TrieNode<Event> root_start_a = root_start 135 .getChild(new Event(new StringEventType("a"))); 136 TrieNode<Event> root_start_a_a = root_start_a 137 .getChild(new Event(new StringEventType("a"))); 138 TrieNode<Event> root_start_a_b = root_start_a 139 .getChild(new Event(new StringEventType("b"))); 140 TrieNode<Event> root_start_a_c = root_start_a 141 .getChild(new Event(new StringEventType("c"))); 142 TrieNode<Event> root_start_a_d = root_start_a 143 .getChild(new Event(new StringEventType("d"))); 144 TrieNode<Event> root_start_a_r = root_start_a 145 .getChild(new Event(new StringEventType("r"))); 146 TrieNode<Event> root_start_b = root_start 147 .getChild(new Event(new StringEventType("b"))); 148 TrieNode<Event> root_start_c = root_start 149 .getChild(new Event(new StringEventType("c"))); 150 TrieNode<Event> root_start_d = root_start 151 .getChild(new Event(new StringEventType("d"))); 152 TrieNode<Event> root_start_r = root_start 153 .getChild(new Event(new StringEventType("r"))); 153 154 154 155 assertEquals(numSequences * 5, root_a.getCount()); … … 287 288 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 288 289 new Random()); 289 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();290 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 290 291 sequences.add(sequence); 291 292 fixture.train(sequences); 292 293 int length = 2; 293 294 294 Collection<List<Event <?>>> expected = new HashSet<List<Event<?>>>();295 ArrayList<Event <?>> list;296 list = new ArrayList<Event <?>>();297 list.add(new Event <String>("a"));295 Collection<List<Event>> expected = new HashSet<List<Event>>(); 296 ArrayList<Event> list; 297 list = new ArrayList<Event>(); 298 list.add(new Event(new StringEventType("a"))); 298 299 list.add(Event.ENDEVENT); 299 300 expected.add(list); 300 list = new ArrayList<Event <?>>();301 list.add(new Event <String>("a"));302 list.add(new Event <String>("b"));303 expected.add(list); 304 list = new ArrayList<Event <?>>();305 list.add(new Event <String>("a"));306 list.add(new Event <String>("c"));307 expected.add(list); 308 list = new ArrayList<Event <?>>();309 list.add(new Event <String>("a"));310 list.add(new Event <String>("d"));311 expected.add(list); 312 list = new ArrayList<Event <?>>();313 list.add(new Event <String>("b"));314 list.add(new Event <String>("r"));315 expected.add(list); 316 list = new ArrayList<Event <?>>();317 list.add(new Event <String>("c"));318 list.add(new Event <String>("a"));319 expected.add(list); 320 list = new ArrayList<Event <?>>();321 list.add(new Event <String>("d"));322 list.add(new Event <String>("a"));323 expected.add(list); 324 list = new ArrayList<Event <?>>();325 list.add(new Event <String>("r"));326 list.add(new Event <String>("a"));327 expected.add(list); 328 list = new ArrayList<Event <?>>();301 list = new ArrayList<Event>(); 302 list.add(new Event(new StringEventType("a"))); 303 list.add(new Event(new StringEventType("b"))); 304 expected.add(list); 305 list = new ArrayList<Event>(); 306 list.add(new Event(new StringEventType("a"))); 307 list.add(new Event(new StringEventType("c"))); 308 expected.add(list); 309 list = new ArrayList<Event>(); 310 list.add(new Event(new StringEventType("a"))); 311 list.add(new Event(new StringEventType("d"))); 312 expected.add(list); 313 list = new ArrayList<Event>(); 314 list.add(new Event(new StringEventType("b"))); 315 list.add(new Event(new StringEventType("r"))); 316 expected.add(list); 317 list = new ArrayList<Event>(); 318 list.add(new Event(new StringEventType("c"))); 319 list.add(new Event(new StringEventType("a"))); 320 expected.add(list); 321 list = new ArrayList<Event>(); 322 list.add(new Event(new StringEventType("d"))); 323 list.add(new Event(new StringEventType("a"))); 324 expected.add(list); 325 list = new ArrayList<Event>(); 326 list.add(new Event(new StringEventType("r"))); 327 list.add(new Event(new StringEventType("a"))); 328 expected.add(list); 329 list = new ArrayList<Event>(); 329 330 list.add(Event.STARTEVENT); 330 list.add(new Event <String>("a"));331 expected.add(list); 332 333 Collection<List< ? extends Event<?>>> result = fixture331 list.add(new Event(new StringEventType("a"))); 332 expected.add(list); 333 334 Collection<List<Event>> result = fixture 334 335 .generateSequences(length); 335 336 … … 342 343 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 343 344 new Random()); 344 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();345 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 345 346 sequences.add(sequence); 346 347 fixture.train(sequences); 347 348 int length = 3; 348 349 349 Collection<List<Event <?>>> expected = new HashSet<List<Event<?>>>();350 ArrayList<Event <?>> list;351 list = new ArrayList<Event <?>>();350 Collection<List<Event>> expected = new HashSet<List<Event>>(); 351 ArrayList<Event> list; 352 list = new ArrayList<Event>(); 352 353 list.add(Event.STARTEVENT); 353 list.add(new Event <String>("a"));354 list.add(new Event(new StringEventType("a"))); 354 355 list.add(Event.ENDEVENT); 355 356 expected.add(list); 356 list = new ArrayList<Event <?>>();357 list = new ArrayList<Event>(); 357 358 list.add(Event.STARTEVENT); 358 list.add(new Event <String>("a"));359 list.add(new Event <String>("b"));360 expected.add(list); 361 list = new ArrayList<Event <?>>();359 list.add(new Event(new StringEventType("a"))); 360 list.add(new Event(new StringEventType("b"))); 361 expected.add(list); 362 list = new ArrayList<Event>(); 362 363 list.add(Event.STARTEVENT); 363 list.add(new Event <String>("a"));364 list.add(new Event <String>("c"));365 expected.add(list); 366 list = new ArrayList<Event <?>>();364 list.add(new Event(new StringEventType("a"))); 365 list.add(new Event(new StringEventType("c"))); 366 expected.add(list); 367 list = new ArrayList<Event>(); 367 368 list.add(Event.STARTEVENT); 368 list.add(new Event <String>("a"));369 list.add(new Event <String>("d"));370 expected.add(list); 371 372 Collection<List< ? extends Event<?>>> result = fixture369 list.add(new Event(new StringEventType("a"))); 370 list.add(new Event(new StringEventType("d"))); 371 expected.add(list); 372 373 Collection<List<Event>> result = fixture 373 374 .generateSequences(length, true); 374 375 … … 381 382 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 382 383 new Random()); 383 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();384 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 384 385 sequences.add(sequence); 385 386 fixture.train(sequences); … … 394 395 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 395 396 new Random()); 396 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();397 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 397 398 sequences.add(sequence); 398 399 fixture.train(sequences); 399 400 int length = 5; 400 401 401 Collection<List<Event <?>>> expected = new HashSet<List<Event<?>>>();402 ArrayList<Event <?>> list;403 list = new ArrayList<Event <?>>();402 Collection<List<Event>> expected = new HashSet<List<Event>>(); 403 ArrayList<Event> list; 404 list = new ArrayList<Event>(); 404 405 list.add(Event.STARTEVENT); 405 list.add(new Event <String>("a"));406 list.add(new Event <String>("c"));407 list.add(new Event <String>("a"));406 list.add(new Event(new StringEventType("a"))); 407 list.add(new Event(new StringEventType("c"))); 408 list.add(new Event(new StringEventType("a"))); 408 409 list.add(Event.ENDEVENT); 409 410 expected.add(list); 410 list = new ArrayList<Event <?>>();411 list = new ArrayList<Event>(); 411 412 list.add(Event.STARTEVENT); 412 list.add(new Event <String>("a"));413 list.add(new Event <String>("d"));414 list.add(new Event <String>("a"));413 list.add(new Event(new StringEventType("a"))); 414 list.add(new Event(new StringEventType("d"))); 415 list.add(new Event(new StringEventType("a"))); 415 416 list.add(Event.ENDEVENT); 416 417 expected.add(list); 417 418 418 Collection<List< ? extends Event<?>>> result = fixture419 Collection<List<Event>> result = fixture 419 420 .generateValidSequences(length); 420 421 … … 427 428 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 428 429 new Random()); 429 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();430 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 430 431 sequences.add(sequence); 431 432 fixture.train(sequences); … … 440 441 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 441 442 new Random()); 442 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();443 sequences.add(sequence); 444 445 fixture.train(sequences); 446 447 Collection< ? extends Event<?>> result = fixture.getEvents();443 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 444 sequences.add(sequence); 445 446 fixture.train(sequences); 447 448 Collection<Event> result = fixture.getEvents(); 448 449 449 450 assertCollectionContent(symbols, result); … … 456 457 new Random()); 457 458 458 Collection< ? extends Event<?>> result = fixture.getEvents();459 460 assertCollectionContent(new HashSet<Event <?>>(), result);459 Collection<Event> result = fixture.getEvents(); 460 461 assertCollectionContent(new HashSet<Event>(), result); 461 462 } 462 463 … … 466 467 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 467 468 new Random()); 468 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();469 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 469 470 sequences.add(sequence); 470 471 … … 493 494 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 494 495 new Random()); 495 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();496 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 496 497 sequences.add(sequence); 497 498 fixture.train(sequences); … … 518 519 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 519 520 new Random()); 520 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();521 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 521 522 sequences.add(sequence); 522 523 fixture.train(sequences); … … 543 544 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 544 545 new Random()); 545 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();546 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 546 547 sequences.add(sequence); 547 548 … … 558 559 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 559 560 new Random()); 560 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();561 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 561 562 sequences.add(sequence); 562 563 sequences.add(sequence); … … 574 575 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 575 576 new Random()); 576 Collection<List< ? extends Event<?>>> sequences = null;577 Collection<List<Event>> sequences = null; 577 578 578 579 fixture.train(sequences); … … 584 585 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 585 586 new Random()); 586 Collection<List< ? extends Event<?>>> sequences = new ArrayList<List<? extends Event<?>>>();587 Collection<List<Event>> sequences = new ArrayList<List<Event>>(); 587 588 sequences.add(sequence); 588 589 fixture.train(sequences); … … 599 600 MockTrieBasedModel fixture = new MockTrieBasedModel(markovOrder, 600 601 new Random()); 601 Collection<List< ? extends Event<?>>> sequences = null;602 Collection<List<Event>> sequences = null; 602 603 fixture.trie = null; 603 604 … … 607 608 @Before 608 609 public void setUp() throws Exception { 609 sequence = new ArrayList<Event <?>>();610 sequence.add(new Event <String>("a"));611 sequence.add(new Event <String>("b"));612 sequence.add(new Event <String>("r"));613 sequence.add(new Event <String>("a"));614 sequence.add(new Event <String>("c"));615 sequence.add(new Event <String>("a"));616 sequence.add(new Event <String>("d"));617 sequence.add(new Event <String>("a"));618 sequence.add(new Event <String>("b"));619 sequence.add(new Event <String>("r"));620 sequence.add(new Event <String>("a"));621 622 symbols = new HashSet<Event <?>>();623 symbols.add(new Event <String>("a"));624 symbols.add(new Event <String>("b"));625 symbols.add(new Event <String>("c"));626 symbols.add(new Event <String>("d"));627 symbols.add(new Event <String>("r"));610 sequence = new ArrayList<Event>(); 611 sequence.add(new Event(new StringEventType("a"))); 612 sequence.add(new Event(new StringEventType("b"))); 613 sequence.add(new Event(new StringEventType("r"))); 614 sequence.add(new Event(new StringEventType("a"))); 615 sequence.add(new Event(new StringEventType("c"))); 616 sequence.add(new Event(new StringEventType("a"))); 617 sequence.add(new Event(new StringEventType("d"))); 618 sequence.add(new Event(new StringEventType("a"))); 619 sequence.add(new Event(new StringEventType("b"))); 620 sequence.add(new Event(new StringEventType("r"))); 621 sequence.add(new Event(new StringEventType("a"))); 622 623 symbols = new HashSet<Event>(); 624 symbols.add(new Event(new StringEventType("a"))); 625 symbols.add(new Event(new StringEventType("b"))); 626 symbols.add(new Event(new StringEventType("c"))); 627 symbols.add(new Event(new StringEventType("d"))); 628 symbols.add(new Event(new StringEventType("r"))); 628 629 symbols.add(Event.STARTEVENT); 629 630 symbols.add(Event.ENDEVENT); -
trunk/quest-core-usageprofiles/.classpath
r518 r548 2 2 <classpath> 3 3 <classpathentry kind="src" output="target/classes" path="src/main/java"> 4 <attributes> 5 <attribute name="optional" value="true"/> 6 <attribute name="maven.pomderived" value="true"/> 7 </attributes> 8 </classpathentry> 9 <classpathentry kind="src" output="target/test-classes" path="src/test/java"> 4 10 <attributes> 5 11 <attribute name="optional" value="true"/> -
trunk/quest-core-usageprofiles/pom.xml
r518 r548 9 9 <url>https://quest.informatik.uni-goettingen.de/svn/quest/trunk/quest-core-usageprofiles</url> 10 10 </scm> 11 <repositories> 12 <repository> 13 <id>mbari</id> 14 <url>http://mbari-maven-repository.googlecode.com/svn/repository</url> 15 </repository> 16 </repositories> 11 17 <dependencies> 12 18 <dependency> … … 14 20 <artifactId>quest-core-events</artifactId> 15 21 <version>0.0.1-SNAPSHOT</version> 22 </dependency> 23 <dependency> 24 <groupId>net.sf.jung</groupId> 25 <artifactId>jung-visualization</artifactId> 26 <version>2.0.1</version> 27 </dependency> 28 <dependency> 29 <groupId>net.sf.jung</groupId> 30 <artifactId>jung-graph-impl</artifactId> 31 <version>2.0.1</version> 32 </dependency> 33 <dependency> 34 <groupId>jama</groupId> 35 <artifactId>jama</artifactId> 36 <version>1.0.2</version> 16 37 </dependency> 17 38 </dependencies> -
trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/AbstractInsertEventComposite.java
r526 r548 16 16 } 17 17 18 public abstract Event <?>getEvent();18 public abstract Event getEvent(); 19 19 20 20 } -
trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/EditSequenceDialog.java
r526 r548 28 28 private TableColumn tblclmnEventTarget; 29 29 30 private java.util.List<Event <?>> sequence;30 private java.util.List<Event> sequence; 31 31 private SortedSet<String> targets; 32 32 … … 46 46 * Open the dialog. 47 47 */ 48 public void open(java.util.List<Event <?>> sequence) {48 public void open(java.util.List<Event> sequence) { 49 49 this.sequence = sequence; 50 50 createContents(); … … 165 165 private void updateTableContents() { 166 166 table.removeAll(); 167 for (Event <?>event : sequence) {167 for (Event event : sequence) { 168 168 TableItem tableItem = new TableItem(table, SWT.NONE); 169 169 String target = event.getTarget(); … … 173 173 target = target.replace("].", "].\n"); 174 174 } 175 tableItem.setText(new String[] { event.getType() , target });175 tableItem.setText(new String[] { event.getType().toString(), target }); 176 176 } 177 177 for (int i = 0; i < table.getColumnCount(); i++) { … … 183 183 InsertAssertionDialog insertDialog = new InsertAssertionDialog(shell, 184 184 SWT.NONE, targets); 185 Event <?>event = insertDialog.open();185 Event event = insertDialog.open(); 186 186 if (event != null) { 187 187 sequence.add(position, event); -
trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/InsertAssertionDialog.java
r526 r548 21 21 public class InsertAssertionDialog extends Dialog { 22 22 23 protected Event <?>result;23 protected Event result; 24 24 protected Shell shell; 25 25 … … 44 44 * @return the result 45 45 */ 46 public Event <?>open() {46 public Event open() { 47 47 result = null; 48 48 insertEventComposites = new ArrayList<AbstractInsertEventComposite>(); -
trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/InsertFileEquals.java
r526 r548 12 12 import org.eclipse.swt.widgets.Button; 13 13 14 import de.ugoe.cs.quest.assertions. AssertEvent;14 import de.ugoe.cs.quest.assertions.FileEqualsAssertEvent; 15 15 import de.ugoe.cs.quest.assertions.FileEqualsReplay; 16 16 import de.ugoe.cs.quest.eventcore.Event; … … 74 74 75 75 @Override 76 public Event <?>getEvent() {76 public Event getEvent() { 77 77 FileEqualsReplay replay = new FileEqualsReplay(expectedText.getText(), actualText.getText()); 78 AssertEvent<FileEqualsReplay> event = new AssertEvent<FileEqualsReplay>("FileEqualsAssertion");79 event.addReplay Event(replay);78 Event event = new Event(new FileEqualsAssertEvent()); 79 event.addReplayable(replay); 80 80 return event; 81 81 } -
trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/InsertTextEquals.java
r526 r548 14 14 15 15 import de.ugoe.cs.quest.assertions.AssertEvent; 16 import de.ugoe.cs.quest.assertions.TextEqualsAssertEventType; 16 17 import de.ugoe.cs.quest.assertions.TextEqualsReplay; 17 18 import de.ugoe.cs.quest.eventcore.Event; 19 import de.ugoe.cs.quest.eventcore.IEventTarget; 18 20 import de.ugoe.cs.util.ArrayTools; 19 21 … … 98 100 99 101 @Override 100 public Event <?>getEvent() {101 Stringtarget = targetText.getText();102 public Event getEvent() { 103 IEventTarget target = targetText.getText(); 102 104 TextEqualsReplay replay = new TextEqualsReplay(expectedText.getText(), target); 103 AssertEvent<TextEqualsReplay> event = new AssertEvent<TextEqualsReplay>("TextEqualsAssertion");105 Event event = new Event(new TextEqualsAssertEventType()); 104 106 event.setTarget(target); 105 event.addReplay Event(replay);107 event.addReplayable(replay); 106 108 return event; 107 109 } -
trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/SequencesDialog.java
r526 r548 27 27 28 28 private List sequenceList; 29 private Collection<java.util.List<Event <?>>> sequences;29 private Collection<java.util.List<Event>> sequences; 30 30 private SortedSet<String> targets; 31 31 … … 85 85 EditSequenceDialog editSequenceDialog = new EditSequenceDialog(shell, SWT.NONE, targets); 86 86 int counter = 0; 87 java.util.List<Event <?>> selectedSequence = null;88 for( java.util.List<Event <?>> sequence : sequences ) {87 java.util.List<Event> selectedSequence = null; 88 for( java.util.List<Event> sequence : sequences ) { 89 89 if( counter==index ) { 90 90 selectedSequence = sequence; … … 116 116 Object dataObject = GlobalDataContainer.getInstance().getData(sequencesName); 117 117 if( SequenceInstanceOf.isCollectionOfSequences(dataObject)) { 118 sequences = (Collection<java.util.List<Event <?>>>) dataObject;118 sequences = (Collection<java.util.List<Event>>) dataObject; 119 119 int seqDigits = Integer.toString(sequences.size()).length(); 120 120 int counter = 1; 121 for( java.util.List<Event <?>> sequence : sequences ) {121 for( java.util.List<Event> sequence : sequences ) { 122 122 String seqName = "#"+String.format("%0"+seqDigits+"d", counter)+": "+sequence.size(); 123 123 sequenceList.add(seqName); … … 135 135 if( targets==null ) { 136 136 targets = new TreeSet<String>(); 137 for( java.util.List<Event <?>> sequence : sequences ) {138 for( Event <?>event : sequence ) {137 for( java.util.List<Event> sequence : sequences ) { 138 for( Event event : sequence ) { 139 139 String target = event.getTarget(); 140 140 if( target!=null ) {
Note: See TracChangeset
for help on using the changeset viewer.