Codota Logo
TIntList.forEach
Code IndexAdd Codota to your IDE (free)

How to use
forEach
method
in
gnu.trove.list.TIntList

Best Java code snippets using gnu.trove.list.TIntList.forEach (Showing top 20 results out of 315)

  • Common ways to obtain TIntList
private void myMethod () {
TIntList t =
  • Codota Iconnew TIntArrayList()
  • Codota Iconnew TIntLinkedList()
  • Codota Iconnew TIntArrayList(capacity)
  • Smart code suggestions by Codota
}
origin: alibaba/mdrill

  /**
   * Executes <tt>procedure</tt> for each element in the set.
   *
   * @param procedure a <code>TObjectProcedure</code> value
   * @return false if the loop over the set terminated because
   *         the procedure returned false for some value.
   */
  @Override
  public boolean forEach(TObjectProcedure<? super E> procedure) {
    ForEachProcedure forEachProcedure = new ForEachProcedure(_set, procedure);
    return order.forEach(forEachProcedure);
  }
}
origin: alibaba/mdrill

@Override
protected void writeEntries(ObjectOutput out) throws IOException {
  // ENTRIES
  WriteProcedure writeProcedure = new WriteProcedure(out);
  if (!order.forEach(writeProcedure))
    throw writeProcedure.getIoException();
}
origin: MovingBlocks/Terasology

