gnu.trove.list.TIntList.add()方法的使用及代码示例

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

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

TIntList.add介绍

[英]Adds val to the end of the list, growing as needed.
[中]将val添加到列表末尾,并根据需要增加。

代码示例

代码示例来源:origin: MovingBlocks/Terasology

public void add(int amount) {
  modifiers.add(amount);
}

代码示例来源:origin: MovingBlocks/Terasology

public void subtract(int amount) {
  modifiers.add(-amount);
}

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

public void add( int[] vals ) {
  synchronized( mutex ) { list.add( vals ); }
}
public void add( int[] vals, int offset, int length ) {

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

public void add( int[] vals, int offset, int length ) {
  synchronized( mutex ) { list.add( vals, offset, length ); }
}

代码示例来源:origin: CalebFenton/simplify

void push(String methodDescriptor, int address) {
  methodStack.add(methodDescriptor);
  addressStack.add(address);
}

代码示例来源:origin: MovingBlocks/Terasology

public MeshBuilder addIndices(int... indices) {
  meshData.getIndices().add(indices);
  return this;
}

代码示例来源:origin: MovingBlocks/Terasology

public MeshBuilder addIndex(int index) {
  meshData.getIndices().add(index);
  return this;
}

代码示例来源:origin: MovingBlocks/Terasology

@Override
public TIntList getAsIntegerArray() {
  TIntList result = new TIntArrayList(size());
  for (JsonElement element : array) {
    result.add(element.getAsInt());
  }
  return result;
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

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

代码示例来源:origin: CalebFenton/simplify

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();
}

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

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

代码示例来源:origin: CalebFenton/simplify

public int[] getConnectedTerminatingAddresses() {
  TIntList addresses = new TIntLinkedList();
  for (int address : terminatingAddresses) {
    if (wasAddressReached(address)) {
      addresses.add(address);
    }
  }
  return addresses.toArray();
}

代码示例来源:origin: MovingBlocks/Terasology

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

代码示例来源:origin: MovingBlocks/Terasology

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;
}

代码示例来源:origin: MovingBlocks/Terasology

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;
}

代码示例来源:origin: MovingBlocks/Terasology

@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;
  }
}

代码示例来源:origin: CalebFenton/simplify

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();
}

代码示例来源:origin: MovingBlocks/Terasology

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;
}

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

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

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

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

相关文章