Index: /trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/AndroidLogParser.java
===================================================================
--- /trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/AndroidLogParser.java	(revision 1796)
+++ /trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/AndroidLogParser.java	(revision 1797)
@@ -38,4 +38,5 @@
 
 import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.eventcore.gui.IInteraction;
 import de.ugoe.cs.autoquest.eventcore.gui.MouseButtonInteraction;
 import de.ugoe.cs.autoquest.eventcore.gui.MouseClick;
@@ -44,5 +45,6 @@
 import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModelException;
 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
-import de.ugoe.cs.autoquest.plugin.android.guimodel.AndroidGUIElementSpec;
+import de.ugoe.cs.autoquest.plugin.android.guimodel.ANDROIDGUIElement;
+import de.ugoe.cs.autoquest.plugin.android.guimodel.ANDROIDGUIElementSpec;
 import de.ugoe.cs.util.console.Console;
 
@@ -71,5 +73,5 @@
 	 * </p>
 	 */
-	private String currentEventId;
+	private String currentEventId = null;
 
 	/**
@@ -102,5 +104,5 @@
 	 * </p>
 	 */
-	private Long currentGUIElementHash;
+	private Long currentGUIElementHash = null;
 
 	/**
@@ -116,5 +118,5 @@
 	 * </p>
 	 */
-	private AndroidGUIElementSpec currentGUIElementSpec;
+	private ANDROIDGUIElementSpec currentGUIElementSpec;
 
 	/**
@@ -147,5 +149,5 @@
 	 * </p>
 	 */
-	private Map<Long, List<Event>> eventsWithoutTargets;
+	// private Map<Long, List<Event>> eventsWithoutTargets;
 
 	/**
@@ -164,5 +166,5 @@
 	public AndroidLogParser() {
 		sequences = new LinkedList<List<Event>>();
-		// currentSequence = null;
+		currentSequence = null;
 	}
 
@@ -228,4 +230,5 @@
 			return;
 		}
+
 		if (inputSource != null) {
 			inputSource.setSystemId("file://" + file.getAbsolutePath());
@@ -252,8 +255,4 @@
 			}
 		}
-		if (!eventsWithoutTargets.isEmpty()) {
-			Console.printerr("Some events reference GUI elements that are not part of logfile. "
-					+ "These events have been parsed without target.");
-		}
 	}
 
@@ -290,19 +289,21 @@
 			Attributes atts) throws SAXException {
 		if (qName.equals("sessions")) {
-			// currentSequence = new LinkedList<Event>(); Up to know it is
-			// necessary to handle different sessions. All components are known
-			// before an event occurs.
-			if (currentGUIElementTree == null)
+			 currentSequence = new LinkedList<Event>();
+			if (currentGUIElementTree == null) {
 				currentGUIElementTree = new GUIElementTree<Long>();
+			}
+			
 		}
 
 		if (qName.equals("component")) {
 			currentGUIElementHash = Long.parseLong(atts.getValue("hash"));
-			currentGUIElementSpec = new AndroidGUIElementSpec();
+			currentGUIElementSpec = new ANDROIDGUIElementSpec();
 			currentGUIElementSpec.setHashCode((int) currentGUIElementHash
 					.longValue());
+			
 		} else if (qName.equals("event")) {
 			currentEventId = atts.getValue("id");
 			currentEventParameters = new HashMap<String, String>();
+			
 
 		} else if (qName.equals("param")) {
@@ -345,4 +346,10 @@
 	public void endElement(String uri, String localName, String qName)
 			throws SAXException {
+		
+		if (qName.equals("sessions")) {
+			if (currentSequence != null) {
+				sequences.add(currentSequence);
+			}
+		}
 		if (qName.equals("component") && currentGUIElementHash != null) {
 			try {
@@ -357,35 +364,64 @@
 			currentGUIElementHash = null;
 			currentParentHash = null;
-		} else if (currentEventId != null) {
-			if (qName.equals("event")) {
-				IGUIElement currentGUIElement;
-				currentGUIElement = currentGUIElementTree
-						.find(currentEventSource);
-				Event event;
-
-				// up to now only onClick events are implemented and each
-				// onclick event is processed as a mouse click
-				int x = Integer.parseInt(currentEventParameters.get("X"));
-				int y = Integer.parseInt(currentEventParameters.get("Y"));
-				MouseButtonInteraction.Button button = null;
-				button = MouseButtonInteraction.Button.LEFT;
-
-				// maybe it would be necessary in the future to check weather
-				// the GUI element exits.
-				event = new Event(new MouseClick(button, x, y),
-						currentGUIElement);
-
+		} else if (currentEventId != null && qName.equals("event")) {
+			
+			IGUIElement currentGUIElement;
+			currentGUIElement = currentGUIElementTree.find(currentEventSource);
+			Event event;
+
+			// up to now only onClick events are implemented and each
+			// onclick event is processed as a mouse click
+			if (currentGUIElement == null) {
+				
+			} else {
+				
+				event = new Event(instantiateInteraction(currentEventId, currentEventParameters), currentGUIElement);	
+				ANDROIDGUIElement currentEventTarget = (ANDROIDGUIElement) event.getTarget();
+				currentEventTarget.markUsed();
 				event.setTimestamp(currentEventTimestamp);
 				currentSequence.add(event);
-
-				currentEventParameters = null;
-				currentEventId = null;
-				currentEventTimestamp = -1l;
-			}
-		} else if (qName.equals("sessions")) {
-			if (currentSequence != null) {
-				sequences.add(currentSequence);
-			}
-		}
+			}
+			currentEventParameters = null;
+			currentEventId = null;
+			currentEventTimestamp = -1l;
+		}
+	}
+
+	/**
+	 * <p>
+	 * depending on the event id and the event parameters, this method
+	 * instantiates the concrete interaction, that took place, i.e. the event
+	 * type
+	 * </p>
+	 * 
+	 * @param eventId
+	 *            the id of the event
+	 * @param eventParameters
+	 *            the parameters provided for the event
+	 * 
+	 * @return as described
+	 * 
+	 * @throws SAXException
+	 *             thrown if the provided event id is unknown
+	 */
+	private IInteraction instantiateInteraction(String event,
+							Map<String, String> eventParameters) 
+			throws SAXException 
+		{
+		
+		switch(event)
+		{
+		case "onClick":
+			int x = Integer.parseInt(currentEventParameters.get("X"));
+			int y = Integer.parseInt(currentEventParameters.get("Y"));
+			MouseButtonInteraction.Button button = null;
+			button = MouseButtonInteraction.Button.LEFT;
+
+			return new MouseClick(button, x, y);
+			
+		default:
+            throw new SAXException("unhandled event id " + event);
+		}
+
 	}
 
