Class CoordinateList
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<Coordinate>, Collection<Coordinate>, List<Coordinate>, RandomAccess
A list of
Coordinates, which may
be set to prevent repeated coordinates from occurring in the list.- Version:
- 1.7
- See Also:
-
Field Summary
Fields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new list without any coordinatesCoordinateList(Coordinate[] coord) Constructs a new list from an array of Coordinates, allowing repeated points.CoordinateList(Coordinate[] coord, boolean allowRepeated) Constructs a new list from an array of Coordinates, allowing caller to specify if repeated points are to be removed. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int i, Coordinate coord, boolean allowRepeated) Inserts the specified coordinate at the specified position in this list.booleanAdds a coordinate to the list.booleanadd(Coordinate[] coord, boolean allowRepeated) Adds an array of coordinates to the list.booleanadd(Coordinate[] coord, boolean allowRepeated, boolean direction) Adds an array of coordinates to the list.booleanadd(Coordinate[] coord, boolean allowRepeated, int start, int end) Adds a section of an array of coordinates to the list.voidadd(Coordinate coord, boolean allowRepeated) Adds a coordinate to the end of the list.booleanaddAll(Collection<? extends Coordinate> coll, boolean allowRepeated) Add an array of coordinatesclone()Returns a deep copy of this CoordinateList instance.voidEnsure this coordList is a ring, by adding the start point if necessarygetCoordinate(int i) Returns the Coordinates in this collection.toCoordinateArray(boolean isForward) Creates an array containing the coordinates in this list, oriented in the given direction (forward or reverse).Methods inherited from class ArrayList
add, add, addAll, addAll, clear, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractList
equals, hashCodeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, streamMethods inherited from interface List
containsAll, equals, hashCode
-
Constructor Details
-
CoordinateList
public CoordinateList()Constructs a new list without any coordinates -
CoordinateList
Constructs a new list from an array of Coordinates, allowing repeated points. (I.e. this constructor produces aCoordinateListwith exactly the same set of points as the input array.)- Parameters:
coord- the initial coordinates
-
CoordinateList
Constructs a new list from an array of Coordinates, allowing caller to specify if repeated points are to be removed.- Parameters:
coord- the array of coordinates to load into the listallowRepeated- iffalse, repeated points are removed
-
-
Method Details
-
getCoordinate
-
add
Adds a section of an array of coordinates to the list.- Parameters:
coord- The coordinatesallowRepeated- if set to false, repeated coordinates are collapsedstart- the index to start fromend- the index to add up to but not including- Returns:
- true (as by general collection contract)
-
add
Adds an array of coordinates to the list.- Parameters:
coord- The coordinatesallowRepeated- if set to false, repeated coordinates are collapseddirection- if false, the array is added in reverse order- Returns:
- true (as by general collection contract)
-
add
Adds an array of coordinates to the list.- Parameters:
coord- The coordinatesallowRepeated- if set to false, repeated coordinates are collapsed- Returns:
- true (as by general collection contract)
-
add
Adds a coordinate to the list.- Parameters:
obj- The coordinate to addallowRepeated- if set to false, repeated coordinates are collapsed- Returns:
- true (as by general collection contract)
-
add
Adds a coordinate to the end of the list.- Parameters:
coord- The coordinatesallowRepeated- if set to false, repeated coordinates are collapsed
-
add
Inserts the specified coordinate at the specified position in this list.- Parameters:
i- the position at which to insertcoord- the coordinate to insertallowRepeated- if set to false, repeated coordinates are collapsed
-
addAll
Add an array of coordinates- Parameters:
coll- The coordinatesallowRepeated- if set to false, repeated coordinates are collapsed- Returns:
- true (as by general collection contract)
-
closeRing
public void closeRing()Ensure this coordList is a ring, by adding the start point if necessary -
toCoordinateArray
Returns the Coordinates in this collection.- Returns:
- the coordinates
-
toCoordinateArray
Creates an array containing the coordinates in this list, oriented in the given direction (forward or reverse).- Parameters:
isForward- true if the direction is forward, false for reverse- Returns:
- an oriented array of coordinates
-
clone
Returns a deep copy of this CoordinateList instance.- Overrides:
clonein classArrayList<Coordinate>- Returns:
- a clone of this CoordinateList instance
-