use of gnu.trove.iterator.TIntIterator in project OsmAnd-tools by osmandapp.
the class ObfFileInMemory method readTransportData.
public void readTransportData(BinaryMapIndexReader indexReader, TransportIndex ind, boolean override) throws IOException {
SearchRequest<TransportStop> sr = BinaryMapIndexReader.buildSearchTransportRequest(MapUtils.get31TileNumberX(lonleft), MapUtils.get31TileNumberX(lonright), MapUtils.get31TileNumberY(lattop), MapUtils.get31TileNumberY(latbottom), -1, null);
List<TransportStop> sti = indexReader.searchTransportIndex(ind, sr);
// merged could not be overridden
TIntLongMap routesData = putTransportStops(sti, override);
if (routesData.size() > 0) {
int[] filePointers = routesData.keys();
// reads all route
TIntObjectHashMap<TransportRoute> transportRoutes = indexReader.getTransportRoutes(filePointers);
TIntIterator it = transportRoutes.keySet().iterator();
while (it.hasNext()) {
int offset = it.next();
TransportRoute route = transportRoutes.get(offset);
Long routeId = route.getId();
if (override || !this.transportRoutes.containsKey(routeId)) {
this.transportRoutes.put(routeId, route);
}
}
}
}
use of gnu.trove.iterator.TIntIterator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class BalloonProcessor method doLastHoleCheck.
private boolean doLastHoleCheck(BlockPos holeToCheck, BlockPos[] adjacentPositions) {
BalloonHoleDetector holeDetector = new BalloonHoleDetector(holeToCheck, parent.worldObj, 2500, this);
if (!holeDetector.cleanHouse) {
// Wow the hole is actually filled! Add the new positions here!
TIntIterator newBallonWallIterator = holeDetector.newBalloonWalls.iterator();
TIntIterator newAirPostitionsIterator = holeDetector.foundSet.iterator();
while (newBallonWallIterator.hasNext()) {
int hash = newBallonWallIterator.next();
BlockPos fromHash = holeDetector.getPosWithRespectTo(hash, holeDetector.firstBlock);
balloonWalls.add(fromHash);
internalAirPositions.remove(fromHash);
balloonHoles.remove(fromHash);
}
while (newAirPostitionsIterator.hasNext()) {
int hash = newAirPostitionsIterator.next();
BlockPos fromHash = holeDetector.getPosWithRespectTo(hash, holeDetector.firstBlock);
internalAirPositions.add(fromHash);
balloonWalls.remove(fromHash);
balloonHoles.remove(fromHash);
}
return true;
}
return false;
}
use of gnu.trove.iterator.TIntIterator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class BalloonProcessor method makeProcessorForDetector.
public static BalloonProcessor makeProcessorForDetector(PhysicsWrapperEntity wrapper, BalloonDetector detector) {
TIntIterator ballonWallIterator = detector.balloonWalls.iterator();
TIntIterator airPostitionsIterator = detector.foundSet.iterator();
HashSet<BlockPos> staticBalloonWalls = new HashSet<BlockPos>();
HashSet<BlockPos> staticInternalPositions = new HashSet<BlockPos>();
int minX, maxX, minY, maxY, minZ, maxZ;
minX = maxX = detector.firstBlock.getX();
minY = maxY = detector.firstBlock.getY();
minZ = maxZ = detector.firstBlock.getZ();
while (ballonWallIterator.hasNext()) {
int hash = ballonWallIterator.next();
BlockPos fromHash = detector.getPosWithRespectTo(hash, detector.firstBlock);
staticBalloonWalls.add(fromHash);
minX = Math.min(minX, fromHash.getX());
minY = Math.min(minY, fromHash.getY());
minZ = Math.min(minZ, fromHash.getZ());
maxX = Math.max(maxX, fromHash.getX());
maxY = Math.max(maxY, fromHash.getY());
maxZ = Math.max(maxZ, fromHash.getZ());
}
while (airPostitionsIterator.hasNext()) {
int hash = airPostitionsIterator.next();
BlockPos fromHash = detector.getPosWithRespectTo(hash, detector.firstBlock);
staticInternalPositions.add(fromHash);
}
BalloonProcessor toReturn = new BalloonProcessor(wrapper, staticBalloonWalls, staticInternalPositions);
toReturn.minX = minX;
toReturn.minY = minY;
toReturn.minZ = minZ;
toReturn.maxX = maxX;
toReturn.maxY = maxY;
toReturn.maxZ = maxZ;
return toReturn;
}
use of gnu.trove.iterator.TIntIterator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class WorldPhysicsCollider method runPhysCollision.
//Runs the collision code
public void runPhysCollision() {
// Multiply by 20 to convert seconds (physTickSpeed) into ticks (ticksSinceCacheUpdate)
ticksSinceCacheUpdate += 20D * calculator.physTickSpeed;
TIntIterator iterator = cachedHitsToRemove.iterator();
while (iterator.hasNext()) {
cachedPotentialHits.remove(iterator.next());
}
cachedHitsToRemove.clear();
if (shouldUpdateCollisonCache()) {
updatePotentialCollisionCache();
// Collections.shuffle(cachedPotentialHits);
}
processPotentialCollisionsAccurately();
}
use of gnu.trove.iterator.TIntIterator in project Terasology by MovingBlocks.
the class OpenGLMesh method createIndexBuffer.
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();
}
Aggregations