Module org.arakhne.afc.gis.giscore
Package org.arakhne.afc.gis.tree
Interface GISTreeSet<P extends GISPrimitive,N extends GISTreeNode<P,N>>
-
- Type Parameters:
P
- is the type of the user data inside the node.N
- is the type of the nodes.
- All Superinterfaces:
Collection<P>
,Iterable<P>
,Set<P>
- All Known Implementing Classes:
AbstractGISTreeSet
,MapElementTreeSet
,MapPolylineTreeSet
,StandardGISTreeSet
,WeakGISTreeSet
public interface GISTreeSet<P extends GISPrimitive,N extends GISTreeNode<P,N>> extends Set<P>
This interface describes a tree that contains GIS primitives and that permits to find them according to there geo-location.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- See Also:
GISPrimitive
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Iterator<Rectangle2afp<?,?,?,?,?,?>>
boundsIterator()
Replies the bounding rectangles of the internal data-structure elements.int
computeSize()
Force the deep computation of the element count in this set.P
get(int index)
Replies the element at the specified index.P
get(GeoId identifier)
Replies the element which as the specified identifier.P
get(GeoLocation location)
Replies the element which as the specified location.Class<? extends P>
getElementType()
Replies the class of the components in this list.GISTreeSetNodeFactory<P,N>
getNodeFactory()
Replies the node factory used by this tree.Tree<P,N>
getTree()
Replies the internal tree data structure.N
getTreeNodeAt(double x, double y)
Replies the tree node that is containing the given coordinates.int
indexOf(Object obj)
Replies the index of the first instance the specified element.boolean
isTypeRecomputedAfterRemoval()
Replies if this informed tree set is trying to compute the best fitting type after a removal.Iterator<P>
iterator(Rectangle2afp<?,?,?,?,?,?> clipBounds)
Replies the set of elements that have an intersection with the specified rectangle.Iterator<P>
iterator(Rectangle2afp<?,?,?,?,?,?> clipBounds, int budget)
Replies the set of elements that have an intersection with the specified rectangle.void
setNodeFactory(GISTreeSetNodeFactory<P,N> factory)
Set the node factory used by this tree.void
setTypeRecomputedAfterRemoval(boolean update)
Set if this informed tree set is trying to compute the best fitting type after a removal.boolean
slowContains(Object obj)
Replies if the given object is inside the set by user a depth-first iteration on the internal tree.Iterable<P>
toIterable(Rectangle2afp<?,?,?,?,?,?> clipBounds)
Replies the set of elements that have an intersection with the specified rectangle.Iterable<P>
toIterable(Rectangle2afp<?,?,?,?,?,?> clipBounds, int budget)
Replies the set of elements that have an intersection with the specified rectangle.-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Method Detail
-
getTree
@Pure Tree<P,N> getTree()
Replies the internal tree data structure.- Returns:
- the internal tree data structure.
-
getTreeNodeAt
@Pure N getTreeNodeAt(double x, double y)
Replies the tree node that is containing the given coordinates.- Parameters:
x
- x coordinate.y
- y coordinate.- Returns:
- the tree node with the givne point inside, or
null
if the point is outside all the tree nodes.
-
setNodeFactory
void setNodeFactory(GISTreeSetNodeFactory<P,N> factory)
Set the node factory used by this tree.- Parameters:
factory
- the factory.
-
getNodeFactory
@Pure GISTreeSetNodeFactory<P,N> getNodeFactory()
Replies the node factory used by this tree.- Returns:
- the factory
-
isTypeRecomputedAfterRemoval
@Pure boolean isTypeRecomputedAfterRemoval()
Replies if this informed tree set is trying to compute the best fitting type after a removal. Iffalse
, this class will keep unchanged the previously computed type.- Returns:
true
if the type is recomputed after a removal,false
if not.
-
setTypeRecomputedAfterRemoval
void setTypeRecomputedAfterRemoval(boolean update)
Set if this informed tree set is trying to compute the best fitting type after a removal. Iffalse
, this class will keep unchanged the previously computed type.- Parameters:
update
- istrue
if the type is recomputed after a removal,false
if not.
-
getElementType
@Pure Class<? extends P> getElementType()
Replies the class of the components in this list.- Returns:
- the top most type of the array's elements.
-
get
@Pure P get(GeoId identifier)
Replies the element which as the specified identifier.This function is time consuming because the location of the primitive could not be retreived from the geoId.
- Parameters:
identifier
- is the identifier to text.- Returns:
- the entity or
null
if none was found.
-
get
@Pure P get(GeoLocation location)
Replies the element which as the specified location.- Parameters:
location
- is the location of the element to find.- Returns:
- the entity or
null
if none was found.
-
get
@Pure P get(int index)
Replies the element at the specified index.This method iterates until the right index.
- Parameters:
index
- the index.- Returns:
- the element at the given index.
- Throws:
IndexOutOfBoundsException
- in case of error.
-
computeSize
int computeSize()
Force the deep computation of the element count in this set.- Returns:
- the count of elements inside the tree.
-
slowContains
@Pure boolean slowContains(Object obj)
Replies if the given object is inside the set by user a depth-first iteration on the internal tree.- Parameters:
obj
- the object.- Returns:
true
of o is inside, otherwisefalse
- See Also:
Set.contains(Object)
-
indexOf
@Pure int indexOf(Object obj)
Replies the index of the first instance the specified element.This method iterates until the right index.
- Parameters:
obj
- the object.- Returns:
- the index or
-1
if the object was not inside this set.
-
iterator
@Pure Iterator<P> iterator(Rectangle2afp<?,?,?,?,?,?> clipBounds)
Replies the set of elements that have an intersection with the specified rectangle.This function replies the elements with a broad-first iteration on the elements' tree.
- Parameters:
clipBounds
- is the bounds outside which the elements will not be replied- Returns:
- the elements inside the specified bounds.
-
iterator
@Pure Iterator<P> iterator(Rectangle2afp<?,?,?,?,?,?> clipBounds, int budget)
Replies the set of elements that have an intersection with the specified rectangle.This function replies the elements with a broad-first iteration on the elements' tree.
- Parameters:
clipBounds
- is the bounds outside which the elements will not be repliedbudget
- is the maximal size of the replied list. If this value is negative, all the elements will be replied.- Returns:
- the elements inside the specified bounds.
-
boundsIterator
@Pure Iterator<Rectangle2afp<?,?,?,?,?,?>> boundsIterator()
Replies the bounding rectangles of the internal data-structure elements.- Returns:
- the bounding boxes in the data-structure.
-
toIterable
@Pure Iterable<P> toIterable(Rectangle2afp<?,?,?,?,?,?> clipBounds)
Replies the set of elements that have an intersection with the specified rectangle.This function replies the elements with a broad-first iteration on the elements' tree.
- Parameters:
clipBounds
- is the bounds outside which the elements will not be replied- Returns:
- the elements inside the specified bounds.
-
toIterable
@Pure Iterable<P> toIterable(Rectangle2afp<?,?,?,?,?,?> clipBounds, int budget)
Replies the set of elements that have an intersection with the specified rectangle.This function replies the elements with a broad-first iteration on the elements' tree.
- Parameters:
clipBounds
- is the bounds outside which the elements will not be repliedbudget
- is the maximal size of the replied list. If this value is negative, all the elements will be replied.- Returns:
- the elements inside the specified bounds.
-
-