1 11 12 package org.eclipse.jdt.internal.ui.text.spelling.engine; 13 14 19 public class RankedWordProposal implements Comparable { 20 21 22 private int fRank; 23 24 25 private final String fText; 26 27 35 public RankedWordProposal(final String text, final int rank) { 36 fText= text; 37 fRank= rank; 38 } 39 40 43 public final int compareTo(Object object) { 44 45 final RankedWordProposal word= (RankedWordProposal)object; 46 final int rank= word.getRank(); 47 48 if (fRank < rank) 49 return -1; 50 51 if (fRank > rank) 52 return 1; 53 54 return 0; 55 } 56 57 60 public final boolean equals(Object object) { 61 62 if (object instanceof RankedWordProposal) 63 return object.hashCode() == hashCode(); 64 65 return false; 66 } 67 68 73 public final int getRank() { 74 return fRank; 75 } 76 77 82 public final String getText() { 83 return fText; 84 } 85 86 89 public final int hashCode() { 90 return fText.hashCode(); 91 } 92 93 99 public final void setRank(final int rank) { 100 fRank= rank; 101 } 102 } 103 | Popular Tags |