indices.forEach(value -> {
  if (value < 0 || value >= vertices.length) {
    throw new JsonParseException("Face value out of range: " + value + ", max vertex is " + (vertices.length - 1));
origin: com.conveyal/r5

/** Mark patterns at touched stops, to be explored in a subsequent round */
private void markPatterns () {
  this.touchedPatterns.clear();
  for (int stop = touchedStops.nextSetBit(0); stop >= 0; stop = touchedStops.nextSetBit(stop + 1)) {
    network.transitLayer.patternsForStop.get(stop).forEach(pat -> {
      this.touchedPatterns.set(pat);
      return true;
    });
  }
  this.touchedStops.clear();
}
origin: conveyal/r5

/** Mark patterns at touched stops, to be explored in a subsequent round */
private void markPatterns () {
  this.touchedPatterns.clear();
  for (int stop = touchedStops.nextSetBit(0); stop >= 0; stop = touchedStops.nextSetBit(stop + 1)) {
    network.transitLayer.patternsForStop.get(stop).forEach(pat -> {
      this.touchedPatterns.set(pat);
      return true;
    });
  }
  this.touchedStops.clear();
}
origin: net.sf.trove4j/trove4j

  /**
   * Executes <tt>procedure</tt> for each element in the set.
   *
   * @param procedure a <code>TObjectProcedure</code> value
   * @return false if the loop over the set terminated because
   *         the procedure returned false for some value.
   */
  @Override
  public boolean forEach(TObjectProcedure<? super E> procedure) {
    ForEachProcedure forEachProcedure = new ForEachProcedure(_set, procedure);
    return order.forEach(forEachProcedure);
  }
}
origin: com.palantir.patches.sourceforge/trove3

  /**
   * Executes <tt>procedure</tt> for each element in the set.
   *
   * @param procedure a <code>TObjectProcedure</code> value
   * @return false if the loop over the set terminated because
   *         the procedure returned false for some value.
   */
  @Override
  public boolean forEach(TObjectProcedure<? super E> procedure) {
    ForEachProcedure forEachProcedure = new ForEachProcedure(_set, procedure);
    return order.forEach(forEachProcedure);
  }
}
origin: com.conveyal/r5

transit.patternsForStop.get(stop).forEach(originalPattern -> {
  int filteredPattern = index[originalPattern];
origin: conveyal/r5

transit.patternsForStop.get(stop).forEach(originalPattern -> {
  int filteredPattern = index[originalPattern];
origin: net.sf.trove4j/trove4j

@Override
protected void writeEntries(ObjectOutput out) throws IOException {
  // ENTRIES
  WriteProcedure writeProcedure = new WriteProcedure(out);
  if (!order.forEach(writeProcedure))
    throw writeProcedure.getIoException();
}
origin: com.palantir.patches.sourceforge/trove3

@Override
protected void writeEntries(ObjectOutput out) throws IOException {
  // ENTRIES
  WriteProcedure writeProcedure = new WriteProcedure(out);
  if (!order.forEach(writeProcedure))
    throw writeProcedure.getIoException();
}
origin: conveyal/r5

  /** Remove the permissions around a vertex for the desired mode. Returns the number of edges affected */
  public void removePermissionsAroundVertex (int vertex) {
    for (TIntList edgeList : new TIntList[] { streets.outgoingEdges.get(vertex), streets.incomingEdges.get(vertex) }) {
      edgeList.forEach(eidx -> {
        edgeCursor.seek(eidx);
        switch (mode) {
          case CAR:
            edgeCursor.clearFlag(EdgeStore.EdgeFlag.ALLOWS_CAR);
            break;
          case BICYCLE:
            edgeCursor.clearFlag(EdgeStore.EdgeFlag.ALLOWS_BIKE);
            break;
          case WALK:
            edgeCursor.clearFlag(EdgeStore.EdgeFlag.ALLOWS_PEDESTRIAN);
            break;
          default:
            throw new IllegalArgumentException(String.format("Unsupported mode %s for island removal", mode));
        }
        return true; // continue iteration
      });
    }
  }
}
origin: com.conveyal/r5

  /** Remove the permissions around a vertex for the desired mode. Returns the number of edges affected */
  public void removePermissionsAroundVertex (int vertex) {
    for (TIntList edgeList : new TIntList[] { streets.outgoingEdges.get(vertex), streets.incomingEdges.get(vertex) }) {
      edgeList.forEach(eidx -> {
        edgeCursor.seek(eidx);
        switch (mode) {
          case CAR:
            edgeCursor.clearFlag(EdgeStore.EdgeFlag.ALLOWS_CAR);
            break;
          case BICYCLE:
            edgeCursor.clearFlag(EdgeStore.EdgeFlag.ALLOWS_BIKE);
            break;
          case WALK:
            edgeCursor.clearFlag(EdgeStore.EdgeFlag.ALLOWS_PEDESTRIAN);
            break;
          default:
            throw new IllegalArgumentException(String.format("Unsupported mode %s for island removal", mode));
        }
        return true; // continue iteration
      });
    }
  }
}
origin: com.conveyal/r5

/** Loop over every outgoing edge for a particular mode */
public void forEachOutgoingEdge (int vertex, Consumer<EdgeStore.Edge> consumer) {
  streets.outgoingEdges.get(vertex).forEach(eidx -> {
    edgeCursor.seek(eidx);
    // filter by mode
    switch (mode) {
      case WALK:
        if (!edgeCursor.getFlag(EdgeStore.EdgeFlag.ALLOWS_PEDESTRIAN)) return true;
        else break;
      case CAR:
        if (!edgeCursor.getFlag(EdgeStore.EdgeFlag.ALLOWS_CAR)) return true;
        else break;
      case BICYCLE:
        // include ped mode here, because walking bikes is a thing you can do.
        boolean allowsBike = edgeCursor.getFlag(EdgeStore.EdgeFlag.ALLOWS_BIKE) ||
                edgeCursor.getFlag(EdgeStore.EdgeFlag.ALLOWS_PEDESTRIAN);
        if (!allowsBike) return true;
        else break;
      default:
        throw new IllegalArgumentException(String.format("Unsupported mode %s for island removal", mode));
    }
    consumer.accept(edgeCursor);
    return true; // continue iteration over outgoing edges
  });
}
origin: conveyal/r5

/** Loop over every outgoing edge for a particular mode */
public void forEachOutgoingEdge (int vertex, Consumer<EdgeStore.Edge> consumer) {
  streets.outgoingEdges.get(vertex).forEach(eidx -> {
    edgeCursor.seek(eidx);
    // filter by mode
    switch (mode) {
      case WALK:
        if (!edgeCursor.getFlag(EdgeStore.EdgeFlag.ALLOWS_PEDESTRIAN)) return true;
        else break;
      case CAR:
        if (!edgeCursor.getFlag(EdgeStore.EdgeFlag.ALLOWS_CAR)) return true;
        else break;
      case BICYCLE:
        // include ped mode here, because walking bikes is a thing you can do.
        boolean allowsBike = edgeCursor.getFlag(EdgeStore.EdgeFlag.ALLOWS_BIKE) ||
                edgeCursor.getFlag(EdgeStore.EdgeFlag.ALLOWS_PEDESTRIAN);
        if (!allowsBike) return true;
        else break;
      default:
        throw new IllegalArgumentException(String.format("Unsupported mode %s for island removal", mode));
    }
    consumer.accept(edgeCursor);
    return true; // continue iteration over outgoing edges
  });
}
origin: conveyal/r5

transitLayer.patternsForStop.get(stopIdx).forEach(p -> {
  patternidx[0] = p;
  return false;
origin: com.conveyal/r5

transitLayer.patternsForStop.get(stopIdx).forEach(p -> {
  patternidx[0] = p;
  return false;
origin: com.conveyal/r5

streetLayer.outgoingEdges.get(fromEdgeToVertex).forEach(eidx -> {
  if (eidx == next[0]) {
    return true;
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));
}
origin: 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));
}
gnu.trove.listTIntListforEach

Javadoc

Applies the procedure to each value in the list in ascending (front to back) order.

Popular methods of TIntList

  • add
    Adds a subset of the values in the array vals to the end of the list, in order.
  • toArray
    Copies a slice of the list into a native array.
  • get
    Returns the value at the specified offset.
  • size
    Returns the number of values in the list.
  • sort
    Sort a slice of the list (ascending) using the Sun quicksort implementation.
  • iterator
  • set
    Replace the values in the list starting at offset withlength values from the values array, starting
  • clear
    Flushes the internal state of the list, resetting the capacity to the default.
  • remove
    Removes length values from the list, starting atoffset
  • reverse
    Reverse the order of the elements in the range of the list.
  • max
    Finds the maximum value in the list.
  • min
    Finds the minimum value in the list.
  • max,
  • min,
  • isEmpty,
  • fill,
  • removeAt,
  • replace,
  • shuffle,
  • subList,
  • sum,
  • binarySearch

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • putExtra (Intent)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • BoxLayout (javax.swing)
  • JFileChooser (javax.swing)
  • JTextField (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now