com.google.common.collect.ArrayListMultimap#get ( )源码实例Demo

下面列出了com.google.common.collect.ArrayListMultimap#get ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: bistoury   文件: PidByJpsHandler.java
@Override
protected int doGetPid() {
    Res<List<String>> res = getJpsInfo();
    if (res.getCode() == 0) {
        ArrayListMultimap<String, JpsInfo> multimap = parseJpsInfo(res.getData());
        List<JpsInfo> jpsInfos = multimap.get(JPS_SYMBOL_CLASS);
        if (jpsInfos.size() > 0) {
            return jpsInfos.iterator().next().getPid();
        } else {
            return -1;
        }
    } else {
        logger.error(res.getMessage());
        return -1;
    }
}
 
源代码2 项目: tasmo   文件: TasmoModelFactory.java
static public List<ViewBinding> parseModelPathStrings(String... simpleBindings) {
    ArrayListMultimap<String, ModelPath> viewBindings = ArrayListMultimap.create();

    for (String simpleBinding : simpleBindings) {
        String[] class_pathId_modelPath = toStringArray(simpleBinding, "::");
        List<ModelPath> bindings = viewBindings.get(class_pathId_modelPath[0].trim());

        bindings.add(buildPath(class_pathId_modelPath[1].trim(), class_pathId_modelPath[2].trim()));
    }

    List<ViewBinding> viewBindingsList = Lists.newArrayList();
    for (Map.Entry<String, Collection<ModelPath>> entry : viewBindings.asMap().entrySet()) {
        viewBindingsList.add(new ViewBinding(entry.getKey(), new ArrayList<>(entry.getValue()), false, false, null));
    }

    return viewBindingsList;
}
 
源代码3 项目: bartworks   文件: StaticRecipeChangeLoaders.java
private static HashSet<ItemStack> getNoGasItems(ArrayListMultimap<SubTag, GT_Recipe> base) {
    HashSet<ItemStack> toAdd = new HashSet<>();
    ArrayListMultimap<SubTag, GT_Recipe> repToAdd = ArrayListMultimap.create();
    for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList) {
        for (SubTag tag : base.keySet())
            recipeLoop:
                    for (GT_Recipe baseRe : base.get(tag)) {
                        if (recipe.mInputs.length == baseRe.mInputs.length && recipe.mOutputs.length == baseRe.mOutputs.length)
                            for (int i = 0; i < recipe.mInputs.length; i++) {
                                if ((recipe.mFluidInputs == null || recipe.mFluidInputs.length == 0) && BW_Util.checkStackAndPrefix(recipe.mInputs[i]) && BW_Util.checkStackAndPrefix(baseRe.mInputs[i]) && GT_OreDictUnificator.getAssociation(recipe.mInputs[i]).mMaterial.mMaterial.equals(GT_OreDictUnificator.getAssociation(baseRe.mInputs[i]).mMaterial.mMaterial) && GT_Utility.areStacksEqual(recipe.mOutputs[0], baseRe.mOutputs[0])) {
                                    toAdd.add(recipe.mOutputs[0]);
                                    repToAdd.put(tag, recipe);
                                    continue recipeLoop;
                                }
                            }
                    }
    }
    base.putAll(repToAdd);
    return toAdd;
}
 
源代码4 项目: bartworks   文件: StaticRecipeChangeLoaders.java
private static void editRecipes(ArrayListMultimap<SubTag, GT_Recipe> base, HashSet<ItemStack> noGas) {
    if (GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeFluidNameMap.contains(Objects.requireNonNull(fluids.get(Oganesson)).getName()))
        return;

    HashSet<GT_Recipe> toAdd = new HashSet<>();

    for (SubTag gasTag : base.keySet()) {
        for (GT_Recipe recipe : base.get(gasTag)) {
            if (recipe.mFluidInputs != null && recipe.mFluidInputs.length > 0) {
                Materials mat = getMaterialFromInputFluid(recipe);
                if (mat != Materials._NULL) {
                    editEBFWerkstoffRecipes(gasTag, recipe, mat, toAdd);
                    editEBFMaterialRecipes(gasTag, recipe, mat, toAdd);
                    editEBFNoGasRecipes(recipe, mat, toAdd, noGas);
                }
            }
        }
        GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList.removeAll(base.get(gasTag));
    }

    removeDuplicateGasRecipes(toAdd);
    toAdd.forEach(GT_Recipe.GT_Recipe_Map.sBlastRecipes::add);
}
 
