Changeset 397 for trunk/EventBenchCore/src/de/ugoe/cs/eventbench
- Timestamp:
- 03/09/12 13:24:55 (13 years ago)
- Location:
- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/Trie.java
r361 r397 437 437 } 438 438 } 439 440 /** 441 * <p> 442 * Two Tries are defined as equal, if their {@link #rootNode} are equal. 443 * </p> 444 * 445 * @see java.lang.Object#equals(java.lang.Object) 446 */ 447 @SuppressWarnings("rawtypes") 448 @Override 449 public boolean equals(Object other) { 450 if (other == this) { 451 return true; 452 } 453 if (other instanceof Trie) { 454 return rootNode.equals(((Trie) other).rootNode); 455 } 456 return false; 457 } 458 459 /* 460 * (non-Javadoc) 461 * 462 * @see java.lang.Object#hashCode() 463 */ 464 @Override 465 public int hashCode() { 466 int multiplier = 17; 467 int hash = 42; 468 if (rootNode != null) { 469 hash = multiplier * hash + rootNode.hashCode(); 470 } 471 return hash; 472 } 439 473 } -
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.