/** * {@inheritDoc} */ public boolean contains(T item) { return indices.containsKey(item); }
/** * Check if the resource consumption is defined for a VM. * * @param vm the VM * @return {@code true} iff the consumption is defined. */ public boolean consumptionDefined(VM vm) { return vmsConsumption.containsKey(vm); }
/** * {@inheritDoc} */ public boolean contains(T item) { return indices.containsKey(item); }
/** * Check if the resource capacity is defined for a node. * * @param n the node identifier * @return {@code true} iff the capacity is defined}. */ public boolean capacityDefined(Node n) { return nodesCapacity.containsKey(n); }
/** See {@link gnu.trove.map.hash.TObjectIntHashMap#containsKey(Object)} */ public boolean containsKey(Object key) { return delegate.containsKey(key); }
/** See {@link gnu.trove.map.hash.TObjectIntHashMap#containsKey(Object)} */ public boolean containsKey(Object key) { return delegate.containsKey(key); }
public static boolean isValidReagent(ItemStack stack) { return reagentAmpMap.containsKey(new ComparableItemStack(stack)); }
/** * Insert a key <i>k</i> with the value <i>v</i> in this. * If the key already exists, it is replaced. * @param k the key * @param v the value */ public void put(E k, int v) { if(map.containsKey(k)){ replace(k, v); }else { map.put(k, v); rmap.put(v, k); } }
/** * {@inheritDoc} */ public int find(T item) { return (indices.containsKey(item)) ? indices.get(item) : -indices.size(); }
/** * {@inheritDoc} */ public int find(T item) { return (indices.containsKey(item)) ? indices.get(item) : -indices.size(); }
@Override public synchronized int getId(T data) throws ItemNotFoundException, UndefinedKeyException { String key = data.toKey(); if (itemkey2id.containsKey(key)) return itemkey2id.get(key); else throw new ItemNotFoundException(data.toString()); }
/** * {@inheritDoc} */ public int index(T item) { if (indices.containsKey(item)) return indices.get(item); synchronized(indices) { // Double check that the item we are currently trying to index // wasn't added while we were blocking if (indices.containsKey(item)) return indices.get(item); int index = indices.size(); indices.put(item, index); return index; } }
@Override public void addNode(V vertex) { if (!vertexToNode.containsKey(vertex)) { vertexToNode.put(vertex, ++nodeCounter); nodeToVertex.put(nodeCounter, vertex); ahujaGraph.addNode(nodeCounter); } }
public static boolean addFuel(ItemStack stack, int energy) { if (stack.isEmpty() || energy < 2000 || energy > 200000000) { return false; } if (fuelMap.containsKey(new ComparableItemStack(stack))) { return false; } fuelMap.put(new ComparableItemStack(stack), energy); return true; }
public static boolean addGemFuel(ItemStack stack, int energy) { if (stack.isEmpty() || energy < 2000 || energy > 200000000) { return false; } if (gemFuelMap.containsKey(new ComparableItemStack(stack))) { return false; } gemFuelMap.put(new ComparableItemStack(stack), energy); return true; }
public static boolean addFuel(ItemStack stack, int energy) { if (stack.isEmpty() || energy < 2000 || energy > 200000000) { return false; } if (fuelMap.containsKey(new ComparableItemStack(stack))) { return false; } fuelMap.put(new ComparableItemStack(stack), energy); return true; }
public static boolean addFuel(ItemStack stack, int energy) { if (stack.isEmpty() || energy < 2000 || energy > 200000000) { return false; } if (fuelMap.containsKey(new ComparableItemStack(stack))) { return false; } fuelMap.put(new ComparableItemStack(stack), energy); return true; }
public static boolean addFuel(ItemStack stack, int energy) { if (stack.isEmpty() || energy < 2000 || energy > 200000000) { return false; } if (fuelMap.containsKey(new ComparableItemStack(stack))) { return false; } fuelMap.put(new ComparableItemStack(stack), energy); return true; }
public void setFluidData(FluidStack fluid) { int viscosity; if (fluid != null) { viscosity = Math.max(fluid.getFluid().getViscosity(), 100); fluidThroughput = MathHelper.clamp(120000 / viscosity, 80, 600); if (fluidFlowrate.containsKey(fluid.getFluid().getName())) { fluidThroughput = fluidFlowrate.get(fluid.getFluid().getName()); } fluidThroughput *= myMaster.getThroughPutModifier(); fluidPerDuct = Math.min(25 * fluidThroughput, myMaster.getMaxFluidPerDuct()); } myMaster.fluidChanged(); }
protected void merge(Term other) { if (other == this) return; this.score = this.score + other.score; this.totalOccurrences = this.totalOccurrences + other.totalOccurrences; TObjectIntIterator<Variant> iter = other.variants.iterator(); while (iter.hasNext()) { iter.advance(); Variant key = iter.key(); int value = iter.value(); if (this.variants.containsKey(key)) this.variants.adjustValue(key, value); else this.variants.put(key, value); key.replaceTerm(this); } }