예제 #1
0
    public CelestialObject clone() {
      try {
        CelestialObject obj = (CelestialObject) super.clone();

        obj.position = new PVector(obj.position.x, obj.position.y);
        obj.velocity = new PVector(obj.velocity.x, obj.velocity.y);
        obj.acceleration = new PVector(obj.acceleration.x, obj.acceleration.y);
        obj.alForces = cloneArrayList(obj.alForces);

        return obj;
      } catch (final CloneNotSupportedException ex) {
        throw new AssertionError();
      }
    }