- Timestamp:
- 03/09/12 13:24:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieNode.java
r361 r397 397 397 this.count = count; 398 398 } 399 400 /** 401 * <p> 402 * Two TrieNodes are defined as equal, if their {@link #count}, 403 * {@link #symbol}, and {@link #children} are equal. 404 * </p> 405 * 406 * @see java.lang.Object#equals(java.lang.Object) 407 */ 408 @SuppressWarnings("rawtypes") 409 @Override 410 public boolean equals(Object other) { 411 if (other == this) { 412 return true; 413 } 414 if (other instanceof TrieNode) { 415 TrieNode otherNode = (TrieNode) other; 416 if (symbol == null) { 417 return count == otherNode.count && otherNode.symbol == null 418 && children.equals(otherNode.children); 419 } else { 420 return count == otherNode.count 421 && symbol.equals(((TrieNode) other).symbol) 422 && children.equals(((TrieNode) other).children); 423 } 424 } 425 return false; 426 } 427 428 /* 429 * (non-Javadoc) 430 * 431 * @see java.lang.Object#hashCode() 432 */ 433 @Override 434 public int hashCode() { 435 int multiplier = 17; 436 int hash = 42; 437 if (symbol != null) { 438 hash = multiplier * hash + symbol.hashCode(); 439 } 440 hash = multiplier * hash + count; 441 hash = multiplier * hash + children.hashCode(); 442 return hash; 443 } 399 444 }
Note: See TracChangeset
for help on using the changeset viewer.