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


Java IntObjectMap.put方法代码示例

本文整理汇总了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;
}
 
开发者ID:keenon,项目名称:loglinear,代码行数:16,代码来源:ConcatVectorNamespaceTest.java

示例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);
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:69,代码来源:RPHASTAlgorithm.java

示例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);
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:77,代码来源:RPHASTAlgorithm.java


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