gnu.trove.map.TIntIntMap.forEachEntry()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中gnu.trove.map.TIntIntMap.forEachEntry()方法的一些代码示例,展示了TIntIntMap.forEachEntry()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TIntIntMap.forEachEntry()方法的具体详情如下:
包路径:gnu.trove.map.TIntIntMap
类名称:TIntIntMap
方法名:forEachEntry

TIntIntMap.forEachEntry介绍

[英]Executes procedure for each key/value entry in the map.
[中]对映射中的每个键/值条目执行过程。

代码示例

代码示例来源:origin: alibaba/mdrill

public boolean forEachEntry( TIntIntProcedure procedure ) {
  return m.forEachEntry( procedure );
}

代码示例来源:origin: alibaba/mdrill

public boolean forEachEntry( TIntIntProcedure procedure ) {
  synchronized( mutex ) { return m.forEachEntry( procedure ); }
}
public void transformValues( TIntFunction function ) {

代码示例来源:origin: net.sf.trove4j/trove4j

public boolean forEachEntry( TIntIntProcedure procedure ) {
  synchronized( mutex ) { return m.forEachEntry( procedure ); }
}
public void transformValues( TIntFunction function ) {

代码示例来源:origin: com.palantir.patches.sourceforge/trove3

@Override
public boolean forEachEntry( TIntIntProcedure procedure ) {
  synchronized( mutex ) { return m.forEachEntry( procedure ); }
}
@Override

代码示例来源:origin: net.sf.trove4j/trove4j

public boolean forEachEntry( TIntIntProcedure procedure ) {
  return m.forEachEntry( procedure );
}

代码示例来源:origin: net.sf.trove4j/core

public boolean forEachEntry( TIntIntProcedure procedure ) {
  synchronized( mutex ) { return m.forEachEntry( procedure ); }
}
public void transformValues( TIntFunction function ) {

代码示例来源:origin: com.palantir.patches.sourceforge/trove3

@Override
public boolean forEachEntry( TIntIntProcedure procedure ) {
  return m.forEachEntry( procedure );
}

代码示例来源:origin: hernad/easyrec

public boolean forEachEntry( TIntIntProcedure procedure ) {
  synchronized( mutex ) { return m.forEachEntry( procedure ); }
}
public void transformValues( TIntFunction function ) {

代码示例来源:origin: net.sf.trove4j/core

public boolean forEachEntry( TIntIntProcedure procedure ) {
  return m.forEachEntry( procedure );
}

代码示例来源:origin: hernad/easyrec

public boolean forEachEntry( TIntIntProcedure procedure ) {
  return m.forEachEntry( procedure );
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

assigned.forEachEntry((i, j) -> {
 String mat = ((IToolPart) toolParts.get(i).getItem()).getMaterial(toolParts.get(i)).getIdentifier();
 materialList.set(j, new NBTTagString(mat));

代码示例来源:origin: zavtech/morpheus-core

@Override
public final Index<Integer> resetOrder() {
  final Array<Integer> keys = keyArray();
  this.indexMap.forEachEntry((key, index) -> {
    keys.setInt(index, key);
    return true;
  });
  return this;
}

代码示例来源:origin: conveyal/r5

/**
 * Set the departure time in the scheduled search to the given departure time,
 * and prepare for the scheduled search at the next-earlier minute
 */
private void advanceScheduledSearchToPreviousMinute (int nextMinuteDepartureTime) {
  for (RaptorState state : this.scheduleState) {
    state.setDepartureTime(nextMinuteDepartureTime);
    // clear all touched stops to avoid constant reëxploration
    state.bestStopsTouched.clear();
    state.nonTransferStopsTouched.clear();
    // TODO prune trips that are now longer than max lengths to avoid biasing averages
  }
  // add initial stops
  RaptorState initialState = scheduleState[0];
  accessStops.forEachEntry((stop, accessTime) -> {
    initialState.setTimeAtStop(stop, accessTime + nextMinuteDepartureTime, -1, -1, 0, 0, true);
    return true; // continue iteration
  });
}

代码示例来源:origin: com.conveyal/r5

/**
 * Set the departure time in the scheduled search to the given departure time,
 * and prepare for the scheduled search at the next-earlier minute
 */
private void advanceScheduledSearchToPreviousMinute (int nextMinuteDepartureTime) {
  for (RaptorState state : this.scheduleState) {
    state.setDepartureTime(nextMinuteDepartureTime);
    // clear all touched stops to avoid constant reëxploration
    state.bestStopsTouched.clear();
    state.nonTransferStopsTouched.clear();
    // TODO prune trips that are now longer than max lengths to avoid biasing averages
  }
  // add initial stops
  RaptorState initialState = scheduleState[0];
  accessStops.forEachEntry((stop, accessTime) -> {
    initialState.setTimeAtStop(stop, accessTime + nextMinuteDepartureTime, -1, -1, 0, 0, true);
    return true; // continue iteration
  });
}

代码示例来源:origin: zavtech/morpheus-core

@Override
  public final Index<Integer> sort(boolean parallel, IntComparator comparator) {
    super.sort(parallel, comparator);
    if (comparator == null) {
      final Array<Integer> keys = keyArray();
      this.indexMap.forEachEntry((key, index) -> {
        keys.setInt(index, key);
        return true;
      });
    }
    return this;
  }
}

代码示例来源:origin: com.conveyal/r5

/** propagate states to the destination in a point-to-point search */
private Collection<McRaptorState> doPropagationToDestination(int departureTime) {
  McRaptorStateBag bag = createStateBag(departureTime);
  egressTimes.forEach((mode, times) -> times.forEachEntry((stop, egressTime) -> {
    McRaptorStateBag bagAtStop = bestStates.get(stop);
    if (bagAtStop == null) return true;
    for (McRaptorState state : bagAtStop.getNonTransferStates()) {
      McRaptorState stateAtDest = new McRaptorState();
      stateAtDest.back = state;
      // walk to destination is transfer
      stateAtDest.pattern = -1;
      stateAtDest.trip = -1;
      stateAtDest.stop = -1;
      stateAtDest.accessMode = state.accessMode;
      stateAtDest.egressMode = mode;
      stateAtDest.time = state.time + egressTime;
      bag.add(stateAtDest);
    }
    return true;
  }));
  return bag.getBestStates();
}

代码示例来源:origin: conveyal/r5

/** propagate states to the destination in a point-to-point search */
private Collection<McRaptorState> doPropagationToDestination(int departureTime) {
  McRaptorStateBag bag = createStateBag(departureTime);
  egressTimes.forEach((mode, times) -> times.forEachEntry((stop, egressTime) -> {
    McRaptorStateBag bagAtStop = bestStates.get(stop);
    if (bagAtStop == null) return true;
    for (McRaptorState state : bagAtStop.getNonTransferStates()) {
      McRaptorState stateAtDest = new McRaptorState();
      stateAtDest.back = state;
      // walk to destination is transfer
      stateAtDest.pattern = -1;
      stateAtDest.trip = -1;
      stateAtDest.stop = -1;
      stateAtDest.accessMode = state.accessMode;
      stateAtDest.egressMode = mode;
      stateAtDest.time = state.time + egressTime;
      bag.add(stateAtDest);
    }
    return true;
  }));
  return bag.getBestStates();
}

代码示例来源:origin: com.conveyal/r5

/**
 * After a search has been run, calling this method will returns a map from transit stop indexes to the value of
 * the objective variable for the optimal path to that stop. TransitLayer contains the information about which
 * street vertices are transit stops.
 *
 * Currently this has what appears to be an optimization that uses the stops found by the {@link StopVisitor}
 * itself, if the routingVisitor used by the search is a StopVisitor. This is the case when transitStopSearch
 * is true. The point of this whole thing is to limit the number of stops found, which was a hack to keep
 * profile routing reasonably fast back in the day. Current SuboptimalPathRouting may not need this anymore.
 * FIXME remove limits on the number of transit stops found, then remove this special case for StopVisitor
 */
public TIntIntMap getReachedStops() {
  if (transitStopSearch && routingVisitor instanceof StopVisitor) {
    return ((StopVisitor) routingVisitor).getStops();
  }
  TIntIntMap result = new TIntIntHashMap();
  TransitLayer transitLayer = streetLayer.parentNetwork.transitLayer;
  transitLayer.stopForStreetVertex.forEachEntry((streetVertex, stop) -> {
    if (streetVertex == -1) return true;
    State state = getStateAtVertex(streetVertex);
    if (state != null) result.put(stop, state.getRoutingVariable(quantityToMinimize));
    return true; // continue iteration
  });
  return result;
}

代码示例来源:origin: conveyal/r5

/**
 * After a search has been run, calling this method will returns a map from transit stop indexes to the value of
 * the objective variable for the optimal path to that stop. TransitLayer contains the information about which
 * street vertices are transit stops.
 *
 * Currently this has what appears to be an optimization that uses the stops found by the {@link StopVisitor}
 * itself, if the routingVisitor used by the search is a StopVisitor. This is the case when transitStopSearch
 * is true. The point of this whole thing is to limit the number of stops found, which was a hack to keep
 * profile routing reasonably fast back in the day. Current SuboptimalPathRouting may not need this anymore.
 * FIXME remove limits on the number of transit stops found, then remove this special case for StopVisitor
 */
public TIntIntMap getReachedStops() {
  if (transitStopSearch && routingVisitor instanceof StopVisitor) {
    return ((StopVisitor) routingVisitor).getStops();
  }
  TIntIntMap result = new TIntIntHashMap();
  TransitLayer transitLayer = streetLayer.parentNetwork.transitLayer;
  transitLayer.stopForStreetVertex.forEachEntry((streetVertex, stop) -> {
    if (streetVertex == -1) return true;
    State state = getStateAtVertex(streetVertex);
    if (state != null) result.put(stop, state.getRoutingVariable(quantityToMinimize));
    return true; // continue iteration
  });
  return result;
}

代码示例来源:origin: com.conveyal/r5

/**
 * 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));
}

相关文章