public void clear() { ensureMutability(); size = 0; }
public void reverse() { ensureMutability(); // in-place reverse int max = size / 2; for (int i = 0; i < max; i++) { int swapIndex = size - i - 1; double tmp = latitudes[i]; latitudes[i] = latitudes[swapIndex]; latitudes[swapIndex] = tmp; tmp = longitudes[i]; longitudes[i] = longitudes[swapIndex]; longitudes[swapIndex] = tmp; if (is3D) { tmp = elevations[i]; elevations[i] = elevations[swapIndex]; elevations[swapIndex] = tmp; } } }
public void trimToSize(int newSize) { ensureMutability(); if (newSize > size) throw new IllegalArgumentException("new size needs be smaller than old size"); size = newSize; }
public void set(int index, double lat, double lon, double ele) { ensureMutability(); if (index >= size) throw new ArrayIndexOutOfBoundsException("index has to be smaller than size " + size); latitudes[index] = lat; longitudes[index] = lon; if (is3D) elevations[index] = ele; else if (!Double.isNaN(ele)) throw new IllegalStateException("This is a 2D list we cannot store elevation: " + ele); }
public void add(double lat, double lon, double ele) { ensureMutability(); int newSize = size + 1; incCap(newSize); latitudes[size] = lat; longitudes[size] = lon; if (is3D) elevations[size] = ele; else if (!Double.isNaN(ele)) throw new IllegalStateException("This is a 2D list we cannot store elevation: " + ele); size = newSize; }
public void add(PointList points) { ensureMutability(); int newSize = size + points.getSize(); incCap(newSize); for (int i = 0; i < points.getSize(); i++) { int tmp = size + i; latitudes[tmp] = points.getLatitude(i); longitudes[tmp] = points.getLongitude(i); if (is3D) elevations[tmp] = points.getElevation(i); } size = newSize; }
public void clear() { ensureMutability(); size = 0; }
public void reverse() { ensureMutability(); // in-place reverse int max = size / 2; for (int i = 0; i < max; i++) { int swapIndex = size - i - 1; double tmp = latitudes[i]; latitudes[i] = latitudes[swapIndex]; latitudes[swapIndex] = tmp; tmp = longitudes[i]; longitudes[i] = longitudes[swapIndex]; longitudes[swapIndex] = tmp; if (is3D) { tmp = elevations[i]; elevations[i] = elevations[swapIndex]; elevations[swapIndex] = tmp; } } }
public void trimToSize(int newSize) { ensureMutability(); if (newSize > size) throw new IllegalArgumentException("new size needs be smaller than old size"); size = newSize; }
public void set(int index, double lat, double lon, double ele) { ensureMutability(); if (index >= size) throw new ArrayIndexOutOfBoundsException("index has to be smaller than size " + size); latitudes[index] = lat; longitudes[index] = lon; if (is3D) elevations[index] = ele; else if (!Double.isNaN(ele)) throw new IllegalStateException("This is a 2D list we cannot store elevation: " + ele); }
public void add(double lat, double lon, double ele) { ensureMutability(); int newSize = size + 1; incCap(newSize); latitudes[size] = lat; longitudes[size] = lon; if (is3D) elevations[size] = ele; else if (!Double.isNaN(ele)) throw new IllegalStateException("This is a 2D list we cannot store elevation: " + ele); size = newSize; }
public void add(PointList points) { ensureMutability(); int newSize = size + points.getSize(); incCap(newSize); for (int i = 0; i < points.getSize(); i++) { int tmp = size + i; latitudes[tmp] = points.getLatitude(i); longitudes[tmp] = points.getLongitude(i); if (is3D) elevations[tmp] = points.getElevation(i); } size = newSize; }