public class OTS2DSet extends Object implements Set<OTSShape>
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Class and Description |
---|---|
(package private) class |
OTS2DSet.QuadTreeIterator
Iterator for quad tree.
|
(package private) class |
OTS2DSet.QuadTreeNode
Spatial-aware storage for a set of OTSShape objects.
|
Constructor and Description |
---|
OTS2DSet(Rectangle2D boundingBox,
double minimumCellSize)
Construct an empty OTS2DSet for a rectangular region.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(OTSShape e) |
boolean |
addAll(Collection<? extends OTSShape> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
Set<OTSShape> |
intersectingShapes(OTSShape shape)
Return all OTSShapes in this OTS2DSet that intersect a given OTSShape.
|
Set<OTSShape> |
intersectingShapes(Rectangle2D rectangle)
Return the set of all shapes in this OTS2DSet that intersect the given rectangle.
|
boolean |
isEmpty() |
Iterator<OTSShape> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
(package private) String |
toString(int recursionDepth)
Recursively print this OTS2DSet.
|
String |
toStringGraphic(int recursionDepth)
Return an ASCII art rendering of this OTS2DSet.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, spliterator
parallelStream, removeIf, stream
public OTS2DSet(Rectangle2D boundingBox, double minimumCellSize) throws OTSGeometryException
add
method will return false,
indicating that the set has not been modified.)boundingBox
- Rectangle2D; the regionminimumCellSize
- double; resolution of the underlying quad treeOTSGeometryException
- when the bounding box covers no surfacepublic final int size()
public final boolean isEmpty()
public final boolean contains(Object o)
public final Object[] toArray()
public final <T> T[] toArray(T[] a)
public final boolean add(OTSShape e)
public final boolean remove(Object o)
public final boolean containsAll(Collection<?> c)
containsAll
in interface Collection<OTSShape>
containsAll
in interface Set<OTSShape>
public final boolean addAll(Collection<? extends OTSShape> c)
public final boolean retainAll(Collection<?> c)
public final boolean removeAll(Collection<?> c)
public final void clear()
public final Set<OTSShape> intersectingShapes(Rectangle2D rectangle)
rectangle
- Rectangle2D; the rectanglefinal String toString(int recursionDepth)
recursionDepth
- int; maximum depth to recursepublic final Set<OTSShape> intersectingShapes(OTSShape shape)
shape
- OTSShape; the given OTSShapeshape
public final String toStringGraphic(int recursionDepth)
recursionDepth
- int; maximum recursion depthCopyright © 2014–2016 Delft University of Technology. All rights reserved.