当前位置: 首页>>代码示例>>Java>>正文


Java ObjectSet类代码示例

本文整理汇总了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());
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:23,代码来源:MultipleBlendingRetriever.java

示例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;
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:27,代码来源:KnnModelFeatureTrigger.java

示例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();
        }
    };
}
 
开发者ID:jmccrae,项目名称:naisc,代码行数:39,代码来源:DenseVector.java

示例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();
}
 
开发者ID:jmccrae,项目名称:naisc,代码行数:10,代码来源:SparseVectorTest.java

示例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();
}
 
开发者ID:jmccrae,项目名称:naisc,代码行数:10,代码来源:DenseVectorTest.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-hivemall,代码行数:11,代码来源:Fastutil.java

示例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);
        }
    }
}
 
开发者ID:grouplens,项目名称:samantha,代码行数:12,代码来源:KnnModelFeatureTrigger.java

示例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;
		}

	};
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:38,代码来源:ZFastTrie.java

示例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();
}
 
开发者ID:metaborg,项目名称:nabl,代码行数:9,代码来源:RegExpMatcher.java

示例10: nodeLayers

import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
public ObjectSet<String> nodeLayers() {
    return nodeLayers.keySet();
}
 
开发者ID:marcusklang,项目名称:docforia,代码行数:4,代码来源:MultipartMessages.java

示例11: edgeLayers

import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
public ObjectSet<String> edgeLayers() {
    return edgeLayers.keySet();
}
 
开发者ID:marcusklang,项目名称:docforia,代码行数:4,代码来源:MultipartMessages.java

示例12: sparseEntrySet

import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@Override
public ObjectSet<Int2DoubleMap.Entry> sparseEntrySet() {
    return underlying.int2DoubleEntrySet();
}
 
开发者ID:jmccrae,项目名称:naisc,代码行数:5,代码来源:SparseVector.java

示例13: entrySet

import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public ObjectSet<Map.Entry<Long, V>> entrySet() {
 return (ObjectSet)long2ObjectEntrySet();
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:5,代码来源:AbstractLong2ObjectMap.java

示例14: long2ObjectEntrySet

import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ObjectSet<Long2ObjectMap.Entry <V> > long2ObjectEntrySet() { return ObjectSets.EMPTY_SET; }
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:3,代码来源:Long2ObjectMaps.java

示例15: entrySet

import it.unimi.dsi.fastutil.objects.ObjectSet; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public ObjectSet<Map.Entry<Long, V>> entrySet() { return (ObjectSet)long2ObjectEntrySet(); }
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:3,代码来源:Long2ObjectMaps.java


注:本文中的it.unimi.dsi.fastutil.objects.ObjectSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。