Package org.jbox2d.pooling

Source Code of org.jbox2d.pooling.OrderedStackVec3

package org.jbox2d.pooling;

import org.jbox2d.common.Vec3;

public class OrderedStackVec3 extends OrderedStack<Vec3> {

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

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

}
TOP

Related Classes of org.jbox2d.pooling.OrderedStackVec3

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.