private void searchNodes(Node n, Interval interval, List<Node> result) { // Don't search nodes that don't exist. if (n == nil) { return; } // Skip all nodes that have got their max value below the start of // the given interval. if (interval.getLow() > n.max) { return; } // Search left children. if (n.left != nil) { searchNodes(n.left, interval, result); } // Check this node. if (n.i.compareTo(interval) == 0) { result.add(n); } // Skip all nodes to the right of nodes whose low value is past the end // of the given interval. if (interval.compareTo(n.i) < 0) { return; } // Otherwise, search right children. if (n.right != nil) { searchNodes(n.right, interval, result); } }
private void searchNodes(Node n, Interval interval, List<Node> result) { // Don't search nodes that don't exist. if (n == nil) { return; } // Skip all nodes that have got their max value below the start of // the given interval. if (interval.getLow() > n.max) { return; } // Search left children. if (n.left != nil) { searchNodes(n.left, interval, result); } // Check this node. if (n.i.compareTo(interval) == 0) { result.add(n); } // Skip all nodes to the right of nodes whose low value is past the end // of the given interval. if (interval.compareTo(n.i) < 0) { return; } // Otherwise, search right children. if (n.right != nil) { searchNodes(n.right, interval, result); } }
private void searchNodes(Node n, double point, List<Node> result) { // Don't search nodes that don't exist. if (n == nil) { return; } // Skip all nodes that have got their max value below the start of // the given interval. if (point > n.max) { return; } // Search left children. if (n.left != nil) { searchNodes(n.left, point, result); } // Check this node. if (n.i.compareTo(point) == 0) { result.add(n); } // Skip all nodes to the right of nodes whose low value is past the end // of the given interval. if (point < n.i.getLow()) { return; } // Otherwise, search right children. if (n.right != nil) { searchNodes(n.right, point, result); } }
private void searchNodes(Node n, double point, List<Node> result) { // Don't search nodes that don't exist. if (n == nil) { return; } // Skip all nodes that have got their max value below the start of // the given interval. if (point > n.max) { return; } // Search left children. if (n.left != nil) { searchNodes(n.left, point, result); } // Check this node. if (n.i.compareTo(point) == 0) { result.add(n); } // Skip all nodes to the right of nodes whose low value is past the end // of the given interval. if (point < n.i.getLow()) { return; } // Otherwise, search right children. if (n.right != nil) { searchNodes(n.right, point, result); } }
private boolean evaluateElement(Element element) { if (timeRepresentation.equals(TimeRepresentation.INTERVAL)) { IntervalSet timeSet = (IntervalSet) element.getAttribute("timeset"); if (timeSet != null) { for (Interval i : timeSet.toArray()) { if (visibleInterval.compareTo(i) == 0) { return true; } } } else if (keepNull) { return true; } } else { TimestampSet timeSet = (TimestampSet) element.getAttribute("timeset"); if (timeSet != null) { for (double t : timeSet.toPrimitiveArray()) { if (visibleInterval.compareTo(t) == 0) { return true; } } } else if (keepNull) { return true; } } return false; }