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


Java ImmutableMultimap.Builder方法代码示例

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


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

示例1: apply

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
@Override
public Multimap<Character, Map.Entry<String, ValueAttribute>> apply(Iterable<ValueAttribute> attributes) {
  ImmutableMultimap.Builder<Character, Map.Entry<String, ValueAttribute>> builder = ImmutableMultimap.builder();

  for (ValueAttribute attribute : attributes) {
    String serializedName = attribute.getMarshaledName();
    builder.put(serializedName.charAt(0), Maps.immutableEntry(serializedName, attribute));

    for (String alternateName : attribute.getAlternateSerializedNames()) {
      if (!alternateName.isEmpty()) {
        builder.put(alternateName.charAt(0), Maps.immutableEntry(alternateName, attribute));
      }
    }
  }

  return builder.build();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:Gsons.java

示例2: toFMeasures

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
private ImmutableMultimap<String, FMeasureCounts> toFMeasures(
    Collection<BrokenDownSummaryConfusionMatrix<Symbol>> data,
    Map.Entry<String, Collection<Symbol>> FMeasureSymbol) {
  final ImmutableMultimap.Builder<String, FMeasureCounts> ret = ImmutableMultimap.builder();

    /*
     MapUtils.copyWithTransformedEntries(data.asMap(),
                        Functions.toStringFunction(), FmeasureVs(FMeasureSymbol.getValue()));
     */
  final Function<SummaryConfusionMatrix, FMeasureCounts> scoringFunction =
      FmeasureVs(ImmutableSet.copyOf(FMeasureSymbol.getValue()));
  for (final BrokenDownSummaryConfusionMatrix<Symbol> dataPoint : data) {
    for (final Map.Entry<Symbol, SummaryConfusionMatrix> entry : dataPoint.asMap().entrySet()) {
      ret.put(entry.getKey().toString(), scoringFunction.apply(entry.getValue()));
    }
  }

  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:20,代码来源:EAScoringObserver.java

示例3: combine

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
public static <K, V> Multimap<K, V> combine(Iterable<Multimap<K, V>> maps) {
    Multimap<K, V> singleton = null;
    ImmutableMultimap.Builder<K, V> builder = null;
    for(Multimap<K, V> map : maps) {
        if(!map.isEmpty()) {
            if(singleton == null) {
                singleton = map;
            } else {
                if(builder == null) {
                    builder = ImmutableMultimap.builder();
                }
                builder.putAll(singleton);
                builder.putAll(map);
            }
        }
    }

    if(builder != null) {
        return builder.build();
    } else if(singleton != null) {
        return singleton;
    } else {
        return ImmutableMultimap.of();
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:26,代码来源:MapUtils.java

示例4: getResultingSourceMapping

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
public ImmutableMultimap<Integer, Record> getResultingSourceMapping(XmlDocument xmlDocument)
        throws ParserConfigurationException, SAXException, IOException {

    XmlLoader.SourceLocation inMemory = XmlLoader.UNKNOWN;

    XmlDocument loadedWithLineNumbers = XmlLoader.load(
            xmlDocument.getSelectors(),
            xmlDocument.getSystemPropertyResolver(),
            inMemory,
            xmlDocument.prettyPrint(),
            XmlDocument.Type.MAIN,
            Optional.<String>absent() /* mainManifestPackageName */);

    ImmutableMultimap.Builder<Integer, Record> mappingBuilder = ImmutableMultimap.builder();
    for (XmlElement xmlElement : loadedWithLineNumbers.getRootNode().getMergeableElements()) {
        parse(xmlElement, mappingBuilder);
    }
    return mappingBuilder.build();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:Actions.java

示例5: parse

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
private void parse(XmlElement element,
        ImmutableMultimap.Builder<Integer, Record> mappings) {
    DecisionTreeRecord decisionTreeRecord = mRecords.get(element.getId());
    if (decisionTreeRecord != null) {
        NodeRecord nodeRecord = findNodeRecord(decisionTreeRecord);
        if (nodeRecord != null) {
            mappings.put(element.getPosition().getLine(), nodeRecord);
        }
        for (XmlAttribute xmlAttribute : element.getAttributes()) {
            AttributeRecord attributeRecord = findAttributeRecord(decisionTreeRecord,
                    xmlAttribute);
            if (attributeRecord != null) {
                mappings.put(xmlAttribute.getPosition().getLine(), attributeRecord);
            }
        }
    }
    for (XmlElement xmlElement : element.getMergeableElements()) {
        parse(xmlElement, mappings);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:Actions.java

示例6: build

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
public ImmutableGroupedPropertyMap build() {
	ImmutableMap.Builder<Key, ImmutableMap<String, Object>> mapOfMapsBuilder=ImmutableMap.builder();
	ImmutableMultimap.Builder<Key, String> groupOfKeyBuilder=ImmutableMultimap.builder();
	
	maps.forEach((key, map) -> {
		mapOfMapsBuilder.put(key, ImmutableMap.copyOf(map));
	});
	
	maps.keySet().forEach(key -> {
		Key current=key;
		while (!current.isRoot()) {
			Key parent = current.parent();
			groupOfKeyBuilder.put(parent, current.last());
			current=parent;
		}
	});
	
	return new ImmutableGroupedPropertyMap(mapOfMapsBuilder.build(), groupOfKeyBuilder.build());
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:20,代码来源:ImmutableGroupedPropertyMap.java

示例7: setParent

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void setParent(Node<Mesh> parent)
{
    this.parent = parent;
    Deque<Node<?>> queue = new ArrayDeque<Node<?>>(parent.getNodes().values());
    while(!queue.isEmpty())
    {
        Node<?> node = queue.pop();
        if(node.getKind() instanceof Bone)
        {
            bones.add((Node<Bone>)node);
            queue.addAll(node.getNodes().values());
        }
    }
    ImmutableMultimap.Builder<Vertex, Pair<Float, Node<Bone>>> builder = ImmutableMultimap.builder();
    for(Node<Bone> bone : getBones())
    {
        for(Pair<Vertex, Float> b : bone.getKind().getData())
        {
            builder.put(b.getLeft(), Pair.of(b.getRight(), bone));
        }
    }
    weightMap = builder.build();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:B3DModel.java

示例8: makeAnnotatorsToDocumentsMap

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
private static ImmutableMultimap<Symbol, Symbol> makeAnnotatorsToDocumentsMap(
    Table<Symbol, Symbol, Symbol> annotatorsTable, Set<Symbol> targetDocIDs) {
  final ImmutableMultimap.Builder<Symbol, Symbol> ret = ImmutableMultimap.builder();

  for (final Symbol docID : targetDocIDs) {
    for (final Symbol annotator : annotatorsTable.row(docID).values()) {
      ret.put(annotator, docID);
    }
  }

  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:13,代码来源:SelectForDualAnnotation.java

示例9: makeEventTypesToDocumentsMap

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
private static ImmutableMultimap<Symbol, Symbol> makeEventTypesToDocumentsMap(
    AnnotationStore annotationStore, Set<Symbol> targetDocIDs) throws IOException {
  final ImmutableMultimap.Builder<Symbol, Symbol> ret = ImmutableMultimap.builder();

  for (final Symbol docID : targetDocIDs) {
    for (final Response response : annotationStore.readOrEmpty(docID).allResponses()) {
      ret.put(response.type(), docID);
    }
  }

  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:13,代码来源:SelectForDualAnnotation.java

示例10: loadTypesToValidRolesMap

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
private static Multimap<Symbol, Symbol> loadTypesToValidRolesMap(final Parameters params)
    throws IOException {
  final Multimap<Symbol, Symbol> typesToValidRolesInitial = FileUtils.loadSymbolMultimap(
      Files.asCharSource(params.getExistingFile("typeAndRoleFile"), Charsets.UTF_8));
  final Set<Symbol> alwaysValidRoles = params.getSymbolSet("alwaysValidRoles");
  final ImmutableMultimap.Builder<Symbol, Symbol> typesToValidRolesB = ImmutableMultimap.builder();
  typesToValidRolesB.putAll(typesToValidRolesInitial);
  for (final Symbol eventType : typesToValidRolesInitial.keySet()) {
    typesToValidRolesB.putAll(eventType, alwaysValidRoles);
  }
  return typesToValidRolesB.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:13,代码来源:FilterAnswerKeyByTypeAndRole.java

示例11: docEventsToCorpusEvents

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
@Value.Derived
public ImmutableMultimap<DocEventFrameReference, CorpusEventFrame> docEventsToCorpusEvents() {
  final ImmutableMultimap.Builder<DocEventFrameReference, CorpusEventFrame> ret =
      ImmutableMultimap.builder();

  for (final CorpusEventFrame corpusEventFrame : corpusEventFrames()) {
    for (final DocEventFrameReference docEventFrameReference : corpusEventFrame
        .docEventFrames()) {
      ret.put(docEventFrameReference, corpusEventFrame);
    }
  }

  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:15,代码来源:_CorpusEventLinking.java

示例12: responsesToContainingResponseSets

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
@Value.Derived
public ImmutableMultimap<Response, ResponseSet> responsesToContainingResponseSets() {
  final ImmutableMultimap.Builder<Response, ResponseSet> ret = ImmutableMultimap.builder();
  for (final ResponseSet responseSet : responseSets()) {
    for (final Response response : responseSet) {
      ret.put(response, responseSet);
    }
  }
  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:11,代码来源:_ResponseLinking.java

示例13: loadFrom

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
public final CorpusQueryAssessments loadFrom(final CharSource source) throws IOException {
  final List<String> lines = source.readLines();
  final List<QueryResponse2016> queries = Lists.newArrayList();
  final Map<QueryResponse2016, String> metadata = Maps.newHashMap();
  final ImmutableMultimap.Builder<QueryResponse2016, Symbol> responsesToSystems =
      ImmutableMultimap.builder();
  final Map<QueryResponse2016, QueryAssessment2016> assessments = Maps.newHashMap();
  Optional<String> lastMetadata = Optional.absent();
  for (final String line : lines) {
    if (line.startsWith("#")) {
      lastMetadata = Optional.of(line.trim().substring(1));
    } else {
      final String[] parts = line.trim().split("\t");
      checkArgument(parts.length == 5, "expected five columns, but got " + parts.length);
      final Symbol queryID = Symbol.from(parts[0]);
      final Symbol docID = Symbol.from(parts[1]);
      final String[] systemIDs = parts[2].split(",");
      final ImmutableSortedSet<CharOffsetSpan> spans = extractPJSpans(parts[3]);
      final QueryAssessment2016 assessment = QueryAssessment2016.valueOf(parts[4]);
      final QueryResponse2016 query =
          QueryResponse2016.builder().queryID(queryID).docID(docID)
              .addAllPredicateJustifications(spans).build();
      queries.add(query);
      for(final String systemID: systemIDs) {
        responsesToSystems.put(query, Symbol.from(systemID));
      }
      if (!assessment.equals(QueryAssessment2016.UNASSESSED)) {
        assessments.put(query, assessment);
      }
      if (lastMetadata.isPresent()) {
        metadata.put(query, lastMetadata.get());
        lastMetadata = Optional.absent();
      }
    }
  }
  return CorpusQueryAssessments.builder().addAllQueryReponses(queries).assessments(assessments)
      .queryResponsesToSystemIDs(responsesToSystems.build())
      .metadata(metadata).build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:40,代码来源:SingleFileQueryAssessmentsLoader.java

示例14: combineMapsToMultimap

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
@MoveToBUECommon
private static <K, V> ImmutableMultimap<K, V> combineMapsToMultimap(
    Iterable<? extends Map<K, V>> maps) {
  final ImmutableMultimap.Builder<K, V> ret = ImmutableMultimap.builder();

  for (final Map<K, V> map : maps) {
    ret.putAll(Multimaps.forMap(map));
  }

  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:12,代码来源:EAScoringObserver.java

示例15: reverse

import com.google.common.collect.ImmutableMultimap; //导入方法依赖的package包/类
private ImmutableMultimap<ImmutableMap<String, Object>, Blob> reverse(ImmutableMultimap<ImmutableMap<String, Object>, Blob> src) {
	ImmutableMultimap.Builder<ImmutableMap<String,Object>, Blob> builder=ImmutableMultimap.builder();
	src.keySet().asList().reverse().forEach(key -> {
		builder.putAll(key, src.get(key));
	});
	return builder.build();
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:8,代码来源:DefaultSiteGenerator.java


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