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


Java SetMultimap.put方法代码示例

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


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

示例1: parse

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
public static DisableDamageModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
    SetMultimap<DamageCause, PlayerRelation> causes = HashMultimap.create();
    for(Element damageCauseElement : doc.getRootElement().getChildren("disabledamage")) {
        for(Element damageEl : damageCauseElement.getChildren("damage")) {
            DamageCause cause = XMLUtils.parseEnum(damageEl, DamageCause.class, "damage type");
            for(PlayerRelation damagerType : PlayerRelation.values()) {
                // Legacy syntax used "other" instead of "neutral"
                String attrName = damagerType.name().toLowerCase();
                Node attr = damagerType == PlayerRelation.NEUTRAL ? Node.fromAttr(damageEl, attrName, "other")
                                                                  : Node.fromAttr(damageEl, attrName);
                if(XMLUtils.parseBoolean(attr, true)) {
                    causes.put(cause, damagerType);

                    // Bukkit 1.7.10 changed TNT from BLOCK_EXPLOSION to ENTITY_EXPLOSION,
                    // so we include them both to keep old maps working.
                    if(cause == DamageCause.BLOCK_EXPLOSION) {
                        causes.put(DamageCause.ENTITY_EXPLOSION, damagerType);
                    }
                }
            }
        }
    }
    return new DisableDamageModule(causes);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:25,代码来源:DisableDamageModule.java

示例2: checkConstructorInitialization

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
/**
 * @param entities field init info
 * @param state visitor state
 * @return a map from each constructor C to the nonnull fields that C does *not* initialize
 */
private SetMultimap<MethodTree, Symbol> checkConstructorInitialization(
    FieldInitEntities entities, VisitorState state) {
  SetMultimap<MethodTree, Symbol> result = LinkedHashMultimap.create();
  Set<Symbol> nonnullInstanceFields = entities.nonnullInstanceFields();
  Trees trees = Trees.instance(JavacProcessingEnvironment.instance(state.context));
  for (MethodTree constructor : entities.constructors()) {
    if (constructorInvokesAnother(constructor, state)) {
      continue;
    }
    Set<Element> guaranteedNonNull =
        guaranteedNonNullForConstructor(entities, state, trees, constructor);
    for (Symbol fieldSymbol : nonnullInstanceFields) {
      if (!guaranteedNonNull.contains(fieldSymbol)) {
        result.put(constructor, fieldSymbol);
      }
    }
  }
  return result;
}
 
开发者ID:uber,项目名称:NullAway,代码行数:25,代码来源:NullAway.java

示例3: getExtensionMap

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private SetMultimap<String, IntegrationSessionExtension> getExtensionMap()
{
	if( extensionMap == null )
	{
		synchronized( this )
		{
			if( extensionMap == null )
			{
				final SetMultimap<String, IntegrationSessionExtension> map = HashMultimap
					.<String, IntegrationSessionExtension>create();
				for( Extension ext : resultsTracker.getExtensions() )
				{
					final IntegrationSessionExtension integExtension = resultsTracker.getBeanByExtension(ext);
					for( Parameter parameter : ext.getParameters("type") )
					{
						map.put(parameter.valueAsString(), integExtension);
					}
				}
				extensionMap = Multimaps.unmodifiableSetMultimap(map);
			}
		}
	}
	return extensionMap;
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:AbstractIntegrationService.java

示例4: bindMacAddr

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private void bindMacAddr(Map.Entry<VlanId, ConnectPoint> e,
                         SetMultimap<VlanId, Pair<ConnectPoint,
                         MacAddress>> confHostPresentCPoint) {
    VlanId vlanId = e.getKey();
    ConnectPoint cp = e.getValue();
    Set<Host> connectedHosts = hostService.getConnectedHosts(cp);
    if (!connectedHosts.isEmpty()) {
        connectedHosts.forEach(host -> {
            if (host.vlan().equals(vlanId)) {
                confHostPresentCPoint.put(vlanId, Pair.of(cp, host.mac()));
            } else {
                confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
            }
        });
    } else {
        confHostPresentCPoint.put(vlanId, Pair.of(cp, null));
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:Vpls.java

示例5: getLocalAndInheritedMethods

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private static void getLocalAndInheritedMethods(
        PackageElement pkg, TypeElement type, SetMultimap<String, ExecutableElement> methods) {

    for (TypeMirror superInterface : type.getInterfaces()) {
        getLocalAndInheritedMethods(pkg, MoreTypes.asTypeElement(superInterface), methods);
    }
    if (type.getSuperclass().getKind() != TypeKind.NONE) {
        // Visit the superclass after superinterfaces so we will always see the implementation of a
        // method after any interfaces that declared it.
        getLocalAndInheritedMethods(pkg, MoreTypes.asTypeElement(type.getSuperclass()), methods);
    }
    for (ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) {
        if (!method.getModifiers().contains(Modifier.STATIC)
                && methodVisibleFromPackage(method, pkg)) {
            methods.put(method.getSimpleName().toString(), method);
        }
    }
}
 
开发者ID:foodora,项目名称:android-auto-mapper,代码行数:19,代码来源:MoreElements.java

示例6: deserialize

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
@Override
public SetMultimap<String, String> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
	SetMultimap<String, String> map = HashMultimap.create();

	JsonObject filters = json.getAsJsonObject();
	for (Map.Entry<String, JsonElement> filter : filters.entrySet())
	{
		String name = filter.getKey();
		JsonArray values = ((JsonArray)filter.getValue());
		for (JsonElement value : values)
		{
			map.put(name, value.getAsString());
		}
	}

	return map;
}
 
开发者ID:quqiangsheng,项目名称:abhot,代码行数:19,代码来源:SetMultimapDeserializer.java

示例7: readKeys

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
/**
 * Read Semeval keys file.
 *
 * @param path path to keys file
 * @return map from sense IDs onto senses
 */
private static SetMultimap<String, String> readKeys(String path) {
    try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
        SetMultimap<String, String> keys = LinkedHashMultimap.create();
        String line;
        while ((line = reader.readLine()) != null) {
            if (line.isEmpty()) {
                continue;
            }
            String[] fields = line.split(" ");
            for (int i = 1; i < fields.length; ++i) {
                keys.put(fields[0], fields[i]);
            }
        }
        return keys;
    } catch (IOException e) {
        throw new RuntimeException("Error reading sense keys file", e);
    }
}
 
开发者ID:clearwsd,项目名称:clearwsd,代码行数:25,代码来源:SemevalReader.java

示例8: deserialize

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
/**
 * Read the inflights file and return a
 * {@link com.google.common.collect.SetMultimap}
 * of transactionIDs to events that were inflight.
 *
 * @return - map of inflight events per txnID.
 */
public SetMultimap<Long, Long> deserialize()
    throws IOException, BadCheckpointException {
  SetMultimap<Long, Long> inflights = HashMultimap.create();
  if (!fileChannel.isOpen()) {
    file = new RandomAccessFile(inflightEventsFile, "rw");
    fileChannel = file.getChannel();
  }
  if (file.length() == 0) {
    return inflights;
  }
  file.seek(0);
  byte[] checksum = new byte[16];
  file.read(checksum);
  ByteBuffer buffer = ByteBuffer.allocate(
      (int) (file.length() - file.getFilePointer()));
  fileChannel.read(buffer);
  byte[] fileChecksum = digest.digest(buffer.array());
  if (!Arrays.equals(checksum, fileChecksum)) {
    throw new BadCheckpointException("Checksum of inflights file differs"
        + " from the checksum expected.");
  }
  buffer.position(0);
  LongBuffer longBuffer = buffer.asLongBuffer();
  try {
    while (true) {
      long txnID = longBuffer.get();
      int numEvents = (int) (longBuffer.get());
      for (int i = 0; i < numEvents; i++) {
        long val = longBuffer.get();
        inflights.put(txnID, val);
      }
    }
  } catch (BufferUnderflowException ex) {
    LOG.debug("Reached end of inflights buffer. Long buffer position ="
        + String.valueOf(longBuffer.position()));
  }
  return inflights;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:46,代码来源:FlumeEventQueue.java

示例9: maakLeveringautorisatieDienstbundelMapping

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private SetMultimap<Integer, Dienstbundel> maakLeveringautorisatieDienstbundelMapping(final List<Dienstbundel> alleDienstBundels) {
    final SetMultimap<Integer, Dienstbundel> map = HashMultimap.create();
    for (final Dienstbundel dienstbundel : alleDienstBundels) {
        map.put(dienstbundel.getLeveringsautorisatie().getId(), dienstbundel);
    }
    return map;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:8,代码来源:LeveringsAutorisatieCacheHelperImpl.java

示例10: maakDienstMapping

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private SetMultimap<Integer, Dienst> maakDienstMapping(final List<Dienst> alleDiensten) {
    final SetMultimap<Integer, Dienst> map = HashMultimap.create();
    for (final Dienst dienst : alleDiensten) {
        map.put(dienst.getDienstbundel().getId(), dienst);
    }
    return map;

}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:9,代码来源:LeveringsAutorisatieCacheHelperImpl.java

示例11: maakDienstbundelgroepDienstbundelMapping

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private SetMultimap<Integer, DienstbundelGroep> maakDienstbundelgroepDienstbundelMapping(final List<DienstbundelGroep> alleDienstBundelgroepen) {
    final SetMultimap<Integer, DienstbundelGroep> map = HashMultimap.create();
    for (final DienstbundelGroep dienstbundelGroep : alleDienstBundelgroepen) {
        map.put(dienstbundelGroep.getDienstbundel().getId(), dienstbundelGroep);
    }
    return map;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:8,代码来源:LeveringsAutorisatieCacheHelperImpl.java

示例12: maakDienstbundelgroepAttribuutMapping

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private SetMultimap<Integer, DienstbundelGroepAttribuut> maakDienstbundelgroepAttribuutMapping(
        final List<DienstbundelGroepAttribuut> alleDienstBundelgroepenAttributen) {
    final SetMultimap<Integer, DienstbundelGroepAttribuut> map = HashMultimap.create();
    for (final DienstbundelGroepAttribuut dienstbundelGroepAttribuut : alleDienstBundelgroepenAttributen) {
        map.put(dienstbundelGroepAttribuut.getDienstbundelGroep().getId(), dienstbundelGroepAttribuut);
    }
    return map;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:9,代码来源:LeveringsAutorisatieCacheHelperImpl.java

示例13: maakDienstbundelLo3RubriekDienstbundelMapping

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private SetMultimap<Integer, DienstbundelLo3Rubriek> maakDienstbundelLo3RubriekDienstbundelMapping(
        final List<DienstbundelLo3Rubriek> alleDienstbundelLo3Rubrieken) {
    final SetMultimap<Integer, DienstbundelLo3Rubriek> map = HashMultimap.create();
    for (final DienstbundelLo3Rubriek dienstbundelLo3Rubriek : alleDienstbundelLo3Rubrieken) {
        map.put(dienstbundelLo3Rubriek.getDienstbundel().getId(), dienstbundelLo3Rubriek);
    }
    return map;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:9,代码来源:LeveringsAutorisatieCacheHelperImpl.java

示例14: geefHandelingenVoorLevering

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private Set<HandelingVoorPublicatie> geefHandelingenVoorLevering() {
    final Set<Long> personenInLevering = new HashSet<>();
    final Set<Long> handelingenInLevering = new HashSet<>();
    final SetMultimap<Long, Long> admhndMap = LinkedHashMultimap.create();
    LOGGER.trace("start haal handelingen op voor levering");
    final List<TeLeverenHandelingDTO> handelingenInLeveringOfTeLeveren = administratieveHandelingRepository.geefHandelingenVoorAdmhndPublicatie();
    LOGGER.trace("einde haal handelingen op voor levering, aantal handelingen: " + handelingenInLeveringOfTeLeveren.size());
    //filter handelingen nog in levering
    for (TeLeverenHandelingDTO teLeverenHandeling : handelingenInLeveringOfTeLeveren) {
        if (teLeverenHandeling.getStatus() == StatusLeveringAdministratieveHandeling.IN_LEVERING) {
            //handeling al in levering
            LOGGER
                    .debug(String.format("admhnd met id %d nog in levering, zet bijgehouden personen op ignore lijst", teLeverenHandeling.getAdmhndId()));
            if (teLeverenHandeling.getBijgehoudenPersoon() != null) {
                personenInLevering.add(teLeverenHandeling.getBijgehoudenPersoon());
            }
            handelingenInLevering.add(teLeverenHandeling.getAdmhndId());
        } else {
            admhndMap.put(teLeverenHandeling.getAdmhndId(), teLeverenHandeling.getBijgehoudenPersoon());
        }
    }
    if (handelingenInLevering.size() > maxHandelingenInLevering) {
        LOGGER.debug("max aantal handelingen staan al in levering, verwerk geen nieuwe");
        return Collections.emptySet();
    }

    return filterHandelingen(personenInLevering, admhndMap);
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:29,代码来源:AdmhndProducerVoorLeveringServiceImpl.java

示例15: generateCoordinates

import com.google.common.collect.SetMultimap; //导入方法依赖的package包/类
private SetMultimap<Integer, Integer> generateCoordinates(
        InclusionDependency unaryInd, ImmutableMap<ColumnIdentifier, TableInputGenerator> attributes)
        throws AlgorithmExecutionException {
    SetMultimap<Integer, Integer> uindCoordinates = MultimapBuilder.hashKeys().hashSetValues().build();
    ColumnIdentifier lhs = getUnaryIdentifier(unaryInd.getDependant());
    ColumnIdentifier rhs = getUnaryIdentifier(unaryInd.getReferenced());
    AttributeIterator cursorA =  new AttributeIterator(config.getSortedRelationalInput(attributes.get(lhs), lhs), lhs);
    AttributeIterator cursorB = new AttributeIterator(config.getSortedRelationalInput(attributes.get(rhs), rhs), rhs);
    cursorA.next();
    cursorB.next();

    while (cursorA.hasNext() || cursorB.hasNext()) {
        AttributeValuePosition valA = cursorA.current();
        AttributeValuePosition valB = cursorB.current();

        if (valA.getValue().equals(valB.getValue())) {
            Set<Integer> positionsA = new HashSet<>();
            Set<Integer> positionsB = new HashSet<>();

            AttributeValuePosition nextValA = cursorA.current();
            while (nextValA.getValue().equals(valA.getValue())) {
                positionsA.add(nextValA.getPosition());
                if (!cursorA.hasNext()) {
                    break;
                }
                nextValA = cursorA.next();
            }

            AttributeValuePosition nextValB = cursorB.current();
            while (nextValB.getValue().equals(valB.getValue())) {
                positionsB.add(nextValB.getPosition());
                if (!cursorB.hasNext()) {
                    break;
                }
                nextValB = cursorB.next();
            }

            if (positionsA.size() > 0 && positionsB.size() > 0) {
                positionsA.forEach(indexA -> uindCoordinates.putAll(indexA, positionsB));
            }
        } else if (valA.getValue().compareTo(valB.getValue()) < 0) {
            if (!cursorA.hasNext()) {
                break;
            }
            cursorA.next();
        } else {
            if (!cursorB.hasNext()) {
                break;
            }
            cursorB.next();
        }
    }
    if (cursorA.current().getValue().equals(cursorB.current().getValue())) {
        uindCoordinates.put(cursorA.current().getPosition(), cursorB.current().getPosition());
    }
    cursorA.close();
    cursorB.close();
    return uindCoordinates;
}
 
开发者ID:HPI-Information-Systems,项目名称:AdvancedDataProfilingSeminar,代码行数:60,代码来源:CoordinatesRepository.java


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