public boolean retainEntries( TIntIntProcedure procedure ) { synchronized( mutex ) { return m.retainEntries( procedure ); } } public boolean increment( int key ) {
@Override public boolean retainEntries( TIntIntProcedure procedure ) { synchronized( mutex ) { return m.retainEntries( procedure ); } } @Override
public boolean retainEntries( TIntIntProcedure procedure ) { synchronized( mutex ) { return m.retainEntries( procedure ); } } public boolean increment( int key ) {
public boolean retainEntries( TIntIntProcedure procedure ) { synchronized( mutex ) { return m.retainEntries( procedure ); } } public boolean increment( int key ) {
public boolean retainEntries( TIntIntProcedure procedure ) { synchronized( mutex ) { return m.retainEntries( procedure ); } } public boolean increment( int key ) {
/** * Filter down a map from target stop indexes to distances so it only includes those stops that are the * closest on some pattern. This is technically incorrect (think of transfers to a U shaped metro from a bus line * running across the legs of the U, a situation which actually exists in Washington, DC with the * red line and the Q4) but anecdotally it speeds up computation by up to 40 percent. We may want to look into * other ways to optimize transfers (or why the transfers are making routing so much slower) if this turns out to * affect results. */ private void retainClosestStopsOnPatterns(TIntIntMap timesToReachedStops) { TIntIntMap bestStopOnPattern = new TIntIntHashMap(50, 0.5f, -1, -1); // For every reached stop, timesToReachedStops.forEachEntry((stopIndex, distanceToStop) -> { // For every pattern passing through that stop, transitLayer.patternsForStop.get(stopIndex).forEach(patternIndex -> { int currentBestStop = bestStopOnPattern.get(patternIndex); // Record this stop if it's the closest one yet seen on that pattern. if (currentBestStop == -1) { bestStopOnPattern.put(patternIndex, stopIndex); } else { int currentBestTime = timesToReachedStops.get(currentBestStop); if (currentBestTime > distanceToStop) { bestStopOnPattern.put(patternIndex, stopIndex); } } return true; // iteration should continue }); return true; // iteration should continue }); timesToReachedStops.retainEntries((stop, distance) -> bestStopOnPattern.containsValue(stop)); }
/** * Filter down a map from target stop indexes to distances so it only includes those stops that are the * closest on some pattern. This is technically incorrect (think of transfers to a U shaped metro from a bus line * running across the legs of the U, a situation which actually exists in Washington, DC with the * red line and the Q4) but anecdotally it speeds up computation by up to 40 percent. We may want to look into * other ways to optimize transfers (or why the transfers are making routing so much slower) if this turns out to * affect results. */ private void retainClosestStopsOnPatterns(TIntIntMap timesToReachedStops) { TIntIntMap bestStopOnPattern = new TIntIntHashMap(50, 0.5f, -1, -1); // For every reached stop, timesToReachedStops.forEachEntry((stopIndex, distanceToStop) -> { // For every pattern passing through that stop, transitLayer.patternsForStop.get(stopIndex).forEach(patternIndex -> { int currentBestStop = bestStopOnPattern.get(patternIndex); // Record this stop if it's the closest one yet seen on that pattern. if (currentBestStop == -1) { bestStopOnPattern.put(patternIndex, stopIndex); } else { int currentBestTime = timesToReachedStops.get(currentBestStop); if (currentBestTime > distanceToStop) { bestStopOnPattern.put(patternIndex, stopIndex); } } return true; // iteration should continue }); return true; // iteration should continue }); timesToReachedStops.retainEntries((stop, distance) -> bestStopOnPattern.containsValue(stop)); }
fraud.retainEntries(new TIntIntProcedure() { @Override public boolean execute(int a, int b) {