MCPcopy Create free account
hub / github.com/MolinDeng/Princeton-algs4 / range

Method range

05Lab-Kd Tree/PointSET.java:54–60  ·  view source on GitHub ↗
(RectHV rect)

Source from the content-addressed store, hash-verified

52
53 // all points that are inside the rectangle (or on the boundary)
54 public Iterable<Point2D> range(RectHV rect) {
55 if (rect == null) throw new IllegalArgumentException();
56 ArrayList<Point2D> arrayList = new ArrayList<>();
57 for (Point2D p : treeSet)
58 if (rect.contains(p)) arrayList.add(p);
59 return arrayList;
60 }
61
62 // a nearest neighbor in the set to point p; null if the set is empty
63 public Point2D nearest(Point2D p) {

Callers

nothing calls this directly

Calls 1

containsMethod · 0.45

Tested by

no test coverage detected