Class/Object

archery

Node

Related Docs: object Node | package archery

Permalink

sealed abstract class Node[A] extends HasGeom

Abstract data type for nodes of the tree.

There are two types of Node: Branch and Leaf. Confusingly, leaves don't actaully hold values, but rather a leaf contains a sequence of entries. This design is commmon to RTree implementations and it seemed like a good idea to keep the nomenclature the same.

Self Type
Node[A]
Linear Supertypes
HasGeom, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Node
  2. HasGeom
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def box: Box

    Permalink
  2. abstract def children: Vector[HasGeom]

    Permalink
  3. abstract def remove(entry: Entry[A]): Option[(Joined[Entry[A]], Option[Node[A]])]

    Permalink

    Remove this entry from the tree.

    Remove this entry from the tree.

    The implementations for Leaf and Branch are somewhat involved, so they are defined in each subclass.

    The return value can be understood as follows:

    1. None: the entry was not found in this node. This is the most common case.

    2. Some((es, None)): the entry was found, and this node was removed (meaning after removal it had too few other children). The 'es' vector are entries that need to be readded to the RTree.

    3. Some((es, Some(node))): the entry was found, and this node should be replaced by 'node'. Like above, the 'es' vector contains entries that should be readded.

    Because adding entries may require rebalancing the tree, we defer the insertions until after the removal is complete and then readd them in RTree. While 'es' will usually be quite small, it's possible that in some cases it may be very large.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def contains(entry: Entry[A]): Boolean

    Permalink

    Determine if entry is contained in the tree.

    Determine if entry is contained in the tree.

    This method depends upon reasonable equality for A. It can only match an Entry(pt, x) if entry.value == x.value.

  7. def contract(gone: Geom, regen: ⇒ Box): Box

    Permalink

    Determine if we need to try contracting our bounding box based on the loss of 'geom'.

    Determine if we need to try contracting our bounding box based on the loss of 'geom'. If so, use the by-name parameter 'regen' to recalculate. Since regen is by-name, it won't be evaluated unless we need it.

  8. def count(space: Box): Int

    Permalink

    Count the number of entries contained within space.

  9. def entries: Vector[Entry[A]]

    Permalink

    Put all the entries this node contains (directly or indirectly) into a vector.

    Put all the entries this node contains (directly or indirectly) into a vector. Obviously this could be quite large in the case of a root node, so it should not be used for traversals.

  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def foldSearch[B](space: Box, init: B)(f: (B, Entry[A]) ⇒ B): B

    Permalink

    Combine the results of a search(space) into a single result.

  14. def genericSearch(space: Box, check: (Geom) ⇒ Boolean, f: (Entry[A]) ⇒ Boolean): Seq[Entry[A]]

    Permalink

    Search for all entries given a search space, spatial checking function, and criteria function.

    Search for all entries given a search space, spatial checking function, and criteria function.

    This method abstracts search and searchIntersection, where the check function is either space.contains or space.intersects, respectively.

  15. def geom: Geom

    Permalink
    Definition Classes
    NodeHasGeom
  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  18. def insert(entry: Entry[A]): Either[Vector[Node[A]], Node[A]]

    Permalink

    Insert a new Entry into the tree.

    Insert a new Entry into the tree.

    Since this node is immutable, the method will return a replacement. There are two possible situations:

    1. We can replace this node with a new node. This is the common case.

    2. This node was already "full", so we can't just replace it with a single node. Instead, we will split this node into (presumably) two new nodes, and return a vector of them.

    The reason we are using vector here is that it simplifies the implementation, and also because eventually we may support bulk insertion, where more than two nodes might be returned.

  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def iterator: Iterator[Entry[A]]

    Permalink

    Returns an iterator over all the entires this node contains (directly or indirectly).

    Returns an iterator over all the entires this node contains (directly or indirectly). Since nodes are immutable there is no concern over concurrent updates while using the iterator.

  21. def map[B](f: (A) ⇒ B): Node[B]

    Permalink

    Transform each entry's value using the given f, returning a new node.

  22. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. def nearest(pt: Point, d0: Double): Option[(Double, Entry[A])]

    Permalink

    Find the closest entry to pt that is within d0.

    Find the closest entry to pt that is within d0.

    This method will either return Some((distance, entry)) or None.

  24. def nearestK(pt: Point, k: Int, d0: Double, pq: PriorityQueue[(Double, Entry[A])]): Double

    Permalink

    Find the closest k entries to pt that are within d0, and add them to the given priority queue pq.

    Find the closest k entries to pt that are within d0, and add them to the given priority queue pq.

    This method returns the distance of the farthest entry that is still included.

  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. def pretty: String

    Permalink

    Method to pretty-print an r-tree.

    Method to pretty-print an r-tree.

    This method should only be called on small-ish trees! It will print one line for every branch, leaf, and entry, so for a tree with thousands of entries this will result in a very large string!

  28. def search(space: Box, f: (Entry[A]) ⇒ Boolean): Seq[Entry[A]]

    Permalink

    Search for all entries contained in the search space.

    Search for all entries contained in the search space.

    Points on the boundary of the search space will be included.

  29. def searchIntersection(space: Box, f: (Entry[A]) ⇒ Boolean): Seq[Entry[A]]

    Permalink

    Search for all entries intersecting the search space.

    Search for all entries intersecting the search space.

    Points on the boundary of the search space will be included.

  30. def searchIterator(space: Box, f: (Entry[A]) ⇒ Boolean): Iterator[Entry[A]]

    Permalink

    Return an iterator over the results of a search.

    Return an iterator over the results of a search.

    This produces the same elements as search(space, f).iterator(), without having to build an entire vector at once.

  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  32. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from HasGeom

Inherited from AnyRef

Inherited from Any

Ungrouped