public PointList copy ( int from , int end ) { if ( from > end ) throw new IllegalArgumentException ( "from must be smaller or equal to end" ) ; if ( from < 0 || end > getSize ( ) ) throw new IllegalArgumentException ( "Illegal interval: " + from + ", " + end + ", size:" + getSize ( ) ) ; PointList thisPL = this ; if ( this instanceof ShallowImmutablePointList ) { ShallowImmutablePointList spl = ( ShallowImmutablePointList ) this ; thisPL = spl . wrappedPointList ; from = spl . fromOffset + from ; end = spl . fromOffset + end ; } int len = end - from ; PointList copyPL = new PointList ( len , is3D ( ) ) ; copyPL . size = len ; copyPL . isImmutable = isImmutable ( ) ; System . arraycopy ( thisPL . latitudes , from , copyPL . latitudes , 0 , len ) ; System . arraycopy ( thisPL . longitudes , from , copyPL . longitudes , 0 , len ) ; if ( is3D ( ) ) System . arraycopy ( thisPL . elevations , from , copyPL . elevations , 0 , len ) ; return copyPL ; }
This method does a deep copy of this object for the specified range .