Example usage for com.google.common.collect HashMultimap create

List of usage examples for com.google.common.collect HashMultimap create

Introduction

In this page you can find the example usage for com.google.common.collect HashMultimap create.

Prototype

public static <K, V> HashMultimap<K, V> create() 

Source Link

Document

Creates a new, empty HashMultimap with the default initial capacities.

Usage

From source file:de.textmining.nerdle.question.answering.fact.matcher.QuestionFactMatcher.java

@Override
public SortedSet<Entry<String, Float>> getAnswers(FactProvider factProvider,
        List<NerdleFact> questionDesciption) {

    EtmPoint point = etmMonitor.createPoint("ExactQuestionFactMatcher:getAnswers");

    SortedSet<Entry<String, Float>> sortedAnswers = new TreeSet<>();

    if (questionDesciption.size() == 1) {
        NerdleFact nerdleFact = questionDesciption.get(0);

        List<NerdleFact> matchingFacts = factProvider.getFactsByMatch(nerdleFact, nerdleFact.getQuestionArg());

        Multimap<String, NerdleFact> answerEvidence = HashMultimap.create();
        ItemCounter answerScore = new ItemCounter();

        for (NerdleFact matchingFact : matchingFacts) {

            String answer = matchingFact.getArgument(nerdleFact.getQuestionArg().getArgLabel());
            answerEvidence.put(answer, matchingFact);

            answerScore.put(answer, 1f);
        }//from w  w w. ja  va  2 s.  c om

        sortedAnswers = MapSorter.sortByValueDesc(answerScore.getAll());

        point.collect();
        return sortedAnswers;
    }

    point.collect();
    return sortedAnswers;
}

From source file:org.jfrog.teamcity.server.trigger.ArtifactoryBuildTriggerService.java

public ArtifactoryBuildTriggerService(@NotNull final PluginDescriptor descriptor,
        @NotNull final WebControllerManager wcm,
        @NotNull final DeployableArtifactoryServers deployableServers) {
    this.deployableServers = deployableServers;
    this.watchedItems = HashMultimap.create();
    this.watchedItems = Multimaps.synchronizedMultimap(watchedItems);
    actualUrl = descriptor.getPluginResourcesPath("editArtifactoryTrigger.html");
    final String actualJsp = descriptor.getPluginResourcesPath("editArtifactoryTrigger.jsp");
    wcm.registerController(actualUrl,//from w ww  .  j a v  a  2  s .  c o m
            new EditArtifactoryTriggerController(actualUrl, actualJsp, deployableServers));
}

From source file:org.invenzzia.helium.gui.mvc.AbstractMvcService.java

public AbstractMvcService() {
    this.elements = new LinkedHashMap<>();
    this.contextAssignment = HashMultimap.create();
    this.lock = new ReentrantReadWriteLock();
}

From source file:org.elasticsearch.common.lucene.ShardCoreKeyMap.java

public ShardCoreKeyMap() {
    coreKeyToShard = new IdentityHashMap<>();
    indexToCoreKey = HashMultimap.create();
}

From source file:org.eclipse.viatra.transformation.evm.specific.event.LightweightAttributeMonitor.java

public LightweightAttributeMonitor(IBaseIndex index) {
    super();// w  w w  . ja  v a2  s . c  om
    this.index = index;
    this.observer = new IInstanceObserver() {
        @Override
        public void notifyBinaryChanged(Object sourceElement, Object edgeType) {
            Collection<MatchType> matches = observedMultimap.get(sourceElement);
            for (MatchType matchType : matches) {
                notifyListeners(matchType);
            }
        }

        @Override
        public void notifyTernaryChanged(Object sourceElement, Object edgeType) {
            Collection<MatchType> matches = observedMultimap.get(sourceElement);
            for (MatchType matchType : matches) {
                notifyListeners(matchType);
            }
        }
    };
    this.observedMultimap = HashMultimap.create();
}

