Index: trunk/EventBenchConsole/.classpath
===================================================================
--- trunk/EventBenchConsole/.classpath	(revision 425)
+++ trunk/EventBenchConsole/.classpath	(revision 1)
@@ -3,36 +3,25 @@
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="lib" path="lib/collections-generic-4.01.jar"/>
+	<classpathentry kind="lib" path="lib/jdom.jar"/>
+	<classpathentry kind="lib" path="lib/colt-1.2.0.jar"/>
+	<classpathentry kind="lib" path="lib/concurrent-1.3.4.jar"/>
+	<classpathentry kind="lib" path="lib/j3d-core-1.3.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-3d-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-3d-demos-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-algorithms-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-api-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-graph-impl-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-io-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-jai-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-jai-samples-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-samples-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-visualization-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/stax-api-1.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/vecmath-1.3.1.jar"/>
+	<classpathentry kind="lib" path="lib/wstx-asl-3.2.6.jar"/>
+	<classpathentry kind="lib" path="lib/commons-codec-1.5.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JavaHelperLib"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/EventBenchCore"/>
-	<classpathentry kind="lib" path="/Build/lib/collections-generic-4.01.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/colt-1.2.0.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/commons-codec-1.5.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/concurrent-1.3.4.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/gui-model-core.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/j3d-core-1.3.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jdom.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-3d-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-3d-demos-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-algorithms-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-api-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-graph-impl-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-io-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-jai-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-jai-samples-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-samples-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-visualization-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/log4j-1.2.16.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/org.eclipse.core.commands_3.6.0.I20110111-0800.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/org.eclipse.equinox.common_3.6.0.v20110523.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/org.eclipse.jface_3.7.0.I20110522-1430.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/org.eclipse.osgi_3.7.0.v20110613.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/org.eclipse.swt.win32.win32.x86_3.7.0.v3735b.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/org.eclipse.ui.forms_3.5.100.v20110425.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/org.eclipse.ui.workbench_3.7.0.I20110519-0100.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/stax-api-1.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/vecmath-1.3.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/wstx-asl-3.2.6.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jopt-simple-3.3.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jdom-1.1.3.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: trunk/EventBenchConsole/.project
===================================================================
--- trunk/EventBenchConsole/.project	(revision 425)
+++ trunk/EventBenchConsole/.project	(revision 1)
@@ -4,6 +4,4 @@
 	<comment></comment>
 	<projects>
-		<project>Build</project>
-		<project>EventBenchCore</project>
 		<project>JavaHelperLib</project>
 	</projects>
Index: trunk/EventBenchConsole/rules/ruleDoctype.dtd
===================================================================
--- trunk/EventBenchConsole/rules/ruleDoctype.dtd	(revision 425)
+++ trunk/EventBenchConsole/rules/ruleDoctype.dtd	(revision 1)
@@ -90,5 +90,4 @@
 <!ENTITY WM_NCXBUTTONUP "172">
 <!ENTITY WM_NCXBUTTONDBLCLK "173">
-<!ENTITY SBM_SETPOS "224">
 <!ENTITY BM_CLICK "245">
 <!ENTITY WM_INPUT "255">
@@ -134,9 +133,8 @@
 <!ENTITY WM_CTLCOLORLISTBOX "308">
 <!ENTITY WM_CTLCOLORBTN "309">
-<!ENTITY WM_CTLCOLORDLG "310">
+<!ENTITY WM_CTLCLOLORDLG "310">
 <!ENTITY WM_CTLCOLORSCROLLBAR "311">
 <!ENTITY WM_CTLCOLORSTATIC "312">
 <!ENTITY CB_SHOWDROPDOWN "335">
-<!ENTITY LB_SETCURSEL "390">
 <!ENTITY WM_MOUSEFIRST "512">
 <!ENTITY WM_MOUSEMOVE "512">
@@ -155,6 +153,3 @@
 <!ENTITY WM_XBUTTONUP "524">
 <!ENTITY WM_XBUTTONDBLCLK "525">
-<!ENTITY WM_USER "1024">
-<!ENTITY CB_SETCURSEL "334">
 <!ENTITY TBM_SETPOS "1029">
-<!ENTITY TCM_SETCURSEL "4876">
Index: trunk/EventBenchConsole/rules/ruleSchema.xsd
===================================================================
--- trunk/EventBenchConsole/rules/ruleSchema.xsd	(revision 425)
+++ trunk/EventBenchConsole/rules/ruleSchema.xsd	(revision 1)
@@ -189,6 +189,4 @@
       <xs:enumeration value="resourceId"/>
       <xs:enumeration value="hwnd"/>
-      <xs:enumeration value="parentTarget"/>
-      <xs:enumeration value="parentClass"/>
     </xs:restriction>
   </xs:simpleType>
Index: trunk/EventBenchConsole/rules/rules.xml
===================================================================
--- trunk/EventBenchConsole/rules/rules.xml	(revision 425)
+++ trunk/EventBenchConsole/rules/rules.xml	(revision 1)
@@ -4,98 +4,28 @@
 
   <!-- rules regarding mouse clicks -->
-  <rule name="LeftClickButton">
-    <msg type="&WM_LBUTTONDOWN;">
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <constValue value="Button"/>
-        <winInfoValue obj="this" winParam="class"/>
-      </equals>
-      <equals>
-        <paramValue obj="clicked" param="window.hwnd"/>
-        <paramValue obj="this" param="window.hwnd"/>
-      </equals>
-    </msg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&BM_CLICK;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-    </genMsg>
-  </rule>
-
-  <rule name="LeftClickListBox">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <winInfoValue obj="this" winParam="class"/>
-        <constValue value="ListBox"/>
-      </equals>
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <store var="up"/>
-    </msg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&LB_SETCURSEL;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-      <WPARAM>
-        <paramValue obj="up" param="scrollPos"/>
-      </WPARAM>
-    </genMsg>
-  </rule>
-
-  <rule name="TabChange">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <constValue value="SysTabControl32"/>
-        <winInfoValue obj="this" winParam="class"/>
-      </equals>
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <store var="up"/>
-    </msg>
-    <!-- tab change message for Tab Controls-->
-    <genMsg delay="100">
-      <type>
-        <constValue value="&TCM_SETCURSEL;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="up" msgParam="target"/>
-      </target>
-      <WPARAM>
-        <paramValue obj="up" param="scrollPos"/>
-      </WPARAM>
-    </genMsg>
-    <!-- tab change message for Property Pages-->
-    <genMsg delay="500">
-      <type>
-        <constValue value="1125"/>
-      </type>
-      <target>
-        <winInfoValue obj="up" winParam="parentTarget"/>
-      </target>
-      <WPARAM>
-        <paramValue obj="up" param="scrollPos"/>
-      </WPARAM>
-    </genMsg>
-  </rule>
-
-<!--
+<rule name="LeftClickButton">
+ <msg type="&WM_LBUTTONDOWN;">
+  <store var="clicked"/>
+ </msg>
+ <msg type="&WM_LBUTTONUP;">
+  <equals>
+   <constValue value="Button"/>
+   <winInfoValue obj="this" winParam="class"/>
+  </equals>
+  <equals>
+   <paramValue obj="clicked" param="window.hwnd"/>
+   <paramValue obj="this" param="window.hwnd"/>
+  </equals>
+ </msg>
+ <genMsg delay="100">
+  <type>
+   <constValue value="&BM_CLICK;"/>
+  </type>
+  <target>
+   <msgInfoValue obj="clicked" msgParam="target"/>
+  </target>
+ </genMsg>
+</rule>
+
   <rule name="ComboBox">
     <msg type="&WM_LBUTTONDOWN;">
@@ -139,5 +69,5 @@
       </target>
     </genMsg>
-    <genMsg delay="500">
+    <genMsg delay="100">
       <type>
         <constValue value="&CB_SHOWDROPDOWN;"/>
@@ -150,5 +80,5 @@
       </WPARAM>
     </genMsg>
-    <!-
+    <!--
     <genMsg delay="100">
       <type>
@@ -178,147 +108,7 @@
         <seqValue seqObj="cmds" param="WPARAM"/>
       </WPARAM>
-    </genMsgSeq>->
-  </rule>
-  <rule name="ComboLBox">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <winInfoValue obj="this" winParam="class"/>
-        <constValue value="ComboLBox"/>
-      </equals>
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_COMMAND;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <store var="cmd1">
-        <resolveHwnd param="source" storeParam="sourceDesc"/>
-      </store>
-    </msg>
-    <msg type="&WM_COMMAND;" multiple="true">
-      <equals>
-        <paramValue obj="this" param="source"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <storeSeq varSeq="cmds">
-        <resolveHwnd param="window.hwnd" storeParam="msgTarget"/>
-        <resolveHwnd param="source" storeParam="sourceDesc"/>
-      </storeSeq>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-    </msg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_SETFOCUS;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-    </genMsg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&CB_SHOWDROPDOWN;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-      <WPARAM>
-        <constValue value="1"/>
-      </WPARAM>
-    </genMsg>
+    </genMsgSeq>-->
   </rule>
   
-  <rule name="LeftClickCommandComboLBox">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <constValue value="ComboLBox"/>
-        <winInfoValue obj="this" winParam="class"/>
-      </equals>
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="clicked" param="window.hwnd"/>
-        <paramValue obj="this" param="window.hwnd"/>
-      </equals>
-      <store var="up"/>
-    </msg>
-    <msg type="&WM_COMMAND;">
-      <equals>
-        <paramValue obj="clicked" param="window.hwnd"/>
-        <paramValue obj="this" param="source"/>
-      </equals>
-      <store var="cmd1">
-        <resolveHwnd param="source" storeParam="sourceDesc"/>
-      </store>
-    </msg>
-    <msg type="&WM_COMMAND;" multiple="true">
-      <equals>
-        <paramValue obj="this" param="source"/>
-        <paramValue obj="cmd1" param="window.hwnd"/>
-      </equals>
-      <storeSeq varSeq="cmds">
-        <resolveHwnd param="window.hwnd" storeParam="target"/>
-        <resolveHwnd param="source" storeParam="sourceDesc"/>
-      </storeSeq>
-    </msg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&CB_SETCURSEL;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="up" msgParam="target"/>
-      </target>
-      <WPARAM>
-        <constValue value="1"/>
-        <!-<paramValue obj="up" param="scrollPos"/>->
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&CB_SHOWDROPDOWN;"/>
-      </type>
-      <target>
-        <winInfoValue obj="clicked" winParam="parentTarget"/>
-      </target>
-      <WPARAM>
-        <constValue value="0"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_COMMAND;"/>
-      </type>
-      <target>
-        <winInfoValue obj="cmd1" winParam="parentTarget"/>
-      </target>
-      <LPARAM>
-        <paramValue obj="cmd1" param="sourceDesc"/>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="cmd1" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-    <genMsgSeq delay="100">
-      <type>
-        <constValue value="&WM_COMMAND;"/>
-      </type>
-      <target>
-        <seqValue seqObj="cmds" param="target"/>
-      </target>
-      <LPARAM>
-        <seqValue seqObj="cmds" param="sourceDesc"/>
-      </LPARAM>
-      <WPARAM>
-        <seqValue seqObj="cmds" param="WPARAM"/>
-      </WPARAM>
-    </genMsgSeq>
-  </rule>-->
-
   <rule name="LeftClickCommand">
     <msg type="&WM_LBUTTONDOWN;">
@@ -340,5 +130,5 @@
       </store>
     </msg>
-    <genMsg delay="500">
+    <genMsg delay="100">
       <type>
         <msgInfoValue obj="cmd" msgParam="type"/>
@@ -369,5 +159,5 @@
       <store var="cmd"/>
     </msg>
-    <genMsg delay="500">
+    <genMsg delay="100">
       <storedVar obj="cmd"/>
     </genMsg>
@@ -391,5 +181,5 @@
       <store var="cmd"/>
     </msg>
-    <genMsg delay="500">
+    <genMsg delay="100">
       <storedVar obj="cmd"/>
     </genMsg>
@@ -419,5 +209,5 @@
       <store var="cmd"/>
     </msg>
-    <genMsg delay="500">
+    <genMsg delay="100">
       <storedVar obj="cmd"/>
     </genMsg>
@@ -426,10 +216,6 @@
  
   <!-- rules involving mouse movement -->
-  <rule name="HScroll_TrackBar">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <winInfoValue obj="this" winParam="class"/>
-        <constValue value="msctls_trackbar32"/>
-      </equals>
+  <rule name="HScroll">
+    <msg type="&WM_LBUTTONDOWN;">
       <store var="clicked"/>
     </msg>
@@ -442,94 +228,14 @@
         <resolveHwnd param="scrollBarHandle" storeParam="scrollBarTarget"/>
       </storeSeq>
-    </msg>    
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-    </msg>
-    <genMsgSeq delay="50">
+    </msg>
+    <msg type="&WM_LBUTTONUP;">
+      <equals>
+        <paramValue obj="clicked" param="window.hwnd"/>
+        <paramValue obj="clicked" param="window.hwnd"/>
+      </equals>
+    </msg>
+    <genMsgSeq delay="20">
       <type>
         <constValue value="&TBM_SETPOS;"/>
-      </type>
-      <target>
-        <seqValue seqObj="scrolls" param="scrollBarTarget"/>
-      </target>
-      <LPARAM>
-        <seqValue seqObj="scrolls" param="scrollPos"/>
-      </LPARAM>
-      <WPARAM>
-        <constValue value="1"/>
-      </WPARAM>
-    </genMsgSeq>
-  </rule>
-
-
-  <rule name="VScroll_TrackBar">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <winInfoValue obj="this" winParam="class"/>
-        <constValue value="msctls_trackbar32"/>
-      </equals>
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_VSCROLL;" multiple="true">
-      <equals>
-        <paramValue obj="this" param="scrollBarHandle"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <storeSeq varSeq="scrolls">
-        <resolveHwnd param="scrollBarHandle" storeParam="scrollBarTarget"/>
-      </storeSeq>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-    </msg>
-    <genMsgSeq delay="50">
-      <type>
-        <constValue value="&TBM_SETPOS;"/>
-      </type>
-      <target>
-        <seqValue seqObj="scrolls" param="scrollBarTarget"/>
-      </target>
-      <LPARAM>
-        <seqValue seqObj="scrolls" param="scrollPos"/>
-      </LPARAM>
-      <WPARAM>
-        <constValue value="1"/>
-      </WPARAM>
-    </genMsgSeq>
-  </rule>
-
-
-  <rule name="HScroll_ScrollBar">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <winInfoValue obj="this" winParam="class"/>
-        <constValue value="ScrollBar"/>
-      </equals>
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_HSCROLL;" multiple="true">
-      <equals>
-        <paramValue obj="this" param="scrollBarHandle"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <storeSeq varSeq="scrolls">
-        <resolveHwnd param="scrollBarHandle" storeParam="scrollBarTarget"/>
-      </storeSeq>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-    </msg>
-    <genMsgSeq delay="50">
-      <type>
-        <constValue value="&SBM_SETPOS;"/>
       </type>
       <target>
@@ -544,109 +250,7 @@
     </genMsgSeq>
   </rule>
-
-
-  <rule name="VScroll_ScrollBar">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <winInfoValue obj="this" winParam="class"/>
-        <constValue value="ScrollBar"/>
-      </equals>
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_VSCROLL;" multiple="true">
-      <equals>
-        <paramValue obj="this" param="scrollBarHandle"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <storeSeq varSeq="scrolls">
-        <resolveHwnd param="scrollBarHandle" storeParam="scrollBarTarget"/>
-      </storeSeq>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-    </msg>
-    <genMsgSeq delay="50">
-      <type>
-        <constValue value="&SBM_SETPOS;"/>
-      </type>
-      <target>
-        <seqValue seqObj="scrolls" param="scrollBarTarget"/>
-      </target>
-      <LPARAM>
-        <constValue value="1"/>
-      </LPARAM>
-      <WPARAM>
-        <seqValue seqObj="scrolls" param="scrollPos"/>
-      </WPARAM>
-    </genMsgSeq>
-  </rule>
   
-  <!-- Does not work correctly, if a scrollbar has no handle of its own, e.g., a standard scrollbar of a listbox -->
-  <rule name="VScrollNC">
-    <msg type="&WM_NCLBUTTONDOWN;">
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_VSCROLL;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <store var="scrolls"/>
-    </msg>
-    <genMsg delay="50">
-      <type>
-        <constValue value="&WM_VSCROLL;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-      <WPARAM>
-        <LOWORD>
-          <constValue value="4"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="scrolls" param="scrollPos"/>
-        </HIWORD>
-      </WPARAM>
-    </genMsg>
-  </rule>
-
-
-  <!--<rule name="VScrollNC">
-    <msg type="&WM_NCLBUTTONDOWN;">
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_VSCROLL;" multiple="true">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <storeSeq varSeq="scrolls">
-        <resolveHwnd param="window.hwnd" storeParam="scrollBarTarget"/>
-      </storeSeq>
-    </msg>
-    <genMsgSeq delay="20">
-      <type>
-        <constValue value="&WM_VSCROLL;"/>
-      </type>
-      <target>
-        <seqValue seqObj="scrolls" param="scrollBarTarget"/>
-      </target>
-      <WPARAM>
-        <LOWORD>
-          <constValue value="4"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="scrolls" param="scrollPos"/>
-        </HIWORD>
-      </WPARAM>
-    </genMsgSeq>
-  </rule>-->
-
-  <!-- Copy of set focus without kill-focus -->
-  <rule name="LeftClickSetFocus">
+  <!-- if nothing else, at least switch focus, works only partially -->
+  <rule name="LeftClickChangeFocus">
     <msg type="&WM_LBUTTONDOWN;">
       <equals>
@@ -656,5 +260,12 @@
       <store var="clicked"/>
     </msg>
+    <msg type="&WM_KILLFOCUS;">
+      <store var="killfocus"/>
+    </msg>
     <msg type="&WM_SETFOCUS;">
+      <equals>
+        <paramValue obj="this" param="WPARAM"/>
+        <paramValue obj="killfocus" param="window.hwnd"/>
+      </equals>
       <store var="setfocus"/>
     </msg>
@@ -678,4 +289,15 @@
     <genMsg delay="20">
       <type>
+        <constValue value="&WM_KILLFOCUS;"/>
+      </type>
+      <target>
+        <msgInfoValue obj="killfocus" msgParam="target"/>
+      </target>
+      <WPARAM>
+        <msgInfoValue obj="setfocus" msgParam="target"/>
+      </WPARAM>
+    </genMsg>
+    <genMsg delay="20">
+      <type>
         <constValue value="&WM_SETFOCUS;"/>
       </type>
@@ -684,8 +306,8 @@
       </target>
       <WPARAM>
-        <constValue value="0"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="500">
+        <msgInfoValue obj="killfocus" msgParam="target"/>
+      </WPARAM>
+    </genMsg>
+    <genMsg delay="100">
       <type>
         <constValue value="&WM_COMMAND;"/>
@@ -702,91 +324,54 @@
     </genMsg>
   </rule>
+
+
+  <!-- rules regarding keyboard input -->
+  <!-- <rule name="KeyPressed">
+    <msg type="&WM_KEYDOWN;">
+      <store var="keydown"/>
+    </msg>
+    <msg type="&WM_KEYUP;">
+      <store var="keyup"/>
+    </msg>
+    <genMsg delay="20">
+      <storedVar obj="keydown"/>
+    </genMsg>
+    <genMsg delay="100">
+      <storedVar obj="keyup"/>
+    </genMsg>
+    <idinfo>
+      <paramValue obj="keydown" param="key"/>
+    </idinfo>
+  </rule>
+
+  <rule name="SysKeyPressed">
+    <msg type="&WM_SYSKEYDOWN;">
+      <store var="keydown"/>
+    </msg>
+    <msg type="&WM_SYSKEYUP;">
+      <store var="keyup"/>
+    </msg>
+    <genMsg delay="20">
+      <storedVar obj="keydown"/>
+    </genMsg>
+    <genMsg delay="100">
+      <storedVar obj="keyup"/>
+    </genMsg>
+    <idinfo>
+      <paramValue obj="keydown" param="key"/>
+    </idinfo>
+  </rule> -->
   
-  <!-- Works only partially! -->
-  <rule name="LeftClickChangeFocus">
-    <msg type="&WM_LBUTTONDOWN;">
-      <equals>
-        <winInfoValue obj="this" winParam="class"/>
-        <constValue value="Edit"/>
-      </equals>
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_KILLFOCUS;">
-      <store var="killfocus"/>
-    </msg>
-    <msg type="&WM_SETFOCUS;">
-      <equals>
-        <paramValue obj="this" param="WPARAM"/>
-        <paramValue obj="killfocus" param="window.hwnd"/>
-      </equals>
-      <store var="setfocus"/>
-    </msg>
-    <msg type="&WM_COMMAND;">
-      <equals>
-        <paramValue obj="this" param="source"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-      <equals>
-        <paramValue obj="this" param="sourceType"/>
-        <constValue value="256"/>
-      </equals>
-      <store var="cmd"/>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="this" param="window.hwnd"/>
-        <paramValue obj="clicked" param="window.hwnd"/>
-      </equals>
-    </msg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_KILLFOCUS;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="killfocus" msgParam="target"/>
-      </target>
-      <WPARAM>
-        <msgInfoValue obj="setfocus" msgParam="target"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_SETFOCUS;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="setfocus" msgParam="target"/>
-      </target>
-      <WPARAM>
-        <msgInfoValue obj="killfocus" msgParam="target"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&WM_COMMAND;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="cmd" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <msgInfoValue obj="setfocus" msgParam="target"/>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="cmd" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-  </rule>
-
-
-  <!-- Rules for keyboard input -->
+  <!-- Alternate rules -->
   <rule name="KeyDown">
     <msg type="&WM_KEYDOWN;">
       <store var="keydown"/>
     </msg>
-    <genMsg delay="100">
+    <genMsg delay="20">
       <storedVar obj="keydown"/>
     </genMsg>
-    <!--<idinfo>
+    <idinfo>
       <paramValue obj="keydown" param="key"/>
-    </idinfo>-->
+    </idinfo>
   </rule>
 
@@ -795,10 +380,10 @@
       <store var="keyup"/>
     </msg>
-    <genMsg delay="500">
+    <genMsg delay="20">
       <storedVar obj="keyup"/>
     </genMsg>
-    <!--<idinfo>
+    <idinfo>
       <paramValue obj="keyup" param="key"/>
-    </idinfo>-->
+    </idinfo>
   </rule>
 
@@ -807,5 +392,5 @@
       <store var="keydown"/>
     </msg>
-    <genMsg delay="100">
+    <genMsg delay="20">
       <storedVar obj="keydown"/>
     </genMsg>
@@ -819,5 +404,5 @@
       <store var="keyup"/>
     </msg>
-    <genMsg delay="500">
+    <genMsg delay="20">
       <storedVar obj="keyup"/>
     </genMsg>
@@ -827,253 +412,3 @@
   </rule>
 
