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

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

Introduction

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

Prototype

public static <E> HashMultiset<E> create() 

Source Link

Document

Creates a new, empty HashMultiset using the default initial capacity.

Usage

From source file:com.cinchapi.concourse.server.concurrent.GuavaInternals.java

/**
 * Return a hash multiset that uses synchronization to control concurrent
 * access. This is typically appropriate in cases where contention is
 * possible but not high enough to warrant the overhead of the
 * {@link com.google.common.collect.ConcurrentHashMultiset
 * ConcurrentHashMultiset}.//from w w  w . j  a v  a  2s  .c  o  m
 * 
 * @return the multiset
 */
@SuppressWarnings("unchecked")
public static <T> Multiset<T> newSynchronizedHashMultiset() {
    try {
        return (Multiset<T>) createSynchronizedMultisetMethod.invoke(null, HashMultiset.create(), new Object());
    } catch (ReflectiveOperationException e) {
        throw Throwables.propagate(e);
    }
}

From source file:de.andreasschoknecht.LS3.LS3Document.java

public LS3Document(String pnmlPath) {
    setPNMLPath(pnmlPath);
    this.bagOfWords = HashMultiset.create();
}

From source file:fr.tse.fi2.hpp.labs.queries.impl.projet.ZoneRentable.java

public ZoneRentable(QueryProcessorMeasure measure) {
    super(measure);
    // TODO Auto-generated constructor stub
    this.maFenetre30 = new LinkedList<DebsRecord>();
    this.maFenetre15 = new LinkedList<DebsRecord>();
    this.arriveeFrequentes = HashMultiset.create();
    this.profits = new HashMap<GridPoint, Float>();
    this.mediane = new HashMap<GridPoint, Float>();
    this.rentabilites = new HashMap<GridPoint, Float>();
    this.bvc = new ValueComparator(rentabilites);
    this.rentabilitesTrie = new TreeMap<GridPoint, Float>(bvc);
    this.nbGp = HashMultiset.create();

}

From source file:com.anhth12.eval.ConfusionMatrix.java

/**
 * Increments the entry specified by actual and predicted by count.
 *///from www  .  ja  v a 2  s .  c  o m
public void add(T actual, T predicted, int count) {
    if (matrix.containsKey(actual)) {
        matrix.get(actual).add(predicted, count);
    } else {
        Multiset<T> counts = HashMultiset.create();
        counts.add(predicted, count);
        matrix.put(actual, counts);
    }

    classes.add(actual);
    classes.add(predicted);
}

From source file:sk.gymy.seminar.persistence.SeminarGenerator.java

public SeminarGenerator(SolutionDao solutionDao) {
    this.random = new Random();
    this.studentSeminars = HashMultiset.create();
    this.solutionDao = solutionDao;
}

From source file:org.apache.lucene.util.MockDirectoryWrapper.java

public MockDirectoryWrapper(Directory delegate) {
    this.delegate = delegate;
    this.openFiles = HashMultiset.create();
}

From source file:com.b2international.index.mapping.Mappings.java

public Mappings(Collection<Class<?>> types) {
    checkArgument(!types.isEmpty(), "At least one document type should be specified");
    final Multiset<String> duplicates = HashMultiset.create();
    for (Class<?> type : ImmutableSet.copyOf(types)) {
        // XXX register only root mappings, nested mappings should be looked up via the parent/ancestor mapping
        DocumentMapping mapping = new DocumentMapping(type);
        mappingsByType.put(type, mapping);
        duplicates.add(mapping.typeAsString());
    }//w  ww.j a va 2  s.c om
    for (Entry<String> duplicate : duplicates.entrySet()) {
        if (duplicate.getCount() > 1) {
            throw new IllegalArgumentException(
                    "Multiple Java types with the same document name: " + duplicate.getElement());
        }
    }
}

From source file:org.datacleaner.components.machinelearning.impl.VectorOneHotEncodingFeatureModifierBuilder.java

public VectorOneHotEncodingFeatureModifierBuilder(MLTrainingConstraints constraints) {
    this.values = HashMultiset.create();
    this.constraints = constraints;
}

From source file:org.sosy_lab.cpachecker.util.blocking.ReducedFunction.java

public ReducedFunction(ReducedNode pEntryNode, ReducedNode pExitNode) {
    assert (pEntryNode != null);
    assert (pExitNode != null);

    this.cfaEdges = HashBasedTable.create();
    this.activeNodes = HashMultiset.create();

    this.entryNode = pEntryNode;
    this.exitNode = pExitNode;
}

From source file:edu.berkeley.compbio.ml.MultiClassCrossValidationResults.java

public MultiClassCrossValidationResults()//Map<L, String> friendlyLabelMap)
{
    confusionMatrix = new MapMaker().makeComputingMap(new Function<L, Multiset<L>>() {
        public Multiset<L> apply(final L key) {
            return HashMultiset.create();
        }/*from   w  w  w. java 2 s  .com*/
    });
    //this.friendlyLabelMap = friendlyLabelMap;
}