public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
@Override public final synchronized void beginTask(String task) { if (taskCounters.adjustOrPutValue(task, 1, 1) == 1) { tasks.add(task); } active = true; lastTask = task; }
public Registration getRegistration(Class type) { instanceCounts.adjustOrPutValue(type, 1, 1); return super.getRegistration(type); }
group.forEach(tt -> patternCount.adjustOrPutValue(graph.index.patternForTrip.get(tt.trip), 1, 1));
public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
@Override public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
public Registration getRegistration(Class type) { instanceCounts.adjustOrPutValue(type, 1, 1); return super.getRegistration(type); }
public Registration getRegistration(Class type) { instanceCounts.adjustOrPutValue(type, 1, 1); return super.getRegistration(type); }
for (KnownSim ks : mostSim) { ids.put(ks.phrase2, ks.wpId2); counts.adjustOrPutValue(ks.phrase2, 1, 1); sums.adjustOrPutValue(ks.phrase2, ks.similarity, ks.similarity);
@SuppressWarnings("deprecation") private void handle(FMLInterModComms.IMCMessage message, IMC type) { imcCounts.adjustOrPutValue(message.getSender(), 1, 1); if (type.isDeprecated()) { Set<String> usedForMod = deprecatedUses.get(message.getSender());
private void calculateHungerSaturationAndRemoveOptionals(Recipe recipe, List<IngredientStack> optionals) { float hunger = 0; float saturation = 0F; TObjectIntMap<Ingredient> added = new TObjectIntHashMap<>(); for (IngredientStack stack: optionals) { Ingredient main = stack.getIngredient(); //If we haven't already added this ingredient, use the full value if (!added.containsKey(main) || stack.isSame(required)) { hunger += main.getHunger(); saturation += main.getSaturation(); added.put(main, 0); } else { //If we have already used this ingredient, let's get how many times we have int used = added.adjustOrPutValue(main, 1, 1); hunger += (((double)main.getHunger())/ (4 * used)); saturation += ((main.getSaturation())/ (4 * used)); //We're added less and less each time to hunger and saturation for each ingredient } if (added.size() >= recipe.getMaximumOptionalIngredients()) break; } this.optional.clear(); this.hunger = (int) Math.floor(hunger); this.saturation = saturation; }
private void calculateActualHungerAndSaturationValues(Recipe recipe) { //Add the leftover required ingredients if (required.size() > 0) { TObjectIntMap<Ingredient> added = new TObjectIntHashMap<>(); for (IngredientStack stack: required) { Ingredient main = stack.getIngredient(); //If we haven't already added this ingredient, use the full value if (!added.containsKey(main)) { hunger += (main.getHunger() / 2); saturation += (main.getSaturation() / 2); added.put(main, 0); } else { //If we have already used this ingredient, let's get how many times we have int used = added.adjustOrPutValue(main, 1, 1); hunger += (((double)main.getHunger())/ (4 * used)); saturation += ((main.getSaturation())/ (4 * used)); //We're added less and less each time to hunger and saturation for each ingredient } } } this.hunger = recipe.getHunger() + (int)((double)this.hunger / stackSize); this.saturation = recipe.getSaturation() + (this.saturation / stackSize); }
/** * Learns the prior probability for all classes. */ @Override public void buildClassifier(Database database, Relation<? extends ClassLabel> labelrep) { TObjectIntMap<ClassLabel> count = new TObjectIntHashMap<>(); for(DBIDIter iter = labelrep.iterDBIDs(); iter.valid(); iter.advance()) { count.adjustOrPutValue(labelrep.get(iter), 1, 1); } int max = Integer.MIN_VALUE; double size = labelrep.size(); distribution = new double[count.size()]; labels = new ArrayList<>(count.size()); TObjectIntIterator<ClassLabel> iter = count.iterator(); for(int i = 0; iter.hasNext(); ++i) { iter.advance(); distribution[i] = iter.value() / size; labels.add(iter.key()); if(iter.value() > max) { max = iter.value(); prediction = iter.key(); } } }
@Override public ClassLabel classify(O instance) { TObjectIntMap<ClassLabel> count = new TObjectIntHashMap<>(); KNNList query = knnq.getKNNForObject(instance, k); for(DoubleDBIDListIter neighbor = query.iter(); neighbor.valid(); neighbor.advance()) { count.adjustOrPutValue(labelrep.get(neighbor), 1, 1); } int bestoccur = Integer.MIN_VALUE; ClassLabel bestl = null; for(TObjectIntIterator<ClassLabel> iter = count.iterator(); iter.hasNext();) { iter.advance(); if(iter.value() > bestoccur) { bestoccur = iter.value(); bestl = iter.key(); } } return bestl; }
IBlockState state = world.getBlockState(toCheck); counter.adjustOrPutValue(state, 1, 1);