public void add(int amount) { modifiers.add(amount); }
public void subtract(int amount) { modifiers.add(-amount); }
public void add( int[] vals ) { synchronized( mutex ) { list.add( vals ); } } public void add( int[] vals, int offset, int length ) {
public void add( int[] vals, int offset, int length ) { synchronized( mutex ) { list.add( vals, offset, length ); } }
void push(String methodDescriptor, int address) { methodStack.add(methodDescriptor); addressStack.add(address); }
public MeshBuilder addIndices(int... indices) { meshData.getIndices().add(indices); return this; }
public MeshBuilder addIndex(int index) { meshData.getIndices().add(index); return this; }
@Override public TIntList getAsIntegerArray() { TIntList result = new TIntArrayList(size()); for (JsonElement element : array) { result.add(element.getAsInt()); } return result; }
/** * Add a variable number of int arguments or an array of ints to the bag for a given stopcluster. * Optionally sort all the entries after a bulk add. */ public void add(StopCluster stopCluster, boolean sort, int... time) { TIntList times = timesForCluster.get(stopCluster); if (times == null) { times = new TIntArrayList(); timesForCluster.put(stopCluster, times); } times.add(time); if (sort) { times.sort(); } }
private int[] buildParameterRegisters(List<String> parameterTypes, int[] registers) { TIntList parameterRegisters = new TIntLinkedList(parameterTypes.size()); int index = 0; for (String parameterType : parameterTypes) { parameterRegisters.add(registers[index]); index += Utils.getRegisterSize(parameterType); } return parameterRegisters.toArray(); }
/** * Inserts a value into the set. * * @param obj an <code>Object</code> value * @return true if the set was modified by the add operation */ @Override public boolean add(E obj) { int index = insertKey(obj); if (index < 0) { return false; // already present in set, nothing to add } if (!order.add(index)) throw new IllegalStateException("Order not changed after insert"); postInsertHook(consumeFreeSlot); return true; // yes, we added something }
public int[] getConnectedTerminatingAddresses() { TIntList addresses = new TIntLinkedList(); for (int address : terminatingAddresses) { if (wasAddressReached(address)) { addresses.add(address); } } return addresses.toArray(); }
public void dispose(int buffer) { if (buffer != 0) { pool.add(buffer); IntBuffer dataBuffer = BufferUtils.createIntBuffer(1); dataBuffer.put(0); dataBuffer.flip(); VertexBufferObjectUtil.bufferVboData(buffer, dataBuffer, GL15.GL_STATIC_DRAW); dataBuffer.flip(); if (traceBufferUsage) { usageTracker.remove(buffer); } } }
private TShortObjectMap<TIntList> createBatchBlockEventMappings(Chunk chunk) { TShortObjectMap<TIntList> batchBlockMap = new TShortObjectHashMap<>(); blockManager.listRegisteredBlocks().stream().filter(Block::isLifecycleEventsRequired).forEach(block -> batchBlockMap.put(block.getId(), new TIntArrayList())); ChunkBlockIterator i = chunk.getBlockIterator(); while (i.next()) { if (i.getBlock().isLifecycleEventsRequired()) { TIntList positionList = batchBlockMap.get(i.getBlock().getId()); positionList.add(i.getBlockPos().x); positionList.add(i.getBlockPos().y); positionList.add(i.getBlockPos().z); } } return batchBlockMap; }
public int get(String forUseBy) { if (pool.isEmpty()) { IntBuffer buffer = BufferUtils.createIntBuffer(BUFFER_FETCH_SIZE); GL15.glGenBuffers(buffer); for (int i = 0; i < BUFFER_FETCH_SIZE; ++i) { pool.add(buffer.get(i)); } totalPoolSize += BUFFER_FETCH_SIZE; } int result = pool.removeAt(pool.size() - 1); if (traceBufferUsage) { usageTracker.put(result, forUseBy); } return result; }
@Override public TIntList getAsIntegerArray() { if (data.getIntegerCount() > 0) { TIntList result = new TIntArrayList(data.getIntegerCount()); for (int i = 0; i < data.getIntegerCount(); ++i) { result.add(data.getInteger(i)); } return result; } else { TIntList result = new TIntArrayList(data.getLongCount()); for (int i = 0; i < data.getLongCount(); ++i) { result.add(Ints.saturatedCast(data.getLong(i))); } return result; } }
private static int[] buildTerminatingAddresses(List<BuilderInstruction> instructions) { TIntList addresses = new TIntLinkedList(); for (BuilderInstruction instruction : instructions) { int address = instruction.getLocation().getCodeAddress(); Opcode op = instruction.getOpcode(); switch (op) { case RETURN_VOID: case RETURN: case RETURN_WIDE: case RETURN_OBJECT: case THROW: break; default: continue; } addresses.add(address); } return addresses.toArray(); }
public SkeletalMeshDataBuilder addMesh(Bone bone, MeshData data) { TFloatList meshVertices = data.getVertices(); TIntList meshIndices = data.getIndices(); TFloatList texCoord0 = data.getTexCoord0(); int weightsStart = weights.size(); addBone(bone); for (int i = 0; i < meshVertices.size() / 3; i++) { float x = meshVertices.get(i * 3); float y = meshVertices.get(i * 3 + 1); float z = meshVertices.get(i * 3 + 2); Vector3f pos = new Vector3f(x, y, z); BoneWeight weight = new BoneWeight(pos, 1, bone.getIndex()); // TODO Meshes may contain normal vectors and we may copy them to the weight here // - but they are recalculated later on in either case. needs some rework addWeight(weight); vertexStartWeights.add(weightsStart + i); vertexWeightCounts.add(1); uvs.add(new Vector2f(texCoord0.get(i * 2), texCoord0.get(i * 2 + 1))); } for (int i = 0; i < meshIndices.size(); i++) { indices.add(meshIndices.get(i) + weightsStart); } return this; }
/** {@inheritDoc} */ public TIntList grep(TIntProcedure condition) { TIntList ret = new TIntLinkedList(); for (TIntLink l = head; got(l); l = l.getNext()) { if (condition.execute(l.getValue())) ret.add(l.getValue()); } return ret; }
/** {@inheritDoc} */ public TIntList inverseGrep(TIntProcedure condition) { TIntList ret = new TIntLinkedList(); for (TIntLink l = head; got(l); l = l.getNext()) { if (!condition.execute(l.getValue())) ret.add(l.getValue()); } return ret; }