Package geomss.geom
Interface GeometryList<T extends GeometryList,E extends GeomElement>
-
- Type Parameters:
T
- The type of this list.E
- The type of elements contained in this list.
- All Superinterfaces:
java.lang.Cloneable
,java.util.Collection<E>
,java.lang.Comparable
,GeomElement<T>
,java.lang.Iterable<E>
,java.util.List<E>
,java.io.Serializable
,Transformable<T>
,javolution.xml.XMLSerializable
- All Known Subinterfaces:
LinearCombination<T,E>
- All Known Implementing Classes:
AbstractGeomList
,AbstractPointGeomList
,GeomList
,LinearComboCurve
,LoftedSurface
,PointArray
,PointComponent
,PointString
,PointVehicle
,TriangleList
public interface GeometryList<T extends GeometryList,E extends GeomElement> extends GeomElement<T>, java.util.List<E>, Transformable<T>
Partial implementation of a named list ofGeomElement
objects. The list will not accept the addition ofnull
elements.Modified by: Joseph A. Huwaldt
- Version:
- February 17, 2025
- Author:
- Joseph A. Huwaldt, Date: March 31, 2000
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(int index, E... array)
Inserts all of theGeomElement
objects in the specified list of arguments into this list at the specified position.boolean
add(E... array)
Appends all of the elements in the specified list of arguments to this geometry element list.boolean
addAll(int index, E[] arr)
Inserts all of theGeomElement
objects in the specified array into this list at the specified position.boolean
addAll(E[] arr)
Appends all of the elements in the specified array to this geometry element list.boolean
containsGeometry()
Returnstrue
if this list actually contains any geometry andfalse
if this list is empty or contains only non-geometry items such as empty lists.E
get(java.lang.String name)
Returns the element with the specified name from this list.GeomList<E>
getAll()
Returns a newGeomList
with the elements in this list.E
getFirst()
Returns the first element from this list.int
getIndexFromName(java.lang.String name)
Return the index to the 1st geometry element in this list with the specified name.E
getLast()
Returns the last element from this list.T
getRange(int first, int last)
Returns the range of elements in this list from the specified start and ending indexes.E
remove(java.lang.String name)
Removes the element with the specified name from this list.T
reverse()
Returns a newGeomList
with the elements in this list in reverse order.T
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this list object but stated in the specified unit.T
toDimension(int newDim)
Return a copy of this list converted to the specified number of physical dimensions.java.util.List<E>
unmodifiableList()
Returns an unmodifiable list view associated to this list.-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, copy, copyToReal, getAllUserData, getBoundsMax, getBoundsMin, getID, getLimitPoint, getName, getParDimension, getPhyDimension, getUnit, getUserData, isValid, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, size, toText
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Methods inherited from interface geomss.geom.Transformable
getTransformed
-
-
-
-
Method Detail
-
to
T to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this list object but stated in the specified unit.- Specified by:
to
in interfaceGeomElement<T extends GeometryList>
- Parameters:
unit
- the length unit of the list object to be returned.- Returns:
- an equivalent to this list object but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException
- if the the input unit is not a length unit.
-
toDimension
T 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 element is simply returned.- Specified by:
toDimension
in interfaceGeomElement<T extends GeometryList>
- Parameters:
newDim
- The dimension of the list element to return.- Returns:
- This list element converted to the new dimensions.
-
containsGeometry
boolean containsGeometry()
Returnstrue
if this list actually contains any geometry andfalse
if this list is empty or contains only non-geometry items such as empty lists.- Returns:
- true if this list actually contains geometry.
-
getRange
T getRange(int first, int last)
Returns the range of elements in this list from the specified start and ending indexes.- 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()
-
getFirst
E getFirst()
Returns the first element from this list.- Returns:
- the first element in this list.
-
getLast
E getLast()
Returns the last element from this list.- Returns:
- the last element in this list.
-
get
E get(java.lang.String name)
Returns the element with the specified name from this list.- Parameters:
name
- The name of the element we are looking for in the list.- Returns:
- The element matching the specified name. If the specified element
name isn't found in the list, then
null
is returned.
-
remove
E remove(java.lang.String name)
Removes the element with the specified name from this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.- Parameters:
name
- the name of the element to remove.- Returns:
- the element previously at the specified position.
-
add
boolean add(E... array)
Appends all of the elements in the specified list of arguments to this geometry element list.- Parameters:
array
- elements to be inserted into this collection. May not be null.- Returns:
true
if this collection changed as a result of the call.
-
add
boolean add(int index, E... array)
Inserts all of theGeomElement
objects in the specified list of arguments 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 appeared in the array.- Parameters:
index
- index at which to insert first element from the specified array.array
- elements to be inserted into this collection. May not be null.- Returns:
true
if this collection changed as a result of the call.
-
addAll
boolean addAll(E[] arr)
Appends all of the elements in the specified array to this geometry element list. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress.- Parameters:
arr
- elements to be inserted into this collection. May not be null.- Returns:
true
if this collection changed as a result of the call.
-
addAll
boolean addAll(int index, E[] arr)
Inserts all of theGeomElement
objects in the specified array 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.- Parameters:
index
- index at which to insert first element from the specified collection.arr
- elements to be inserted into this collection. May not be null.- Returns:
true
if this collection changed as a result of the call.
-
unmodifiableList
java.util.List<E> unmodifiableList()
Returns an unmodifiable list view associated to this list. Attempts to modify the returned collection result in an UnsupportedOperationException being thrown.- Returns:
- the unmodifiable view over this list.
-
getAll
GeomList<E> getAll()
Returns a newGeomList
with the elements in this list.- Returns:
- A new GeomList with the elements in this list.
-
reverse
T reverse()
Returns a newGeomList
with the elements in this list in reverse order.- Returns:
- A new list with the elements in this list in reverse order.
-
getIndexFromName
int getIndexFromName(java.lang.String name)
Return the index to the 1st geometry element in this list with the specified name. Objects withnull
names are ignored.- Parameters:
name
- The name of the geometry element to find in this list- Returns:
- The index to the named geometry element or -1 if it is not found.
-
-