@Override public void add(int index, Word word) { checkWordIsNotNull(word); if (null != dictionary && dictionary.isEditable()) { checkDictionaryIsOurs(word); super.add(index, word); addToIndexWords(word); } else { super.add(index, word); } }
public String toString() { StringBuilder words = new StringBuilder(); for (int i = 0; i < this.words.size(); ++i) { if (i > 0) { words.append(", "); } words.append(this.words.get(i).getLemma()); } if (getGloss() != null) { words.append(" -- (").append(getGloss()).append(")"); } return ResourceBundleSet.insertParams("[Synset: [Offset: {0}] {1} Words: {2}]", new Object[]{getOffset(), getPOS(), words.toString()}); }
@Override public boolean remove(Object o) { if (null != dictionary && dictionary.isEditable()) { boolean result = super.remove(o); if (result && o instanceof Word) { removeThisSynsetFromIndexWords((Word) o); } return result; } else { return super.remove(o); } }
@Override public boolean addAll(Collection<? extends Word> c) { if (null != dictionary && dictionary.isEditable()) { boolean result = false; ensureCapacity(size() + c.size()); for (Word word : c) { if (add(word)) { result = true; } } return result; } else { for (Word word : c) { checkWordIsNotNull(word); } return super.addAll(c); } }
@Override public boolean addAll(Collection<? extends Word> c) { if (null != dictionary && dictionary.isEditable()) { boolean result = false; ensureCapacity(size() + c.size()); for (Word word : c) { if (add(word)) { result = true; } } return result; } else { for (Word word : c) { checkWordIsNotNull(word); } return super.addAll(c); } }
@Override public boolean addAll(int index, Collection<? extends Word> c) { if (null != dictionary && dictionary.isEditable()) { ensureCapacity(size() + c.size()); for (Word word : c) { add(index, word); index++; } return true; } else { for (Word word : c) { checkWordIsNotNull(word); } return super.addAll(index, c); } }
/** * Returns the index of the word which has the <var>lemma</var> or -1 if not found. * * @param lemma lemma to check * @return true if <var>lemma</var> is one of the words contained in this synset */ public int indexOfWord(String lemma) { checkLemmaIsNotNull(lemma); for (int i = 0; i < words.size(); i++) { if (words.get(i).getLemma().equalsIgnoreCase(lemma)) { return i; } } return -1; }
@Override public boolean addAll(int index, Collection<? extends Word> c) { if (null != dictionary && dictionary.isEditable()) { ensureCapacity(size() + c.size()); for (Word word : c) { add(index, word); index++; } return true; } else { for (Word word : c) { checkWordIsNotNull(word); } return super.addAll(index, c); } }
/** * Returns the index of the word which has the <var>lemma</var> or -1 if not found. * * @param lemma lemma to check * @return true if <var>lemma</var> is one of the words contained in this synset */ public int indexOfWord(String lemma) { checkLemmaIsNotNull(lemma); for (int i = 0; i < words.size(); i++) { if (words.get(i).getLemma().equalsIgnoreCase(lemma)) { return i; } } return -1; }
@Override public Word set(int index, Word word) { checkWordIsNotNull(word); if (null != dictionary && dictionary.isEditable()) { checkDictionaryIsOurs(word); Word result = super.set(index, word); if (null != result) { removeThisSynsetFromIndexWords(result); } addToIndexWords(word); return result; } else { return super.set(index, word); } }
@Override public Word set(int index, Word word) { checkWordIsNotNull(word); if (null != dictionary && dictionary.isEditable()) { checkDictionaryIsOurs(word); Word result = super.set(index, word); if (null != result) { removeThisSynsetFromIndexWords(result); } addToIndexWords(word); return result; } else { return super.set(index, word); } }
public String toString() { StringBuilder words = new StringBuilder(); for (int i = 0; i < this.words.size(); ++i) { if (i > 0) { words.append(", "); } words.append(this.words.get(i).getLemma()); } if (getGloss() != null) { words.append(" -- (").append(getGloss()).append(")"); } return ResourceBundleSet.insertParams("[Synset: [Offset: {0}] {1} Words: {2}]", new Object[]{getOffset(), getPOS(), words.toString()}); }
public Synset(Dictionary dictionary, POS pos) throws JWNLException { super(dictionary); checkPOSIsNotNull(dictionary, pos); this.pos = pos; pointers = new PointerList(); words = new WordList(); if (null != dictionary && dictionary.isEditable()) { dictionary.addSynset(this); } }
@Override public boolean remove(Object o) { if (null != dictionary && dictionary.isEditable()) { boolean result = super.remove(o); if (result && o instanceof Word) { removeThisSynsetFromIndexWords((Word) o); } return result; } else { return super.remove(o); } }
@Override public Word remove(int index) { if (null != dictionary && dictionary.isEditable()) { Word result = super.remove(index); removeThisSynsetFromIndexWords(result); return result; } else { return super.remove(index); } }
public Synset(Dictionary dictionary, POS pos, long offset) throws JWNLException { super(dictionary); checkPOSIsNotNull(dictionary, pos); this.pos = pos; pointers = new PointerList(); words = new WordList(); this.offset = offset; if (null != dictionary && dictionary.isEditable()) { dictionary.addSynset(this); } }
@Override public Word remove(int index) { if (null != dictionary && dictionary.isEditable()) { Word result = super.remove(index); removeThisSynsetFromIndexWords(result); return result; } else { return super.remove(index); } }
public Synset(Dictionary dictionary, POS pos, long offset) throws JWNLException { super(dictionary); checkPOSIsNotNull(dictionary, pos); this.pos = pos; pointers = new PointerList(); words = new WordList(); this.offset = offset; if (null != dictionary && dictionary.isEditable()) { dictionary.addSynset(this); } }
@Override public void clear() { if (null != dictionary && dictionary.isEditable()) { List<Word> copy = new ArrayList<>(this); super.clear(); for (Word word : copy) { removeThisSynsetFromIndexWords(word); } } else { super.clear(); } }
@Override protected void removeRange(int fromIndex, int toIndex) { if (null != dictionary && dictionary.isEditable()) { List<Word> copy = new ArrayList<>(subList(fromIndex, toIndex)); super.removeRange(fromIndex, toIndex); for (Word word : copy) { removeThisSynsetFromIndexWords(word); } } else { super.removeRange(fromIndex, toIndex); } }