Search in sources :

Example 11 with Interval

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]) };
}
Also used : ArrayList(java.util.ArrayList) Interval(org.gephi.graph.api.Interval)

Example 12 with Interval

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 + "]"));
}
Also used : Issue(org.gephi.io.importer.api.Issue) Interval(org.gephi.graph.api.Interval)

Aggregations

Interval (org.gephi.graph.api.Interval)12 ArrayList (java.util.ArrayList)3 Column (org.gephi.graph.api.Column)3 Graph (org.gephi.graph.api.Graph)3 Node (org.gephi.graph.api.Node)3 TimeRepresentation (org.gephi.graph.api.TimeRepresentation)3 Issue (org.gephi.io.importer.api.Issue)3 Element (org.gephi.graph.api.Element)2 GraphController (org.gephi.graph.api.GraphController)2 GraphModel (org.gephi.graph.api.GraphModel)2 IntervalMap (org.gephi.graph.api.types.IntervalMap)2 IntervalSet (org.gephi.graph.api.types.IntervalSet)2 AttributeColumnsController (org.gephi.datalab.api.AttributeColumnsController)1 AttributeDataColumn (org.gephi.desktop.datalab.tables.columns.AttributeDataColumn)1 ElementDataColumn (org.gephi.desktop.datalab.tables.columns.ElementDataColumn)1 DirectedGraph (org.gephi.graph.api.DirectedGraph)1 Edge (org.gephi.graph.api.Edge)1 GraphView (org.gephi.graph.api.GraphView)1 Subgraph (org.gephi.graph.api.Subgraph)1 ClusteringCoefficient (org.gephi.statistics.plugin.ClusteringCoefficient)1