MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / AdjustTree

Method AdjustTree

JSAT/src/jsat/linear/vectorcollection/RTree.java:776–826  ·  view source on GitHub ↗
(RNode<V> L, RNode<V> LL)

Source from the content-addressed store, hash-verified

774 }
775
776 private void AdjustTree(RNode<V> L, RNode<V> LL)
777 {
778 /*
779 * AT1 [Imtlahze.] Set N=L If L was split
780 * previously, set NN to be the resultmg
781 * second node
782 */
783 RNode<V> N = L, NN = LL;
784
785 while(N != root)//AT2 [Check If done ] If N 1s the root, stop
786 {
787 /*
788 * AT3 [Adjust covermg rectangle m parent
789 * entry ] Let P be the parent node of
790 * N, and let EN be N’s entry in P
791 * Adjust EN I so that it tightly encloses
792 * all entry rectangles in N.
793 */
794 RNode<V> P = N.parent;
795 P.bound.adjustToContain(N.bound);//P alread contains us, so we dont add ourselves again!
796 if(NN != null)
797 {
798 /*
799 * AT4 [Propagate node split upward] If N has a partner NN resultmg from an
800 * earher spht, create a new entry Em with ENNp pointmg to NN and Em I
801 * enclosing all rectangles in NN. Add Em to P If there is room. Otherwise,
802 * invoke SplitNode to produce P and PP containing Em and all P’s old
803 * entries
804 */
805 if(P.add(NN))
806 NN = splitNode(P); //Asignment is part of step AT5 below
807 else
808 NN = null;
809 }
810 /*
811 * AT5 [Move up to next level.] Set N=P and
812 * set NN=PP If a spht occurred,
813 * Repeat from AT2.
814 */
815 N = P;
816 }
817
818 //Step I4 [Grow tree taller]
819 if(NN != null)//That means we caues the root to split! Need a new root!
820 {
821 root = new RNode<V>();
822 root.add(N);
823 root.add(NN);
824 }
825
826 }
827
828 public void add(V v)
829 {

Callers 1

addMethod · 0.95

Calls 3

splitNodeMethod · 0.95
adjustToContainMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected