com.artemis.utils.Bag.getCapacity()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(113)

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

Bag.getCapacity介绍

[英]Returns the number of elements the bag can hold without growing.
[中]

代码示例

代码示例来源:origin: junkdog/artemis-odb

/**
 * Checks if the internal storage supports this index.
 *
 * @param index
 *            index to check
 *
 * @return {@code true} if the index is within bounds
 */
public boolean isIndexWithinBounds(int index) {
  return index < getCapacity();
}

代码示例来源:origin: junkdog/artemis-odb

/**
 * Checks if the internal storage supports this index.
 * 
 * @param index
 *            index to check
 *
 * @return {@code true} if the index is within bounds
 */
public boolean isIndexWithinBounds(int index) {
  return index < getCapacity();
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb

/**
 * Checks if the internal storage supports this index.
 *
 * @param index
 *            index to check
 *
 * @return {@code true} if the index is within bounds
 */
public boolean isIndexWithinBounds(int index) {
  return index < getCapacity();
}

代码示例来源:origin: junkdog/artemis-odb

public void registerEntityStore(BitVector bv) {
  bv.ensureCapacity(entities.getCapacity());
  entityBitVectors.add(bv);
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb

public void registerEntityStore(BitVector bv) {
  bv.ensureCapacity(entities.getCapacity());
  entityBitVectors.add(bv);
}

代码示例来源:origin: junkdog/artemis-odb

/**
 * Instantiates an Entity without registering it into the world.
 * @param id The ID to be set on the Entity
 */
private Entity createEntity(int id) {
  Entity e = new Entity(world, id);
  if (e.id >= entities.getCapacity()) {
    growEntityStores();
  }
  // can't use unsafe set, as we need to track highest id
  // for faster iteration when syncing up new subscriptions
  // in ComponentManager#synchronize
  entities.set(e.id, e);
  return e;
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb

/**
 * Instantiates an Entity without registering it into the world.
 * @param id The ID to be set on the Entity
 */
private Entity createEntity(int id) {
  Entity e = new Entity(world, id);
  if (e.id >= entities.getCapacity()) {
    growEntityStores();
  }
  // can't use unsafe set, as we need to track highest id
  // for faster iteration when syncing up new subscriptions
  // in ComponentManager#synchronize
  entities.set(e.id, e);
  return e;
}

代码示例来源:origin: junkdog/artemis-odb

private void growEntityStores() {
  int newSize = 2 * entities.getCapacity();
  entities.ensureCapacity(newSize);
  ComponentManager cm = world.getComponentManager();
  cm.ensureCapacity(newSize);
  for (int i = 0, s = entityBitVectors.size(); s > i; i++) {
    entityBitVectors.get(i).ensureCapacity(newSize);
  }
}

代码示例来源:origin: net.onedaybeard.artemis/artemis-odb

private void growEntityStores() {
  int newSize = 2 * entities.getCapacity();
  entities.ensureCapacity(newSize);
  ComponentManager cm = world.getComponentManager();
  cm.ensureCapacity(newSize);
  for (int i = 0, s = entityBitVectors.size(); s > i; i++) {
    entityBitVectors.get(i).ensureCapacity(newSize);
  }
}

相关文章