public void update(Observable obs, Object obj) { if (obj instanceof IndexWord) { IndexWord word = (IndexWord) obj; removeLemma(DictionaryElementType.INDEX_WORD, word.getLemma(), word.getPOS()); } else if (obj instanceof Exc) { Exc exc = (Exc) obj; removeLemma(DictionaryElementType.EXCEPTION, exc.getLemma(), exc.getPOS()); } }
public void cacheObject(DictionaryElementType fileType, Object key, Object value) { if (value instanceof IndexWord) { IndexWord word = (IndexWord) value; getMap(DictionaryElementType.INDEX_WORD) .put(new POSKey(word.getPOS(), word.getLemma()), key); } else if (value instanceof Exc) { Exc exc = (Exc) value; getMap(DictionaryElementType.EXCEPTION).put(new POSKey(exc.getPOS(), exc.getLemma()), key); } super.cacheObject(fileType, key, value); }
private void removeFromIndexWords(Word word) { if (null != dictionary && dictionary.isEditable()) { try { // take care of IndexWords IndexWord indexWord = dictionary.getIndexWord(getPOS(), word.getLemma()); if (null != indexWord) { indexWord.getSenses().remove(Synset.this); } } catch (JWNLException e) { if (log.isErrorEnabled()) { log.error(JWNL.resolveMessage("EXCEPTION_001", e.getMessage()), e); } } } }
private void addToIndexWords(Word word) { if (null != dictionary && dictionary.isEditable()) { try { // take care of IndexWords IndexWord iw = dictionary.getIndexWord(word.getPOS(), word.getLemma()); if (null == iw) { dictionary.createIndexWord(word.getPOS(), word.getLemma(), Synset.this); } else { iw.getSenses().add(Synset.this); } } catch (JWNLException e) { if (log.isErrorEnabled()) { if (log.isErrorEnabled()) { log.error(JWNL.resolveMessage("EXCEPTION_001", e.getMessage()), e); } } } } }