Example usage for com.google.common.collect Multimap keySet

List of usage examples for com.google.common.collect Multimap keySet

Introduction

In this page you can find the example usage for com.google.common.collect Multimap keySet.

Prototype

Set<K> keySet();

Source Link

Document

Returns a view collection of all distinct keys contained in this multimap.

Usage

From source file:com.yahoo.yqlplus.engine.internal.source.IndexedSourceAdapter.java

@Override
protected void indexQuery(List<StreamValue> out, Location location, ContextPlanner planner,
        List<IndexQuery> queries, List<OperatorNode<PhysicalExprOperator>> args) {
    // split IndexQuery by index and then invoke each index exactly once
    OperatorNode<PhysicalExprOperator> sourceAdapter = createSource(location, planner, args);
    Multimap<IndexKey, IndexQuery> split = ArrayListMultimap.create();
    for (IndexQuery query : queries) {
        split.put(query.index, query);/*from www . j a  va 2s.  c  o m*/
    }
    for (IndexKey idx : split.keySet()) {
        Collection<IndexQuery> todo = split.get(idx);
        selectMap.get(idx).index(out, location, sourceAdapter, planner, Lists.newArrayList(todo));
    }
}

From source file:com.yahoo.yqlplus.engine.internal.source.IndexedSourceAdapter.java

@Override
protected void deleteQuery(List<StreamValue> out, Location location, ContextPlanner planner,
        List<IndexQuery> queries, List<OperatorNode<PhysicalExprOperator>> args) {
    // split IndexQuery by index and then invoke each index exactly once
    OperatorNode<PhysicalExprOperator> sourceAdapter = createSource(location, planner, args);
    Multimap<IndexKey, IndexQuery> split = ArrayListMultimap.create();
    for (IndexQuery query : queries) {
        split.put(query.index, query);/* w  w  w . j  a  v a2  s.c o m*/
    }
    for (IndexKey idx : split.keySet()) {
        Collection<IndexQuery> todo = split.get(idx);
        deleteMap.get(idx).index(out, location, sourceAdapter, planner, Lists.newArrayList(todo));
    }
}

From source file:com.yahoo.yqlplus.engine.internal.source.IndexedSourceAdapter.java

@Override
protected void updateQuery(List<StreamValue> out, Location location, ContextPlanner planner,
        List<IndexQuery> queries, List<OperatorNode<PhysicalExprOperator>> args,
        OperatorNode<PhysicalExprOperator> record) {
    OperatorNode<PhysicalExprOperator> sourceAdapter = createSource(location, planner, args);
    Multimap<IndexKey, IndexQuery> split = ArrayListMultimap.create();
    for (IndexQuery query : queries) {
        split.put(query.index, query);/*  ww  w  .  j av a 2s  . co  m*/
    }
    for (IndexKey idx : split.keySet()) {
        Collection<IndexQuery> todo = split.get(idx);
        updateMap.get(idx).index(out, location, sourceAdapter, planner, Lists.newArrayList(todo), record);
    }
}

From source file:fr.putnami.pwt.doc.client.page.sample.decorator.SampleDecorator.java

protected void addSources(Multimap<String, String> sources) {
    Panel panelToOpen = null;/*w w w  .  j  a  v  a2s. co m*/
    String sourceToOpen = null;
    this.sourceAccordion.clear();
    for (String panelName : sources.keySet()) {

        List sourceList = new List();
        sourceList.setType(Type.LIST);
        for (String source : sources.get(panelName)) {
            if (sourceToOpen == null) {
                sourceToOpen = source;
            }
            sourceList.add(new SourceItem(source));
        }
        Panel sourcePanel = new Panel();
        if (panelToOpen == null) {
            panelToOpen = sourcePanel;
        }
        sourcePanel.add(new Header(panelName));
        sourcePanel.add(sourceList);
        this.sourceAccordion.add(sourcePanel);
    }
    this.requestFile(sourceToOpen);
    final Panel toOpen = panelToOpen;

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            toOpen.setCollapse(false);
        }
    });
}

From source file:org.obiba.onyx.quartz.core.engine.questionnaire.util.builder.CategoryBuilder.java

