List of usage examples for com.google.common.collect HashMultimap create
public static <K, V> HashMultimap<K, V> create()
From source file:com.continuuity.weave.internal.DefaultResourceReport.java
public DefaultResourceReport(String applicationId, WeaveRunResources masterResources) { this.applicationId = applicationId; this.appMasterResources = masterResources; this.usedResources = HashMultimap.create(); }
From source file:org.sonar.server.user.MockUserSession.java
private MockUserSession() { globalPermissions = Collections.emptyList(); projectKeyByPermission = HashMultimap.create(); authorizationDao = mock(AuthorizationDao.class); resourceDao = mock(ResourceDao.class); }
From source file:com.sk89q.eduardo.service.event.AnnotatedSubscriberFinder.java
/** * {@inheritDoc}/*from w w w . j a v a 2s . c om*/ * * This implementation finds all methods marked with a {@link Subscribe} * annotation. */ @Override public Multimap<Class<?>, EventHandler> findAllSubscribers(Object listener) { Multimap<Class<?>, EventHandler> methodsInListener = HashMultimap.create(); Class<?> clazz = listener.getClass(); while (clazz != null) { for (Method method : clazz.getMethods()) { Subscribe annotation = method.getAnnotation(Subscribe.class); method.setAccessible(true); if (annotation != null) { Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length != 1) { throw new IllegalArgumentException("Method " + method + " has @Subscribe annotation, but requires " + parameterTypes.length + " arguments. Event handler methods " + "must require a single argument."); } Class<?> eventType = parameterTypes[0]; EventHandler handler = new MethodEventHandler(annotation.priority(), annotation.ignoreCancelled(), listener, method); methodsInListener.put(eventType, handler); } } clazz = clazz.getSuperclass(); } return methodsInListener; }
From source file:com.torodb.common.util.Sequencer.java
public Sequencer(Class<E> messageClass) { sentMessages = EnumSet.noneOf(messageClass); reservedMessages = HashMultimap.create(); }
From source file:cc.kave.commons.utils.json.legacy.MultimapTypeAdapter.java
@Override public Multimap deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { final Multimap multimap = HashMultimap.create(); final Map map = context.deserialize(json, createMapType(typeOfT)); for (final Object key : map.keySet()) { final Collection values = (Collection) map.get(key); multimap.putAll(key, values);/*w w w .j av a 2 s . c o m*/ } return multimap; }
From source file:com.sk89q.worldedit.util.eventbus.AnnotatedSubscriberFinder.java
/** * {@inheritDoc}//w w w . ja va2 s . co m * * This implementation finds all methods marked with a {@link Subscribe} * annotation. */ @Override public Multimap<Class<?>, EventHandler> findAllSubscribers(Object listener) { Multimap<Class<?>, EventHandler> methodsInListener = HashMultimap.create(); Class<?> clazz = listener.getClass(); while (clazz != null) { for (Method method : clazz.getMethods()) { Subscribe annotation = method.getAnnotation(Subscribe.class); method.setAccessible(true); if (annotation != null) { Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length != 1) { throw new IllegalArgumentException("Method " + method + " has @Subscribe annotation, but requires " + parameterTypes.length + " arguments. Event handler methods " + "must require a single argument."); } Class<?> eventType = parameterTypes[0]; EventHandler handler = new MethodEventHandler(annotation.priority(), listener, method); methodsInListener.put(eventType, handler); } } clazz = clazz.getSuperclass(); } return methodsInListener; }
From source file:org.jakstab.cfa.ReverseCFATransformerFactory.java
public ReverseCFATransformerFactory(Set<CFAEdge> cfa) { reverseCFA = HashMultimap.create(); Set<Location> nonSinks = new HashSet<Location>(); for (CFAEdge e : cfa) { reverseCFA.put(e.getTarget(), e); nonSinks.add(e.getSource());/*from w w w . j a v a 2s .c o m*/ } FastSet<Location> sinks = new FastSet<Location>(); for (Location l : reverseCFA.keySet()) { if (!nonSinks.contains(l)) { sinks.add(l); } } if (sinks.size() == 1) { sink = sinks.pick(); } else if (sinks.size() == 0) { throw new RuntimeException("CFA has no sink!"); } else { // Generate artificial exit node sink = new Location(new AbsoluteAddress(0xFFFFFF01L)); for (Location l : sinks) { reverseCFA.put(sink, new CFAEdge(l, sink, new RTLSkip())); } } }
From source file:org.erlide.backend.internal.CodeBundle.java
public CodeBundle(final Bundle bundle, final RuntimeVersion version, final Multimap<CodeContext, String> paths, final Collection<Pair<String, String>> inits) { this.bundle = bundle; this.version = version; this.paths = HashMultimap.create(); this.paths.putAll(paths); this.inits = inits; }
From source file:edu.umd.cs.psl.model.kernel.AbstractKernel.java
protected AbstractKernel() { this.frameworks = HashMultimap.create(); }
From source file:org.sosy_lab.cpachecker.util.predicates.matching.SmtAstMatchResultImpl.java
public SmtAstMatchResultImpl() { this.argumentPatternMatches = HashMultimap.create(); this.variableBindings = HashMultimap.create(); this.variableBindingsReverse = HashMultimap.create(); }