Changeset 300 for trunk/EventBenchConsole/src/de/ugoe/cs/eventbensch
- Timestamp:
- 12/13/11 13:39:32 (13 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbensch/jfc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbensch/jfc/JFCLogParser.java
r299 r300 9 9 import java.security.InvalidParameterException; 10 10 import java.util.Collection; 11 import java.util.LinkedList; 11 12 import java.util.List; 12 13 … … 42 43 * </p> 43 44 */ 44 Collection<List<JFCEvent>> sequences; 45 private Collection<List<JFCEvent>> sequences; 46 47 /** 48 * <p> 49 * Internal handle to the event that is currently being parsed. 50 * </p> 51 */ 52 private JFCEvent currentEvent; 53 54 /** 55 * <p> 56 * Internal handle to the event sequence that is currently being parsed. 57 * </p> 58 */ 59 private List<JFCEvent> currentSequence = null; 60 61 /** 62 * <p> 63 * Enumeration to differentiate if a parameter belongs to an event, a source 64 * or the parent of a source. 65 * </p> 66 * 67 * @author Steffen Herbold 68 * @version 1.0 69 */ 70 private enum ParamSource { 71 EVENT, SOURCE, PARENT 72 }; 73 74 /** 75 * <p> 76 * Specifies whether the parameters that are currently being read belong the 77 * the event, the source or the parent. 78 * </p> 79 */ 80 ParamSource paramSource = null; 45 81 46 82 /** … … 66 102 if (qName.equals("newsession")) { 67 103 Console.traceln("start of session"); 68 // TODO implement handling: newsession node 104 if (currentSequence != null && currentSequence.size() != 0) { 105 sequences.add(currentSequence); 106 currentSequence = new LinkedList<JFCEvent>(); 107 } 69 108 } else if (qName.equals("event")) { 70 // TODO implement handling: start of event node 109 currentEvent = new JFCEvent(atts.getValue("id")); 110 paramSource = ParamSource.EVENT; 71 111 } else if (qName.equals("param")) { 72 // TODO implement handling: param node 112 if (paramSource == ParamSource.EVENT) { 113 currentEvent.addParameter(atts.getValue("name"), 114 atts.getValue("value")); 115 } else if (paramSource == ParamSource.SOURCE) { 116 currentEvent.addSourceInformation(atts.getValue("name"), 117 atts.getValue("value")); 118 } else if (paramSource == ParamSource.PARENT) { 119 currentEvent.addParentInformation(atts.getValue("name"), 120 atts.getValue("value")); 121 } 122 } else if (qName.equals("source")) { 123 paramSource = ParamSource.SOURCE; 124 } else if (qName.equals("parent")) { 125 paramSource = ParamSource.PARENT; 73 126 } 74 127 } … … 84 137 throws SAXException { 85 138 if (qName.equals("event")) { 86 // TODO implement handling: end of event node139 currentSequence.add(currentEvent); 87 140 } else if (qName.equals("source")) { 88 // TODO implement handling: end of source node141 paramSource = ParamSource.EVENT; 89 142 } else if (qName.equals("parent")) { 90 // TODO implement handling: end of parent node143 paramSource = ParamSource.SOURCE; 91 144 } 92 145 } -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbensch/jfc/data/JFCEvent.java
r299 r300 1 1 package de.ugoe.cs.eventbensch.jfc.data; 2 3 import java.util.HashMap; 4 import java.util.Map; 2 5 3 6 import de.ugoe.cs.eventbench.data.IReplayable; … … 23 26 /** 24 27 * <p> 28 * Internal map of parameters associated with the event. 29 * </p> 30 */ 31 private Map<String, String> parameters; 32 33 /** 34 * <p> 35 * Information about the event source. 36 * </p> 37 */ 38 private Map<String, String> sourceParameters; 39 40 /** 41 * <p> 42 * Information about the parent of the event source. 43 * </p> 44 */ 45 private Map<String, String> parentParameters; 46 47 /** 48 * <p> 25 49 * Constructor. Creates a new JFCEvent. 26 50 * </p> … … 31 55 public JFCEvent(String type) { 32 56 super(type); 57 parameters = new HashMap<String, String>(); 58 } 59 60 /** 61 * <p> 62 * Adds a new parameter to the event. 63 * </p> 64 * 65 * @param name 66 * name of the parameter 67 * @param value 68 * value of the parameter 69 */ 70 public void addParameter(String name, String value) { 71 parameters.put(name, value); 72 } 73 74 /** 75 * <p> 76 * Retrieves the value of a parameter. 77 * </p> 78 * 79 * @param name 80 * name of the parameter 81 * @return value of the parameter 82 */ 83 public String getParameter(String name) { 84 return parameters.get(name); 85 } 86 87 /** 88 * <p> 89 * Adds new information about the source of the event. 90 * </p> 91 * 92 * @param name 93 * name of the information 94 * @param value 95 * value of the information 96 */ 97 public void addSourceInformation(String name, String value) { 98 sourceParameters.put(name, value); 99 } 100 101 /** 102 * <p> 103 * Retrieves information about the source of the event. 104 * </p> 105 * 106 * @param name 107 * name of the information 108 * @return value of the information 109 */ 110 public String getSourceInformation(String name) { 111 return sourceParameters.get(name); 112 } 113 114 /** 115 * <p> 116 * Adds new information about the parent of the source of the event. 117 * </p> 118 * 119 * @param name 120 * name of the information 121 * @param value 122 * value of the information 123 */ 124 public void addParentInformation(String name, String value) { 125 parentParameters.put(name, value); 126 } 127 128 /** 129 * <p> 130 * Retrieves information about the parent of the source of the event. 131 * </p> 132 * 133 * @param name 134 * name of the information 135 * @return value of the information 136 */ 137 public String getParentInformation(String name) { 138 return parentParameters.get(name); 139 } 140 141 /* 142 * (non-Javadoc) 143 * 144 * @see de.ugoe.cs.eventbench.data.ReplayableEvent#equals(java.lang.Object) 145 */ 146 @Override 147 public boolean equals(Object other) { 148 if (other == this) { 149 return true; 150 } 151 if (other instanceof JFCEvent) { 152 return super.equals(other) 153 && parameters.equals(((JFCEvent) other).parameters); 154 } 155 return false; 156 } 157 158 /* 159 * (non-Javadoc) 160 * 161 * @see de.ugoe.cs.eventbench.data.ReplayableEvent#hashCode() 162 */ 163 @Override 164 public int hashCode() { 165 int hashCode = super.hashCode(); 166 hashCode *= parameters.hashCode(); 167 return hashCode; 33 168 } 34 169
Note: See TracChangeset
for help on using the changeset viewer.