Java Code Examples for com.google.common.collect.ArrayListMultimap#keySet()

The following examples show how to use com.google.common.collect.ArrayListMultimap#keySet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StaticRecipeChangeLoaders.java    From bartworks with MIT License 6 votes vote down vote up
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;
}
 
Example 2
Source File: StaticRecipeChangeLoaders.java    From bartworks with MIT License 6 votes vote down vote up
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);
}
 
Example 3
Source File: RoundRobinOperator.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
public RoundRobinOperator(TunnelProvider tunnelProvider, OperatorContext context, RoundRobinSender config) throws OutOfMemoryException {
  super(config);
  this.config = config;
  this.allocator = context.getAllocator();
  this.handle = context.getFragmentHandle();
  this.stats = context.getStats();

  List<MinorFragmentEndpoint> destinations = config.getDestinations(context.getEndpointsIndex());
  final ArrayListMultimap<NodeEndpoint, Integer> dests = ArrayListMultimap.create();
  for(MinorFragmentEndpoint destination : destinations) {
    dests.put(destination.getEndpoint(), destination.getMinorFragmentId());
  }

  this.tunnels = new ArrayList<>();
  this.minorFragments = new ArrayList<>();
  for(final NodeEndpoint ep : dests.keySet()){
    List<Integer> minorsList= dests.get(ep);
    minorFragments.add(minorsList);
    tunnels.add(tunnelProvider.getExecTunnel(ep));
  }

  int destCount = dests.keySet().size();
  this.currentTunnelsIndex = ThreadLocalRandom.current().nextInt(destCount);
  this.currentMinorFragmentsIndex = ThreadLocalRandom.current().nextInt(minorFragments.get(currentTunnelsIndex).size());
}
 
Example 4
Source File: SchematicVerifier.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addCountFor(MismatchType mismatchType, ArrayListMultimap<Pair<IBlockState, IBlockState>, BlockPos> map, List<BlockMismatch> list)
{
    for (Pair<IBlockState, IBlockState> pair : map.keySet())
    {
        list.add(new BlockMismatch(mismatchType, pair.getLeft(), pair.getRight(), map.get(pair).size()));
    }
}
 
Example 5
Source File: DefaultConfigHandler.java    From mango with Apache License 2.0 5 votes vote down vote up
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);
                }
            }
        }
    }
 
Example 6
Source File: BroadcastOperator.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
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++;
  }
}