Package geomss.geom
Class GeomList<E extends GeomElement>
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractGeomList<GeomList,E>
-
- geomss.geom.GeomList<E>
-
- Type Parameters:
E- The type of element stored in this list.
- All Implemented Interfaces:
GeomElement<GeomList>,GeometryList<GeomList,E>,Transformable<GeomList>,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.List<E>,javolution.lang.Reusable,javolution.xml.XMLSerializable
public final class GeomList<E extends GeomElement> extends AbstractGeomList<GeomList,E>
A concrete list of arbitraryGeomElementobjects.WARNING: This list allows geometry to be stored in different units and with different physical dimensions. If consistent units or dimensions are required, then the user must specifically convert the list items.
Modified by: Joseph A. Huwaldt
- Version:
- February 17, 2025
- Author:
- Joseph A. Huwaldt, Date: May 1, 2009
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GeomListcopy()Returns a copy of thisGeomListinstanceallocatedby the calling thread (possibly on the stack).GeomListcopyToReal()Return a copy of this object with any transformations or subranges removed (applied).GeomListgetRange(int first, int last)Returns the range of elements in this list from the specified start and ending indexes.GeomListgetTransformed(GTransform transform)Returns transformed version of this element.static GeomListnewInstance()Returns a new, empty, preallocated or recycledGeomListinstance (on the stack when executing in aStackContext) that can store a list ofGeomElementobjects.static GeomListnewInstance(java.lang.String name)Returns a new, empty, preallocated or recycledGeomListinstance (on the stack when executing in aStackContext) with the specified name, that can store a list ofGeomElementobjects.static voidrecycle(GeomList instance)Recycles a GeomList instance immediately (on the stack when executing in a StackContext).GeomListreverse()Returns an newGeomListwith the elements in this list in reverse order.GeomListto(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)Returns the equivalent to this list but with all the elements stated in the specified unit.GeomListtoDimension(int newDim)Return a copy of this list converted to the specified number of physical dimensions.static GeomListvalueOf(GeomElement... elements)Return a GeomList containing theGeomElementobjects in the specified array.static GeomListvalueOf(java.lang.String name, GeomElement... elements)Return a GeomList containing theGeomElementobjects in the specified list.static GeomListvalueOf(java.lang.String name, java.util.Collection<? extends GeomElement> elements)Return a GeomList containing theGeomElementobjects in the specified collection.-
Methods inherited from class geomss.geom.AbstractGeomList
add, add, add, add, addAll, addAll, addAll, addAll, clear, contains, containsAll, containsGeometry, equals, get, get, getAll, getBoundsMax, getBoundsMin, getFirst, getIndexFromName, getLast, getLimitPoint, getParDimension, getPhyDimension, getUnit, hashCode, indexOf, isEmpty, isValid, iterator, lastIndexOf, listIterator, listIterator, remove, remove, remove, removeAll, reset, retainAll, set, size, subList, toArray, toArray, toText, unmodifiableList
-
Methods inherited from class geomss.geom.AbstractGeomElement
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, toString
-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
-
-
-
-
Method Detail
-
newInstance
public static GeomList newInstance()
Returns a new, empty, preallocated or recycledGeomListinstance (on the stack when executing in aStackContext) that can store a list ofGeomElementobjects.- Returns:
- A new, empty GeomList.
-
newInstance
public static GeomList newInstance(java.lang.String name)
Returns a new, empty, preallocated or recycledGeomListinstance (on the stack when executing in aStackContext) with the specified name, that can store a list ofGeomElementobjects.- Parameters:
name- The name to be assigned to this list (may benull).- Returns:
- A new, empty GeomList with the specified name.
-
valueOf
public static GeomList valueOf(java.lang.String name, java.util.Collection<? extends GeomElement> elements)
Return a GeomList containing theGeomElementobjects in the specified collection.- Parameters:
name- The name to be assigned to this list (may benull).elements- A collection of geometry elements. May not be null.- Returns:
- A new GeomList containing the elements in the specified collection.
-
valueOf
public static GeomList valueOf(java.lang.String name, GeomElement... elements)
Return a GeomList containing theGeomElementobjects in the specified list.- Parameters:
name- The name to be assigned to this list (may benull).elements- A list of geometry elements. May not be null.- Returns:
- A new GeomList containing the elements in the specified list.
-
valueOf
public static GeomList valueOf(GeomElement... elements)
Return a GeomList containing theGeomElementobjects in the specified array.- Parameters:
elements- An array of geometry elements. May not be null.- Returns:
- A new GeomList containing the elements in the specified array.
-
getRange
public GeomList getRange(int first, int last)
Returns the range of elements in this list from the specified start and ending indexes.- Specified by:
getRangein interfaceGeometryList<GeomList,E extends GeomElement>- Specified by:
getRangein classAbstractGeomList<GeomList,E extends GeomElement>- Parameters:
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).- Returns:
- the list of elements in the given range from this list.
- Throws:
java.lang.IndexOutOfBoundsException- if the given index is out of range:index ≥ size()
-
reverse
public GeomList reverse()
Returns an newGeomListwith the elements in this list in reverse order.- Specified by:
reversein interfaceGeometryList<GeomList,E extends GeomElement>- Specified by:
reversein classAbstractGeomList<GeomList,E extends GeomElement>- Returns:
- A new GeomList with the elements in this list in reverse order.
-
toDimension
public GeomList toDimension(int newDim)
Return a copy of this list converted to the specified number of physical dimensions. If the number of dimensions is greater than this element, then zeros are added to the additional dimensions. If the number of dimensions is less than this element, then the extra dimensions are simply dropped (truncated). If the new dimensions are the same as the dimension of this element, then this list is simply returned.- Parameters:
newDim- The dimension of the element to return.- Returns:
- A copy of this list converted to the new dimensions.
-
to
public GeomList to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this list but with all the elements stated in the specified unit.- Parameters:
unit- the length unit of the list to be returned. May not be null.- Returns:
- an equivalent to this list but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException- if the the input unit is not a length unit.
-
copy
public GeomList copy()
Returns a copy of thisGeomListinstanceallocatedby the calling thread (possibly on the stack).- Returns:
- an identical and independent copy of this object.
-
copyToReal
public GeomList copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Returns:
- A copy of this list with any transformations or subranges removed.
-
getTransformed
public GeomList getTransformed(GTransform transform)
Returns transformed version of this element. The returned object implementsGeomTransformand contains transformed versions of the contents of this list as children. Any list elements that are not transformable will simply be added to the output list without transformation.- Parameters:
transform- The transform to apply to this geometry element. May not be null.- Returns:
- A transformed version of this geometry element.
- Throws:
DimensionException- if this element is not 3D.
-
-