From: Marko Luukkainen Date: Thu, 10 Dec 2020 11:21:41 +0000 (+0200) Subject: Contains method for QuadTree X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F25%2F4625%2F1;p=simantics%2Fplatform.git Contains method for QuadTree gitlab #658 Change-Id: I37f8855694d803368fd433250e7c7adb053c21e1 --- diff --git a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java index ce918484f..b22fa2703 100644 --- a/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java +++ b/bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/collections/QuadTree.java @@ -104,6 +104,15 @@ public class QuadTree { } } + 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