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

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

Introduction

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

Prototype

Collection<V> get(@Nullable K key);

Source Link

Document

Returns a view collection of the values associated with key in this multimap, if any.

Usage

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

@SuppressWarnings("NonBooleanMethodNameMayNotStartWithQuestion")
public void hasArtifactGroupsOfSize(long size) {
    Multimap<String, NativeArtifact> groups = getArtifactsGroupedByGroupName();
    for (String groupName : groups.keySet()) {
        if (groups.get(groupName).size() != size) {
            failWithRawMessage("Not true that %s artifact group %s has size %s. " + "Actual size is <%s>",
                    getDisplaySubject(), groupName, size, groups.get(groupName).size());
        }/*from   w  ww. j  ava2s.c o  m*/
    }
}

From source file:eu.tomylobo.routes.sign.SignHandler.java

public void load() {
    trackedSigns.clear();//  ww  w . j  a v  a 2s.  c  o  m

    final Multimap<String, Multimap<String, String>> sections = Ini.load(plugin.getConfigFileName("signs.txt"));
    if (sections == null)
        return;

    for (Multimap<String, String> section : sections.get("sign")) {
        final TrackedSign trackedSign = new TrackedSign(section);

        trackedSigns.put(trackedSign.getLocation(), trackedSign);
    }
}

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  w  ww  .j av  a  2 s. c om*/
    }
    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);//from   w  w  w  .  j a va 2 s.co 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);/*from www.  j  a v a 2s  . c om*/
    }
    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:de.iteratec.iteraplan.businesslogic.exchange.xmi.exporter.ecore.EcoreServiceForTabReportingImpl.java

private void handleEnumATs(Multimap<Class<? extends AttributeType>, AttributeType> attributeTypes,
        TabReportingEcoreData data) {//from   ww  w .  j a v a 2s. c  om
    Collection<AttributeType> enumAttributeTypes = attributeTypes.get(EnumAT.class);

    for (AttributeType at : enumAttributeTypes) {
        EnumAT enumAT = (EnumAT) at;
        EEnum newEEnum = generateNewEEnumFor(enumAT);
        data.getModelPackage().getEClassifiers().add(newEEnum);

        List<BuildingBlockType> buildingBlockTypesForAttributeType = buildingBlockTypeDAO
                .getConnectedBuildingBlockTypesForAttributeType(at.getId());
        for (BuildingBlockType bbt : buildingBlockTypesForAttributeType) {
            EAttribute newAttribute = EcoreFactory.eINSTANCE.createEAttribute();
            Iteraplan2EMFHelper.setName(newAttribute, enumAT.getName());
            newAttribute.setEType(newEEnum);
            newAttribute.setLowerBound(enumAT.isMandatory() ? 1 : 0);
            newAttribute.setUpperBound(
                    enumAT.isMultiassignmenttype() ? EStructuralFeature.UNBOUNDED_MULTIPLICITY : 1);
            newAttribute.setUnique(false);

            EClass eClass = (EClass) data.getModelPackage()
                    .getEClassifier(bbt.getTypeOfBuildingBlock().getAssociatedClass().getSimpleName());
            if (eClass != null) {
                eClass.getEStructuralFeatures().add(newAttribute);
            } else {
                LOGGER.error("Encountered a class '" + bbt.getTypeOfBuildingBlock()
                        + "' which is not present in the current ECore meta-model! This is most probably a bug.");
            }

            data.addStructuralFeature(newAttribute, at);
            data.addEnum(newEEnum, at);
        }
    }
}

From source file:org.apache.tez.analyzer.plugins.SlowNodeAnalyzer.java

