Skip to content

Commit

Permalink
Merge branch '0.9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
eduramiba committed Dec 20, 2016
2 parents 893eb49 + 52d5dba commit d325411
Showing 1 changed file with 44 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,53 @@ protected void refresh() {
max = index.getMaxValue(column);
} else {
ElementIterable<? extends Element> iterable = AttributeUtils.isNodeColumn(column) ? graph.getNodes() : graph.getEdges();
double minN = Double.POSITIVE_INFINITY;
double maxN = Double.NEGATIVE_INFINITY;
for (Element el : iterable) {
if (column.isDynamic()) {
TimeMap timeMap = (TimeMap) el.getAttribute(column);
if (timeMap != null) {
Number numMin = (Number) timeMap.get(graph.getView().getTimeInterval(), Estimator.MIN);
Number numMax = (Number) timeMap.get(graph.getView().getTimeInterval(), Estimator.MAX);
if (numMin.doubleValue() < minN) {
min = numMin;
}
if (numMax.doubleValue() > maxN) {
max = numMax;
}
}
} else {
Number num = (Number) el.getAttribute(column);
if (num.doubleValue() < minN) {
min = num;
}
if (num.doubleValue() > maxN) {
max = num;
}

if (column.isDynamic()) {
refreshDynamic(iterable);
} else {
refreshNotIndexed(iterable);
}
}
}

protected void refreshDynamic(ElementIterable<? extends Element> iterable) {
double minN = Double.POSITIVE_INFINITY;
double maxN = Double.NEGATIVE_INFINITY;

for (Element el : iterable) {
TimeMap timeMap = (TimeMap) el.getAttribute(column);
if (timeMap != null) {
double numMin = ((Number) timeMap.get(graph.getView().getTimeInterval(), Estimator.MIN)).doubleValue();
double numMax = ((Number) timeMap.get(graph.getView().getTimeInterval(), Estimator.MAX)).doubleValue();
if (numMin < minN) {
minN = numMin;
}
if (numMax > maxN) {
maxN = numMax;
}
}
}

min = minN;
max = maxN;
}

protected void refreshNotIndexed(ElementIterable<? extends Element> iterable) {
double minN = Double.POSITIVE_INFINITY;
double maxN = Double.NEGATIVE_INFINITY;

for (Element el : iterable) {
double num = ((Number) el.getAttribute(column)).doubleValue();
if (num < minN) {
minN = num;
}
if (num > maxN) {
maxN = num;
}
}

min = minN;
max = maxN;
}

@Override
Expand Down

0 comments on commit d325411

Please sign in to comment.