public boolean equals(Object obj) { if(this == obj) return true; if(obj == null) return false; if(!(obj instanceof IIndexWord)) return false; final IIndexWord other = (IndexWord) obj; if(!id.equals(other.getID())) return false; if(tagSenseCount != other.getTagSenseCount()) return false; if(!wordIDs.equals(other.getWordIDs())) return false; return true; } }
/** * Creates a new index word that replicates the specified index word. * The new index word replaces it's internal synset ids with synset ids * from the denoted synsets, thus removing redundant ids. * * @param old * the index word to be replicated * @return the new index word object * @throws NullPointerException * if the specified index word is <code>null</code> * @since JWI 2.2.0 */ protected IIndexWord makeIndexWord(IIndexWord old){ List<IWordID> oldIDs = old.getWordIDs(); IWordID[] newIDs = new IWordID[oldIDs.size()]; IWordID oldID; ISynset synset; for(int i = 0; i < oldIDs.size(); i++){ oldID = oldIDs.get(i); synset = synsets.get(oldID.getPOS()).get(oldID.getSynsetID()); for(IWord newWord : synset.getWords()){ if(!newWord.getID().equals(oldID)) continue; newIDs[i] = newWord.getID(); break; } if(newIDs[i] == null) throw new IllegalStateException(); } return new IndexWord(old.getID(), old.getTagSenseCount(), newIDs); }
for(Iterator<IIndexWord> i = source.getIndexWordIterator(pos); i.hasNext(); ){ idxWord = i.next(); idxWords.put(idxWord.getID(), idxWord);