Ignore:
Timestamp:
03/09/12 13:24:55 (12 years ago)
Author:
sherbold
Message:
  • implemented equals and hashCode for de.ugoe.cs.eventbench.models.Trie and de.ugoe.cs.eventbench.models.TrieNode?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/Trie.java

    r361 r397  
    437437                } 
    438438        } 
     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        } 
    439473} 
Note: See TracChangeset for help on using the changeset viewer.