Example #1
0
 protected T[] resize(int newSize) {
   T[] items = this.items;
   T[] newItems = (T[]) new Object[newSize];
   System.arraycopy(items, 0, newItems, 0, MathUtils.min(size, newItems.length));
   this.items = newItems;
   return newItems;
 }
Example #2
0
 /**
  * A simple constructor
  *
  * @param data data
  * @param nbins nbins
  */
 public Histogram(double[] data, int nbins) {
   double min = MathUtils.min(data);
   double max = MathUtils.max(data);
   setHistogram(data, nbins, min, max);
 }
Example #3
0
 public Histogram(double[] data) {
   double min = MathUtils.min(data);
   double max = MathUtils.max(data);
   setHistogram(data, 15, min, max);
 }
Example #4
0
 public static IntHashMap.Entry[] copyOf(IntHashMap.Entry[] obj, int newSize) {
   IntHashMap.Entry tempArr[] = new IntHashMap.Entry[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }
Example #5
0
 public static LTexture[] copyOf(LTexture[] obj, int newSize) {
   LTexture tempArr[] = new LTexture[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }
Example #6
0
 public static PSortableObject[] copyOf(PSortableObject[] obj, int newSize) {
   PSortableObject tempArr[] = new PSortableObject[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }
Example #7
0
 public static PBody[] copyOf(PBody[] obj, int newSize) {
   PBody tempArr[] = new PBody[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }
Example #8
0
 public static PConvexPolygonShape[] copyOf(PConvexPolygonShape[] obj, int newSize) {
   PConvexPolygonShape tempArr[] = new PConvexPolygonShape[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }
Example #9
0
 /**
  * copy指定长度的数组数据
  *
  * @param obj
  * @param newSize
  * @return
  */
 public static boolean[] copyOf(boolean[] obj, int newSize) {
   boolean tempArr[] = new boolean[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }
Example #10
0
 /**
  * copy指定长度的数组数据
  *
  * @param obj
  * @param newSize
  * @return
  */
 public static long[] copyOf(long[] obj, int newSize) {
   long tempArr[] = new long[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }
Example #11
0
 /**
  * copy指定长度的数组数据
  *
  * @param obj
  * @param newSize
  * @return
  */
 public static char[] copyOf(char[] obj, int newSize) {
   char tempArr[] = new char[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }
Example #12
0
 /**
  * copy指定长度的数组数据
  *
  * @param obj
  * @param newSize
  * @return
  */
 public static float[] copyOf(float[] obj, int newSize) {
   float tempArr[] = new float[newSize];
   System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize));
   return tempArr;
 }