Java 类com.google.common.collect.SetMultimap 实例源码

项目:raml-java-tools    文件:PluginManager.java   
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);
    }

  }
项目:guava-mock    文件:SetMultimapEqualsTester.java   
@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();
}
项目:guava-mock    文件:SetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:guava-mock    文件:SortedSetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:ProjectAres    文件:DisableDamageModule.java   
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);
}
项目:ProjectAres    文件:TargetedEventBusImpl.java   
@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;
    });
}
项目:flume-release-1.7.0    文件:TestFlumeEventQueue.java   
@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()));
}
项目:Equella    文件:AbstractIntegrationService.java   
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;
}
项目:OperatieBRP    文件:LeveringsAutorisatieCacheHelperImpl.java   
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());
        }
    }
}
项目:OperatieBRP    文件:LeveringsAutorisatieCacheHelperImpl.java   
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());
        }
    }
}
项目:clearwsd    文件:SemevalReader.java   
/**
 * 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);
    }
}
项目:OperatieBRP    文件:AdmhndProducerVoorLeveringServiceImpl.java   
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;
}
项目:CustomWorldGen    文件:Loader.java   
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);
    }
}
项目:athena    文件:Vpls.java   
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);
}
项目:athena    文件:Vpls.java   
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));
    }
}
项目:android-auto-mapper    文件:MoreElements.java   
private static void getLocalAndInheritedMethods(
        PackageElement pkg, TypeElement type, SetMultimap<String, ExecutableElement> methods) {

    for (TypeMirror superInterface : type.getInterfaces()) {
        getLocalAndInheritedMethods(pkg, MoreTypes.asTypeElement(superInterface), methods);
    }
    if (type.getSuperclass().getKind() != TypeKind.NONE) {
        // Visit the superclass after superinterfaces so we will always see the implementation of a
        // method after any interfaces that declared it.
        getLocalAndInheritedMethods(pkg, MoreTypes.asTypeElement(type.getSuperclass()), methods);
    }
    for (ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) {
        if (!method.getModifiers().contains(Modifier.STATIC)
                && methodVisibleFromPackage(method, pkg)) {
            methods.put(method.getSimpleName().toString(), method);
        }
    }
}
项目:abhot    文件:SetMultimapDeserializer.java   
@Override
public SetMultimap<String, String> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
    SetMultimap<String, String> map = HashMultimap.create();

    JsonObject filters = json.getAsJsonObject();
    for (Map.Entry<String, JsonElement> filter : filters.entrySet())
    {
        String name = filter.getKey();
        JsonArray values = ((JsonArray)filter.getValue());
        for (JsonElement value : values)
        {
            map.put(name, value.getAsString());
        }
    }

    return map;
}
项目:abhot    文件:QueryParser.java   
@Inject
public QueryParser(AggregatorFactory aggregatorFactory, GroupByFactory groupByFactory,
        QueryPluginFactory pluginFactory)
{
    m_aggregatorFactory = aggregatorFactory;
    m_groupByFactory = groupByFactory;
    m_pluginFactory = pluginFactory;

    m_descriptorMap = new HashMap<>();

    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapterFactory(new LowercaseEnumTypeAdapterFactory());
    builder.registerTypeAdapter(TimeUnit.class, new TimeUnitDeserializer());
    builder.registerTypeAdapter(DateTimeZone.class, new DateTimeZoneDeserializer());
    builder.registerTypeAdapter(Metric.class, new MetricDeserializer());
    builder.registerTypeAdapter(SetMultimap.class, new SetMultimapDeserializer());
    builder.registerTypeAdapter(RelativeTime.class, new RelativeTimeSerializer());
    builder.registerTypeAdapter(SetMultimap.class, new SetMultimapSerializer());
    builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);

    m_gson = builder.create();
}
项目:googles-monorepo-demo    文件:SetMultimapEqualsTester.java   
@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();
}
项目:googles-monorepo-demo    文件:SetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:Reer    文件:ModuleMetadataSerializer.java   
private void writeDependencyConfigurationMapping(IvyDependencyMetadata dep) throws IOException {
    SetMultimap<String, String> confMappings = dep.getConfMappings();
    writeCount(confMappings.keySet().size());
    for (String conf : confMappings.keySet()) {
        writeString(conf);
        writeStringSet(confMappings.get(conf));
    }
}
项目:Reer    文件:ModuleMetadataSerializer.java   
private DependencyMetadata readDependency() throws IOException {
    ModuleVersionSelector requested = DefaultModuleVersionSelector.newSelector(readString(), readString(), readString());

    byte type = decoder.readByte();
    switch (type) {
        case TYPE_IVY:
            SetMultimap<String, String> configMappings = readDependencyConfigurationMapping();
            List<Artifact> artifacts = readDependencyArtifactDescriptors();
            List<Exclude> excludes = readExcludeRules();
            String dynamicConstraintVersion = readString();
            boolean force = readBoolean();
            boolean changing = readBoolean();
            boolean transitive = readBoolean();
            return new IvyDependencyMetadata(requested, dynamicConstraintVersion, force, changing, transitive, configMappings, artifacts, excludes);
        case TYPE_MAVEN:
            artifacts = readDependencyArtifactDescriptors();
            excludes = readExcludeRules();
            MavenScope scope = MavenScope.values()[decoder.readSmallInt()];
            boolean optional = decoder.readBoolean();
            return new MavenDependencyMetadata(scope, optional, requested, artifacts, excludes);
        default:
            throw new IllegalArgumentException("Unexpected dependency type found.");
    }
}
项目:Reer    文件:ModuleMetadataSerializer.java   
private SetMultimap<String, String> readDependencyConfigurationMapping() throws IOException {
    int size = readCount();
    SetMultimap<String, String> result = LinkedHashMultimap.create();
    for (int i = 0; i < size; i++) {
        String from = readString();
        Set<String> to = readStringSet();
        result.putAll(from, to);
    }
    return result;
}
项目:googles-monorepo-demo    文件:SortedSetMultimapTestSuiteBuilder.java   
@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();
  }
}
项目:raml-java-tools    文件:PluginManager.java   
private static void buildPluginNames(SetMultimap<String, Class<?>> info, Properties properties) {

    for (String name : properties.stringPropertyNames()) {

      List<Class<?>> classList = classList(name, properties.getProperty(name));
      if (info.containsKey(name)) {

        throw new GenerationException("duplicate name in plugins: " + name);
      }
      info.putAll(name, classList);
    }
  }
项目:AdvancedDataProfilingSeminar    文件:CoordinatesRepository.java   
public void storeUindCoordinates() throws AlgorithmExecutionException {
    ImmutableMap<ColumnIdentifier, TableInputGenerator> attributes =
            getRelationalInputMap(config.getInputGenerators());
    for (InclusionDependency uind : config.getUnaryInds()) {
        SetMultimap<Integer, Integer> uindCoordinates = generateCoordinates(uind, attributes);
        Path path = getPath();
        try {
            writeToFile(uind, uindCoordinates, path);
            uindToPath.put(uind, path);
        } catch (IOException e) {
            throw new AlgorithmExecutionException(
                    format("Error writing uind coordinates for uind %s to file %s", uind, path), e);
        }
    }
}
项目:googles-monorepo-demo    文件:SortedSetMultimapTestSuiteBuilder.java   
@Override
TestSuite computeMultimapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  return SortedSetTestSuiteBuilder.using(
          new SetMultimapTestSuiteBuilder.MultimapGetGenerator<K, V>(
              parentBuilder.getSubjectGenerator()))
      .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".get[key]")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava-mock    文件:SetMultimapTestSuiteBuilder.java   
@Override
TestSuite computeMultimapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  return SetTestSuiteBuilder.using(
          new MultimapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".get[key]")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava-mock    文件:SetMultimapTestSuiteBuilder.java   
@Override
TestSuite computeEntriesTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Map.Entry<K, V>>>
        parentBuilder) {
  return SetTestSuiteBuilder.using(
          new EntriesGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".entries")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava-mock    文件:SortedSetMultimapTestSuiteBuilder.java   
@Override
TestSuite computeMultimapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  return SortedSetTestSuiteBuilder.using(
          new SetMultimapTestSuiteBuilder.MultimapGetGenerator<K, V>(
              parentBuilder.getSubjectGenerator()))
      .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".get[key]")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
项目:guava-mock    文件:TestStringSetMultimapGenerator.java   
@Override
public final SetMultimap<String, String> create(Object... entries) {
  @SuppressWarnings("unchecked")
  Entry<String, String>[] array = new Entry[entries.length];
  int i = 0;
  for (Object o : entries) {
    @SuppressWarnings("unchecked")
    Entry<String, String> e = (Entry<String, String>) o;
    array[i++] = e;
  }
  return create(array);
}
项目:CustomWorldGen    文件:ASMDataTable.java   
public SetMultimap<String,ASMData> getAnnotationsFor(ModContainer container)
{
    if (containerAnnotationData == null)
    {
        ImmutableMap.Builder<ModContainer, SetMultimap<String, ASMData>> mapBuilder = ImmutableMap.builder();
        for (ModContainer cont : containers)
        {
            Multimap<String, ASMData> values = Multimaps.filterValues(globalAnnotationData, new ModContainerPredicate(cont));
            mapBuilder.put(cont, ImmutableSetMultimap.copyOf(values));
        }
        containerAnnotationData = mapBuilder.build();
    }
    return containerAnnotationData.get(container);
}
项目:ProjectAres    文件:ImmutableTypeMap.java   
public static <K, V> ImmutableTypeMap<K, V> copyOf(TypeMap<? extends K, ? extends V> that) {
    if(that instanceof ImmutableTypeMap) {
        return (ImmutableTypeMap<K, V>) that;
    } else {
        return copyOf((SetMultimap) that);
    }
}
项目:flume-release-1.7.0    文件:FlumeEventQueue.java   
/**
 * Read the inflights file and return a
 * {@link com.google.common.collect.SetMultimap}
 * of transactionIDs to events that were inflight.
 *
 * @return - map of inflight events per txnID.
 */
public SetMultimap<Long, Long> deserialize()
    throws IOException, BadCheckpointException {
  SetMultimap<Long, Long> inflights = HashMultimap.create();
  if (!fileChannel.isOpen()) {
    file = new RandomAccessFile(inflightEventsFile, "rw");
    fileChannel = file.getChannel();
  }
  if (file.length() == 0) {
    return inflights;
  }
  file.seek(0);
  byte[] checksum = new byte[16];
  file.read(checksum);
  ByteBuffer buffer = ByteBuffer.allocate(
      (int) (file.length() - file.getFilePointer()));
  fileChannel.read(buffer);
  byte[] fileChecksum = digest.digest(buffer.array());
  if (!Arrays.equals(checksum, fileChecksum)) {
    throw new BadCheckpointException("Checksum of inflights file differs"
        + " from the checksum expected.");
  }
  buffer.position(0);
  LongBuffer longBuffer = buffer.asLongBuffer();
  try {
    while (true) {
      long txnID = longBuffer.get();
      int numEvents = (int) (longBuffer.get());
      for (int i = 0; i < numEvents; i++) {
        long val = longBuffer.get();
        inflights.put(txnID, val);
      }
    }
  } catch (BufferUnderflowException ex) {
    LOG.debug("Reached end of inflights buffer. Long buffer position ="
        + String.valueOf(longBuffer.position()));
  }
  return inflights;
}
项目:flume-release-1.7.0    文件:TestFlumeEventQueue.java   
@Test
public void testInflightTakes() 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.addTail(new FlumeEventPointer(1, 1));
  queue.addTail(new FlumeEventPointer(2, 1));
  queue.addTail(new FlumeEventPointer(2, 2));
  queue.removeHead(txnID1);
  queue.removeHead(txnID2);
  queue.removeHead(txnID2);
  queue.checkpoint(true);
  TimeUnit.SECONDS.sleep(3L);
  queue = new FlumeEventQueue(backingStore,
      backingStoreSupplier.getInflightTakes(),
      backingStoreSupplier.getInflightPuts(),
      backingStoreSupplier.getQueueSetDir());
  SetMultimap<Long, Long> deserializedMap = queue.deserializeInflightTakes();
  Assert.assertTrue(deserializedMap.get(
          txnID1).contains(new FlumeEventPointer(1, 1).toLong()));
  Assert.assertTrue(deserializedMap.get(
          txnID2).contains(new FlumeEventPointer(2, 1).toLong()));
  Assert.assertTrue(deserializedMap.get(
          txnID2).contains(new FlumeEventPointer(2, 2).toLong()));

}
项目:Equella    文件:AbstractIntegrationService.java   
protected Set<IntegrationSessionExtension> getExtensions()
{
    final SetMultimap<String, IntegrationSessionExtension> map = getExtensionMap();
    final Set<IntegrationSessionExtension> typeExtensions = Sets.newHashSet(map.get(getIntegrationType()));
    typeExtensions.addAll(map.get(ALL_TYPES_KEY));
    return typeExtensions;
}
项目:OperatieBRP    文件:LeveringsAutorisatieCacheHelperImpl.java   
private void toevoegenDienstbundelsAanLevAutorisaties(final Map<Integer, Leveringsautorisatie> leveringsAutorisatieMap,
                                                      final SetMultimap<Integer, Dienstbundel> dienstbundelMap) {
    for (Leveringsautorisatie leveringsautorisatie : leveringsAutorisatieMap.values()) {
        final Set<Dienstbundel> dienstbundelSet = dienstbundelMap.get(leveringsautorisatie.getId());
        if (dienstbundelSet != null) {
            leveringsautorisatie.setDienstbundelSet(dienstbundelSet);
        } else {
            leveringsautorisatie.setDienstbundelSet(Collections.emptySet());
        }
    }
}
项目:OperatieBRP    文件:LeveringsAutorisatieCacheHelperImpl.java   
private SetMultimap<Integer, Dienstbundel> maakLeveringautorisatieDienstbundelMapping(final List<Dienstbundel> alleDienstBundels) {
    final SetMultimap<Integer, Dienstbundel> map = HashMultimap.create();
    for (final Dienstbundel dienstbundel : alleDienstBundels) {
        map.put(dienstbundel.getLeveringsautorisatie().getId(), dienstbundel);
    }
    return map;
}
项目:OperatieBRP    文件:LeveringsAutorisatieCacheHelperImpl.java   
private SetMultimap<Integer, Dienst> maakDienstMapping(final List<Dienst> alleDiensten) {
    final SetMultimap<Integer, Dienst> map = HashMultimap.create();
    for (final Dienst dienst : alleDiensten) {
        map.put(dienst.getDienstbundel().getId(), dienst);
    }
    return map;

}
项目:OperatieBRP    文件:LeveringsAutorisatieCacheHelperImpl.java   
private SetMultimap<Integer, DienstbundelGroep> maakDienstbundelgroepDienstbundelMapping(final List<DienstbundelGroep> alleDienstBundelgroepen) {
    final SetMultimap<Integer, DienstbundelGroep> map = HashMultimap.create();
    for (final DienstbundelGroep dienstbundelGroep : alleDienstBundelgroepen) {
        map.put(dienstbundelGroep.getDienstbundel().getId(), dienstbundelGroep);
    }
    return map;
}