源代码5 项目: tasmo   文件: Materialization.java
static List<ViewBinding> parseModelPathStrings(List<String> simpleBindings) {
    ArrayListMultimap<String, ModelPath> viewBindings = ArrayListMultimap.create();

    for (String simpleBinding : simpleBindings) {
        String[] class_pathId_modelPath = toStringArray(simpleBinding, "::");
        List<ModelPath> bindings = viewBindings.get(class_pathId_modelPath[0].trim());

        bindings.add(buildPath(class_pathId_modelPath[1].trim(), class_pathId_modelPath[2].trim()));
    }

    List<ViewBinding> viewBindingsList = Lists.newArrayList();
    for (Map.Entry<String, Collection<ModelPath>> entry : viewBindings.asMap().entrySet()) {
        viewBindingsList.add(new ViewBinding(entry.getKey(), new ArrayList<>(entry.getValue()), false, false, null));
    }

    return viewBindingsList;
}
 
源代码6 项目: tasmo   文件: TasmoModelFactory.java
static public List<ViewBinding> parseModelPathStrings(String... simpleBindings) {
    ArrayListMultimap<String, ModelPath> viewBindings = ArrayListMultimap.create();

    for (String simpleBinding : simpleBindings) {
        String[] class_pathId_modelPath = toStringArray(simpleBinding, "::");
        List<ModelPath> bindings = viewBindings.get(class_pathId_modelPath[0].trim());

        bindings.add(buildPath(class_pathId_modelPath[1].trim(), class_pathId_modelPath[2].trim()));
    }

    List<ViewBinding> viewBindingsList = Lists.newArrayList();
    for (Map.Entry<String, Collection<ModelPath>> entry : viewBindings.asMap().entrySet()) {
        viewBindingsList.add(new ViewBinding(entry.getKey(), new ArrayList<>(entry.getValue()), false, false, null));
    }

    return viewBindingsList;
}
 
源代码7 项目: tasmo   文件: ViewModelParser.java
public List<ViewBinding> parse(List<String> modelPathtrings) {
    ArrayListMultimap<String, ModelPath> viewBindings = ArrayListMultimap.create();

    for (String simpleBinding : modelPathtrings) {
        String[] class_pathId_modelPath = toStringArray(simpleBinding, "::");
        List<ModelPath> bindings = viewBindings.get(class_pathId_modelPath[0].trim());

        try {
            bindings.add(buildPath(class_pathId_modelPath[1].trim(), class_pathId_modelPath[2].trim()));
        } catch (Throwable t) {
            t.printStackTrace(System.out);
        }
    }

    List<ViewBinding> viewBindingsList = Lists.newArrayList();
    for (Map.Entry<String, Collection<ModelPath>> entry : viewBindings.asMap().entrySet()) {
        viewBindingsList.add(new ViewBinding(entry.getKey(), new ArrayList<>(entry.getValue()), false, true, null));
    }

    return viewBindingsList;
}
 
源代码8 项目: runelite   文件: MenuEntrySwapperPlugin.java
private void swap(ArrayListMultimap<String, Integer> optionIndexes, MenuEntry[] entries, int index1, int index2)
{
	MenuEntry entry1 = entries[index1],
		entry2 = entries[index2];

	entries[index1] = entry2;
	entries[index2] = entry1;

	client.setMenuEntries(entries);

	// Update optionIndexes
	String option1 = Text.removeTags(entry1.getOption()).toLowerCase(),
		option2 = Text.removeTags(entry2.getOption()).toLowerCase();

	List<Integer> list1 = optionIndexes.get(option1),
		list2 = optionIndexes.get(option2);

	// call remove(Object) instead of remove(int)
	list1.remove((Integer) index1);
	list2.remove((Integer) index2);

	sortedInsert(list1, index2);
	sortedInsert(list2, index1);
}
 
