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


Java Multimap.entries方法代码示例

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


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

示例1: setOnTransaction

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private void setOnTransaction(final ConfigTransactionClient ta, final ConfigExecution execution)
        throws DocumentedException {

    for (Multimap<String, ModuleElementResolved> modulesToResolved : execution.getResolvedXmlElements(ta)
            .values()) {

        for (Map.Entry<String, ModuleElementResolved> moduleToResolved : modulesToResolved.entries()) {
            String moduleName = moduleToResolved.getKey();

            ModuleElementResolved moduleElementResolved = moduleToResolved.getValue();
            String instanceName = moduleElementResolved.getInstanceName();

            InstanceConfigElementResolved ice = moduleElementResolved.getInstanceConfigElementResolved();
            EditConfigStrategy strategy = ice.getEditStrategy();
            strategy.executeConfiguration(moduleName, instanceName, ice.getConfiguration(), ta,
                    execution.getServiceRegistryWrapper(ta));
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:ConfigSubsystemFacade.java

示例2: create

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private static MediaType create(
    String type, String subtype, Multimap<String, String> parameters) {
  checkNotNull(type);
  checkNotNull(subtype);
  checkNotNull(parameters);
  String normalizedType = normalizeToken(type);
  String normalizedSubtype = normalizeToken(subtype);
  checkArgument(
      !WILDCARD.equals(normalizedType) || WILDCARD.equals(normalizedSubtype),
      "A wildcard type cannot be used with a non-wildcard subtype");
  ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
  for (Entry<String, String> entry : parameters.entries()) {
    String attribute = normalizeToken(entry.getKey());
    builder.put(attribute, normalizeParameterValue(attribute, entry.getValue()));
  }
  MediaType mediaType = new MediaType(normalizedType, normalizedSubtype, builder.build());
  // Return one of the constants if the media type is a known type.
  return MoreObjects.firstNonNull(KNOWN_TYPES.get(mediaType), mediaType);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:20,代码来源:MediaType.java

示例3: handleMisssingInstancesOnTransaction

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private void handleMisssingInstancesOnTransaction(final ConfigTransactionClient ta, final ConfigExecution execution)
        throws DocumentedException {

    for (Multimap<String, ModuleElementDefinition> modulesToResolved : execution.getModulesDefinition(ta)
            .values()) {
        for (Map.Entry<String, ModuleElementDefinition> moduleToResolved : modulesToResolved.entries()) {
            String moduleName = moduleToResolved.getKey();

            ModuleElementDefinition moduleElementDefinition = moduleToResolved.getValue();

            EditConfigStrategy strategy = moduleElementDefinition.getEditStrategy();
            strategy.executeConfiguration(moduleName, moduleElementDefinition.getInstanceName(), null, ta,
                    execution.getServiceRegistryWrapper(ta));
        }
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:ConfigSubsystemFacade.java

示例4: eval

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
public Object eval(Response response) {
	Object value = null;
	String data = response.body().asString();

	if (bodyAssert.getSelect() != null) {
		Multimap<String, List<String>> exps = parsedExpressions(bodyAssert.getSelect());

		for (Entry<String, List<String>> entry : exps.entries()) {
			if (entry.getKey().toLowerCase().startsWith(ExpressionType.jsonpath.toString().toLowerCase())) {
				value = JsonExpression.build(data, entry.getKey(), entry.getValue()).parse();
			} else if (entry.getKey().toLowerCase().startsWith(ExpressionType.regex.toString().toLowerCase())) {
				value = RegexExpression.build(data, entry.getKey(), entry.getValue()).parse();
			} else {
				throw new TestException("Expression="+entry.getKey()+" not supported in select=" + bodyAssert.getSelect());
			}
			data = JsonMapper.toJson(value);
		}

	}

	return value;
}
 
开发者ID:ERS-HCL,项目名称:rest-yaml-test,代码行数:23,代码来源:BodyAssertSelectExpression.java

示例5: collectTestsMatchingConditions

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private static Set<String> collectTestsMatchingConditions(
    DexTool dexTool,
    CompilerUnderTest compilerUnderTest,
    DexVm dexVm,
    CompilationMode mode,
    Multimap<String, TestCondition> testConditionsMap) {
  Set<String> set = Sets.newHashSet();
  for (Map.Entry<String, TestCondition> kv : testConditionsMap.entries()) {
    if (kv.getValue().test(dexTool, compilerUnderTest, dexVm, mode)) {
      set.add(kv.getKey());
    }
  }
  return set;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:15,代码来源:R8RunArtTestsTest.java

示例6: removeAttributeModifiers

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
public void removeAttributeModifiers(Multimap<String, AttributeModifier> p_111148_1_)
{
    for (Entry<String, AttributeModifier> entry : p_111148_1_.entries())
    {
        IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:BaseAttributeMap.java

示例7: applyAttributeModifiers

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
public void applyAttributeModifiers(Multimap<String, AttributeModifier> p_111147_1_)
{
    for (Entry<String, AttributeModifier> entry : p_111147_1_.entries())
    {
        IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
            iattributeinstance.applyModifier((AttributeModifier)entry.getValue());
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:BaseAttributeMap.java

示例8: putAll

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
@Override
public boolean putAll(Multimap<? extends K, ? extends V> multimap) {
    for (Entry<? extends K, ? extends V> e : multimap.entries()) {
        value2key.put(e.getValue(), e.getKey());
    }
    return key2Value.putAll(multimap);
}
 
开发者ID:maxdemarzi,项目名称:GuancialeDB,代码行数:8,代码来源:ReversibleMultiMap.java

示例9: checkCustomPing

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
private void checkCustomPing(IMessage msg) {
    if (msg.getChannel().isPrivate() || msg.getAuthor().equals(MCBot.instance.getOurUser())) return;
    
    Multimap<Long, CustomPing> pings = HashMultimap.create();
    CommandCustomPing.this.getPingsForGuild(msg.getGuild()).forEach(pings::putAll);
    for (Entry<Long, CustomPing> e : pings.entries()) {
        if (e.getKey() == msg.getAuthor().getLongID()) {
            continue;
        }
        IUser owner = msg.getGuild().getUserByID(e.getKey());
        if (owner == null || !msg.getChannel().getModifiedPermissions(owner).contains(Permissions.READ_MESSAGES)) {
            continue;
        }
        Matcher matcher = e.getValue().getPattern().matcher(msg.getContent());
        if (matcher.find()) {
            final IPrivateChannel channel = owner.getOrCreatePMChannel();
            RequestBuffer.request(() -> {
                EmbedObject embed = new EmbedBuilder()
                        .withAuthorIcon(msg.getAuthor().getAvatarURL())
                        .withAuthorName("New ping from: " + msg.getAuthor().getDisplayName(msg.getGuild()))
                        .withTitle(e.getValue().getText())
                        .withDesc(msg.getContent())
                        .build();
                channel.sendMessage("<#" + msg.getChannel().getStringID() + ">", embed);
                return true;
            });
        }
    }
}
 
开发者ID:tterrag1098,项目名称:MCBot,代码行数:30,代码来源:CommandCustomPing.java

示例10: removeAttributeModifiers

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
public void removeAttributeModifiers(Multimap<String, AttributeModifier> modifiers)
{
    for (Entry<String, AttributeModifier> entry : modifiers.entries())
    {
        IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:AbstractAttributeMap.java

示例11: applyAttributeModifiers

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
public void applyAttributeModifiers(Multimap<String, AttributeModifier> modifiers)
{
    for (Entry<String, AttributeModifier> entry : modifiers.entries())
    {
        IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey());

        if (iattributeinstance != null)
        {
            iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
            iattributeinstance.applyModifier((AttributeModifier)entry.getValue());
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:AbstractAttributeMap.java

示例12: computeSelfCost

import com.google.common.collect.Multimap; //导入方法依赖的package包/类
/**
 * Computes the cost honoring column pushdown and relative costs across {@link GroupScan group scans}.
 *
 * The cost model is a function of row count, column and scan factors. Row count may or may not be precise and is
 * obtained from{@link GroupScan#getScanStats(PlannerSettings)}. Column factor is relative to number of columns to
 * scan. Scan factor represents the relative cost of making the scan as compared to other scans kinds.
 *
 * An exact field contributes 1 whole points to column factor. A sub field scan contributes proportionately anywhere
 * from (0, 1], weighting subsequent sub fields less through a logarithmic model.
 */
@Override
public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadataQuery mq) {
  final List<SchemaPath> columns = getColumns();
  final boolean isStarQuery = ColumnUtils.isStarQuery(columns);
  final int allColumns = getTable().getRowType().getFieldCount();

  final double columnFactor;
  if (isStarQuery) {
    columnFactor = allColumns;
  } else {
    double runningFactor = 0;
    // Maintain map of root to child segments to determine what fraction of a whole field is projected.
    final Multimap<NameSegment, SchemaPath> subFields = HashMultimap.create();
    for (final SchemaPath column : columns) {
      subFields.put(column.getRootSegment(), column);
    }

    for (Map.Entry<PathSegment.NameSegment, SchemaPath> entry : subFields.entries()) {
      final PathSegment.NameSegment root = entry.getKey();
      final SchemaPath field = entry.getValue();
      final String rootPath = root.getPath();
      final boolean entireColSelected = rootPath.equalsIgnoreCase(field.getAsUnescapedPath());
      if (entireColSelected) {
        runningFactor += 1;
      } else {
        final RelDataType dataType = getRowType().getField(rootPath, false, false).getType();
        final int subFieldCount = dataType.isStruct() ? dataType.getFieldCount() : 1;
        // sandwich impact of this projection between (0, 1]
        final double impact = Math.log10(1 + (Math.min(1, subFieldCount/MAX_COLUMNS) * 9));
        runningFactor += impact;
      }
    }
    columnFactor = runningFactor;
  }

  final double estimatedCount = estimateRowCount(mq);
  // If the estimatedCount is actually 0, then make it 1, so that at least, we choose the scan that
  // has fewer columns pushed down since all the cost scales with rowCount.
  final double rowCount = Math.max(1, estimatedCount);
  final double scanFactor = getGroupScan().getScanCostFactor().getFactor();
  final double cpuCost = rowCount * columnFactor * scanFactor;
  final double ioCost = cpuCost;

  if (PrelUtil.getSettings(getCluster()).useDefaultCosting()) {
    return planner.getCostFactory().makeCost(estimatedCount, cpuCost, ioCost);
  }

  final double networkCost = ioCost;
  // Even though scan is reading from disk, in the currently generated plans all plans will
  // need to read the same amount of data, so keeping the disk io cost 0 is ok for now.
  // In the future we might consider alternative scans that go against projections or
  // different compression schemes etc that affect the amount of data read. Such alternatives
  // would affect both cpu and io cost.
  final DremioCost.Factory costFactory = (DremioCost.Factory)planner.getCostFactory();
  return costFactory.makeCost(estimatedCount, cpuCost, ioCost, networkCost);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:67,代码来源:OldScanRelBase.java


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