T9
T9 Trie Word Completion Algorithm
t9/trie/Pair.java
Go to the documentation of this file.
00001 
00009 package t9.trie;
00010 
00021 public class Pair implements Comparable<Pair> {
00022     final String word;
00023     final int frequency;
00024 
00025     @SuppressWarnings("javadoc")
00026     public Pair(String word, int frequency) {
00027         this.word = word;
00028         this.frequency = frequency;
00029     }
00030     @Override
00031     public int compareTo(Pair obj) {
00032         int rslt = this.word.compareTo(obj.word);
00033         return rslt;
00034     }
00035     @Override
00036     public int hashCode() {
00037         final int prime = 31;
00038         int result = 1;
00039         result = prime * result + ((word == null) ? 0 : word.hashCode());
00040         return result;
00041     }
00042     @Override
00043     public boolean equals(Object obj) {
00044         if (this == obj)
00045             return true;
00046         if (obj == null)
00047             return false;
00048         if (getClass() != obj.getClass())
00049             return false;
00050         Pair other = (Pair) obj;
00051         if (word == null) {
00052             if (other.word != null)
00053                 return false;
00054         } else if (!word.equals(other.word))
00055             return false;
00056         return true;
00057     }
00058 
00059 } // class Pair
 All Classes Namespaces Files Functions Variables