源代码9 项目: tablesaw   文件: Summarizer.java
/**
 * Associates the columns to be summarized with the functions that match their type. All valid
 * combinations are used
 *
 * @param group A table slice group
 * @param selectionFunction Function that provides the filter for the having clause
 * @return A table containing a row of summarized data for each group in the table slice group
 */
private Table summarizeForHaving(
    TableSliceGroup group, Function<Table, Selection> selectionFunction) {
  List<Table> results = new ArrayList<>();

  ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap =
      getAggregateFunctionMultimap();

  for (String name : reductionMultimap.keys()) {
    List<AggregateFunction<?, ?>> reductions = reductionMultimap.get(name);
    Table groupTable = group.aggregate(name, reductions.toArray(new AggregateFunction<?, ?>[0]));
    groupTable = groupTable.where(selectionFunction);
    if (!groupTable.isEmpty()) {
      results.add(groupTable);
    }
  }
  return combineTables(results);
}
 
源代码10 项目: tablesaw   文件: Summarizer.java
/**
 * Associates the columns to be summarized with the functions that match their type. All valid
 * combinations are used
 *
 * @param group A table slice group
 * @param selectionFunction Function that provides the filter for the having clause
 * @return A table containing a row of summarized data for each group in the table slice group
 */
private Table summarizeForHaving(
    TableSliceGroup group, Function<Table, Selection> selectionFunction) {
  List<Table> results = new ArrayList<>();

  ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap =
      getAggregateFunctionMultimap();

  for (String name : reductionMultimap.keys()) {
    List<AggregateFunction<?, ?>> reductions = reductionMultimap.get(name);
    Table groupTable = group.aggregate(name, reductions.toArray(new AggregateFunction<?, ?>[0]));
    groupTable = groupTable.where(selectionFunction);
    if (!groupTable.isEmpty()) {
      results.add(groupTable);
    }
  }
  return combineTables(results);
}
 
源代码11 项目: tasmo   文件: Materialization.java
static List<ViewBinding> parseModelPathStrings(List<String> simpleBindings) {
    ArrayListMultimap<String, ModelPath> viewBindings = ArrayListMultimap.create();

    for (String simpleBinding : simpleBindings) {
        String[] class_pathId_modelPath = toStringArray(simpleBinding, "::");
        List<ModelPath> bindings = viewBindings.get(class_pathId_modelPath[0].trim());

        bindings.add(buildPath(class_pathId_modelPath[1].trim(), class_pathId_modelPath[2].trim()));
    }

    List<ViewBinding> viewBindingsList = Lists.newArrayList();
    for (Map.Entry<String, Collection<ModelPath>> entry : viewBindings.asMap().entrySet()) {
        viewBindingsList.add(new ViewBinding(entry.getKey(), new ArrayList<>(entry.getValue()), false, false, null));
    }

    return viewBindingsList;
}
 
源代码12 项目: tasmo   文件: ViewModelParser.java
public List<ViewBinding> parse(List<String> modelPathtrings) {
    ArrayListMultimap<String, ModelPath> viewBindings = ArrayListMultimap.create();

    for (String simpleBinding : modelPathtrings) {
        String[] class_pathId_modelPath = toStringArray(simpleBinding, "::");
        List<ModelPath> bindings = viewBindings.get(class_pathId_modelPath[0].trim());

        try {
            bindings.add(buildPath(class_pathId_modelPath[1].trim(), class_pathId_modelPath[2].trim()));
        } catch (Throwable t) {
            t.printStackTrace(System.out);
        }
    }

    List<ViewBinding> viewBindingsList = Lists.newArrayList();
    for (Map.Entry<String, Collection<ModelPath>> entry : viewBindings.asMap().entrySet()) {
        viewBindingsList.add(new ViewBinding(entry.getKey(), new ArrayList<>(entry.getValue()), false, true, null));
    }

    return viewBindingsList;
}
 
源代码13 项目: mango   文件: DefaultConfigHandler.java
private void unRegister(ArrayListMultimap<URL, URL> registryUrls) {

        for (URL serviceUrl : registryUrls.keySet()) {
            for (URL url : registryUrls.get(serviceUrl)) {
                try {
                    RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getExtension(url.getProtocol());
                    Registry registry = registryFactory.getRegistry(url);
                    registry.unregister(serviceUrl);
                } catch (Exception e) {
                    logger.warn(String.format("unregister url false:%s", url), e);
                }
            }
        }
    }
 
