T
- type of element in the collectionpublic class BoundedList<T> extends Object
Modifier and Type | Method and Description |
---|---|
BoundedList<T> |
addObjectsNoBoundingBoxChange(Collection<T> elementsToAdd)
Adds elements without changing the bounding-box
|
BoundedList<T> |
assignBoundingBox(BoundingBox boxToAssign)
Assigns a new containing bounding-box.
|
BoundedList<T> |
assignBoundingBoxAndMap(BoundingBox boxToAssign,
java.util.function.UnaryOperator<T> mappingFunction)
Assigns a new containing bounding-box and maps each individual element.
|
BoundingBox |
boundingBox()
A bounding-box that must contain all elements in the collection
|
static <T> BoundedList<T> |
createFromList(List<T> list,
java.util.function.Function<T,BoundingBox> extractBoundingBox)
Creates for a list, minimally fitting a bounding-box around all elements
|
static <T> BoundedList<T> |
createSingle(T element,
java.util.function.Function<T,BoundingBox> extractBoundingBox)
Creates for a single element using its current bounding-box.
|
T |
get(int index)
Gets a particular element.
|
List<T> |
list()
The collection of element with bounding-boxes.
|
int |
size()
The number of elements.
|
java.util.stream.Stream<T> |
stream()
A stream of elements in the list.
|
public static <T> BoundedList<T> createSingle(T element, java.util.function.Function<T,BoundingBox> extractBoundingBox)
element
- the single elementextractBoundingBox
- extracts a bounding box from an element. The operation is assumed
to involve no computational cost.public static <T> BoundedList<T> createFromList(List<T> list, java.util.function.Function<T,BoundingBox> extractBoundingBox)
list
- the listextractBoundingBox
- extracts a bounding box from an element. The operation is assumed
to involve no computational cost.public BoundedList<T> assignBoundingBox(BoundingBox boxToAssign)
The new box must contain the existing box.
boxToAssign
- the new bounding-box to assignpublic BoundedList<T> assignBoundingBoxAndMap(BoundingBox boxToAssign, java.util.function.UnaryOperator<T> mappingFunction)
The new box must contain the existing box.
boxToAssign
- the new bounding-box to assignmappingFunction
- applied to each element of the list to generate new elementpublic BoundedList<T> addObjectsNoBoundingBoxChange(Collection<T> elementsToAdd)
The operation is immutable.
elementsToAdd
- elements to add (unchanged)BoundedList
with existing and added elements and the same
bounding-boxpublic int size()
public T get(int index)
index
- the index to get an element at.index
.public java.util.stream.Stream<T> stream()
public List<T> list()
This collection should not be altered after the constructor (treated immutably).
public BoundingBox boundingBox()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.