From source file:com.vectrace.MercurialEclipse.model.HgFolder.java

/**
 * Parse the list of files and then apply the filer
 *//*from   w ww. ja  v a 2s. com*/
private void parseListing(List<IPath> listing, SortedSet<String> filter) {
    Multimap<String, IPath> sublisting = HashMultimap.create();

    for (IPath line : listing) {
        assert line.isPrefixOf(path);

        String segment = line.segment(path.segmentCount());

        if (line.segmentCount() == path.segmentCount() + 1) {
            if (filter == null || filter.contains(line.toOSString())) {
                IHgResource file = new HgFile(root, changeset, line);
                this.members.add(file);
            }
        } else {
            sublisting.put(segment, line);
        }
    }

    if (sublisting.size() != 0) {
        Set<String> folderNames = sublisting.keySet();
        for (Iterator<String> it = folderNames.iterator(); it.hasNext();) {
            String folderName = it.next();
            Collection<IPath> folder = sublisting.get(folderName);

            HgFolder hgFolder = new HgFolder(root, changeset, path.append(folderName),
                    new ArrayList<IPath>(folder), filter);

            if (hgFolder.members().length != 0) {
                this.members.add(hgFolder);
            }
        }
    }

}

From source file:co.cask.tigon.sql.io.MethodsDriver.java

/**
 * Constructor for MethodsDriver/*  ww  w  . java  2  s .  c  o m*/
 * @param flowlet An instance of the {@link co.cask.tigon.sql.flowlet.AbstractInputFlowlet} to be used for
 *                invoking the method calls
 */
public MethodsDriver(AbstractInputFlowlet flowlet, Map<String, StreamSchema> schemaMap) {
    this.methodListMap = HashMultimap.create();
    this.flowlet = flowlet;
    this.schemaMap = schemaMap;
    populateMethodListMap();
}

From source file:org.jakstab.analysis.explicit.ExplicitPrecision.java

public ExplicitPrecision(int defaultThreshold) {
    this.defaultThreshold = defaultThreshold;
    this.thresholds = new HashMap<RTLVariable, Integer>();
    this.varLevels = new HashMap<RTLVariable, TrackingLevel>();
    this.memLevels = new HashMapMap<MemoryRegion, Long, TrackingLevel>();
    varMap = HashMultimap.create();
    regionMaps = new HashMap<MemoryRegion, SetMultimap<Long, BasedNumberElement>>();
}

From source file:com.google.eclipse.protobuf.scoping.ProtobufImportScope.java

@Override
protected Iterable<IEObjectDescription> getAliasedElements(Iterable<IEObjectDescription> candidates) {
    Multimap<QualifiedName, IEObjectDescription> keyToDescription = LinkedHashMultimap.create();
    Multimap<QualifiedName, ImportNormalizer> keyToNormalizer = HashMultimap.create();

    for (IEObjectDescription imported : candidates) {
        QualifiedName fullyQualifiedName = imported.getName();
        for (ImportNormalizer normalizer : normalizers) {
            QualifiedName alias = normalizer.deresolve(fullyQualifiedName);
            if (alias != null) {
                QualifiedName key = alias;
                if (isIgnoreCase()) {
                    key = key.toLowerCase();
                }//from  w  w w.  j  a va2 s .  co  m
                keyToDescription.put(key, new AliasedEObjectDescription(alias, imported));
                keyToNormalizer.put(key, normalizer);
            }
        }
    }
    for (QualifiedName name : keyToNormalizer.keySet()) {
        if (keyToNormalizer.get(name).size() > 1)
            keyToDescription.removeAll(name);
    }
    return keyToDescription.values();
}

From source file:suneido.SuRules.java

public SuRules() {
    usedBy = HashMultimap.create();
    dependencies = ArrayListMultimap.create();
    invalid = Sets.newHashSet();
    attachedRules = Maps.newHashMap();
}