源代码14 项目: dremio-oss   文件: AbstractMuxExchange.java
protected void createSenderReceiverMapping(EndpointsIndex.Builder indexBuilder) {
  if (isSenderReceiverMappingCreated) {
    return;
  }

  senderToReceiverMapping = Maps.newHashMap();
  receiverToSenderMapping = ArrayListMultimap.create();

  // Find the list of sender fragment ids assigned to each SabotNode endpoint.
  ArrayListMultimap<NodeEndpoint, Integer> endpointSenderList = ArrayListMultimap.create();

  int senderFragmentId = 0;
  for(NodeEndpoint senderLocation : senderLocations) {
    endpointSenderList.put(senderLocation, senderFragmentId);
    senderFragmentId++;
  }

  int receiverFragmentId = 0;
  for(NodeEndpoint receiverLocation : receiverLocations) {
    List<Integer> senderFragmentIds = endpointSenderList.get(receiverLocation);

    for(Integer senderId : senderFragmentIds) {
      senderToReceiverMapping.put(senderId,
        indexBuilder.addFragmentEndpoint(receiverFragmentId, receiverLocation));

      receiverToSenderMapping.put(receiverFragmentId,
        indexBuilder.addFragmentEndpoint(senderId, senderLocations.get(senderId)));
    }
    receiverFragmentId++;
  }

  isSenderReceiverMappingCreated = true;
}
 
源代码15 项目: dremio-oss   文件: AbstractDeMuxExchange.java
protected void createSenderReceiverMapping(EndpointsIndex.Builder indexBuilder) {
  if (isSenderReceiverMappingCreated) {
    return;
  }

  senderToReceiversMapping = ArrayListMultimap.create();
  receiverToSenderMapping = Maps.newHashMap();

  // Find the list of receiver fragment ids assigned to each SabotNode endpoint
  ArrayListMultimap<NodeEndpoint, Integer> endpointReceiverList = ArrayListMultimap.create();

  int receiverFragmentId = 0;
  for(NodeEndpoint receiverLocation : receiverLocations) {
    endpointReceiverList.put(receiverLocation, receiverFragmentId);
    receiverFragmentId++;
  }

  int senderFragmentId = 0;
  for(NodeEndpoint senderLocation : senderLocations) {
    final List<Integer> receiverMinorFragmentIds = endpointReceiverList.get(senderLocation);

    for(Integer receiverId : receiverMinorFragmentIds) {
      receiverToSenderMapping.put(receiverId, indexBuilder.addFragmentEndpoint(senderFragmentId, senderLocation));

      senderToReceiversMapping.put(senderFragmentId,
          indexBuilder.addFragmentEndpoint(receiverId, receiverLocations.get(receiverId)));
    }
    senderFragmentId++;
  }

  isSenderReceiverMappingCreated = true;
}
 
源代码16 项目: dremio-oss   文件: BroadcastOperator.java
public BroadcastOperator(TunnelProvider tunnelProvider, OperatorContext context, BroadcastSender config) throws OutOfMemoryException {
  super(config);
  this.config = config;
  this.context = context;
  this.handle = context.getFragmentHandle();
  this.stats = context.getStats();

  final List<MinorFragmentEndpoint> destinations = config.getDestinations(context.getEndpointsIndex());
  final ArrayListMultimap<NodeEndpoint, Integer> dests = ArrayListMultimap.create();

  for(MinorFragmentEndpoint destination : destinations) {
    dests.put(destination.getEndpoint(), destination.getMinorFragmentId());
  }

  int destCount = dests.keySet().size();
  int i = 0;

  this.tunnels = new AccountingExecTunnel[destCount];
  this.receivingMinorFragments = new int[destCount][];
  for(final NodeEndpoint ep : dests.keySet()){
    List<Integer> minorsList= dests.get(ep);
    int[] minorsArray = new int[minorsList.size()];
    int x = 0;
    for(Integer m : minorsList){
      minorsArray[x++] = m;
    }
    receivingMinorFragments[i] = minorsArray;
    tunnels[i] = tunnelProvider.getExecTunnel(ep);
    i++;
  }
}
 
