當前位置: 首頁>>代碼示例>>Java>>正文


Java ImmutableSetMultimap類代碼示例

本文整理匯總了Java中com.google.common.collect.ImmutableSetMultimap的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableSetMultimap類的具體用法?Java ImmutableSetMultimap怎麽用?Java ImmutableSetMultimap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImmutableSetMultimap類屬於com.google.common.collect包,在下文中一共展示了ImmutableSetMultimap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getActions

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
@Override
public Multimap<ModelActionRole, ModelAction> getActions(ModelReference<?> subject, ModelRuleDescriptor descriptor) {
    return ImmutableSetMultimap.<ModelActionRole, ModelAction>builder()
        .put(ModelActionRole.Discover, AddProjectionsAction.of(subject, descriptor,
            ModelMapModelProjection.managed(schema.getType(), schema.getElementType(), ChildNodeInitializerStrategyAccessors.fromPrivateData())
        ))
        .put(ModelActionRole.Create, DirectNodeInputUsingModelAction.of(subject, descriptor,
            ModelReference.of(NodeInitializerRegistry.class),
            new BiAction<MutableModelNode, NodeInitializerRegistry>() {
                @Override
                public void execute(MutableModelNode modelNode, NodeInitializerRegistry nodeInitializerRegistry) {
                    ChildNodeInitializerStrategy<E> childStrategy = NodeBackedModelMap.createUsingRegistry(nodeInitializerRegistry);
                    modelNode.setPrivateData(ChildNodeInitializerStrategy.class, childStrategy);
                }
            }
        ))
        .build();
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:19,代碼來源:ModelMapNodeInitializerExtractionStrategy.java

示例2: getActions

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
@Override
public Multimap<ModelActionRole, ModelAction> getActions(ModelReference<?> subject, ModelRuleDescriptor descriptor) {
    return ImmutableSetMultimap.<ModelActionRole, ModelAction>builder()
        .put(ModelActionRole.Discover, AddProjectionsAction.of(subject, descriptor,
            TypedModelProjection.of(
                ModelTypes.modelSet(schema.getElementType()),
                new ModelSetModelViewFactory<E>(schema.getElementType())
            )
        ))
        .put(ModelActionRole.Create, DirectNodeInputUsingModelAction.of(subject, descriptor,
            ModelReference.of(NodeInitializerRegistry.class),
            new BiAction<MutableModelNode, NodeInitializerRegistry>() {
                @Override
                public void execute(MutableModelNode modelNode, NodeInitializerRegistry nodeInitializerRegistry) {
                    ChildNodeInitializerStrategy<T> childStrategy = new ManagedChildNodeCreatorStrategy<T>(nodeInitializerRegistry);
                    modelNode.setPrivateData(ChildNodeInitializerStrategy.class, childStrategy);
                }
            }
        ))
        .build();
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:22,代碼來源:ModelSetNodeInitializerExtractionStrategy.java

示例3: createUsingParentNode

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
public static <T> ChildNodeInitializerStrategy<T> createUsingParentNode(final Transformer<? extends NamedEntityInstantiator<T>, ? super MutableModelNode> instantiatorTransform) {
    return new ChildNodeInitializerStrategy<T>() {
        @Override
        public <S extends T> NodeInitializer initializer(final ModelType<S> type, Spec<ModelType<?>> constraints) {
            return new NodeInitializer() {
                @Override
                public Multimap<ModelActionRole, ModelAction> getActions(ModelReference<?> subject, ModelRuleDescriptor descriptor) {
                    return ImmutableSetMultimap.<ModelActionRole, ModelAction>builder()
                        .put(ModelActionRole.Discover, AddProjectionsAction.of(subject, descriptor,
                            UnmanagedModelProjection.of(type),
                            new ModelElementProjection(type)
                        ))
                        .put(ModelActionRole.Create, DirectNodeNoInputsModelAction.of(subject, descriptor, new Action<MutableModelNode>() {
                            @Override
                            public void execute(MutableModelNode modelNode) {
                                NamedEntityInstantiator<T> instantiator = instantiatorTransform.transform(modelNode.getParent());
                                S item = instantiator.create(modelNode.getPath().getName(), type.getConcreteClass());
                                modelNode.setPrivateData(type, item);
                            }
                        }))
                        .build();
                }
            };
        }
    };
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:27,代碼來源:NodeBackedModelMap.java

示例4: buildSubtyping

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
private static SetMultimap<String, ValueType> buildSubtyping(List<ValueType> implementationTypes) {
  ImmutableSetMultimap.Builder<String, ValueType> builder = ImmutableSetMultimap.builder();

  for (ValueType type : implementationTypes) {
    String abstractValueTypeName = type.typeAbstract().toString();
    builder.put(abstractValueTypeName, type);

    for (String className : type.getExtendedClassesNames()) {
      if (!className.equals(abstractValueTypeName)) {
        builder.put(className, type);
      }
    }
    for (String interfaceName : type.getImplementedInterfacesNames()) {
      if (!interfaceName.equals(abstractValueTypeName)) {
        builder.put(interfaceName, type);
      }
    }
  }

  return builder.build();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:CaseStructure.java

示例5: EventArgScoringAlignment

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
private EventArgScoringAlignment(final Symbol docID,
    final ArgumentOutput argumentOutput,
    final AnswerKey answerKey,
    final Iterable<EquivClassType> truePositiveECs,
    final Iterable<EquivClassType> falsePositiveECs,
    final Iterable<EquivClassType> falseNegativeECs,
    final Iterable<EquivClassType> unassessed,
    final Multimap<EquivClassType, AssessedResponse> ecsToAnswerKey,
    final Multimap<EquivClassType, Response> ecsToSystem) {
  this.docID = checkNotNull(docID);
  this.argumentOutput = checkNotNull(argumentOutput);
  this.answerKey = checkNotNull(answerKey);
  this.truePositiveECs = ImmutableSet.copyOf(truePositiveECs);
  this.falsePositiveECs = ImmutableSet.copyOf(falsePositiveECs);
  this.falseNegativeECs = ImmutableSet.copyOf(falseNegativeECs);
  this.unassessed = ImmutableSet.copyOf(unassessed);
  this.ecsToAnswerKey = ImmutableSetMultimap.copyOf(ecsToAnswerKey);
  this.ecsToSystem = ImmutableSetMultimap.copyOf(ecsToSystem);
}
 
開發者ID:isi-nlp,項目名稱:tac-kbp-eal,代碼行數:20,代碼來源:EventArgScoringAlignment.java

示例6: response2016CollapsedJustifications

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
/**
 * Collapses DocEventFrameReferences into their PJs for the particular document at hand.
 */
public static ImmutableSetMultimap<Symbol, QueryResponse2016> response2016CollapsedJustifications(
    final Iterable<Map.Entry<Symbol, Collection<DocEventFrameReference>>> matchesByDocument,
    final SystemOutputStore2016 store, final CorpusQuery2016 query)
    throws IOException {
  final ImmutableSetMultimap.Builder<Symbol, QueryResponse2016> retB =
      ImmutableSetMultimap.builder();
  for (final Map.Entry<Symbol, Collection<DocEventFrameReference>> matchEntry : matchesByDocument) {
    final Symbol docID = matchEntry.getKey();
    final Collection<DocEventFrameReference> eventFramesMatchedInDoc =
        matchEntry.getValue();
    final DocumentSystemOutput2015 docSystemOutput = store.read(docID);
    final ImmutableSet<CharOffsetSpan> matchJustifications =
        matchJustificationsForDoc(eventFramesMatchedInDoc, docSystemOutput);

    final QueryResponse2016 queryResponse2016 =
        QueryResponse2016.builder().docID(docID).queryID(query.id())
            .addAllPredicateJustifications(matchJustifications).build();
    retB.put(docID, queryResponse2016);
  }
  return retB.build();
}
 
開發者ID:isi-nlp,項目名稱:tac-kbp-eal,代碼行數:25,代碼來源:QueryResponseFromERE.java

示例7: finish

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
public void finish() throws IOException {
  outputDir.mkdirs();

  final ImmutableSetMultimap<String, String> mentionAlignmentFailures =
      mentionAlignmentFailuresB.build();
  log.info("Of {} system responses, got {} mention alignment failures",
      numResponses.size(), mentionAlignmentFailures.size());

  final File serializedFailuresFile = new File(outputDir, "alignmentFailures.json");
  final JacksonSerializer serializer =
      JacksonSerializer.builder().forJson().prettyOutput().build();
  serializer.serializeTo(mentionAlignmentFailures, Files.asByteSink(serializedFailuresFile));

  final File failuresCount = new File(outputDir, "alignmentFailures.count.txt");
  serializer.serializeTo(mentionAlignmentFailures.size(), Files.asByteSink(failuresCount));
}
 
開發者ID:isi-nlp,項目名稱:tac-kbp-eal,代碼行數:17,代碼來源:ScoreKBPAgainstERE.java

示例8: getPersistentChunksIterableFor

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
public static Iterator<Chunk> getPersistentChunksIterableFor(final World world, Iterator<Chunk> chunkIterator)
{
    final ImmutableSetMultimap<ChunkPos, Ticket> persistentChunksFor = getPersistentChunksFor(world);
    final ImmutableSet.Builder<Chunk> builder = ImmutableSet.builder();
    world.theProfiler.startSection("forcedChunkLoading");
    builder.addAll(Iterators.transform(persistentChunksFor.keys().iterator(), new Function<ChunkPos, Chunk>() {
        @Nullable
        @Override
        public Chunk apply(@Nullable ChunkPos input)
        {
            return world.getChunkFromChunkCoords(input.chunkXPos, input.chunkZPos);
        }
    }));
    world.theProfiler.endStartSection("regularChunkLoading");
    builder.addAll(chunkIterator);
    world.theProfiler.endSection();
    return builder.build().iterator();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:ForgeChunkManager.java

示例9: getType2Name2DependenciesMap

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
private ImmutableMap<DependencyType, Multimap<String, String>> getType2Name2DependenciesMap()
{
	final ImmutableMap.Builder<DependencyType, Multimap<String, String>> builder = ImmutableMap.builder();
	for (final Entry<DependencyType, ImmutableSetMultimap.Builder<String, String>> e : type2name2dependencies.entrySet())
	{
		final DependencyType dependencyType = e.getKey();
		final Multimap<String, String> name2dependencies = e.getValue().build();
		if (name2dependencies.isEmpty())
		{
			continue;
		}

		builder.put(dependencyType, name2dependencies);
	}

	return builder.build();
}
 
開發者ID:metasfresh,項目名稱:metasfresh-webui-api,代碼行數:18,代碼來源:DocumentFieldDependencyMap.java

示例10: add

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
public Builder add(final String fieldName, final Collection<String> dependsOnFieldNames, final DependencyType dependencyType)
{
	if (dependsOnFieldNames == null || dependsOnFieldNames.isEmpty())
	{
		return this;
	}

	ImmutableSetMultimap.Builder<String, String> fieldName2dependsOnFieldNames = type2name2dependencies.get(dependencyType);
	if (fieldName2dependsOnFieldNames == null)
	{
		fieldName2dependsOnFieldNames = ImmutableSetMultimap.builder();
		type2name2dependencies.put(dependencyType, fieldName2dependsOnFieldNames);
	}

	for (final String dependsOnFieldName : dependsOnFieldNames)
	{
		fieldName2dependsOnFieldNames.put(dependsOnFieldName, fieldName);
	}

	return this;
}
 
開發者ID:metasfresh,項目名稱:metasfresh-webui-api,代碼行數:22,代碼來源:DocumentFieldDependencyMap.java

示例11: entriesThatIncreaseGap_treatsIndexesSeparately

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
/**
 * Most partition keys will not clash, as they are delimited differently. For example, spans index
 * partition keys are delimited with dots, and annotations with colons.
 *
 * <p>This tests an edge case, where a delimiter exists in a service name.
 */
@Test
public void entriesThatIncreaseGap_treatsIndexesSeparately() throws Exception {
  ConcurrentMap<PartitionKeyToTraceId, Pair<Long>> sharedState = Maps.newConcurrentMap();

  // If indexes were not implemented properly, the span index app.foo would be mistaken as the
  // first service index
  ImmutableSetMultimap<PartitionKeyToTraceId, Long> parsed =
      ImmutableSetMultimap.<PartitionKeyToTraceId, Long>builder()
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800050L)
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800110L)
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800125L)
          .put(new PartitionKeyToTraceId(SERVICE_SPAN_NAME_INDEX, "app.foo", 20), 1467676800000L)
          .build();

  assertThat(Indexer.entriesThatIncreaseGap(sharedState, parsed)).hasSameEntriesAs(
      ImmutableSetMultimap.<PartitionKeyToTraceId, Long>builder()
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800050L)
          .put(new PartitionKeyToTraceId(SERVICE_NAME_INDEX, "app.foo", 20), 1467676800125L)
          .put(new PartitionKeyToTraceId(SERVICE_SPAN_NAME_INDEX, "app.foo", 20), 1467676800000L)
          .build()
  );
}
 
開發者ID:liaominghua,項目名稱:zipkin,代碼行數:29,代碼來源:IndexerTest.java

示例12: testRoleInference_RoleHierarchyInvolved

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
@Test //missing role is ambiguous without cardinality constraints
public void testRoleInference_RoleHierarchyInvolved() {
    GraknTx graph = unificationTestSet.tx();
    String relationString = "{($p, subRole2: $gc) isa binary;}";
    String relationString2 = "{(subRole1: $gp, $p) isa binary;}";
    RelationshipAtom relation = (RelationshipAtom) ReasonerQueries.atomic(conjunction(relationString, graph), graph).getAtom();
    RelationshipAtom relation2 = (RelationshipAtom) ReasonerQueries.atomic(conjunction(relationString2, graph), graph).getAtom();
    Multimap<Role, Var> roleMap = roleSetMap(relation.getRoleVarMap());
    Multimap<Role, Var> roleMap2 = roleSetMap(relation2.getRoleVarMap());

    ImmutableSetMultimap<Role, Var> correctRoleMap = ImmutableSetMultimap.of(
            graph.getRole("role"), var("p"),
            graph.getRole("subRole2"), var("gc"));
    ImmutableSetMultimap<Role, Var> correctRoleMap2 = ImmutableSetMultimap.of(
            graph.getRole("role"), var("p"),
            graph.getRole("subRole1"), var("gp"));
    assertEquals(correctRoleMap, roleMap);
    assertEquals(correctRoleMap2, roleMap2);
}
 
開發者ID:graknlabs,項目名稱:grakn,代碼行數:20,代碼來源:AtomicTest.java

示例13: selectPipelines

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
private ImmutableSet<Pipeline> selectPipelines(InterpreterListener interpreterListener,
                                               Set<Tuple2<String, String>> processingBlacklist,
                                               Message message,
                                               Set<String> initialStreamIds,
                                               ImmutableSetMultimap<String, Pipeline> streamConnection) {
    final String msgId = message.getId();

    // if a message-stream combination has already been processed (is in the set), skip that execution
    final Set<String> streamsIds = initialStreamIds.stream()
            .filter(streamId -> !processingBlacklist.contains(tuple(msgId, streamId)))
            .filter(streamConnection::containsKey)
            .collect(Collectors.toSet());
    final ImmutableSet<Pipeline> pipelinesToRun = streamsIds.stream()
            .flatMap(streamId -> streamConnection.get(streamId).stream())
            .collect(ImmutableSet.toImmutableSet());
    interpreterListener.processStreams(message, pipelinesToRun, streamsIds);
    log.debug("[{}] running pipelines {} for streams {}", msgId, pipelinesToRun, streamsIds);
    return pipelinesToRun;
}
 
開發者ID:Graylog2,項目名稱:graylog-plugin-pipeline-processor,代碼行數:20,代碼來源:PipelineInterpreter.java

示例14: State

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
@AssistedInject
public State(@Assisted ImmutableMap<String, Pipeline> currentPipelines,
             @Assisted ImmutableSetMultimap<String, Pipeline> streamPipelineConnections,
             MetricRegistry metricRegistry,
             @Named("processbuffer_processors") int processorCount,
             @Named("cached_stageiterators") boolean cachedIterators) {
    this.currentPipelines = currentPipelines;
    this.streamPipelineConnections = streamPipelineConnections;
    this.cachedIterators = cachedIterators;

    cache = CacheBuilder.newBuilder()
            .concurrencyLevel(processorCount)
            .recordStats()
            .build(new CacheLoader<Set<Pipeline>, StageIterator.Configuration>() {
                @Override
                public StageIterator.Configuration load(@Nonnull Set<Pipeline> pipelines) throws Exception {
                    return new StageIterator.Configuration(pipelines);
                }
            });

    // we have to remove the metrics, because otherwise we leak references to the cache (and the register call with throw)
    metricRegistry.removeMatching((name, metric) -> name.startsWith(name(PipelineInterpreter.class, "stage-cache")));
    MetricUtils.safelyRegisterAll(metricRegistry, new CacheStatsSet(name(PipelineInterpreter.class, "stage-cache"), cache));
}
 
開發者ID:Graylog2,項目名稱:graylog-plugin-pipeline-processor,代碼行數:25,代碼來源:PipelineInterpreter.java

示例15: getChunkCount

import com.google.common.collect.ImmutableSetMultimap; //導入依賴的package包/類
public int getChunkCount(ImmutableSetMultimap<ChunkPos, ForgeChunkManager.Ticket> tickets)
{
    int count = 0;
    for(ChunkPos key : tickets.asMap().keySet())
    {
        Collection<ForgeChunkManager.Ticket> ticketList = tickets.asMap().get(key);
        for(ForgeChunkManager.Ticket ticket : ticketList)
        {
            if(Reference.MOD_ID.equals(ticket.getModId()))
            {
                count++;
            }
        }
    }
    return count;
}
 
開發者ID:CorwinJV,項目名稱:AChunkLoader,代碼行數:17,代碼來源:CommandStats.java


注:本文中的com.google.common.collect.ImmutableSetMultimap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。