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


Java ImmutableSet.builder方法代码示例

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


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

示例1: getFlowRulesFrom

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private Set<FlowEntry> getFlowRulesFrom(ConnectPoint egress) {
    ImmutableSet.Builder<FlowEntry> builder = ImmutableSet.builder();
    flowRuleService.getFlowEntries(egress.deviceId()).forEach(r -> {
        if (r.appId() == appId.id()) {
            r.treatment().allInstructions().forEach(i -> {
                if (i.type() == Instruction.Type.OUTPUT) {
                    if (((Instructions.OutputInstruction) i).port().equals(egress.port())) {
                        builder.add(r);
                    }
                }
            });
        }
    });

    return builder.build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:ReactiveForwarding.java

示例2: vRouterMacs

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
 * Gets vRouters from the config.
 *
 * @return Set of vRouter MAC addresses, empty is not specified,
 *         or null if not valid
 */
public Set<MacAddress> vRouterMacs() {
    if (!object.has(VROUTER_MACS)) {
        return ImmutableSet.of();
    }

    ImmutableSet.Builder<MacAddress> builder = ImmutableSet.builder();
    ArrayNode arrayNode = (ArrayNode) object.path(VROUTER_MACS);
    for (JsonNode jsonNode : arrayNode) {
        MacAddress mac;

        String macStr = jsonNode.asText(null);
        if (macStr == null) {
            return null;
        }
        try {
            mac = MacAddress.valueOf(macStr);
        } catch (IllegalArgumentException e) {
            return null;
        }

        builder.add(mac);
    }
    return builder.build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:SegmentRoutingAppConfig.java

示例3: getDisjointPaths

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
 * Computes on-demand the set of shortest disjoint path pairs between source and
 * destination devices.
 *
 * @param src    source device
 * @param dst    destination device
 * @param weight link weight function
 * @return set of disjoint shortest path pairs
 */
public Set<DisjointPath> getDisjointPaths(DeviceId src, DeviceId dst, LinkWeight weight) {
    DefaultTopologyVertex srcV = new DefaultTopologyVertex(src);
    DefaultTopologyVertex dstV = new DefaultTopologyVertex(dst);
    Set<TopologyVertex> vertices = graph.getVertexes();
    if (!vertices.contains(srcV) || !vertices.contains(dstV)) {
        // src or dst not part of the current graph
        return ImmutableSet.of();
    }

    GraphPathSearch.Result<TopologyVertex, TopologyEdge> result =
            SUURBALLE.search(graph, srcV, dstV, weight, ALL_PATHS);
    ImmutableSet.Builder<DisjointPath> builder = ImmutableSet.builder();
    for (org.onlab.graph.Path<TopologyVertex, TopologyEdge> path : result.paths()) {
        builder.add(networkDisjointPath((org.onlab.graph.DisjointPathPair<TopologyVertex, TopologyEdge>) path));
    }
    return builder.build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:DefaultTopology.java

示例4: precomputeAncestors

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
 * @return Precomputed map from term id to list of ancestor term ids (a term is its own ancestor).
 */
private ImmutableMap<TermId, ImmutableSet<TermId>> precomputeAncestors() {
  final ImmutableMap.Builder<TermId, ImmutableSet<TermId>> mapBuilder = ImmutableMap.builder();

  for (TermId termId : graph.getVertices()) {
    final ImmutableSet.Builder<TermId> setBuilder = ImmutableSet.builder();
    BreadthFirstSearch<TermId, ImmutableEdge<TermId>> bfs = new BreadthFirstSearch<>();
    bfs.startFromForward(graph, termId, new VertexVisitor<TermId, ImmutableEdge<TermId>>() {
      @Override
      public boolean visit(DirectedGraph<TermId, ImmutableEdge<TermId>> g, TermId v) {
        setBuilder.add(v);
        return true;
      }
    });

    mapBuilder.put(termId, setBuilder.build());
  }

  return mapBuilder.build();
}
 
开发者ID:Phenomics,项目名称:ontolib,代码行数:23,代码来源:ImmutableOntology.java

示例5: gatherTypes

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private ImmutableSet<Symbol> gatherTypes(final EREEvent ereEvent) {
  final ImmutableSet.Builder<Symbol> ret = ImmutableSet.builder();
  for (final EREEventMention ereEventMention : ereEvent.getEventMentions()) {
    final Symbol mappedMainType = ontologyMapper.eventType(
        Symbol.from(ereEventMention.getType())).get();
    final Symbol mappedSubType = ontologyMapper.eventSubtype(
        Symbol.from(ereEventMention.getSubtype())).get();

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

示例6: gatherDocumentEventsForResponses

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private void gatherDocumentEventsForResponses(final List<Response> matchingResponses,
    final DocumentSystemOutput2015 docSystemOutput,
    final ImmutableSet.Builder<DocEventFrameReference> retB) {
  final ImmutableSet.Builder<ResponseSet> matchingResponseSetsB = ImmutableSet.builder();
  for (final Response matchingResponse : matchingResponses) {
    matchingResponseSetsB.addAll(docSystemOutput.linking()
        .responsesToContainingResponseSets().get(matchingResponse));
  }
  final ImmutableSet<ResponseSet> matchingResponseSets = matchingResponseSetsB.build();

  for (final ResponseSet matchingResponseSet : matchingResponseSets) {
    retB.add(docSystemOutput.linking().asEventFrameReference(matchingResponseSet));
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:15,代码来源:CorpusQueryExecutor2016.java

示例7: sourceRootsOf

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private static Set<String> sourceRootsOf(Class<?>... classes) {
    ImmutableSet.Builder<String> result = ImmutableSet.builder();
    for (Class<?> c : classes) {
        String classFile = "/" + c.getName().replace('.', '/') + ".class";
        String file = c.getResource(classFile).getFile();
        result.add(file.substring(0, file.indexOf(classFile)));
    }
    return result.build();
}
 
开发者ID:TNG,项目名称:ArchUnit,代码行数:10,代码来源:ArchUnitArchitectureTest.java

示例8: ancestors

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public static Set<Method> ancestors(Method method) {
    if(Members.isPrivate(method)) return Collections.emptySet();

    final ImmutableSet.Builder<Method> builder = ImmutableSet.builder();
    for(Class<?> ancestor : Types.ancestors(method.getDeclaringClass())) {
        final Method sup = overrideIn(ancestor, method);
        if(sup != null) builder.add(sup);
    }
    return builder.build();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:11,代码来源:Methods.java

示例9: getScores

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public ImmutableSet<Score> getScores(OfflinePlayer player) throws IllegalArgumentException {
    Validate.notNull(player, "OfflinePlayer cannot be null");

    ImmutableSet.Builder<Score> scores = ImmutableSet.builder();
    for (CraftObjective objective : objectives.values()) {
        scores.add(objective.getScore(player));
    }
    return scores.build();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:10,代码来源:CraftScoreboard.java

示例10: getFieldAccessesFromSelf

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@PublicAPI(usage = ACCESS)
public Set<JavaFieldAccess> getFieldAccessesFromSelf() {
    ImmutableSet.Builder<JavaFieldAccess> result = ImmutableSet.builder();
    for (JavaCodeUnit codeUnit : codeUnits) {
        result.addAll(codeUnit.getFieldAccesses());
    }
    return result.build();
}
 
开发者ID:TNG,项目名称:ArchUnit,代码行数:9,代码来源:JavaClass.java

示例11: getApplicationNames

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
 * Returns the set of installed application names.
 *
 * @return installed application names
 */
public Set<String> getApplicationNames() {
    ImmutableSet.Builder<String> names = ImmutableSet.builder();
    File[] files = appsDir.listFiles(File::isDirectory);
    if (files != null) {
        for (File file : files) {
            names.add(file.getName());
        }
    }
    return names.build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:ApplicationArchive.java

示例12: lessSpecificCompatibleTimes

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public ImmutableSet<KBPTIMEXExpression> lessSpecificCompatibleTimes() {
  final ImmutableSet.Builder<KBPTIMEXExpression> ret = ImmutableSet.builder();

  final StringBuilder curDay = new StringBuilder(day);
  final StringBuilder curMonth = new StringBuilder(month);
  final StringBuilder curYear = new StringBuilder(year);

  for (int i = 1; i >= 0; --i) {
    if (!isX(curDay.charAt(i))) {
      curDay.setCharAt(i, 'X');
      ret.add(KBPTIMEXExpression.fromYMD(curYear.toString(),
          curMonth.toString(), curDay.toString()));
    }
  }

  for (int i = 1; i >= 0; --i) {
    if (!isX(curMonth.charAt(i))) {
      curMonth.setCharAt(i, 'X');
      ret.add(KBPTIMEXExpression.fromYMD(curYear.toString(),
          curMonth.toString(), curDay.toString()));
    }
  }

  // don't terminate at 0 because all Xes is an invalid year
  for (int i = 3; i >= 1; --i) {
    if (!isX(curYear.charAt(i))) {
      curYear.setCharAt(i, 'X');
      ret.add(KBPTIMEXExpression.fromYMD(curYear.toString(),
          curMonth.toString(), curDay.toString()));
    }
  }

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

示例13: toSQLConvertSupport

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public static final Set<SQLConvertSupport> toSQLConvertSupport(Iterable<ConvertSupport> convertSupportIterable) {
  ImmutableSet.Builder<SQLConvertSupport> sqlConvertSupportSet = ImmutableSet.builder();
  for(ConvertSupport convertSupport: convertSupportIterable) {
    try {
      sqlConvertSupportSet.add(new SQLConvertSupport(
          toSQLType(convertSupport.getFrom()),
          toSQLType(convertSupport.getTo())));
    } catch(IllegalArgumentException e) {
      // Ignore unknown types...
    }
  }
  return sqlConvertSupportSet.build();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:DremioDatabaseMetaDataImpl.java

示例14: getLicenses

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @return An immutable set containing all licenses.
 */
@Override
public ImmutableSet<GSVMLicense> getLicenses() {
    if (licenseSet == null) {
        ImmutableSet.Builder<GSVMLicense> builder = ImmutableSet.builder();
        builder.add(nationalCircle.getLicenses());
        builder.add(regionalCircle.getLicenses());
        licenseSet = builder.build();
    }
    return licenseSet;
}
 
开发者ID:spectrumauctions,项目名称:sats-core,代码行数:16,代码来源:GSVMWorld.java

示例15: mergeSpecsOf

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private Spec mergeSpecsOf(List<Class<? extends GradleApiSpecProvider>> providers) {
    final ImmutableSet.Builder<String> exportedPackages = ImmutableSet.builder();
    final ImmutableSet.Builder<String> exportedResourcePrefixes = ImmutableSet.builder();
    for (Class<? extends GradleApiSpecProvider> provider : providers) {
        Spec spec = specFrom(provider);
        exportedPackages.addAll(spec.getExportedPackages());
        exportedResourcePrefixes.addAll(spec.getExportedResourcePrefixes());
    }
    return new DefaultSpec(exportedPackages.build(), exportedResourcePrefixes.build());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:GradleApiSpecAggregator.java


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