Sha256: 08c80db1630aab6a15f92579be70e50a49c19177179e82c458ad323524fbe2f1

Contents?: true

Size: 843 Bytes

Versions: 7

Compression:

Stored size: 843 Bytes

Contents

package org.jbox2d.pooling.arrays;

import java.util.HashMap;

import org.jbox2d.particle.VoronoiDiagram;

public class GeneratorArray {

  private final HashMap<Integer, VoronoiDiagram.Generator[]> map;

    public GeneratorArray() {
        this.map = new HashMap<>();
    }

  public VoronoiDiagram.Generator[] get(int length) {
    assert (length > 0);

    if (!map.containsKey(length)) {
      map.put(length, getInitializedArray(length));
    }

    assert (map.get(length).length == length) : "Array not built of correct length";
    return map.get(length);
  }

  protected VoronoiDiagram.Generator[] getInitializedArray(int length) {
    final VoronoiDiagram.Generator[] ray = new VoronoiDiagram.Generator[length];
    for (int i = 0; i < ray.length; i++) {
      ray[i] = new VoronoiDiagram.Generator();
    }
    return ray;
  }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pbox2d-1.0.3-java src/org/jbox2d/pooling/arrays/GeneratorArray.java
pbox2d-1.0.2-java src/org/jbox2d/pooling/arrays/GeneratorArray.java
pbox2d-1.0.1-java src/org/jbox2d/pooling/arrays/GeneratorArray.java
pbox2d-1.0.0-java src/org/jbox2d/pooling/arrays/GeneratorArray.java
pbox2d-0.9.1-java src/org/jbox2d/pooling/arrays/GeneratorArray.java
pbox2d-0.9.0-java src/org/jbox2d/pooling/arrays/GeneratorArray.java
pbox2d-0.8.0-java src/org/jbox2d/pooling/arrays/GeneratorArray.java