當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。