@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; }
@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; }
@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; }
@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; }
public IntervalWithValue(double low, double high, T value) { this.interval = new Interval(low, high); this.value = value; }
public IntervalWithValue(double low, double high, T value) { this.interval = new Interval(low, high); this.value = value; }
private Interval deserializeInterval(final DataInput is) throws IOException, ClassNotFoundException { double start = (Double) deserialize(is); double end = (Double) deserialize(is); return new Interval(start, end); }
private Interval deserializeInterval(final DataInput is) throws IOException, ClassNotFoundException { double start = (Double) deserialize(is); double end = (Double) deserialize(is); return new Interval(start, end); }
@Override public double getWeight(double timestamp) { synchronized (this) { Object weightValue = attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX]; if (weightValue instanceof Double) { throw new IllegalStateException("The weight is static, call getWeight() instead"); } TimeMap dynamicValue = (TimeMap) weightValue; if (dynamicValue == null) { return DEFAULT_DYNAMIC_EDGE_WEIGHT_WHEN_MISSING; } if (dynamicValue instanceof IntervalMap) { return (Double) ((IntervalMap) dynamicValue) .get(new Interval(timestamp, timestamp), DEFAULT_DYNAMIC_EDGE_WEIGHT_WHEN_MISSING); } else { return (Double) dynamicValue.get(timestamp, DEFAULT_DYNAMIC_EDGE_WEIGHT_WHEN_MISSING); } } }
@Override public double getWeight(double timestamp) { synchronized (this) { Object weightValue = attributes[GraphStoreConfiguration.EDGE_WEIGHT_INDEX]; if (weightValue instanceof Double) { throw new IllegalStateException("The weight is static, call getWeight() instead"); } TimeMap dynamicValue = (TimeMap) weightValue; if (dynamicValue == null) { return DEFAULT_DYNAMIC_EDGE_WEIGHT_WHEN_MISSING; } if (dynamicValue instanceof IntervalMap) { return (Double) ((IntervalMap) dynamicValue) .get(new Interval(timestamp, timestamp), DEFAULT_DYNAMIC_EDGE_WEIGHT_WHEN_MISSING); } else { return (Double) dynamicValue.get(timestamp, DEFAULT_DYNAMIC_EDGE_WEIGHT_WHEN_MISSING); } } }
@Override public void execute(Table table, Column column) { Class dynamicType = AttributeUtils.getIntervalMapType(column.getTypeClass()); AttributeColumnsController ac = Lookup.getDefault().lookup(AttributeColumnsController.class); Element[] rows = ac.getTableAttributeRows(table); Object[] values = new Object[rows.length]; Interval interval = new Interval(Double.parseDouble(start), Double.parseDouble(end)); for (int i = 0; i < values.length; i++) { try { IntervalMap val = (IntervalMap) dynamicType.newInstance(); val.put(interval, rows[i].getAttribute(column)); } catch (Exception e) { } } table.removeColumn(column); Column dynamicColumn = table.addColumn(column.getId(), column.getTitle(), dynamicType, null); for (int i = 0; i < values.length; i++) { rows[i].setAttribute(dynamicColumn, values[i]); } }
@Override public Graph filter(Graph graph) { visibleInterval = new Interval(range.getLowerDouble(), range.getUpperDouble()); List<Node> toRemoveNodes = new ArrayList<>(); for (Node n : graph.getNodes()) { if (!evaluateElement(n)) { toRemoveNodes.add(n); } } graph.removeAllNodes(toRemoveNodes); List<Edge> toRemoveEdge = new ArrayList<>(); for (Edge e : graph.getEdges()) { if (!evaluateElement(e)) { toRemoveEdge.add(e); } } graph.removeAllEdges(toRemoveEdge); graph.getModel().setTimeInterval(graph.getView(), visibleInterval); return graph; }
@Override public Interval getTimeBounds(GraphView view) { TimeStore timeStore = store.timeStore; store.autoReadLock(); try { double min = timeStore.getMin(getGraph(view)); double max = timeStore.getMax(getGraph(view)); return new Interval(min, max); } finally { store.autoReadUnlock(); } }
@Override public Interval getTimeBounds(GraphView view) { TimeStore timeStore = store.timeStore; store.autoReadLock(); try { double min = timeStore.getMin(getGraph(view)); double max = timeStore.getMax(getGraph(view)); return new Interval(min, max); } finally { store.autoReadUnlock(); } }
for (Node n : graph.getNodes()) { Integer randomDataValue = random.nextInt(21) + 1990; n.addInterval(new Interval(randomDataValue, Double.POSITIVE_INFINITY));
TimestampIntegerMap value = (TimestampIntegerMap) n.getAttribute("price"); Double priceFrom2007to2009Avg = (Double) value.get(new Interval(2007, 2009), Estimator.AVERAGE); System.out.println("With AVERAGE estimator: '" + n.getLabel() + "': " + priceFrom2007to2009Avg); Integer priceFrom2007to2009Max = (Integer) value.get(new Interval(2007, 2009), Estimator.MAX); System.out.println("With MAX estimator: '" + n.getLabel() + "': " + priceFrom2007to2009Max);
Interval interval = new Interval(low, high); for (int i = 0; i < rows.length; i++) { if (oldValues[i] != null) {
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();
switch (tr) { case INTERVAL: n.setAttribute(dynamicDegreeColumn, degree, new Interval(interval.getLow(), interval.getLow() + tick)); break; case TIMESTAMP: 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(dynamicCoefficientColumn, coef, new Interval(interval.getLow(), interval.getLow() + tick)); break; case TIMESTAMP: