Changeset 369 for trunk/EventBenchConsole
- Timestamp:
- 01/30/12 11:27:44 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/jfc/JFCLogParser.java
r359 r369 1 1 package de.ugoe.cs.eventbench.jfc; 2 2 3 import java.awt.event.MouseEvent; 3 4 import java.io.File; 4 5 import java.io.FileInputStream; … … 9 10 import java.security.InvalidParameterException; 10 11 import java.util.Collection; 12 import java.util.HashSet; 11 13 import java.util.LinkedList; 12 14 import java.util.List; … … 58 60 */ 59 61 private List<JFCEvent> currentSequence = null; 60 62 61 63 /** 62 64 * <p> … … 87 89 ParamSource paramSource = null; 88 90 91 private Collection<Integer> eventFilter; 92 89 93 /** 90 94 * <p> … … 95 99 sequences = new LinkedList<List<JFCEvent>>(); 96 100 currentSequence = new LinkedList<JFCEvent>(); 101 setupEventFilter(); 102 } 103 104 private void setupEventFilter() { 105 eventFilter = new HashSet<Integer>(); 106 eventFilter.add(MouseEvent.MOUSE_PRESSED); 107 eventFilter.add(MouseEvent.MOUSE_RELEASED); 97 108 } 98 109 … … 117 128 public void startElement(String uri, String localName, String qName, 118 129 Attributes atts) throws SAXException { 119 if ( qName.equals("sessions")) {130 if (qName.equals("sessions")) { 120 131 currentSequence = new LinkedList<JFCEvent>(); 121 132 } … … 127 138 currentSequence = new LinkedList<JFCEvent>(); 128 139 } else if (qName.equals("event")) { 129 currentEvent = new JFCEvent(atts.getValue("id")); 130 paramSource = ParamSource.EVENT; 131 } else if (qName.equals("param")) { 132 if (paramSource == ParamSource.EVENT) { 133 currentEvent.addParameter(atts.getValue("name"), 134 atts.getValue("value")); 135 } else if (paramSource == ParamSource.SOURCE) { 136 currentEvent.addSourceInformation(atts.getValue("name"), 137 atts.getValue("value")); 138 } else if (paramSource == ParamSource.PARENT) { 139 currentEvent.addParentInformation(atts.getValue("name"), 140 atts.getValue("value")); 141 } else if (paramSource == ParamSource.COMPONENT) { 142 componentString += "'" + atts.getValue("value") + "',"; 143 } 144 } else if (qName.equals("source")) { 145 paramSource = ParamSource.SOURCE; 146 } else if (qName.equals("parent")) { 147 paramSource = ParamSource.PARENT; 148 } else if (qName.equals("component")) { 149 paramSource = ParamSource.COMPONENT; 150 componentString = "["; 140 int eventId = Integer.parseInt(atts.getValue("id")); 141 if (!eventFilter.contains(eventId)) { 142 currentEvent = new JFCEvent(atts.getValue("id")); 143 paramSource = ParamSource.EVENT; 144 } 145 } else if (currentEvent != null) { 146 if (qName.equals("param")) { 147 if (paramSource == ParamSource.EVENT) { 148 currentEvent.addParameter(atts.getValue("name"), 149 atts.getValue("value")); 150 } else if (paramSource == ParamSource.SOURCE) { 151 currentEvent.addSourceInformation(atts.getValue("name"), 152 atts.getValue("value")); 153 } else if (paramSource == ParamSource.PARENT) { 154 currentEvent.addParentInformation(atts.getValue("name"), 155 atts.getValue("value")); 156 } else if (paramSource == ParamSource.COMPONENT) { 157 componentString += "'" + atts.getValue("value") + "',"; 158 } 159 } else if (qName.equals("source")) { 160 paramSource = ParamSource.SOURCE; 161 } else if (qName.equals("parent")) { 162 paramSource = ParamSource.PARENT; 163 } else if (qName.equals("component")) { 164 paramSource = ParamSource.COMPONENT; 165 componentString = "["; 166 } 151 167 } 152 168 } … … 161 177 public void endElement(String uri, String localName, String qName) 162 178 throws SAXException { 163 if (qName.equals("event")) { 164 currentSequence.add(currentEvent); 165 } else if (qName.equals("source")) { 166 paramSource = ParamSource.EVENT; 167 } else if (qName.equals("parent")) { 168 paramSource = ParamSource.SOURCE; 169 } else if (qName.equals("sessions")) { 170 if(currentSequence!=null && !currentSequence.isEmpty() ) { 179 if (qName.equals("sessions")) { 180 if (currentSequence != null && !currentSequence.isEmpty()) { 171 181 sequences.add(currentSequence); 172 182 } 173 183 currentSequence = null; 174 } else if (qName.equals("component")) { 175 paramSource.equals(ParamSource.SOURCE); 176 currentEvent.extendTarget(componentString.substring(0, componentString.length()-1)+"]"); 184 } else if (currentEvent != null) { 185 if (qName.equals("event")) { 186 currentSequence.add(currentEvent); 187 currentEvent = null; 188 } else if (qName.equals("source")) { 189 paramSource = ParamSource.EVENT; 190 } else if (qName.equals("parent")) { 191 paramSource = ParamSource.SOURCE; 192 } else if (qName.equals("component")) { 193 paramSource.equals(ParamSource.SOURCE); 194 currentEvent.extendTarget(componentString.substring(0, 195 componentString.length() - 1) + "]"); 196 } 177 197 } 178 198 }
Note: See TracChangeset
for help on using the changeset viewer.