Java 类gnu.trove.map.TLongObjectMap 实例源码

项目:ProjectAres    文件:FallingBlocksMatchModule.java   
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);
        }
    }
}
项目:graphium    文件:RenderingCalculatorImpl.java   
@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);
}
项目:graphium    文件:RenderingCalculatorImpl.java   
private void calculateRendering(IAzimuth currentAzimuth,
                                List<IAzimuth> azimuthsToInvestigate,
                                TLongObjectMap<IRenderingSegment> renderingResult) {
    IRenderingSegment rendering = renderingResult.get(currentAzimuth.getSegmentFrom().getId());
    if (rendering == null) {
        rendering = new RenderingSegmentImpl();
    }
    rendering.setId(currentAzimuth.getSegmentFrom().getId());
    boolean connectedOnStartNode = currentAzimuth.getSegmentFrom().getFromNodeId() == currentAzimuth.getNodeId();
    //Only consider azimuths from same origin
    for (IAzimuth azimuthToInvestigate : azimuthsToInvestigate) {
        if (currentAzimuth.getSegmentFrom().getId() == azimuthToInvestigate.getSegmentFrom().getId()
                && currentAzimuth.getSegmentFrom().getFuncRoadClassValue() >= azimuthToInvestigate.getSegmentTo().getFuncRoadClassValue()
                && azimuthToInvestigate.getSegmentTo().getFuncRoadClassValue() != 0) {
            if (connectedOnStartNode) {
                rendering.addStartCut(azimuthToInvestigate.getReduceFactor() * -1);
            } else {
                rendering.addEndCut(azimuthToInvestigate.getReduceFactor());
            }
        }
    }
    renderingResult.put(currentAzimuth.getSegmentFrom().getId(), rendering);
}
项目:JDA    文件:GuildImpl.java   
@Override
public AudioManager getAudioManager()
{
    if (!api.isAudioEnabled())
        throw new IllegalStateException("Audio is disabled. Cannot retrieve an AudioManager while audio is disabled.");

    final TLongObjectMap<AudioManager> managerMap = api.getAudioManagerMap();
    AudioManager mng = managerMap.get(id);
    if (mng == null)
    {
        // No previous manager found -> create one
        synchronized (managerMap)
        {
            mng = managerMap.get(id);
            if (mng == null)
            {
                mng = new AudioManagerImpl(this);
                managerMap.put(id, mng);
            }
        }
    }
    return mng;
}
项目:papaya    文件:AsyncContext.java   
@Override public boolean compareAndSet(T expect, T update) {
  TLongObjectMap<Object> values = CURRENT_VALUES.get();
  boolean matched;
  if (values != null) {
    Object actual = values.get(key);
    matched = Objects.equal(expect, actual);
    if (matched) {
      if (update != null) {
        values.put(key, update);
      } else {
        values.remove(key);
      }
    }
  } else {
    matched = expect == null;
    if (matched) {
      if (update != null) {
        initialize(update);
      }
    }
  }
  return matched;
}
项目:ProjectAres    文件:FallingBlocksMatchModule.java   
/**
 * 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());
    }
}
项目:xcc    文件:TLongObjectHashMap.java   
/** {@inheritDoc} */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongObjectMap ) ) {
        return false;
    }
    TLongObjectMap that = ( TLongObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TLongObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            long key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:xcc    文件:TLongObjectMapDecorator.java   
public void readExternal( ObjectInput in )
    throws IOException, ClassNotFoundException {

    // VERSION
    in.readByte();

    // MAP
    //noinspection unchecked
    _map = ( TLongObjectMap<V> ) in.readObject();
}
项目:graphium    文件:RenderingCalculatorImpl.java   
private TLongObjectMap<IPixelCut> adaptPixelCuts(TLongObjectMap<IPixelCut> pixelCuts, TLongObjectMap<IRenderingSegment> renderingResults) {
    for (Long key : renderingResults.keys()) {
        IRenderingSegment seg = renderingResults.get(key);
        pixelCuts.put(key, new PixelCut(seg.getId(), null, seg.getStartCutRight(), seg.getStartCutLeft(), seg.getEndCutRight(), seg.getEndCutLeft()));
    }
    return pixelCuts;
}
项目:graphium    文件:RenderingCalculatorImpl.java   
private void investigateNode(long nodeId, TLongObjectMap<IRenderingSegment> renderingResult,
        ISegment... connectedSegments) {
    List<IAzimuth> azimuthList = new ArrayList<>();
    for (ISegment segmentFrom : connectedSegments) {
        for (ISegment segmentTo : connectedSegments) {
            if (segmentFrom != null && segmentTo != null &&
                    (segmentFrom.getId() != segmentTo.getId())) {
                azimuthList.add(calculateAzimuth(nodeId, segmentFrom,segmentTo));
            }
        }
    }
    calculateRendering(azimuthList, renderingResult);
}
项目:graphium    文件:AsyncGipLinkParser.java   
public AsyncGipLinkParser(String line,
                          IGipModelFactory gipModelFactory,
                          TLongObjectMap<IGipNode> nodes,
                          Set<Integer> functionalRoadClasses,
                          Set<Access> accessTypes,
                          TObjectIntMap<String> atrPos) {
    this.line = line;
    this.modelFactory = gipModelFactory;
    this.nodes = nodes;
    this.functionalRoadClasses = functionalRoadClasses;
    this.accessTypes = accessTypes;
    this.atrPos = atrPos;
}
项目:graphium    文件:GipLinkSectionParser.java   
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;
}
项目:graphium    文件:GipParserImpl.java   
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;
}
项目:graphium    文件:GipParserImpl.java   
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;
}
项目:graphium    文件:GipParserImpl.java   
protected void doUpdateConnections(IWaySegment current,
                                   TLongObjectMap<List<IGipTurnEdge>> turnEdges) {
    Set<IWaySegmentConnection> startNodeCons = new HashSet<>();
    Set<IWaySegmentConnection> endNodeCons = new HashSet<>();

    if (turnEdges.containsKey(current.getWayId())) {
        for (IGipTurnEdge turnEdge : turnEdges.get(current.getWayId())) {
            if (turnEdge.getViaNodeId() == current.getStartNodeId()) {
                startNodeCons.add(new WaySegmentConnection(turnEdge.getViaNodeId(), turnEdge.getFromLinkId(),
                        turnEdge.getToLinkId(), ParserHelper.adaptAccess(turnEdge.getVehicleType())));

            } else if (turnEdge.getViaNodeId() == current.getEndNodeId()) {
                endNodeCons.add(new WaySegmentConnection(turnEdge.getViaNodeId(), turnEdge.getFromLinkId(),
                        turnEdge.getToLinkId(), ParserHelper.adaptAccess(turnEdge.getVehicleType())));

            } else {
                log.error("ViaNode of TurnEdge is wheter start node nor end node!");
            }
        }
    }

    if (!startNodeCons.isEmpty()) {
        current.setStartNodeCons(new ArrayList<>(startNodeCons));
    }
    if (!endNodeCons.isEmpty()) {
        current.setEndNodeCons(new ArrayList<>(endNodeCons));
    }

}
项目:graphium    文件:GipLinkTurnEdgesParser.java   
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<>();
}
项目:graphium    文件:GipLinkCoordinatesParser.java   
public GipLinkCoordinatesParser(IGipParser parserReference,
                                IGipSectionParser<TLongObjectMap<IGipLink>> linkParser) {
    super(parserReference);
    this.linkParser = linkParser;
    this.linksToEnqueue = new TSynchronizedLongSet(new TLongHashSet());
    this.executor = Executors.newFixedThreadPool(30);
}
项目:graphium    文件:GipLinkCoordinatesParser.java   
private CompletableFuture buildLinkAsync(final long currentLinkId,
                                         final Set<GipComparableLinkCoordinate> linkCoords,
                                         final TLongObjectMap<IGipLink> links,
                                         final TLongSet linksToEnqueue) {
    int[] linkCoordsX = new int[linkCoords.size() + 2];
    int[] linkCoordsY = new int[linkCoords.size() + 2];
    int i = 1;
    for (GipComparableLinkCoordinate linkCoordinate : linkCoords) {
        linkCoordsX[i] = linkCoordinate.getX();
        linkCoordsY[i] = linkCoordinate.getY();
        i++;
    }
    return CompletableFuture.supplyAsync(new AsyncGipLinkBuilder(
            links.get(currentLinkId),
            linkCoordsX, linkCoordsY), executor).thenAcceptAsync(gipLink -> {
        try {
            if (gipLink != null) {
                links.put(currentLinkId, gipLink);
                if (gipLink.isValid()) {
                    linksToEnqueue.add(currentLinkId);
                }
            }
        } catch (Exception e) {
            log.error("Async Error ", e);
        }
    });
}
项目:discord-bot-gateway    文件:ConversionUtils.java   
public static JSONArray arrayOf(TLongObjectMap<? extends CachedEntity> map) {
    JSONArray array = new JSONArray();
    map.forEachValue(v->{
        array.put(v.toJSON(0));
        return true;
    });
    return array;
}
项目:discord-bot-gateway    文件:ConversionUtils.java   
public static JSONArray arrayOf(long id, TLongObjectMap<? extends CachedEntity> map) {
    JSONArray array = new JSONArray();
    map.forEachValue(v->{
        array.put(v.toJSON(id));
        return true;
    });
    return array;
}
项目:HCFCore    文件:TLongObjectHashMap.java   
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongObjectMap ) ) {
        return false;
    }
    TLongObjectMap that = ( TLongObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TLongObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            long key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:HCFCore    文件:TLongObjectMapDecorator.java   
public void readExternal( ObjectInput in )
    throws IOException, ClassNotFoundException {

    // VERSION
    in.readByte();

    // MAP
    //noinspection unchecked
    _map = ( TLongObjectMap<V> ) in.readObject();
}
项目:HCFCore    文件:TLongObjectHashMap.java   
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongObjectMap ) ) {
        return false;
    }
    TLongObjectMap that = ( TLongObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TLongObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            long key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:HCFCore    文件:TLongObjectMapDecorator.java   
public void readExternal( ObjectInput in )
    throws IOException, ClassNotFoundException {

    // VERSION
    in.readByte();

    // MAP
    //noinspection unchecked
    _map = ( TLongObjectMap<V> ) in.readObject();
}
项目:Long-Map-Benchmarks    文件:MapTests.java   
private void troveMapGet(Context context, TLongObjectMap map) { //Populates a map, makes 50% successful and 50% unsuccessful get() calls
    //Populate the map
    for (int i = 0; i < context.testValues.length; i++)
        map.put(context.testKeys[i], context.testValues[i]);

    for (int i = 0; i < context.testValues.length/2; i++) {
        map.get(context.testKeys[context.random.nextInt(context.testKeys.length)]); //Successful call
        map.get(Integer.MIN_VALUE+context.random.nextInt(Integer.MAX_VALUE)-1); //Unsuccessful call
    }
}
项目:Long-Map-Benchmarks    文件:MapTests.java   
private void troveMapPutUpdate(Context context, TLongObjectMap map) { //Populates a map, then repopulates it
    //Populate the map the first time
    for (int i = 0; i < context.testValues.length; i++)
        map.put(context.testKeys[i], context.testValues[i]);

    //Update every map pair
    for (int i = 0; i < context.testValues.length; i++) {
        map.put(context.testKeys[i], context.testValues2[i]);
    }
}
项目:Long-Map-Benchmarks    文件:MapTests.java   
private void troveMapPutRemove(Context context, TLongObjectMap map) { //Populates a map, then manually clears the contents of it
    //Populate the map the first time
    for (int i = 0; i < context.testValues.length; i++)
        map.put(context.testKeys[i], context.testValues[i]);

    //Remove every map pair
    for (int i = 0; i < context.testValues.length; i++) {
        map.remove(context.testKeys[i]);
    }
}
项目:financisto1-holo    文件:LatestExchangeRates.java   
@Override
public ExchangeRate getRate(Currency fromCurrency, Currency toCurrency) {
    if (fromCurrency.id == toCurrency.id) {
        return ExchangeRate.ONE;
    }
    TLongObjectMap<ExchangeRate> rateMap = getMapFor(fromCurrency.id);
    ExchangeRate rate = rateMap.get(toCurrency.id);
    if (rate == null) {
        rate = ExchangeRate.NA;
        rateMap.put(toCurrency.id, rate);
    }
    return rate;
}
项目:financisto1-holo    文件:LatestExchangeRates.java   
private TLongObjectMap<ExchangeRate> getMapFor(long fromCurrencyId) {
    TLongObjectMap<ExchangeRate> m = rates.get(fromCurrencyId);
    if (m == null) {
        m = new TLongObjectHashMap<ExchangeRate>();
        rates.put(fromCurrencyId, m);
    }
    return m;
}
项目:financisto1-holo    文件:HistoryExchangeRates.java   
private TLongObjectMap<SortedSet<ExchangeRate>> getMapFor(long fromCurrencyId) {
    TLongObjectMap<SortedSet<ExchangeRate>> m = rates.get(fromCurrencyId);
    if (m == null) {
        m = new TLongObjectHashMap<SortedSet<ExchangeRate>>();
        rates.put(fromCurrencyId, m);
    }
    return m;
}
项目:financisto1-holo    文件:HistoryExchangeRates.java   
private SortedSet<ExchangeRate> getSetFor(TLongObjectMap<SortedSet<ExchangeRate>> rates, long date) {
    SortedSet<ExchangeRate> s = rates.get(date);
    if (s == null) {
        s = new TreeSet<ExchangeRate>();
        rates.put(date, s);
    }
    return s;
}
项目:GabrielBot    文件:GabrielBot.java   
public TLongObjectMap<GuildMusicPlayer> getPlayers() {
    TLongObjectMap<GuildMusicPlayer> map = new TLongObjectHashMap<>();
    for(Shard s : shards) {
        map.putAll(s.players());
    }
    return map;
}
项目:trove-3.0.3    文件:TLongObjectHashMap.java   
/** {@inheritDoc} */
@Override
@SuppressWarnings("rawtypes")
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongObjectMap ) ) {
        return false;
    }
    TLongObjectMap that = ( TLongObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TLongObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            long key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:trove-3.0.3    文件:TLongObjectMapDecorator.java   
@Override
@SuppressWarnings("unchecked")
public void readExternal( ObjectInput in )
    throws IOException, ClassNotFoundException {

    // VERSION
    in.readByte();

    // MAP
    //noinspection unchecked
    _map = ( TLongObjectMap<V> ) in.readObject();
}
项目:easyrec_major    文件:TLongObjectHashMap.java   
/** {@inheritDoc} */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongObjectMap ) ) {
        return false;
    }
    TLongObjectMap that = ( TLongObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TLongObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            long key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:easyrec_major    文件:TLongObjectMapDecorator.java   
public void readExternal( ObjectInput in )
    throws IOException, ClassNotFoundException {

    // VERSION
    in.readByte();

    // MAP
    //noinspection unchecked
    _map = ( TLongObjectMap<V> ) in.readObject();
}
项目:recalot.com    文件:TLongObjectHashMap.java   
/** {@inheritDoc} */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongObjectMap ) ) {
        return false;
    }
    TLongObjectMap that = ( TLongObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TLongObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            long key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:recalot.com    文件:TLongObjectMapDecorator.java   
public void readExternal( ObjectInput in )
    throws IOException, ClassNotFoundException {

    // VERSION
    in.readByte();

    // MAP
    //noinspection unchecked
    _map = ( TLongObjectMap<V> ) in.readObject();
}
项目:flowzr-android-black    文件:LatestExchangeRates.java   
@Override
public ExchangeRate getRate(Currency fromCurrency, Currency toCurrency) {
    if (fromCurrency.id == toCurrency.id) {
        return ExchangeRate.ONE;
    }
    TLongObjectMap<ExchangeRate> rateMap = getMapFor(fromCurrency.id);
    ExchangeRate rate = rateMap.get(toCurrency.id);
    if (rate == null) {
        rate = ExchangeRate.NA;
        rateMap.put(toCurrency.id, rate);
    }
    return rate;
}
项目:flowzr-android-black    文件:LatestExchangeRates.java   
private TLongObjectMap<ExchangeRate> getMapFor(long fromCurrencyId) {
    TLongObjectMap<ExchangeRate> m = rates.get(fromCurrencyId);
    if (m == null) {
        m = new TLongObjectHashMap<>();
        rates.put(fromCurrencyId, m);
    }
    return m;
}