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

Method range

05Lab-Kd Tree/KdTree.java:102–107  ·  view source on GitHub ↗
(RectHV rect)

Source from the content-addressed store, hash-verified

100
101 // all points that are inside the rectangle (or on the boundary)
102 public Iterable<Point2D> range(RectHV rect) {
103 if (rect == null) throw new IllegalArgumentException();
104 ArrayList<Point2D> arrayList = new ArrayList<>();
105 if (!isEmpty()) range(root, rect, arrayList);
106 return arrayList;
107 }
108
109 private void range(Node nd, RectHV rect, ArrayList<Point2D> arrayList) {
110 if (rect.contains(nd.p)) arrayList.add(nd.p);

Callers

nothing calls this directly

Calls 2

isEmptyMethod · 0.95
containsMethod · 0.45

Tested by

no test coverage detected