checkpoint
authoradam <adam@megacz.com>
Sun, 16 Dec 2007 01:29:16 +0000 (17:29 -0800)
committeradam <adam@megacz.com>
Sun, 16 Dec 2007 01:29:16 +0000 (17:29 -0800)
darcs-hash:20071216012916-5007d-fc7f582f1183c0c48147ce8963935422eacc2940.gz

src/edu/berkeley/qfat/geom/RTree.java

index 2fab5f5..35b6f9b 100644 (file)
@@ -4,6 +4,7 @@ import java.util.*;
 import com.infomatiq.jsi.*;
 import com.infomatiq.jsi.rtree.*;
 
+/** wrapper around the <tt>com.infomatiq.jsi.rtree.RTree</tt> class */
 public class RTree<V extends HasBoundingBox> implements Iterable<V> {
 
     private com.infomatiq.jsi.rtree.RTree rtree =
@@ -15,10 +16,10 @@ public class RTree<V extends HasBoundingBox> implements Iterable<V> {
 
     public Iterator<V> iterator() { return vToId.keySet().iterator(); }
 
-    private final MyIntProcedure myIntProcedure = new MyIntProcedure();
+    private final MyIntProcedure myIntProcedure    = new MyIntProcedure();
     private final com.infomatiq.jsi.Rectangle rect = new com.infomatiq.jsi.Rectangle(0,0,0,0,0,0);
-    private final com.infomatiq.jsi.Point point = new com.infomatiq.jsi.Point(0,0,0);
-    private V found = null;
+    private final com.infomatiq.jsi.Point point    = new com.infomatiq.jsi.Point(0,0,0);
+    private V          found   = null;
     private Visitor<V> visitor = null;
 
     private static final Properties props = new Properties();
@@ -54,19 +55,6 @@ public class RTree<V extends HasBoundingBox> implements Iterable<V> {
         rtree.delete(rect, id);
     }
 
-    private class MyIntProcedure implements IntProcedure {
-        public boolean execute(int id) {
-            if (visitor != null) {
-                V v = idToV.get(id);
-                visitor.visit(v);
-                return true;
-            } else {
-                found = idToV.get(id);
-                return false;
-            }
-        }
-    }
-
     public V nearest(Point p) {
         point.set(p.x, p.y, p.z);
         rtree.nearest(point, myIntProcedure, Float.POSITIVE_INFINITY);
@@ -81,4 +69,16 @@ public class RTree<V extends HasBoundingBox> implements Iterable<V> {
         visitor = null;
     }
 
+    private class MyIntProcedure implements IntProcedure {
+        public boolean execute(int id) {
+            if (visitor != null) {
+                V v = idToV.get(id);
+                visitor.visit(v);
+                return true;
+            } else {
+                found = idToV.get(id);
+                return false;
+            }
+        }
+    }
 }