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

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

Introduction

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

Prototype

@SuppressWarnings("unchecked") 
public static <E> ImmutableMultiset<E> of() 

Source Link

Document

Returns the empty immutable multiset.

Usage

From source file:com.google.errorprone.StatisticsCollector.java

/**
 * Returns a statistics collector that will ignore any statistics added to it, always returning an
 * empty result for {@link #counters}.//from  ww w. j  av a  2  s .co m
 */
static StatisticsCollector createNoOpCollector() {
    return new StatisticsCollector() {
        @Override
        public void incrementCounter(String key, int count) {
        }

        @Override
        public ImmutableMultiset<String> counters() {
            return ImmutableMultiset.of();
        }
    };
}

From source file:org.lightjason.agentspeak.language.execution.action.achievement_test.IAchievementGoal.java

@Override
public double score(final IAgent<?> p_agent) {
    return p_agent.aggregation().evaluate(p_agent, ImmutableMultiset.of());
}

From source file:com.ardor3d.input.MouseState.java

/**
 * Constructs a new MouseState instance.
 * //from   ww w  .ja v a  2 s.  com
 * @param x
 *            the mouse's x position
 * @param y
 *            the mouse's y position
 * @param dx
 *            the delta in the mouse's x position since the last update
 * @param dy
 *            the delta in the mouse's y position since the last update
 * @param dwheel
 *            the delta in the mouse's wheel movement since the last update
 * @param buttonStates
 *            the states of the various given buttons.
 * @param clicks
 *            the number of times each button has been clicked
 */
public MouseState(final int x, final int y, final int dx, final int dy, final int dwheel,
        final EnumMap<MouseButton, ButtonState> buttonStates, final Multiset<MouseButton> clicks) {
    _x = x;
    _y = y;
    _dx = dx;
    _dy = dy;
    _dwheel = dwheel;
    if (buttonStates != null) {
        final com.google.common.collect.ImmutableMap.Builder<MouseButton, ButtonState> builder = ImmutableMap
                .builder();
        _buttonStates = builder.putAll(buttonStates).build();
    } else {
        _buttonStates = ImmutableMap.of();
    }
    if (clicks != null) {
        final Builder<MouseButton> builder = ImmutableMultiset.builder();
        _clickCounts = builder.addAll(clicks).build();
    } else {
        _clickCounts = ImmutableMultiset.of();
    }
}

From source file:com.google.devtools.moe.client.gson.AutoValueTypeAdapter.java

@VisibleForTesting
static Object emptyAggregationFor(Field field) {
    Class<?> type = field.getType();
    if (type.isAssignableFrom(ImmutableSet.class)) {
        return ImmutableSet.of();
    } else if (type.isAssignableFrom(ImmutableMap.class)) {
        return ImmutableMap.of();
    } else if (type.isAssignableFrom(ImmutableList.class)) {
        return ImmutableList.of();
    } else if (type.isAssignableFrom(ImmutableListMultimap.class)) {
        return ImmutableListMultimap.of();
    } else if (type.isAssignableFrom(ImmutableSetMultimap.class)) {
        return ImmutableSetMultimap.of();
    } else if (type.isAssignableFrom(ImmutableMultiset.class)) {
        return ImmutableMultiset.of();
    }/*from   ww  w. j a v  a 2s.  co m*/
    try {
        // Not a known aggregate type or supertype, so we'll play their game and see if it works.
        return type.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
        // Don't know how to make this type, so don't.
        return null;
    }
}

From source file:org.lightjason.agentspeak.language.execution.unaryoperator.CIncrement.java

@Override
public final double score(final IAgent<?> p_agent) {
    return p_agent.aggregation().evaluate(p_agent, ImmutableMultiset.of());
}

From source file:com.sonarsource.lits.IssuesChecker.java

Multiset<IssueKey> getByComponentKey(String componentKey) {
    Multiset<IssueKey> issueKeys = getPrevious().get(componentKey);
    if (issueKeys == null) {
        issueKeys = ImmutableMultiset.of();
    }/*from   ww w.  j av a  2 s  . c om*/
    return issueKeys;
}

From source file:org.apache.aurora.scheduler.filter.AttributeAggregate.java

@VisibleForTesting
public static AttributeAggregate empty() {
    return new AttributeAggregate(Suppliers.ofInstance(ImmutableMultiset.of()));
}

From source file:org.onebusaway.nyc.vehicle_tracking.impl.inference.VehicleLocationInferenceServiceImpl.java

@Override
public Multiset<Particle> getCurrentParticlesForVehicleId(AgencyAndId vehicleId) {
    final VehicleInferenceInstance instance = _vehicleInstancesByVehicleId.get(vehicleId);
    if (instance == null)
        return ImmutableMultiset.of();
    return instance.getCurrentParticles();
}

From source file:org.onebusaway.nyc.vehicle_tracking.impl.inference.VehicleLocationInferenceServiceImpl.java

@Override
public Multiset<Particle> getCurrentSampledParticlesForVehicleId(AgencyAndId vehicleId) {
    final VehicleInferenceInstance instance = _vehicleInstancesByVehicleId.get(vehicleId);
    if (instance == null)
        return ImmutableMultiset.of();
    return instance.getCurrentSampledParticles();
}