本文整理了Java中gnu.trove.map.TObjectIntMap.adjustOrPutValue()
方法的一些代码示例,展示了TObjectIntMap.adjustOrPutValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TObjectIntMap.adjustOrPutValue()
方法的具体详情如下:
包路径:gnu.trove.map.TObjectIntMap
类名称:TObjectIntMap
方法名:adjustOrPutValue
[英]Adjusts the primitive value mapped to the key if the key is present in the map. Otherwise, the initial_value is put in the map.
[中]如果映射中存在键,则调整映射到该键的基本体值。否则,初始_值将被放入映射中。
代码示例来源:origin: alibaba/mdrill
public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) {
synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); }
}
代码示例来源:origin: MovingBlocks/Terasology
@Override
public final synchronized void beginTask(String task) {
if (taskCounters.adjustOrPutValue(task, 1, 1) == 1) {
tasks.add(task);
}
active = true;
lastTask = task;
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
public Registration getRegistration(Class type) {
instanceCounts.adjustOrPutValue(type, 1, 1);
return super.getRegistration(type);
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
group.forEach(tt -> patternCount.adjustOrPutValue(graph.index.patternForTrip.get(tt.trip), 1, 1));
代码示例来源:origin: net.sf.trove4j/trove4j
public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) {
synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); }
}
代码示例来源:origin: com.palantir.patches.sourceforge/trove3
@Override
public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) {
synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); }
}
代码示例来源:origin: net.sf.trove4j/core
public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) {
synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); }
}
代码示例来源:origin: hernad/easyrec
public int adjustOrPutValue( K key, int adjust_amount, int put_amount ) {
synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); }
}
代码示例来源:origin: com.conveyal/r5
public Registration getRegistration(Class type) {
instanceCounts.adjustOrPutValue(type, 1, 1);
return super.getRegistration(type);
}
代码示例来源:origin: conveyal/r5
public Registration getRegistration(Class type) {
instanceCounts.adjustOrPutValue(type, 1, 1);
return super.getRegistration(type);
}
代码示例来源:origin: shilad/wikibrain
for (KnownSim ks : mostSim) {
ids.put(ks.phrase2, ks.wpId2);
counts.adjustOrPutValue(ks.phrase2, 1, 1);
sums.adjustOrPutValue(ks.phrase2, ks.similarity, ks.similarity);
代码示例来源:origin: Chisel-Team/Chisel
@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());
代码示例来源:origin: PenguinSquad/Harvest-Festival
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;
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
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);
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
/**
* 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();
}
}
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
@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;
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
IBlockState state = world.getBlockState(toCheck);
counter.adjustOrPutValue(state, 1, 1);
内容来源于网络,如有侵权,请联系作者删除!