Example usage for com.google.common.collect ImmutableListMultimap of

List of usage examples for com.google.common.collect ImmutableListMultimap of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableListMultimap of.

Prototype


@SuppressWarnings("unchecked")
public static <K, V> ImmutableListMultimap<K, V> of() 

Source Link

Document

Returns the empty multimap.

Usage

From source file:com.github.rinde.jaamas17.JaamasPostProcessor.java

@Override
public SimResult collectResults(Simulator sim, SimArgs args) {

    @Nullable//from  w  w w.  jav a2 s. c  o  m
    final RealtimeClockLogger logger = sim.getModelProvider().tryGetModel(RealtimeClockLogger.class);

    @Nullable
    final AuctionCommModel<?> auctionModel = sim.getModelProvider().tryGetModel(AuctionCommModel.class);

    final Optional<AuctionStats> aStats;
    if (auctionModel == null) {
        aStats = Optional.absent();
    } else {
        final int parcels = auctionModel.getNumParcels();
        final int reauctions = auctionModel.getNumAuctions() - parcels;
        final int unsuccessful = auctionModel.getNumUnsuccesfulAuctions();
        final int failed = auctionModel.getNumFailedAuctions();
        aStats = Optional.of(AuctionStats.create(parcels, reauctions, unsuccessful, failed));
    }

    final StatisticsDTO stats = PostProcessors.statisticsPostProcessor(objectiveFunction).collectResults(sim,
            args);

    PerformExperiment.LOGGER.info("success: {}", args);

    @Nullable
    final AuctionTimeStatsLogger auctionLogger = sim.getModelProvider()
            .tryGetModel(AuctionTimeStatsLogger.class);
    ImmutableList<AuctionEvent> finishEvents;
    ImmutableListMultimap<Bidder<?>, SolverTimeMeasurement> timeMeasurements;
    if (auctionLogger != null) {
        finishEvents = auctionLogger.getAuctionFinishEvents();
        timeMeasurements = auctionLogger.getTimeMeasurements();
    } else {
        finishEvents = ImmutableList.of();
        timeMeasurements = ImmutableListMultimap.of();
    }

    @Nullable
    final RoutePlannerStatsLogger rpLogger = sim.getModelProvider().tryGetModel(RoutePlannerStatsLogger.class);
    ImmutableListMultimap<RoutePlanner, SolverTimeMeasurement> rpTimeMeasurements;
    if (auctionLogger != null) {
        rpTimeMeasurements = rpLogger.getTimeMeasurements();
    } else {
        rpTimeMeasurements = ImmutableListMultimap.of();
    }

    if (logger == null) {
        return SimResult.create(new ArrayList<LogEntry>(), 0, sim.getCurrentTime() / sim.getTimeStep(), stats,
                ImmutableList.<RealtimeTickInfo>of(), aStats, finishEvents, timeMeasurements,
                rpTimeMeasurements);
    }
    return SimResult.create(logger.getLog(), logger.getRtCount(), logger.getStCount(), stats,
            logger.getTickInfoList(), aStats, finishEvents, timeMeasurements, rpTimeMeasurements);
}

From source file:com.opengamma.strata.engine.marketdata.ScenarioCalculationEnvironment.java

/**
 * Returns a set of data for a single scenario, taking the data from an instance of {@link CalculationEnvironment}.
 *
 * @param marketData  a set of data for a single scenario
 * @return a set of scenario data for a single scenario taken from {@code marketData}
 *//*  w  ww.j  av  a2  s.c  o m*/
public static ScenarioCalculationEnvironment of(CalculationEnvironment marketData) {
    return new ScenarioCalculationEnvironment(marketData, 1, ImmutableList.of(marketData.getValuationDate()),
            ImmutableListMultimap.of(), ImmutableMap.of(), ImmutableMap.of());
}

From source file:com.linecorp.armeria.common.MediaType.java

private static MediaType createConstant(String type, String subtype) {
    return addKnownType(new MediaType(type, subtype, ImmutableListMultimap.of()));
}

From source file:de.metas.ui.web.window.datatypes.LookupValuesList.java

/** Empty constructor */
private LookupValuesList() {
    valuesById = ImmutableListMultimap.of();
    debugProperties = ImmutableMap.of();
}

From source file:com.google.gerrit.server.notedb.DraftCommentNotes.java

@Override
protected void loadDefaults() {
    comments = ImmutableListMultimap.of();
}

From source file:org.ambraproject.rhino.rest.controller.RestController.java

protected static ImmutableListMultimap<String, String> getParameters(ServletRequest request) {
    Map<String, String[]> parameterMap = request.getParameterMap();
    if (parameterMap.isEmpty()) {
        return ImmutableListMultimap.of(); // avoid constructing a builder
    }//  w ww  .ja va 2s  .  c o  m
    ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
    for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
        String key = entry.getKey();
        String[] values = entry.getValue();
        for (int i = 0; i < values.length; i++) {
            builder.put(key, values[i]);
        }
    }
    return builder.build();
}

From source file:edu.buaa.satla.analysis.core.counterexample.Model.java

private Model() {
    mModel = ImmutableMap.of();
    assignments = new CFAPathWithAssignments();
    assignableTermsPerCFAEdge = ImmutableListMultimap.of();
}

From source file:edu.buaa.satla.analysis.core.counterexample.Model.java

public Model(Map<AssignableTerm, Object> content) {
    mModel = ImmutableMap.copyOf(content);
    assignments = new CFAPathWithAssignments();
    assignableTermsPerCFAEdge = ImmutableListMultimap.of();
}

From source file:edu.buaa.satla.analysis.core.counterexample.Model.java

public Model(Map<AssignableTerm, Object> content, CFAPathWithAssignments pAssignments) {
    mModel = ImmutableMap.copyOf(content);
    assignments = pAssignments;/*w  w  w  . j  ava 2 s .c o m*/
    assignableTermsPerCFAEdge = ImmutableListMultimap.of();
}

From source file:com.isotrol.impe3.nr.api.Node.java

public Multimap<String, String> getProperties() {
    if (properties == null) {
        if (propertiesMap != null) {
            ImmutableListMultimap.Builder<String, String> b = ImmutableListMultimap.builder();
            for (Entry<String, Collection<String>> entry : propertiesMap.entrySet()) {
                final Collection<String> values = entry.getValue();
                if (values != null) {
                    b.putAll(entry.getKey(), values);
                }/* w w  w. j  av a  2 s  .co  m*/
            }
            properties = b.build();
        } else {
            properties = ImmutableListMultimap.of();
        }
    }
    return properties;
}