public void addWord(final String word) { // synchronizing is necessary as this is a write access Set copy; synchronized (fDictionaries) { copy= new HashSet(fDictionaries); } final String addable= word.toLowerCase(); for (final Iterator iterator= copy.iterator(); iterator.hasNext();) { ISpellDictionary dictionary= (ISpellDictionary)iterator.next(); if (dictionary.acceptsWords()) dictionary.addWord(addable); } }
public Set getProposals(final String word, final boolean sentence) { // synchronizing might not be needed here since getProposals is // a read-only access and only called in the same thread as // the modifing methods add/removeDictionary (?) Set copy; synchronized (fDictionaries) { copy= new HashSet(fDictionaries); } ISpellDictionary dictionary= null; final HashSet proposals= new HashSet(); for (final Iterator iterator= copy.iterator(); iterator.hasNext();) { dictionary= (ISpellDictionary)iterator.next(); proposals.addAll(dictionary.getProposals(word, sentence)); } return proposals; }
@Override public final boolean isCorrect(final String word) { // synchronizing is necessary as this is called from execute Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy= new HashSet<>(fDictionaries); } if (fIgnored.contains(word.toLowerCase())) return true; ISpellDictionary dictionary= null; for (final Iterator<ISpellDictionary> iterator= copy.iterator(); iterator.hasNext();) { dictionary= iterator.next(); if (dictionary.isCorrect(word)) return true; } return false; }
private synchronized void resetSpellChecker() { if (fChecker != null) { ISpellDictionary dictionary= (ISpellDictionary)fLocaleDictionaries.get(fChecker.getLocale()); if (dictionary != null) dictionary.unload(); } fChecker= null; }
public boolean acceptsWords() { // synchronizing might not be needed here since acceptWords is // a read-only access and only called in the same thread as // the modifying methods add/checkWord (?) Set copy; synchronized (fDictionaries) { copy= new HashSet(fDictionaries); } ISpellDictionary dictionary= null; for (final Iterator iterator= copy.iterator(); iterator.hasNext();) { dictionary= (ISpellDictionary)iterator.next(); if (dictionary.acceptsWords()) return true; } return false; }
iter.next().setStripNonLetters(ignoreNonLetters);
private synchronized void resetSpellChecker() { if (fChecker != null) { ISpellDictionary dictionary= fLocaleDictionaries.get(fChecker.getLocale()); if (dictionary != null) dictionary.unload(); } fChecker= null; }
@Override public boolean acceptsWords() { // synchronizing might not be needed here since acceptWords is // a read-only access and only called in the same thread as // the modifying methods add/checkWord (?) Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy= new HashSet<>(fDictionaries); } ISpellDictionary dictionary= null; for (final Iterator<ISpellDictionary> iterator= copy.iterator(); iterator.hasNext();) { dictionary= iterator.next(); if (dictionary.acceptsWords()) return true; } return false; }
((ISpellDictionary)iter.next()).setStripNonLetters(ignoreNonLetters);
@Override public synchronized final void unregisterDictionary(final ISpellDictionary dictionary) { fGlobalDictionaries.remove(dictionary); fLocaleDictionaries.values().remove(dictionary); dictionary.unload(); resetSpellChecker(); } }
@Override public void addWord(final String word) { // synchronizing is necessary as this is a write access Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy= new HashSet<>(fDictionaries); } final String addable= word.toLowerCase(); for (final Iterator<ISpellDictionary> iterator= copy.iterator(); iterator.hasNext();) { ISpellDictionary dictionary= iterator.next(); if (dictionary.acceptsWords()) dictionary.addWord(addable); } }
public final boolean isCorrect(final String word) { // synchronizing is necessary as this is called from execute Set copy; synchronized (fDictionaries) { copy= new HashSet(fDictionaries); } if (fIgnored.contains(word.toLowerCase())) return true; ISpellDictionary dictionary= null; for (final Iterator iterator= copy.iterator(); iterator.hasNext();) { dictionary= (ISpellDictionary)iterator.next(); if (dictionary.isCorrect(word)) return true; } return false; }
@Override public boolean acceptsWords() { // synchronizing might not be needed here since acceptWords is // a read-only access and only called in the same thread as // the modifying methods add/checkWord (?) Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy= new HashSet<>(fDictionaries); } ISpellDictionary dictionary= null; for (final Iterator<ISpellDictionary> iterator= copy.iterator(); iterator.hasNext();) { dictionary= iterator.next(); if (dictionary.acceptsWords()) return true; } return false; }
@Override public Set<RankedWordProposal> getProposals(final String word, final boolean sentence) { // synchronizing might not be needed here since getProposals is // a read-only access and only called in the same thread as // the modifing methods add/removeDictionary (?) Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy= new HashSet<>(fDictionaries); } ISpellDictionary dictionary= null; final HashSet<RankedWordProposal> proposals= new HashSet<>(); for (final Iterator<ISpellDictionary> iterator= copy.iterator(); iterator.hasNext();) { dictionary= iterator.next(); proposals.addAll(dictionary.getProposals(word, sentence)); } return proposals; }
iter.next().setStripNonLetters(ignoreNonLetters);
@Override public synchronized final void unregisterDictionary(final ISpellDictionary dictionary) { fGlobalDictionaries.remove(dictionary); fLocaleDictionaries.values().remove(dictionary); dictionary.unload(); resetSpellChecker(); } }
@Override public void addWord(final String word) { // synchronizing is necessary as this is a write access Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy= new HashSet<>(fDictionaries); } final String addable= word.toLowerCase(); for (final Iterator<ISpellDictionary> iterator= copy.iterator(); iterator.hasNext();) { ISpellDictionary dictionary= iterator.next(); if (dictionary.acceptsWords()) dictionary.addWord(addable); } }
@Override public final boolean isCorrect(final String word) { // synchronizing is necessary as this is called from execute Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy= new HashSet<>(fDictionaries); } if (fIgnored.contains(word.toLowerCase())) return true; ISpellDictionary dictionary= null; for (final Iterator<ISpellDictionary> iterator= copy.iterator(); iterator.hasNext();) { dictionary= iterator.next(); if (dictionary.isCorrect(word)) return true; } return false; }
@Override public Set<RankedWordProposal> getProposals(final String word, final boolean sentence) { // synchronizing might not be needed here since getProposals is // a read-only access and only called in the same thread as // the modifing methods add/removeDictionary (?) Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy= new HashSet<>(fDictionaries); } ISpellDictionary dictionary= null; final HashSet<RankedWordProposal> proposals= new HashSet<>(); for (final Iterator<ISpellDictionary> iterator= copy.iterator(); iterator.hasNext();) { dictionary= iterator.next(); proposals.addAll(dictionary.getProposals(word, sentence)); } return proposals; }
public synchronized final void unregisterDictionary(final ISpellDictionary dictionary) { fGlobalDictionaries.remove(dictionary); fLocaleDictionaries.values().remove(dictionary); dictionary.unload(); resetSpellChecker(); } }