use of org.gephi.graph.api.Interval in project gephi-plugins-bootcamp by gephi.
the class InteractiveSparkline method getDynamicNumberNumbers.
/**
* For getting x and y values from a dynamic number Use the intervals start
* time as X values
*/
private Number[][] getDynamicNumberNumbers(IntervalMap dynamicNumber) {
ArrayList<Number> xValuesList = new ArrayList<Number>();
ArrayList<Number> yValuesList = new ArrayList<Number>();
if (dynamicNumber == null) {
return new Number[2][0];
}
Number n;
for (Interval interval : dynamicNumber.toKeysArray()) {
n = (Number) dynamicNumber.get(interval, null);
if (n != null) {
xValuesList.add(interval.getLow());
yValuesList.add(n);
}
}
return new Number[][] { xValuesList.toArray(new Number[0]), yValuesList.toArray(new Number[0]) };
}
use of org.gephi.graph.api.Interval in project gephi by gephi.
the class ImportContainerImpl method setInterval.
@Override
public void setInterval(String startDateTime, String endDateTime) {
try {
double start, end;
if (startDateTime == null || startDateTime.isEmpty() || "-inf".equalsIgnoreCase(startDateTime) || "-infinity".equalsIgnoreCase(startDateTime)) {
start = Double.NEGATIVE_INFINITY;
} else {
start = timeFormat.equals(TimeFormat.DOUBLE) ? Double.parseDouble(startDateTime) : AttributeUtils.parseDateTime(startDateTime);
}
if (endDateTime == null || endDateTime.isEmpty() || "inf".equalsIgnoreCase(endDateTime) || "infinity".equalsIgnoreCase(endDateTime)) {
end = Double.POSITIVE_INFINITY;
} else {
end = timeFormat.equals(TimeFormat.DOUBLE) ? Double.parseDouble(endDateTime) : AttributeUtils.parseDateTime(endDateTime);
}
this.interval = new Interval(start, end);
} catch (Exception e) {
report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_Interval_Parse_Error", "[" + startDateTime + "," + endDateTime + "]"), Level.SEVERE));
return;
}
report.log(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerLog.GraphInterval", "[" + startDateTime + "," + endDateTime + "]"));
}
Aggregations