All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jbox2d.pooling.OrderedStackAABB Maven / Gradle / Ivy

There is a newer version: 1.9.1
Show newest version
package org.jbox2d.pooling;

import org.jbox2d.collision.AABB;

public class OrderedStackAABB extends OrderedStack {

  public OrderedStackAABB(int argStackSize, int argContainerSize) {
    super(argStackSize, argContainerSize);
    pool = new AABB[argStackSize];
    for (int i = 0; i < argStackSize; i++) {
      pool[i] = new AABB();
    }
    container = new AABB[argContainerSize];
    for (int i = 0; i < argContainerSize; i++) {
      container[i] = new AABB();
    }
  }

  @Override
  protected AABB[] createArray(int argSize, AABB[] argOld) {
    if (argOld != null) {
      AABB[] sk = new AABB[argSize];
      for (int i = 0; i < argOld.length; i++) {
        sk[i] = argOld[i];
      }
      for (int i = argOld.length; i < argSize; i++) {
        sk[i] = new AABB();
      }
      return sk;
    } else {
      AABB[] sk = new AABB[argSize];
      for (int i = 0; i < argSize; i++) {
        sk[i] = new AABB();
      }
      return sk;
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy