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


Java Builder.addAll方法代码示例

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


在下文中一共展示了Builder.addAll方法的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: listNodesByIds

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids) {
   List<Instance> instances = new ArrayList<Instance>();
   for (String id : ids) {
      IAcsClient client = api.getAcsClient(api.decodeToRegion(id));
      DescribeInstancesRequest req = new DescribeInstancesRequest();
      Gson gson = new GsonBuilder().create();
      String iids = gson.toJson(new String[] { api.decodeToId(id) });
      req.setInstanceIds(iids);
      try {
         DescribeInstancesResponse resp = client.getAcsResponse(req);
         instances.addAll(resp.getInstances());
      } catch (Exception e) {
         logger.warn(e.getMessage());
      }
   }
   Builder<NodeMetadata> builder = ImmutableSet.builder();
   builder.addAll(transform(instances, new InstanceToNodeMetadata(api, nodeStatus)));
   return builder.build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:21,代码来源:ECSComputeServiceAdapter.java

示例4: listNodes

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Iterable<NodeMetadata> listNodes() {
   Builder<NodeMetadata> builder = ImmutableSet.builder();
   Set<String> regions = api.getAvailableRegions();
   for (String region : regions) {
      try {
         IAcsClient client = api.getAcsClient(region);
         DescribeInstancesRequest req = new DescribeInstancesRequest();
         DescribeInstancesResponse resp = client.getAcsResponse(req);
         builder.addAll(transform(resp.getInstances(), new InstanceToNodeMetadata(api, nodeStatus)));
      } catch (Exception e) {
         logger.warn(e.getMessage());
      }
   }
   return builder.build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:17,代码来源:ECSComputeServiceAdapter.java

示例5: listImages

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Iterable<Image> listImages() {
   Builder<Image> builder = ImmutableSet.builder();
   Set<String> regions = api.getAvailableRegions();
   for (String region : regions) {
      try {
         IAcsClient client = api.getAcsClient(region);
         DescribeImagesRequest req = new DescribeImagesRequest();
         DescribeImagesResponse resp = client.getAcsResponse(req);
         builder.addAll(transform(resp.getImages(), new ImageToImage(api, region)));
      } catch (Exception e) {
         logger.warn(e.getMessage());
      }
   }
   return builder.build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:17,代码来源:ECSComputeServiceAdapter.java

示例6: getOptimizerRules

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<StoragePluginOptimizerRule> getOptimizerRules(OptimizerRulesContext optimizerRulesContext) {
  Builder<StoragePluginOptimizerRule> setBuilder = ImmutableSet.builder();
  for(FormatPlugin plugin : this.formatPluginsByName.values()){
    Set<StoragePluginOptimizerRule> rules = plugin.getOptimizerRules();
    if(rules != null && rules.size() > 0){
      setBuilder.addAll(rules);
    }
  }
  return setBuilder.build();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:12,代码来源:FileSystemPlugin.java

示例7: getStoragePluginRuleSet

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
public RuleSet getStoragePluginRuleSet(OptimizerRulesContext optimizerRulesContext) {
  // query registered engines for optimizer rules and build the storage plugin RuleSet
  Builder<RelOptRule> setBuilder = ImmutableSet.builder();
  for (StoragePlugin plugin : this.plugins.values()) {
    Set<? extends RelOptRule> rules = plugin.getOptimizerRules(optimizerRulesContext);
    if (rules != null && rules.size() > 0) {
      setBuilder.addAll(rules);
    }
  }

  return DrillRuleSets.create(setBuilder.build());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:13,代码来源:StoragePluginRegistry.java

示例8: getLogicalOptimizerRules

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<StoragePluginOptimizerRule> getLogicalOptimizerRules(OptimizerRulesContext optimizerRulesContext) {
  Builder<StoragePluginOptimizerRule> setBuilder = ImmutableSet.builder();
  for(FormatPlugin plugin : formatCreator.getConfiguredFormatPlugins()){
    Set<StoragePluginOptimizerRule> rules = plugin.getOptimizerRules(optimizerRulesContext);
    if(rules != null && rules.size() > 0){
      setBuilder.addAll(rules);
    }
  }
  return setBuilder.build();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:12,代码来源:FileSystemPlugin.java

示例9: listLoadBalancers

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Iterable<LoadBalancerMetadata> listLoadBalancers() {
   Builder<LoadBalancerMetadata> builder = ImmutableSet.builder();
   for (String region : api.getAvailableRegions()) {
      IAcsClient client = api.getAcsClient(region);
      DescribeLoadBalancersRequest req = new DescribeLoadBalancersRequest();
      try {
         List<LoadBalancer> list = client.getAcsResponse(req).getLoadBalancers();
         builder.addAll(transform(list, new LoadBalancerToLoadBalancerMetadata(client, loadBalancerTypes)));
      } catch (Exception e) {
         logger.warn(e.getMessage());
      }
   }
   return builder.build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:16,代码来源:SLBLoadBalancerServiceAdapter.java

示例10: getAll

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<T> getAll() {
	Builder<T> builder = ImmutableSet.builder();
	
	this.read_lock.lock();
	try {
		builder.addAll(this.types.values());
	} finally {
		this.read_lock.unlock();
	}
	
	return builder.build();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:14,代码来源:ERegister.java

示例11: getAll

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Collection<EntityTemplate.Property<?>> getAll() {
	Builder<EntityTemplate.Property<?>> builder = ImmutableSet.builder();
	
	this.read_lock.lock();
	try {
		builder.addAll(this.properties.values());
	} finally {
		this.read_lock.unlock();
	}
	
	return builder.build();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:14,代码来源:EPropertyRegister.java

示例12: getAll

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<EntityTemplate> getAll() {
	Builder<EntityTemplate> builder = ImmutableSet.builder();
	
	this.read_lock.lock();
	try {
		builder.addAll(this.entities.values());
	} finally {
		this.read_lock.unlock();
	}
	
	return builder.build();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:14,代码来源:EEntityService.java

示例13: getAll

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<FireType> getAll() {
	Builder<FireType> builder = ImmutableSet.builder();
	
	this.read_lock.lock();
	try {
		builder.addAll(this.fires.values());
	} finally {
		this.read_lock.unlock();
	}
	
	return builder.build();
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:14,代码来源:EFireService.java

示例14: getBans

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Collection<Ban> getBans() {
	this.removeExpired();
	
	Builder<Ban> builder = ImmutableSet.builder();
	builder.addAll(this.bans_profile.keySet());
	builder.addAll(this.bans_ip.keySet());
	return builder.build();
}
 
开发者ID:EverCraft,项目名称:EverSanctions,代码行数:10,代码来源:EBanService.java

示例15: getProfileBans

import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Collection<Ban.Profile> getProfileBans() {
	this.removeExpired();
	
	Builder<Ban.Profile> builder = ImmutableSet.builder();
	builder.addAll(this.bans_profile.keySet());
	return builder.build();
}
 
开发者ID:EverCraft,项目名称:EverSanctions,代码行数:9,代码来源:EBanService.java


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