当前位置: 首页>>代码示例>>Java>>正文


Java SetMultimap类代码示例

本文整理汇总了Java中com.google.common.collect.SetMultimap的典型用法代码示例。如果您正苦于以下问题:Java SetMultimap类的具体用法?Java SetMultimap怎么用?Java SetMultimap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SetMultimap类属于com.google.common.collect包,在下文中一共展示了SetMultimap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPluginManager

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
public static PluginManager createPluginManager(String pluginFileName) {

    try {
      SetMultimap<String, Class<?>> info = LinkedHashMultimap.create();
      Enumeration<URL> resourcesFiles = PluginManager.class.getClassLoader().getResources(pluginFileName);

      while (resourcesFiles.hasMoreElements()) {
        URL url = resourcesFiles.nextElement();
        Properties properties = new Properties();
        loadProperties(url, properties);
        buildPluginNames(info, properties);
      }

      return new PluginManager(info);

    } catch (IOException e) {

      throw new GenerationException(e);
    }

  }
 
开发者ID:mulesoft-labs,项目名称:raml-java-tools,代码行数:22,代码来源:PluginManager.java

示例2: testOrderingDoesntAffectEqualsComparisons

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
@CollectionSize.Require(SEVERAL)
public void testOrderingDoesntAffectEqualsComparisons() {
  SetMultimap<K, V> multimap1 =
      getSubjectGenerator()
          .create(
              Helpers.mapEntry(k0(), v0()),
              Helpers.mapEntry(k0(), v1()),
              Helpers.mapEntry(k0(), v4()));
  SetMultimap<K, V> multimap2 =
      getSubjectGenerator()
          .create(
              Helpers.mapEntry(k0(), v1()),
              Helpers.mapEntry(k0(), v0()),
              Helpers.mapEntry(k0(), v4()));
  new EqualsTester().addEqualityGroup(multimap1, multimap2).testEquals();
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:SetMultimapEqualsTester.java

示例3: computeMultimapAsMapGetTestSuite

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SetTestSuiteBuilder.using(
            new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:18,代码来源:SetMultimapTestSuiteBuilder.java

示例4: computeMultimapAsMapGetTestSuite

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SortedSetTestSuiteBuilder.using(
            new SetMultimapTestSuiteBuilder.MultimapAsMapGetGenerator<K, V>(
                parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:19,代码来源:SortedSetMultimapTestSuiteBuilder.java

示例5: parse

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
public static DisableDamageModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
    SetMultimap<DamageCause, PlayerRelation> causes = HashMultimap.create();
    for(Element damageCauseElement : doc.getRootElement().getChildren("disabledamage")) {
        for(Element damageEl : damageCauseElement.getChildren("damage")) {
            DamageCause cause = XMLUtils.parseEnum(damageEl, DamageCause.class, "damage type");
            for(PlayerRelation damagerType : PlayerRelation.values()) {
                // Legacy syntax used "other" instead of "neutral"
                String attrName = damagerType.name().toLowerCase();
                Node attr = damagerType == PlayerRelation.NEUTRAL ? Node.fromAttr(damageEl, attrName, "other")
                                                                  : Node.fromAttr(damageEl, attrName);
                if(XMLUtils.parseBoolean(attr, true)) {
                    causes.put(cause, damagerType);

                    // Bukkit 1.7.10 changed TNT from BLOCK_EXPLOSION to ENTITY_EXPLOSION,
                    // so we include them both to keep old maps working.
                    if(cause == DamageCause.BLOCK_EXPLOSION) {
                        causes.put(DamageCause.ENTITY_EXPLOSION, damagerType);
                    }
                }
            }
        }
    }
    return new DisableDamageModule(causes);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:25,代码来源:DisableDamageModule.java

示例6: TargetedEventBusImpl

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
@Inject TargetedEventBusImpl(ExceptionHandler exceptionHandler, EventRegistry eventRegistry, TargetedEventHandlerScanner eventHandlerScanner, TypeMap<Object, TargetedEventRouter<?>> routers) {
    this.exceptionHandler = exceptionHandler;
    this.eventRegistry = eventRegistry;
    this.routers = routers;

    // Cache of handler methods per listener type
    this.listenerCache = CacheUtils.newCache(listener -> {
        final SetMultimap<EventKey<? extends Event>, EventHandlerInfo<? extends Event>> handlers = eventHandlerScanner.findEventHandlers(listener);
        for(EventHandlerInfo<? extends Event> info : handlers.values()) {
            if(this.routers.allAssignableFrom(info.event()).isEmpty()) {
                throw new InvalidMemberException(
                    info.method(),
                    "No router registered for targeted event type " + info.event().getName()
                );
            }
        }
        return handlers;
    });
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:20,代码来源:TargetedEventBusImpl.java

示例7: testInflightPuts

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
@Test
public void testInflightPuts() throws Exception {
  queue = new FlumeEventQueue(backingStore,
                              backingStoreSupplier.getInflightTakes(),
                              backingStoreSupplier.getInflightPuts(),
                              backingStoreSupplier.getQueueSetDir());
  long txnID1 = new Random().nextInt(Integer.MAX_VALUE - 1);
  long txnID2 = txnID1 + 1;
  queue.addWithoutCommit(new FlumeEventPointer(1, 1), txnID1);
  queue.addWithoutCommit(new FlumeEventPointer(2, 1), txnID1);
  queue.addWithoutCommit(new FlumeEventPointer(2, 2), txnID2);
  queue.checkpoint(true);
  TimeUnit.SECONDS.sleep(3L);
  queue = new FlumeEventQueue(backingStore,
                              backingStoreSupplier.getInflightTakes(),
                              backingStoreSupplier.getInflightPuts(),
                              backingStoreSupplier.getQueueSetDir());
  SetMultimap<Long, Long> deserializedMap = queue.deserializeInflightPuts();
  Assert.assertTrue(deserializedMap.get(txnID1).contains(new FlumeEventPointer(1, 1).toLong()));
  Assert.assertTrue(deserializedMap.get(txnID1).contains(new FlumeEventPointer(2, 1).toLong()));
  Assert.assertTrue(deserializedMap.get(txnID2).contains(new FlumeEventPointer(2, 2).toLong()));
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:23,代码来源:TestFlumeEventQueue.java

示例8: getExtensionMap

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
private SetMultimap<String, IntegrationSessionExtension> getExtensionMap()
{
	if( extensionMap == null )
	{
		synchronized( this )
		{
			if( extensionMap == null )
			{
				final SetMultimap<String, IntegrationSessionExtension> map = HashMultimap
					.<String, IntegrationSessionExtension>create();
				for( Extension ext : resultsTracker.getExtensions() )
				{
					final IntegrationSessionExtension integExtension = resultsTracker.getBeanByExtension(ext);
					for( Parameter parameter : ext.getParameters("type") )
					{
						map.put(parameter.valueAsString(), integExtension);
					}
				}
				extensionMap = Multimaps.unmodifiableSetMultimap(map);
			}
		}
	}
	return extensionMap;
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:AbstractIntegrationService.java

示例9: toevoegenAttributenAanDienstbundelGroepen

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
private void toevoegenAttributenAanDienstbundelGroepen(final List<DienstbundelGroep> alleDienstBundelgroepen,
                                                       final Map<Integer, Dienstbundel> dienstbundelIdMap,
                                                       final SetMultimap<Integer, DienstbundelGroepAttribuut> dbGrAttrBijDbGroep) {
    for (final DienstbundelGroep dienstbundelGroep : alleDienstBundelgroepen) {
        final Dienstbundel dienstbundel = dienstbundelIdMap.get(dienstbundelGroep.getDienstbundel().getId());
        if (dienstbundel != null) {
            dienstbundelGroep.setDienstbundel(dienstbundel);
        }
        final Set<DienstbundelGroepAttribuut> dienstbundelGroepAttribuutSet = dbGrAttrBijDbGroep.get(dienstbundelGroep.getId());
        if (dienstbundelGroepAttribuutSet != null) {
            dienstbundelGroep.setDienstbundelGroepAttribuutSet(dienstbundelGroepAttribuutSet);
        } else {
            dienstbundelGroep.setDienstbundelGroepAttribuutSet(Collections.emptySet());
        }
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:17,代码来源:LeveringsAutorisatieCacheHelperImpl.java

示例10: toevoegenSetsAanDienstbundels

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
private void toevoegenSetsAanDienstbundels(final List<Dienstbundel> alleDienstBundels,
                                           final SetMultimap<Integer, DienstbundelGroep> dienstbundelGroepenBijDienstbundelMap,
                                           final SetMultimap<Integer, DienstbundelLo3Rubriek> dienstbundelLo3RubriekenBijDienstbundelMap,
                                           final SetMultimap<Integer, Dienst> dienstenBijDienstbundelMap) {
    for (final Dienstbundel dienstbundel : alleDienstBundels) {
        final Set<DienstbundelGroep> dienstbundelGroepSet = dienstbundelGroepenBijDienstbundelMap.get(dienstbundel.getId());
        final Set<DienstbundelLo3Rubriek> dienstbundelLo3RubriekSet = dienstbundelLo3RubriekenBijDienstbundelMap.get(dienstbundel.getId());
        if (dienstbundelGroepSet != null) {
            dienstbundel.setDienstbundelGroepSet(dienstbundelGroepSet);
            dienstbundel.setDienstbundelLo3RubriekSet(dienstbundelLo3RubriekSet);
            dienstbundel.setDienstSet(dienstenBijDienstbundelMap.get(dienstbundel.getId()));
        } else {
            dienstbundel.setDienstbundelGroepSet(Collections.emptySet());
            dienstbundel.setDienstSet(Collections.emptySet());
        }
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:18,代码来源:LeveringsAutorisatieCacheHelperImpl.java

示例11: readKeys

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
/**
 * Read Semeval keys file.
 *
 * @param path path to keys file
 * @return map from sense IDs onto senses
 */
private static SetMultimap<String, String> readKeys(String path) {
    try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
        SetMultimap<String, String> keys = LinkedHashMultimap.create();
        String line;
        while ((line = reader.readLine()) != null) {
            if (line.isEmpty()) {
                continue;
            }
            String[] fields = line.split(" ");
            for (int i = 1; i < fields.length; ++i) {
                keys.put(fields[0], fields[i]);
            }
        }
        return keys;
    } catch (IOException e) {
        throw new RuntimeException("Error reading sense keys file", e);
    }
}
 
开发者ID:clearwsd,项目名称:clearwsd,代码行数:25,代码来源:SemevalReader.java

示例12: filterHandelingen

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
private Set<HandelingVoorPublicatie> filterHandelingen(final Set<Long> personenInLevering, final SetMultimap<Long, Long> admhndMap) {
    final Set<HandelingVoorPublicatie> teLeverenHandelingen = new HashSet<>();
    //loop over handelingen zonder status in levering en bepaal unieke bijgehouden persoon sets
    for (Long admhnId : admhndMap.keySet()) {
        final Set<Long> bijgehoudenPersonen = admhndMap.get(admhnId);
        if (Collections.disjoint(bijgehoudenPersonen, personenInLevering)) {
            final HandelingVoorPublicatie handelingVoorPublicatie = new HandelingVoorPublicatie();
            handelingVoorPublicatie.setAdmhndId(admhnId);
            handelingVoorPublicatie.setBijgehoudenPersonen(bijgehoudenPersonen);
            teLeverenHandelingen.add(handelingVoorPublicatie);
            personenInLevering.addAll(bijgehoudenPersonen);
        } else {
            LOGGER.debug(String.format("admhnd %s voor persoon al in levering, discard voor nu. Worden later opgepakt", admhnId));
        }
    }
    return teLeverenHandelingen;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:18,代码来源:AdmhndProducerVoorLeveringServiceImpl.java

示例13: identifyDuplicates

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
private void identifyDuplicates(List<ModContainer> mods)
{
    TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
    for (ModContainer mc : mods)
    {
        if (mc.getSource() != null)
        {
            dupsearch.put(mc, mc.getSource());
        }
    }

    ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
    SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
    for (Entry<ModContainer> e : duplist.entrySet())
    {
        if (e.getCount() > 1)
        {
            FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
            dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
        }
    }
    if (!dupes.isEmpty())
    {
        throw new DuplicateModsFoundException(dupes);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:Loader.java

示例14: setupConnectivity

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
protected void setupConnectivity() {
    /*
     * Parse Configuration and get Connect Point by VlanId.
     */
    SetMultimap<VlanId, ConnectPoint> confCPointsByVlan = getConfigCPoints();

    /*
     * Check that configured Connect Points have hosts attached and
     * associate their Mac Address to the Connect Points configured.
     */
    SetMultimap<VlanId, Pair<ConnectPoint, MacAddress>> confHostPresentCPoint =
            pairAvailableHosts(confCPointsByVlan);

    /*
     * Create and submit intents between the Connect Points.
     * Intents for broadcast between all the configured Connect Points.
     * Intents for unicast between all the configured Connect Points with
     * hosts attached.
     */
    intentInstaller.installIntents(confHostPresentCPoint);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:Vpls.java

示例15: bindMacAddr

import com.google.common.collect.SetMultimap; //导入依赖的package包/类
private void bindMacAddr(Map.Entry<VlanId, ConnectPoint> e,
                         SetMultimap<VlanId, Pair<ConnectPoint,
                         MacAddress>> confHostPresentCPoint) {
    VlanId vlanId = e.getKey();
    ConnectPoint cp = e.getValue();
    Set<Host> connectedHosts = hostService.getConnectedHosts(cp);
    if (!connectedHosts.isEmpty()) {
        connectedHosts.forEach(host -> {
            if (host.vlan().equals(vlanId)) {
                confHostPresentCPoint.put(vlanId, Pair.of(cp, host.mac()));
            } else {
                confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
            }
        });
    } else {
        confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:Vpls.java


注:本文中的com.google.common.collect.SetMultimap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。