@Override public Interval[] toArray() { Interval[] res = new Interval[size]; for (int i = 0; i < size; i++) { res[i] = new Interval(array[i * 2], array[i * 2 + 1]); } return res; }
switch (tr) { case INTERVAL: n.setAttribute(dynamicDegreeColumn, degree, new Interval(interval.getLow(), interval.getLow() + tick)); break; case TIMESTAMP: n.setAttribute(dynamicDegreeColumn, degree, interval.getLow()); n.setAttribute(dynamicDegreeColumn, degree, interval.getHigh()); break; n.setAttribute(dynamicInDegreeColumn, indegree, new Interval(interval.getLow(), interval.getLow() + tick)); n.setAttribute(dynamicOutDegreeColumn, outdegree, new Interval(interval.getLow(), interval.getLow() + tick)); break; case TIMESTAMP: n.setAttribute(dynamicInDegreeColumn, indegree, interval.getLow()); n.setAttribute(dynamicInDegreeColumn, indegree, interval.getHigh()); n.setAttribute(dynamicOutDegreeColumn, outdegree, interval.getLow()); n.setAttribute(dynamicOutDegreeColumn, outdegree, interval.getHigh()); break; averages.put(interval.getLow(), avg); averages.put(interval.getHigh(), avg); graphModel.getGraphVisible().setAttribute(DYNAMIC_AVGDEGREE, avg, interval.getLow()); graphModel.getGraphVisible().setAttribute(DYNAMIC_AVGDEGREE, avg, interval.getHigh());
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); } }
public Node(Interval key, int value) { color = BLACK; i = key; v = value; max = i.getHigh(); } }
@Override protected double getLow(Interval interval) { return interval.getLow(); }
private Node findNode(Node z, Interval i) { if (z != null) { if (z.i != null && z.i.equals(i)) { return z; } else if (z.i == null) { return null; } boolean cmp = compareLow(i, z.i); if (z.left != null && cmp && i.getHigh() <= z.left.max) { Node r = findNode(z.left, i); if (r != null) { return r; } } if (z.right != null && !cmp && i.getHigh() <= z.right.max) { Node r = findNode(z.right, i); if (r != null) { return r; } } } return null; }
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; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Entry other = (Entry) obj; if (this.value != other.value) { return false; } if (this.key != other.key && (this.key == null || !this.key.equals(other.key))) { return false; } return true; } }
n.setAttribute(dynamicCoefficientColumn, coef, new Interval(interval.getLow(), interval.getLow() + tick)); break; case TIMESTAMP: n.setAttribute(dynamicCoefficientColumn, coef, interval.getLow()); n.setAttribute(dynamicCoefficientColumn, coef, interval.getHigh()); break; graphModel.getGraphVisible().setAttribute(DYNAMIC_AVG_CLUSTERING_COEFFICIENT, avg, interval.getLow()); graphModel.getGraphVisible().setAttribute(DYNAMIC_AVG_CLUSTERING_COEFFICIENT, avg, interval.getHigh()); averages.put(interval.getLow(), avg); averages.put(interval.getHigh(), avg);
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); } }
public Node(Interval key, int value) { color = BLACK; i = key; v = value; max = i.getHigh(); } }
@Override protected double getLow(Interval interval) { return interval.getLow(); }
private Node findNode(Node z, Interval i) { if (z != null) { if (z.i != null && z.i.equals(i)) { return z; } else if (z.i == null) { return null; } boolean cmp = compareLow(i, z.i); if (z.left != null && cmp && i.getHigh() <= z.left.max) { Node r = findNode(z.left, i); if (r != null) { return r; } } if (z.right != null && !cmp && i.getHigh() <= z.right.max) { Node r = findNode(z.right, i); if (r != null) { return r; } } } return null; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Entry other = (Entry) obj; if (this.value != other.value) { return false; } if (this.key != other.key && (this.key == null || !this.key.equals(other.key))) { return false; } return true; } }
@Override public Interval[] toKeysArray() { Interval[] res = new Interval[size]; for (int i = 0; i < size; i++) { res[i] = new Interval(array[i * 2], array[i * 2 + 1]); } return res; }
int c = (int) ((bounds.getHigh() - window - bounds.getLow()) / tick); dynamicLongTask.start(c); for (double low = bounds.getLow(); low <= bounds.getHigh() - window; low += tick) { double high = low + window; for (Node node : nodeIndex.get(new Interval(low, high))) { g.addNode(node); for (Edge edge : edgeIndex.get(new Interval(low, high))) { if (g.contains(edge.getSource()) && g.contains(edge.getTarget())) { g.addEdge(edge); statistics.loop(g.getView(), new Interval(low, high)); } finally { graph.writeUnlock();
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 computeMax(Node x) { if (x.left == nil && x.right == nil) { x.max = x.i.getHigh(); } else if (x.left == nil) { x.max = Math.max(x.i.getHigh(), x.right.max); } else if (x.right == nil) { x.max = Math.max(x.i.getHigh(), x.left.max); } else { x.max = Math.max(x.i.getHigh(), Math.max(x.left.max, x.right.max)); } }