本文整理汇总了Java中gnu.trove.map.hash.TLongObjectHashMap类的典型用法代码示例。如果您正苦于以下问题:Java TLongObjectHashMap类的具体用法?Java TLongObjectHashMap怎么用?Java TLongObjectHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TLongObjectHashMap类属于gnu.trove.map.hash包,在下文中一共展示了TLongObjectHashMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: disturb
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
private void disturb(long pos, BlockState blockState, @Nullable ParticipantState disturber) {
FallingBlocksRule rule = this.ruleWithShortestDelay(blockState);
if(rule != null) {
long tick = this.getMatch().getClock().now().tick + rule.delay;
TLongObjectMap<ParticipantState> blockDisturbers = this.blockDisturbersByTick.get(tick);
if(blockDisturbers == null) {
blockDisturbers = new TLongObjectHashMap<>();
this.blockDisturbersByTick.put(tick, blockDisturbers);
}
Block block = blockState.getBlock();
if(!blockDisturbers.containsKey(pos)) {
blockDisturbers.put(pos, disturber);
}
}
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:18,代码来源:FallingBlocksMatchModule.java
示例2: calculateAllReduceFactors
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
@Override
public void calculateAllReduceFactors(final TLongObjectMap<TLongArrayList> nodeSegmentTable,
final TLongObjectMap<ISegment> segmentsTable,
final TLongSet relevantLinks,
TLongObjectMap<IPixelCut> pixelCuts) {
TLongObjectMap<IRenderingSegment> renderingResults = new TLongObjectHashMap<>();
nodeSegmentTable.forEachEntry((nodeId, segmentIds) -> {
if (segmentIds.size() > 1) {
ISegment[] segments = new ISegment[segmentIds.size()];
for (int i = 0; i < segmentIds.size(); i++) {
segments[i] = segmentsTable.get(segmentIds.get(i));
}
investigateNode(nodeId, renderingResults, segments);
}
return true;
});
adaptPixelCuts(pixelCuts, renderingResults);
}
开发者ID:graphium-project,项目名称:graphium,代码行数:19,代码来源:RenderingCalculatorImpl.java
示例3: WaySink
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
public WaySink(TLongObjectHashMap<List<WayRef>> wayRefs, TLongObjectHashMap<NodeCoord> nodes,
TLongObjectHashMap<List<IWaySegment>> segmentedWaySegments, TLongObjectHashMap<List<Relation>> wayRelations,
BlockingQueue<IWaySegment> waysQueue) {
this.wayRefs = wayRefs;
this.nodes = nodes;
this.wayRelations = wayRelations;
this.segmentedWaySegments = segmentedWaySegments;
for (long nodeId : wayRefs.keys()) {
List<WayRef> wayRefList = wayRefs.get(nodeId);
for (WayRef wayRef : wayRefList) {
if (wayRef.getType() == 2) {
if (waysToSegment.get(wayRef.getWayId()) == null) {
waysToSegment.put(wayRef.getWayId(), new TLongArrayList(new long[] {nodeId}));
} else {
waysToSegment.get(wayRef.getWayId()).add(nodeId);
}
}
}
}
this.waysQueue = waysQueue;
this.connectionsBuilder = new ConnectionsBuilder();
}
开发者ID:graphium-project,项目名称:graphium,代码行数:24,代码来源:WaySink.java
示例4: SegmentationWaySink
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
public SegmentationWaySink(TLongObjectHashMap<List<WayRef>> wayRefs, TLongObjectHashMap<List<Relation>> wayRelations,
BlockingQueue<IWaySegment> waysQueue) {
this.wayRefs = wayRefs;
this.wayRelations = wayRelations;
for (long nodeId : wayRefs.keys()) {
List<WayRef> wayRefList = wayRefs.get(nodeId);
for (WayRef wayRef : wayRefList) {
if (wayRef.getType() == 2) {
if (waysToSegment.get(wayRef.getWayId()) == null) {
waysToSegment.put(wayRef.getWayId(), new TLongArrayList(new long[] {nodeId}));
} else {
waysToSegment.get(wayRef.getWayId()).add(nodeId);
}
}
}
}
this.waysQueue = waysQueue;
connectionsBuilder = new ConnectionsBuilder();
}
开发者ID:graphium-project,项目名称:graphium,代码行数:21,代码来源:SegmentationWaySink.java
示例5: update
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
@Override
public void update(JSONObject json) {
position = json.optInt("position");
if(overwrites == null) overwrites = new TLongObjectHashMap<>();
TLongSet toRemove = new TLongHashSet(overwrites.keys());
JSONArray array = json.getJSONArray("permission_overwrites");
for(int i = 0, j = array.length(); i < j; i++) {
JSONObject overwrite = array.getJSONObject(i);
long id = overwrite.getLong("id");
toRemove.remove(id);
overwrites.put(id, new CachedOverwrite(overwrite));
}
for(TLongIterator it = toRemove.iterator(); it.hasNext();) {
overwrites.remove(it.next());
}
name = json.optString("name");
topic = json.optString("topic");
nsfw = json.optBoolean("nsfw");
lastMessageId = json.optLong("last_message_id");
bitrate = json.optInt("bitrate");
userLimit = json.optInt("user_limit");
parentId = json.optLong("parent_id");
}
开发者ID:natanbc,项目名称:discord-bot-gateway,代码行数:24,代码来源:CachedChannel.java
示例6: recombinedRawQuads
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
/**
* Returns all quads in this tree recombined as much as possible.
* Use instead of allRawQuads() for anything to be rendered.
* Generally only useful on job node!
*
* Will only work if build was called with initCSG parameter = true
* during initialization of the tree because it uses the information populated then.
* @return
*/
public List<RawQuad> recombinedRawQuads()
{
TLongObjectHashMap<ArrayList<RawQuad>> ancestorBuckets = new TLongObjectHashMap<ArrayList<RawQuad>>();
this.allRawQuads().forEach((quad) ->
{
if(!ancestorBuckets.contains(quad.ancestorQuadID))
{
ancestorBuckets.put(quad.ancestorQuadID, new ArrayList<RawQuad>());
}
ancestorBuckets.get(quad.ancestorQuadID).add(quad);
});
ArrayList<RawQuad> retVal = new ArrayList<RawQuad>();
ancestorBuckets.valueCollection().forEach((quadList) ->
{
retVal.addAll(recombine(quadList));
});
return retVal;
}
开发者ID:grondag,项目名称:Hard-Science,代码行数:31,代码来源:CSGNode.java
示例7: loadLong2TXTGZMap
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
public static TLongObjectHashMap loadLong2TXTGZMap(String mapFile, boolean reverse) throws IOException {
long time = System.currentTimeMillis();
TLongObjectHashMap idMap = new TLongObjectHashMap();
BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(mapFile))));
String line;
String[] parts;
while ((line = br.readLine()) != null) {
parts = line.split(SEP);
if (!reverse) {
idMap.put(Long.parseLong(parts[0]), parts[1]);
} else {
idMap.put(Long.parseLong(parts[1]), parts[0]);
}
}
logger.info(((System.currentTimeMillis() - time) / 1000d) + "s");
return idMap;
}
开发者ID:giovanni-stilo,项目名称:G,代码行数:20,代码来源:TxtGraphUtils.java
示例8: HDTileBasedDataProcessor
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
private HDTileBasedDataProcessor(MapWriterConfiguration configuration) {
super(configuration);
this.indexedNodeStore = new IndexedObjectStore<Node>(new SingleClassObjectSerializationFactory(Node.class),
"idxNodes");
this.indexedWayStore = new IndexedObjectStore<Way>(new SingleClassObjectSerializationFactory(Way.class),
"idxWays");
// indexedRelationStore = new IndexedObjectStore<Relation>(
// new SingleClassObjectSerializationFactory(
// Relation.class), "idxWays");
this.wayStore = new SimpleObjectStore<Way>(new SingleClassObjectSerializationFactory(Way.class), "heapWays",
true);
this.relationStore = new SimpleObjectStore<Relation>(new SingleClassObjectSerializationFactory(Relation.class),
"heapRelations", true);
this.tileData = new HDTileData[this.zoomIntervalConfiguration.getNumberOfZoomIntervals()][][];
for (int i = 0; i < this.zoomIntervalConfiguration.getNumberOfZoomIntervals(); i++) {
this.tileData[i] = new HDTileData[this.tileGridLayouts[i].getAmountTilesHorizontal()][this.tileGridLayouts[i]
.getAmountTilesVertical()];
}
this.virtualWays = new TLongObjectHashMap<TDWay>();
this.additionalRelationTags = new TLongObjectHashMap<List<TDRelation>>();
}
开发者ID:DonTomika,项目名称:mapsforge,代码行数:23,代码来源:HDTileBasedDataProcessor.java
示例9: load
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
/**
*
* @see org.jmangos.commons.dataholder.DataLoadService#load()
*/
@Override
public TLongObjectHashMap<ItemPrototype> load() {
Long eTime = System.currentTimeMillis();
final TLongObjectHashMap<ItemPrototype> map = new TLongObjectHashMap<ItemPrototype>();
final List<ItemPrototype> itemPrototypeList =
this.itemPrototypeService.readItemPrototypes();
// Fill map
for (final ItemPrototype item : itemPrototypeList) {
map.put(item.getEntry(), item);
}
eTime = System.currentTimeMillis() - eTime;
ItemStorages.logger.info(String.format("Loaded [%d] ItemPrototypes under %d ms",
map.size(), eTime));
this.itemPrototypes = map;
return this.itemPrototypes;
}
开发者ID:JMaNGOS,项目名称:JMaNGOS,代码行数:26,代码来源:ItemStorages.java
示例10: fallCheck
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
/**
* Make any unsupported blocks fall that are disturbed for the current tick
*/
private void fallCheck() {
this.visitsWorstTick = Math.max(this.visitsWorstTick, this.visitsThisTick);
this.visitsThisTick = 0;
World world = this.getMatch().getWorld();
TLongObjectMap<ParticipantState> blockDisturbers = this.blockDisturbersByTick.remove(this.getMatch().getClock().now().tick);
if(blockDisturbers == null) return;
TLongSet supported = new TLongHashSet();
TLongSet unsupported = new TLongHashSet();
TLongObjectMap<ParticipantState> fallsByBreaker = new TLongObjectHashMap<>();
try {
while(!blockDisturbers.isEmpty()) {
long pos = blockDisturbers.keySet().iterator().next();
ParticipantState breaker = blockDisturbers.remove(pos);
// Search down for the first block that can actually fall
for(;;) {
long below = neighborPos(pos, BlockFace.DOWN);
if(!Materials.isColliding(blockAt(world, below).getType())) break;
blockDisturbers.remove(pos); // Remove all the blocks we find along the way
pos = below;
}
// Check if the block needs to fall, if it isn't already falling
if(!fallsByBreaker.containsKey(pos) && !this.isSupported(pos, supported, unsupported)) {
fallsByBreaker.put(pos, breaker);
}
}
} catch(MaxSearchVisitsExceeded ex) {
this.logError(ex);
}
for(TLongObjectIterator<ParticipantState> iter = fallsByBreaker.iterator(); iter.hasNext();) {
iter.advance();
this.fall(iter.key(), iter.value());
}
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:43,代码来源:FallingBlocksMatchModule.java
示例11: RelationSink
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
public RelationSink(TLongObjectHashMap<List<WayRef>> wayRefs) {
for (List<WayRef> wayRefList : wayRefs.valueCollection()) {
for (WayRef wayRef : wayRefList) {
wayIds.add(wayRef.getWayId());
}
}
}
开发者ID:graphium-project,项目名称:graphium,代码行数:8,代码来源:RelationSink.java
示例12: GipLinkSectionParser
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
public GipLinkSectionParser(IGipParser parserReference,
IGipSectionParser<TLongObjectMap<IGipNode>> nodeParser,
IImportConfig config,
ImportStatistics statistics) {
super(parserReference);
this.links = new TSynchronizedLongObjectMap<>(new TLongObjectHashMap<>());
this.nodeParser = nodeParser;
this.functionalRoadClasses = config.getFrcList();
this.accessTypes = config.getAccessTypes();
this.executor = Executors.newFixedThreadPool(15);
this.statistics = statistics;
}
开发者ID:graphium-project,项目名称:graphium,代码行数:13,代码来源:GipLinkSectionParser.java
示例13: calculatePixelCutOffset
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
private TLongObjectMap<IPixelCut> calculatePixelCutOffset(IImportConfig config,
TLongSet linkIdsEnqueued,
TLongObjectMap<IGipLink> links){
log.info("phase pixel cut calculation ....");
TLongObjectMap<IPixelCut> renderingResultPerSegment = new TLongObjectHashMap<>();
final TLongObjectHashMap<TLongArrayList> nodeLinksConnectionTable = new TLongObjectHashMap<>();
log.info("Link Ids Queued size: " + linkIdsEnqueued.size());
GipLinkFilter filter = new GipLinkFilter(config.getMaxFrc(),config.getMinFrc(),config.getIncludedGipIds(),
config.getExcludedGipIds(),config.isEnableSmallConnections());
TLongSet filteredLinks = filter.filter(links);
linkIdsEnqueued.forEach(value -> {
//enqued Gip Links that after they have been filtered.
if (filteredLinks.contains(value)) {
IGipLink link = links.get(value);
if (link != null) {
if (link.getFromNodeId() != 0) {
if (!nodeLinksConnectionTable.containsKey(link.getFromNodeId())) {
nodeLinksConnectionTable.put(link.getFromNodeId(), new TLongArrayList());
}
nodeLinksConnectionTable.get(link.getFromNodeId()).add(link.getId());
}
if (link.getToNodeId() != 0) {
if (!nodeLinksConnectionTable.containsKey(link.getToNodeId())) {
nodeLinksConnectionTable.put(link.getToNodeId(), new TLongArrayList());
}
nodeLinksConnectionTable.get(link.getToNodeId()).add(link.getId());
}
}
}
return true;
});
log.info("Filtered Links Size " + filteredLinks.size());
renderingResultPerSegment = new TLongObjectHashMap<>();
IRenderingCalculator renderingCalculator = new RenderingCalculatorImpl();
renderingCalculator.calculateAllReduceFactors(nodeLinksConnectionTable, adaptSegments(links), filteredLinks, renderingResultPerSegment);
log.info("Rendering result size " + renderingResultPerSegment.size());
return renderingResultPerSegment;
}
开发者ID:graphium-project,项目名称:graphium,代码行数:40,代码来源:GipParserImpl.java
示例14: adaptSegments
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
private TLongObjectMap<ISegment> adaptSegments(TLongObjectMap<IGipLink> links) {
TLongObjectMap<ISegment> segments = new TLongObjectHashMap<>(links.size());
for (Long id : links.keys()) {
IGipLink link = links.get(id);
segments.put(id, new SegmentImpl(link.getId(), link.getFromNodeId(), link.getToNodeId(), link.getCoordinatesX(), link.getCoordinatesY(), link.getFuncRoadClassValue()));
}
return segments;
}
开发者ID:graphium-project,项目名称:graphium,代码行数:9,代码来源:GipParserImpl.java
示例15: GipLinkTurnEdgesParser
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
public GipLinkTurnEdgesParser(IGipParser parserReference, IImportConfig config,
IGipSectionParser<TLongObjectMap<IGipNode>> nodeParser,
IGipSectionParser<TLongObjectMap<IGipLink>> linkParser,
IGipSectionParser<TLongSet> linkCoordinateParser) {
super(parserReference);
this.config = config;
this.nodeParser = nodeParser;
this.linkParser = linkParser;
this.linkCoordinateParser = linkCoordinateParser;
this.turnEdges = new TLongObjectHashMap<>();
}
开发者ID:graphium-project,项目名称:graphium,代码行数:12,代码来源:GipLinkTurnEdgesParser.java
示例16: manualSnchronizedTLongObjectHashMapGet
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
@Benchmark
public void manualSnchronizedTLongObjectHashMapGet(Context context) {
TLongObjectHashMap<Object> map = new TLongObjectHashMap<>();
synchronized (map) {
troveMapGet(context, map);
}
}
开发者ID:austinv11,项目名称:Long-Map-Benchmarks,代码行数:9,代码来源:MapTests.java
示例17: manualSnchronizedTLongObjectHashMapUpdate
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
@Benchmark
public void manualSnchronizedTLongObjectHashMapUpdate(Context context) {
TLongObjectHashMap<Object> map = new TLongObjectHashMap<>();
synchronized (map) {
troveMapPutUpdate(context, map);
}
}
开发者ID:austinv11,项目名称:Long-Map-Benchmarks,代码行数:9,代码来源:MapTests.java
示例18: manualSnchronizedTLongObjectHashMapPutRemove
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
@Benchmark
public void manualSnchronizedTLongObjectHashMapPutRemove(Context context) {
TLongObjectHashMap<Object> map = new TLongObjectHashMap<>();
synchronized (map) {
troveMapPutRemove(context, map);
}
}
开发者ID:austinv11,项目名称:Long-Map-Benchmarks,代码行数:9,代码来源:MapTests.java
示例19: manualSnchronizedTLongObjectHashMapMapCopy
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
@Benchmark
public TLongObjectHashMap manualSnchronizedTLongObjectHashMapMapCopy(Context context) {
TLongObjectHashMap<Object> map = new TLongObjectHashMap<>();
synchronized (map) {
//Populate the map the first time
for (int i = 0; i < context.testValues.length; i++)
map.put(context.testKeys[i], context.testValues[i]);
//Copy!
TLongObjectHashMap<Object> copy = new TLongObjectHashMap<>(map);
return copy;
}
}
开发者ID:austinv11,项目名称:Long-Map-Benchmarks,代码行数:15,代码来源:MapTests.java
示例20: synchronizedTLongObjectHashMapGet
import gnu.trove.map.hash.TLongObjectHashMap; //导入依赖的package包/类
@Benchmark
public void synchronizedTLongObjectHashMapGet(Context context) {
TSynchronizedLongObjectMap<Object> map = new TSynchronizedLongObjectMap<>(new TLongObjectHashMap<>());
synchronized (map) {
troveMapGet(context, map);
}
}
开发者ID:austinv11,项目名称:Long-Map-Benchmarks,代码行数:9,代码来源:MapTests.java
注:本文中的gnu.trove.map.hash.TLongObjectHashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论