public boolean hasStages(int stage) { return stageMultimap.containsKey(stage); }
private List<StemTransition> getTransitions(String stem) { lock.readLock().lock(); try { if (singleStems.containsKey(stem)) { return Lists.newArrayList(singleStems.get(stem)); } else if (multiStems.containsKey(stem)) { return Lists.newArrayList(multiStems.get(stem)); } else { return Collections.emptyList(); } } finally { lock.readLock().unlock(); } }
public List<StemTransition> getTransitions(DictionaryItem item) { if (differentStemItems.containsKey(item)) { return differentStemItems.get(item); } else { List<StemTransition> transitions = stemTransitionTrie.getItems(item.root); return transitions.stream().filter(s -> s.item.equals(item)).collect(Collectors.toList()); } }
public List<StemTransition> getTransitions(DictionaryItem item) { lock.readLock().lock(); try { if (differentStemItems.containsKey(item)) { return differentStemItems.get(item); } else { List<StemTransition> transitions = getTransitions(item.root); return transitions.stream().filter(s -> s.item.equals(item)).collect(Collectors.toList()); } } finally { lock.readLock().unlock(); } }
private synchronized void addStemTransition(StemTransition stemTransition) { final String surfaceForm = stemTransition.surface; if (multiStems.containsKey(surfaceForm)) { multiStems.put(surfaceForm, stemTransition); } else if (singleStems.containsKey(surfaceForm)) { multiStems.put(surfaceForm, singleStems.get(surfaceForm)); singleStems.remove(surfaceForm); multiStems.put(surfaceForm, stemTransition); } else { singleStems.put(surfaceForm, stemTransition); } }
private LinkedHashSet<StemTransition> getTransitionsAsciiTolerant(String stem) { lock.readLock().lock(); try { // add actual LinkedHashSet<StemTransition> result = new LinkedHashSet<>(); if (singleStems.containsKey(stem)) { result.add(singleStems.get(stem)); } else if (multiStems.containsKey(stem)) { result.addAll(multiStems.get(stem)); } Set<String> asciiStems = asciiKeys.get(TurkishAlphabet.INSTANCE.toAscii(stem)); for (String st : asciiStems) { if (singleStems.containsKey(st)) { result.add(singleStems.get(st)); } else if (multiStems.containsKey(st)) { result.addAll(multiStems.get(st)); } } return result; } finally { lock.readLock().unlock(); } }
public void removeDictionaryItem(DictionaryItem item) { lock.writeLock().lock(); try { List<StemTransition> transitions = generate(item); for (StemTransition transition : transitions) { removeStemNode(transition); } if (differentStemItems.containsKey(item)) { differentStemItems.removeAll(item); } } catch (Exception e) { Log.warn("Cannot remove %s ", item, e.getMessage()); } finally { lock.writeLock().unlock(); } }
private synchronized void removeStemNode(StemTransition stemTransition) { final String surfaceForm = stemTransition.surface; if (multiStems.containsKey(surfaceForm)) { multiStems.remove(surfaceForm, stemTransition); } else if (singleStems.containsKey(surfaceForm) && singleStems.get(surfaceForm).item.equals(stemTransition.item)) { singleStems.remove(surfaceForm); } if (!differentStemItems.containsEntry(stemTransition.item, stemTransition)) { differentStemItems.remove(stemTransition.item, stemTransition); } }
public void removeDictionaryItem(DictionaryItem item) { lock.writeLock().lock(); try { List<StemTransition> transitions = generate(item); for (StemTransition transition : transitions) { stemTransitionTrie.remove(transition.surface, transition); } if (differentStemItems.containsKey(item)) { differentStemItems.removeAll(item); } } catch (Exception e) { Log.warn("Cannot remove %s ", e.getMessage()); } finally { lock.writeLock().unlock(); } }
try { IBaseResource resource = ((BaseResourceReturningMethodBinding) method).doInvokeServer(theRequestDetails.getServer(), requestDetails); if (paramValues.containsKey(Constants.PARAM_SUMMARY) || paramValues.containsKey(Constants.PARAM_CONTENT)) { resource = filterNestedBundle(requestDetails, resource);
try { IBaseResource resource = ((BaseResourceReturningMethodBinding) method).doInvokeServer(theRequestDetails.getServer(), requestDetails); if (paramValues.containsKey(Constants.PARAM_SUMMARY) || paramValues.containsKey(Constants.PARAM_CONTENT)) { resource = filterNestedBundle(requestDetails, resource);
/** * returns if hooks that inherit from a specific class/interface are available * * @param hookClass class that implements from {@link PluginHook} * @return if any hook was found */ public boolean hasHooks(Class<? extends PluginHook> hookClass) { return hooks.containsKey(hookClass); }
public void clearLeashFlagSettings(MyPetType petType) { if (leashFlagSettings.containsKey(petType)) { leashFlagSettings.get(petType).clear(); } }
public List<JavaSymbol> lookup(String name) { Scope scope = this; while (scope != null && !scope.symbols.containsKey(name)) { scope = scope.next; } return scope == null ? ImmutableList.<JavaSymbol>of() : scope.symbols.get(name); }
public List<JavaSymbol> lookup(String name) { Scope scope = this; while (scope != null && !scope.symbols.containsKey(name)) { scope = scope.next; } return scope == null ? ImmutableList.<JavaSymbol>of() : scope.symbols.get(name); }
@Override @Deprecated public boolean growFlower(String flowerType, World world, IIndividual individual, BlockPos pos) { if (!this.growthRules.containsKey(flowerType)) { return false; } for (IFlowerGrowthRule rule : this.growthRules.get(flowerType)) { if (rule.growFlower(this, flowerType, world, pos)) { return true; } } return false; }
private void updateGuesses(IRI iri, Class<?> class1, boolean explicitlyTyped) { if (explicitlyTyped && guessedDeclarations.containsKey(iri)) { // if an explicitly typed declaration has been added and there was a // guess for its type, replace it // Do not replace all guesses, as these might be due to punning guessedDeclarations.remove(iri, class1); } if (!explicitlyTyped) { guessedDeclarations.put(iri, class1); } }
private void updateGuesses(IRI iri, Class<?> class1, boolean explicitlyTyped) { if (explicitlyTyped && guessedDeclarations.containsKey(iri)) { // if an explicitly typed declaration has been added and there was a // guess for its type, replace it // Do not replace all guesses, as these might be due to punning guessedDeclarations.remove(iri, class1); } if (!explicitlyTyped) { guessedDeclarations.put(iri, class1); } }
public void enter(JavaSymbol symbol) { if(!symbol.isMethodSymbol() && symbols.containsKey(symbol.name)) { for (JavaSymbol symInScope : symbols.get(symbol.name)) { Preconditions.checkState(symInScope.kind != symbol.kind, "Registering symbol: '%s' twice in the same scope", symbol.name); } } symbols.put(symbol.name, symbol); scopeSymbols.add(symbol); }
public void enter(JavaSymbol symbol) { if(!symbol.isMethodSymbol() && symbols.containsKey(symbol.name)) { for (JavaSymbol symInScope : symbols.get(symbol.name)) { Preconditions.checkState(symInScope.kind != symbol.kind, "Registering symbol: '%s' twice in the same scope", symbol.name); } } symbols.put(symbol.name, symbol); scopeSymbols.add(symbol); }