本文整理汇总了Java中it.unimi.dsi.fastutil.objects.Object2IntMap.Entry方法的典型用法代码示例。如果您正苦于以下问题:Java Object2IntMap.Entry方法的具体用法?Java Object2IntMap.Entry怎么用?Java Object2IntMap.Entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.objects.Object2IntMap
的用法示例。
在下文中一共展示了Object2IntMap.Entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startsWith
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
default Selection startsWith(String string) {
Selection results = new BitmapBackedSelection();
IntRBTreeSet sorted = new IntRBTreeSet();
DictionaryMap dictionaryMap = this.dictionaryMap();
for (Object2IntMap.Entry<String> entry : dictionaryMap.valueToKeyMap().object2IntEntrySet()) {
String key = entry.getKey();
if (key.startsWith(string)) {
sorted.add(entry.getIntValue());
}
}
int i = 0;
for (int next : values()) {
if (sorted.contains(next)) {
results.add(i);
}
i++;
}
return results;
}
示例2: remove
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
@Override
public void remove(FHashMapObjectInt<String> v) {
for (Object2IntMap.Entry<String> entry : v.object2IntEntrySet()) {
int current = getInt(entry.getKey());
sumflog -= getPLogP(current);
if (entry.getIntValue() > current) {
log.fatal("remove cannot remove value greater than current key %s current %d remove %d", entry.getKey(), current, entry.getValue());
} else if (entry.getIntValue() == current) {
remove(entry.getKey());
} else {
put(entry.getKey(), current - entry.getIntValue());
sumflog += getPLogP(current - entry.getIntValue());
total -= entry.getIntValue();
}
}
magnitude = null;
}
示例3: add
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
/**
* Used to add two Lists that have counts for the same set of RowSnapShots. Behavior is not
* determined if it is called with two lists that have different sets of keys. Meant to be used
* by ExactFreqSketch.
* @param that The list to be added to the current one.
* @return Updated counts (existing counts are overwritten).
*/
public FreqKList add(FreqKList that) {
this.totalRows += that.totalRows;
for (Object2IntMap.Entry<RowSnapshot> entry : this.hMap.object2IntEntrySet()) {
int newVal = entry.getIntValue() + that.hMap.getOrDefault(entry.getKey(), 0);
entry.setValue(newVal);
}
return this;
}
示例4: filter
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
/**
* Prunes the hashmap to retain only those RowSnapshots that occur with frequency above
* 1/maxSize, and their frequencies.
*/
public void filter(double threshold) {
for (ObjectIterator<Object2IntMap.Entry<RowSnapshot>> it = this.hMap.object2IntEntrySet().fastIterator();
it.hasNext(); ) {
final Object2IntMap.Entry<RowSnapshot> entry = it.next();
if (entry.getIntValue() < (threshold))
it.remove();
}
}
示例5: rescale
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public void rescale() {
for (ObjectIterator<Object2IntMap.Entry<RowSnapshot>> it = this.hMap.object2IntEntrySet().fastIterator();
it.hasNext(); ) {
final Object2IntMap.Entry<RowSnapshot> entry = it.next();
if (entry.getIntValue() < (this.epsilon * this.maxSize /1.1))
it.remove();
else
this.hMap.put(entry.getKey(), (int) Math.ceil(entry
.getIntValue() * this.totalRows / this.maxSize));
}
}
示例6: subtract
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
/**
* creates a new Map containing the tallies of this map minus the tallies in
* map v.
*
* @param value
*/
public FHashMapObjectInt<K> subtract(FHashMapObjectInt<K> value) {
FHashMapObjectInt<K> result = create();
for (Object2IntMap.Entry<K> entry : object2IntEntrySet()) {
int v = entry.getIntValue() - value.getInt(entry.getKey());
if (v > 0) {
result.add(entry.getKey(), v);
}
}
return result;
}
示例7: getSumFLogOmit
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public double getSumFLogOmit(TermVectorEntropy omit) {
double sl = getsumflog();
for (Object2IntMap.Entry<String> o : omit.object2IntEntrySet()) {
int f = getInt(o.getKey());
sl -= getPLogP(f);
f -= o.getIntValue();
sl += getPLogP(f);
}
return sl;
}
示例8: add
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
@Override
public TermVectorInt add(FHashMapObjectInt<String> v) {
for (Object2IntMap.Entry<String> entry : v.object2IntEntrySet()) {
super.add(entry.getKey(), entry.getIntValue());
}
magnitude = null;
total = null;
return this;
}
示例9: combinedEntropy3
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public double combinedEntropy3(TermVectorEntropy vector2, int total) {
if (vector2.size() > size()) {
return vector2.combinedEntropy3(this, total);
}
double sumflog = this.getsumflog() + vector2.getsumflog();
for (Object2IntMap.Entry<String> entry : vector2.object2IntEntrySet()) {
if (containsKey(entry.getKey())) {
int f = getInt(entry.getKey());
sumflog += getPLogP(f + entry.getIntValue()) - getPLogP(f) - getPLogP(entry.getIntValue());
}
}
return sumflog / total + MathTools.log2(total);
}
示例10: cossim
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public double cossim(TermVectorInt v) {
if (this.size() > v.size()) {
return v.cossim(this);
}
double dotproduct = 0;
for (Object2IntMap.Entry<String> entry : object2IntEntrySet()) {
dotproduct += v.getInt(entry.getKey()) * entry.getIntValue();
}
double magnitude = magnitude() * v.magnitude();
return (magnitude == 0) ? 0 : dotproduct / magnitude;
}
示例11: cossimDebug
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public double cossimDebug(TermVectorInt v) {
if (this.size() > v.size()) {
return v.cossimDebug(this);
}
double dotproduct = 0;
for (Object2IntMap.Entry<String> entry : object2IntEntrySet()) {
dotproduct += v.getInt(entry.getKey()) * entry.getIntValue();
log.info("%s %d %d %s", entry.getKey(), v.getInt(entry.getKey()), entry.getIntValue(), dotproduct);
}
double magnitude = magnitude() * v.magnitude();
log.info("magnitude %s %s %s", magnitude(), v.magnitude(), dotproduct / magnitude);
return (magnitude == 0) ? 0 : dotproduct / magnitude;
}
示例12: cossimOmit
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public double cossimOmit(TermVectorInt v) {
double dotproduct = 0;
for (Object2IntMap.Entry<String> entry : object2IntEntrySet()) {
dotproduct += v.getInt(entry.getKey()) * entry.getIntValue();
}
double magnitude = magnitudeOmit(v) * v.magnitude();
return (magnitude == 0) ? 0 : dotproduct / magnitude;
}
示例13: normalize
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public TermVectorDouble normalize() {
TermVectorDouble result = new TermVectorDouble(size());
double total = total();
for (Object2IntMap.Entry<String> entry : object2IntEntrySet()) {
result.put(entry.getKey(), entry.getIntValue() / total);
}
return result;
}
示例14: write
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
@Override
public void write(StructureWriter writer) {
writer.write(size());
for (Object2IntMap.Entry<String> entry : object2IntEntrySet()) {
writer.write(entry.getKey());
writer.write(entry.getIntValue());
}
}
示例15: retainAll
import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public void retainAll(Set<String> keys) {
ObjectIterator<Object2IntMap.Entry<String>> fastIterator = this.object2IntEntrySet().fastIterator();
while (fastIterator.hasNext()) {
Object2IntMap.Entry<String> next = fastIterator.next();
if (!keys.contains(next.getKey())) {
fastIterator.remove();
}
}
}