001    package org.maltparser.core.symbol.trie;
002    
003    /**
004    
005    @author Johan Hall
006    @since 1.0
007    */
008    public class TrieEntry {
009            private int code;
010            private boolean known;
011            
012            public TrieEntry(int code, boolean known) {
013                    this.code = code;
014                    this.known = known;
015            }
016    
017            public int getCode() {
018                    return code;
019            }
020            
021            public boolean isKnown() {
022                    return known;
023            }
024            
025            public void setKnown(boolean known) {
026                    this.known = known;
027            }
028    
029            public boolean equals(Object obj) {
030                    if (this == obj)
031                            return true;
032                    if (obj == null)
033                            return false;
034                    if (getClass() != obj.getClass())
035                            return false;
036                    return code == ((TrieEntry)obj).code && known == ((TrieEntry)obj).known;
037            }
038    
039    
040            public int hashCode() {
041                    int hash = 7;
042                    hash = 31 * hash + code;
043                    return 31 * hash + (known ? 1 : 0);
044            }
045    
046    
047            public String toString() {
048                    final StringBuilder sb = new StringBuilder();
049                    sb.append(code);
050                    sb.append(' ');
051                    sb.append(known);
052                    return sb.toString();
053            }
054    }