本文整理汇总了Java中com.carrotsearch.hppc.IntObjectMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java IntObjectMap.put方法的具体用法?Java IntObjectMap.put怎么用?Java IntObjectMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.carrotsearch.hppc.IntObjectMap
的用法示例。
在下文中一共展示了IntObjectMap.put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import com.carrotsearch.hppc.IntObjectMap; //导入方法依赖的package包/类
@Override
public ConcatVectorNamespace generate(SourceOfRandomness sourceOfRandomness, GenerationStatus generationStatus) {
ConcatVectorNamespace namespace = new ConcatVectorNamespace();
namespace.featureToIndex.putAll(generateFeatureMap(sourceOfRandomness));
for (ObjectCursor<String> key : namespace.featureToIndex.keys()) {
if (sourceOfRandomness.nextBoolean()) {
ObjectIntMap<String> sparseMap = generateFeatureMap(sourceOfRandomness);
IntObjectMap< String> reverseSparseMap = new IntObjectHashMap<>();
for (ObjectCursor<String> sparseKey : sparseMap.keys()) reverseSparseMap.put(sparseMap.get(sparseKey.value), sparseKey.value);
namespace.sparseFeatureIndex.put(key.value, sparseMap);
namespace.reverseSparseFeatureIndex.put(key.value, reverseSparseMap);
}
}
return namespace;
}
示例2: fillEdgesUpward
import com.carrotsearch.hppc.IntObjectMap; //导入方法依赖的package包/类
private void fillEdgesUpward(MultiTreeSPEntry currEdge, PriorityQueue<MultiTreeSPEntry> prioQueue,
IntObjectMap<MultiTreeSPEntry> shortestWeightMap, EdgeExplorer explorer) {
EdgeIterator iter = explorer.setBaseNode(currEdge.adjNode);
if (iter == null) // we reach one of the target nodes
return;
_upwardEdgeFilter.setBaseNode(currEdge.adjNode);
while (iter.next()) {
if (!_upwardEdgeFilter.accept(iter))
continue;
_upwardEdgeFilter.updateHighestNode(iter);
_edgeWeight = _weighting.calcWeight(iter, false, 0);
if (!Double.isInfinite(_edgeWeight)) {
MultiTreeSPEntry ee = shortestWeightMap.get(iter.getAdjNode());
if (ee == null) {
ee = new MultiTreeSPEntry(iter.getAdjNode(), iter.getEdge(), _edgeWeight, true, currEdge, currEdge.getSize());
shortestWeightMap.put(iter.getAdjNode(), ee);
prioQueue.add(ee);
} else {
_addToQueue = false;
for (int i = 0; i < _treeEntrySize; ++i) {
_msptItem = currEdge.getItem(i);
_entryWeight = _msptItem.weight;
if (_entryWeight == 0.0)
continue;
_msptSubItem = ee.getItem(i);
if (_msptItem.update == false) {
// upwardItersSkipped++;
continue;
}
_tmpWeight = _edgeWeight + _entryWeight;
if (_msptSubItem.weight > _tmpWeight || _msptSubItem.weight == 0.0) {
_msptSubItem.weight = _tmpWeight;
_msptSubItem.edge = iter.getEdge();
_msptSubItem.parent = currEdge;
_msptSubItem.update = true;
_addToQueue = true;
// upwardIters++;
} //else
// upwardItersTotal++;
}
if (_addToQueue) {
ee.updateWeights();
prioQueue.remove(ee);
prioQueue.add(ee);
}
}
}
}
currEdge.resetUpdate(false);
}
示例3: fillEdgesDownward
import com.carrotsearch.hppc.IntObjectMap; //导入方法依赖的package包/类
private void fillEdgesDownward(MultiTreeSPEntry currEdge, PriorityQueue<MultiTreeSPEntry> prioQueue,
IntObjectMap<MultiTreeSPEntry> shortestWeightMap, EdgeExplorer explorer) {
EdgeIterator iter = explorer.setBaseNode(currEdge.adjNode);
if (iter == null)
return;
while (iter.next()) {
_edgeWeight = _weighting.calcWeight(iter, false, 0);
if (!Double.isInfinite(_edgeWeight)) {
MultiTreeSPEntry ee = shortestWeightMap.get(iter.getAdjNode());
if (ee == null) {
ee = new MultiTreeSPEntry(iter.getAdjNode(), iter.getEdge(), _edgeWeight, true, currEdge, currEdge.getSize());
ee.visited = true;
shortestWeightMap.put(iter.getAdjNode(), ee);
prioQueue.add(ee);
} else {
_addToQueue = false;
for (int i = 0; i < _treeEntrySize; ++i) {
_msptItem = currEdge.getItem(i);
_entryWeight = _msptItem.weight;
if (_entryWeight == 0.0)
continue;
if (_msptItem.update == false) {
// downwardItersSkipped++;
continue;
}
_tmpWeight = _edgeWeight + _entryWeight;
MultiTreeSPEntryItem eeItem = ee.getItem(i);
if (eeItem.weight > _tmpWeight || eeItem.weight == 0.0) {
eeItem.weight = _tmpWeight;
eeItem.edge = iter.getEdge();
eeItem.parent = currEdge;
eeItem.update = true;
_addToQueue = true;
// downwardIters++;
} //else
// downwardItersTotal++;
}
ee.updateWeights();
if (ee.visited == false) {
// // This is the case if the node has been assigned a
// weight in
// // the upwards pass (fillEdges). We need to use it in
// the
// // downwards pass to access lower level nodes, though
// the
// weight
// // does not have to be reset necessarily //
ee.visited = true;
ee.resetUpdate(true);
prioQueue.add(ee);
} else if (_addToQueue) {
ee.visited = true;
prioQueue.remove(ee);
prioQueue.add(ee);
}
}
}
}
currEdge.resetUpdate(false);
}