本文整理汇总了Java中it.unimi.dsi.fastutil.objects.ObjectSet类的典型用法代码示例。如果您正苦于以下问题:Java ObjectSet类的具体用法?Java ObjectSet怎么用?Java ObjectSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectSet类属于it.unimi.dsi.fastutil.objects包,在下文中一共展示了ObjectSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieve
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
public RetrievedResult retrieve(RequestContext requestContext) {
ObjectSet<String> items = new ObjectOpenHashSet<>();
List<ObjectNode> entities = new ArrayList<>(maxHits);
for (Retriever retriever : retrievers) {
long start = System.currentTimeMillis();
RetrievedResult results = retriever.retrieve(requestContext);
Logger.debug("{} time: {}", retriever, System.currentTimeMillis() - start);
List<ObjectNode> initial = results.getEntityList();
initial = ExpanderUtilities.expand(initial, expanders, requestContext);
for (ObjectNode entity : initial) {
String item = FeatureExtractorUtilities.composeConcatenatedKey(entity, itemAttrs);
if (!items.contains(item)) {
items.add(item);
entities.add(entity);
if (maxHits != null && entities.size() >= maxHits) {
return new RetrievedResult(entities, maxHits);
}
}
}
}
return new RetrievedResult(entities, entities.size());
}
示例2: getTriggeredFeaturesWithoutScore
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
public List<ObjectNode> getTriggeredFeaturesWithoutScore(List<ObjectNode> bases) {
ObjectSet<String> items = new ObjectOpenHashSet<>();
for (ObjectNode inter : bases) {
double weight = 1.0;
if (inter.has(weightAttr)) {
weight = inter.get(weightAttr).asDouble();
}
String key = FeatureExtractorUtilities.composeConcatenatedKey(inter, feaAttrs);
if (weight >= 0.5 && featureKnnModel != null) {
getNeighbors(items, featureKnnModel, key);
}
if (weight < 0.5 && featureKdnModel != null) {
getNeighbors(items, featureKdnModel, key);
}
}
List<ObjectNode> results = new ArrayList<>();
for (String item : items) {
ObjectNode entity = Json.newObject();
Map<String, String> attrVals = FeatureExtractorUtilities.decomposeKey(item);
for (Map.Entry<String, String> ent : attrVals.entrySet()) {
entity.put(ent.getKey(), ent.getValue());
}
results.add(entity);
}
return results;
}
示例3: sparseEntrySet
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@Override
public ObjectSet<Int2DoubleMap.Entry> sparseEntrySet() {
return new AbstractObjectSet<Int2DoubleMap.Entry>() {
@Override
public ObjectIterator<Int2DoubleMap.Entry> iterator() {
return new ObjectIterator<Int2DoubleMap.Entry>() {
int n = 0;
@Override
public int skip(int i) {
int nold = n;
n = Math.max(0, Math.min(size(), n + i));
return n - nold;
}
@Override
public boolean hasNext() {
return n < size();
}
@Override
public Int2DoubleMap.Entry next() {
return new AbstractInt2DoubleMap.BasicEntry(n, getDouble(n++));
}
@Override
public void remove() {
}
};
}
@Override
public int size() {
return DenseVector.this.size();
}
};
}
示例4: testSparseEntrySet
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
/**
* Test of sparseEntrySet method, of class SparseVector.
*/
@Test
public void testSparseEntrySet() {
System.out.println("sparseEntrySet");
SparseVector instance = new SparseVector(3);
ObjectSet<Int2DoubleMap.Entry> result = instance.sparseEntrySet();
}
示例5: testSparseEntrySet
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
/**
* Test of sparseEntrySet method, of class DenseVector.
*/
@Test
public void testSparseEntrySet() {
System.out.println("sparseEntrySet");
DenseVector instance = new DenseVector(3);
ObjectSet<Int2DoubleMap.Entry> result = instance.sparseEntrySet();
}
示例6: fastIterable
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@Nonnull
public static ObjectIterable<Int2LongMap.Entry> fastIterable(@Nonnull final Int2LongMap map) {
final ObjectSet<Int2LongMap.Entry> entries = map.int2LongEntrySet();
return entries instanceof Int2LongMap.FastEntrySet ? new ObjectIterable<Int2LongMap.Entry>() {
public ObjectIterator<Int2LongMap.Entry> iterator() {
return ((Int2LongMap.FastEntrySet) entries).fastIterator();
}
}
: entries;
}
示例7: getNeighbors
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
private void getNeighbors(ObjectSet<String> items, FeatureKnnModel knnModel,
String key) {
if (knnModel.hasKey(key)) {
RealVector sims = knnModel.getKeyVector(key);
for (int i=0; i<sims.getDimension(); i+=2) {
int idx = (int)sims.getEntry(i);
String recItem = knnModel.getKeyByIndex(idx);
items.add(recItem);
}
}
}
示例8: keySet
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
public ObjectSet<LongArrayBitVector> keySet() {
return new AbstractObjectSet<LongArrayBitVector>() {
@Override
public ObjectIterator<LongArrayBitVector> iterator() {
return new ObjectIterator<LongArrayBitVector>() {
private int i = 0;
private int pos = -1;
@Override
public boolean hasNext() {
return i < size;
}
@Override
public LongArrayBitVector next() {
if (! hasNext()) throw new NoSuchElementException();
while(node[++pos] == null);
i++;
return LongArrayBitVector.copy(node[pos].handle(transform));
}
};
}
@Override
public boolean contains(Object o) {
final BitVector v = (BitVector)o;
return get(v, true) != null;
}
@Override
public int size() {
return size;
}
};
}
示例9: RegExpMatcher
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
private RegExpMatcher(IRegExp<S> state,
Object2ObjectMap<IRegExp<S>,Object2ObjectMap<S,IRegExp<S>>> stateTransitions,
ObjectSet<IRegExp<S>> nonFinal) {
this.state = state;
this.stateTransitions = stateTransitions;
this.nonFinal = nonFinal;
this.alphabet = state.getBuilder().getAlphabet();
}
示例10: nodeLayers
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
public ObjectSet<String> nodeLayers() {
return nodeLayers.keySet();
}
示例11: edgeLayers
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
public ObjectSet<String> edgeLayers() {
return edgeLayers.keySet();
}
示例12: sparseEntrySet
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@Override
public ObjectSet<Int2DoubleMap.Entry> sparseEntrySet() {
return underlying.int2DoubleEntrySet();
}
示例13: entrySet
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public ObjectSet<Map.Entry<Long, V>> entrySet() {
return (ObjectSet)long2ObjectEntrySet();
}
示例14: long2ObjectEntrySet
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ObjectSet<Long2ObjectMap.Entry <V> > long2ObjectEntrySet() { return ObjectSets.EMPTY_SET; }
示例15: entrySet
import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public ObjectSet<Map.Entry<Long, V>> entrySet() { return (ObjectSet)long2ObjectEntrySet(); }