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


Java Builder.add方法代码示例

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


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

示例1: adaptMIPResult

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
protected XORAllocation<T> adaptMIPResult(IMIPResult mipResult) {
    Map<Bidder<T>, BidderAllocation<T>> trades = new HashMap<>();
    for (Bidder<T> bidder : auction.getBidders()) {
        double totalValue = 0;
        Builder<Good> goodsBuilder = ImmutableSet.<Good>builder();
        Builder<XORValue<T>> bundleBids = ImmutableSet.<XORValue<T>>builder();
        for (XORValue<T> bundleBid : auction.getBid(bidder).getValues()) {
            if (DoubleMath.fuzzyEquals(mipResult.getValue(getBidVariable(bundleBid)), 1, 1e-3)) {
                goodsBuilder.addAll(bundleBid.getLicenses());
                bundleBids.add(bundleBid);
                totalValue += bundleBid.value().doubleValue();
            }
        }
        Set<Good> goods = goodsBuilder.build();
        if (!goods.isEmpty()) {
            trades.put(bidder, new BidderAllocation<>(totalValue, new Bundle<>(goods), bundleBids.build()));
        }
    }

    return new XORAllocation<>(trades);
}
 
开发者ID:spectrumauctions,项目名称:sats-opt,代码行数:22,代码来源:WinnerDetermination.java

示例2: getClassesToCheck

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
private synchronized Collection<Class<?>> getClassesToCheck()
{
	if( classesToCheck == null )
	{
		Builder<Class<?>> builder = ImmutableSet.builder();
		builder.addAll(STATIC_CLASSES_TO_CHECK);
		List<Extension> extensions = domainParamTracker.getExtensions();
		for( Extension extension : extensions )
		{
			Collection<Parameter> clazzes = extension.getParameters("class");
			for( Parameter clazzParam : clazzes )
			{
				builder.add(domainParamTracker.getClassForName(extension, clazzParam.valueAsString()));
			}
		}
		classesToCheck = builder.build();
	}
	return classesToCheck;
}
 
开发者ID:equella,项目名称:Equella,代码行数:20,代码来源:SecurityAttributeSource.java

示例3: getDrillUserConfigurableLogicalRules

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
/**
 * Get a list of logical rules that can be turned on or off by session/system options.
 *
 * If a rule is intended to always be included with the logical set, it should be added
 * to the immutable list created in the getDrillBasicRules() method below.
 *
 * @param optimizerRulesContext - used to get the list of planner settings, other rules may
 *                                also in the future need to get other query state from this,
 *                                such as the available list of UDFs (as is used by the
 *                                DrillMergeProjectRule created in getDrillBasicRules())
 * @return - a list of rules that have been filtered to leave out
 *         rules that have been turned off by system or session settings
 */
