本文整理了Java中gnu.trove.list.TIntList.iterator()
方法的一些代码示例,展示了TIntList.iterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TIntList.iterator()
方法的具体详情如下:
包路径:gnu.trove.list.TIntList
类名称:TIntList
方法名:iterator
暂无
代码示例来源:origin: alibaba/mdrill
public TObjectHashIterator<E> iterator() {
return new TObjectHashIterator<E>(this) {
TIntIterator localIterator = order.iterator();
int lastIndex;
代码示例来源:origin: alibaba/mdrill
public TIntLinkedList(TIntList list) {
no_entry_value = list.getNoEntryValue();
//
for (TIntIterator iterator = list.iterator(); iterator.hasNext();) {
int next = iterator.next();
add(next);
}
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
/**
* Calculates Stats for the transfer to the given ride from the previous ride.
* This should only be called after all PatternRides have been added to the ride.
* Distances can be stored in rides, including the first and last distance. But waits must be
* calculated from full sets of patterns, which are not known until a round is over.
*/
public Stats calcStatsForTransfer (TimeWindow window, double walkSpeed) {
TIntList arrivals = previous.getSortedStoptimes(window, true);
TIntList departures = this.getSortedStoptimes(window, false);
List<Integer> waits = Lists.newArrayList();
TIntIterator departureIterator = departures.iterator();
int departure = departureIterator.next();
ARRIVAL : for (TIntIterator arrivalsIterator = arrivals.iterator(); arrivalsIterator.hasNext();) {
int arrival = arrivalsIterator.next();
// On transfers the access stats should have max=min=avg
// We use the min, which would be best if min != max since it should only relax the bounds somewhat.
int boardTime = arrival + accessStats.min + ProfileRouter.SLACK;
while (departure <= boardTime) {
if (!departureIterator.hasNext()) break ARRIVAL;
departure = departureIterator.next();
}
waits.add(departure - boardTime);
}
/* Waits list may be empty if no transfers are possible. */
if (waits.isEmpty()) return null; // Impossible to make this transfer.
return new Stats (waits);
}
代码示例来源:origin: MovingBlocks/Terasology
private int calculateTotal(int base, TFloatList multipliers, TIntList modifiers) {
// For now, add all modifiers and multiply by all multipliers. Negative modifiers cap to zero, but negative
// multipliers remain (so damage can be flipped to healing)
float total = base;
TIntIterator modifierIter = modifiers.iterator();
while (modifierIter.hasNext()) {
total += modifierIter.next();
}
total = Math.max(0, total);
if (total == 0) {
return 0;
}
TFloatIterator multiplierIter = multipliers.iterator();
while (multiplierIter.hasNext()) {
total *= multiplierIter.next();
}
return TeraMath.floorToInt(total);
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
/**
* Produce stats about boarding an initial Ride, which has no previous ride.
* This assumes arrival times are uniformly distributed during the window.
* The Ride must contain some trips, and the window must have a positive duration.
*/
public Stats calcStatsForBoarding(TimeWindow window) {
Stats stats = new Stats ();
stats.min = 0; // You can always arrive just before a train departs.
TIntList departures = getSortedStoptimes(window, false);
int last = window.from;
double avgAccumulated = 0.0;
/* All departures in the list are known to be running and within the window. */
for (TIntIterator it = departures.iterator(); it.hasNext();) {
int dep = it.next();
int maxWait = dep - last;
if (maxWait > stats.max) stats.max = maxWait;
/* Weight the average of each interval by the number of seconds it contains. */
avgAccumulated += (maxWait / 2.0) * maxWait;
stats.num += maxWait;
last = dep;
}
if (stats.num > 0) {
stats.avg = (int) (avgAccumulated / stats.num);
}
return stats;
}
代码示例来源:origin: MovingBlocks/Terasology
TIntIterator indexIterator = elements.indices.iterator();
while (indexIterator.hasNext()) {
elements.finalIndices.put(indexIterator.next());
代码示例来源:origin: MovingBlocks/Terasology
private void createIndexBuffer(TIntList indexList) {
IntBuffer indexBuffer = BufferUtils.createIntBuffer(indexList.size());
TIntIterator iterator = indexList.iterator();
while (iterator.hasNext()) {
indexBuffer.put(iterator.next());
}
indexBuffer.flip();
if (disposalAction.vboIndexBuffer == 0) {
disposalAction.vboIndexBuffer = disposalAction.bufferPool.get(getUrn().toString());
}
VertexBufferObjectUtil.bufferVboElementData(disposalAction.vboIndexBuffer, indexBuffer, GL15.GL_STATIC_DRAW);
indexBuffer.flip();
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
for (TIntIterator it = stopForIndex.iterator(); it.hasNext();) {
int stop = it.next();
TIntList transfers = new TIntArrayList();
for (TIntIterator stopIt = stopForIndex.iterator(); stopIt.hasNext();) {
int stop = stopIt.next();
for (TIntIterator stopIt = stopForIndex.iterator(); stopIt.hasNext();) {
out.clear();
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
/**
* Compute the centroid for each class.
*
* @param dim Dimensionality
* @param vectorcolumn Vector column
* @param keys Key index
* @param classes Classes
* @return Centroids for each class.
*/
protected List<Centroid> computeCentroids(int dim, List<V> vectorcolumn, List<ClassLabel> keys, Map<ClassLabel, TIntList> classes) {
final int numc = keys.size();
List<Centroid> centroids = new ArrayList<>(numc);
for (int i = 0; i < numc; i++) {
Centroid c = new Centroid(dim);
// Note: GNU Trove iterator, not ELKI style!
for (TIntIterator it = classes.get(keys.get(i)).iterator(); it.hasNext();) {
c.put(vectorcolumn.get(it.next()));
}
centroids.add(c);
}
return centroids;
}
代码示例来源:origin: com.flowpowered/caustic-api
/**
* Replaces the current buffer data with the list of bytes in the give {@link gnu.trove.list.TIntList} This method arbitrarily creates data for the ByteBuffer regardless of the data type of the
* vertex attribute.
*
* @param list to set
*/
public void setData(TIntList list) {
this.buffer = CausticUtil.createByteBuffer(list.size() * DataType.INT.getByteSize());
final TIntIterator iterator = list.iterator();
while (iterator.hasNext()) {
buffer.putInt(iterator.next());
}
}
代码示例来源:origin: net.sf.trove4j/trove4j
public TIntLinkedList(TIntList list) {
no_entry_value = list.getNoEntryValue();
//
for (TIntIterator iterator = list.iterator(); iterator.hasNext();) {
int next = iterator.next();
add(next);
}
}
代码示例来源:origin: com.palantir.patches.sourceforge/trove3
public TIntLinkedList(TIntList list) {
no_entry_value = list.getNoEntryValue();
//
for (TIntIterator iterator = list.iterator(); iterator.hasNext();) {
int next = iterator.next();
add(next);
}
}
代码示例来源:origin: com.conveyal/r5
/**
* Get a single best state at a vertex. NB this should not be used for propagating to samples, as you need to apply
* turn costs/restrictions during propagation.
*/
public State getStateAtVertex (int vertexIndex) {
State ret = null;
TIntList edgeList;
if (profileRequest.reverseSearch) {
edgeList = streetLayer.outgoingEdges.get(vertexIndex);
} else {
edgeList = streetLayer.incomingEdges.get(vertexIndex);
}
for (TIntIterator it = edgeList.iterator(); it.hasNext();) {
int eidx = it.next();
State state = getStateAtEdge(eidx);
if (state == null) continue;
if (ret == null) ret = state;
else if (ret.getRoutingVariable(quantityToMinimize) > state.getRoutingVariable(quantityToMinimize)) {
ret = state;
}
}
return ret;
}
代码示例来源:origin: conveyal/r5
/**
* Get a single best state at a vertex. NB this should not be used for propagating to samples, as you need to apply
* turn costs/restrictions during propagation.
*/
public State getStateAtVertex (int vertexIndex) {
State ret = null;
TIntList edgeList;
if (profileRequest.reverseSearch) {
edgeList = streetLayer.outgoingEdges.get(vertexIndex);
} else {
edgeList = streetLayer.incomingEdges.get(vertexIndex);
}
for (TIntIterator it = edgeList.iterator(); it.hasNext();) {
int eidx = it.next();
State state = getStateAtEdge(eidx);
if (state == null) continue;
if (ret == null) ret = state;
else if (ret.getRoutingVariable(quantityToMinimize) > state.getRoutingVariable(quantityToMinimize)) {
ret = state;
}
}
return ret;
}
代码示例来源:origin: numenta/htm.java
/**
* Returns true if any of the on bit indexes of the specified collection are
* matched by the on bits of this matrix. It is allowed that
* this matrix have more on bits than the specified matrix.
*
* @param matrix
* @return
*/
public boolean any(TIntList onBits) {
TIntSet keySet = getSparseSet();
for(TIntIterator i = onBits.iterator();i.hasNext();) {
if(keySet.contains(i.next())) return true;
}
return false;
}
代码示例来源:origin: conveyal/r5
for (TIntIterator patternIt = patterns.iterator(); patternIt.hasNext();) {
int pattern = patternIt.next();
代码示例来源:origin: com.conveyal/r5
for (TIntIterator patternIt = patterns.iterator(); patternIt.hasNext();) {
int pattern = patternIt.next();
代码示例来源:origin: guokr/simbase
private void processDenseChangedEvt(VectorSet evtSrc, int vecid, float[] vector) {
if (evtSrc == this.source) {
target.rescore(source.key(), vecid, vector, this);
} else if (evtSrc == this.target) {
int tgtVecId = vecid;
TIntIterator iter = sorterKeys.iterator();
while (iter.hasNext()) {
int srcVecId = iter.next();
float score = scoring.score(source.key(), srcVecId, source.get(srcVecId), target.key(), tgtVecId,
vector);
add(srcVecId, tgtVecId, score);
}
}
}
代码示例来源:origin: guokr/simbase
private void processSparseChangedEvt(VectorSet evtSrc, int vecid, int[] vector) {
if (evtSrc == this.source) {
target.rescore(source.key(), vecid, vector, this);
} else if (evtSrc == this.target) {
int tgtVecId = vecid;
TIntIterator iter = sorterKeys.iterator();
while (iter.hasNext()) {
int srcVecId = iter.next();
float score = scoring.score(source.key(), srcVecId, source._get(srcVecId), source.length(srcVecId),
target.key(), tgtVecId, vector, vector.length);
add(srcVecId, tgtVecId, score);
}
}
}
代码示例来源:origin: guokr/simbase
reverseIndexer = new TIntObjectHashMap<TIntSet>();
TIntIterator iter = oldSorterKeys.iterator();
while (iter.hasNext()) {
int srcId = iter.next();
内容来源于网络,如有侵权,请联系作者删除!