Changeset 336 for trunk/EventBenchCore/src/de/ugoe
- Timestamp:
- 12/20/11 13:37:14 (13 years ago)
- Location:
- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/Event.java
r335 r336 96 96 if (other instanceof Event<?>) { 97 97 Event<?> otherEvent = (Event<?>) other; 98 if (target != null) { 99 return type.equals(otherEvent.type) 100 && target.equals(otherEvent.target); 98 if (otherEvent.canEqual(this)) { 99 if (type != null && target != null) { 100 return type.equals(otherEvent.type) 101 && target.equals(otherEvent.target); 102 } else if (type != null && target == null) { 103 return type.equals(otherEvent.type) 104 && otherEvent.target == null; 105 } else if (type == null && target != null) { 106 return otherEvent.type == null 107 && target.equals(otherEvent.target); 108 } else { 109 return otherEvent.type == null && otherEvent.target == null; 110 } 101 111 } else { 102 return type.equals(otherEvent.type) 103 && otherEvent.target == null; 112 return false; 104 113 } 105 114 } else { 106 115 return false; 107 116 } 117 } 118 119 public boolean canEqual(Object other) { 120 return (other instanceof Event<?>); 108 121 } 109 122 … … 216 229 int multiplier = 17; 217 230 int hash = 42; 218 hash = multiplier * hash + type.hashCode(); 231 if (type != null) { 232 hash = multiplier * hash + type.hashCode(); 233 } 219 234 if (target != null) { 220 235 hash = multiplier * hash + target.hashCode(); -
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/ReplayableEvent.java
r335 r336 1 1 package de.ugoe.cs.eventbench.data; 2 2 3 import java.security.InvalidParameterException; 3 4 import java.util.LinkedList; 4 5 import java.util.List; … … 73 74 * @param replayable 74 75 * element that is added to the sequence 76 * @throws InvalidParameterException 77 * thrown is replayable is null 75 78 */ 76 79 public void addReplayEvent(T replayable) { 80 if (replayable == null) { 81 throw new InvalidParameterException("replayble must not be null"); 82 } 77 83 replayEvents.add(replayable); 78 84 } … … 85 91 * @param generatedReplaySeq 86 92 * {@link List} that is added to the sequence 93 * @throws InvalidParameterException 94 * thrown if generatedReplaySeq is null 87 95 */ 88 96 public void addReplaySequence(List<T> generatedReplaySeq) { 97 if (generatedReplaySeq == null) { 98 throw new InvalidParameterException( 99 "generatedReplaySeq must not be null"); 100 } 89 101 replayEvents.addAll(generatedReplaySeq); 90 102 } … … 149 161 } 150 162 151 /* (non-Javadoc) 163 /* 164 * (non-Javadoc) 165 * 152 166 * @see de.ugoe.cs.eventbench.data.Event#equals(java.lang.Object) 153 167 */ … … 159 173 if (other instanceof ReplayableEvent<?>) { 160 174 ReplayableEvent<?> otherEvent = (ReplayableEvent<?>) other; 161 return super.equals(otherEvent) 162 && replayEvents.equals(otherEvent.replayEvents) 163 && replayValid == otherEvent.replayValid; 175 if (replayEvents != null) { 176 return super.equals(otherEvent) 177 && replayEvents.equals(otherEvent.replayEvents) 178 && replayValid == otherEvent.replayValid; 179 } else { 180 return super.equals(otherEvent) 181 && otherEvent.replayEvents == null 182 && replayValid == otherEvent.replayValid; 183 } 164 184 165 185 } else { … … 168 188 } 169 189 170 /* (non-Javadoc) 190 @Override 191 public boolean canEqual(Object other) { 192 return (other instanceof ReplayableEvent<?>); 193 } 194 195 /* 196 * (non-Javadoc) 197 * 171 198 * @see de.ugoe.cs.eventbench.data.Event#hashCode() 172 199 */ … … 175 202 int multiplier = 17; 176 203 int hash = super.hashCode(); 177 hash = multiplier * hash + replayEvents.hashCode(); 204 if (replayEvents != null) { 205 hash = multiplier * hash + replayEvents.hashCode(); 206 } 178 207 hash = multiplier * hash + (replayValid ? 1 : 0); 179 208
Note: See TracChangeset
for help on using the changeset viewer.