public static RuleSet getDrillUserConfigurableLogicalRules(OptimizerRulesContext optimizerRulesContext) {
  final PlannerSettings ps = optimizerRulesContext.getPlannerSettings();

  // This list is used to store rules that can be turned on an off
  // by user facing planning options
  final Builder<RelOptRule> userConfigurableRules = ImmutableSet.<RelOptRule>builder();

  if (ps.isConstantFoldingEnabled()) {
    // TODO - DRILL-2218
    userConfigurableRules.add(ReduceExpressionsRule.PROJECT_INSTANCE);

    userConfigurableRules.add(DrillReduceExpressionsRule.FILTER_INSTANCE_DRILL);
    userConfigurableRules.add(DrillReduceExpressionsRule.CALC_INSTANCE_DRILL);
  }

  return new DrillRuleSet(userConfigurableRules.build());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:31,代码来源:DrillRuleSets.java

示例4: getIncomingChannels

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
public Set<String> getIncomingChannels(Plugin plugin) {
    if (plugin == null) {
        throw new IllegalArgumentException("Plugin cannot be null");
    }

    synchronized (incomingLock) {
        Set<PluginMessageListenerRegistration> registrations = incomingByPlugin.get(plugin);

        if (registrations != null) {
            Builder<String> builder = ImmutableSet.builder();

            for (PluginMessageListenerRegistration registration : registrations) {
                builder.add(registration.getChannel());
            }

            return builder.build();
        } else {
            return ImmutableSet.of();
        }
    }
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:22,代码来源:StandardMessenger.java

示例5: getIncomingChannelRegistrations

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
public Set<PluginMessageListenerRegistration> getIncomingChannelRegistrations(Plugin plugin, String channel) {
    if (plugin == null) {
        throw new IllegalArgumentException("Plugin cannot be null");
    }
    validateChannel(channel);

    synchronized (incomingLock) {
        Set<PluginMessageListenerRegistration> registrations = incomingByPlugin.get(plugin);

        if (registrations != null) {
            Builder<PluginMessageListenerRegistration> builder = ImmutableSet.builder();

            for (PluginMessageListenerRegistration registration : registrations) {
                if (registration.getChannel().equals(channel)) {
                    builder.add(registration);
                }
            }

            return builder.build();
        } else {
            return ImmutableSet.of();
        }
    }
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:25,代码来源:StandardMessenger.java

示例6: modelToList

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
protected ImmutableList<ValueAssignment> modelToList() {
  scala.collection.Map<ModelLocation, ModelValue> interpretation = model.interpretation();

  // first get the addresses of arrays
  Map<IdealInt, ITerm> arrays = getArrayAddresses(interpretation);

  // then iterate over the model and generate the assignments
  Builder<ValueAssignment> assignments = ImmutableSet.builder();
  Iterator<Tuple2<ModelLocation, ModelValue>> it2 = interpretation.iterator();
  while (it2.hasNext()) {
    Tuple2<ModelLocation, ModelValue> entry = it2.next();
    ValueAssignment assignment = getAssignment(entry._1, entry._2, arrays);
    if (assignment != null) {
      assignments.add(assignment);
    }
  }

  return assignments.build().asList();
}
 
开发者ID:sosy-lab,项目名称:java-smt,代码行数:21,代码来源:PrincessModel.java

示例7: solve

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
public void solve() throws IloException{
	long startms = System.currentTimeMillis();
	cplex.solve();
	long endms = System.currentTimeMillis();
	this.solveTimeSeconds = (endms - startms)/1000.0;
	if(this.displayOutput){
		System.out.println("objective: " + cplex.getObjValue());
	}
	Builder<E> setBuilder = ImmutableSet.builder();
	for(E edge: kepInstance.getGraph().getEdges()){
		if(CplexUtil.doubleToBoolean(cplex.getValue(this.phaseOneProblem.indicatorEdgeSelected(edge)))){
			setBuilder.add(edge);
		}
	}
	this.edgesInSolution = setBuilder.build();
}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:17,代码来源:TwoStageEdgeFailureSolver.java

示例8: adaptArgumentValue

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Collection<SchemaNodeIdentifier> adaptArgumentValue(
        final StmtContext<Collection<SchemaNodeIdentifier>, KeyStatement,
            EffectiveStatement<Collection<SchemaNodeIdentifier>, KeyStatement>> ctx,
        final QNameModule targetModule) {
    final Builder<SchemaNodeIdentifier> builder = ImmutableSet.builder();
    boolean replaced = false;
    for (final SchemaNodeIdentifier arg : ctx.getStatementArgument()) {
        final QName qname = arg.getLastComponent();
        if (!targetModule.equals(qname.getModule())) {
            final QName newQname = ctx.getFromNamespace(QNameCacheNamespace.class,
                    QName.create(targetModule, qname.getLocalName()));
            builder.add(SchemaNodeIdentifier.SAME.createChild(newQname));
            replaced = true;
        } else {
            builder.add(arg);
        }
    }

    // This makes sure we reuse the collection when a grouping is
    // instantiated in the same module
    return replaced ? builder.build() : ctx.getStatementArgument();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:KeyStatementSupport.java

示例9: download

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@GET
@Path("{id}/download")
@RequiresRoles(UserRole.ROLE_ADMIN)
@Produces(MediaType.TEXT_PLAIN)
public Response download(@PathParam("id") long id) {
	Course course = courseDao.findById(id);
	Builder<String> setBuilder = ImmutableSet.builder();
	if (course.getProjects().isEmpty()) {
		return Response.status(Status.NO_CONTENT).entity("This course doesn't have any projects").build();
	} else {
		for (Project project : course.getProjects()) {
			if (project.getSourceCodeUrl() == null) {
				LOG.warn("This project doesnt have a source code URL: {}", project);
			} else {
				setBuilder.add(project.getSourceCodeUrl());
			}
		}
		Set<String> sourceCodeurls = setBuilder.build();
		return Response.ok(repoDownloader.prepareDownload(sourceCodeurls)).build();
	}
}
 
开发者ID:devhub-tud,项目名称:devhub-prototype,代码行数:22,代码来源:CoursesResources.java

示例10: getPermutationsConditions

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
private Set<String> getPermutationsConditions(ResourceContext context,
    List<String> permutationAxes) {
  Builder<String> setBuilder = ImmutableSet.builder();
  PropertyOracle oracle = context.getGeneratorContext().getPropertyOracle();

  for (String permutationAxis : permutationAxes) {
    String propValue = null;
    try {
      SelectionProperty selProp = oracle.getSelectionProperty(null,
          permutationAxis);
      propValue = selProp.getCurrentValue();
    } catch (BadPropertyValueException e) {
      try {
        ConfigurationProperty confProp = oracle.getConfigurationProperty(permutationAxis);
        propValue = confProp.getValues().get(0);
      } catch (BadPropertyValueException e1) {
        e1.printStackTrace();
      }
    }

    if (propValue != null) {
      setBuilder.add(permutationAxis + ":" + propValue);
    }
  }
  return setBuilder.build();
}
 
开发者ID:jDramaix,项目名称:gss.gwt,代码行数:27,代码来源:GssResourceGenerator.java

示例11: processTemplateDef

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
private void processTemplateDef(Builder<TagHandler> handlers, Element defElement)
    throws TemplateParserException {
  Attr tagAttribute = defElement.getAttributeNode(TAG_ATTRIBUTE);
  if (tagAttribute == null) {
    throw new TemplateParserException("Missing tag attribute on TemplateDef");
  }

  ImmutableSet.Builder<TemplateResource> resources = ImmutableSet.builder();
  
  Element scriptElement = (Element) DomUtil.getFirstNamedChildNode(defElement, JAVASCRIPT_TAG);
  if (scriptElement != null) {
    resources.add(TemplateResource.newJavascriptResource(scriptElement.getTextContent(), this));
  }
  
  Element styleElement = (Element) DomUtil.getFirstNamedChildNode(defElement, STYLE_TAG);
  if (styleElement != null) {
    resources.add(TemplateResource.newStyleResource(styleElement.getTextContent(), this));
  }

  Element templateElement = (Element) DomUtil.getFirstNamedChildNode(defElement, TEMPLATE_TAG);
  TagHandler handler = createHandler(tagAttribute.getNodeValue(), templateElement,
      resources.build());
  if (handler != null) {
    handlers.add(handler);
  }
}
 
开发者ID:inevo,项目名称:shindig-1.1-BETA5-incubating,代码行数:27,代码来源:XmlTemplateLibrary.java

示例12: getParts

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

    for (EntityDragonPart part : getHandle().dragonPartArray) {
        builder.add((ComplexEntityPart) part.getBukkitEntity());
    }

    return builder.build();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:10,代码来源:CraftEnderDragon.java

示例13: verifyTableSize

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@GwtIncompatible // RegularImmutableSet.table not in emulation
private void verifyTableSize(int inputSize, int setSize, int tableSize) {
  Builder<Integer> builder = ImmutableSet.builder();
  for (int i = 0; i < inputSize; i++) {
    builder.add(i % setSize);
  }
  ImmutableSet<Integer> set = builder.build();
  assertTrue(set instanceof RegularImmutableSet);
  assertEquals("Input size " + inputSize + " and set size " + setSize,
      tableSize, ((RegularImmutableSet<Integer>) set).table.length);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:12,代码来源:ImmutableSetTest.java

示例14: mergedRuleSets

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
public static RuleSet mergedRuleSets(RuleSet...ruleSets) {
  final Builder<RelOptRule> relOptRuleSetBuilder = ImmutableSet.builder();
  for (final RuleSet ruleSet : ruleSets) {
    for (final RelOptRule relOptRule : ruleSet) {
      relOptRuleSetBuilder.add(relOptRule);
    }
  }
  return new DrillRuleSet(relOptRuleSetBuilder.build());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:10,代码来源:DrillRuleSets.java

示例15: toStringSet

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
static Set<String> toStringSet(ResultSet resultSet) throws SQLException {
  Builder<String> builder = ImmutableSet.builder();
  final List<Ord<String>> columns = columnLabels(resultSet);
  while (resultSet.next()) {
    StringBuilder buf = new StringBuilder();
    for (Ord<String> column : columns) {
      buf.append(column.i == 1 ? "" : "; ").append(column.e).append("=").append(resultSet.getObject(column.i));
    }
    builder.add(buf.toString());
    buf.setLength(0);
  }
  return builder.build();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:JdbcAssert.java


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