Index: /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieTest.java
===================================================================
--- /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieTest.java	(revision 397)
+++ /trunk/EventBenchCoreTest/src/de/ugoe/cs/eventbench/models/TrieTest.java	(revision 398)
@@ -15,24 +15,25 @@
 
 /**
- * The class <code>TrieTest</code> contains tests for the class <code>{@link Trie}</code>.
- *
+ * The class <code>TrieTest</code> contains tests for the class
+ * <code>{@link Trie}</code>.
+ * 
  * @author Steffen Herbold
  * @version 1.0
  */
 public class TrieTest {
-	
+
 	List<String> sequence;
 	Collection<String> symbols;
-	
-	private static void assertCollectionContent(Collection<?> c1, Collection<?> c2) {
+
+	private static void assertCollectionContent(Collection<?> c1,
+			Collection<?> c2) {
 		assertEquals(c1.size(), c2.size());
-		for( Object obj : c1 ) {
+		for (Object obj : c1) {
 			assertTrue(c2.contains(obj));
 		}
 	}
-	
-	@Test
-	public void testTrie_1()
-		throws Exception {
+
+	@Test
+	public void testTrie_1() throws Exception {
 
 		Trie<String> result = new Trie<String>();
@@ -46,41 +47,53 @@
 
 	@Test
-	public void testAdd_1()
-		throws Exception {
+	public void testTrie_2() throws Exception {
+		Trie<String> trie1 = new Trie<String>();
+		trie1.train(sequence, 3);
+
+		Trie<String> result = new Trie<String>(trie1);
+
+		assertEquals(trie1, result);
+		assertNotSame(trie1, result);
+	}
+
+	@Test(expected = java.security.InvalidParameterException.class)
+	public void testTrie_3() throws Exception {
+		new Trie<String>(null);
+	}
+
+	@Test
+	public void testAdd_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		List<String> seq = new ArrayList<String>();
 		seq.add("a");
 		seq.add("b");
-		
+
 		fixture.add(seq);
-		
+
 		assertEquals(1, fixture.getChild("a").getCount());
 		assertEquals(1, fixture.getChild("a").getChild("b").getCount());
 		assertNull(fixture.getChild("b"));
 	}
-	
-	@Test
-	public void testAdd_2()
-		throws Exception {
-		Trie<String> fixture = new Trie<String>();
-		
+
+	@Test
+	public void testAdd_2() throws Exception {
+		Trie<String> fixture = new Trie<String>();
+
 		fixture.add(new ArrayList<String>());
-		
+
 		assertEquals(0, fixture.getNumSymbols());
 	}
-	
-	@Test
-	public void testAdd_3()
-		throws Exception {
-		Trie<String> fixture = new Trie<String>();
-		
+
+	@Test
+	public void testAdd_3() throws Exception {
+		Trie<String> fixture = new Trie<String>();
+
 		fixture.add(null);
-		
+
 		assertEquals(0, fixture.getNumSymbols());
 	}
 
 	@Test
-	public void testFind_1()
-		throws Exception {
+	public void testFind_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -89,6 +102,7 @@
 		findSequence.add("b");
 		findSequence.add("r");
-		TrieNode<String> expected = fixture.getChild("a").getChild("b").getChild("r");
-		
+		TrieNode<String> expected = fixture.getChild("a").getChild("b")
+				.getChild("r");
+
 		TrieNode<String> result = fixture.find(findSequence);
 
@@ -97,6 +111,5 @@
 
 	@Test
-	public void testFind_2()
-		throws Exception {
+	public void testFind_2() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -105,5 +118,5 @@
 		findSequence.add("a");
 		TrieNode<String> expected = fixture.getChild("c").getChild("a");
-		
+
 		TrieNode<String> result = fixture.find(findSequence);
 
@@ -112,10 +125,9 @@
 
 	@Test
-	public void testFind_3()
-		throws Exception {
+	public void testFind_3() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
 		List<String> findSequence = new ArrayList<String>();
-		
+
 		TrieNode<String> result = fixture.find(findSequence);
 
@@ -124,9 +136,8 @@
 
 	@Test
-	public void testFind_4()
-		throws Exception {
-		Trie<String> fixture = new Trie<String>();
-		fixture.train(sequence, 3);
-		
+	public void testFind_4() throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+
 		TrieNode<String> result = fixture.find(null);
 
@@ -135,6 +146,5 @@
 
 	@Test
-	public void testGetChildCreate_1()
-		throws Exception {
+	public void testGetChildCreate_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		String symbol = "a";
@@ -146,8 +156,7 @@
 		assertTrue(result.isLeaf());
 	}
-	
-	@Test(expected=java.security.InvalidParameterException.class)
-	public void testGetChildCreate_2()
-		throws Exception {
+
+	@Test(expected = java.security.InvalidParameterException.class)
+	public void testGetChildCreate_2() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.getChildCreate(null);
@@ -155,6 +164,5 @@
 
 	@Test
-	public void testGetContextSuffix_1()
-		throws Exception {
+	public void testGetContextSuffix_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -166,5 +174,4 @@
 		expected.add("a");
 		expected.add("b");
-		
 
 		List<String> result = fixture.getContextSuffix(context);
@@ -174,6 +181,5 @@
 
 	@Test
-	public void testGetContextSuffix_2()
-		throws Exception {
+	public void testGetContextSuffix_2() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -186,5 +192,4 @@
 		expected.add("b");
 		expected.add("r");
-		
 
 		List<String> result = fixture.getContextSuffix(context);
@@ -194,6 +199,5 @@
 
 	@Test
-	public void testGetContextSuffix_3()
-		throws Exception {
+	public void testGetContextSuffix_3() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -211,6 +215,5 @@
 
 	@Test
-	public void testGetContextSuffix_4()
-		throws Exception {
+	public void testGetContextSuffix_4() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 
@@ -223,6 +226,5 @@
 
 	@Test
-	public void testGetContextSuffix_5()
-		throws Exception {
+	public void testGetContextSuffix_5() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -234,5 +236,4 @@
 		expected.add("a");
 		expected.add("b");
-		
 
 		List<String> result = fixture.getContextSuffix(context);
@@ -242,6 +243,5 @@
 
 	@Test
-	public void testGetCount_1()
-		throws Exception {
+	public void testGetCount_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -255,6 +255,5 @@
 
 	@Test
-	public void testGetCount_2()
-		throws Exception {
+	public void testGetCount_2() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -264,11 +263,10 @@
 
 		int result = fixture.getCount(subSequence);
-		
+
 		assertEquals(2, result);
 	}
 
 	@Test
-	public void testGetCount_3()
-		throws Exception {
+	public void testGetCount_3() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -280,8 +278,7 @@
 		assertEquals(0, result);
 	}
-	
-	@Test
-	public void testGetCount_4()
-		throws Exception {
+
+	@Test
+	public void testGetCount_4() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -294,6 +291,5 @@
 
 	@Test
-	public void testGetCount_5()
-		throws Exception {
+	public void testGetCount_5() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -303,11 +299,10 @@
 
 		int result = fixture.getCount(subSequence, "r");
-		
+
 		assertEquals(2, result);
 	}
 
 	@Test
-	public void testGetCount_6()
-		throws Exception {
+	public void testGetCount_6() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -320,6 +315,5 @@
 
 	@Test
-	public void testGetFollowingSymbols_1()
-		throws Exception {
+	public void testGetFollowingSymbols_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -330,5 +324,5 @@
 		expected.add("c");
 		expected.add("d");
-		
+
 		Collection<String> result = fixture.getFollowingSymbols(subSequence);
 
@@ -337,6 +331,5 @@
 
 	@Test
-	public void testGetFollowingSymbols_2()
-		throws Exception {
+	public void testGetFollowingSymbols_2() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -350,8 +343,7 @@
 		assertEquals(0, result.size());
 	}
-	
-	@Test
-	public void testGetFollowingSymbols_3()
-		throws Exception {
+
+	@Test
+	public void testGetFollowingSymbols_3() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -363,8 +355,7 @@
 		assertEquals(0, result.size());
 	}
-	
-	@Test
-	public void testGetNumLeafAncestors_1()
-		throws Exception {
+
+	@Test
+	public void testGetNumLeafAncestors_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -374,8 +365,7 @@
 		assertEquals(7, result);
 	}
-	
-	@Test
-	public void testGetNumLeafs_1()
-		throws Exception {
+
+	@Test
+	public void testGetNumLeafs_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -385,8 +375,7 @@
 		assertEquals(7, result);
 	}
-	
-	@Test
-	public void testGetNumSymbols_1()
-		throws Exception {
+
+	@Test
+	public void testGetNumSymbols_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		fixture.train(sequence, 3);
@@ -398,14 +387,13 @@
 
 	@Test
-	public void testTrain_1()
-		throws Exception {
+	public void testTrain_1() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		int maxOrder = 3;
 
 		fixture.train(sequence, maxOrder);
-		
+
 		// check if symbols are correct
 		assertCollectionContent(symbols, fixture.getKnownSymbols());
-		
+
 		// check if counters are correct and only the correct nodes exist
 		TrieNode<String> root = fixture.find(new ArrayList<String>());
@@ -475,5 +463,5 @@
 		TrieNode<String> root_r_d = root_r.getChild("d");
 		TrieNode<String> root_r_r = root_r.getChild("r");
-		
+
 		assertEquals(5, root_a.getCount());
 		assertNull(root_a_a);
@@ -497,5 +485,5 @@
 		assertNull(root_a_d_r);
 		assertNull(root_a_r);
-		
+
 		assertEquals(2, root_b.getCount());
 		assertNull(root_b_a);
@@ -509,5 +497,5 @@
 		assertNull(root_b_r_d);
 		assertNull(root_b_r_r);
-		
+
 		assertEquals(1, root_c.getCount());
 		assertEquals(1, root_c_a.getCount());
@@ -521,5 +509,5 @@
 		assertNull(root_c_d);
 		assertNull(root_c_r);
-		
+
 		assertEquals(1, root_d.getCount());
 		assertEquals(1, root_d_a.getCount());
@@ -533,5 +521,5 @@
 		assertNull(root_d_d);
 		assertNull(root_d_r);
-		
+
 		assertEquals(2, root_r.getCount());
 		assertEquals(2, root_r_a.getCount());
@@ -545,5 +533,5 @@
 		assertNull(root_r_d);
 		assertNull(root_r_r);
-		
+
 		// check if leafs are really leafs
 		assertTrue(root_a_b_r.isLeaf());
@@ -557,6 +545,5 @@
 
 	@Test
-	public void testTrain_2()
-		throws Exception {
+	public void testTrain_2() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		int maxOrder = 0;
@@ -568,6 +555,5 @@
 
 	@Test
-	public void testTrain_3()
-		throws Exception {
+	public void testTrain_3() throws Exception {
 		Trie<Object> fixture = new Trie<Object>();
 		List<Object> sequence = new ArrayList<Object>();
@@ -575,11 +561,10 @@
 
 		fixture.train(sequence, maxOrder);
-		
+
 		assertTrue(fixture.getKnownSymbols().isEmpty());
 	}
 
 	@Test
-	public void testTrain_4()
-		throws Exception {
+	public void testTrain_4() throws Exception {
 		Trie<String> fixture = new Trie<String>();
 		List<String> sequence = new ArrayList<String>();
@@ -589,5 +574,5 @@
 
 		fixture.train(sequence, maxOrder);
-		
+
 		assertCollectionContent(sequence, fixture.getKnownSymbols());
 		TrieNode<String> root = fixture.find(new ArrayList<String>());
@@ -598,5 +583,5 @@
 		TrieNode<String> root_b_a = root_b.getChild("a");
 		TrieNode<String> root_b_b = root_b.getChild("b");
-		
+
 		assertEquals(1, root_a.getCount());
 		assertNull(root_a_a);
@@ -605,38 +590,113 @@
 		assertNull(root_b_a);
 		assertNull(root_b_b);
-		
+
 		assertTrue(root_a_b.isLeaf());
 		assertTrue(root_b.isLeaf());
 	}
-	
+
 	@Test
 	public void testEdgeEdge_1() throws Exception {
 		Edge result = new Edge();
-		
+
 		assertNotNull(result);
 	}
-	
+
 	@Test
 	public void testTrieVertexTrieVertex_1() throws Exception {
 		String id = "idString";
-		
+
 		TrieVertex result = new TrieVertex(id);
-		
+
 		assertNotNull(result);
 	}
-	
+
 	@Test
 	public void testTrieVertexToString_1() throws Exception {
 		String id = "idString";
 		TrieVertex fixture = new TrieVertex(id);
-		
+
 		String result = fixture.toString();
-		
+
 		assertEquals(id, result);
 	}
 
+	@Test
+	public void testEquals_1() throws Exception {
+		Trie<String> trieOther = new Trie<String>();
+		Trie<String> fixture = new Trie<String>();
+
+		boolean result = fixture.equals(trieOther);
+
+		assertEquals(true, result);
+	}
+
+	@Test
+	public void testEquals_2() throws Exception {
+		Trie<String> trieOther = new Trie<String>();
+		trieOther.train(sequence, 2);
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 2);
+
+		boolean result = fixture.equals(trieOther);
+
+		assertEquals(true, result);
+	}
+
+	@Test
+	public void testEquals_3() throws Exception {
+		Trie<String> trieOther = new Trie<String>();
+		trieOther.train(sequence, 2);
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 3);
+
+		boolean result = fixture.equals(trieOther);
+
+		assertEquals(false, result);
+	}
+
+	@Test
+	public void testEquals_4() throws Exception {
+		Trie<String> trieOther = new Trie<String>();
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 2);
+
+		boolean result = fixture.equals(trieOther);
+
+		assertEquals(false, result);
+	}
+
+	@Test
+	public void testEquals_5() throws Exception {
+		Trie<String> trieOther = new Trie<String>();
+		trieOther.train(sequence, 2);
+		Trie<String> fixture = new Trie<String>();
+
+		boolean result = fixture.equals(trieOther);
+
+		assertEquals(false, result);
+	}
+
+	@Test
+	public void testEquals_6() throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 2);
+
+		boolean result = fixture.equals(fixture);
+
+		assertEquals(true, result);
+	}
+
+	@Test
+	public void testEquals_7() throws Exception {
+		Trie<String> fixture = new Trie<String>();
+		fixture.train(sequence, 2);
+
+		boolean result = fixture.equals(null);
+
+		assertEquals(false, result);
+	}
+
 	@Before
-	public void setUp()
-		throws Exception {
+	public void setUp() throws Exception {
 		sequence = new ArrayList<String>();
 		sequence.add("a");
@@ -651,5 +711,5 @@
 		sequence.add("r");
 		sequence.add("a");
-		
+
 		symbols = new HashSet<String>();
 		symbols.add("a");
@@ -660,10 +720,4 @@
 	}
 
-	@After
-	public void tearDown()
-		throws Exception {
-		// Add additional tear down code here
-	}
-
 	public static void main(String[] args) {
 		new org.junit.runner.JUnitCore().run(TrieTest.class);