源代码17 项目: tablesaw   文件: Summarizer.java
/**
 * Returns the result of applying to the functions to all the values in the appropriate column
 * TODO add a test that uses a non numeric return type with apply
 */
@SuppressWarnings({"unchecked", "rawtypes"})
public Table apply() {

  if (groupColumnNames.length > 0) {
    TableSliceGroup group = StandardTableSliceGroup.create(temp, groupColumnNames);
    return summarize(group);
  } else {
    List<Table> results = new ArrayList<>();
    ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap =
        getAggregateFunctionMultimap();

    for (String name : reductionMultimap.keys()) {
      List<AggregateFunction<?, ?>> reductions = reductionMultimap.get(name);
      Table table = TableSliceGroup.summaryTableName(temp);
      for (AggregateFunction function : reductions) {
        Column column = temp.column(name);
        Object result = function.summarize(column);
        ColumnType type = function.returnType();
        Column newColumn =
            type.create(TableSliceGroup.aggregateColumnName(name, function.functionName()));
        if (result instanceof Number) {
          Number number = (Number) result;
          newColumn.append(number.doubleValue());
        } else {
          newColumn.append(result);
        }
        table.addColumns(newColumn);
      }
      results.add(table);
    }
    return (combineTables(results));
  }
}
 
源代码18 项目: tablesaw   文件: Summarizer.java
/**
 * Associates the columns to be summarized with the functions that match their type. All valid
 * combinations are used
 *
 * @param group A table slice group
 * @return A table containing a row of summarized data for each group in the table slice group
 */
private Table summarize(TableSliceGroup group) {
  List<Table> results = new ArrayList<>();

  ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap =
      getAggregateFunctionMultimap();

  for (String name : reductionMultimap.keys()) {
    List<AggregateFunction<?, ?>> reductions = reductionMultimap.get(name);
    results.add(group.aggregate(name, reductions.toArray(new AggregateFunction<?, ?>[0])));
  }
  return combineTables(results);
}
 
源代码19 项目: tablesaw   文件: Summarizer.java
/**
 * Returns the result of applying to the functions to all the values in the appropriate column
 * TODO add a test that uses a non numeric return type with apply
 */
@SuppressWarnings({"unchecked", "rawtypes"})
public Table apply() {

  if (groupColumnNames.length > 0) {
    TableSliceGroup group = StandardTableSliceGroup.create(temp, groupColumnNames);
    return summarize(group);
  } else {
    List<Table> results = new ArrayList<>();
    ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap =
        getAggregateFunctionMultimap();

    for (String name : reductionMultimap.keys()) {
      List<AggregateFunction<?, ?>> reductions = reductionMultimap.get(name);
      Table table = TableSliceGroup.summaryTableName(temp);
      for (AggregateFunction function : reductions) {
        Column column = temp.column(name);
        Object result = function.summarize(column);
        ColumnType type = function.returnType();
        Column newColumn =
            type.create(TableSliceGroup.aggregateColumnName(name, function.functionName()));
        if (result instanceof Number) {
          Number number = (Number) result;
          newColumn.append(number.doubleValue());
        } else {
          newColumn.append(result);
        }
        table.addColumns(newColumn);
      }
      results.add(table);
    }
    return (combineTables(results));
  }
}
 
源代码20 项目: tablesaw   文件: Summarizer.java
/**
 * Associates the columns to be summarized with the functions that match their type. All valid
 * combinations are used
 *
 * @param group A table slice group
 * @return A table containing a row of summarized data for each group in the table slice group
 */
private Table summarize(TableSliceGroup group) {
  List<Table> results = new ArrayList<>();

  ArrayListMultimap<String, AggregateFunction<?, ?>> reductionMultimap =
      getAggregateFunctionMultimap();

  for (String name : reductionMultimap.keys()) {
    List<AggregateFunction<?, ?>> reductions = reductionMultimap.get(name);
    results.add(group.aggregate(name, reductions.toArray(new AggregateFunction<?, ?>[0])));
  }
  return combineTables(results);
}