/**
   * Look for a {@link Category} with the same name in the {@link QuestionnaireBuilder. Create it if not found.
   * @param name/*from  w  w w.j  a v  a 2  s. c  o m*/
   * @return
   */
public CategoryBuilder withSharedCategory(String name) {
    Multimap<Category, Question> map = QuestionnaireFinder.getInstance(questionnaire).findCategories(name);
    if (map.keySet().size() > 1) {
        throw invalidSharedCategoryNameUnicityException(name);
    } else if (map.keySet().isEmpty()) {
        return withCategory(name);
    } else {
        this.element = map.keySet().iterator().next();
        questionCategory = createQuestionCategory(questionCategory.getQuestion());
        return this;
    }
}

From source file:com.android.build.gradle.integration.common.truth.NativeAndroidProjectSubject.java

@SuppressWarnings("NonBooleanMethodNameMayNotStartWithQuestion")
public void hasArtifactGroupsNamed(String... artifacts) {
    Set<String> expected = Sets.newHashSet(artifacts);
    Multimap<String, NativeArtifact> groups = getArtifactsGroupedByGroupName();
    if (!groups.keySet().equals(expected)) {
        failWithRawMessage("Not true that %s artifact groups are <%s>. They are <%s>", getDisplaySubject(),
                expected, groups.keySet());
    }/*from  w w w  . j  av  a2 s . c  o  m*/
}

From source file:org.sosy_lab.cpachecker.cfa.postprocessing.global.FunctionCallUnwinder.java

/** checks maximum size of callstack.
 * TODO implement better user-defined limits */
private boolean isCallStackSizeReached(final String calledFunction,
        final Multimap<String, String> reverseGraph) {
    final Collection<String> functions = reverseGraph.keySet();
    int maxDepth = 0;
    for (String function : functions) {
        if (function.startsWith(calledFunction)) {
            int index = function.indexOf(RECURSION_SEPARATOR);
            if (index != -1) {
                int depth = Integer.parseInt(function.substring(index + RECURSION_SEPARATOR.length()));
                maxDepth = Math.max(maxDepth, depth);
            }/*from  w w w  .j a v  a2 s  .co  m*/
        }
    }
    return maxDepth >= recursionDepth;
}

From source file:io.takari.maven.plugins.jar.Jar.java

private List<Entry> inputsSource(Multimap<File, File> inputs) {
    final List<Entry> entries = new ArrayList<>();
    for (File basedir : inputs.keySet()) {
        entries.addAll(inputsSource(basedir, inputs.get(basedir)));
    }/*ww  w . j  a  v  a2 s.co  m*/
    return entries;
}

From source file:com.streamsets.pipeline.stage.destination.salesforce.ForceTarget.java

/**
 * {@inheritDoc}/*from  w  ww  . j  a  v  a2  s. c  om*/
 */
@Override
public void write(Batch batch) throws StageException {
    Multimap<String, Record> partitions = ELUtils.partitionBatchByExpression(sObjectNameEval, sObjectNameVars,
            conf.sObjectNameTemplate, batch);
    Set<String> sObjectNames = partitions.keySet();
    for (String sObjectName : sObjectNames) {
        List<OnRecordErrorException> errors = writer.writeBatch(sObjectName, partitions.get(sObjectName), this);
        for (OnRecordErrorException error : errors) {
            errorRecordHandler.onError(error);
        }
    }
}

From source file:org.coode.existentialtree.model.OWLRelationHierarchyProvider.java

public Set<OWLIndividual> getChildren(OWLIndividual individual) {
    Multimap<OWLObjectPropertyExpression, OWLIndividual> values = EntitySearcher
            .getObjectPropertyValues(individual, ontologies);

    Set<OWLIndividual> children = new HashSet<OWLIndividual>();

    for (OWLObjectPropertyExpression p : values.keySet()) {
        if (propAndDescendants.isEmpty() || propAndDescendants.contains(p)) {
            children.addAll(values.get(p));
        }/*from   w  ww .  j  a v a2s . c om*/
    }
    return children;
}