E
- The type of GeomPoint stored in this array of points.public final class PointArray<E extends GeomPoint> extends AbstractPointGeomList<PointArray<E>,PointString<E>>
PointArray
is a collection of PointString
objects that make up a
"list of strings of points". Any number of strings may be added to an array. All the
strings in an array must have the same dimensions. In order to draw the array, all the
strings in a array must also have the same number of points.
WARNING: This list allows geometry to be stored in different units. If consistent units are required, then the user must specifically convert the list items.
Modified by: Joseph A. Huwaldt
RESOURCES
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
PointString<E> value)
Inserts the specified
PointString at the specified position in this list. |
boolean |
addAll(int index,
java.util.Collection<? extends PointString<E>> c)
Inserts all of the
PointString objects in the specified collection into
this list at the specified position. |
PointArray<E> |
copy()
Returns a copy of this
PointArray instance
allocated by the calling
thread (possibly on the stack). |
PointArray |
copyToReal()
Return a copy of this object with any transformations or subranges
removed (applied).
|
PointArray<E> |
enrich()
Returns a new
PointArray that is identical to this array but with new rows
(strings of points) and columns (points in each string) of points linearly
interpolated between each of the existing rows and columns. |
PointArray<E> |
enrichColumns()
Returns a new
PointArray that is identical to this array but with
a new column (point) linearly interpolated between each point of the existing
strings. |
PointArray<E> |
enrichRows()
Returns a new
PointArray that is identical to this array but with
a new row (string of points) linearly interpolated between each of the existing
rows. |
E |
get(int row,
int col)
Returns the
GeomPoint at the specified pair of indices in this
array. |
Parameter<Area> |
getArea()
Return the total surface area of all the panels formed by this array of
points.
|
PointString<E> |
getColumn(int col)
Return a column of points from this array as a new PointString object.
|
int |
getNumberOfPanels()
Return the total number of quadrilateral panels in this array of points.
|
PointArray<E> |
getRange(int first,
int last)
Returns the range of elements in this list from the specified start and
ending indexes.
|
PointArray |
getTransformed(GTransform transform)
Returns transformed version of this element.
|
static void |
main(java.lang.String[] args)
Tests the methods in this class.
|
static PointArray |
newInstance()
Returns a new, empty, preallocated or recycled
PointArray
instance (on the stack when executing in a StackContext ),
that can store a list of PointString objects. |
static PointArray |
newInstance(java.lang.String name)
Returns a new, preallocated or recycled
PointArray instance
(on the stack when executing in a StackContext ) with the
specified name, that can store a list of PointString objects. |
static void |
recycle(PointArray instance)
Recycles a case instance immediately (on the stack when executing in a
StackContext).
|
PointArray<E> |
reverse()
Returns an new
PointArray with the elements in this list in
reverse order. |
PointArray<E> |
reverseStrings()
Returns an new
PointArray with the points in each string in this
array in reverse order. |
PointString<E> |
set(int index,
PointString<E> element)
Replaces the
PointString at the specified position in this list with the
specified element. |
PointArray<E> |
thin()
Returns a new
PointArray that is identical to this array but with every
other row (string of points) and column (points in the strings) removed. |
PointArray<E> |
thinColumns()
Returns a new
PointArray that is identical to this array but with every
other column (points in strings) removed. |
PointArray<E> |
thinRows()
Returns a new
PointArray that is identical to this array but with every
other row (string of points) removed. |
PointArray |
to(Unit<Length> unit)
Returns the equivalent to this list but with all the elements stated in the
specified unit.
|
PointArray<E> |
toDimension(int newDim)
Return the equivalent of this list converted to the specified number of
physical dimensions.
|
PointArray<E> |
transpose()
Returns a new
PointArray that is the transpose this array (rows
and columns swapped). |
TriangleList<Triangle> |
triangulate()
Return a TriangleList containing a simple triangulation of the input array of
quadrilateral panels.
|
static <E extends GeomPoint> |
valueOf(PointString<E>... elements)
Return a PointArray made up of the
PointString objects in the
specified array. |
static <E extends GeomPoint> |
valueOf(java.lang.String name,
java.util.Collection<? extends PointString<E>> elements)
Return a PointArray made up of the
PointString objects in the
specified collection. |
static <E extends GeomPoint> |
valueOf(java.lang.String name,
PointString<E>... elements)
Return a PointArray made up of the
PointString objects in the
specified array. |
getNumberOfPoints, getPhyDimension
add, add, add, addAll, addAll, addAll, clear, contains, containsAll, containsGeometry, equals, get, get, getAll, getBoundsMax, getBoundsMin, getFirst, getIndexFromName, getLast, getLimitPoint, getParDimension, getUnit, hashCode, indexOf, isEmpty, isValid, iterator, lastIndexOf, listIterator, listIterator, remove, remove, remove, removeAll, reset, retainAll, size, subList, toArray, toArray, toText, unmodifiableList
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, toString
addChangeListener, getAllUserData, getBoundsMax, getBoundsMin, getID, getLimitPoint, getName, getParDimension, getUnit, getUserData, isValid, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, size, toText
public static PointArray newInstance()
PointArray
instance (on the stack when executing in a StackContext
),
that can store a list of PointString
objects.public static PointArray newInstance(java.lang.String name)
PointArray
instance
(on the stack when executing in a StackContext
) with the
specified name, that can store a list of PointString
objects.name
- The name to be assigned to this list (may be null
).public static <E extends GeomPoint> PointArray<E> valueOf(java.lang.String name, java.util.Collection<? extends PointString<E>> elements)
PointString
objects in the
specified collection.E
- The type of GeomPoint stored in this array of points.name
- The name to be assigned to this list (may be null
).elements
- A collection that contains a set of strings. May not be null.public static <E extends GeomPoint> PointArray<E> valueOf(java.lang.String name, PointString<E>... elements)
PointString
objects in the
specified array.E
- The type of GeomPoint stored in this array of points.name
- The name to be assigned to this string (may be null
).elements
- A list that contains a set of strings. May not be null.public static <E extends GeomPoint> PointArray<E> valueOf(PointString<E>... elements)
PointString
objects in the
specified array.E
- The type of GeomPoint stored in this array of points.elements
- A list that contains a set of strings. May not be null.public E get(int row, int col) throws java.lang.IndexOutOfBoundsException
GeomPoint
at the specified pair of indices in this
array. This is a convenience method that is identical to
array.get(row).get(col)
.row
- The row (string or "T") index of the panel to be returnedcol
- The column (point in a string or "S") index of the panel to be returnedjava.lang.IndexOutOfBoundsException
- if there the specified indices do not
exist in this array.public PointString<E> getColumn(int col) throws java.lang.IndexOutOfBoundsException
col
- The column of points to return.java.lang.IndexOutOfBoundsException
- if there the specified index does not exist in
this array.public PointArray<E> getRange(int first, int last)
getRange
in interface GeometryList<PointArray<E extends GeomPoint>,PointString<E extends GeomPoint>>
getRange
in class AbstractGeomList<PointArray<E extends GeomPoint>,PointString<E extends GeomPoint>>
first
- index of the first element to return (0 returns the 1st
element, -1 returns the last, etc).last
- index of the last element to return (0 returns the 1st
element, -1 returns the last, etc).java.lang.IndexOutOfBoundsException
- if the given index is out of range:
index >= size()
public PointArray<E> reverse()
PointArray
with the elements in this list in
reverse order.reverse
in interface GeometryList<PointArray<E extends GeomPoint>,PointString<E extends GeomPoint>>
reverse
in class AbstractGeomList<PointArray<E extends GeomPoint>,PointString<E extends GeomPoint>>
public PointArray<E> reverseStrings()
PointArray
with the points in each string in this
array in reverse order.public PointArray<E> transpose() throws java.lang.IndexOutOfBoundsException
PointArray
that is the transpose this array (rows
and columns swapped). This method can only be called if all the strings
in this array have the same number of points in them.java.lang.IndexOutOfBoundsException
- if the number of points is not the same
in each string in this array.public PointArray<E> thin()
PointArray
that is identical to this array but with every
other row (string of points) and column (points in the strings) removed. The 1st
row and column and the last row and column are always retained. If there are less
than 3 columns in the array, then a new array is returned that contains the same
columns as this array. If there are less than 3 rows, then a new array is returned
that contains the same rows as this array.public PointArray<E> thinRows()
PointArray
that is identical to this array but with every
other row (string of points) removed. The 1st row (index = 0) and last row (index =
size()-1) are always retained. If there are less than 3 rows in the array, then a
new array is returned that contains the same rows as this array.public PointArray<E> thinColumns() throws java.lang.IndexOutOfBoundsException
PointArray
that is identical to this array but with every
other column (points in strings) removed. The 1st column (index = 0) and last
column (index = get(0).size()-1) are always retained. If there are less than 3
columns in the array, then a new array is returned that contains the same columns
as this array.java.lang.IndexOutOfBoundsException
- if the number of points is not the same in each
string in this array.public PointArray<E> enrich() throws java.lang.IndexOutOfBoundsException
PointArray
that is identical to this array but with new rows
(strings of points) and columns (points in each string) of points linearly
interpolated between each of the existing rows and columns. If there are less than
2 columns in the array, then a new array is returned that contains the one column
in this array. If there are less than 2 points in each string of the array, then a
new array is returned that contains the one point in each string in this array.java.lang.IndexOutOfBoundsException
- if the number of points is not the same in each
string in this array.public PointArray<E> enrichRows() throws java.lang.IndexOutOfBoundsException
PointArray
that is identical to this array but with
a new row (string of points) linearly interpolated between each of the existing
rows. If there are less than 2 rows in the array, then a new array
is returned that contains the one row in this array.java.lang.IndexOutOfBoundsException
- if the number of points is not the same
in each string in this array.public PointArray<E> enrichColumns() throws java.lang.IndexOutOfBoundsException
PointArray
that is identical to this array but with
a new column (point) linearly interpolated between each point of the existing
strings. If there are less than 2 points in each string of the array,
then a new array is returned that contains the one point in each string
in this array.java.lang.IndexOutOfBoundsException
- if the number of points is not the same
in each string in this array.public TriangleList<Triangle> triangulate()
copyToReal()
public PointArray<E> toDimension(int newDim)
newDim
- The dimension of the element to return.public PointArray to(Unit<Length> unit)
unit
- the length unit of the list to be returned. May not be null.ConversionException
- if the the input unit is not a length unit.public PointArray<E> copy()
PointArray
instance
allocated
by the calling
thread (possibly on the stack).public PointArray copyToReal()
public int getNumberOfPanels() throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
- if the strings in this array have
different lengths.public Parameter<Area> getArea()
public PointArray getTransformed(GTransform transform)
GeomTransform
and contains transformed versions of the
contents of this list as children.transform
- The transform to apply to this geometry element. May not be null.DimensionException
- if this element is not 3D.public PointString<E> set(int index, PointString<E> element)
PointString
at the specified position in this list with the
specified element. Null elements are ignored. The input element must have the same
physical dimensions as the other items in this list, or an exception is thrown.set
in interface java.util.List<PointString<E extends GeomPoint>>
set
in class AbstractPointGeomList<PointArray<E extends GeomPoint>,PointString<E extends GeomPoint>>
index
- The index of the element to replace (0 returns the 1st element, -1
returns the last, -2 returns the 2nd from last, etc).element
- The element to be stored at the specified position.
null
elements are ignored.java.lang.IndexOutOfBoundsException
- - if index > size()
DimensionException
- if the input element's dimensions are different from
this list's dimensions.public void add(int index, PointString<E> value)
PointString
at the specified position in this list.
Shifts the element currently at that position (if any) and any subsequent elements
to the right (adds one to their indices). Null values are ignored. The input
value must have the same physical dimensions as the other items in this list, or
an exception is thrown.
Note: If this method is used concurrent access must be synchronized (the list is not thread-safe).
add
in interface java.util.List<PointString<E extends GeomPoint>>
add
in class AbstractPointGeomList<PointArray<E extends GeomPoint>,PointString<E extends GeomPoint>>
index
- the index at which the specified element is to be inserted. (0 returns
the 1st element, -1 returns the last, -2 returns the 2nd from last,
etc).value
- the element to be inserted. May not be null.java.lang.IndexOutOfBoundsException
- if index > size()
DimensionException
- if the input value dimensions are different from
this list's dimensions.public boolean addAll(int index, java.util.Collection<? extends PointString<E>> c)
PointString
objects in the specified collection into
this list at the specified position. Shifts the element currently at that position
(if any) and any subsequent elements to the right (increases their indices). The
new elements will appear in this list in the order that they are returned by the
specified collection's iterator. The behavior of this operation is unspecified if
the specified collection is modified while the operation is in progress. Note that
this will occur if the specified collection is this list, and it's nonempty. The
input elements must have the same physical dimensions as the other items in this
list, or an exception is thrown.addAll
in interface java.util.List<PointString<E extends GeomPoint>>
addAll
in class AbstractGeomList<PointArray<E extends GeomPoint>,PointString<E extends GeomPoint>>
index
- index at which to insert first element from the specified collection.c
- elements to be inserted into this collection. May not be null.true
if this collection changed as a result of the call.DimensionException
- if the input element's dimensions are different from
this list's dimensions.public static void recycle(PointArray instance)
instance
- The instance to be recycled.public static void main(java.lang.String[] args)
args
- Command-line arguments (ignored).