- Timestamp:
- 12/13/11 13:39:32 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.