@Override
public void analyze(DagInfo dagInfo) throws TezException {
    Multimap<String, TaskAttemptInfo> nodeDetails = dagInfo.getNodeDetails();
    for (String nodeName : nodeDetails.keySet()) {
        List<String> record = Lists.newLinkedList();

        Collection<TaskAttemptInfo> taskAttemptInfos = nodeDetails.get(nodeName);

        record.add(nodeName);/*from   www  .  j a va2 s. c  o m*/
        record.add(taskAttemptInfos.size() + "");
        record.add(getNumberOfTasks(taskAttemptInfos, TaskAttemptState.KILLED) + "");
        record.add(getNumberOfTasks(taskAttemptInfos, TaskAttemptState.FAILED) + "");

        Iterable<TaskAttemptInfo> succeedTasks = getFilteredTaskAttempts(taskAttemptInfos,
                TaskAttemptState.SUCCEEDED);
        record.add(getAvgTaskExecutionTime(succeedTasks) + "");

        Iterable<TaskAttemptInfo> killedTasks = getFilteredTaskAttempts(taskAttemptInfos,
                TaskAttemptState.KILLED);
        record.add(getAvgTaskExecutionTime(killedTasks) + "");

        Iterable<TaskAttemptInfo> failedTasks = getFilteredTaskAttempts(taskAttemptInfos,
                TaskAttemptState.FAILED);
        record.add(getAvgTaskExecutionTime(failedTasks) + "");

        record.add(getAvgCounter(taskAttemptInfos, FileSystemCounter.class.getName(),
                FileSystemCounter.HDFS_BYTES_READ.name()) + "");
        record.add(getAvgCounter(taskAttemptInfos, FileSystemCounter.class.getName(),
                FileSystemCounter.HDFS_BYTES_WRITTEN.name()) + "");
        record.add(getAvgCounter(taskAttemptInfos, FileSystemCounter.class.getName(),
                FileSystemCounter.FILE_BYTES_READ.name()) + "");
        record.add(getAvgCounter(taskAttemptInfos, FileSystemCounter.class.getName(),
                FileSystemCounter.FILE_BYTES_WRITTEN.name()) + "");
        record.add(
                getAvgCounter(taskAttemptInfos, TaskCounter.class.getName(), TaskCounter.GC_TIME_MILLIS.name())
                        + "");
        record.add(getAvgCounter(taskAttemptInfos, TaskCounter.class.getName(),
                TaskCounter.CPU_MILLISECONDS.name()) + "");

        csvResult.addRecord(record.toArray(new String[record.size()]));
    }
}

From source file:com.proteus.jsmodify.JSExecutionTracer.java

/**
 * This method parses the JSON file containing the trace objects and extracts the objects
 *///from  ww w.jav  a 2  s. com
