]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Contains method for QuadTree 25/4625/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 10 Dec 2020 11:21:41 +0000 (13:21 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 10 Dec 2020 11:21:41 +0000 (13:21 +0200)
gitlab #658

Change-Id: I37f8855694d803368fd433250e7c7adb053c21e1

bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java

index ce918484fd475b78183d23ad1af26f5a6b44f8e9..b22fa27035ef6eec49126a54415089ffb48a98d6 100644 (file)
@@ -104,6 +104,15 @@ public class QuadTree<T> {
                }
        }
        
+       public boolean contains(T object) {
+               if (leaf) {
+                       return contains.contains(object);
+               } else {
+                       return pXnY.contains(object) || pXpY.contains(object) || nXnY.contains(object) || nXpY.contains(object);
+               }
+               
+       }
+       
        /**
         * Returns objects within the given area.
         * @param bounds