本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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));
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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