當前位置: 首頁>>代碼示例>>Java>>正文


Java TLongObjectHashMap類代碼示例

本文整理匯總了Java中gnu.trove.map.hash.TLongObjectHashMap的典型用法代碼示例。如果您正苦於以下問題:Java TLongObjectHashMap類的具體用法?Java TLongObjectHashMap怎麽用?Java TLongObjectHashMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TLongObjectHashMap類屬於gnu.trove.map.hash包,在下文中一共展示了TLongObjectHashMap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的gnu.trove.map.hash.TLongObjectHashMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。