-
-  <!-- What follows are coordinate-based rules. They are "hail mary" rules that try to salvage events that cannot be matched or replayed in a coordinate independent way (yet). -->
-  <rule name ="LeftClickCoordinates">
-    <msg type="&WM_LBUTTONDOWN;">
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="clicked" param="window.hwnd"/>
-        <paramValue obj="this" param="window.hwnd"/>
-      </equals>
-      <store var="up"/>
-    </msg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_LBUTTONDOWN;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="clicked" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="clicked" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="clicked" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&WM_LBUTTONUP;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="up" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="up" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="up" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="up" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-  </rule>
-  
-  <rule name ="NCLeftClickCoordinates">
-    <msg type="&WM_NCLBUTTONDOWN;">
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <equals>
-        <paramValue obj="clicked" param="window.hwnd"/>
-        <paramValue obj="this" param="window.hwnd"/>
-      </equals>
-      <store var="up"/>
-    </msg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_NCLBUTTONDOWN;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="clicked" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="clicked" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="clicked" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&WM_LBUTTONUP;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="up" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="up" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="up" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="up" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-  </rule>
-
-  <rule name ="NCLeftClickCoordinates2">
-    <msg type="&WM_NCLBUTTONDOWN;">
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_NCLBUTTONUP;">
-      <equals>
-        <paramValue obj="clicked" param="window.hwnd"/>
-        <paramValue obj="this" param="window.hwnd"/>
-      </equals>
-      <store var="up"/>
-    </msg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_NCLBUTTONDOWN;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="clicked" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="clicked" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="clicked" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&WM_NCLBUTTONUP;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="up" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="up" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="up" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="up" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-  </rule>
-
-  <rule name ="LeftClickCoordinatesTargetChanged">
-    <msg type="&WM_LBUTTONDOWN;">
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_LBUTTONUP;">
-      <store var="up"/>
-    </msg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_LBUTTONDOWN;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="clicked" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="clicked" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="clicked" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&WM_LBUTTONUP;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="up" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="up" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="up" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="up" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-  </rule>
-  
-  <rule name ="LeftClickCoordinatesTargetChanged2">
-    <msg type="&WM_LBUTTONDOWN;">
-      <store var="clicked"/>
-    </msg>
-    <msg type="&WM_NCLBUTTONUP;">
-      <store var="up"/>
-    </msg>
-    <genMsg delay="100">
-      <type>
-        <constValue value="&WM_LBUTTONDOWN;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="clicked" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="clicked" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="clicked" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="clicked" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-    <genMsg delay="500">
-      <type>
-        <constValue value="&WM_NCLBUTTONUP;"/>
-      </type>
-      <target>
-        <msgInfoValue obj="up" msgParam="target"/>
-      </target>
-      <LPARAM>
-        <LOWORD>
-          <paramValue obj="up" param="point.x"/>
-        </LOWORD>
-        <HIWORD>
-          <paramValue obj="up" param="point.y"/>
-        </HIWORD>
-      </LPARAM>
-      <WPARAM>
-        <paramValue obj="up" param="WPARAM"/>
-      </WPARAM>
-    </genMsg>
-  </rule>
-
-
 </rules>
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/CommandHelpers.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/CommandHelpers.java	(revision 425)
+++ 	(revision )
@@ -1,54 +1,0 @@
-package de.ugoe.cs.eventbench;
-
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Helper class that collects methods that are often used by the commands.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CommandHelpers {
-
-	/**
-	 * <p>
-	 * Prints a message to error stream of the {@link Console} that an object
-	 * has not been found in the storage.
-	 * </p>
-	 * 
-	 * @param objectName
-	 *            name of the object
-	 */
-	public static void objectNotFoundMessage(String objectName) {
-		Console.printerrln("Object " + objectName + " not found in storage.");
-	}
-
-	/**
-	 * <p>
-	 * Prints a message to the error stream of the {@link Console} that an
-	 * object is not of an expected type.
-	 * </p>
-	 * 
-	 * @param objectName
-	 *            name of the object
-	 * @param type
-	 *            expected type
-	 */
-	public static void objectNotType(String objectName, String type) {
-		Console.printerrln("Object " + objectName + "not of type " + type + ".");
-	}
-
-	/**
-	 * <p>
-	 * Prints a message to the trace stream of the {@link Console} that an
-	 * object in the storage has been overwritten.
-	 * </p>
-	 * 
-	 * @param objectName
-	 */
-	public static void dataOverwritten(String objectName) {
-		Console.traceln("Existing object " + objectName + " overwritten.");
-	}
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/EventGenerator.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/EventGenerator.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/EventGenerator.java	(revision 1)
@@ -0,0 +1,707 @@
+package de.ugoe.cs.eventbench;
+
+import java.io.IOException;
+import java.security.InvalidParameterException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.Namespace;
+import org.jdom.input.SAXBuilder;
+
+import de.ugoe.cs.eventbench.data.Event;
+import de.ugoe.cs.eventbench.data.ReplayableEvent;
+import de.ugoe.cs.eventbench.data.WindowTree;
+import de.ugoe.cs.eventbench.data.WindowTreeNode;
+import de.ugoe.cs.eventbench.data.WindowsMessage;
+import de.ugoe.cs.util.console.Console;
+
+/**
+ * <p>
+ * Translates sequences of windows messages into events that can be used by the
+ * Logalyzer core libraries for usage analysis.
+ * </p>
+ * 
+ * @author Steffen Herbold
+ * 
+ */
+public class EventGenerator {
+
+	/**
+	 * <p>
+	 * Helper method that fetches the document node of an XML file.
+	 * </p>
+	 * 
+	 * @param filename
+	 *            name of the XML file
+	 * @return the document node
+	 */
+	private static Document getDocument(String filename) {
+		SAXBuilder builder = new SAXBuilder();
+		Document doc = null;
+
+		try {
+			doc = builder.build(filename);
+			rulesNamespace = Namespace.getNamespace("ul:rules");
+		} catch (JDOMException e) {
+			System.err.println("Invalid rules file.");
+			e.printStackTrace();
+		} catch (IOException e) {
+			System.err.println("Invalid rules file.");
+			e.printStackTrace();
+		}
+
+		return doc;
+	}
+
+	/**
+	 * <p>
+	 * Name and path of the XML files containing the rules.
+	 * </p>
+	 */
+	private String rulesFile;
+
+	/**
+	 * <p>
+	 * Iterator used for the current sequence.
+	 * </p>
+	 */
+	private ListIterator<WindowsMessage> sequenceIterator;
+
+	/**
+	 * <p>
+	 * Token that is currently being generated.
+	 * </p>
+	 */
+	private ReplayableEvent<WindowsMessage> currentToken;
+
+	/**
+	 * <p>
+	 * Reference to the ul:rules namespace.
+	 * </p>
+	 */
+	private static Namespace rulesNamespace;
+
+	/**
+	 * <p>
+	 * The name of the rule that is currently being evaluated.
+	 * </p>
+	 */
+	private String currentRuleName;
+
+	/**
+	 * <p>
+	 * Internal message storage. Used to implement the
+	 * <code>{@literal <store>}</code> and <code>{@literal <storeSeq>}</code>
+	 * tags.
+	 * </p>
+	 */
+	private Map<String, Object> messageStorage;
+
+	/**
+	 * <p>
+	 * Creates a new EventGenerator. Sets "rules/rules.xml" as default file for
+	 * the rules.
+	 * </p>
+	 */
+	public EventGenerator() {
+		rulesFile = "rules/rules.xml";
+	}
+
+	/**
+	 * <p>
+	 * Tries to match the rules to the given sequence to generate an
+	 * {@link Event}.
+	 * </p>
+	 * <p>
+	 * The rules are matched the order, in which they are defined in the XML
+	 * file. Therefore, the order of the rules in the file defines priorities,
+	 * when multiple rules could be matched to the same sequence.
+	 * </p>
+	 * 
+	 * @param sequence
+	 *            sequence of message for which an event will be generated
+	 * @return event that matches the messages; null, if no rule can be matched
+	 */
+	@SuppressWarnings("unchecked")
+	public Event<WindowsMessage> generateEvent(List<WindowsMessage> sequence) {
+		Document rulesDoc = getDocument(rulesFile);
+		Element rulesRoot = rulesDoc.getRootElement();
+
+		List<Element> ruleElements = rulesRoot.getChildren("rule",
+				rulesNamespace);
+
+		boolean isMatch = false;
+
+		for (int ruleIndex = 0; ruleIndex < ruleElements.size() && !isMatch; ruleIndex++) {
+			Element currentRule = ruleElements.get(ruleIndex);
+			currentToken = new ReplayableEvent<WindowsMessage>(currentRuleName);
+			currentRuleName = currentRule.getAttributeValue("name");
+			isMatch = true;
+			messageStorage = new HashMap<String, Object>();
+			sequenceIterator = sequence.listIterator();
+			List<Element> ruleChildrenMsg = currentRule.getChildren("msg",
+					rulesNamespace);
+
+			int i = 0;
+			while (isMatch && i < ruleChildrenMsg.size()) {
+				Element messageElement = ruleChildrenMsg.get(i);
+				if ("true".equals(messageElement.getAttributeValue("multiple"))) {
+					Element nextMessageElement = null;
+					if (i + 1 < ruleChildrenMsg.size()) {
+						nextMessageElement = ruleChildrenMsg.get(i + 1);
+					}
+					try {
+						isMatch = matchMultipleMessages(messageElement,
+								nextMessageElement);
+					} catch (InvalidParameterException e) {
+						Console.printerrln(e.getMessage());
+					}
+				} else {
+					try {
+						isMatch = matchSingleMessage(messageElement);
+					} catch (InvalidParameterException e) {
+						Console.printerrln(e.getMessage());
+					}
+				}
+				i++;
+			}
+			if (isMatch) {
+				List<Element> ruleChildren = currentRule.getChildren();
+				for (Element genMsgElement : ruleChildren) {
+					if (genMsgElement.getName().equals("genMsg")) {
+						try {
+							generateReplayMessage(genMsgElement);
+						} catch (InvalidParameterException e) {
+							Console.printerrln(e.getMessage());
+							currentToken.invalidateReplay();
+						}
+					} else if (genMsgElement.getName().equals("genMsgSeq")) {
+						try {
+							generateReplaySequence(genMsgElement);
+							currentToken.invalidateReplay();
+						} catch (InvalidParameterException e) {
+							Console.printerrln(e.getMessage());
+							currentToken.invalidateReplay();
+						}
+					}
+				}
+				Element idinfoElement = currentRule.getChild("idinfo",
+						rulesNamespace);
+				if (idinfoElement != null) {
+					// cannot be empty if document is valid
+					List<Element> valueElements = idinfoElement.getChildren();
+					currentToken.setIdInfo(getTermValue(null,
+							valueElements.get(0)));
+				}
+				Console.traceln(currentRule.getAttributeValue("name")
+						+ currentToken.getIdInfo() + " matched");
+			} else {
+				currentToken = null;
+			}
+		}
+		if (!isMatch) {
+			Console.traceln("no match found for sequence: "
+					+ sequence.toString());
+		}
+		return currentToken;
+	}
+
+	private boolean createSequenceLParam(
+			List<WindowsMessage> generatedMessageSeq, boolean msgsGenerated,
+			int constMsgType, Element termElement)
+			throws NoSuchElementException {
+		Iterator<WindowsMessage> seqIterator = generatedMessageSeq.iterator();
+		if (termElement.getName().equals("seqValue")) {
+			String obj = termElement.getAttributeValue("seqObj");
+			List<WindowsMessage> seqVar = getStoredSeqVariable(obj);
+			if (msgsGenerated && seqVar.size() != generatedMessageSeq.size()) {
+				throw new InvalidParameterException(
+						"Failure generating replay sequence for rule "
+								+ currentRuleName
+								+ ": One or more of the sequence variables used to generate a sequence have different lenghts.");
+			}
+			for (WindowsMessage msg : seqVar) {
+				WindowsMessage currentSeqMsg = getCurrentSeqMsg(
+						generatedMessageSeq, msgsGenerated, constMsgType,
+						seqIterator);
+				String paramValueStr = msg.getParameter(termElement
+						.getAttributeValue("param"));
+				int paramValue = 0;
+				try {
+					paramValue = Integer.parseInt(paramValueStr);
+					currentSeqMsg.setLPARAM(paramValue);
+				} catch (NumberFormatException e) {
+					currentSeqMsg.setLPARAMasWindowDesc(paramValueStr);
+				}
+			}
+			if (seqIterator.hasNext()) {
+				// the first seq-var has a different number of elements than the
+				// current one
+				throw new NoSuchElementException();
+			}
+			msgsGenerated = true;
+		} else { // const value
+			int paramValue = Integer.parseInt(getTermValue(null, termElement));
+			while (seqIterator.hasNext()) {
+				seqIterator.next().setLPARAM(paramValue);
+			}
+		}
+		return msgsGenerated;
+	}
+
+	private boolean createSequenceTarget(
+			List<WindowsMessage> generatedMessageSeq, boolean msgsGenerated,
+			int constMsgType, Element termElement)
+			throws NoSuchElementException {
+		Iterator<WindowsMessage> seqIterator = generatedMessageSeq.iterator();
+		if (termElement.getName().equals("seqValue")) {
+			String obj = termElement.getAttributeValue("seqObj");
+			List<WindowsMessage> seqVar = getStoredSeqVariable(obj);
+			if (msgsGenerated && seqVar.size() != generatedMessageSeq.size()) {
+				throw new InvalidParameterException(
+						"Failure generating replay sequence for rule "
+								+ currentRuleName
+								+ ": One or more of the sequence variables used to generate a sequence have different lenghts.");
+			}
+			for (WindowsMessage msg : seqVar) {
+				WindowsMessage currentSeqMsg = getCurrentSeqMsg(
+						generatedMessageSeq, msgsGenerated, constMsgType,
+						seqIterator);
+				String targetString = msg.getParameter(termElement
+						.getAttributeValue("param"));
+				currentSeqMsg.setXmlWindowDescription(targetString);
+			}
+			msgsGenerated = true;
+		} else { // const value
+			throw new AssertionError("target must be a sequence variable!");
+			/*
+			 * If target would not be a variable, the message-elements could not
+			 * yet be created and the whole sequence might be broken. If this is
+			 * to be changed, createSequenceLParam and createSequenceWParam need
+			 * to be addepted, too.
+			 */
+		}
+		return msgsGenerated;
+	}
+
+	private boolean createSequenceWParam(
+			List<WindowsMessage> generatedMessageSeq, boolean msgsGenerated,
+			int constMsgType, Element termElement)
+			throws NoSuchElementException {
+		Iterator<WindowsMessage> seqIterator = generatedMessageSeq.iterator();
+		if (termElement.getName().equals("seqValue")) {
+			String obj = termElement.getAttributeValue("seqObj");
+			List<WindowsMessage> seqVar = getStoredSeqVariable(obj);
+			if (msgsGenerated && seqVar.size() != generatedMessageSeq.size()) {
+				throw new InvalidParameterException(
+						"Failure generating replay sequence for rule "
+								+ currentRuleName
+								+ ": One or more of the sequence variables used to generate a sequence have different lenghts.");
+			}
+			for (WindowsMessage msg : seqVar) {
+				WindowsMessage currentSeqMsg = getCurrentSeqMsg(
+						generatedMessageSeq, msgsGenerated, constMsgType,
+						seqIterator);
+				String paramValueStr = msg.getParameter(termElement
+						.getAttributeValue("param"));
+				int paramValue = 0;
+				try {
+					paramValue = Integer.parseInt(paramValueStr);
+					currentSeqMsg.setWPARAM(paramValue);
+				} catch (NumberFormatException e) {
+					currentSeqMsg.setWPARAMasWindowDesc(paramValueStr);
+				}
+			}
+			if (seqIterator.hasNext()) {
+				// the first seq-var has a different number of elements than the
+				// current one
+				throw new NoSuchElementException();
+			}
+			msgsGenerated = true;
+		} else { // const value
+			int paramValue = Integer.parseInt(getTermValue(null, termElement));
+			while (seqIterator.hasNext()) {
+				seqIterator.next().setWPARAM(paramValue);
+			}
+		}
+		return msgsGenerated;
+	}
+
+	@SuppressWarnings("unchecked")
+	private boolean evalEqualRestrictions(WindowsMessage currentMessage,
+			Element messageElement) {
+		boolean isMatch = true;
+		for (Element childElement : (List<Element>) messageElement.getChildren(
+				"equals", rulesNamespace)) {
+			List<Element> termElements = childElement.getChildren();
+			// the size 2 of termElements is guaranteed by the XML schema
+			String value1 = getTermValue(currentMessage, termElements.get(0));
+			String value2 = getTermValue(currentMessage, termElements.get(1));
+			if (value1 == null || value2 == null) {
+				isMatch = false;
+			} else {
+				isMatch = isMatch && value1.equals(value2);
+			}
+		}
+		for (Element childElement : (List<Element>) messageElement.getChildren(
+				"equalsSeq", rulesNamespace)) {
+			List<Element> termElements = childElement.getChildren();
+			List<String> values1 = getTermValueSeq(currentMessage,
+					termElements.get(0));
+			List<String> values2 = getTermValueSeq(currentMessage,
+					termElements.get(0));
+			if (values1 == null || values2 == null) {
+				isMatch = false;
+			} else {
+				isMatch = isMatch && values1.equals(values2);
+			}
+		}
+		return isMatch;
+	}
+
+	@SuppressWarnings("unchecked")
+	private void generateReplayMessage(Element genMsgElement) {
+		List<Element> genMsgChildren = genMsgElement.getChildren();
+		WindowsMessage generatedMessage = null;
+		if (genMsgChildren.size() == 1) { // replay stored message without
+											// change
+			String obj = genMsgChildren.get(0).getAttributeValue("obj");
+			generatedMessage = getStoredMessageVariable(null, obj);
+		} else { // generate message according to the rule
+			for (Element genMsgChild : genMsgChildren) {
+				Element termElement = (Element) genMsgChild.getChildren()
+						.get(0);
+				if (genMsgChild.getName().equals("type")) {
+					try {
+						int msgType = Integer.parseInt(getTermValue(null,
+								termElement));
+						generatedMessage = new WindowsMessage(msgType);
+					} catch (NumberFormatException e) {
+						throw new InvalidParameterException(
+								"Failure generating replay sequence for rule "
+										+ currentRuleName
+										+ ": Defined type is not an integer.");
+					}
+				} else if (genMsgChild.getName().equals("target")) {
+					String targetString = getTermValue(null, termElement);
+					generatedMessage.setXmlWindowDescription(targetString);
+				} else if (genMsgChild.getName().equals("LPARAM")) {
+					String paramValueStr = getTermValue(null, termElement);
+					int paramValue = 0;
+					try {
+						paramValue = Integer.parseInt(paramValueStr);
+						generatedMessage.setLPARAM(paramValue);
+					} catch (NumberFormatException e) {
+						generatedMessage.setLPARAMasWindowDesc(paramValueStr);
+					}
+				} else if (genMsgChild.getName().equals("WPARAM")) {
+					String paramValueStr = getTermValue(null, termElement);
+					int paramValue = 0;
+					try {
+						paramValue = Integer.parseInt(paramValueStr);
+						generatedMessage.setWPARAM(paramValue);
+					} catch (NumberFormatException e) {
+						generatedMessage.setWPARAMasWindowDesc(paramValueStr);
+					}
+				}
+			}
+		}
+		if (generatedMessage != null) {
+			int delay = Integer.parseInt(genMsgElement
+					.getAttributeValue("delay"));
+			generatedMessage.setDelay(delay);
+		} else {
+			currentToken.invalidateReplay();
+		}
+		currentToken.addReplayEvent(generatedMessage);
+	}
+
+	@SuppressWarnings("unchecked")
+	private void generateReplaySequence(Element genMsgElement) {
+		List<Element> genMsgSeqChildren = genMsgElement.getChildren();
+		List<WindowsMessage> generatedMessageSeq = new LinkedList<WindowsMessage>();
+		if (genMsgSeqChildren.size() == 1) {
+			String obj = genMsgSeqChildren.get(0).getAttributeValue("seqObj");
+			generatedMessageSeq = getStoredSeqVariable(obj);
+		} else {
+			boolean msgsGenerated = false;
+			int constMsgType = 0;
+			for (Element genMsgSeqChild : genMsgSeqChildren) {
+				Element termElement = (Element) genMsgSeqChild.getChildren()
+						.get(0);
+				if (genMsgSeqChild.getName().equals("type")) {
+					// note: cannot easily be extracted because of mulitple
+					// return values
+					if (termElement.getName().equals("seqValue")) {
+						String obj = termElement.getAttributeValue("seqObj");
+						List<WindowsMessage> seqVar = getStoredSeqVariable(obj);
+						for (WindowsMessage msg : seqVar) {
+							generatedMessageSeq.add(new WindowsMessage(msg
+									.getType()));
+						}
+						msgsGenerated = true;
+					} else { // constValue type
+						constMsgType = Integer.parseInt(getTermValue(null,
+								termElement));
+					}
+				} else if (genMsgSeqChild.getName().equals("target")) {
+					msgsGenerated = createSequenceTarget(generatedMessageSeq,
+							msgsGenerated, constMsgType, termElement);
+				} else if (genMsgSeqChild.getName().equals("LPARAM")) {
+					msgsGenerated = createSequenceLParam(generatedMessageSeq,
+							msgsGenerated, constMsgType, termElement);
+				} else if (genMsgSeqChild.getName().equals("WPARAM")) {
+					msgsGenerated = createSequenceWParam(generatedMessageSeq,
+							msgsGenerated, constMsgType, termElement);
+				}
+			}
+		}
+		currentToken.addReplaySequence(generatedMessageSeq);
+	}
+
+	private WindowsMessage getCurrentSeqMsg(
+			List<WindowsMessage> generatedMessageSeq, boolean msgsGenerated,
+			int constMsgType, Iterator<WindowsMessage> seqIterator) {
+		WindowsMessage currentSeqMsg = null;
+		if (msgsGenerated) {
+			currentSeqMsg = seqIterator.next();
+		} else {
+			currentSeqMsg = new WindowsMessage(constMsgType);
+			generatedMessageSeq.add(currentSeqMsg);
+		}
+		return currentSeqMsg;
+	}
+
+	private WindowsMessage getStoredMessageVariable(
+			WindowsMessage currentMessage, String obj)
+			throws InvalidParameterException {
+		WindowsMessage varMessage = null;
+		if (obj.equals("this")) {
+			if (currentMessage == null) {
+				throw new InvalidParameterException(
+						"Failure obtaining term value for rule "
+								+ currentRuleName
+								+ ": \"this\" is not a valid name for generating runtime messages.");
+			}
+			varMessage = currentMessage;
+		} else {
+			Object tmp = messageStorage.get(obj);
+			if (tmp instanceof WindowsMessage) {
+				varMessage = (WindowsMessage) tmp;
+			} else {
+				throw new InvalidParameterException(
+						"Failure obtaining term value for rule "
+								+ currentRuleName + ": No message \"" + obj
+								+ "\" stored.");
+			}
+		}
+		return varMessage;
+	}
+
+	@SuppressWarnings("unchecked")
+	private List<WindowsMessage> getStoredSeqVariable(String obj)
+			throws InvalidParameterException {
+		List<WindowsMessage> varMsgSeq = null;
+		Object tmp = messageStorage.get(obj);
+		if (tmp instanceof List<?>) {
+			varMsgSeq = (List<WindowsMessage>) tmp;
+		} else {
+			throw new InvalidParameterException(
+					"Failure obtaining term value for rule " + currentRuleName
+							+ ": No sequence \"" + obj + "\" store.");
+		}
+		return varMsgSeq;
+	}
+
+	private String getTermValue(WindowsMessage currentMessage,
+			Element termElement) {
+		String value = null;
+		WindowsMessage varMessage = null;
+		if (termElement.getName().equals("constValue")) {
+			value = termElement.getAttributeValue("value");
+		} else if (termElement.getName().equals("paramValue")) {
+			String objectName = termElement.getAttributeValue("obj");
+			varMessage = getStoredMessageVariable(currentMessage, objectName);
+			if (varMessage != null) {
+				String param = termElement.getAttributeValue("param");
+				value = varMessage.getParameter(param);
+			}
+		} else if (termElement.getName().equals("winInfoValue")) {
+			String objectName = termElement.getAttributeValue("obj");
+			varMessage = getStoredMessageVariable(currentMessage, objectName);
+			if (varMessage != null) {
+				String paramString = termElement.getAttributeValue("winParam");
+				if (paramString.equals("class")) {
+					value = varMessage.getWindowClass();
+				} else if (paramString.equals("resourceId")) {
+					value = "" + varMessage.getWindowResourceId();
+				} else if (paramString.equals("hwnd")) {
+					value = "" + varMessage.getHwnd();
+				}
+			}
+		} else if (termElement.getName().equals("msgInfoValue")) {
+			String objectName = termElement.getAttributeValue("obj");
+			varMessage = getStoredMessageVariable(currentMessage, objectName);
+			if (varMessage != null) {
+				String paramString = termElement.getAttributeValue("msgParam");
+				if (paramString.equals("type")) {
+					value = "" + varMessage.getType();
+				} else if (paramString.equals("target")) {
+					value = varMessage.getXmlWindowDescription();
+				}
+			}
+		}
+		return value;
+	}
+
+	private List<String> getTermValueSeq(WindowsMessage currentMessage,
+			Element termElement) {
+		List<String> values = new LinkedList<String>();
+		if (termElement.getName().equals("seqValue")) {
+			String obj = termElement.getAttributeValue("seqObj");
+			String param = termElement.getAttributeValue("param");
+			List<WindowsMessage> seqVar = getStoredSeqVariable(obj);
+
+			for (WindowsMessage msg : seqVar) {
+				// msg.getParameter returns null, if parameter is not found,
+				// therefore the List can contain null-values
+				values.add(msg.getParameter(param));
+			}
+		}
+		return values;
+	}
+
+	@SuppressWarnings("unchecked")
+	private void handleStorage(Element messageElement,
+			WindowsMessage currentMessage) {
+		for (Element childElement : (List<Element>) messageElement.getChildren(
+				"store", rulesNamespace)) {
+			String identifier = childElement.getAttributeValue("var");
+			messageStorage.put(identifier, currentMessage);
+			resolveHwnd(currentMessage, childElement);
+		}
+		for (Element childElement : (List<Element>) messageElement.getChildren(
+				"storeSeq", rulesNamespace)) {
+			String identifier = childElement.getAttributeValue("varSeq");
+			Object tmp = messageStorage.get(identifier);
+			List<WindowsMessage> storedSequence;
+			if (tmp == null || tmp instanceof WindowsMessage) {
+				storedSequence = new LinkedList<WindowsMessage>();
+				storedSequence.add(currentMessage);
+				messageStorage.put(identifier, storedSequence);
+			} else if (tmp instanceof List<?>) {
+				storedSequence = (List<WindowsMessage>) tmp;
+				storedSequence.add(currentMessage);
+				messageStorage.put(identifier, storedSequence);
+			}
+			resolveHwnd(currentMessage, childElement);
+		}
+	}
+
+	private boolean matchMultipleMessages(Element messageElement,
+			Element nextMessageElement) {
+		boolean isMatch = false;
+		boolean isCurrentMatch = false;
+		boolean nextMatchFound = false;
+		WindowsMessage currentMessage = null;
+		WindowsMessage nextMessage = null;
+
+		int type = Integer.parseInt(messageElement.getAttributeValue("type"));
+
+		int nextType = -1;
+		if (nextMessageElement != null) {
+			nextType = Integer.parseInt(nextMessageElement
+					.getAttributeValue("type"));
+		}
+
+		while (!nextMatchFound && sequenceIterator.hasNext()) {
+			currentMessage = sequenceIterator.next();
+			if (type == currentMessage.getType()) {
+				isCurrentMatch = evalEqualRestrictions(currentMessage,
+						messageElement);
+				isMatch = isMatch || isCurrentMatch;
+
+				if (isCurrentMatch) {
+					handleStorage(messageElement, currentMessage);
+					currentToken.setTarget(currentMessage
+							.getXmlWindowDescription());
+					currentToken
+							.setTargetShort(currentMessage.getParentNames());
+				}
+			}
+			if (nextMessageElement != null && isMatch) {
+				// peek next message to check if the sequence ends and the next
+				// match is found
+				if (!sequenceIterator.hasNext()) {
+					return false; // sequence is over, but not all messages are
+									// found
+				}
+				nextMessage = sequenceIterator.next();
+				sequenceIterator.previous();
+
+				if (nextType == nextMessage.getType()) {
+					nextMatchFound = evalEqualRestrictions(nextMessage,
+							nextMessageElement);
+				}
+
+			}
+		}
+
+		return isMatch;
+	}
+
+	private boolean matchSingleMessage(Element messageElement) {
+		boolean isMatch = false;
+		WindowsMessage currentMessage = null;
+
+		int type = Integer.parseInt(messageElement.getAttributeValue("type"));
+
+		while (!isMatch && sequenceIterator.hasNext()) {
+			// traverses the messages from the current position forward till a
+			// message with the correct type is found
+			currentMessage = sequenceIterator.next();
+			if (type == currentMessage.getType()) {
+				// message with the correct type found
+				// eval child nodes for further matching/storing
+				isMatch = evalEqualRestrictions(currentMessage, messageElement);
+
+				// in case the message is a match, eval storage children
+				if (isMatch) {
+					handleStorage(messageElement, currentMessage);
+					currentToken.setTarget(currentMessage
+							.getXmlWindowDescription());
+					currentToken
+							.setTargetShort(currentMessage.getParentNames());
+				}
+			}
+		}
+
+		return isMatch;
+	}
+
+	@SuppressWarnings("unchecked")
+	private void resolveHwnd(WindowsMessage currentMessage, Element childElement) {
+		List<Element> resolveElements = childElement.getChildren("resolveHwnd",
+				rulesNamespace);
+		for (Element resolveElement : resolveElements) {
+			String param = resolveElement.getAttributeValue("param");
+			String storeParam = resolveElement.getAttributeValue("storeParam");
+			int paramHwnd = Integer
+					.parseInt(currentMessage.getParameter(param));
+			WindowTreeNode node = WindowTree.getInstance().find(paramHwnd);
+			if (node != null) {
+				currentMessage.addParameter(storeParam,
+						node.xmlRepresentation());
+			}
+		}
+	}
+
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/LogParser.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/LogParser.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/LogParser.java	(revision 1)
@@ -0,0 +1,179 @@
+package de.ugoe.cs.eventbench;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.security.InvalidParameterException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import de.ugoe.cs.eventbench.data.Event;
+import de.ugoe.cs.eventbench.data.WindowTree;
+import de.ugoe.cs.eventbench.data.WindowsMessage;
+import de.ugoe.cs.eventbench.messagehandler.HandlerCreate;
+import de.ugoe.cs.eventbench.messagehandler.HandlerDestroy;
+import de.ugoe.cs.eventbench.messagehandler.HandlerSetText;
+import de.ugoe.cs.eventbench.messagehandler.MessageHandler;
+import de.ugoe.cs.eventbench.windowsdefs.MessageDefs;
+import de.ugoe.cs.util.StringTools;
+import de.ugoe.cs.util.console.Console;
+
+public class LogParser extends DefaultHandler {
+	
+	private MessageHandler currentHandler;
+	
+	private WindowsMessage currentMessage;
+	
+	private SequenceSplitter sequenceSplitter;
+	
+	private List<List<Event<WindowsMessage>>> sequences;
+	
+	private SortedMap<Integer, Integer> typeCounter;
+	
+	private boolean countMessageOccurences;
+	
+	public LogParser() {
+		this(false);
+	}
+	
+	public LogParser(boolean countMessageOccurences) {
+		sequenceSplitter = new SequenceSplitter();
+		sequences = new LinkedList<List<Event<WindowsMessage>>>();
+		currentHandler = null;
+		this.countMessageOccurences = countMessageOccurences;
+		if( countMessageOccurences) {
+			typeCounter = new TreeMap<Integer, Integer>();
+		}
+		
+	}
+	
+	public List<List<Event<WindowsMessage>>> getSequences() {
+		return sequences;
+	}
+	
+	@Override
+	public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+		if( qName.equals("session") ) {
+			Console.traceln("start of session");
+			sequenceSplitter = new SequenceSplitter();
+		}
+		else if( qName.equals("msg") ) {
+			String msgType = atts.getValue("type");
+			int msgInt = -1;
+			try {
+				msgInt = Integer.parseInt(msgType);
+				
+				if( countMessageOccurences ) {
+					Integer currentCount = typeCounter.get(msgInt);
+					if( currentCount==null ) {
+						typeCounter.put(msgInt, 1);
+					} else {
+						typeCounter.put(msgInt, currentCount+1);
+					}
+				}
+				
+				if( msgInt==MessageDefs.WM_CREATE ) {
+					currentHandler = new HandlerCreate();
+					currentHandler.onStartElement();
+				}
+				else if( msgInt==MessageDefs.WM_DESTROY ) {
+					currentHandler = new HandlerDestroy();
+					currentHandler.onStartElement();
+				}
+				else if( msgInt==MessageDefs.WM_SETTEXT ) {
+					currentHandler = new HandlerSetText();
+					currentHandler.onStartElement();
+				} else {
+					currentMessage = new WindowsMessage(msgInt);
+				}
+			} catch(NumberFormatException e) {
+				System.err.println("Invalid message type: type not a number");
+				e.printStackTrace();
+			}
+		}
+		else if( qName.equals("param") ) {
+			if( currentHandler!=null ) {
+				currentHandler.onParameter(atts.getValue("name"), atts.getValue("value"));
+			} else {
+				currentMessage.addParameter(atts.getValue("name"), atts.getValue("value"));
+			}
+		}
+	}
+	
+	@Override
+	public void endElement(String uri, String localName, String qName) throws SAXException {
+		if( qName.equals("msg") ) {
+			if( currentHandler!=null ) {
+				currentHandler.onEndElement();
+				currentHandler = null;
+			} else {
+				try {
+					currentMessage.setTarget(WindowTree.getInstance());
+					sequenceSplitter.addMessage(currentMessage);
+				} catch (InvalidParameterException e) {
+					Console.traceln(e.getMessage() + " WindowsMessage " + currentMessage + " ignored.");
+				}				
+			}
+		}
+		else if(qName.equals("session")) {
+			sequenceSplitter.endSession();
+			sequences.add(sequenceSplitter.getSequence());
+			Console.traceln("end of session");
+		}
+	}
+	
+	public void parseFile(String filename) {
+		if( filename==null ) {
+			throw new InvalidParameterException("filename must not be null");
+		}
+		
+		SAXParserFactory spf = SAXParserFactory.newInstance();
+		spf.setValidating(true);
+		
+		SAXParser saxParser = null;
+		InputSource inputSource = null;
+		try {
+			saxParser = spf.newSAXParser();
+			inputSource = new InputSource(new FileReader(filename));
+		} catch (ParserConfigurationException e) {
+			e.printStackTrace();
+		} catch (SAXException e) {
+			e.printStackTrace();
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		}
+		if( inputSource!=null ) {
+	        inputSource.setSystemId("file://" + new File(filename).getAbsolutePath());
+	        try {
+	        	if( saxParser==null) {
+	        		throw new RuntimeException("SAXParser creation failed");
+	        	}
+				saxParser.parse(inputSource, this);
+	        } catch (SAXParseException e) {
+	        	Console.printerrln("Failure parsing file in line " + e.getLineNumber() + ", column " + e.getColumnNumber() +".");
+	        	e.printStackTrace();
+			} catch (SAXException e) {
+				e.printStackTrace();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		if( countMessageOccurences ) {
+			Console.println("Message statistics:");
+			Console.println(typeCounter.toString().replace(" ", StringTools.ENDLINE).replaceAll("[\\{\\}]",""));
+		}
+	}
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/LogPreprocessor.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/LogPreprocessor.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/LogPreprocessor.java	(revision 1)
@@ -0,0 +1,127 @@
+package de.ugoe.cs.eventbench;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.commons.codec.binary.Base64;
+
+import de.ugoe.cs.util.StringTools;
+import de.ugoe.cs.util.console.Console;
+
+public class LogPreprocessor {
+	
+	private boolean sessionOpen = false;
+	private boolean msgIncomplete = false;
+	
+	private boolean base64;
+	
+	public LogPreprocessor() {
+		this(false);
+	}
+	
+	public LogPreprocessor(boolean base64) {
+		this.base64 = base64;
+	}
+	
+	public void convertToXml(String source, String target) throws IOException, FileNotFoundException {
+		FileWriter targetFile = new FileWriter(target);
+		targetFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + StringTools.ENDLINE);
+		targetFile.write("<log>" + StringTools.ENDLINE);
+		processFile(source, targetFile);
+		if( sessionOpen ) {
+			targetFile.write(" </session>" + StringTools.ENDLINE);
+		}
+		targetFile.write("</log>");
+		targetFile.close();
+	}
+	
+	
+	public void convertDirToXml(String path, String target) throws IOException, FileNotFoundException {
+		FileWriter targetFile = new FileWriter(target);
+		targetFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + StringTools.ENDLINE);
+		targetFile.write("<log>" + StringTools.ENDLINE);
+		File folder = new File(path);
+		if( !folder.isDirectory() ) {
+			throw new IOException(path + " is not a directory");
+		}
+		String absolutPath = folder.getAbsolutePath();
+		for( String filename : folder.list() ) {
+			String source = absolutPath + "/" + filename;
+			Console.traceln("Processing file: " + source);
+			processFile(source, targetFile);
+		}
+		
+		if( sessionOpen ) {
+			targetFile.write(" </session>" + StringTools.ENDLINE);
+		}
+		targetFile.write("</log>");
+		targetFile.close();
+	}
+
+	private void processFile(String source, FileWriter targetFile)
+			throws FileNotFoundException, IOException {
+		File f = new File(source);
+		FileReader reader = new FileReader(f);
+		char[] buffer = new char[(int) f.length()];
+		reader.read(buffer);
+		reader.close();
+		String[] lines = (new String(buffer)).split("\n");
+		String incompleteLine = "";
+		// Open source and read line by line
+		for( String currentLine : lines ) {
+			if( currentLine.contains("UL: <session>")) {
+				if( sessionOpen) {
+					targetFile.write(" </session>" + StringTools.ENDLINE);
+					targetFile.write(" <session>" + StringTools.ENDLINE);
+				} else {
+					targetFile.write(" <session>" + StringTools.ENDLINE);
+					sessionOpen = true;
+				}
+			} else if( currentLine.contains("UL: </session>")) {
+				if( sessionOpen) {
+					targetFile.write(" </session>" + StringTools.ENDLINE);
+					sessionOpen = false;
+				}
+			} else if( msgIncomplete || currentLine.contains("UL: ")) {
+				
+				String currentContent;
+				String actualLine;
+				if( msgIncomplete ) {
+					actualLine = currentLine;
+				} else {
+					String[] splitResult = currentLine.split("UL: ");
+					actualLine = splitResult[1];
+				}
+				if( base64 ) {
+					Base64 decoder = new Base64();
+					byte[] decoded = decoder.decode(actualLine);
+					currentContent = new String(decoded, "UTF-16LE");
+					currentContent = currentContent.substring(0, currentContent.length()-1);
+				} else {
+					currentContent = actualLine;
+				}
+				if( msgIncomplete ) {
+					incompleteLine += currentContent;
+					if( incompleteLine.contains("</msg>") ) {
+						msgIncomplete = false;
+						targetFile.write(incompleteLine + StringTools.ENDLINE);
+						incompleteLine = "";
+					}
+				} else {
+					if( currentContent.contains("<msg") && sessionOpen ) {
+						if( currentContent.contains("</msg>") ) {
+							targetFile.write("  " + currentContent + StringTools.ENDLINE);
+						} else {
+							msgIncomplete = true;
+							incompleteLine += currentContent;
+						}
+					}
+				}
+			}
+		}
+	}
+
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/ReplayGenerator.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/ReplayGenerator.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/ReplayGenerator.java	(revision 1)
@@ -2,8 +2,6 @@
 
 import java.io.File;
-import java.io.FileOutputStream;
+import java.io.FileWriter;
 import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.Collection;
 import java.util.List;
 
@@ -13,57 +11,35 @@
 import de.ugoe.cs.util.console.Console;
 
-/**
- * <p>
- * This class provides the functionality to generate replay files from sequences
- * if {@link ReplayableEvent}s.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
 public class ReplayGenerator {
+		
+	public void createLogfileMultipleSessions(List<List<ReplayableEvent<?>>> sequences, String filename) {
+		FileWriter writer = openReplayFile(filename);
+		if( writer!=null ) {		
+			try {
+				writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + StringTools.ENDLINE);
+				writer.write("<log>" + StringTools.ENDLINE);
 
-	/**
-	 * <p>
-	 * {@link IReplayDecorator} to be used. If this field is {@code null}, no
-	 * decorator is used. Default: {@code null}
-	 * </p>
-	 */
-	private IReplayDecorator decorator = null;
-
-	/**
-	 * <p>
-	 * Id of the current session. The starting id is 1.
-	 * </p>
-	 */
-	int sessionId = 1;
-
-	/**
-	 * <p>
-	 * Creates a replay file that contains multiple event sequences.
-	 * </p>
-	 * 
-	 * @param sequences
-	 *            collection of event sequences from which the sessions are
-	 *            generated
-	 * @param filename
-	 *            name and path of the replay file
-	 */
-	public void createLogfileMultipleSessions(
-			Collection<List<ReplayableEvent<?>>> sequences, String filename) {
-		OutputStreamWriter writer = openReplayFile(filename);
-		if (writer != null) {
-			try {
-				decorator = sequences.iterator().next().get(0).getReplayDecorator();
-				if (decorator != null) {
-					writer.write(decorator.getHeader());
-				}
-				for (List<ReplayableEvent<?>> actions : sequences) {
+				for( List<ReplayableEvent<?>> actions : sequences ) {
 					writeSession(actions, writer);
 				}
-				if (decorator != null) {
-					writer.write(decorator.getFooter());
-				}
-				decorator = null;
+				
+				writer.write("</log>" + StringTools.ENDLINE);
+				writer.close();
+			} catch (IOException e) {
+				Console.printerrln("Unable to write replay file " + filename);
+			}
+		}
+	}
+	
+	public void createLogfileSingleSession(List<ReplayableEvent<?>> actions, String filename) {
+		FileWriter writer = openReplayFile(filename);
+		if( writer!=null ) {		
+			try {
+				writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + StringTools.ENDLINE);
+				writer.write("<log>" + StringTools.ENDLINE);
+	
+				writeSession(actions, writer);
+				
+				writer.write("</log>" + StringTools.ENDLINE);
 				writer.close();
 			} catch (IOException e) {
@@ -73,50 +49,10 @@
 	}
 
-	/**
-	 * <p>
-	 * Creates a replay file that from a single event sequence.
-	 * </p>
-	 * 
-	 * @param actions
-	 *            event sequence from which the sessions are generated
-	 * @param filename
-	 *            name and path of the replay file
-	 */
-	public void createLogfileSingleSession(List<ReplayableEvent<?>> actions,
-			String filename) {
-		OutputStreamWriter writer = openReplayFile(filename);
-		if (writer != null) {
-			try {
-				actions.get(0).getReplayDecorator();
-				if (decorator != null) {
-					writer.write(decorator.getHeader());
-				}
-				writeSession(actions, writer);
-				if (decorator != null) {
-					writer.write(decorator.getFooter());
-				}
-				decorator = null;
-				writer.close();
-			} catch (IOException e) {
-				Console.printerrln("Unable to write replay file " + filename);
-			}
-		}
-	}
-
-	/**
-	 * <p>
-	 * Helper function that opens the replay file for writing.
-	 * </p>
-	 * 
-	 * @param filename
-	 *            name and path of the replay file
-	 * @return {@link OutputStreamWriter} that writes to the replay file
-	 */
-	private OutputStreamWriter openReplayFile(String filename) {
+	private FileWriter openReplayFile(String filename) {
 		File file = new File(filename);
 		boolean fileCreated;
 		try {
 			fileCreated = file.createNewFile();
-			if (!fileCreated) {
+			if( !fileCreated ) {
 				Console.traceln("Created logfile " + filename);
 			} else {
@@ -125,48 +61,27 @@
 		} catch (IOException e) {
 			Console.printerrln("Unable to create file " + filename);
-			Console.logException(e);
+			Console.printStacktrace(e);
 		}
-		OutputStreamWriter writer = null;
+		FileWriter writer = null;
 		try {
-			writer = new OutputStreamWriter(new FileOutputStream(file),
-					"UTF-16");
+			writer = new FileWriter(file);
 		} catch (IOException e) {
-			Console.printerrln("Unable to open file for writing (read-only file):"
-					+ filename);
-			Console.logException(e);
+			Console.printerrln("Unable to open file for writing (read-only file):" + filename);
+			Console.printStacktrace(e);
 		}
 		return writer;
 	}
-
-	/**
-	 * <p>
-	 * Helper function that adds an event sequence to the replay.
-	 * </p>
-	 * 
-	 * @param actions
-	 *            event sequences to be added
-	 * @param writer
-	 *            {@link OutputStreamWriter} to which the replay is added
-	 * @throws IOException
-	 *             thrown if there is a problem writing to writer
-	 */
-	private void writeSession(List<ReplayableEvent<?>> actions,
-			OutputStreamWriter writer) throws IOException {
-		if (decorator != null) {
-			writer.write(decorator.getSessionHeader(sessionId));
-		}
-		for (ReplayableEvent<?> currentAction : actions) {
-
-			List<? extends IReplayable> replayables = currentAction
-					.getReplayMessages();
-			for (IReplayable replayble : replayables) {
-				writer.write(replayble.getReplay() + StringTools.ENDLINE);
-				writer.flush();
+	
+	private void writeSession(List<ReplayableEvent<?>> actions, FileWriter writer)
+			throws IOException {
+		writer.write(" <session>" + StringTools.ENDLINE);
+		for( ReplayableEvent<?> currentAction : actions ) {
+			
+			List<? extends IReplayable> replayables = currentAction.getReplayMessages();
+			for( IReplayable replayble : replayables ) {
+				writer.write(replayble.getReplayXml()+StringTools.ENDLINE);
 			}
 		}
-		if (decorator != null) {
-			writer.write(decorator.getSessionFooter(sessionId));
-		}
-		sessionId++;
+		writer.write(" </session>" + StringTools.ENDLINE);
 	}
 
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/Runner.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/Runner.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/Runner.java	(revision 1)
@@ -1,108 +1,16 @@
 package de.ugoe.cs.eventbench;
 
-import java.io.IOException;
-import java.util.List;
-
-import joptsimple.OptionException;
-import joptsimple.OptionParser;
-import joptsimple.OptionSet;
-import joptsimple.OptionSpec;
-import de.ugoe.cs.eventbench.log4j.Log4JLogger;
-import de.ugoe.cs.eventbench.swt.MainWindow;
 import de.ugoe.cs.util.console.CommandExecuter;
-import de.ugoe.cs.util.console.Console;
 import de.ugoe.cs.util.console.TextConsole;
 
-/**
- * <p>
- * Start-up class of the application.
- * </p>
- * <p>
- * It sets up and starts the {@link Console}.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
 public class Runner {
 
-	public enum UITYPE {
-		text, swt
-	};
-	
-	public enum LOG4JTYPE {
-		enable, disable
-	}
-
 	/**
-	 * <p>
-	 * Main method of the application.
-	 * </p>
-	 * 
 	 * @param args
-	 *            if parameters are defined, they are interpreted as commands
-	 *            for the {@link Console} and executed before the user can use
-	 *            the console; can be used to perform batch operations
 	 */
 	public static void main(String[] args) {
-		CommandExecuter.getInstance().addCommandPackage(
-				"de.ugoe.cs.eventbench.commands");
-		CommandExecuter.getInstance().addCommandPackage(
-				"de.ugoe.cs.eventbench.windows.commands");
-		CommandExecuter.getInstance().addCommandPackage(
-				"de.ugoe.cs.eventbench.web.commands");
-		CommandExecuter.getInstance().addCommandPackage(
-				"de.ugoe.cs.eventbench.efg.commands");
-		CommandExecuter.getInstance().addCommandPackage(
-				"de.ugoe.cs.eventbench.jfc.commands");
-		//new Log4JLogger();
-
-		OptionParser parser = new OptionParser();
-		OptionSpec<LOG4JTYPE> log4j = parser.accepts("log4j", "Allowed values: enable, disable").withRequiredArg()
-				.ofType(LOG4JTYPE.class).defaultsTo(LOG4JTYPE.enable);
-		OptionSpec<UITYPE> ui = parser.accepts("ui", "Allowed values: text, swt").withRequiredArg()
-				.ofType(UITYPE.class).defaultsTo(UITYPE.text);
-		OptionSpec<LOG4JTYPE> trace = parser.accepts("trace", "Allowed values: enable, disable").withRequiredArg().ofType(LOG4JTYPE.class).defaultsTo(LOG4JTYPE.enable);
-		OptionSet options = parser.parse(args);
-
-		List<String> startupCommands = options.nonOptionArguments();
-		try {
-			switch (options.valueOf(log4j)) {
-			case enable:
-				new Log4JLogger();
-				break;
-			case disable:
-				// do nothing
-				break;
-			default:
-				throw new AssertionError("reached source code that should be unreachable");
-			}
-			
-			switch (options.valueOf(ui)) {
-			case text:
-				TextConsole textConsole = new TextConsole();
-				if( options.valueOf(trace)==LOG4JTYPE.disable ) {
-					textConsole.setDebug(false);
-				}
-				for (String command : startupCommands) {
-					CommandExecuter.getInstance().exec(command);
-				}
-				textConsole.run(true);
-				break;
-			case swt:
-				MainWindow mainWindow = new MainWindow(startupCommands);
-				mainWindow.open();
-				break;
-			default:
-				throw new AssertionError("reached source code that should be unreachable");
-			}
-		} catch (OptionException e) {
-			System.err.println("Invalid Parameters: " + e.getMessage());
-			try {
-				parser.printHelpOn(System.out);
-			} catch (IOException e1) {
-				// ignore exception.
-			}
-		}
+		CommandExecuter.getInstance().addCommandPackage("de.ugoe.cs.eventbench.commands");
+		TextConsole textConsole = new TextConsole();
+		textConsole.run(true);
 	}
 
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/SequenceSplitter.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/SequenceSplitter.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/SequenceSplitter.java	(revision 1)
@@ -0,0 +1,155 @@
+package de.ugoe.cs.eventbench;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import de.ugoe.cs.eventbench.data.Event;
+import de.ugoe.cs.eventbench.data.WindowsMessage;
+import de.ugoe.cs.eventbench.windowsdefs.MessageDefs;
+import de.ugoe.cs.util.console.Console;
+
+public class SequenceSplitter {
+
+	private List<WindowsMessage> currentSequence;
+	
+	private int openDowns;
+	
+	private boolean initMessages;
+	
+	private EventGenerator tokenGenerator;
+	
+	private List<Event<WindowsMessage>> actionSequence;
+	
+	public SequenceSplitter() {
+		currentSequence = new LinkedList<WindowsMessage>();
+		openDowns = 0;
+		initMessages = true;
+		tokenGenerator = new EventGenerator();
+		actionSequence = new LinkedList<Event<WindowsMessage>>();
+	}
+	
+	public void addMessage(WindowsMessage msg) {
+		if( startOfSequence(msg) ) {
+			if( !initMessages ) {
+				Event<WindowsMessage> currentAction = tokenGenerator.generateEvent(currentSequence);
+				if( currentAction!=null ) {
+					actionSequence.add(currentAction);
+				}
+				if( isKeyMessage(msg.getType()) && openDowns>0 ) {
+					Console.traceln("Key message found with open down mouse messages - will probabably result in a faulty sequence.");
+				}
+			} else {
+				initMessages = false;
+			}
+			currentSequence = new LinkedList<WindowsMessage>();
+		} 
+		if( isUpMessage(msg.getType()) ) {
+			if( openDowns>0 ) { 
+				openDowns--;
+			}
+		}
+		currentSequence.add(msg);
+	}
+	
+	public List<Event<WindowsMessage>> getSequence() {
+		return actionSequence;
+	}
+	
+	public void endSession() {
+		Event<WindowsMessage> currentAction = tokenGenerator.generateEvent(currentSequence);
+		if( currentAction!=null ) {
+			actionSequence.add(currentAction);
+		}
+	}
+
+	private boolean startOfSequence(WindowsMessage msg) {
+		boolean isStart = false;
+		int msgType = msg.getType();
+		if( isKeyMessage(msgType) ) {
+			isStart = true;
+		}
+		if( isDownMessage(msgType) ) {
+			openDowns++;
+			if( openDowns==1 ) {
+				isStart = true;
+			}
+		}
+		if( isDblclkMessage(msgType) ) {
+			openDowns++;
+		}
+		return isStart;
+	}
+
+	private boolean isKeyMessage(int msgType) {
+		boolean isKeyMsg = false;
+		switch (msgType) {
+			case MessageDefs.WM_KEYDOWN:
+			case MessageDefs.WM_KEYUP:
+			case MessageDefs.WM_SYSKEYDOWN:
+			case MessageDefs.WM_SYSKEYUP:
+				isKeyMsg = true;
+				break;
+			default:
+					break;
+		}
+		return isKeyMsg;
+	}
+	
+	private boolean isDownMessage(int msgType) {
+		boolean isDownMsg = false;
+		switch (msgType) {
+			case MessageDefs.WM_LBUTTONDOWN:
+			case MessageDefs.WM_RBUTTONDOWN:
+			case MessageDefs.WM_MBUTTONDOWN:
+			case MessageDefs.WM_XBUTTONDOWN:
+			case MessageDefs.WM_NCLBUTTONDOWN:
+			case MessageDefs.WM_NCRBUTTONDOWN:
+			case MessageDefs.WM_NCMBUTTONDOWN:
+			case MessageDefs.WM_NCXBUTTONDOWN:
+				isDownMsg = true;
+				break;
+			default:
+				break;
+		}
+		return isDownMsg;
+	}
+
+	private boolean isDblclkMessage(int msgType) {
+		boolean isDblclkMsg = false;
+		switch (msgType) {
+			case MessageDefs.WM_LBUTTONDBLCLK:
+			case MessageDefs.WM_RBUTTONDBLCLK:
+			case MessageDefs.WM_MBUTTONDBLCLK:
+			case MessageDefs.WM_XBUTTONDBLCLK:
+			case MessageDefs.WM_NCLBUTTONDBLCLK:
+			case MessageDefs.WM_NCRBUTTONDBLCLK:
+			case MessageDefs.WM_NCMBUTTONDBLCLK:
+			case MessageDefs.WM_NCXBUTTONDBLCLK:
+				isDblclkMsg = true;
+				break;
+			default:
+				break;
+		}
+		return isDblclkMsg;
+	}
+	
+	private boolean isUpMessage(int msgType) {
+		boolean isUpMsg = false;
+		switch (msgType) {
+			case MessageDefs.WM_LBUTTONUP:
+			case MessageDefs.WM_RBUTTONUP:
+			case MessageDefs.WM_MBUTTONUP:
+			case MessageDefs.WM_XBUTTONUP:
+			case MessageDefs.WM_NCLBUTTONUP:
+			case MessageDefs.WM_NCRBUTTONUP:
+			case MessageDefs.WM_NCMBUTTONUP:
+			case MessageDefs.WM_NCXBUTTONUP:
+				isUpMsg = true;
+				break;
+			default:
+				break;
+		}
+		return isUpMsg;
+	}
+	
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/AbstractTrainCommand.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/AbstractTrainCommand.java	(revision 425)
+++ 	(revision )
@@ -1,93 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.Collection;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.SequenceInstanceOf;
-import de.ugoe.cs.eventbench.data.Event;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.TrieBasedModel;
-import de.ugoe.cs.util.console.Command;
-
-/**
- * <p>
- * Abstract class for commands to train {@link TrieBasedModel}s.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public abstract class AbstractTrainCommand implements Command {
-
-	/**
-	 * <p>
-	 * Handling of additional parameters.
-	 * </p>
-	 * 
-	 * @param parameters
-	 *            same as the parameters passed to {@link #run(List)}.
-	 * @throws Exception
-	 *             thrown, if there is an error parsing the parameters
-	 */
-	abstract void handleAdditionalParameters(List<Object> parameters)
-			throws Exception;
-
-	/**
-	 * <p>
-	 * Returns a concrete instance of {@link TrieBasedModel} to be trained. This
-	 * is a factory method.
-	 * </p>
-	 * 
-	 * @return instance of {@link TrieBasedModel}
-	 */
-	abstract TrieBasedModel createModel();
-
-	/**
-	 * <p>
-	 * The command is implemented as a template method. The general structure of
-	 * the command is always the same, only the parameters of the command and
-	 * the creation of the {@link TrieBasedModel} instance. The former is
-	 * handled by {@link #handleAdditionalParameters(List)}, the latter by
-	 * {@link #createModel()}.
-	 * </p>
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		String sequencesName;
-
-		try {
-			modelname = (String) parameters.get(0);
-			sequencesName = (String) parameters.get(1);
-			handleAdditionalParameters(parameters);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance().getData(
-				sequencesName);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(sequencesName);
-			return;
-		}
-		if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) {
-			CommandHelpers.objectNotType(sequencesName,
-					"Collection<List<Event<?>>>");
-			return;
-		}
-		Collection<List<? extends Event<?>>> sequences = (Collection<List<? extends Event<?>>>) dataObject;
-
-		TrieBasedModel model = createModel();
-		model.train(sequences);
-		if (GlobalDataContainer.getInstance().addData(modelname, model)) {
-			CommandHelpers.dataOverwritten(modelname);
-		}
-
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDcalcCoverage.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDcalcCoverage.java	(revision 425)
+++ 	(revision )
@@ -1,141 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.Collection;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.SequenceInstanceOf;
-import de.ugoe.cs.eventbench.coverage.CoverageCalculatorObserved;
-import de.ugoe.cs.eventbench.coverage.CoverageCalculatorProcess;
-import de.ugoe.cs.eventbench.data.Event;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to calculate the coverage of a test suite.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDcalcCoverage implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		String observedName;
-		String[] sequenceNames;
-		int minLength;
-		int maxLength;
-		try {
-			modelname = (String) parameters.get(0);
-			observedName = (String) parameters.get(1);
-			sequenceNames = (String[]) parameters.get(2);
-			minLength = Integer.parseInt((String) parameters.get(3));
-			maxLength = Integer.parseInt((String) parameters.get(4));
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		IStochasticProcess process = null;
-		Collection<List<? extends Event<?>>> observedSequences = null;
-		Collection<List<? extends Event<?>>> sequences = null;
-		Object dataObjectProcess = GlobalDataContainer.getInstance().getData(
-				modelname);
-		Object dataObjectObserved = GlobalDataContainer.getInstance().getData(
-				observedName);
-		if (dataObjectProcess == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		}
-		if (!(dataObjectProcess instanceof IStochasticProcess)) {
-			CommandHelpers.objectNotType(modelname, "IStochasticProcess");
-			return;
-		}
-		if (dataObjectObserved == null) {
-			CommandHelpers.objectNotFoundMessage(observedName);
-			return;
-		}
-		if (!SequenceInstanceOf.isCollectionOfSequences(dataObjectObserved)) {
-			CommandHelpers.objectNotType(observedName,
-					"Collection<List<Event<?>>>");
-			return;
-		}
-		process = (IStochasticProcess) dataObjectProcess;
-		observedSequences = (Collection<List<? extends Event<?>>>) dataObjectObserved;
-
-		Console.print("seqName");
-		for (int length = minLength; length <= maxLength; length++) {
-			Console.print(";numObs_" + length);
-			Console.print(";numCov_" + length);
-			Console.print(";numNew_" + length);
-			Console.print(";numPos_" + length);
-			Console.print(";all_" + length);
-			Console.print(";pos_" + length);
-			Console.print(";poswei_" + length);
-			Console.print(";obs_" + length);
-			Console.print(";obswei_" + length);
-			Console.print(";new_" + length);
-			Console.print(";newpos_" + length);
-			Console.print(";newposwei_" + length);
-		}
-		Console.println("");
-		for (String sequenceName : sequenceNames) {
-			Object dataObjectSequences = GlobalDataContainer.getInstance()
-					.getData(sequenceName);
-			if (dataObjectSequences == null) {
-				CommandHelpers.objectNotFoundMessage(sequenceName);
-				return;
-			} else if (!SequenceInstanceOf
-					.isCollectionOfSequences(dataObjectSequences)) {
-				CommandHelpers.objectNotType(sequenceName,
-						"Collection<List<Event<?>>>");
-				return;
-			}
-			sequences = (Collection<List<? extends Event<?>>>) dataObjectSequences;
-			Console.print(sequenceName);
-			for (int length = minLength; length <= maxLength; length++) {
-				CoverageCalculatorProcess covCalcProc = new CoverageCalculatorProcess(
-						process, sequences, length);
-				CoverageCalculatorObserved covCalcObs = new CoverageCalculatorObserved(
-						observedSequences, sequences, length);
-				Console.print(";" + covCalcObs.getNumObserved());
-				Console.print(";" + covCalcObs.getNumCovered());
-				Console.print(";" + covCalcObs.getNumNew());
-				Console.print(";" + covCalcProc.getNumPossible());
-				Console.print(";" + covCalcProc.getCoverageAllNoWeight());
-				Console.print(";" + covCalcProc.getCoveragePossibleNoWeight());
-				Console.print(";" + covCalcProc.getCoveragePossibleWeight());
-				Console.print(";" + covCalcObs.getCoverageObserved());
-				Console.print(";"
-						+ covCalcObs.getCoverageObservedWeigth(process));
-				Console.print(";" + covCalcObs.getNewPercentage());
-				Console.print(";" + covCalcObs.getCoveragePossibleNew(process));
-				Console.print(";"
-						+ covCalcObs.getCoveragePossibleNewWeight(process));
-			}
-			Console.println("");
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: calcCoverage <modelname> <observedSequences> [sequenceNames] <minCovLength> <maxCovLength>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDcalcEntropy.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDcalcEntropy.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDcalcEntropy.java	(revision 1)
@@ -1,28 +1,14 @@
 package de.ugoe.cs.eventbench.commands;
-
 import java.security.InvalidParameterException;
 import java.util.List;
 
-import de.ugoe.cs.eventbench.CommandHelpers;
 import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel;
+import de.ugoe.cs.eventbench.markov.MarkovModel;
 import de.ugoe.cs.util.console.Command;
 import de.ugoe.cs.util.console.Console;
 
-/**
- * <p>
- * Command to calculate the entropy of first-order Markov models.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
+
 public class CMDcalcEntropy implements Command {
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
 	@Override
 	public void help() {
@@ -30,9 +16,4 @@
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
 	@Override
 	public void run(List<Object> parameters) {
@@ -43,20 +24,18 @@
 			throw new InvalidParameterException();
 		}
-
-		FirstOrderMarkovModel model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
+		
+		MarkovModel model = null; 
+		Object dataObject = GlobalDataContainer.getInstance().getData(modelname);
+		if( dataObject==null ) {
+			Console.println("Model " + modelname + "not found in storage.");
 		}
-		if (!(dataObject instanceof FirstOrderMarkovModel)) {
-			CommandHelpers.objectNotType(modelname, "FirstOrderMarkovModel");
-			return;
-		}
-		model = (FirstOrderMarkovModel) dataObject;
-		double entropy = model.calcEntropy();
-		if (!Double.isNaN(entropy)) {
-			Console.println("entropy: " + entropy);
+		else if( !(dataObject instanceof MarkovModel) ) {
+			Console.println("Object " + modelname + " is not a markov model!");
+		} else {
+			model = (MarkovModel) dataObject;
+			double entropy = model.calcEntropy();
+			if( Double.isNaN(entropy) ) {
+				Console.println("entropy: " + entropy);
+			}
 		}
 	}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDconvertDirToXml.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDconvertDirToXml.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDconvertDirToXml.java	(revision 1)
@@ -0,0 +1,41 @@
+package de.ugoe.cs.eventbench.commands;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.security.InvalidParameterException;
+import java.util.List;
+
+import de.ugoe.cs.eventbench.LogPreprocessor;
+import de.ugoe.cs.util.console.Command;
+import de.ugoe.cs.util.console.Console;
+
+public class CMDconvertDirToXml implements Command {
+
+	@Override
+	public void help() {
+		Console.println("Usage: convertToXml <sourceFolder> <targetFile> {<base64>}");
+	}
+
+	@Override
+	public void run(List<Object> parameters) {
+		if( parameters.size() < 2 ) {
+			throw new InvalidParameterException();
+		}
+		String path = (String) parameters.get(0);
+		String target = (String) parameters.get(1);
+		boolean base64 = false;
+		if( parameters.size() == 3 ) {
+			base64 = Boolean.parseBoolean((String) parameters.get(2));
+		}
+		
+		try {
+			new LogPreprocessor(base64).convertDirToXml(path, target);
+		} catch (FileNotFoundException e) {
+			Console.println(e.getMessage());
+		} catch (IOException e) {
+			Console.println(e.getMessage());
+		}
+		
+	}
+
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDconvertToXml.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDconvertToXml.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDconvertToXml.java	(revision 1)
@@ -0,0 +1,41 @@
+package de.ugoe.cs.eventbench.commands;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.security.InvalidParameterException;
+import java.util.List;
+
+import de.ugoe.cs.eventbench.LogPreprocessor;
+import de.ugoe.cs.util.console.Command;
+import de.ugoe.cs.util.console.Console;
+
+public class CMDconvertToXml implements Command {
+
+	@Override
+	public void help() {
+		Console.println("Usage: convertToXml <sourceFile> <targetFile> {<base64>}");
+	}
+
+	@Override
+	public void run(List<Object> parameters) {
+		if( parameters.size() < 2 ) {
+			throw new InvalidParameterException();
+		}
+		String source = (String) parameters.get(0);
+		String target = (String) parameters.get(1);
+		boolean base64 = false;
+		if( parameters.size() == 3 ) {
+			base64 = Boolean.parseBoolean((String) parameters.get(2));
+		}
+		
+		try {
+			new LogPreprocessor(base64).convertToXml(source, target);
+		} catch (FileNotFoundException e) {
+			Console.println(e.getMessage());
+		} catch (IOException e) {
+			Console.println(e.getMessage());
+		}
+		
+	}
+
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDdeleteObject.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDdeleteObject.java	(revision 425)
+++ 	(revision )
@@ -1,50 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to delete object from {@link GlobalDataContainer}.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDdeleteObject implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: deleteObject <objectname>");
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String objectName;
-		try {
-			objectName = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-		boolean deleted = GlobalDataContainer.getInstance().removeData(
-				objectName);
-		if (!deleted) {
-			CommandHelpers.objectNotFoundMessage(objectName);
-		}
-	}
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDflattenModel.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDflattenModel.java	(revision 425)
+++ 	(revision )
@@ -1,72 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel;
-import de.ugoe.cs.eventbench.models.HighOrderMarkovModel;
-import de.ugoe.cs.eventbench.models.ModelFlattener;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to flatten high-order models and create first-order markov models
- * with the same stochastic properties.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDflattenModel implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		String modelnameFOM;
-
-		try {
-			modelname = (String) parameters.get(0);
-			modelnameFOM = (String) parameters.get(1);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		}
-		if (!(dataObject instanceof HighOrderMarkovModel)) {
-			CommandHelpers.objectNotType(modelname, "HighOrderMarkovModel");
-			return;
-		}
-
-		HighOrderMarkovModel model = (HighOrderMarkovModel) dataObject;
-		ModelFlattener flattener = new ModelFlattener();
-		FirstOrderMarkovModel modelFOM = flattener
-				.flattenHighOrderMarkovModel(model);
-
-		if (GlobalDataContainer.getInstance().addData(modelnameFOM, modelFOM)) {
-			CommandHelpers.dataOverwritten(modelnameFOM);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: flattenModel <modelname> <modelname_flattened>");
-	}
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateFixedLengthSequences.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateFixedLengthSequences.java	(revision 425)
+++ 	(revision )
@@ -1,133 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.Event;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to generate all sequences of a given length.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDgenerateFixedLengthSequences implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		String sequencesName;
-		int minLength;
-		int maxLength;
-		boolean all = true;
-		int numSequences = -1;
-		boolean validEnd = true;
-		try {
-			modelname = (String) parameters.get(0);
-			sequencesName = (String) parameters.get(1);
-			minLength = Integer.parseInt((String) parameters.get(2));
-			maxLength = Integer.parseInt((String) parameters.get(3));
-			if (parameters.size() >= 5) {
-				all = Boolean.parseBoolean((String) parameters.get(4));
-			}
-			if (parameters.size() >= 6) {
-				numSequences = Integer.parseInt((String) parameters.get(5));
-			}
-			if (parameters.size() >= 7) {
-				validEnd = Boolean.parseBoolean((String) parameters.get(6));
-			}
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		IStochasticProcess model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		} else if (!(dataObject instanceof IStochasticProcess)) {
-			CommandHelpers.objectNotType(modelname, "IStochasticProcess");
-			return;
-		}
-		model = (IStochasticProcess) dataObject;
-		Collection<List<? extends Event<?>>> sequences = new LinkedHashSet<List<? extends Event<?>>>();
-		for (int length = minLength; length <= maxLength; length++) {
-			if( validEnd ) {
-				sequences.addAll(model.generateValidSequences(length + 2));
-			} else {
-				sequences.addAll(model.generateSequences(length + 1, true));
-			}
-		}
-		Console.traceln("" + sequences.size() + " possible");
-		if (!all && numSequences < sequences.size()) {
-			List<Double> probabilities = new ArrayList<Double>(sequences.size());
-			double probSum = 0.0;
-			for (List<? extends Event<?>> sequence : sequences) {
-				double prob = model.getProbability(sequence);
-				probabilities.add(prob);
-				probSum += prob;
-			}
-			Set<Integer> drawnSequences = new HashSet<Integer>(numSequences);
-			Random r = new Random();
-			while (drawnSequences.size() < numSequences) {
-				double randVal = r.nextDouble() * probSum;
-				double sum = 0.0d;
-				int index = -1;
-				while (sum < randVal) {
-					index++;
-					double currentProb = probabilities.get(index);
-					sum += currentProb;
-				}
-				if (!drawnSequences.contains(index)) {
-					drawnSequences.add(index);
-					probSum -= probabilities.get(index);
-					probabilities.set(index, 0.0d);
-				}
-			}
-			Collection<List<? extends Event<?>>> retainedSequences = new LinkedList<List<? extends Event<?>>>();
-			int index = 0;
-			for (List<? extends Event<?>> sequence : sequences) {
-				if (drawnSequences.contains(index)) {
-					retainedSequences.add(sequence);
-				}
-				index++;
-			}
-			sequences = retainedSequences;
-		}
-		if (GlobalDataContainer.getInstance().addData(sequencesName, sequences)) {
-			CommandHelpers.dataOverwritten(sequencesName);
-		}
-		Console.println("" + sequences.size() + " sequences generated");
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: generateFixedLengthSequences <modelname> <sequencesName> <minlenght> <maxlength> {<all>} {<numSequences>} {<validEnd>}");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateGreedy.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateGreedy.java	(revision 425)
+++ 	(revision )
@@ -1,179 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.coverage.SequenceTools;
-import de.ugoe.cs.eventbench.data.Event;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
-import de.ugoe.cs.util.ArrayTools;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to generate test suite with a greedy strategy to achieve a desired
- * coverage.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDgenerateGreedy implements Command {
-
-	/**
-	 * <p>
-	 * Tolerance for double comparisons
-	 * </p>
-	 */
-	final static double eps = 0.000000000001;
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		String sequencesName;
-		int minLength;
-		int maxLength;
-		int coverageDepth;
-		float desiredCoverage;
-		boolean validEnd = true;
-		try {
-			modelname = (String) parameters.get(0);
-			sequencesName = (String) parameters.get(1);
-			minLength = Integer.parseInt((String) parameters.get(2));
-			maxLength = Integer.parseInt((String) parameters.get(3));
-			coverageDepth = Integer.parseInt((String) parameters.get(4));
-			desiredCoverage = Float.parseFloat((String) parameters.get(5));
-			if (parameters.size() >= 7) {
-				validEnd = Boolean.parseBoolean((String) parameters.get(6));
-			}
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		IStochasticProcess model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		} else if (!(dataObject instanceof IStochasticProcess)) {
-			CommandHelpers.objectNotType(modelname, "IStochasticProcess");
-			return;
-		}
-		model = (IStochasticProcess) dataObject;
-
-		// set up everything
-		List<List<? extends Event<?>>> allSequences = new LinkedList<List<? extends Event<?>>>();
-		for (int length = minLength; length <= maxLength; length++) {
-			if (validEnd) {
-				allSequences.addAll(model.generateValidSequences(length + 2));
-			} else {
-				allSequences.addAll(model.generateSequences(length + 1, true));
-			}
-		}
-		Console.traceln("" + allSequences.size() + " possible");
-
-		Collection<List<? extends Event<?>>> allSubSeqs = model
-				.generateSequences(coverageDepth);
-		Map<List<? extends Event<?>>, Double> weightMap = SequenceTools
-				.generateWeights(model, allSubSeqs);
-		Set<List<? extends Event<?>>> coveredSubSeqs = new LinkedHashSet<List<? extends Event<?>>>();
-
-		List<Set<List<? extends Event<?>>>> containedSubSeqs = new LinkedList<Set<List<? extends Event<?>>>>();
-		for (List<? extends Event<?>> sequence : allSequences) {
-			List<List<? extends Event<?>>> wrapper = new LinkedList<List<? extends Event<?>>>();
-			wrapper.add(sequence);
-			Set<List<? extends Event<?>>> currentSubSeqs = SequenceTools
-					.containedSubSequences(wrapper, coverageDepth);
-			containedSubSeqs.add(currentSubSeqs);
-		}
-
-		List<List<? extends Event<?>>> testSuite = new LinkedList<List<? extends Event<?>>>();
-		double currentCoverage = 0.0d;
-
-		// Build test suite
-		double prevGain = 1.0d;
-		boolean gainEqual = false;
-		while (currentCoverage < desiredCoverage) {
-			Double[] sequenceGain = new Double[allSequences.size()];
-			int i = 0;
-			for (Set<List<? extends Event<?>>> containedSubSeq : containedSubSeqs) {
-				double gain = 0.0d;
-				Iterator<List<? extends Event<?>>> subSeqIter = containedSubSeq
-						.iterator();
-				while (subSeqIter.hasNext()) {
-					List<? extends Event<?>> subSeq = subSeqIter.next();
-					if (!coveredSubSeqs.contains(subSeq)) {
-						gain += weightMap.get(subSeq);
-					} else {
-						subSeqIter.remove();
-					}
-				}
-				sequenceGain[i] = gain;
-				// optimization using that the gain is monotonically decreasing
-				if (Math.abs(gain - prevGain) <= eps) {
-					gainEqual = true;
-					break;
-				}
-				i++;
-			}
-			int maxIndex;
-			if (gainEqual) {
-				maxIndex = i;
-			} else {
-				maxIndex = ArrayTools.findMax(sequenceGain);
-			}
-			if (maxIndex < 0 || sequenceGain[maxIndex] <= 0.0 + eps) {
-				Console.traceln("No gain anymore! Desired coverage cannot be satisfied!");
-				break;
-			}
-			prevGain = sequenceGain[maxIndex];
-			testSuite.add(allSequences.get(maxIndex));
-			coveredSubSeqs.addAll(containedSubSeqs.get(maxIndex));
-			currentCoverage += sequenceGain[maxIndex];
-			if (gainEqual) {
-				allSequences.remove(maxIndex);
-				containedSubSeqs.remove(maxIndex);
-				gainEqual = false;
-			} else {
-				for (int j = sequenceGain.length - 1; j >= 0; j--) {
-					if (j == maxIndex || sequenceGain[j] <= 0.0 + eps) {
-						allSequences.remove(j);
-						containedSubSeqs.remove(j);
-					}
-				}
-			}
-		}
-
-		if (GlobalDataContainer.getInstance().addData(sequencesName, testSuite)) {
-			CommandHelpers.dataOverwritten(sequencesName);
-		}
-		Console.println("" + testSuite.size() + " sequences generated");
-		Console.println("" + currentCoverage + " coverage achieved");
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("generateGreedy <modelname> <sequencesName> <minLength> <maxLength> <coverageDepth> <desiredCoverage> {<validEnd>}");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateHybrid.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateHybrid.java	(revision 425)
+++ 	(revision )
@@ -1,180 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Random;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.Event;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to generate sequences of a given length.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDgenerateHybrid implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		String sequencesName;
-		int length;
-		int maxLengthAll;
-		int numSequences;
-		boolean validEnd = true;
-		try {
-			modelname = (String) parameters.get(0);
-			sequencesName = (String) parameters.get(1);
-			length = Integer.parseInt((String) parameters.get(2));
-			maxLengthAll = Integer.parseInt((String) parameters.get(3));
-			numSequences = Integer.parseInt((String) parameters.get(4));
-			if (parameters.size() >= 6) {
-				validEnd = Boolean.parseBoolean((String) parameters.get(5));
-			}
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		if (length <= maxLengthAll) {
-			// indirectly call command generateFixedLengthSequences
-			List<Object> parameters2 = new LinkedList<Object>();
-			parameters2.add(modelname);
-			parameters2.add(sequencesName);
-			parameters2.add(Integer.toString(length));
-			parameters2.add(Integer.toString(length));
-			parameters2.add(Boolean.toString(false));
-			parameters2.add(Integer.toString(numSequences));
-			parameters2.add(Boolean.toString(validEnd));
-			CMDgenerateFixedLengthSequences cmd = new CMDgenerateFixedLengthSequences();
-			cmd.run(parameters2);
-			return;
-		}
-
-		IStochasticProcess model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		} else if (!(dataObject instanceof IStochasticProcess)) {
-			CommandHelpers.objectNotType(modelname, "IStochasticProcess");
-			return;
-		}
-		model = (IStochasticProcess) dataObject;
-		Collection<List<? extends Event<?>>> sequences = new LinkedHashSet<List<? extends Event<?>>>();
-
-		List<List<? extends Event<?>>> seqsTmp = new ArrayList<List<? extends Event<?>>>(
-				model.generateSequences(maxLengthAll + 1, true));
-
-		Console.traceln("" + seqsTmp.size() + " of length " + maxLengthAll
-				+ " possible");
-		List<Double> probabilities = new ArrayList<Double>(seqsTmp.size());
-		double probSum = 0.0;
-		for (List<? extends Event<?>> sequence : seqsTmp) {
-			double prob = model.getProbability(sequence);
-			probabilities.add(prob);
-			probSum += prob;
-		}
-
-		Random r = new Random();
-		int j = 0;
-		while (sequences.size() < numSequences && j <= numSequences * 100) {
-			j++;
-			double randVal = r.nextDouble() * probSum;
-			double sum = 0.0d;
-			int index = -1;
-			while (sum < randVal) {
-				index++;
-				double currentProb = probabilities.get(index);
-				sum += currentProb;
-			}
-			List<? extends Event<?>> seqTmp = seqsTmp.get(index);
-			if (!Event.ENDEVENT.equals(seqTmp.get(seqTmp.size() - 1))) {
-				List<? extends Event<?>> sequence;
-				if (validEnd) {
-					sequence = finishSequence(seqTmp, model, length + 2,
-							validEnd);
-					if( sequence!= null && sequence.size()!=length+2 ) {
-						sequence = null;
-					}
-				} else {
-					sequence = finishSequence(seqTmp, model, length + 1,
-							validEnd);
-					if( sequence!= null && sequence.size()!=length+1 ) {
-						sequence = null;
-					}
-				}
-				if( sequence!=null ) {
-					sequences.add(sequence);
-				}
-			}
-		}
-		if (GlobalDataContainer.getInstance().addData(sequencesName, sequences)) {
-			CommandHelpers.dataOverwritten(sequencesName);
-		}
-		Console.println("" + sequences.size() + " sequences generated");
-	}
-
-	public List<? extends Event<?>> finishSequence(
-			List<? extends Event<?>> sequence, IStochasticProcess model,
-			int maxLength, boolean validEnd) {
-		Random r = new Random();
-		boolean endFound = false;
-		List<Event<?>> sequenceCopy = new LinkedList<Event<?>>(sequence);
-		final int maxIter = 30000;
-		int iter = 0;
-		while (!endFound && iter<maxIter) {
-			iter++;
-			sequenceCopy = new LinkedList<Event<?>>(sequence);
-			while (!endFound && sequenceCopy.size() <= maxLength) {
-				double randVal = r.nextDouble();
-				double probSum = 0.0;
-				for (Event<?> symbol : model.getEvents()) {
-					probSum += model.getProbability(sequenceCopy, symbol);
-					if (probSum >= randVal) {
-						if (!(Event.STARTEVENT.equals(symbol) || (!validEnd && Event.ENDEVENT.equals(symbol)))) {
-							// only add the symbol the sequence if it is not
-							// START
-							// or END
-							sequenceCopy.add(symbol);
-						}
-						endFound = Event.ENDEVENT.equals(symbol)
-								|| (!validEnd && sequenceCopy.size() == maxLength);
-						break;
-					}
-				}
-			}
-		}
-		if( iter==maxIter ) {
-			return null;
-		}
-		return sequenceCopy;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: generateHybrid <modelname> <sequencesName> <lenght> <maxlengthAll> <numSequences> {<validEnd>}");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomReplay.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomReplay.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomReplay.java	(revision 1)
@@ -2,31 +2,16 @@
 
 import java.security.InvalidParameterException;
-import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
 
-import de.ugoe.cs.eventbench.CommandHelpers;
 import de.ugoe.cs.eventbench.ReplayGenerator;
 import de.ugoe.cs.eventbench.data.GlobalDataContainer;
 import de.ugoe.cs.eventbench.data.ReplayableEvent;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
+import de.ugoe.cs.eventbench.markov.MarkovModel;
 import de.ugoe.cs.util.console.Command;
 import de.ugoe.cs.util.console.Console;
 
-/**
- * <p>
- * Command to create a replay file with randomly generated sessions.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
 public class CMDgenerateRandomReplay implements Command {
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
 	@Override
 	public void help() {
@@ -34,9 +19,4 @@
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
 	@SuppressWarnings("unchecked")
 	@Override
@@ -48,34 +28,32 @@
 			modelname = (String) parameters.get(0);
 			filename = (String) parameters.get(1);
-			if (parameters.size() < 3) {
+			if( parameters.size()<3 ) {
 				numSessions = Integer.parseInt((String) parameters.get(2));
 			}
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new InvalidParameterException();
 		}
-
-		IStochasticProcess model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
+		
+		MarkovModel model = null; 
+		Object dataObject = GlobalDataContainer.getInstance().getData(modelname);
+		if( dataObject==null ) {
+			Console.println("Model " + modelname + " not found in storage.");
 		}
-		if (!(dataObject instanceof IStochasticProcess)) {
-			CommandHelpers.objectNotType(modelname, "IStochasticProcess");
-			return;
+		else if( !(dataObject instanceof MarkovModel) ) {
+			Console.println("Object " + modelname + " not of type MarkovModel!");
+		} else {
+			model = (MarkovModel) dataObject;
+			List<List<ReplayableEvent<?>>> sequences = new LinkedList<List<ReplayableEvent<?>>>();
+			try {
+				for( int i=0 ; i<numSessions ; i++ ) {
+					sequences.add((List<ReplayableEvent<?>>) model.randomSequence());
+				}
+			} catch (ClassCastException e) {
+				Console.println("Modeled events don't support replay.");
+			}
+			ReplayGenerator generator = new ReplayGenerator();
+			generator.createLogfileMultipleSessions(sequences, filename);
 		}
-		model = (IStochasticProcess) dataObject;
-		Collection<List<ReplayableEvent<?>>> sequences = new LinkedList<List<ReplayableEvent<?>>>();
-		try {
-			for (int i = 0; i < numSessions; i++) {
-				sequences
-						.add((List<ReplayableEvent<?>>) model.randomSequence());
-			}
-		} catch (ClassCastException e) {
-			Console.printerrln("Modeled events don't support replay.");
-		}
-		ReplayGenerator generator = new ReplayGenerator();
-		generator.createLogfileMultipleSessions(sequences, filename);
 	}
 
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomSequences.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomSequences.java	(revision 425)
+++ 	(revision )
@@ -1,105 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.data.Event;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to generate random sessions.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDgenerateRandomSequences implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		String sequencesName;
-		int numSessions;
-		int minLength = 0;
-		int maxLength = Integer.MAX_VALUE;
-		long maxIter;
-		boolean validEnd = true;
-		try {
-			modelname = (String) parameters.get(0);
-			sequencesName = (String) parameters.get(1);
-			numSessions = Integer.parseInt((String) parameters.get(2));
-			minLength = Integer.parseInt((String) parameters.get(3));
-			maxLength = Integer.parseInt((String) parameters.get(4));
-			maxIter = numSessions * 10;
-			if (parameters.size() >= 5) {
-				maxIter = Long.parseLong((String) parameters.get(5));
-			}
-			if (parameters.size() >= 6) {
-				validEnd = Boolean.parseBoolean((String) parameters.get(6));
-			}
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		IStochasticProcess model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		}
-		if (!(dataObject instanceof IStochasticProcess)) {
-			CommandHelpers.objectNotType(modelname, "IStochasticProcess");
-			return;
-		}
-		model = (IStochasticProcess) dataObject;
-		Set<List<? extends Event<?>>> sequences = new HashSet<List<? extends Event<?>>>(
-				numSessions);
-		long numIterations = 0;
-		while (sequences.size() < numSessions && numIterations < maxIter) {
-			List<? extends Event<?>> generatedSequence = model.randomSequence(
-					maxLength, validEnd);
-			if (generatedSequence.size() >= minLength
-					&& generatedSequence.size() <= maxLength) {
-				((List<Event<?>>) generatedSequence).add(0, Event.STARTEVENT);
-				if( validEnd ) {
-					((List<Event<?>>) generatedSequence).add(Event.ENDEVENT);
-				}
-				sequences.add(generatedSequence);
-			}
-			numIterations++;
-		}
-		if (sequences.size() < numSessions) {
-			Console.println("Only " + sequences.size()
-					+ " unique sessions generated after " + maxIter
-					+ " iterations");
-		}
-		if (GlobalDataContainer.getInstance().addData(sequencesName, sequences)) {
-			CommandHelpers.dataOverwritten(sequencesName);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: generateRandomSequenecs <modelName> <sequencesName> <numSessions> <minLength> <maxLength> {<maxIter>} {<validEnd>}");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateReplayfile.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateReplayfile.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateReplayfile.java	(revision 1)
@@ -2,10 +2,8 @@
 
 import java.security.InvalidParameterException;
-import java.util.Collection;
 import java.util.List;
 
-import de.ugoe.cs.eventbench.CommandHelpers;
 import de.ugoe.cs.eventbench.ReplayGenerator;
-import de.ugoe.cs.eventbench.SequenceInstanceOf;
+import de.ugoe.cs.eventbench.data.Event;
 import de.ugoe.cs.eventbench.data.GlobalDataContainer;
 import de.ugoe.cs.eventbench.data.ReplayableEvent;
@@ -13,57 +11,38 @@
 import de.ugoe.cs.util.console.Console;
 
-/**
- * <p>
- * Command to create a replay file from stored sessions.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
 public class CMDgenerateReplayfile implements Command {
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
 	@Override
 	public void help() {
-		Console.println("Usage: generateReplayfile <filename> <sequences>");
+		Console.println("Usage: generateReplayfile <filename>");		
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
 	@SuppressWarnings("unchecked")
 	@Override
 	public void run(List<Object> parameters) {
-		String filename;
-		String sequencesName;
-		try {
-			filename = (String) parameters.get(0);
-			sequencesName = (String) parameters.get(1);
-		} catch (Exception e) {
+		if( parameters.size() < 1 ) {
 			throw new InvalidParameterException();
 		}
-
-		Collection<List<ReplayableEvent<?>>> sequences = null;
-		Object dataObject = GlobalDataContainer.getInstance().getData(
-				sequencesName);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(sequencesName);
-			return;
+		String filename = (String) parameters.get(0);
+		
+		List<List<ReplayableEvent<?>>> sequences = null;
+		Object dataObject = GlobalDataContainer.getInstance().getData("sequences");
+			
+		try {
+			sequences = (List<List<ReplayableEvent<?>>>) dataObject;
+			ReplayGenerator generator = new ReplayGenerator();
+			if( sequences.size()>0 ) {
+				if( sequences.get(0).get(0) instanceof Event ) {
+					generator.createLogfileMultipleSessions(sequences, filename);
+				} else {
+					Console.traceln("Illegal use of \"sequences\" parameter in the GlobalDataContainer.");
+					Console.traceln("The parameter should always be of type List<List<Event>>!");
+				}
+			}
 		}
-		if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) {
-			CommandHelpers.objectNotType(sequencesName,
-					"Collection<List<Event<?>>>");
-			return;
+		catch(ClassCastException e) {
+			Console.printerrln("Sequences need to be loaded first using parseXML");
 		}
-
-		sequences = (Collection<List<ReplayableEvent<?>>>) dataObject;
-		ReplayGenerator generator = new ReplayGenerator();
-		generator.createLogfileMultipleSessions(sequences, filename);
+		
 	}
 
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDlistSymbols.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDlistSymbols.java	(revision 425)
+++ 	(revision )
@@ -1,73 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.Arrays;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to list all events (symbols) known to a usage profile (stochastic
- * process).
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDlistSymbols implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname = "";
-		boolean sort = false;
-		try {
-			modelname = (String) parameters.get(0);
-			if (parameters.size() == 2) {
-				sort = Boolean.parseBoolean((String) parameters.get(1));
-			}
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		IStochasticProcess model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		}
-		if (!(dataObject instanceof IStochasticProcess)) {
-			CommandHelpers.objectNotType(modelname, "IStochasticProcess");
-			return;
-		}
-		model = (IStochasticProcess) dataObject;
-		String[] stateStrings = model.getSymbolStrings();
-		if (sort) {
-			Arrays.sort(stateStrings);
-		}
-		for (String stateString : stateStrings) {
-			Console.println(stateString);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: listStates <modelName> {<sort>}");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDload.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDload.java	(revision 425)
+++ 	(revision )
@@ -1,61 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command that loads a previously serialized {@link GlobalDataContainer}.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDload implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String filename;
-		try {
-			filename = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		FileInputStream fis = null;
-		ObjectInputStream in = null;
-		try {
-			fis = new FileInputStream(filename);
-			in = new ObjectInputStream(fis);
-			in.readObject();
-			in.close();
-		} catch (IOException ex) {
-			Console.logException(ex);
-		} catch (ClassNotFoundException ex) {
-			Console.logException(ex);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: load <filename>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDloadObject.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDloadObject.java	(revision 425)
+++ 	(revision )
@@ -1,69 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to load a previously serialized object and store it in the
- * {@link GlobalDataContainer}.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDloadObject implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String filename;
-		String objectName;
-		try {
-			filename = (String) parameters.get(0);
-			objectName = (String) parameters.get(1);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object data = null;
-		FileInputStream fis = null;
-		ObjectInputStream in = null;
-		try {
-			fis = new FileInputStream(filename);
-			in = new ObjectInputStream(fis);
-			data = in.readObject();
-			in.close();
-		} catch (IOException ex) {
-			Console.logException(ex);
-		} catch (ClassNotFoundException ex) {
-			Console.logException(ex);
-		}
-		if (GlobalDataContainer.getInstance().addData(objectName, data)) {
-			CommandHelpers.dataOverwritten(objectName);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: loadObject <filename> <objectName>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDmodelSize.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDmodelSize.java	(revision 425)
+++ 	(revision )
@@ -1,63 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command that prints the size of a stochastic process to the console.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDmodelSize implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		try {
-			modelname = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		}
-		if (!(dataObject instanceof IStochasticProcess)) {
-			CommandHelpers.objectNotType(modelname, "IStochasticProcess");
-			return;
-		}
-
-		IStochasticProcess process = (IStochasticProcess) dataObject;
-		Console.println("#symbols: " + process.getNumSymbols()
-				+ " ; #FOMstates " + process.getNumFOMStates()
-				+ " ; #transitions: " + process.getNumTransitions());
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: modelSize <modelName>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDparseXML.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDparseXML.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDparseXML.java	(revision 1)
@@ -0,0 +1,42 @@
+package de.ugoe.cs.eventbench.commands;
+
+import java.security.InvalidParameterException;
+import java.util.List;
+
+import de.ugoe.cs.eventbench.LogParser;
+import de.ugoe.cs.eventbench.data.Event;
+import de.ugoe.cs.eventbench.data.GlobalDataContainer;
+import de.ugoe.cs.eventbench.data.WindowsMessage;
+import de.ugoe.cs.util.console.Command;
+import de.ugoe.cs.util.console.Console;
+
+public class CMDparseXML implements Command {
+
+	@Override
+	public void help() {
+		Console.println("Usage: parseXML <filename> {<countMessageOccurences}");
+	}
+
+	@Override
+	public void run(List<Object> parameters) {
+		String filename;
+		boolean countMessageOccurences = false;
+		
+		try {
+			filename = (String) parameters.get(0);
+			if( parameters.size()==2 ) {
+				countMessageOccurences = Boolean.parseBoolean((String) parameters.get(1));
+			}
+		} catch (Exception e) {
+			throw new InvalidParameterException();
+		}
+		
+		LogParser parser = new LogParser(countMessageOccurences);
+		parser.parseFile(filename);
+		
+		List<List<Event<WindowsMessage>>> sequences = parser.getSequences();
+		
+		GlobalDataContainer.getInstance().addData("sequences", sequences);		
+	}
+
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDprintDot.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDprintDot.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDprintDot.java	(revision 1)
@@ -4,26 +4,11 @@
 import java.util.List;
 
-import de.ugoe.cs.eventbench.CommandHelpers;
 import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.IDotCompatible;
+import de.ugoe.cs.eventbench.markov.DotPrinter;
 import de.ugoe.cs.util.console.Command;
 import de.ugoe.cs.util.console.Console;
 
-/**
- * <p>
- * Command that prints a dot representation of a model (if supported) to the
- * console.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
 public class CMDprintDot implements Command {
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
 	@Override
 	public void help() {
@@ -31,9 +16,4 @@
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
 	@Override
 	public void run(List<Object> parameters) {
@@ -44,19 +24,16 @@
 			throw new InvalidParameterException();
 		}
-
-		IDotCompatible model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
+		
+		DotPrinter model = null; 
+		Object dataObject = GlobalDataContainer.getInstance().getData(modelname);
+		if( dataObject==null ) {
+			Console.println("Model " + modelname + "not found in storage.");
 		}
-		if (!(dataObject instanceof IDotCompatible)) {
-			CommandHelpers.objectNotType(modelname, "IDotCompatible");
-			return;
+		else if( !(dataObject instanceof DotPrinter) ) {
+			Console.println("Object " + modelname + " does not implement DotPrinter!");
+		} else {
+			model = (DotPrinter) dataObject;
+			model.printDot();
 		}
-
-		model = (IDotCompatible) dataObject;
-		Console.println(model.getDotRepresentation());
 	}
 
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDprintTrieDot.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDprintTrieDot.java	(revision 425)
+++ 	(revision )
@@ -1,64 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.Trie;
-import de.ugoe.cs.eventbench.models.TrieBasedModel;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command that prints the {@link Trie} of a {@link TrieBasedModel} as dot to
- * the console.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDprintTrieDot implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: printTreeDot <modelname>");
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname = "";
-		try {
-			modelname = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		TrieBasedModel model = null;
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		}
-		if (!(dataObject instanceof TrieBasedModel)) {
-			CommandHelpers.objectNotType(modelname, "TrieBasedModel");
-			return;
-		}
-
-		model = (TrieBasedModel) dataObject;
-		Console.println(model.getTrieDotRepresentation());
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDsave.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDsave.java	(revision 425)
+++ 	(revision )
@@ -1,59 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to save the {@link GlobalDataContainer} through serialization.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDsave implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String filename;
-		try {
-			filename = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		FileOutputStream fos = null;
-		ObjectOutputStream out = null;
-		try {
-			fos = new FileOutputStream(filename);
-			out = new ObjectOutputStream(fos);
-			out.writeObject(GlobalDataContainer.getInstance());
-			out.close();
-		} catch (IOException ex) {
-			Console.logException(ex);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: save <filename>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDsaveObject.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDsaveObject.java	(revision 425)
+++ 	(revision )
@@ -1,70 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command that saves an object contained in the {@link GlobalDataContainer}
- * through serialization.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDsaveObject implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String filename;
-		String objectName;
-		try {
-			filename = (String) parameters.get(0);
-			objectName = (String) parameters.get(1);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance().getData(
-				objectName);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(objectName);
-			return;
-		}
-
-		FileOutputStream fos = null;
-		ObjectOutputStream out = null;
-		try {
-			fos = new FileOutputStream(filename);
-			out = new ObjectOutputStream(fos);
-			out.writeObject(dataObject);
-			out.close();
-		} catch (IOException ex) {
-			Console.logException(ex);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: saveObject <filename> <objectName>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDsequenceStatistics.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDsequenceStatistics.java	(revision 425)
+++ 	(revision )
@@ -1,83 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.SequenceInstanceOf;
-import de.ugoe.cs.eventbench.data.Event;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to print basic statistical information about stored sequences, e.g.,
- * how many there are of which lenght.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDsequenceStatistics implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	public void run(List<Object> parameters) {
-		String sequencesName;
-		try {
-			sequencesName = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Collection<List<Event<?>>> sequences = null;
-		Object dataObject = GlobalDataContainer.getInstance().getData(
-				sequencesName);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(sequencesName);
-			return;
-		}
-		if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) {
-			CommandHelpers.objectNotType(sequencesName,
-					"Collection<List<Event<?>>>");
-			return;
-		}
-
-		sequences = (Collection<List<Event<?>>>) dataObject;
-		Console.println("Number of Sequences: " + sequences.size());
-		SortedMap<Integer, Integer> lengthMap = new TreeMap<Integer, Integer>();
-		for (List<Event<?>> sequence : sequences) {
-			Integer currentSize = sequence.size();
-			if (lengthMap.containsKey(currentSize)) {
-				lengthMap.put(currentSize, lengthMap.get(currentSize) + 1);
-			} else {
-				lengthMap.put(currentSize, 1);
-			}
-		}
-		for (Entry<Integer, Integer> entry : lengthMap.entrySet()) {
-			Console.println("Of length " + entry.getKey() + ": "
-					+ entry.getValue());
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: sequenceStatistics <sequencesName>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowMarkovModel.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowMarkovModel.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowMarkovModel.java	(revision 1)
@@ -11,8 +11,7 @@
 import org.apache.commons.collections15.Transformer;
 
-import de.ugoe.cs.eventbench.CommandHelpers;
 import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel;
-import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel.MarkovEdge;
+import de.ugoe.cs.eventbench.markov.MarkovModel;
+import de.ugoe.cs.eventbench.markov.MarkovModel.MarkovEdge;
 import de.ugoe.cs.util.console.Command;
 import de.ugoe.cs.util.console.Console;
@@ -24,19 +23,6 @@
 import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position;
 
-/**
- * <p>
- * Command that visualizes first-order Markov models.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
 public class CMDshowMarkovModel implements Command {
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
 	@Override
 	public void help() {
@@ -44,9 +30,4 @@
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
 	@Override
 	public void run(List<Object> parameters) {
@@ -55,60 +36,51 @@
 		try {
 			modelname = (String) parameters.get(0);
-			if (parameters.size() == 2) {
-				showNodeNames = Boolean
-						.parseBoolean((String) parameters.get(1));
+			if( parameters.size()==2 ) {
+				showNodeNames = Boolean.parseBoolean((String) parameters.get(1));
 			}
 		} catch (Exception e) {
 			throw new InvalidParameterException();
 		}
+		
+		Object dataObject = GlobalDataContainer.getInstance().getData(modelname);
+		if( dataObject==null ) {
+			Console.printerrln("No model with name " + modelname + "found");
+		} else {
+			MarkovModel mm = (MarkovModel) dataObject;
+			
+			Graph<String, MarkovEdge> graph = mm.getGraph();
+			Layout<String, MarkovEdge> layout = new ISOMLayout<String, MarkovEdge>(graph);
+			layout.setSize(new Dimension(1000,800)); // sets the initial size of the space
+			// The BasicVisualizationServer<V,E> is parameterized by the edge types
+			BasicVisualizationServer<String,MarkovEdge> vv =
+			new BasicVisualizationServer<String,MarkovEdge>(layout);
+			vv.setPreferredSize(new Dimension(1100,850)); //Sets the viewing area size
 
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
+			
+			if( showNodeNames ) {
+				final Rectangle rect = new Rectangle(240, 20);
+				
+				Transformer<String, Shape> vertexShapeTransformer =
+					new Transformer<String, Shape>() {
+						public Shape transform(String s) {
+							return rect;
+						}
+				};
+				vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
+				vv.getRenderContext().setVertexShapeTransformer(vertexShapeTransformer);
+				vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>());
+			}
+			
+			
+			vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<MarkovModel.MarkovEdge>());
+			
+			JFrame frame = new JFrame("Markov Model");
+			frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+			frame.getContentPane().add(vv);
+			frame.pack();
+			frame.setVisible(true);
 		}
-		if (!(dataObject instanceof FirstOrderMarkovModel)) {
-			CommandHelpers.objectNotType(modelname, "FirstOrderMarkovModel");
-			return;
-		}
-		FirstOrderMarkovModel mm = (FirstOrderMarkovModel) dataObject;
-
-		Graph<String, MarkovEdge> graph = mm.getGraph();
-		Layout<String, MarkovEdge> layout = new ISOMLayout<String, MarkovEdge>(
-				graph);
-		layout.setSize(new Dimension(1000, 800)); // sets the initial size
-													// of the space
-		// The BasicVisualizationServer<V,E> is parameterized by the edge
-		// types
-		BasicVisualizationServer<String, MarkovEdge> vv = new BasicVisualizationServer<String, MarkovEdge>(
-				layout);
-		vv.setPreferredSize(new Dimension(1100, 850)); // Sets the viewing
-														// area size
-
-		if (showNodeNames) {
-			final Rectangle rect = new Rectangle(240, 20);
-
-			Transformer<String, Shape> vertexShapeTransformer = new Transformer<String, Shape>() {
-				public Shape transform(String s) {
-					return rect;
-				}
-			};
-			vv.getRenderer().getVertexLabelRenderer()
-					.setPosition(Position.CNTR);
-			vv.getRenderContext().setVertexShapeTransformer(
-					vertexShapeTransformer);
-			vv.getRenderContext().setVertexLabelTransformer(
-					new ToStringLabeller<String>());
-		}
-
-		vv.getRenderContext().setEdgeLabelTransformer(
-				new ToStringLabeller<MarkovEdge>());
-
-		JFrame frame = new JFrame("Markov Model");
-		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
-		frame.getContentPane().add(vv);
-		frame.pack();
-		frame.setVisible(true);
 	}
+	
+	
 }
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowSequences.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowSequences.java	(revision 425)
+++ 	(revision )
@@ -1,69 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.SequenceInstanceOf;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.swt.SequencesDialog;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to show sequences.
- * </p>
- * 
- * @author Jeffrey Hall, Steffen Herbold
- */
-public class CMDshowSequences implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: showSequences <sequencesName>");
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String sequencesName;
-		try {
-			sequencesName = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance().getData(
-				sequencesName);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(sequencesName);
-			return;
-		}
-		if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) {
-			CommandHelpers.objectNotType(sequencesName,
-					"Collection<List<Event<?>>>");
-			return;
-		}
-
-		Shell shell = new Shell(SWT.NONE);
-		shell.open();
-		shell.layout();
-		shell.setSize(0, 0);
-		SequencesDialog sequencesDialog = new SequencesDialog(shell, SWT.NONE);
-		sequencesDialog.open(sequencesName);
-		shell.dispose();
-	}
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowTimer.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowTimer.java	(revision 425)
+++ 	(revision )
@@ -1,60 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to show the time elapsed since a timer has been started.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDshowTimer implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String timerName;
-		try {
-			timerName = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance().getData(timerName);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(timerName);
-			return;
-		}
-		if (!(dataObject instanceof Long)) {
-			CommandHelpers.objectNotType(timerName, "Long");
-			return;
-		}
-
-		long startTime = (Long) dataObject;
-		long currentTime = System.currentTimeMillis();
-		Console.traceln("" + (currentTime - startTime) + " milliseconds");
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: showTimer <timerName>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowTrie.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowTrie.java	(revision 425)
+++ 	(revision )
@@ -1,101 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.awt.Dimension;
-import java.awt.Rectangle;
-import java.awt.Shape;
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import javax.swing.JFrame;
-
-import org.apache.commons.collections15.Transformer;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.Trie;
-import de.ugoe.cs.eventbench.models.Trie.Edge;
-import de.ugoe.cs.eventbench.models.Trie.TrieVertex;
-import de.ugoe.cs.eventbench.models.TrieBasedModel;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-import edu.uci.ics.jung.algorithms.layout.Layout;
-import edu.uci.ics.jung.algorithms.layout.TreeLayout;
-import edu.uci.ics.jung.graph.Tree;
-import edu.uci.ics.jung.visualization.BasicVisualizationServer;
-import edu.uci.ics.jung.visualization.decorators.ToStringLabeller;
-import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position;
-
-/**
- * <p>
- * Command that visualizes the {@link Trie} of a {@link TrieBasedModel}.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDshowTrie implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: showTrie <modelName>");
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		try {
-			modelname = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance()
-				.getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		}
-		if (!(dataObject instanceof TrieBasedModel)) {
-			CommandHelpers.objectNotType(modelname, "TrieBasedModel");
-		}
-		TrieBasedModel model = (TrieBasedModel) dataObject;
-		Tree<TrieVertex, Edge> graph = model.getTrieGraph();
-		Layout<TrieVertex, Edge> layout = new TreeLayout<TrieVertex, Edge>(
-				graph, 60);
-		// The BasicVisualizationServer<V,E> is parameterized by the edge
-		// types
-		BasicVisualizationServer<TrieVertex, Edge> vv = new BasicVisualizationServer<TrieVertex, Edge>(
-				layout);
-		vv.setPreferredSize(new Dimension(1100, 850)); // Sets the viewing
-														// area size
-
-		final Rectangle rect = new Rectangle(40, 20);
-
-		Transformer<TrieVertex, Shape> vertexShapeTransformer = new Transformer<TrieVertex, Shape>() {
-			public Shape transform(TrieVertex s) {
-				return rect;
-			}
-		};
-		vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
-		vv.getRenderContext().setVertexShapeTransformer(vertexShapeTransformer);
-		vv.getRenderContext().setVertexLabelTransformer(
-				new ToStringLabeller<TrieVertex>());
-
-		JFrame frame = new JFrame("Trie");
-		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
-		frame.getContentPane().add(vv);
-		frame.pack();
-		frame.setVisible(true);
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDstartFileListener.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDstartFileListener.java	(revision 425)
+++ 	(revision )
@@ -1,53 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-import de.ugoe.cs.util.console.FileOutputListener;
-
-/**
- * <p>
- * Command to start a {@link FileOutputListener}.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDstartFileListener implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String filename;
-		try {
-			filename = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		FileOutputListener listener = new FileOutputListener(filename);
-		listener.start();
-		if (GlobalDataContainer.getInstance().addData(filename, listener)) {
-			CommandHelpers.dataOverwritten(filename);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: startFileListener <filename>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDstartTimer.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDstartTimer.java	(revision 425)
+++ 	(revision )
@@ -1,50 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to start a time.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDstartTimer implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@Override
-	public void run(List<Object> parameters) {
-		String timerName;
-		try {
-			timerName = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-		Long time = System.currentTimeMillis();
-		if (GlobalDataContainer.getInstance().addData(timerName, time)) {
-			CommandHelpers.dataOverwritten(timerName);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: startTimer <timerName>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDstopFileListener.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDstopFileListener.java	(revision 425)
+++ 	(revision )
@@ -1,51 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-import de.ugoe.cs.util.console.FileOutputListener;
-
-/**
- * <p>
- * Command to stop a {@link FileOutputListener}.
- * </p>
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDstopFileListener implements Command {
-
-	@Override
-	public void run(List<Object> parameters) {
-		String filename;
-		try {
-			filename = (String) parameters.get(0);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance().getData(filename);
-		if( dataObject==null ) {
-			CommandHelpers.objectNotFoundMessage(filename);
-			return;
-		}
-		if( !(dataObject instanceof FileOutputListener) ) {
-			CommandHelpers.objectNotType(filename, "FileOutputListener");
-			return;
-		}
-		
-		FileOutputListener listener = (FileOutputListener) dataObject;
-		listener.stop();
-		GlobalDataContainer.getInstance().removeData(filename);
-	}
-
-	@Override
-	public void help() {
-		Console.println("Command: stopFileListener <filename>");
-
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainDFA.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainDFA.java	(revision 425)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.util.List;
-import java.util.Random;
-
-import de.ugoe.cs.eventbench.models.DeterministicFiniteAutomaton;
-import de.ugoe.cs.eventbench.models.TrieBasedModel;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to train a Deterministic Finite Automaton (DFA).
- * </p>
- * 
- * @author Steffen Herbold
- * @version 2.0
- */
-public class CMDtrainDFA extends AbstractTrainCommand {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: trainDFA <modelName> <sequencesName>");
-	}
-
-	/**
-	 * <p>
-	 * No additional parameters.
-	 * </p>
-	 * 
-	 * @see de.ugoe.cs.eventbench.commands.AbstractTrainCommand#handleAdditionalParameters(java.util.List)
-	 */
-	@Override
-	void handleAdditionalParameters(List<Object> parameters) throws Exception {
-		// no additional parameters.
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.eventbench.commands.AbstractTrainCommand#createModel()
-	 */
-	@Override
-	TrieBasedModel createModel() {
-		return new DeterministicFiniteAutomaton(new Random());
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainMarkovModel.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainMarkovModel.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainMarkovModel.java	(revision 1)
@@ -1,66 +1,51 @@
 package de.ugoe.cs.eventbench.commands;
 
+
+import java.security.InvalidParameterException;
 import java.util.List;
-import java.util.Random;
 
-import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel;
-import de.ugoe.cs.eventbench.models.HighOrderMarkovModel;
-import de.ugoe.cs.eventbench.models.TrieBasedModel;
+import de.ugoe.cs.eventbench.data.Event;
+import de.ugoe.cs.eventbench.data.GlobalDataContainer;
+import de.ugoe.cs.eventbench.markov.MarkovModel;
+import de.ugoe.cs.util.console.Command;
 import de.ugoe.cs.util.console.Console;
 
-/**
- * <p>
- * Command to train first-order and high-order Markov models.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 2.0
- */
-public class CMDtrainMarkovModel extends AbstractTrainCommand {
+public class CMDtrainMarkovModel implements Command {
 
-	/**
-	 * <p>
-	 * Order of the Markov model.
-	 * </p>
-	 */
-	int order;
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
 	@Override
 	public void help() {
-		Console.println("Usage: trainMarkovModel <modelName> <sequencesName> {<order>}");
+		Console.println("Usage: trainMarkovModel <modelName>");
 	}
 
-	/**
-	 * <p>
-	 * Handles the parameter order.
-	 * </p>
-	 * 
-	 * @see de.ugoe.cs.eventbench.commands.AbstractTrainCommand#handleOptionalParameters(java.util.List)
-	 */
+	@SuppressWarnings("unchecked")
 	@Override
-	void handleAdditionalParameters(List<Object> parameters) throws Exception {
-		if (parameters.size() >= 3) {
-			order = Integer.parseInt((String) parameters.get(2));
-		} else {
-			order = 1;
+	public void run(List<Object> parameters) {
+		String modelname;
+		try {
+			modelname = (String) parameters.get(0);
+		} catch (Exception e) {
+			throw new InvalidParameterException();
 		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.eventbench.commands.AbstractTrainCommand#createModel()
-	 */
-	@Override
-	TrieBasedModel createModel() {
-		if (order == 1) {
-			return new FirstOrderMarkovModel(new Random());
-		} else {
-			return new HighOrderMarkovModel(order, new Random());
+		
+		List<List<Event<?>>> sequences = null;
+		Object dataObject = GlobalDataContainer.getInstance().getData("sequences");
+			
+		try {
+			sequences = (List<List<Event<?>>>) dataObject;
+			if( sequences.size()>0 ) {
+				if( sequences.get(0).get(0) instanceof Event ) {
+					MarkovModel model = new MarkovModel();
+					model.train(sequences);
+					if( GlobalDataContainer.getInstance().addData(modelname, model) ) {
+						Console.traceln("Old model overwritten");
+					}
+				} else {
+					Console.traceln("Illegal use of \"sequences\" parameter in the GlobalDataContainer.");
+					Console.traceln("The parameter should always be of type List<List<Event>>!");
+				}
+			}
+		}
+		catch(ClassCastException e) {
+			Console.println("Sequences need to be loaded first using parseXML");
 		}
 	}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainPPM.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainPPM.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainPPM.java	(revision 1)
@@ -1,78 +1,56 @@
 package de.ugoe.cs.eventbench.commands;
 
+import java.security.InvalidParameterException;
 import java.util.List;
 import java.util.Random;
 
-import de.ugoe.cs.eventbench.models.PredictionByPartialMatch;
-import de.ugoe.cs.eventbench.models.TrieBasedModel;
+import de.ugoe.cs.eventbench.data.Event;
+import de.ugoe.cs.eventbench.data.GlobalDataContainer;
+import de.ugoe.cs.eventbench.ppm.PredictionByPartialMatch;
+import de.ugoe.cs.util.console.Command;
 import de.ugoe.cs.util.console.Console;
 
-/**
- * <p>
- * Command that trains Prediction by Partial Match (PPM) models.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 2.0
- */
-public class CMDtrainPPM extends AbstractTrainCommand {
+public class CMDtrainPPM implements Command {
 
-	/**
-	 * <p>
-	 * Escape probability of the PPM model.
-	 * </p>
-	 */
-	double probEscape;
-
-	/**
-	 * <p>
-	 * Maximal Markov order of the PPM model.
-	 * </p>
-	 */
-	int maxOrder;
-
-	/**
-	 * <p>
-	 * Minimal Markov order of the PPM model. Default: 0
-	 * </p>
-	 */
-	int minOrder = 0;
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
 	@Override
 	public void help() {
-		Console.println("Usage: trainPPM <modelName> <sequencesName> <probEscape> <maxOrder> {<minOrder>}");
+		Console.println("Usage: trainPPM <modelName>");
 	}
 
-	/**
-	 * <p>
-	 * Handles the parameters probEscape, maxOrder, and minOrder.
-	 * </p>
-	 * 
-	 * @see de.ugoe.cs.eventbench.commands.AbstractTrainCommand#handleOptionalParameters(java.util.List)
-	 */
+	@SuppressWarnings("unchecked")
 	@Override
-	void handleAdditionalParameters(List<Object> parameters) throws Exception {
-		probEscape = Double.parseDouble((String) parameters.get(2));
-		maxOrder = Integer.parseInt((String) parameters.get(3));
-		if (parameters.size() == 5) {
-			minOrder = Integer.parseInt((String) parameters.get(4));
+	public void run(List<Object> parameters) {
+		String modelname;
+		try {
+			modelname = (String) parameters.get(0);
+		} catch (Exception e) {
+			throw new InvalidParameterException();
+		}
+		
+		List<List<Event<?>>> sequences = null;
+		Object dataObject = GlobalDataContainer.getInstance().getData("sequences");
+			
+		try {
+			sequences = (List<List<Event<?>>>) dataObject;
+			if( sequences.size()>0 ) {
+				if( sequences.get(0).get(0) instanceof Event ) {
+					PredictionByPartialMatch model = new PredictionByPartialMatch();
+					model.train(sequences);
+					if( GlobalDataContainer.getInstance().addData(modelname, model) ) {
+						Console.traceln("Old model overwritten");
+					}
+					// TODO TMP!!
+					model.printRandomWalk(new Random());
+					
+				} else {
+					Console.traceln("Illegal use of \"sequences\" parameter in the GlobalDataContainer.");
+					Console.traceln("The parameter should always be of type List<List<Event>>!");
+				}
+			}
+		}
+		catch(ClassCastException e) {
+			Console.println("Sequences need to be loaded first using parseXML");
 		}
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.eventbench.commands.AbstractTrainCommand#createModel()
-	 */
-	@Override
-	TrieBasedModel createModel() {
-		return new PredictionByPartialMatch(maxOrder, minOrder, new Random(),
-				probEscape);
-	}
-
 }
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDupdateModel.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDupdateModel.java	(revision 425)
+++ 	(revision )
@@ -1,80 +1,0 @@
-package de.ugoe.cs.eventbench.commands;
-
-import java.security.InvalidParameterException;
-import java.util.Collection;
-import java.util.List;
-
-import de.ugoe.cs.eventbench.CommandHelpers;
-import de.ugoe.cs.eventbench.SequenceInstanceOf;
-import de.ugoe.cs.eventbench.data.Event;
-import de.ugoe.cs.eventbench.data.GlobalDataContainer;
-import de.ugoe.cs.eventbench.models.TrieBasedModel;
-import de.ugoe.cs.util.console.Command;
-import de.ugoe.cs.util.console.Console;
-
-/**
- * <p>
- * Command to update a {@link TrieBasedModel}.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class CMDupdateModel implements Command {
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	public void run(List<Object> parameters) {
-		String modelname;
-		String sequencesName;
-
-		try {
-			modelname = (String) parameters.get(0);
-			sequencesName = (String) parameters.get(1);
-		} catch (Exception e) {
-			throw new InvalidParameterException();
-		}
-
-		Object dataObject = GlobalDataContainer.getInstance().getData(
-				sequencesName);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(sequencesName);
-			return;
-		}
-		if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) {
-			CommandHelpers.objectNotType(sequencesName,
-					"Collection<List<Event<?>>>");
-			return;
-		}
-		Collection<List<? extends Event<?>>> sequences = (Collection<List<? extends Event<?>>>) dataObject;
-
-		dataObject = GlobalDataContainer.getInstance().getData(modelname);
-		if (dataObject == null) {
-			CommandHelpers.objectNotFoundMessage(modelname);
-			return;
-		}
-		if (!(dataObject instanceof TrieBasedModel)) {
-			CommandHelpers.objectNotType(modelname, "TrieBasedModel");
-			return;
-		}
-
-		TrieBasedModel model = (TrieBasedModel) dataObject;
-		model.update(sequences);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#help()
-	 */
-	@Override
-	public void help() {
-		Console.println("Usage: updateModel <modelname> <sequencesName>");
-	}
-
-}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/GlobalDataContainer.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/GlobalDataContainer.java	(revision 425)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/GlobalDataContainer.java	(revision 1)
@@ -1,226 +1,41 @@
 package de.ugoe.cs.eventbench.data;
 
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Collection;
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.Map;
-import java.util.Map.Entry;
 
-import de.ugoe.cs.eventbench.SequenceInstanceOf;
-import de.ugoe.cs.eventbench.models.IStochasticProcess;
-
-/**
- * <p>
- * This data structure can be used by the commands to store any {@link Object}.
- * The data is stored in a key-value map, with strings as keys.
- * </p>
- * <p>
- * This class is implemented as a singleton, as more than one data container
- * does not serves no purpose.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class GlobalDataContainer implements Serializable {
-
-	/**
-	 * <p>
-	 * Id for object serialization.
-	 * </p>
-	 */
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * <p>
-	 * Instance of the {@link GlobalDataContainer} (implemented as singleton).
-	 * </p>
-	 */
-	transient private static GlobalDataContainer theInstance = null;
-
-	/**
-	 * <p>
-	 * Internal storage of the data.
-	 * </p>
-	 */
+public class GlobalDataContainer {
+	
+	private static GlobalDataContainer theInstance= null;
+	
 	private Map<String, Object> dataObjects;
-
-	/**
-	 * <p>
-	 * Returns the instance of the container. If it does not yet exist, the data
-	 * container is created.
-	 * </p>
-	 * 
-	 * @return instance of the container
-	 */
+	
 	public static GlobalDataContainer getInstance() {
-		if (theInstance == null) {
+		if( theInstance==null ) {
 			theInstance = new GlobalDataContainer();
 		}
 		return theInstance;
 	}
-
-	/**
-	 * <p>
-	 * Manual serialization of the object. Necessary to guarantee the singleton
-	 * property.
-	 * </p>
-	 * 
-	 * @param s
-	 *            output stream for the serialization
-	 * @throws IOException
-	 *             thrown if there is problem writing to the output stream
-	 */
-	private void writeObject(ObjectOutputStream s) throws IOException {
-		s.defaultWriteObject();
-		s.writeObject(dataObjects);
-	}
-
-	/**
-	 * <p>
-	 * Manual de-serialization of the object. Necessary to guarantee the
-	 * singleton property.
-	 * 
-	 * @param s
-	 *            input stream for the de-serialization
-	 * @throws IOException
-	 *             thrown if there is problem reading from the input stream
-	 * @throws ClassNotFoundException
-	 *             thrown if there is a problem reading from the input stream
-	 */
-	@SuppressWarnings("unchecked")
-	private void readObject(ObjectInputStream s) throws IOException,
-			ClassNotFoundException {
-		s.defaultReadObject();
-		if (theInstance == null) {
-			theInstance = new GlobalDataContainer();
-		}
-		theInstance.dataObjects = (Map<String, Object>) s.readObject();
-	}
-
-	/**
-	 * <p>
-	 * Manual de-serialization to guarantee the singleton property.
-	 * </p>
-	 * 
-	 * @return instance of the container
-	 */
-	private Object readResolve() {
-		return theInstance;
-	}
-
-	/**
-	 * <p>
-	 * Constructor. Creates a new GlobalDataContainer. Private to guarantee the
-	 * singleton property.
-	 * </p>
-	 */
+	
 	private GlobalDataContainer() {
 		dataObjects = new HashMap<String, Object>();
 	}
-
-	/**
-	 * <p>
-	 * Adds data to the container.
-	 * </p>
-	 * 
-	 * @param key
-	 *            key that identifies the data
-	 * @param data
-	 *            data that is stored
-	 * @return true, if an old entry was overwritten; false otherwise
-	 */
+	
 	public boolean addData(String key, Object data) {
 		Object previousEntry = dataObjects.put(key, data);
-		return previousEntry != null;
+		return previousEntry!=null;
 	}
-
-	/**
-	 * <p>
-	 * Removes data from the container.
-	 * </p>
-	 * 
-	 * @param key
-	 *            key of the data to be removed
-	 * @return true, if the object was removed; false if it was not present
-	 */
+	
 	public boolean removeData(String key) {
 		Object previousEntry = dataObjects.remove(key);
-		return previousEntry != null;
+		return previousEntry==null;
 	}
-
-	/**
-	 * <p>
-	 * Returns the data associated with a key or {@code null} if no data is
-	 * stored for the key.
-	 * </p>
-	 * 
-	 * @param key
-	 *            key whose data is returned
-	 * @return data associated with the key; {@code null} if no data is
-	 *         available
-	 */
+	
 	public Object getData(String key) {
 		return dataObjects.get(key);
 	}
-
-	/**
-	 * <p>
-	 * Resets the data container, i.e., deletes all its contents.
-	 * </p>
-	 */
+	
 	public void reset() {
 		dataObjects = new HashMap<String, Object>();
 	}
 
-	/**
-	 * <p>
-	 * Returns all keys of collections of sequences contained in the storage.
-	 * </p>
-	 * 
-	 * @return keys of all collections of sequences contained in the storage
-	 */
-	public Collection<String> getAllSequencesNames() {
-		Collection<String> allSequencesNames = new LinkedList<String>();
-		for (Entry<String, Object> entry : dataObjects.entrySet()) {
-			if( SequenceInstanceOf.isCollectionOfSequences(entry.getValue())) {
-				allSequencesNames.add(entry.getKey());
-			}
-		}
-		return allSequencesNames;
-	}
-
-	/**
-	 * <p>
-	 * Returns the keys of all {@link IStochasticProcess}s contained in the
-	 * storage.
-	 * </p>
-	 * 
-	 * @return keys of all {@link IStochasticProcess}s contained in the storage
-	 */
-	public Collection<String> getAllModelNames() {
-		Collection<String> modelNames = new LinkedList<String>();
-		for (Entry<String, Object> entry : dataObjects.entrySet()) {
-			if (entry.getValue() instanceof IStochasticProcess) {
-				modelNames.add(entry.getKey());
-			}
-		}
-		return modelNames;
-	}
-
-	/**
-	 * <p>
-	 * Returns the keys of all objects contained in the storage.
-	 * </p>
-	 * 
-	 * @return keys of all objects in the storage
-	 */
-	public Collection<String> getAllKeys() {
-		return dataObjects.keySet();
-	}
-
 }
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowTree.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowTree.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowTree.java	(revision 1)
@@ -0,0 +1,163 @@
+package de.ugoe.cs.eventbench.data;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * This class provides an the interfaces for window trees.
+ * </p>
+ * <p>
+ * The window tree represents the hierarchical structure of the windows
+ * "as it is" currently during a session. It may change during the session due
+ * to creation and destruction of windows.
+ * </p>
+ * <p>
+ * The class is implemented as a singleton. The rational behind implementing
+ * this class as a singleton is to ease the access of all class that may request
+ * information about the windows during the parsing of a session. As the tree
+ * may change during the session, it does not make sense to preserve it after a
+ * session. Thus, it can just be deleted. Therefore, as long as only one session
+ * is parsed at a time, a single instance is sufficient.
+ * </p>
+ * 
+ * @author Steffen Herbold
+ */
+public class WindowTree {
+
+	/**
+	 * <p>
+	 * Handle to the window instance.
+	 * </p>
+	 */
+	private static WindowTree theInstance = null;
+
+	/**
+	 * <p>
+	 * Obtain a handle to the window instance.
+	 * </p>
+	 * 
+	 * @return
+	 */
+	public static WindowTree getInstance() {
+		if (theInstance == null) {
+			theInstance = new WindowTree();
+		}
+		return theInstance;
+	}
+
+	/**
+	 * <p>
+	 * Resets the tree. Should be used between sessions.
+	 * </p>
+	 */
+	public static void resetTree() {
+		theInstance = null;
+	}
+
+	/**
+	 * <p>
+	 * Map of all windows that are part of the tree for efficient searching. The
+	 * keys of the map are the hwnd's of the windows.
+	 * </p>
+	 */
+	private Map<Integer, WindowTreeNode> nodes;
+
+	/**
+	 * <p>
+	 * Creates a new WindowTree.
+	 * </p>
+	 * <p>
+	 * Private, as the class is a singleton.
+	 * </p>
+	 */
+	private WindowTree() {
+		nodes = new HashMap<Integer, WindowTreeNode>();
+	}
+
+	/**
+	 * <p>
+	 * Adds a new window to the tree.
+	 * </p>
+	 * 
+	 * @param parentHwnd
+	 *            hwnd of the parent window
+	 * @param childHwnd
+	 *            hwnd of the window to be created
+	 * @param childWindowName
+	 *            resource id of the window to be created
+	 * @param resourceId
+	 *            resource id of the window to be created
+	 * @param className
+	 *            class name of the window to be created
+	 */
+	public void add(int parentHwnd, int childHwnd, String childWindowName,
+			int resourceId, String className, boolean isModal) {
+		WindowTreeNode parent = nodes.get(parentHwnd);
+		WindowTreeNode child = nodes.get(childHwnd);
+		if (child == null) {
+			if (parent != null) {
+				child = parent.addChild(childHwnd, childWindowName, resourceId,
+						className, isModal);
+			} else {
+				child = new WindowTreeNode(childHwnd, null, childWindowName,
+						resourceId, className, isModal);
+			}
+			nodes.put(childHwnd, child);
+		}
+	}
+
+	/**
+	 * <p>
+	 * Removes a window (defined by its hwnd) from the tree. All children of the
+	 * window will be removed recursively.
+	 * </p>
+	 * 
+	 * @param hwnd
+	 *            hwnd of the window to be removed
+	 * @return number of windows that were removed
+	 */
+	public int remove(int hwnd) {
+		int removedCounter = 0;
+		WindowTreeNode node = nodes.get(hwnd);
+		if (node != null) {
+			List<WindowTreeNode> nodesToBeRemoved = node.remove();
+			for (int i = 0; i < nodesToBeRemoved.size(); i++) {
+				WindowTreeNode nodeToBeRemoved = nodesToBeRemoved.get(i);
+				nodesToBeRemoved.addAll(nodeToBeRemoved.getChildren());
+				nodes.remove(nodeToBeRemoved.getHwnd());
+				removedCounter++;
+			}
+			nodes.remove(hwnd);
+			removedCounter++;
+		}
+		return removedCounter;
+	}
+
+	/**
+	 * <p>
+	 * Searches the tree for a window with the specified hwnd and returns its
+	 * {@link WindowTreeNode}.
+	 * </p>
+	 * 
+	 * @param hwnd
+	 *            hwnd that is looked for
+	 * @return {@link WindowTreeNode} of the window with the given hwnd if
+	 *         found, null otherwise
+	 */
+	public WindowTreeNode find(int hwnd) {
+		return nodes.get(hwnd);
+	}
+	
+	/**
+	 * <p>
+	 * Returns the number of nodes contained in the WindowTree.
+	 * </p>
+	 * 
+	 * @return number of nodes
+	 */
+	public int size() {
+		return nodes.size();
+	}
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowTreeNode.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowTreeNode.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowTreeNode.java	(revision 1)
@@ -0,0 +1,280 @@
+package de.ugoe.cs.eventbench.data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.ugoe.cs.util.StringTools;
+
+/**
+ * <p>
+ * This class implements a node in the {@link WindowTree} that is maintained
+ * during parsing a session.
+ * </p>
+ * <p>
+ * The window tree is structure that contains the hierarchy of the windows of a
+ * application as well as basic information about each window: the hwnd; its
+ * name; its resource id; its class name.
+ * </p>
+ * 
+ * @author Steffen Herbold
+ */
+public class WindowTreeNode {
+
+	/**
+	 * <p>
+	 * Name of the window. May change over time.
+	 * </p>
+	 */
+	private String windowName;
+
+	/**
+	 * <p>
+	 * Handle of the window. Used as unique identifier during its existence.
+	 * </p>
+	 */
+	private final int hwnd;
+
+	/**
+	 * <p>
+	 * Resource id of the window.
+	 * </p>
+	 */
+	private final int resourceId;
+
+	/**
+	 * <p>
+	 * Class name of the window.
+	 * </p>
+	 */
+	private final String className;
+
+	/**
+	 * <p>
+	 * True, if the window is modal.
+	 * </p>
+	 */
+	private final boolean isModal;
+
+	/**
+	 * <p>
+	 * Parent of the window. <code>null</code> if the window has no parent.
+	 * </p>
+	 */
+	private WindowTreeNode parent;
+
+	/**
+	 * <p>
+	 * List of the windows children. May be empty.
+	 * </p>
+	 */
+	private List<WindowTreeNode> children;
+	
+	/**
+	 * <p>
+	 * Creates a new WindowTreeNode.
+	 * </p>
+	 * <p>
+	 * The constructor is protected WindowTreeNode may only be created from the
+	 * WindowTree.
+	 * </p>
+	 * 
+	 * @param hwnd
+	 *            hwnd of the window
+	 * @param parent
+	 *            reference to the parent's WindowTreeNode
+	 * @param windowName
+	 *            name of the window
+	 * @param resourceId
+	 *            resource id of the window
+	 * @param className
+	 *            class name of the window
+	 * @param isModal
+	 *            modality of the window
+	 */
+	protected WindowTreeNode(int hwnd, WindowTreeNode parent,
+			String windowName, int resourceId, String className, boolean isModal) {
+		this.hwnd = hwnd;
+		this.parent = parent;
+		this.windowName = windowName;
+		this.resourceId = resourceId;
+		this.className = className;
+		this.isModal = isModal;
+		children = new ArrayList<WindowTreeNode>();
+	}
+
+	/**
+	 * <p>
+	 * Returns a reference to the WindowTreeNode of the parent.
+	 * </p>
+	 * 
+	 * @return WindowTreeNode of the parent
+	 */
+	public WindowTreeNode getParent() {
+		return parent;
+	}
+
+	/**
+	 * <p>
+	 * Returns the list of the windows children.
+	 * </p>
+	 * 
+	 * @return list of the windows children
+	 */
+	public List<WindowTreeNode> getChildren() {
+		return children;
+	}
+
+	/**
+	 * <p>
+	 * Returns the name of the window.
+	 * </p>
+	 * 
+	 * @return name of the window
+	 */
+	public String getName() {
+		return windowName;
+	}
+
+	/**
+	 * <p>
+	 * Returns the hwnd of the window.
+	 * </p>
+	 * 
+	 * @return hwnd of the window
+	 */
+	public int getHwnd() {
+		return hwnd;
+	}
+
+	/**
+	 * <p>
+	 * Returns the resource id of the window.
+	 * </p>
+	 * 
+	 * @return resource id of the window
+	 */
+	public int getResourceId() {
+		return resourceId;
+	}
+
+	/**
+	 * <p>
+	 * Returns the class name of the window.
+	 * </p>
+	 * 
+	 * @return
+	 */
+	public String getClassName() {
+		return className;
+	}
+
+	/**
+	 * <p>
+	 * Sets the name of the window.
+	 * </p>
+	 * 
+	 * @param text
+	 *            new name of the window
+	 */
+	public void setName(String text) {
+		windowName = text;
+	}
+
+	/**
+	 * <p>
+	 * Removes a the window and all its children from the {@link WindowTree}.
+	 * </p>
+	 * 
+	 * @return list of the children of the window for further clean up.
+	 */
+	public List<WindowTreeNode> remove() {
+		if (parent != null) {
+			parent.removeChild(this);
+		}
+		return children;
+	}
+
+	/**
+	 * <p>
+	 * Removes a child window.
+	 * </p>
+	 * 
+	 * @param child
+	 *            reference to the child window to be removed
+	 */
+	public void removeChild(WindowTreeNode child) {
+		children.remove(child);
+	}
+
+	/**
+	 * <p>
+	 * Adds a new child window and creates WindowTreeNode for it.
+	 * </p>
+	 * 
+	 * @param childHwnd
+	 *            hwnd of the child window
+	 * @param childWindowName
+	 *            name of the child window
+	 * @param resourceId
+	 *            resource id of the child window
+	 * @param className
+	 *            class name of the child window
+	 * @param isModal
+	 *            modality of the child window
+	 * @return reference to the WindowTreeNode created for the child window
+	 */
+	public WindowTreeNode addChild(int childHwnd, String childWindowName,
+			int resourceId, String className, boolean isModal) {
+		WindowTreeNode child = new WindowTreeNode(childHwnd, this,
+				childWindowName, resourceId, className, isModal);
+		children.add(child);
+		return child;
+	}
+
+	/**
+	 * <p>
+	 * Returns a string identfier of the window:<br>
+	 * {@code [resourceId;"windowName";"className";modality]}
+	 * </p>
+	 * 
+	 * @return identifier string of the window
+	 */
+	@Override
+	public String toString() {
+		return "[" + resourceId + ";\"" + windowName + "\";\"" + className
+				+ "\";" + isModal + "]";
+	}
+
+	/**
+	 * <p>
+	 * Returns an XML representation of the window, including its parents. It is
+	 * defined as follows:<br>
+	 * <code>
+	 * parent#xmlRepresentation()<br>
+	 * &lt;window name="this.windowname" class="this.className" resourceId="this.resourceId" isModal="this.isModel"/&gt;
+	 * </code>
+	 * </p>
+	 * 
+	 * @return xml representation of the window
+	 */
+	public String xmlRepresentation() {
+		String xmlString = "";
+		if (parent != null) {
+			xmlString = parent.xmlRepresentation();
+		}
+		xmlString += "<window name=\"" + StringTools.xmlEntityReplacement(windowName) + "\" class=\""
+				+ StringTools.xmlEntityReplacement(className) + "\" resourceId=\"" + resourceId + "\" isModal=\""
+				+ isModal + "\"/>";
+		return xmlString;
+	}
+	
+	public String getParentNames() {
+		String parentNames = "";
+		if (parent != null ) {
+			parentNames = parent.getParentNames()+".";
+		}
+		parentNames += windowName;
+		return parentNames;
+	}
+
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowsMessage.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowsMessage.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/data/WindowsMessage.java	(revision 1)
@@ -0,0 +1,204 @@
+package de.ugoe.cs.eventbench.data;
+
+import java.security.InvalidParameterException;
+import java.util.HashMap;
+import java.util.Map;
+
+import de.ugoe.cs.eventbench.data.IReplayable;
+import de.ugoe.cs.util.StringTools;
+
+public class WindowsMessage implements IReplayable {
+	final int type;
+	private String windowClass = "";
+	private int resourceId = 0;
+	private String xmlWindowDescription = "";
+	private String parentNames = null;
+
+	private long LPARAM = 0;
+	private long WPARAM = 0;
+
+	private String LPARAMasWindowDesc = null;
+	private String WPARAMasWindowDesc = null;
+
+	private int delay = 0;
+	
+	private Map<String, String> params = new HashMap<String, String>();
+
+	public WindowsMessage(int type) {
+		this.type = type;
+	}
+
+	public void addParameter(String type, String value) {
+		params.put(type, value);
+		if (type.equals("LPARAM")) {
+			LPARAM = Long.parseLong(value);
+		} else if (type.equals("WPARAM")) {
+			WPARAM = Long.parseLong(value);
+		}
+	}
+
+	public int getType() {
+		return type;
+	}
+
+	public String getParameter(String type) {
+		return params.get(type);
+	}
+
+	public String getWindowClass() {
+		return windowClass;
+	}
+
+	public int getHwnd() {
+		int hwnd = -1;
+		String hwndString = getParameter("window.hwnd"); // possible, as
+															// "window.hwnd" is
+															// mandatory
+		if (hwndString != null) {
+			hwnd = Integer.parseInt(hwndString);
+		}
+		return hwnd;
+	}
+
+	public int getWindowResourceId() {
+		return resourceId;
+	}
+
+	@Override
+	public boolean equals(Object other) {
+		if( other==this) {
+			return true;
+		}
+		boolean isEqual = false;
+		if (other instanceof WindowsMessage) {
+			isEqual = ((WindowsMessage) other).type == this.type
+					&& ((WindowsMessage) other).xmlWindowDescription
+							.equals(this.xmlWindowDescription)
+					&& ((WindowsMessage) other).params.equals(this.params);
+		}
+		return isEqual;
+	}
+
+	@Override
+	public int hashCode() {
+		int multiplier = 17;
+		int hash = 42;
+
+		hash = multiplier * hash + type;
+		hash = multiplier * hash + xmlWindowDescription.hashCode();
+		hash = multiplier * hash + params.hashCode();
+
+		return hash;
+	}
+
+	@Override
+	public String toString() {
+		return "msg[target=" + getParameter("window.hwnd") + ";type=" + type
+				+ "]";
+	}
+
+	public void setTarget(WindowTree windowTree)
+			throws InvalidParameterException {
+		int hwnd = Integer.parseInt(getParameter("window.hwnd"));
+		WindowTreeNode node = windowTree.find(hwnd);
+		if (node == null) {
+			throw new InvalidParameterException("No window with HWND " + hwnd
+					+ " found in window tree!");
+		} else {
+			windowClass = node.getClassName();
+			resourceId = node.getResourceId();
+			xmlWindowDescription = node.xmlRepresentation();
+			parentNames = node.getParentNames();
+		}
+	}
+
+	public void setLPARAM(long paramValue) {
+		LPARAM = paramValue;
+	}
+
+	public void setWPARAM(long paramValue) {
+		WPARAM = paramValue;
+	}
+
+	public long getLPARAM() {
+		return LPARAM;
+	}
+
+	public long getWPARAM() {
+		return WPARAM;
+	}
+
+	public void setLPARAMasWindowDesc(String windowDesc) {
+		LPARAMasWindowDesc = windowDesc;
+	}
+
+	public void setWPARAMasWindowDesc(String windowDesc) {
+		WPARAMasWindowDesc = windowDesc;
+	}
+
+	public String getLPARAMasWindowDesc() {
+		return LPARAMasWindowDesc;
+	}
+
+	public String getWPARAMasWindowDesc() {
+		return WPARAMasWindowDesc;
+	}
+
+	public String getXmlWindowDescription() {
+		return xmlWindowDescription;
+	}
+
+	public void setXmlWindowDescription(String xmlWindowDescription) {
+		this.xmlWindowDescription = xmlWindowDescription;
+	}
+
+	public int getDelay() {
+		return delay;
+	}
+
+	public void setDelay(int delay) {
+		this.delay = delay;
+	}
+
+	public String getParentNames() {
+		return parentNames;
+	}
+
+	public int getNumParams() {
+		return params.size();
+	}
+	
+	public String getReplayXml() {
+		StringBuilder currentMsgStr = new StringBuilder(400);
+		currentMsgStr.append("  <msg type=\""+type+"\" ");
+		currentMsgStr.append("LPARAM=\""+LPARAM+"\" ");
+		currentMsgStr.append("WPARAM=\""+WPARAM+"\" ");
+		currentMsgStr.append("delay=\""+delay+"\">");
+		if( LPARAMasWindowDesc!=null ) {
+			currentMsgStr.append(StringTools.ENDLINE);
+			currentMsgStr.append("   <LPARAM>");
+			currentMsgStr.append(StringTools.ENDLINE);
+			currentMsgStr.append(LPARAMasWindowDesc);
+			currentMsgStr.append(StringTools.ENDLINE);
+			currentMsgStr.append("</LPARAM>");
+		} 
+		if( WPARAMasWindowDesc!=null ) {
+			currentMsgStr.append(StringTools.ENDLINE);
+			currentMsgStr.append("   <WPARAM>");
+			currentMsgStr.append(StringTools.ENDLINE);
+			currentMsgStr.append(WPARAMasWindowDesc);
+			currentMsgStr.append(StringTools.ENDLINE);
+			currentMsgStr.append("   </WPARAM>");
+		}
+		currentMsgStr.append(StringTools.ENDLINE);
+		currentMsgStr.append(xmlWindowDescription);
+		currentMsgStr.append(StringTools.ENDLINE);
+		currentMsgStr.append("  </msg>");
+		currentMsgStr.append(StringTools.ENDLINE);
+		return currentMsgStr.toString();
+	}
+	
+	public String getTarget() {
+		return xmlWindowDescription;
+	}
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerCreate.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerCreate.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerCreate.java	(revision 1)
@@ -0,0 +1,63 @@
+package de.ugoe.cs.eventbench.messagehandler;
+
+import de.ugoe.cs.eventbench.data.WindowTree;
+
+public class HandlerCreate extends MessageHandler {
+
+	public HandlerCreate() {
+		super();
+	}
+
+	private String windowName;
+	private int hwnd;
+	private int parentHwnd;
+	private int resourceId;
+	private String className;
+	private boolean isModal;
+	
+	@Override
+	public void onEndElement() {
+		if( hwnd!=0 ) {
+			WindowTree.getInstance().add(parentHwnd, hwnd, windowName, resourceId, className, isModal);
+		}
+	}
+
+	@Override
+	public void onParameter(String name, String value) {
+		if( name.equals("window.hwnd") ) {
+			hwnd = Integer.parseInt(value);
+		}
+		else if( name.equals("window.name") ) {
+			windowName = value;
+		}
+		else if( name.equals("window.parent.hwnd") ) {
+			parentHwnd = Integer.parseInt(value);
+		}
+		else if( name.equals("window.resourceId") ) {
+			resourceId = Integer.parseInt(value);
+		}
+		else if( name.equals("window.class") ) {
+			if( value.startsWith("Afx:") ) {
+				className = "Afx:";
+			} else {
+				className = value;
+			}
+		}
+		else if( name.equals("window.ismodal") ) {
+			if( value.equals("true") || value.equals("1") ) {
+				isModal = true;
+			}
+		}
+	}
+
+	@Override
+	public void onStartElement() {
+		windowName = "";
+		hwnd = 0;
+		parentHwnd = 0;
+		resourceId = 0;
+		className = "";
+		isModal = false;
+	}
+
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerDestroy.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerDestroy.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerDestroy.java	(revision 1)
@@ -0,0 +1,32 @@
+package de.ugoe.cs.eventbench.messagehandler;
+
+import de.ugoe.cs.eventbench.data.WindowTree;
+
+public class HandlerDestroy extends MessageHandler {
+
+	public HandlerDestroy() {
+		super();
+	}
+
+	private int hwnd;
+	
+	@Override
+	public void onEndElement() {
+		if( hwnd!=0 ) {
+			WindowTree.getInstance().remove(hwnd);
+		}
+	}
+
+	@Override
+	public void onParameter(String name, String value) {
+		if( name.equals("window.hwnd") ) {
+			hwnd = Integer.parseInt(value);
+		}
+	}
+
+	@Override
+	public void onStartElement() {
+		hwnd = 0;
+	}
+
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerSetText.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerSetText.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/HandlerSetText.java	(revision 1)
@@ -0,0 +1,37 @@
+package de.ugoe.cs.eventbench.messagehandler;
+
+import de.ugoe.cs.eventbench.data.WindowTree;
+import de.ugoe.cs.eventbench.data.WindowTreeNode;
+
+public class HandlerSetText extends MessageHandler {
+
+	public HandlerSetText() {
+		super();
+	}
+
+	private String windowName;
+	private int hwnd;
+
+	@Override
+	public void onEndElement() {
+		if (hwnd != 0) {
+			WindowTreeNode node = WindowTree.getInstance().find(hwnd);
+			node.setName(windowName);
+		}
+	}
+
+	@Override
+	public void onParameter(String name, String value) {
+		if (name.equals("window.hwnd")) {
+			hwnd = Integer.parseInt(value);
+		} else if (name.equals("window.newText")) {
+			windowName = value;
+		}
+	}
+
+	@Override
+	public void onStartElement() {
+		windowName = "";
+		hwnd = 0;
+	}
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/MessageHandler.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/MessageHandler.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/messagehandler/MessageHandler.java	(revision 1)
@@ -0,0 +1,11 @@
+package de.ugoe.cs.eventbench.messagehandler;
+
+
+public class MessageHandler {
+		
+	protected MessageHandler() {}
+	
+	public void onStartElement() {}
+	public void onParameter(String name, String value) {}
+	public void onEndElement() {}
+}
Index: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/windowsdefs/MessageDefs.java
===================================================================
--- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/windowsdefs/MessageDefs.java	(revision 1)
+++ trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/windowsdefs/MessageDefs.java	(revision 1)
@@ -0,0 +1,157 @@
+package de.ugoe.cs.eventbench.windowsdefs;
+
+public interface MessageDefs {
+	
+	public static final int WM_NULL = 0;
+	public static final int WM_CREATE = 1;
+	public static final int WM_DESTROY = 2;
+	public static final int WM_MOVE = 3;
+	public static final int WM_SIZE = 5;
+	public static final int WM_ACTIVATE = 6;
+	public static final int WM_SETFOCUS = 7;
+	public static final int WM_KILLFOCUS = 8;
+	public static final int WM_ENABLE = 10;
+	public static final int WM_SETREDRAW = 11;
+	public static final int WM_SETTEXT = 12;
+	public static final int WM_GETTEXT = 13;
+	public static final int WM_GETTEXTLENGTH = 14;
+	public static final int WM_PAINT = 15;
+	public static final int WM_CLOSE = 16;
+	public static final int WM_QUERYENDSESSION = 17;
+	public static final int WM_QUIT = 18;
+	public static final int WM_QUERYOPEN = 19;
+	public static final int WM_ERASEBKGND = 20;
+	public static final int WM_SYSCOLORCHANGE = 21;
+	public static final int WM_ENDSESSION = 22;
+	public static final int WM_SHOWWINDOW = 24;
+	public static final int WM_CTLCOLOR = 25;
+	public static final int WM_WININICHANGE = 26;
+	public static final int WM_DEVMODECHANGE = 27;
+	public static final int WM_ACTIVATEAPP = 28;
+	public static final int WM_FONTCHANGE = 29;
+	public static final int WM_TIMECHANGE = 30;
+	public static final int WM_CANCELMODE = 31;
+	public static final int WM_SETCURSOR = 32;
+	public static final int WM_MOUSEACTIVATE = 33;
+	public static final int WM_CHILDACTIVATE = 34;
+	public static final int WM_QUEUESYNC = 35;
+	public static final int WM_GETMINMAXINFO = 36;
+	public static final int WM_PAINTICON = 38;
+	public static final int WM_ICONERASEBKGND = 39;
+	public static final int WM_NEXTDLGCTL = 40;
+	public static final int WM_SPOOLERSTATUS = 42;
+	public static final int WM_DRAWITEM = 43;
+	public static final int WM_MEASUREITEM = 44;
+	public static final int WM_DELETEITEM = 45;
+	public static final int WM_VKEYTOITEM = 46;
+	public static final int WM_CHARTOITEM = 47;
+	public static final int WM_SETFONT = 48;
+	public static final int WM_GETFONT = 49;
+	public static final int WM_SETHOTKEY = 50;
+	public static final int WM_GETHOTKEY = 51;
+	public static final int WM_QUERYDRAGICON = 55;
+	public static final int WM_COMPAREITEM = 57;
+	public static final int WM_GETOBJECT = 61;
+	public static final int WM_COMPACTING = 65;
+	public static final int WM_COMMNOTIFY = 68;
+	public static final int WM_WINDOWPOSCHANGING = 70;
+	public static final int WM_WINDOWPOSCHANGED = 71;
+	public static final int WM_POWER = 72;
+	public static final int WM_COPYDATA = 74;
+	public static final int WM_CANCELJOURNAL = 75;
+	public static final int WM_NOTIFY = 78;
+	public static final int WM_INPUTLANGCHANGEREQUEST = 80;
+	public static final int WM_INPUTLANGCHANGE = 81;
+	public static final int WM_TCARD = 82;
+	public static final int WM_HELP = 83;
+	public static final int WM_USERCHANGED = 84;
+	public static final int WM_NOTIFYFORMAT = 85;
+	public static final int WM_CONTEXTMENU = 123;
+	public static final int WM_STYLECHANGING = 124;
+	public static final int WM_STYLECHANGED = 125;
+	public static final int WM_DISPLAYCHANGE = 126;
+	public static final int WM_GETICON = 127;
+	public static final int WM_SETICON = 128;
+	public static final int WM_NCCREATE = 129;
+	public static final int WM_NCDESTROY = 130;
+	public static final int WM_NCCALCSIZE = 131;
+	public static final int WM_NCHITTEST = 132;
+	public static final int WM_NCPAINT = 133;
+	public static final int WM_NCACTIVATE = 134;
+	public static final int WM_GETDLGCODE = 135;
+	public static final int WM_SYNCPAINT = 136;
+	public static final int WM_NCMOUSEMOVE = 160;
+	public static final int WM_NCLBUTTONDOWN = 161;
+	public static final int WM_NCLBUTTONUP = 162;
+	public static final int WM_NCLBUTTONDBLCLK = 163;
+	public static final int WM_NCRBUTTONDOWN = 164;
+	public static final int WM_NCRBUTTONUP = 165;
+	public static final int WM_NCRBUTTONDBLCLK = 166;
+	public static final int WM_NCMBUTTONDOWN = 167;
+	public static final int WM_NCMBUTTONUP = 168;
+	public static final int WM_NCMBUTTONDBLCLK = 169;
+	public static final int WM_NCXBUTTONDOWN = 171;
+	public static final int WM_NCXBUTTONUP = 172;
+	public static final int WM_NCXBUTTONDBLCLK = 173;
+	public static final int WM_INPUT = 255;
+	public static final int WM_KEYDOWN = 256;
+	public static final int WM_KEYFIRST = 256;
+	public static final int WM_KEYUP = 257;
+	public static final int WM_CHAR = 258;
+	public static final int WM_DEADCHAR = 259;
+	public static final int WM_SYSKEYDOWN = 260;
+	public static final int WM_SYSKEYUP = 261;
+	public static final int WM_SYSCHAR = 262;
+	public static final int WM_SYSDEADCHAR = 263;
+	public static final int WM_KEYLAST = 264;
+	public static final int WM_WNT_CONVERTREQUESTEX = 265;
+	public static final int WM_CONVERTREQUEST = 266;
+	public static final int WM_CONVERTRESULT = 267;
+	public static final int WM_INTERIM = 268;
+	public static final int WM_IME_STARTCOMPOSITION = 269;
+	public static final int WM_IME_ENDCOMPOSITION = 270;
+	public static final int WM_IME_COMPOSITION = 271;
+	public static final int WM_IME_KEYLAST = 271;
+	public static final int WM_INITDIALOG = 272;
+	public static final int WM_COMMAND = 273;
+	public static final int WM_SYSCOMMAND = 274;
+	public static final int WM_TIMER = 275;
+	public static final int WM_HSCROLL = 276;
+	public static final int WM_VSCROLL = 277;
+	public static final int WM_INITMENU = 278;
+	public static final int WM_INITMENUPOPUP = 279;
+	public static final int WM_MENUSELECT = 287;
+	public static final int WM_MENUCHAR = 288;
+	public static final int WM_ENTERIDLE = 289;
+	public static final int WM_MENURBUTTONUP = 290;
+	public static final int WM_MENUDRAG = 291;
+	public static final int WM_MENUGETOBJECT = 292;
+	public static final int WM_UNINTMENUPOPUP = 293;
+	public static final int WM_MENUCOMMAND = 294;
+	public static final int WM_CHANGEUISTATE = 295;
+	public static final int WM_UPDATEUISTATE = 296;
+	public static final int WM_QUERYUISTATE = 297;
+	public static final int WM_CTLCOLORMSGBOX = 306;
+	public static final int WM_CTLCOLOREDIT = 307;
+	public static final int WM_CTLCOLORLISTBOX = 308;
+	public static final int WM_CTLCOLORBTN = 309;
+	public static final int WM_CTLCLOLORDLG = 310;
+	public static final int WM_CTLCOLORSCROLLBAR = 311;
+	public static final int WM_CTLCOLORSTATIC = 312;
+	public static final int WM_MOUSEFIRST = 512;
+	public static final int WM_MOUSEMOVE = 512;
+	public static final int WM_LBUTTONDOWN = 513;
+	public static final int WM_LBUTTONUP = 514;
+	public static final int WM_LBUTTONDBLCLK = 515;
+	public static final int WM_RBUTTONDOWN = 516;
+	public static final int WM_RBUTTONUP = 517;
+	public static final int WM_RBUTTONDBLCLK = 518;
+	public static final int WM_MBUTTONDOWN = 519;
+	public static final int WM_MBUTTONUP = 520;
+	public static final int WM_MBUTTONDBLCLK = 521;
+	public static final int WM_MOUSELAST = 521;
+	public static final int WM_MOUSEWHEEL = 522;
+	public static final int WM_XBUTTONDOWN = 523;
+	public static final int WM_XBUTTONUP = 524;
+	public static final int WM_XBUTTONDBLCLK = 525;
+}
Index: trunk/EventBenchCore/.classpath
===================================================================
--- trunk/EventBenchCore/.classpath	(revision 425)
+++ trunk/EventBenchCore/.classpath	(revision 1)
@@ -3,24 +3,22 @@
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="lib" path="lib/Jama-1.0.2.jar"/>
+	<classpathentry kind="lib" path="lib/colt-1.2.0.jar"/>
+	<classpathentry kind="lib" path="lib/concurrent-1.3.4.jar"/>
+	<classpathentry kind="lib" path="lib/j3d-core-1.3.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-3d-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-3d-demos-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-algorithms-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-api-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-graph-impl-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-io-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-jai-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-jai-samples-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-samples-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/jung-visualization-2.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/stax-api-1.0.1.jar"/>
+	<classpathentry kind="lib" path="lib/vecmath-1.3.1.jar"/>
+	<classpathentry kind="lib" path="lib/wstx-asl-3.2.6.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JavaHelperLib"/>
-	<classpathentry kind="lib" path="/Build/lib/collections-generic-4.01.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/colt-1.2.0.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/commons-codec-1.5.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/concurrent-1.3.4.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/j3d-core-1.3.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/Jama-1.0.2.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-3d-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-3d-demos-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-algorithms-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-api-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-graph-impl-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-io-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-jai-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-jai-samples-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-samples-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/jung-visualization-2.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/stax-api-1.0.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/vecmath-1.3.1.jar"/>
-	<classpathentry kind="lib" path="/Build/lib/wstx-asl-3.2.6.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
Index: trunk/EventBenchCore/.project
===================================================================
--- trunk/EventBenchCore/.project	(revision 425)
+++ trunk/EventBenchCore/.project	(revision 1)
@@ -4,6 +4,4 @@
 	<comment></comment>
 	<projects>
-		<project>Build</project>
-		<project>JavaHelperLib</project>
 	</projects>
 	<buildSpec>
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/IReplayDecorator.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/IReplayDecorator.java	(revision 425)
+++ 	(revision )
@@ -1,55 +1,0 @@
-package de.ugoe.cs.eventbench;
-
-import java.io.Serializable;
-
-/**
- * <p>
- * This interface defines the structure of decorators used when writing replay
- * files.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public interface IReplayDecorator extends Serializable {
-
-	/**
-	 * <p>
-	 * Header of the file. Called at the beginning of the writing.
-	 * </p>
-	 * 
-	 * @return file header
-	 */
-	String getHeader();
-
-	/**
-	 * <p>
-	 * Footer of the file. Called at the end of the writing.
-	 * </p>
-	 * 
-	 * @return file footer
-	 */
-	String getFooter();
-
-	/**
-	 * <p>
-	 * Session Header. Called before each session.
-	 * </p>
-	 * 
-	 * @param sessionId
-	 *            id of the session
-	 * @return session header
-	 */
-	String getSessionHeader(int sessionId);
-
-	/**
-	 * <p>
-	 * Session Footer. Called after each session.
-	 * </p>
-	 * 
-	 * @param sessionId
-	 *            id of the session
-	 * @return session footer
-	 */
-	String getSessionFooter(int sessionId);
-}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/SequenceInstanceOf.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/SequenceInstanceOf.java	(revision 425)
+++ 	(revision )
@@ -1,79 +1,0 @@
-package de.ugoe.cs.eventbench;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import de.ugoe.cs.eventbench.data.Event;
-
-/**
- * <p>
- * Helper class that can be used to determine if an object is a sequence or a
- * collection of sequences. {@code instanceof} does not work, because of
- * the type erasure of generics.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class SequenceInstanceOf {
-	
-	/**
-	 * <p>
-	 * Private constructor to prevent initializing of the class.
-	 * </p>
-	 */
-	private SequenceInstanceOf() {
-		
-	}
-
-	/**
-	 * <p>
-	 * Checks if an object is of type {@link Collection}&lt;{@link List}&lt;
-	 * {@link Event}&lt;?&gt;&gt;&gt;.
-	 * </p>
-	 * 
-	 * @param obj
-	 *            object that is checked
-	 * @return true, if the obj is of type {@link Collection}&lt;{@link List}
-	 *         &lt; {@link Event}&lt;?&gt;&gt;&gt;; false otherwise
-	 */
-	public static boolean isCollectionOfSequences(Object obj) {
-		try {
-			if (obj instanceof Collection<?>) {
-				Object listObj = ((Collection<?>) obj).iterator().next();
-				if (listObj instanceof List<?>) {
-					if (((List<?>) listObj).iterator().next() instanceof Event<?>) {
-						return true;
-					}
-				}
-			}
-		} catch (NoSuchElementException e) {
-		}
-		return false;
-	}
-
-	/**
-	 * <p>
-	 * Checks if an object is of type {@link List}&lt;{@link Event}
-	 * &lt;?&gt;&gt;.
-	 * </p>
-	 * 
-	 * @param obj
-	 *            object that is checked
-	 * @return true, if obj is of type {@link List}&lt;{@link Event}
-	 *         &lt;?&gt;&gt;; false otherwise
-	 */
-	public static boolean isEventSequence(Object obj) {
-		try {
-			if (obj instanceof List<?>) {
-				if (((List<?>) obj).iterator().next() instanceof Event<?>) {
-					return true;
-				}
-			}
-		} catch (NoSuchElementException e) {
-		}
-		return false;
-	}
-
-}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/Event.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/Event.java	(revision 425)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/Event.java	(revision 1)
@@ -1,39 +1,7 @@
 package de.ugoe.cs.eventbench.data;
 
-import java.io.Serializable;
-import java.security.InvalidParameterException;
 
-/**
- * <p>
- * Base class for all events. An event is described by its {@link #type} and its
- * {@link #target}.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- * 
- * @param <T>
- *            Can be used to declare that events belong to a specific platform
- *            without subclassing.
- */
-public class Event<T> implements Serializable {
 
-	/**
-	 * Id for object serialization.
-	 */
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * <p>
-	 * Global start event that can be used to indicate the start of a sequence.
-	 * </p>
-	 */
-	public static final Event<Object> STARTEVENT = new Event<Object>("START");
-
-	/**
-	 * <p>
-	 * Global end event that can be used to indicate the end of a sequence.
-	 */
-	public static final Event<Object> ENDEVENT = new Event<Object>("END");
+public class Event<T> {
 
 	/**
@@ -42,11 +10,12 @@
 	 * </p>
 	 */
-	protected String type;
-
+	private String type;
+	
 	/**
-	 * </p> Target of the event.
+	 * </p>
+	 * Target of the event.
 	 */
-	protected String target = null;
-
+	private String target = null;
+	
 	/**
 	 * <p>
@@ -54,57 +23,24 @@
 	 * </p>
 	 */
-	protected String targetShort = null;
+	private String targetShort = null;
 
-	/**
-	 * Further information about the event that shall be included in its Id.
-	 */
-	protected String idInfo = "";
 
-	/**
-	 * <p>
-	 * Constructor. Creates a new Event with a given type.
-	 * </p>
-	 * 
-	 * @param type
-	 *            type of the event
-	 */
+	
+
+	private String idInfo = null;
+	
 	public Event(String type) {
-		if (type == null) {
-			throw new InvalidParameterException("Event type must not be null");
-		}
 		this.type = type;
 	}
 
-	/**
-	 * <p>
-	 * Two events are equal, if their {@link #type} and {@link #target} are
-	 * equal.
-	 * </p>
-	 * <p>
-	 * See {@link Object#equals(Object)} for further information.
-	 * </p>
-	 * 
-	 * @param other
-	 *            Event that is compared to this
-	 * @return true, if events are equal, false otherwise
-	 */
 	@Override
 	public boolean equals(Object other) {
-		if (this == other) {
+		if( this==other ) {
 			return true;
 		}
 		if (other instanceof Event<?>) {
-			Event<?> otherEvent = (Event<?>) other;
-			if (otherEvent.canEqual(this)) {
-				if (type != null) {
-					return targetEquals(otherEvent.target)
-							&& type.equals(otherEvent.type);
-				} else {
-					return targetEquals(otherEvent.target)
-							&& otherEvent.type == null;
-				}
-			} else {
-				return false;
-			}
+			Event<?> otherToken = (Event<?>) other;
+			return otherToken.type.equals(this.type)
+					&& otherToken.target.equals(this.target);
 		} else {
 			return false;
@@ -112,69 +48,22 @@
 	}
 
-	public boolean canEqual(Object other) {
-		return (other instanceof Event<?>);
-	}
-
-	/**
-	 * <p>
-	 * Returns {@link #getStandardId()} as String representation of the event.
-	 * </p>
-	 * 
-	 * @return String represenation of the event
-	 */
-	@Override
-	public String toString() {
-		return getStandardId();
-	}
-
-	/**
-	 * Informations about the event important for its Id that is neither target
-	 * nor type.
-	 * 
-	 * @return {@link #idInfo} of the event
-	 */
 	public String getIdInfo() {
 		return idInfo;
 	}
 
-	/**
-	 * <p>
-	 * If {@link #targetShort} is set, a shortend version of the Id is returned
-	 * of the form {@link #targetShort}.{@link #type}.{@link #idInfo} is
-	 * returned. Otherwise the standard Id is returned (see
-	 * {@link #getStandardId()}).
-	 * </p>
-	 * 
-	 * @return if available, shortend Id string; {@link #getStandardId()}
-	 *         otherwise
-	 */
 	public String getShortId() {
 		String shortId = null;
-		if (targetShort != null) {
-			shortId = targetShort + "." + getType();
-			if (!"".equals(idInfo)) {
-				shortId += "." + idInfo;
+		if (targetShort!=null) {
+			shortId = targetShort+"."+getType();
+			if (idInfo!=null) {
+				shortId += "."+idInfo;
 			}
-		} else {
-			shortId = getStandardId();
 		}
 		return shortId;
 	}
 
-	/**
-	 * <p>
-	 * Returns the Id string of the event. It has the form {@link #target}.
-	 * {@link #type}.{@link #idInfo};
-	 * <p>
-	 * 
-	 * @return Id string of the event
-	 */
 	public String getStandardId() {
-		String id = "";
-		if (target != null) {
-			id += target + ".";
-		}
-		id += getType();
-		if (!"".equals(idInfo)) {
+		String id = target + "." + getType();
+		if ( idInfo!=null ) {
 			id += "." + idInfo;
 		}
@@ -182,79 +71,41 @@
 	}
 
-	/**
-	 * <p>
-	 * Returns the {@link #target} of the event.
-	 * </p>
-	 * 
-	 * @return {@link #target} of the event
-	 */
 	public String getTarget() {
 		return target;
 	}
-
-	/**
-	 * <p>
-	 * Returns the {@link #targetShort} of the event.
-	 * </p>
-	 * 
-	 * @return {@link #targetShort} of the event
-	 */
-	protected String getTargetShort() {
+	
+	public String getTargetShort() {
 		return targetShort;
 	}
 
-	/**
-	 * <p>
-	 * Returns the {@link #type} of the event.
-	 * </p>
-	 * 
-	 * @return {@link #type} of the event
-	 */
 	public String getType() {
 		return type;
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#hashCode()
-	 */
 	@Override
 	public int hashCode() {
 		int multiplier = 17;
 		int hash = 42;
-		if (type != null) {
-			hash = multiplier * hash + type.hashCode();
+		hash = multiplier * hash + type.hashCode();
+		if( target!=null ) {
+			hash = multiplier * hash + target.hashCode();
 		}
-		hash = multiplier * hash + targetHashCode();
 
 		return hash;
 	}
 
-	/**
-	 * <p>
-	 * Sets the {@link #idInfo} of the event. The idInfo is optional and
-	 * contains information important for the event's Id that is neither target
-	 * nor type.
-	 * </p>
-	 * 
-	 * @param info
-	 *            {@link #idInfo} of the event
-	 */
 	public void setIdInfo(String info) {
 		idInfo = info;
 	}
-
+	
 	/**
 	 * <p>
 	 * Sets the target of the event. Once set, the target cannot be changed.
-	 * </p>
-	 * 
-	 * @param target
-	 *            target of the event
+	 * </p> 
+	 * @param target target of the event
 	 * @return true, if target was changed, false otherwise
 	 */
 	public boolean setTarget(String target) {
-		if (this.target != null) {
+		if( this.target!=null ) {
 			return false;
 		}
@@ -262,17 +113,14 @@
 		return true;
 	}
-
+	
 	/**
 	 * <p>
-	 * Sets the short description of the event target. Once set, the target
-	 * cannot be changed.
-	 * </p>
-	 * 
-	 * @param targetShort
-	 *            short target description
+	 * Sets the short description of the event target. Once set, the target cannot be changed.
+	 * </p> 
+	 * @param targetShort short target description
 	 * @return true, if target was changed, false otherwise
 	 */
 	public boolean setTargetShort(String targetShort) {
-		if (this.targetShort != null) {
+		if( this.targetShort!=null ) {
 			return false;
 		}
@@ -280,48 +128,3 @@
 		return true;
 	}
-
-	/**
-	 * <p>
-	 * This function is used by {@link #equals(Object)} to determine if the
-	 * targets of both events are equal. The standard implementation provided by
-	 * this class performs a String comparison between the target strings.
-	 * </p>
-	 * <p>
-	 * Subclasses can override this method to implemented more sophisticated
-	 * means for the target comparison, e.g., to account for changes in the
-	 * title of a widget.
-	 * </p>
-	 * 
-	 * @param otherTarget
-	 *            other target string to which the target if this event is
-	 *            compared to
-	 * @return true if the targets are equals; false otherwise
-	 */
-	protected boolean targetEquals(String otherTarget) {
-		boolean retVal;
-		if (target != null) {
-			retVal = target.equals(otherTarget);
-		} else {
-			retVal = (otherTarget == null);
-		}
-		return retVal;
-	}
-
-	/**
-	 * <p>
-	 * This function is used by {@link #hashCode()} to determine how the hash of
-	 * the {@link #target}. It has to be overridden by subclasses that implement
-	 * {@link #targetEquals(String)}, to ensure that the equals/hashCode
-	 * contract remains valid.
-	 * </p>
-	 * 
-	 * @return hash of the target
-	 */
-	protected int targetHashCode() {
-		if (target != null) {
-			return target.hashCode();
-		} else {
-			return 0;
-		}
-	}
 }
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/IReplayable.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/IReplayable.java	(revision 425)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/IReplayable.java	(revision 1)
@@ -1,35 +1,8 @@
 package de.ugoe.cs.eventbench.data;
 
-import java.io.Serializable;
-
-/**
- * <p>
- * This interface is used by {@link ReplayableEvent}to describe how events can
- * be replayed. It can be used to define a sequence of fine-grained platform
- * events that make up an abstract event.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public interface IReplayable extends Serializable {
-
-	/**
-	 * <p>
-	 * Returns a string to be written to the replay script that describes the
-	 * replayable platform event.
-	 * </p>
-	 * 
-	 * @return string for the replay script
-	 */
-	String getReplay();
-
-	/**
-	 * <p>
-	 * Returns the target of the replayable.
-	 * </p>
-	 * 
-	 * @return target of the replayable
-	 */
+public interface IReplayable {
+	
+	String getReplayXml();
+	
 	String getTarget();
 }
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/ReplayableEvent.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/ReplayableEvent.java	(revision 425)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/ReplayableEvent.java	(revision 1)
@@ -1,167 +1,46 @@
 package de.ugoe.cs.eventbench.data;
 
-import java.security.InvalidParameterException;
 import java.util.LinkedList;
 import java.util.List;
 
-import de.ugoe.cs.eventbench.IReplayDecorator;
-
-/**
- * <p>
- * Subclass of {@link Event} for events that contain all informations required
- * for replaying them, i.e., generating scripts that can used for automated
- * software execution.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- * 
- * @param <T>
- *            Allows only types that extend {@link IReplayable} and is used to
- *            define a list of replayables that describe the replay of the
- *            event.
- */
 public class ReplayableEvent<T extends IReplayable> extends Event<T> {
 
-	/**
-	 * Id for object serialization.
-	 */
-	private static final long serialVersionUID = 1L;
+	private List<T> replayEvents = new LinkedList<T>();;
 
-	/**
-	 * <p>
-	 * List of {@link IReplayable}s of type T that describes the replay of an
-	 * event. The {@link IReplayable}s can be interpreted as <it>sub-events</it>
-	 * on the platform level that make up the abstract event.
-	 * </p>
-	 */
-	protected List<T> replayEvents = new LinkedList<T>();;
-
-	/**
-	 * <p>
-	 * Defines whether the replay is valid or invalid. It may be invalid, e.g.,
-	 * due to errors during the generation of the event or lack of vital
-	 * information.
-	 * </p>
-	 */
-	protected boolean replayValid = true;
-
-	/**
-	 * <p>
-	 * {@link IReplayDecorator} used when replays of this type are written.
-	 * </p>
-	 */
-	protected IReplayDecorator decorator = null;
-
-	/**
-	 * <p>
-	 * Constructor. Creates a new event with the given type.
-	 * <p>
-	 * 
-	 * @param type
-	 *            type of the event
-	 * @see Event#Event(String)
-	 */
+	private boolean replayValid = true;
+	
 	public ReplayableEvent(String type) {
 		super(type);
 	}
-
-	/**
-	 * <p>
-	 * Adds a new {@link IReplayable} of type T to the replay sequence.
-	 * </p>
-	 * 
-	 * @param replayable
-	 *            element that is added to the sequence
-	 * @throws InvalidParameterException
-	 *             thrown is replayable is null
-	 */
-	public void addReplayEvent(T replayable) {
-		if (replayable == null) {
-			throw new InvalidParameterException("replayble must not be null");
-		}
-		replayEvents.add(replayable);
-	}
-
-	/**
-	 * <p>
-	 * Adds a {@link List}ist of {@link IReplayable} to the replay sequence.
-	 * </p>
-	 * 
-	 * @param generatedReplaySeq
-	 *            {@link List} that is added to the sequence
-	 * @throws InvalidParameterException
-	 *             thrown if generatedReplaySeq is null
-	 */
+	
 	public void addReplaySequence(List<T> generatedReplaySeq) {
-		if (generatedReplaySeq == null) {
-			throw new InvalidParameterException(
-					"generatedReplaySeq must not be null");
-		}
 		replayEvents.addAll(generatedReplaySeq);
 	}
 
-	/**
-	 * <p>
-	 * Returns the {@link IReplayDecorator} of the event.
-	 * </p>
-	 * 
-	 * @return {@link IReplayDecorator} of the event; null if no decorator has
-	 *         been set
-	 */
-	public IReplayDecorator getReplayDecorator() {
-		return decorator;
+	public void addReplayEvent(T replayable) {
+		replayEvents.add(replayable);
 	}
-
+	
 	/**
 	 * <p>
 	 * Returns a the list of replay events.
-	 * </p>
+	 * </p> 
 	 * <p>
 	 * The return value is a copy of the list used internally!
 	 * </p>
-	 * 
-	 * @return list of replay events.
+	 * @return list of replay events. 
 	 */
 	public List<T> getReplayMessages() {
 		return new LinkedList<T>(replayEvents);
 	}
-
-	/**
-	 * <p>
-	 * Returns whether the replay is valid or not.
-	 * </p>
-	 * 
-	 * @return true, if replay is valid; false otherwise.
-	 */
+	
 	public boolean hasValidReplay() {
 		return replayValid;
 	}
 
-	/**
-	 * <p>
-	 * Marks the replay as invalid. Once marked as invalid, it remains so and
-	 * cannot be changed back to valid.
-	 * </p>
-	 */
 	public void invalidateReplay() {
 		replayValid = false;
 	}
 
-	/**
-	 * <p>
-	 * Sets the {@link IReplayDecorator} associated with the event.
-	 * </p>
-	 * 
-	 * @param decorator
-	 *            decorator associated with the event
-	 */
-	public void setDecorator(IReplayDecorator decorator) {
-		this.decorator = decorator;
-	}
-	
-	@Override
-	public boolean canEqual(Object other) {
-		return (other instanceof ReplayableEvent<?>);
-	}
+
 }
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/DotPrinter.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/DotPrinter.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/DotPrinter.java	(revision 1)
@@ -0,0 +1,5 @@
+package de.ugoe.cs.eventbench.markov;
+
+public interface DotPrinter {
+	public abstract void printDot();
+}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/IMemory.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/IMemory.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/IMemory.java	(revision 1)
@@ -0,0 +1,40 @@
+package de.ugoe.cs.eventbench.markov;
+
+import java.util.List;
+
+/**
+ * <p>
+ * This interface defines basic functions for classes that implement a memory
+ * about the recent events of a sequences.
+ * </p>
+ * 
+ * @author Steffen Herbold
+ * @version 1.0
+ * 
+ * @param <T>
+ *            Type of the sequence elements that are memorized.
+ */
+public interface IMemory<T> {
+
+	/**
+	 * Adds an element to the end of the memory.
+	 * 
+	 * @param element
+	 *            Element to be added.
+	 */
+	public void add(T element);
+
+	/**
+	 * <p>
+	 * Returns the last <code>num</code> memorized elements. If the history is
+	 * shorter than <code>num</code>, the length of the returned
+	 * {@link java.util.List} may be less than <code>num</code>.
+	 * </p>
+	 * 
+	 * @param num
+	 *            Number of states from the end of the memory to be returned.
+	 * @return {@link java.util.List} of memorized elements.
+	 */
+	public List<T> getLast(int num);
+
+}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/IncompleteMemory.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/IncompleteMemory.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/IncompleteMemory.java	(revision 1)
@@ -0,0 +1,33 @@
+package de.ugoe.cs.eventbench.markov;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class IncompleteMemory<T> implements IMemory<T> {
+
+	private int length;
+	
+	private List<T> history;
+	
+	public IncompleteMemory(int length) {
+		this.length = length;
+		history = new LinkedList<T>();
+	}
+	
+	@Override
+	public void add(T state) {
+		if( history.size()==length ) {
+			history.remove(0);
+		}
+		history.add(state);
+	}
+
+	@Override
+	public List<T> getLast(int num) {
+		return new LinkedList<T>(history); // defensive copy
+	}
+
+	public int getLength() {
+		return history.size();
+	}
+}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/MarkovModel.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/MarkovModel.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/MarkovModel.java	(revision 1)
@@ -0,0 +1,242 @@
+package de.ugoe.cs.eventbench.markov;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+
+import Jama.Matrix;
+
+import de.ugoe.cs.eventbench.data.Event;
+import de.ugoe.cs.util.console.Console;
+import edu.uci.ics.jung.graph.Graph;
+import edu.uci.ics.jung.graph.SparseMultigraph;
+import edu.uci.ics.jung.graph.util.EdgeType;
+
+public class MarkovModel implements DotPrinter {
+
+	private State initialState;
+	private State endState;
+	
+	private List<State> states;
+	private List<String> stateIdList;
+	
+	private Random r;
+	
+	final static int MAX_STATDIST_ITERATIONS = 1000;
+	
+	/**
+	 * <p>
+	 * Default constructor. Creates a new random number generator.
+	 * </p>
+	 */
+	public MarkovModel() {
+		this(new Random());
+	}
+	
+	/**
+	 * <p>
+	 * Creates a new {@link MarkovModel} with a predefined random number generator.
+	 * </p>
+	 * 
+	 * @param r random number generator
+	 */
+	public MarkovModel(Random r) {
+		this.r = r; // defensive copy would be better, but constructor Random(r) does not seem to exist.
+	}
+	
+	public void printRandomWalk() {
+		State currentState = initialState;
+		IMemory<State> history = new IncompleteMemory<State>(5); // this is NOT used here, just for testing ...
+		history.add(currentState);
+		Console.println(currentState.getId());
+		while(!currentState.equals(endState)) {
+			currentState = currentState.getNextState();
+			Console.println(currentState.getId());
+			history.add(currentState);
+		}
+	}
+	
+	public List<? extends Event<?>> randomSequence() {
+		List<Event<?>> sequence = new LinkedList<Event<?>>();
+		State currentState = initialState;
+		if( currentState.getAction()!=null ) {
+			sequence.add(currentState.getAction());
+		}
+		System.out.println(currentState.getId());
+		while(!currentState.equals(endState)) {
+			currentState = currentState.getNextState();
+			if( currentState.getAction()!=null ) {
+				sequence.add(currentState.getAction());
+			}
+			System.out.println(currentState.getId());
+		}
+		return sequence;
+	}
+	
+	public void printDot() {
+		int numUnprintableStates = 0;
+		System.out.println("digraph model {");
+		for( State state : states ) {
+			if( state instanceof DotPrinter ) {
+				((DotPrinter) state).printDot();
+			} else {
+				numUnprintableStates++;
+			}
+		}
+		System.out.println('}');
+		if( numUnprintableStates>0 ) {
+			Console.println("" + numUnprintableStates + "/" + states.size() + "were unprintable!");
+		}
+	}
+	
+	public Graph<String, MarkovEdge> getGraph() {
+		Graph<String, MarkovEdge> graph = new SparseMultigraph<String, MarkovEdge>();
+		
+		for( State state : states) {
+			try {
+				SimpleState simpleState = (SimpleState) state;
+				String from = simpleState.getShortId();
+				for( int i=0 ; i<simpleState.toStates.size() ; i++ ) {
+					SimpleState toState = (SimpleState) simpleState.toStates.get(i);
+					String to = toState.getShortId();
+					MarkovEdge prob = new MarkovEdge(simpleState.transitionProbs.get(i));
+					graph.addEdge(prob, from, to, EdgeType.DIRECTED);
+				}
+			} catch (ClassCastException e) {
+				// TODO: handle exception
+			}
+		}
+		
+		return graph;
+	}
+	
+	static public class MarkovEdge {
+		double weight;
+		MarkovEdge(double weight) { this.weight = weight; }
+		public String toString() { return ""+weight; }
+	}
+	
+	/////////////////////////////////////////////////////////////////////////////////////
+	// Code to learn type1 model: states are wndid.action and transitions are unlabled //
+	/////////////////////////////////////////////////////////////////////////////////////
+	
+	public void train(List<List<Event<?>>> sequences) {
+		Event<?> fromElement = null;
+		Event<?> toElement = null;
+		SimpleState fromState;
+		SimpleState toState;
+		
+		states = new ArrayList<State>();
+		stateIdList = new ArrayList<String>();
+		initialState = new SimpleState("GLOBALSTARTSTATE", null);
+		initialState.setRandom(r);
+		states.add(initialState);
+		stateIdList.add("GLOBALSTARTSTATE");
+		endState = new SimpleState("GLOBALENDSTATE", null);
+		endState.setRandom(r);
+		states.add(endState);
+		stateIdList.add("GLOBALENDSTATE");
+		for( List<Event<?>> sequence : sequences ) {
+			for( int i=0; i<sequence.size() ; i++ ) {
+				if( i==0 ) {
+					fromState = (SimpleState) initialState;
+				} else {
+					fromElement = sequence.get(i-1);
+					fromState = findOrCreateSimpleState(fromElement);
+				}
+				
+				toElement = sequence.get(i);
+				toState = findOrCreateSimpleState(toElement);
+				
+				fromState.incTransTo(toState);
+				
+				if( i==sequence.size()-1 ) {
+					toState.incTransTo(endState);
+				}
+			}
+		}
+	}
+	
+	private SimpleState findOrCreateSimpleState(Event<?> action) {
+		SimpleState state = null;
+		String id = action.getStandardId();
+		String idShort = action.getShortId();
+		int index = stateIdList.indexOf(id);
+		if( index!=-1 ) {
+			state = (SimpleState) states.get(index);
+		} else {
+			state = new SimpleState(id, action, idShort);
+			state.setRandom(r);
+			states.add(state);
+			stateIdList.add(id);
+		}
+		return state;
+	}
+	
+	///////////////////////////////////////////////////////////
+	
+	// states must be SimpleState, this functions will throw bad cast exceptions
+	public double calcEntropy() {
+		int numStates = states.size();
+		// create transmission matrix
+		Matrix transmissionMatrix = new Matrix(numStates, numStates);
+		for( int i=0 ; i<numStates ; i++ ) {
+			State tmpState = states.get(i);
+			if( SimpleState.class.isInstance(tmpState) ) {
+				SimpleState currentState = (SimpleState) tmpState;
+				for( int j=0 ; j<numStates ; j++ ) {
+					double prob = currentState.getProb(states.get(j));
+					transmissionMatrix.set(i, j, prob);
+				}
+			} else {
+				Console.printerr("Error calculating entropy. Only allowed for first-order markov models.");
+				return Double.NaN;
+			}
+		}
+		
+		// Add transition from endState to startState. This makes the markov chain irreducible and recurrent. 
+		int startStateIndex = states.indexOf(initialState);
+		int endStateIndex = states.indexOf(endState);
+		if( startStateIndex==-1 ) {
+			Console.printerrln("Error calculating entropy. Initial state of markov chain not found.");
+			return Double.NaN;
+		}
+		if( endStateIndex==-1 ) {
+			Console.printerrln("Error calculating entropy. End state of markov chain not found.");
+			return Double.NaN;
+		}
+		transmissionMatrix.set(endStateIndex, startStateIndex, 1);
+		
+		// Calculate stationary distribution by raising the power of the transmission matrix.
+		// The rank of the matrix should fall to 1 and each two should be the vector of the
+		// stationory distribution. 
+		int iter = 0;
+		int rank = transmissionMatrix.rank();
+		Matrix stationaryMatrix = (Matrix) transmissionMatrix.clone();
+		while( iter<MAX_STATDIST_ITERATIONS && rank>1 ) {
+			stationaryMatrix = stationaryMatrix.times(stationaryMatrix);
+			rank = stationaryMatrix.rank();
+			iter++;
+		}
+		
+		if( rank!=1 ) {
+			Console.traceln("rank: " + rank);
+			Console.printerrln("Unable to calculate stationary distribution.");
+			return Double.NaN;
+		}
+		
+		double entropy = 0.0;
+		for( int i=0 ; i<numStates ; i++ ) {
+			for( int j=0 ; j<numStates ; j++ ) {
+				if( transmissionMatrix.get(i,j)!=0 ) {
+					double tmp = stationaryMatrix.get(i, 0);
+					tmp *= transmissionMatrix.get(i, j);
+					tmp *= Math.log(transmissionMatrix.get(i,j))/Math.log(2);
+					entropy -= tmp;
+				}
+			}
+		}
+		return entropy;
+	}
+}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/SimpleState.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/SimpleState.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/SimpleState.java	(revision 1)
@@ -0,0 +1,100 @@
+package de.ugoe.cs.eventbench.markov;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.ugoe.cs.eventbench.data.Event;
+
+
+/**
+ * This class implements a simple first-order markov state. 
+ * Transitions are unlabled.
+ * @author Steffen Herbold
+ */
+public class SimpleState extends State implements DotPrinter {
+	
+	List<Double> transitionProbs;
+	List<State> toStates;
+	
+	// members for learning
+	private int transitionsObserved;
+	
+	private String idShort = null;
+	
+	public SimpleState(String id, Event<?> action) {
+		super(id, action);
+		transitionsObserved = 0;
+		toStates = new ArrayList<State>();
+		transitionProbs = new ArrayList<Double>();
+	}
+	
+	public SimpleState(String id, Event<?> action, String idShort) {
+		this(id, action);
+		this.idShort = idShort;
+	}
+	
+	@Override
+	public State getNextState() {
+		double randVal = rand.nextDouble();
+		double probSum = 0;
+		int index = 0;
+		while( index<transitionProbs.size() && probSum+transitionProbs.get(index) < randVal ) {
+			probSum += transitionProbs.get(index);
+			index++;
+		}
+		return toStates.get(index);
+	}
+	
+	public void incTransTo(State state) {
+		int index = toStates.indexOf(state);
+		if( index==-1 ) {
+			toStates.add(state);
+			transitionProbs.add(0.0);
+			index = toStates.size()-1;
+		}
+		// update trans probs
+		for( int i=0 ; i<toStates.size() ; i++ ) {
+			double currentProb = transitionProbs.get(i);
+			double newProb = 0.0;
+			if( i!=index ) {
+				newProb = (currentProb*transitionsObserved)/(transitionsObserved+1);
+			} else {
+				newProb = ((currentProb*transitionsObserved)+1)/(transitionsObserved+1);
+			}
+			transitionProbs.set(i, newProb);
+		}
+		transitionsObserved++;
+	}
+	
+	// get the transition probability to the given state
+	public double getProb(State state) {
+		double prob = 0.0;
+		int index = toStates.indexOf(state);
+		if( index>=0 ) {
+			prob = transitionProbs.get(index);
+		}
+		return prob;
+	}
+	
+	public String getShortId() {
+		String shortId;
+		if( idShort!=null ) {
+			shortId = idShort;
+		} else {
+			shortId = getId();
+		}
+		return shortId;
+	}
+
+	@Override
+	public void printDot() {
+		final String thisSaneId = getShortId().replace("\"", "\\\"").replaceAll("[\r\n]","");
+		System.out.println(" " + hashCode() + " [label=\""+thisSaneId+"\"];");
+		for(int i=0 ; i<toStates.size() ; i++ ) {
+			System.out.print(" "+hashCode()+" -> " + toStates.get(i).hashCode() + " ");
+			System.out.println("[label=\"" + transitionProbs.get(i) + "\"];");
+		}
+		
+	}
+	
+}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/State.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/State.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/markov/State.java	(revision 1)
@@ -0,0 +1,97 @@
+package de.ugoe.cs.eventbench.markov;
+
+import java.util.Random;
+
+import de.ugoe.cs.eventbench.data.Event;
+
+public abstract class State {
+	
+	/**
+	 * {@link Event} associated with the state. 
+	 */
+	private Event<?> action;
+	
+	/**
+	 * Identifier of the state
+	 */
+	private String id;
+	
+	/**
+	 * Random number generator used for state transmissions. 
+	 */
+	protected Random rand;
+	
+	/**
+	 * State transmission function to be used by models. 
+	 * @return
+	 */
+	public abstract State getNextState();
+	
+	/**
+	 * Creates a new State object. The id should be unique.
+	 * @param id identifier string of the state
+	 */
+	protected State(String id, Event<?> action) {
+		this.id = id;
+		this.action = action;
+	}
+
+	/**
+	 * Dummy method for history-less state implementations.
+	 */
+	public void setHistoryObject() {}
+	
+	/**
+	 * Defines a random number generator to be used by getNextState.
+	 * @param r Random number generator
+	 */
+	public void setRandom(Random r) {
+		rand = r;
+	}
+	
+	/**
+	 * Returns the id of the state. 
+	 * @return id of the state
+	 */
+	public String getId() {
+		return id;
+	}
+	
+	/**
+	 * The {@link Event} associated with this state. 
+	 * @return {@link Event} associated with this state
+	 */
+	public Event<?> getAction() {
+		return action;
+	}
+	
+	/**
+	 * Two states are equal if their id string is equal.
+	 */
+	@Override
+	public boolean equals(Object other) {
+		if( other==this ) {
+			return true;
+		}
+		boolean isEqual = false;
+		if( other instanceof State ) {
+			isEqual = id.equals(((State) other).id);
+		}
+		return isEqual;
+	}
+	
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		int multiplier = 37;
+		int hash = 42;
+		
+		hash = multiplier*hash + id.hashCode();
+		
+		return hash;
+	}
+	
+}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/PredictionByPartialMatch.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/PredictionByPartialMatch.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/PredictionByPartialMatch.java	(revision 1)
@@ -0,0 +1,106 @@
+package de.ugoe.cs.eventbench.ppm;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+
+import de.ugoe.cs.eventbench.data.Event;
+import de.ugoe.cs.eventbench.markov.IncompleteMemory;
+import de.ugoe.cs.util.console.Console;
+
+public class PredictionByPartialMatch {
+	
+	private String initialSymbol = "GLOBALSTARTSTATE";
+	private String endSymbol = "GLOBALENDSTATE";
+	
+	private int maxOrder = 3;
+	
+	private Trie<String> trie;
+	
+	private Set<String> knownSymbols;
+	
+	// the training is basically the generation of the trie
+	public void train(List<List<Event<?>>> sequences) {
+		trie = new Trie<String>();
+		knownSymbols = new LinkedHashSet<String>();
+		knownSymbols.add(initialSymbol);
+		knownSymbols.add(endSymbol);
+		
+		for(List<Event<?>> sequence : sequences) {
+			IncompleteMemory<String> latestActions = new IncompleteMemory<String>(maxOrder); // TODO need to check if it should be maxOrder+1
+			latestActions.add(initialSymbol);
+			for(Event<?> currentAction : sequence) {
+				String currentId = currentAction.getStandardId();
+				latestActions.add(currentId);
+				knownSymbols.add(currentId);
+				if( latestActions.getLength()==maxOrder ) { // FIXME needs special case for sequences shorter than maxOrder
+					trie.add(latestActions.getLast(maxOrder));
+				}
+			}
+			latestActions.add(endSymbol);
+			if( latestActions.getLength()==maxOrder ) { // FIXME needs special case for sequences shorter than maxOrder
+				trie.add(latestActions.getLast(maxOrder));
+			}
+		}
+	}
+	
+	public void printRandomWalk(Random r) {
+		IncompleteMemory<String> context = new IncompleteMemory<String>(maxOrder-1);
+		
+		context.add(initialSymbol);
+		
+		String currentState = initialSymbol;
+		
+		Console.println(currentState);
+		while(!endSymbol.equals(currentState)) {
+			double randVal = r.nextDouble();
+			double probSum = 0.0;
+			List<String> currentContext = context.getLast(maxOrder);
+			for( String symbol : knownSymbols ) {
+				probSum += getProbability(currentContext, symbol);
+				if( probSum>=randVal ) {
+					currentContext.add(symbol);
+					currentState = symbol;
+					Console.println(currentState);
+					break;
+				}
+			}
+		}
+	}
+	
+	private double getProbability(List<String> context, String symbol) {
+		double result = 0.0; 
+		int countContextSymbol = 0;
+		List<String> contextSuffix = trie.getContextSuffix(context);
+		if( contextSuffix.isEmpty() ) {
+			result = 1.0d / knownSymbols.size(); 
+		} else {
+			countContextSymbol = trie.getCount(contextSuffix, symbol);
+			List<String> followers = trie.getFollowingSymbols(contextSuffix);
+			int countContextFollowers = 0;
+			for( String follower : followers ) {
+				countContextFollowers += trie.getCount(contextSuffix, follower);
+			}
+			
+			if( followers.isEmpty() ) {
+				throw new AssertionError("Invalid return value of getContextSuffix!");
+			}
+			if( countContextSymbol!=0 ) {
+				result = ((double) countContextSymbol) / (followers.size()+countContextFollowers);
+			} else { // escape
+				double probEscape = ((double) followers.size()) / (followers.size()+countContextFollowers);
+				contextSuffix.remove(0);
+				double probSuffix = getProbability(contextSuffix, symbol);
+				result = probEscape*probSuffix;
+			}
+		}
+
+		return result;
+	}
+	
+	@Override
+	public String toString() {
+		return trie.toString();
+	}
+}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/Trie.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/Trie.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/Trie.java	(revision 1)
@@ -0,0 +1,100 @@
+package de.ugoe.cs.eventbench.ppm;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class Trie<T> {
+	
+	private List<TrieNode<T>> children = new LinkedList<TrieNode<T>>();
+	
+
+	public void add(List<T> subsequence) {
+		if( !subsequence.isEmpty() ) {
+			subsequence = new LinkedList<T>(subsequence);  // copy list!
+			T firstSymbol = subsequence.get(0);
+			getChildCreate(firstSymbol).add(subsequence);
+		}
+	}
+
+	// FIXME clones of TrieNode.getChildCreate
+	protected TrieNode<T>  getChildCreate(T symbol) {
+		TrieNode<T> node = getChild(symbol);
+		if( node==null ) {
+			node = new TrieNode<T>(symbol);
+			children.add(node);
+		}
+		return node;
+	}
+	
+	// FIXME clones of TrieNode.getChild
+	protected TrieNode<T> getChild(T symbol) {
+		for( TrieNode<T> child : children ) {
+			if( child.getSymbol().equals(symbol) ) {
+				return child;
+			}
+		}
+		return null;
+	}
+
+	public int getCount(List<T> sequence) {
+		int count = 0;
+		TrieNode<T> node = find(sequence);
+		if( node!=null ) {
+			count = node.getCount();
+		}
+		return count;
+	}
+	
+	public int getCount(List<T> sequence, T follower) {
+		List<T> tmpSequence = new LinkedList<T>(sequence);
+		tmpSequence.add(follower);
+		return getCount(tmpSequence);
+		
+	}
+	
+	public TrieNode<T> find(List<T> sequence) {
+		TrieNode<T> result = null;
+		if( !sequence.isEmpty() ) {
+			TrieNode<T> node = getChild(sequence.get(0));
+			if( node!=null ) {
+				result = node.find(sequence);
+			}
+		}
+		return result;
+	}
+	
+	public List<T> getFollowingSymbols(List<T> sequence) {
+		List<T> result = null;
+		TrieNode<T> node = find(sequence);
+		if( node!=null ) {
+			result = node.getFollowingSymbols();
+		}
+		return result;
+	}
+	
+	public List<T> getContextSuffix(List<T> context) {
+		List<T> contextSuffix = new LinkedList<T>(context);
+		boolean suffixFound = false;
+		
+		while(!suffixFound) {
+			if( contextSuffix.isEmpty() ) {
+				suffixFound = true; // suffix is the empty word
+			} else {
+				TrieNode<T> node = find(contextSuffix);
+				if( node!=null ) {
+					if( !node.getFollowingSymbols().isEmpty() ) {
+						suffixFound = true;
+					}
+				}
+				contextSuffix.remove(0);
+			}
+		}
+		
+		return contextSuffix;
+	}
+	
+	@Override
+	public String toString() {
+		return children.toString();
+	}
+}
Index: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/TrieNode.java
===================================================================
--- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/TrieNode.java	(revision 1)
+++ trunk/EventBenchCore/src/de/ugoe/cs/eventbench/ppm/TrieNode.java	(revision 1)
@@ -0,0 +1,99 @@
+package de.ugoe.cs.eventbench.ppm;
+
+import java.security.InvalidParameterException;
+import java.util.LinkedList;
+import java.util.List;
+
+import de.ugoe.cs.util.StringTools;
+
+
+class TrieNode<T> {
+	
+	private int count;
+	private final T symbol;
+	
+	private List<TrieNode<T>> children;
+	
+	public TrieNode(T symbol) {
+		if( symbol==null ) {
+			throw new InvalidParameterException("symbol must not be null.");
+		}
+		this.symbol = symbol;
+		count = 0;
+		children = new LinkedList<TrieNode<T>>();
+	}
+
+	public void add(List<T> subsequence) {
+		if( !subsequence.isEmpty() ) {
+			if( !symbol.equals(subsequence.get(0)) ) { // should be guaranteed by the recursion/TrieRoot!
+				throw new AssertionError("Invalid trie operation!");
+			}
+			count++;
+			subsequence.remove(0);
+			if( !subsequence.isEmpty() ) {
+				T nextSymbol = subsequence.get(0);
+				getChildCreate(nextSymbol).add(subsequence);
+			}
+		}
+	}
+	
+	public T getSymbol() {
+		return symbol;
+	}
+	
+	public int getCount() {
+		return count;
+	}
+	
+	protected TrieNode<T>  getChildCreate(T symbol) {
+		TrieNode<T> node = getChild(symbol);
+		if( node==null ) {
+			node = new TrieNode<T>(symbol);
+			children.add(node);
+		}
+		return node;
+	}
+	
+	protected TrieNode<T> getChild(T symbol) {
+		for( TrieNode<T> child : children ) {
+			if( child.getSymbol().equals(symbol) ) {
+				return child;
+			}
+		}
+		return null;
+	}
+	
+
+	
+	public TrieNode<T> find(List<T> subsequence) {
+		TrieNode<T> result = null;
+		if( subsequence.isEmpty() ) {
+			result = this;
+		} else {
+			TrieNode<T> node = getChild(subsequence.get(0));
+			if( node!=null ) {
+				subsequence.remove(0);
+				result = node.find(subsequence);
+			}
+		}
+		return result;
+	}
+	
+	public List<T> getFollowingSymbols() {
+		List<T> followingSymbols = new LinkedList<T>();
+		for( TrieNode<T> child : children ) {
+			followingSymbols.add(child.getSymbol());
+		}
+		return followingSymbols;
+	}
+	
+	@Override
+	public String toString() {
+		String str = symbol.toString()+" #"+count;
+		if( !children.isEmpty() ) {
+			str += StringTools.ENDLINE + children.toString();
+		}
+		return str; 
+	}
+
+}
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/ArrayTools.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/ArrayTools.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/ArrayTools.java	(revision 1)
@@ -1,47 +1,27 @@
 package de.ugoe.cs.util;
 
-/**
- * <p>
- * Helper class that provides methods to simplify working with arrays.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
 final public class ArrayTools {
-
+	
 	/**
 	 * <p>
-	 * Private constructor to prevent initializing of the class.
-	 * </p>
-	 */
-	private ArrayTools() {
-
-	}
-
-	/**
-	 * <p>
-	 * Finds the first occurrence of an object inside an array.
+	 * Finds the first occurence of an object inside an array.
 	 * </p>
 	 * <p>
-	 * In case {@code other==null}, the first occurrence of a {@code null} value
-	 * in the array is returned.
+	 * In case {@code other==null}, the first occurence of a {@code null} value in the array is returned.
 	 * </p>
-	 * 
-	 * @param array
-	 *            the array
-	 * @param other
-	 *            the object
+	 *  
+	 * @param array the array
+	 * @param other the object
 	 * @return index of the object if found, -1 otherwise
 	 */
 	public static int findIndex(Object[] array, Object other) {
 		int retVal = -1;
-		for (int i = 0; i < array.length && retVal == -1; i++) {
-			if (other != null) {
-				if (array[i] != null && array[i].equals(other)) {
+		for( int i=0 ; i<array.length && retVal==-1 ; i++ ) {
+			if( other!=null ) {
+				if( array[i]!=null && array[i].equals(other) ) {
 					retVal = i;
 				}
 			} else {
-				if (array[i] == null) {
+				if( array[i]==null ) {
 					retVal = i;
 				}
@@ -50,67 +30,3 @@
 		return retVal;
 	}
-
-	/**
-	 * <p>
-	 * Finds the highest element in an array. If multiple elements have the
-	 * maximum value, the index of the first one is returned; null-values are
-	 * ignored. In case the parameter array is null, has length 0 or contains
-	 * only null-values, -1 is returned.
-	 * </p>
-	 * 
-	 * @param <T>
-	 * @param array
-	 *            the array
-	 * @return index of the element with the highest value, -1 in case of an
-	 *         invalid parameter
-	 */
-	@SuppressWarnings("unchecked")
-	public static <T> int findMax(Comparable<T>[] array) {
-		int maxIndex = -1;
-		T maxElement = null;
-		if (array != null) {
-			for (int i = 0; i < array.length; i++) {
-				if (array[i] != null) {
-					if (maxElement == null
-							|| array[i].compareTo(maxElement) > 0) {
-						maxElement = (T) array[i];
-						maxIndex = i;
-					}
-				}
-			}
-		}
-		return maxIndex;
-	}
-
-	/**
-	 * <p>
-	 * Finds the lowest element in an array. If multiple elements have the
-	 * minimal value, the index of the first one is returned; null-values are
-	 * ignored. In case the parameter array is null, has length 0 or contains
-	 * only null-values, -1 is returned.
-	 * </p>
-	 * 
-	 * @param <T>
-	 * @param array
-	 *            the array
-	 * @return index of the element with the lowest value, -1 in case of an
-	 *         invalid parameter
-	 */
-	@SuppressWarnings("unchecked")
-	public static <T> int findMin(Comparable<T>[] array) {
-		int maxIndex = -1;
-		T maxElement = null;
-		if (array != null) {
-			for (int i = 0; i < array.length; i++) {
-				if (array[i] != null) {
-					if (maxElement == null
-							|| array[i].compareTo(maxElement) < 0) {
-						maxElement = (T) array[i];
-						maxIndex = i;
-					}
-				}
-			}
-		}
-		return maxIndex;
-	}
 }
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/FileTools.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/FileTools.java	(revision 425)
+++ 	(revision )
@@ -1,88 +1,0 @@
-package de.ugoe.cs.util;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-
-/**
- * <p>
- * Helper class that provides methods that simplify working with files.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class FileTools {
-
-	/**
-	 * <p>
-	 * Private constructor to prevent initializing of the class.
-	 * </p>
-	 */
-	private FileTools() {
-
-	}
-
-	/**
-	 * <p>
-	 * Returns an array of the lines contained in a file. The line separator is
-	 * {@link StringTools#ENDLINE}.
-	 * </p>
-	 * 
-	 * @param filename
-	 *            name of the file
-	 * @return string array, where each line contains a file
-	 * @throws IOException
-	 *             see {@link FileReader#read(char[])},
-	 *             {@link FileReader#close()}
-	 * @throws FileNotFoundException
-	 *             see {@link FileReader#FileReader(File)}
-	 */
-	public static String[] getLinesFromFile(String filename)
-			throws IOException, FileNotFoundException {
-		boolean carriageReturn = true;
-		if( StringTools.ENDLINE.equals("\n") ) {
-			carriageReturn = false;
-		}
-		return getLinesFromFile(filename, carriageReturn);
-	}
-
-	/**
-	 * <p>
-	 * Returns an array of the lines contained in a file.
-	 * </p>
-	 * 
-	 * @param filename
-	 *            name of the file
-	 * @param carriageReturn
-	 *            if true, "\r\n", if false "\n" is used as line separator
-	 * @return string array, where each line contains a file
-	 * @throws IOException
-	 *             see {@link FileReader#read(char[])},
-	 *             {@link FileReader#close()}
-	 * @throws FileNotFoundException
-	 *             see {@link FileReader#FileReader(File)}
-	 */
-	public static String[] getLinesFromFile(String filename,
-			boolean carriageReturn) throws IOException, FileNotFoundException {
-		File f = new File(filename);
-		FileInputStream fis = new FileInputStream(f);
-		InputStreamReader reader = new InputStreamReader(fis,
-				Charset.defaultCharset());
-		char[] buffer = new char[(int) f.length()];
-		reader.read(buffer);
-		reader.close();
-		String splitString;
-		if (carriageReturn) {
-			splitString = "\r\n";
-		} else {
-			splitString = "\n";
-		}
-		return (new String(buffer)).split(splitString);
-	}
-
-}
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/StringTools.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/StringTools.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/StringTools.java	(revision 1)
@@ -1,52 +1,27 @@
 package de.ugoe.cs.util;
 
-/**
- * <p>
- * Helper class that provides methods to simplify working with {@link String}s.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
 final public class StringTools {
 
+	public final static String ENDLINE = System.getProperty("line.separator");
+	
 	/**
 	 * <p>
-	 * Private constructor to prevent initializing of the class.
-	 * </p>
-	 */
-	private StringTools() {
-
-	}
-
-	/**
-	 * <p>
-	 * Simplifies use of operation system specific line separators.
-	 * </p>
-	 */
-	public final static String ENDLINE = System.getProperty("line.separator");
-
-	/**
-	 * <p>
-	 * Replaces all occurrences of {@literal &, <, >, ', and "} with their
-	 * respective XML entities {@literal &amp;, &lt;, &gt;, &apos;, and &quot;}
+	 * Replaces all occurences of {@literal &, <, >, ', and "} with their
+	 * respective XML entites {@literal &amp;, &lt;, &gt;, &apos;, and &quot;}
 	 * without destroying already existing entities.
 	 * </p>
 	 * 
 	 * @param str
-	 *            String where the XML entities are to be replaced
-	 * @return new String, where the XML entities are used instead of the
+	 *            String where the XML entites are to be replaced
+	 * @return new String, where the XML entites are used instead of the
 	 *         literals
 	 */
 	public static String xmlEntityReplacement(String str) {
 		String result = str;
-		if (result != null && !"".equals(result)) {
-			result = result
-					.replaceAll("&(?!(?:lt|gt|apos|quot|amp);)", "&amp;");
-			result = result.replaceAll("<", "&lt;");
-			result = result.replaceAll(">", "&gt;");
-			result = result.replaceAll("'", "&apos;");
-			result = result.replaceAll("\"", "&quot;");
-		}
+		result = result.replaceAll("&(?!(?:lt|gt|apos|quot|amp);)", "&amp;");
+		result = result.replaceAll("<", "&lt;");
+		result = result.replaceAll(">", "&gt;");
+		result = result.replaceAll("'", "&apos;");
+		result = result.replaceAll("\"", "&quot;");
 		return result;
 	}
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/Command.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/Command.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/console/Command.java	(revision 1)
@@ -11,5 +11,4 @@
  * 
  * @author Steffen Herbold
- * @version 1.0
  */
 public interface Command {
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/CommandExecuter.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/CommandExecuter.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/console/CommandExecuter.java	(revision 1)
@@ -4,4 +4,5 @@
 import java.util.ArrayList;
 import java.util.List;
+
 
 /**
@@ -13,9 +14,8 @@
  * </p>
  * <p>
- * This class is implemented as a <i>Singleton</i>.
+ * This class is implemented as a <i>Singleton</i>. 
  * </p>
  * 
  * @author Steffen Herbold
- * @version 1.0
  */
 public class CommandExecuter {
@@ -34,5 +34,5 @@
 	 */
 	private static final String cmdPrefix = "CMD";
-
+	
 	/**
 	 * <p>
@@ -48,6 +48,6 @@
 	 * </p>
 	 * <p>
-	 * The de.ugoe.cs.util.console.defaultcommands package has always lowest
-	 * priority, unless it is specifically added.
+	 * The defaultcommands package has always lowest priority, unless it is
+	 * specificially added.
 	 * </p>
 	 */
@@ -78,18 +78,11 @@
 	/**
 	 * <p>
-	 * Adds a package that will be used by {@link #exec(String)} to load command
-	 * from.
+	 * Adds a package that will be used by exec to load command from.
 	 * </p>
 	 * 
 	 * @param pkg
 	 *            package where commands are located
-	 * @throws InvalidParameterException
-	 *             thrown if the package name is null or empty string
 	 */
 	public void addCommandPackage(String pkg) {
-		if ("".equals(pkg) || pkg == null) {
-			throw new InvalidParameterException(
-					"package name must not be null or empty string");
-		}
 		commandPackageList.add(pkg);
 	}
@@ -114,15 +107,12 @@
 	 */
 	public void exec(String command) {
-		Console.commandNotification(command);
 		Command cmd = null;
 		CommandParser parser = new CommandParser();
 		parser.parse(command);
 		for (int i = 0; cmd == null && i < commandPackageList.size(); i++) {
-			cmd = loadCMD(commandPackageList.get(i) + "." + cmdPrefix
-					+ parser.getCommandName());
+			cmd = loadCMD(commandPackageList.get(i)+"."+cmdPrefix+parser.getCommandName());
 		}
 		if (cmd == null) { // check if command is available as default command
-			cmd = loadCMD(defaultPackage + "." + cmdPrefix
-					+ parser.getCommandName());
+			cmd = loadCMD(defaultPackage+"."+cmdPrefix+parser.getCommandName());
 		}
 		if (cmd == null) {
@@ -138,12 +128,8 @@
 
 	/**
-	 * <p>
 	 * Helper method that loads a class and tries to cast it to {@link Command}.
-	 * </p>
 	 * 
-	 * @param className
-	 *            qualified name of the class (including package name)
-	 * @return if class is available and implement {@link Command} and instance
-	 *         of the class, null otherwise
+	 * @param className qualified name of the class (including package name)
+	 * @return if class is available and implement {@link Command} and instance of the class, null otherwise
 	 */
 	private Command loadCMD(String className) {
@@ -154,7 +140,6 @@
 		} catch (NoClassDefFoundError e) {
 			String[] splitResult = e.getMessage().split("CMD");
-			String correctName = splitResult[splitResult.length - 1].replace(
-					")", "");
-			Console.println("Did you mean " + correctName + "?");
+			String correctName = splitResult[splitResult.length-1].replace(")", "");
+			Console.traceln("Did you mean " + correctName + "?");
 		} catch (ClassNotFoundException e) {
 		} catch (IllegalAccessException e) {
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/CommandParser.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/CommandParser.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/console/CommandParser.java	(revision 1)
@@ -10,5 +10,4 @@
  * 
  * @author Steffen Herbold
- * @version 1.0
  */
 public class CommandParser {
@@ -55,5 +54,5 @@
 	 * </p>
 	 * 
-	 * @return {@link List} of parameters that were parsed.
+	 * @return
 	 */
 	public List<Object> getParameters() {
@@ -145,5 +144,5 @@
 					startArrayparameter = false;
 				}
-				if (i < commandChars.length && quote && !startArrayparameter && commandChars[i] == '\'') {
+				if (i < commandChars.length && quote && commandChars[i] == '\'') {
 					// end of parameter with '
 					i++; // skip '
@@ -152,5 +151,5 @@
 					arrayBuffer.add((new String(buffer)).trim());
 				}
-				if (i < commandChars.length && !quote && !startArrayparameter
+				if (i < commandChars.length && !quote
 						&& Character.isWhitespace(commandChars[i])) {
 					startArrayparameter = true;
@@ -190,6 +189,6 @@
 		if (bufferPos > 0) {
 			if (isArray) {
-				//arrayBuffer.add((new String(buffer)).trim());
-				parameters.add(arrayBuffer.toArray(new String[0]));
+				arrayBuffer.add((new String(buffer)).trim());
+				parameters.add(arrayBuffer);
 			}
 			if (isString) {
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/Console.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/Console.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/console/Console.java	(revision 1)
@@ -1,13 +1,9 @@
 package de.ugoe.cs.util.console;
 
-import java.util.Collection;
-import java.util.LinkedHashSet;
+import java.util.ArrayList;
+import java.util.List;
 
 import de.ugoe.cs.util.StringTools;
-import de.ugoe.cs.util.console.listener.ICommandListener;
-import de.ugoe.cs.util.console.listener.IErrorListener;
-import de.ugoe.cs.util.console.listener.IExceptionListener;
-import de.ugoe.cs.util.console.listener.IOutputListener;
-import de.ugoe.cs.util.console.listener.ITraceListener;
+
 
 /**
@@ -27,5 +23,4 @@
  * 
  * @author Steffen Herbold
- * @version 1.0
  */
 public final class Console {
@@ -33,36 +28,8 @@
 	/**
 	 * <p>
-	 * Listeners for the output stream.
-	 * </p>
-	 */
-	private Collection<IOutputListener> outputListener;
-
-	/**
-	 * <p>
-	 * Listeners for the error stream.
-	 * </p>
-	 */
-	private Collection<IErrorListener> errorListener;
-
-	/**
-	 * <p>
-	 * Listeners for the trace stream.
-	 * </p>
-	 */
-	private Collection<ITraceListener> traceListener;
-
-	/**
-	 * <p>
-	 * Listeners for the command stream.
-	 * </p>
-	 */
-	private Collection<ICommandListener> commandListener;
-
-	/**
-	 * <p>
-	 * Listeners for the exception stream.
-	 * </p>
-	 */
-	private Collection<IExceptionListener> exceptionListener;
+	 * List of observers.
+	 * </p>
+	 */
+	private List<ConsoleObserver> observers;
 
 	/**
@@ -71,5 +38,5 @@
 	 * </p>
 	 */
-	private static Console theInstance = new Console();
+	private static Console theInstance = null;
 
 	/**
@@ -82,4 +49,7 @@
 	 */
 	public static Console getInstance() {
+		if (theInstance == null) {
+			theInstance = new Console();
+		}
 		return theInstance;
 	}
@@ -87,32 +57,9 @@
 	/**
 	 * <p>
-	 * Resets the Console by creating a new instance that has no registered
-	 * observers.
-	 * </p>
-	 */
-	public static void reset() {
-		theInstance.init();
-	}
-
-	/**
-	 * <p>
 	 * Creates a new Console. Private to prevent multiple instances (Singleton).
 	 * </p>
 	 */
 	private Console() {
-		init();
-	}
-
-	/**
-	 * <p>
-	 * Initializes the console.
-	 * </p>
-	 */
-	private void init() {
-		outputListener = new LinkedHashSet<IOutputListener>();
-		errorListener = new LinkedHashSet<IErrorListener>();
-		traceListener = new LinkedHashSet<ITraceListener>();
-		commandListener = new LinkedHashSet<ICommandListener>();
-		exceptionListener = new LinkedHashSet<IExceptionListener>();
+		observers = new ArrayList<ConsoleObserver>();
 	}
 
@@ -122,74 +69,9 @@
 	 * </p>
 	 * 
-	 * @deprecated use registerXYZListener instead
 	 * @param observer
 	 *            observer to be added
 	 */
 	public void registerObserver(ConsoleObserver observer) {
-		registerOutputListener(observer);
-		registerErrorListener(observer);
-		registerTraceListener(observer);
-		registerCommandListener(observer);
-		registerExceptionListener(observer);
-	}
-
-	/**
-	 * <p>
-	 * Registers an output listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is registered
-	 */
-	public void registerOutputListener(IOutputListener listener) {
-		outputListener.add(listener);
-	}
-
-	/**
-	 * <p>
-	 * Registers an error listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is registered
-	 */
-	public void registerErrorListener(IErrorListener listener) {
-		errorListener.add(listener);
-	}
-
-	/**
-	 * <p>
-	 * Registers a trace listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is registered
-	 */
-	public void registerTraceListener(ITraceListener listener) {
-		traceListener.add(listener);
-	}
-
-	/**
-	 * <p>
-	 * Registers a command listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is registered
-	 */
-	public void registerCommandListener(ICommandListener listener) {
-		commandListener.add(listener);
-	}
-
-	/**
-	 * <p>
-	 * Registers an exception listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is registered
-	 */
-	public void registerExceptionListener(IExceptionListener listener) {
-		exceptionListener.add(listener);
+		observers.add(observer);
 	}
 
@@ -199,139 +81,9 @@
 	 * </p>
 	 * 
-	 * @deprecated use removeXYZListener instead
 	 * @param observer
 	 *            observer to be removed
 	 */
 	public void deleteObserver(ConsoleObserver observer) {
-		removeOutputListener(observer);
-		removeErrorListener(observer);
-		removeTraceListener(observer);
-		removeCommandListener(observer);
-		removeExceptionListener(observer);
-	}
-
-	/**
-	 * <p>
-	 * Removes an output listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is removed
-	 */
-	public void removeOutputListener(IOutputListener listener) {
-		outputListener.remove(listener);
-	}
-
-	/**
-	 * <p>
-	 * Removes an error listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is removed
-	 */
-	public void removeErrorListener(IErrorListener listener) {
-		errorListener.remove(listener);
-	}
-
-	/**
-	 * <p>
-	 * Removes an trace listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is removed
-	 */
-	public void removeTraceListener(ITraceListener listener) {
-		traceListener.remove(listener);
-	}
-
-	/**
-	 * <p>
-	 * Removes a command listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is removed
-	 */
-	public void removeCommandListener(ICommandListener listener) {
-		commandListener.remove(listener);
-	}
-
-	/**
-	 * <p>
-	 * Removes an exception listener.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is removed
-	 */
-	public void removeExceptionListener(IExceptionListener listener) {
-		exceptionListener.remove(listener);
-	}
-
-	/**
-	 * <p>
-	 * Checks if a listener is registered.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is checked
-	 * @return true, is listener is registered; false, otherwise
-	 */
-	public boolean hasOutputListener(IOutputListener listener) {
-		return outputListener.contains(listener);
-	}
-
-	/**
-	 * <p>
-	 * Checks if a listener is registered.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is checked
-	 * @return true, is listener is registered; false, otherwise
-	 */
-	public boolean hasErrorListener(IErrorListener listener) {
-		return errorListener.contains(listener);
-	}
-
-	/**
-	 * <p>
-	 * Checks if a listener is registered.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is checked
-	 * @return true, is listener is registered; false, otherwise
-	 */
-	public boolean hasTraceListener(ITraceListener listener) {
-		return traceListener.contains(listener);
-	}
-
-	/**
-	 * <p>
-	 * Checks if a listener is registered.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is checked
-	 * @return true, is listener is registered; false, otherwise
-	 */
-	public boolean hasCommandListener(ICommandListener listener) {
-		return commandListener.contains(listener);
-	}
-
-	/**
-	 * <p>
-	 * Checks if a listener is registered.
-	 * </p>
-	 * 
-	 * @param listener
-	 *            listener that is checked
-	 * @return true, is listener is registered; false, otherwise
-	 */
-	public boolean hasExceptionListener(IExceptionListener listener) {
-		return exceptionListener.contains(listener);
+		observers.remove(observer);
 	}
 
@@ -346,6 +98,9 @@
 	 */
 	public static void print(String msg) {
-		for (IOutputListener observer : theInstance.outputListener) {
-			observer.outputMsg(msg);
+		if (theInstance == null) {
+			getInstance();
+		}
+		for (ConsoleObserver observer : theInstance.observers) {
+			observer.updateText(msg);
 		}
 	}
@@ -361,6 +116,10 @@
 	 */
 	public static void println(String msg) {
-		for (IOutputListener observer : theInstance.outputListener) {
-			observer.outputMsg(msg + StringTools.ENDLINE);
+		if (theInstance == null) {
+			getInstance();
+		}
+		for (ConsoleObserver observer : theInstance.observers) {
+			observer.updateText(msg
+					+ StringTools.ENDLINE);
 		}
 	}
@@ -376,6 +135,9 @@
 	 */
 	public static void printerr(String errMsg) {
-		for (IErrorListener observer : theInstance.errorListener) {
-			observer.errorMsg(errMsg);
+		if (theInstance == null) {
+			getInstance();
+		}
+		for (ConsoleObserver observer : theInstance.observers) {
+			observer.errStream(errMsg);
 		}
 	}
@@ -391,6 +153,10 @@
 	 */
 	public static void printerrln(String errMsg) {
-		for (IErrorListener observer : theInstance.errorListener) {
-			observer.errorMsg(errMsg + StringTools.ENDLINE);
+		if (theInstance == null) {
+			getInstance();
+		}
+		for (ConsoleObserver observer : theInstance.observers) {
+			observer.errStream(errMsg
+					+ StringTools.ENDLINE);
 		}
 	}
@@ -404,7 +170,10 @@
 	 *            exception whose stack trace is to be printed
 	 */
-	public static void logException(Exception e) {
-		for (IExceptionListener observer : theInstance.exceptionListener) {
-			observer.logException(e);
+	public static void printStacktrace(Exception e) {
+		if (theInstance == null) {
+			getInstance();
+		}
+		for (ConsoleObserver observer : theInstance.observers) {
+			observer.printStacktrace(e);
 		}
 	}
@@ -420,6 +189,9 @@
 	 */
 	public static void trace(String traceMsg) {
-		for (ITraceListener observer : theInstance.traceListener) {
-			observer.traceMsg(traceMsg);
+		if (theInstance == null) {
+			getInstance();
+		}
+		for (ConsoleObserver observer : theInstance.observers) {
+			observer.trace(traceMsg);
 		}
 	}
@@ -428,6 +200,5 @@
 	 * <p>
 	 * Sends a debug message to all observers containing the message that was
-	 * passed to this function and adds an {@link StringTools#ENDLINE} to the
-	 * message.
+	 * passed to this function and adds an endline to the message.
 	 * </p>
 	 * 
@@ -436,20 +207,10 @@
 	 */
 	public static void traceln(String traceMsg) {
-		for (ITraceListener observer : theInstance.traceListener) {
-			observer.traceMsg(traceMsg + StringTools.ENDLINE);
-		}
-	}
-
-	/**
-	 * <p>
-	 * Called by {@link CommandExecuter#exec(String)}.
-	 * </p>
-	 * 
-	 * @param command
-	 *            command that is executed
-	 */
-	static void commandNotification(String command) {
-		for (ICommandListener observer : theInstance.commandListener) {
-			observer.commandNotification(command);
+		if (theInstance == null) {
+			getInstance();
+		}
+		for (ConsoleObserver observer : theInstance.observers) {
+			observer.trace(traceMsg
+					+ StringTools.ENDLINE);
 		}
 	}
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/ConsoleObserver.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/ConsoleObserver.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/console/ConsoleObserver.java	(revision 1)
@@ -1,9 +1,3 @@
 package de.ugoe.cs.util.console;
-
-import de.ugoe.cs.util.console.listener.ICommandListener;
-import de.ugoe.cs.util.console.listener.IErrorListener;
-import de.ugoe.cs.util.console.listener.IExceptionListener;
-import de.ugoe.cs.util.console.listener.IOutputListener;
-import de.ugoe.cs.util.console.listener.ITraceListener;
 
 /**
@@ -13,8 +7,47 @@
  * 
  * @author Steffen Herbold
- * @version 2.0
- * @deprecated Use listeners defined in the package de.ugoe.cs.console.listeners instead.
  */
-public interface ConsoleObserver extends ITraceListener, IOutputListener, IErrorListener, ICommandListener, IExceptionListener {
+public interface ConsoleObserver {
+
+	/**
+	 * <p>
+	 * If a new message is send to the console, all observers are updated using
+	 * this method.
+	 * </p>
+	 * 
+	 * @param newMessage
+	 *            message that was send to the console.
+	 */
+	public void updateText(String newMessage);
+
+	/**
+	 * <p>
+	 * Send messages to the error stream of all observers.
+	 * </p>
+	 * 
+	 * @param errMessage
+	 *            error message
+	 */
+	public void errStream(String errMessage);
+
+	/**
+	 * <p>
+	 * Send messages to the trace stream of all observers.
+	 * </p>
+	 * 
+	 * @param traceMesssage
+	 *            error message
+	 */
+	public void trace(String traceMessage);
+
+	/**
+	 * <p>
+	 * Prints the stack trace of an exception.
+	 * </p>
+	 * 
+	 * @param e
+	 *            exception whose stack trace is to be printed
+	 */
+	public void printStacktrace(Exception e);
 
 }
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/FileOutputListener.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/FileOutputListener.java	(revision 425)
+++ 	(revision )
@@ -1,126 +1,0 @@
-package de.ugoe.cs.util.console;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-
-import de.ugoe.cs.util.console.listener.IOutputListener;
-
-/**
- * <p>
- * Implements an {@link IOutputListener} for the {@link Console} that logs all
- * outputs in a file. This can be used to "pipe" the output-stream of the
- * console into a file. The advantage of using this mechanism for piping is that
- * the file will only contain the output stream. No errors, no commands, etc.
- * </p>
- * 
- * @author Steffen Herbold
- * @version 1.0
- */
-public class FileOutputListener implements IOutputListener {
-
-	/**
-	 * <p>
-	 * Flag that ensures that only one log message is produced if the listener
-	 * breaks, e.g., because of a full hard disk/quota.
-	 * </p>
-	 */
-	boolean failureLogged = false;
-
-	/**
-	 * <p>
-	 * Name of the output file.
-	 * </p>
-	 */
-	String filename;
-
-	/**
-	 * <p>
-	 * Writer for the output.
-	 * </p>
-	 */
-	OutputStreamWriter writer = null;
-
-	/**
-	 * <p>
-	 * Constructor. Creates a new FileOutputListener.
-	 * </p>
-	 * 
-	 * @param filename
-	 *            name and path of the file the listener writes to.
-	 */
-	public FileOutputListener(String filename) {
-		this.filename = filename;
-
-	}
-
-	/**
-	 * <p>
-	 * Starts the listener by opening the file and registering it with the
-	 * {@link Console}.
-	 * </p>
-	 */
-	public void start() {
-		try {
-			FileOutputStream fos = new FileOutputStream(filename);
-			writer = new OutputStreamWriter(fos, "UTF-8");
-			Console.getInstance().registerOutputListener(this);
-		} catch (IOException e) {
-			Console.printerrln("Failed to start FileOutputListener for file "
-					+ filename + ": " + e.getMessage());
-		}
-	}
-
-	/**
-	 * <p>
-	 * Stops the listener by closing the file and removing itself from the
-	 * {@link Console}.
-	 * </p>
-	 */
-	public void stop() {
-		Console.getInstance().removeOutputListener(this);
-		if( writer!=null ) {
-			try {
-				writer.close();
-				writer = null;
-			} catch (IOException e) {
-				Console.printerrln("Failed to close file " + filename + ": "
-						+ e.getMessage());
-			}
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * de.ugoe.cs.util.console.listener.IOutputListener#outputMsg(java.lang.
-	 * String)
-	 */
-	@Override
-	public void outputMsg(String newMessage) {
-		if( writer!=null ) {
-			try {
-				writer.write(newMessage);
-			} catch (IOException e) {
-				if (!failureLogged) {
-					Console.printerrln("FileOutpustListener for file " + filename
-							+ " broken: " + e.getMessage());
-					failureLogged = true;
-				}
-			}
-		}
-	}
-
-	/**
-	 * <p>
-	 * Returns the name of the log file used by this listener.
-	 * </p>
-	 * 
-	 * @return name of the log file
-	 */
-	public String getFilename() {
-		return filename;
-	}
-
-}
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/TextConsole.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/TextConsole.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/console/TextConsole.java	(revision 1)
@@ -2,22 +2,15 @@
 
 import java.io.IOException;
-import java.nio.charset.Charset;
-
-import de.ugoe.cs.util.console.listener.IErrorListener;
-import de.ugoe.cs.util.console.listener.IExceptionListener;
-import de.ugoe.cs.util.console.listener.IOutputListener;
-import de.ugoe.cs.util.console.listener.ITraceListener;
 
 /**
  * <p>
  * Implements a simple console observer that prints normal text to
- * {@code stdout}, errors to {@code stderr} and reads from {@code stdin}.
+ * <code>stdout</code>, errors to <code>stderr</code> and reads from
+ * <code>stdin</code>.
  * </p>
  * 
  * @author Steffen Herbold
- * @version 1.0
  */
-public class TextConsole implements IOutputListener, IErrorListener,
-		ITraceListener, IExceptionListener {
+public class TextConsole implements ConsoleObserver {
 
 	/**
@@ -34,18 +27,15 @@
 	 */
 	public TextConsole() {
-		Console.getInstance().registerOutputListener(this);
-		Console.getInstance().registerErrorListener(this);
-		Console.getInstance().registerTraceListener(this);
-		Console.getInstance().registerExceptionListener(this);
+		Console.getInstance().registerObserver(this);
 	}
 
 	/**
 	 * <p>
-	 * Prints messages to {@code stdout}.
+	 * Prints messages to <code>stdout</code>.
 	 * </p>
 	 * 
-	 * @see ConsoleObserver#outputMsg(java.lang.String)
+	 * @see ConsoleObserver#updateText(java.lang.String)
 	 */
-	public void outputMsg(String newMessage) {
+	public void updateText(String newMessage) {
 		System.out.print(newMessage);
 	}
@@ -53,11 +43,11 @@
 	/**
 	 * <p>
-	 * Prints messages to {@code stderr}.
+	 * Prints messages to <code>stderr</code>.
 	 * </p>
 	 * 
-	 * @see ConsoleObserver#errorMsg(String)
+	 * @see ConsoleObserver#errStream(String)
 	 */
 	@Override
-	public void errorMsg(String errMessage) {
+	public void errStream(String errMessage) {
 		System.err.print(errMessage);
 	}
@@ -65,22 +55,22 @@
 	/**
 	 * <p>
-	 * Prints the stacktrace of an exception to {@code stderr}.
+	 * Prints the stackrace of an exception to <code>stderr</code>
 	 * </p>
 	 * 
-	 * @see ConsoleObserver#logException(Exception)
+	 * @see ConsoleObserver#printStacktrace(Exception)
 	 */
 	@Override
-	public void logException(Exception e) {
-		System.err.println(e.getMessage());
+	public void printStacktrace(Exception e) {
+		e.printStackTrace();
 	}
 
 	/**
 	 * <p>
-	 * Prints messages to {@code stdout}. These messages are only printed, if
-	 * the console is run in debug mode.
+	 * Prints messages to <code>stdout</code>. These messages are only printed,
+	 * if the console is run in debug mode.
 	 * </p>
 	 */
 	@Override
-	public void traceMsg(String traceMessage) {
+	public void trace(String traceMessage) {
 		if (debugMode) {
 			System.out.print(traceMessage);
@@ -92,5 +82,5 @@
 	 * Starts a new TextConsole. If the text console is started, it can be used
 	 * not only to print message, but also to execute commands by reading
-	 * {@code stdin}.
+	 * <code>stdin</code>.
 	 * </p>
 	 * 
@@ -113,5 +103,5 @@
 	/**
 	 * <p>
-	 * Reads a new command from {@code stdin}.
+	 * Reads a new command from <code>stdin</code>.
 	 * </p>
 	 * 
@@ -120,30 +110,10 @@
 	protected String getCommand() {
 		byte[] buffer = new byte[1024];
-		int bytesRead = 0;
-		String command;
 		try {
-			bytesRead = System.in.read(buffer);
+			System.in.read(buffer);
 		} catch (IOException e) {
 
 		}
-		if (bytesRead == 0) {
-			command = "";
-		} else {
-			command = new String(buffer, Charset.defaultCharset());
-		}
-		return command;
+		return new String(buffer);
 	}
-
-	/**
-	 * <p>
-	 * Configures if the debug mode of the text console is enabled.
-	 * </p>
-	 * 
-	 * @param debug
-	 *            if true, debug mode is enabled.
-	 */
-	public void setDebug(boolean debug) {
-		debugMode = debug;
-	}
-
 }
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/defaultcommands/CMDexec.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/defaultcommands/CMDexec.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/console/defaultcommands/CMDexec.java	(revision 1)
@@ -2,8 +2,7 @@
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.security.InvalidParameterException;
 import java.util.List;
@@ -15,17 +14,22 @@
 /**
  * <p>
- * Command to execute a batch of {@link Command}s. The batch is defined as a
- * text file, where each line defines one command.
+ * Implements a command to execute batchs of {@link Command}s, defined by batch
+ * file, to allow scripted executions.
  * </p>
  * 
  * @author Steffen Herbold
- * @version 1.0
  */
 public class CMDexec implements Command {
 
-	/*
-	 * (non-Javadoc)
+	/**
+	 * <p>
+	 * Executes a batch of {@link Command}s that are listed line by line in the
+	 * given file.
+	 * </p>
+	 * <p>
+	 * Usage: <code>exec filename</code>
+	 * </p>
 	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
+	 * @see de.ugoe.cs.util.console.commands.Command#run(java.util.List)
 	 */
 	public void run(List<Object> parameters) {
@@ -39,11 +43,10 @@
 			String[] commands;
 			File f = new File(script);
-			FileInputStream fis = new FileInputStream(f);
-			InputStreamReader reader = new InputStreamReader(fis, "UTF-8");
+			FileReader reader = new FileReader(f);
 			char[] buffer = new char[(int) f.length()];
 			reader.read(buffer);
 			commands = (new String(buffer)).split("\n");
 			for (String command : commands) {
-				Console.traceln(command.trim());
+				Console.println(command);
 				CommandExecuter.getInstance().exec(command);
 			}
@@ -63,5 +66,5 @@
 	@Override
 	public void help() {
-		Console.println("Usage: exec <filename>");
+		Console.println("Usage: exec filename");
 	}
 }
Index: trunk/JavaHelperLib/src/de/ugoe/cs/util/console/defaultcommands/CMDexit.java
===================================================================
--- trunk/JavaHelperLib/src/de/ugoe/cs/util/console/defaultcommands/CMDexit.java	(revision 425)
+++ trunk/JavaHelperLib/src/de/ugoe/cs/util/console/defaultcommands/CMDexit.java	(revision 1)
@@ -8,15 +8,13 @@
 /**
  * <p>
- * Command to terminate an application.
+ * Implements a command to terminate an application.
  * </p>
  * 
  * @author Steffen Herbold
- * @version 1.0
+ *
  */
 public class CMDexit implements Command {
 
-	/*
-	 * (non-Javadoc)
-	 * 
+	/* (non-Javadoc)
 	 * @see databasebuilder.console.commands.Command#help()
 	 */
@@ -25,9 +23,12 @@
 		Console.println("Usage: exit");
 	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
+	
+	/**
+	 * <p>
+	 * Terminates the programm.
+	 * </p>
+	 * <p>
+	 * Usage: <code>exit</code>
+	 * </p>
 	 */
 	@Override
