public class CoordinateArrays extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CoordinateArrays.ForwardComparator
A
Comparator for Coordinates arrays
in the forward direction of their coordinates,
using lexicographic ordering. |
| Constructor and Description |
|---|
CoordinateArrays() |
| Modifier and Type | Method and Description |
|---|---|
static Point[] |
atLeastNCoordinatesOrNothing(int n,
Point[] c)
Returns either the given coordinate array if its length is greater than the
given amount, or an empty coordinate array.
|
static int |
compare(Point[] pts1,
Point[] pts2)
Compares two
Coordinates arrays
in the forward direction of their coordinates,
using lexicographic ordering. |
static Point[] |
copyDeep(Point[] coordinates)
Creates a deep copy of the argument
Coordinates array. |
static void |
copyDeep(Point[] src,
int srcStart,
Point[] dest,
int destStart,
int length)
Creates a deep copy of a given section of a source
Coordinates array
into a destination Point array. |
static boolean |
equals(Point[] coord1,
Point[] coord2)
Returns true if the two arrays are identical, both null, or pointwise
equal (as compared using Coordinate#equals)
|
static boolean |
equals(Point[] coord1,
Point[] coord2,
Comparator coordinateComparator)
Returns true if the two arrays are identical, both null, or pointwise
equal, using a user-defined
Comparator for Coordinates s |
static Point[] |
extract(Point[] pts,
int start,
int end)
Extracts a subsequence of the input
Coordinates array
from indices start to
end (inclusive). |
static boolean |
hasRepeatedPoints(Point[] coord)
Returns whether #equals returns true for any two consecutive Coordinates
in the given array.
|
static int |
indexOf(Point coordinate,
Point[] coordinates)
Returns the index of
coordinate in coordinates. |
static boolean |
isRing(Point[] pts)
Tests whether an array of
Coordinatess forms a ring,
by checking length and closure. |
static Point |
ptNotInList(Point[] testPts,
Point[] pts)
Finds a point in a list of points which is not contained in another list of points
|
static Point[] |
removeNull(Point[] coord)
Collapses a coordinate array to remove all null elements.
|
static Point[] |
removeRepeatedPoints(Point[] coord)
If the coordinate array argument has repeated points,
constructs a new array containing no repeated points.
|
static void |
reverse(Point[] coord)
Reverses the coordinates in an array in-place.
|
static Point[] |
toCoordinateArray(Collection coordList)
Converts the given Collection of Point into a Point array.
|
public static Point[] atLeastNCoordinatesOrNothing(int n, Point[] c)
public static int compare(Point[] pts1, Point[] pts2)
Coordinates arrays
in the forward direction of their coordinates,
using lexicographic ordering.pts1 - pts2 - public static Point[] copyDeep(Point[] coordinates)
Coordinates array.coordinates - an array of Coordinatespublic static void copyDeep(Point[] src, int srcStart, Point[] dest, int destStart, int length)
Coordinates array
into a destination Point array.
The destination array must be an appropriate size to receive
the copied coordinates.src - an array of CoordinatessrcStart - the index to start copying fromdest - thedestStart - the destination index to start copying tolength - the number of items to copypublic static boolean equals(Point[] coord1, Point[] coord2)
Geometry.equals(Object)public static boolean equals(Point[] coord1, Point[] coord2, Comparator coordinateComparator)
Comparator for Coordinates scoord1 - an array of Coordinatescoord2 - an array of CoordinatescoordinateComparator - a Comparator for Coordinatespublic static Point[] extract(Point[] pts, int start, int end)
Coordinates array
from indices start to
end (inclusive).
The input indices are clamped to the array size;
If the end index is less than the start index,
the extracted array will be empty.pts - the input arraystart - the index of the start of the subsequence to extractend - the index of the end of the subsequence to extractpublic static boolean hasRepeatedPoints(Point[] coord)
public static int indexOf(Point coordinate, Point[] coordinates)
coordinate in coordinates.
The first position is 0; the second, 1; etc.coordinate - the Coordinate to search forcoordinates - the array to searchcoordinate, or -1 if it is
not foundpublic static boolean isRing(Point[] pts)
Coordinatess forms a ring,
by checking length and closure.
Self-intersection is not checked.pts - an array of Coordinatespublic static Point ptNotInList(Point[] testPts, Point[] pts)
testPts - the Coordinatess to testpts - an array of Coordinatess to test the input points againstCoordinates from testPts which is not in pts, '
or nullpublic static Point[] removeNull(Point[] coord)
coord - the coordinate array to collapsepublic static Point[] removeRepeatedPoints(Point[] coord)
hasRepeatedPoints(Point[])public static void reverse(Point[] coord)
public static Point[] toCoordinateArray(Collection coordList)
Copyright © 2015 Revolution Systems Inc.. All rights reserved.