public static void extraxtTraceObjects() {
    try {
        ObjectMapper mapper = new ObjectMapper();
        // Register the module that serializes the Guava Multimap
        mapper.registerModule(new GuavaModule());

        File traceFile = new File("clematis-output/ftrace/function.trace");
        //            File traceFile = new File("function-traces/same-game.function.trace");
        //            File traceFile = new File("function-traces/ghostbusters.function.trace");
        //            File traceFile = new File("function-traces/mojule.function.trace");
        //            File traceFile = new File("function-traces/listo.function.trace");
        //            File traceFile = new File("function-traces/doctored.function.trace");
        //            File traceFile = new File("function-traces/jointlondon.function.trace");
        //            File traceFile = new File("function-traces/607.space.mahjon.function.trace");

        Multimap<String, TraceObject> traceMap = mapper.<Multimap<String, TraceObject>>readValue(traceFile,
                new TypeReference<TreeMultimap<String, TraceObject>>() {
                });
        /**
                    Collection<TraceObject> timingTraces = traceMap.get("TimingTrace");
        **/
        Collection<TraceObject> domEventTraces = traceMap.get("DOMEventTrace");
        /**            Collection<TraceObject> XHRTraces = traceMap.get("XHRTrace");
        **/
        Collection<TraceObject> functionTraces = traceMap.get("FunctionTrace");

        // TODO TODO TODO TODO TODO
        InteractionGraph.getInstance().handleDynamicCallGraph(functionTraces);
        InteractionGraph.getInstance().handleDomEvents(domEventTraces);
        // TODO TODO TODO TODO TODO

        ///////            createDynamicCallGraph(functionTraces);

        /**            Iterator<TraceObject> it3 = domEventTraces.iterator();
                    TraceObject next2;
                    ArrayList<TraceObject> removeus = new ArrayList<TraceObject>();
                    while (it3.hasNext()) {
        next2 = it3.next();
                
        if (next2 instanceof DOMEventTrace
                && (((DOMEventTrace) next2).getEventType().equals("mouseover") 
                        || (((DOMEventTrace) next2).getEventType().equals("mousemove"))
                        || (((DOMEventTrace) next2).getEventType().equals("mouseout"))
                        || (((DOMEventTrace) next2).getEventType().equals("mousedown"))
                        || (((DOMEventTrace) next2).getEventType().equals("mouseup")))) {
            removeus.add(next2);
                
        }
                    }
                    domEventTraces.removeAll(removeus);
                
                    story = new Story(domEventTraces, functionTraces, timingTraces, XHRTraces);
                    story.setOrderedTraceList(sortTraceObjects());
                
                
                    System.out.println(timingTraces.size());
                    Iterator<TraceObject> it = timingTraces.iterator();
                    TraceObject next;
                
                    while (it.hasNext()) {
        next = it.next();
        System.out.println("=======");
        System.out.println( next.getCounter());
                    }
        **/

        /*
         * ArrayList<TraceObject> bookmarkTraceObjects = new ArrayList<TraceObject>(); for
         * (TraceObject to : story.getOrderedTraceList()) { if (to instanceof DOMEventTrace) {
         * if (((DOMEventTrace)to).getEventType().equals("_BOOKMARK_")) {
         * bookmarkTraceObjects.add(to);
         * System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); } } }
         */
        /**
                    story.setEpisodes(buildEpisodes());
                
                    ArrayList<Episode> ss = story.getEpisodes();
                    Iterator<Episode> it2 = ss.iterator();
                    System.out.println("hhhmmm");
                
                    while (it2.hasNext()) {
        System.out.println("--------");
        System.out.println(it2.next().getSource().getClass());
                    }
                
                
                
                    System.out.println("# of trace objects: " + story.getOrderedTraceList().size());
                    System.out.println("# of episodes: " + story.getEpisodes().size());
        **/ /*
             * for (int i = 0; i < story.getEpisodes().size(); i ++) { Episode episode =
             * story.getEpisodes().get(i); if (episode.getSource() instanceof DOMEventTrace) {
             * DOMEventTrace source = (DOMEventTrace)episode.getSource();
             * if(source.getTargetElement().contains("bookmarkButton")) {
             * System.out.println("***********"); if (i + 1 < story.getEpisodes().size()) {
             * story.getEpisodes().get(i).getSource().setIsBookmarked(true); // move isbookmarked to
             * episode System.out.println("* " + story.getEpisodes().get(i).getSource().toString());
             * } } } }
             */
        /*
         * for (int i = 0; i < story.getEpisodes().size(); i ++) { Episode episode =
         * story.getEpisodes().get(i); ArrayList<TraceObject> bookmarkObjects = new
         * ArrayList<TraceObject>(); for (int j = 0; j < episode.getTrace().getTrace().size(); j
         * ++) { if (episode.getTrace().getTrace().get(j) instanceof DOMEventTrace) {
         * DOMEventTrace domEventTrace = (DOMEventTrace)episode.getTrace().getTrace().get(j); if
         * (domEventTrace.getEventType().equals("_BOOKMARK_")) {
         * bookmarkObjects.add(domEventTrace); System.out.println("bookmark"); if (i + 1 <
         * story.getEpisodes().size()) { story.getEpisodes().get(i +
         * 1).getSource().setIsBookmarked(true); } } } }
         * episode.getTrace().getTrace().removeAll(bookmarkObjects); } for (Episode e :
         * story.getEpisodes()) { boolean bookmarkNextEpisode = false; // if
         * (e.getSource().getIsBookmarked()) System.out.println("============ " +
         * e.getSource().getIsBookmarked()); for (TraceObject to : e.getTrace().getTrace()) { if
         * (to instanceof DOMEventTrace) { if
         * (((DOMEventTrace)to).getEventType().equals("_BOOKMARK_"))
         * System.out.println("bookmark"); } } }
         */
        /*
         * for (Episode episode : story.getEpisodes()) { if (episode.getSource() instanceof
         * DOMEventTrace) { if
         * (((DOMEventTrace)episode.getSource()).getTargetElement().contains("bookmarkButton"))
         * { System.out.print("**** " + ((DOMEventTrace)episode.getSource()).getEventType() +
         * " * "); } System.out.println("---- " +
         * ((DOMEventTrace)episode.getSource()).getTargetElement()); } }
         */// TODO TODO TODO project specific for photo gallery. eliminate unwanted episodes
        /**
        story.removeUselessEpisodes();
                
        ss = story.getEpisodes();
        it2 = ss.iterator();
        System.out.println("hhhmmm2");
                
        while (it2.hasNext()) {
        System.out.println("--------");
        System.out.println(it2.next().getSource().getClass());
        }
                
        ArrayList<Episode> bookmarkEpisodes = new ArrayList<Episode>();
                
        for (int i = 0; i < story.getEpisodes().size(); i++) {
        Episode episode = story.getEpisodes().get(i);
        if (episode.getSource() instanceof DOMEventTrace) {
            DOMEventTrace source = (DOMEventTrace) episode.getSource();
            if (source.getTargetElement().contains("bookmarkButton")) {
                bookmarkEpisodes.add(episode);
                if (i + 1 < story.getEpisodes().size()) {
                    story.getEpisodes().get(i + 1).setIsBookmarked(true);
                    // story.getEpisodes().get(i).getSource().setIsBookmarked(true); // move
                    // isbookmarked to episode
                    System.out.println("* episode # " + (i + 1) + " bookmarked");
                }
            }
        }
                
        }
                
        story.removeUselessEpisodes(bookmarkEpisodes);
                
        //    story.removeToolbarEpisodes();
                
        System.out.println("# of episodes after trimming: " + story.getEpisodes().size());
                
        DateFormat dateFormat = new SimpleDateFormat("EEE,d,MMM,HH-mm");
        Date date = new Date();
        System.out.println(dateFormat.format(date));
        // dateFormat.format(date).toString()
        theTime = new String(dateFormat.format(date).toString());
        System.out.println(theTime);
                
        // JavaScript episodes for JSUML2
        Helper.directoryCheck(outputFolder + "/sequence_diagrams/");
        PrintStream JSepisodes =
            new PrintStream(outputFolder + "/sequence_diagrams/allEpisodes.js");
                
        for (Episode e : story.getEpisodes()) {
        // Create pic files for each episode's sequence diagram
        designSequenceDiagram(e, JSepisodes);
        }
                
        // Once all episodes have been saved to JS file, close
        JSepisodes.close();
        **/
        // Create graph containing all episodes with embedded sequence diagrams
        /**            EpisodeGraph eg = new EpisodeGraph(getOutputFolder(), story.getEpisodes());
                    eg.createGraph();
                    writeStoryToDisk();
        **/
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.sonar.batch.issue.tracking.IssueTrackingResult.java

Collection<ServerIssue> unmatchedForRuleAndForLineAndForChecksum(RuleKey ruleKey, @Nullable Integer line,
        @Nullable String checksum) {
    if (!unmatchedByRuleAndLineAndChecksum.containsKey(ruleKey)) {
        return Collections.emptyList();
    }/*from w w  w . j a  v a 2 s  .  c  o  m*/
    Map<Integer, Multimap<String, ServerIssue>> unmatchedForRule = unmatchedByRuleAndLineAndChecksum
            .get(ruleKey);
    Integer lineNotNull = line != null ? line : 0;
    if (!unmatchedForRule.containsKey(lineNotNull)) {
        return Collections.emptyList();
    }
    Multimap<String, ServerIssue> unmatchedForRuleAndLine = unmatchedForRule.get(lineNotNull);
    String checksumNotNull = StringUtils.defaultString(checksum, "");
    if (!unmatchedForRuleAndLine.containsKey(checksumNotNull)) {
        return Collections.emptyList();
    }
    return unmatchedForRuleAndLine.get(checksumNotNull);
}

From source file:org.glowroot.central.repo.AgentDao.java

private AgentRollup createAgentRollup(AgentRollupRecord agentRollupRecord,
        Multimap<String, AgentRollupRecord> parentChildMap) {
    Collection<AgentRollupRecord> childAgentRollupRecords = parentChildMap.get(agentRollupRecord.id());
    ImmutableAgentRollup.Builder builder = ImmutableAgentRollup.builder().id(agentRollupRecord.id())
            .display(agentRollupRecord.display()).agent(agentRollupRecord.agent())
            .lastCaptureTime(agentRollupRecord.lastCaptureTime());
    for (AgentRollupRecord childAgentRollupRecord : Ordering.natural().sortedCopy(childAgentRollupRecords)) {
        builder.addChildren(createAgentRollup(childAgentRollupRecord, parentChildMap));
    }/*from w  w w. ja v a  2s.  com*/
    return builder.build();
}