Package org.gephi.graph.api

Examples of org.gephi.graph.api.Attributes


                    switch (event.getEventType()) {
                        case REMOVE_EDGES:
                            if (!edgeDynamicColumns.isEmpty()) {
                                AttributeColumn[] dynamicCols = edgeDynamicColumns.toArray(new AttributeColumn[0]);
                                for (Edge e : event.getData().removedEdges()) {
                                    Attributes attributeRow = e.getEdgeData().getAttributes();
                                    for (int i = 0; i < dynamicCols.length; i++) {
                                        DynamicType<?> ti = (DynamicType) attributeRow.getValue(dynamicCols[i].getIndex());
                                        if (ti != null) {
                                            for (Interval interval : ti.getIntervals(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)) {
                                                timeIntervalIndex.remove(interval);
                                            }
                                        }
                                    }
                                }
                            }
                            break;
                        case REMOVE_NODES:
                            if (!nodeDynamicColumns.isEmpty()) {
                                AttributeColumn[] dynamicCols = edgeDynamicColumns.toArray(new AttributeColumn[0]);
                                for (Node n : event.getData().removedNodes()) {
                                    Attributes attributeRow = n.getNodeData().getAttributes();
                                    for (int i = 0; i < dynamicCols.length; i++) {
                                        DynamicType<?> ti = (DynamicType) attributeRow.getValue(dynamicCols[i].getIndex());
                                        if (ti != null) {
                                            for (Interval interval : ti.getIntervals(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)) {
                                                timeIntervalIndex.remove(interval);
                                            }
                                        }
View Full Code Here


        }
        AttributeColumn[] dynamicCols = nodeDynamicColumns.toArray(new AttributeColumn[0]);
        if (dynamicCols.length > 0) {
            Graph graph = graphModel.getGraph();
            for (Node n : graph.getNodes()) {
                Attributes attributeRow = n.getNodeData().getAttributes();
                for (int i = 0; i < dynamicCols.length; i++) {
                    DynamicType<?> ti = (DynamicType) attributeRow.getValue(dynamicCols[i].getIndex());
                    if (ti != null) {
                        for (Interval interval : ti.getIntervals(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)) {
                            timeIntervalIndex.add(interval);
                        }
                    }
                }
            }
        }
        for (AttributeColumn col : attributeModel.getNodeTable().getColumns()) {
            if (col.getType().isDynamicType()) {
                edgeDynamicColumns.add(col);
            }
        }
        dynamicCols = nodeDynamicColumns.toArray(new AttributeColumn[0]);
        if (dynamicCols.length > 0) {
            Graph graph = graphModel.getGraph();
            for (Edge e : graph.getEdges()) {
                Attributes attributeRow = e.getEdgeData().getAttributes();
                for (int i = 0; i < dynamicCols.length; i++) {
                    DynamicType<?> ti = (DynamicType) attributeRow.getValue(dynamicCols[i].getIndex());
                    if (ti != null) {
                        for (Interval interval : ti.getIntervals(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)) {
                            timeIntervalIndex.add(interval);
                        }
                    }
View Full Code Here

  @Override
  public Object[] getAttributesValues(Node node, Interval interval, Estimator[] estimators) {
    checkEstimators(node, estimators);

    Attributes attributes = node.getNodeData().getAttributes();
    Object[]   values     = new Object[attributes.countValues()];

    for (int i = 0; i < attributes.countValues(); ++i) {
      values[i] = attributes.getValue(i);
      if (values[i] instanceof DynamicType)
        values[i] = ((DynamicType)values[i]).getValue(estimators[i]);
    }

    return values;
View Full Code Here

  @Override
  public Object[] getAttributesValues(Edge edge, Interval interval, Estimator[] estimators) {
    checkEstimators(edge, estimators);

    Attributes attributes = edge.getEdgeData().getAttributes();
    Object[]   values     = new Object[attributes.countValues()];

    for (int i = 0; i < attributes.countValues(); ++i) {
      values[i] = attributes.getValue(i);
      if (values[i] instanceof DynamicType)
        values[i] = ((DynamicType)values[i]).getValue(estimators[i]);
    }

    return values;
View Full Code Here

        public Object getValueFor(ImmutableTreeNode node) {
            Node graphNode = node.getNode();
            if (graphNode.getId() == -1) {
                return null;
            }
            Attributes row = graphNode.getNodeData().getAttributes();
            Object value = row.getValue(column.getIndex());

            if (useSparklines && (attributeUtils.isNumberListColumn(column) || attributeUtils.isDynamicNumberColumn(column))) {
                return value;
            } else if (column.getType() == AttributeType.TIME_INTERVAL) {
                return value;
View Full Code Here

            }
        }
    }

    public void copyNodeDataToOtherNodes(Node node, Node[] otherNodes, AttributeColumn[] columnsToCopy) {
        Attributes row = node.getNodeData().getAttributes();
        Attributes[] otherRows = new Attributes[otherNodes.length];
        for (int i = 0; i < otherNodes.length; i++) {
            otherRows[i] = otherNodes[i].getNodeData().getAttributes();
        }
View Full Code Here

        copyRowDataToOtherRows(row, otherRows, columnsToCopy);
    }

    public void copyEdgeDataToOtherEdges(Edge edge, Edge[] otherEdges, AttributeColumn[] columnsToCopy) {
        Attributes row = edge.getEdgeData().getAttributes();
        Attributes[] otherRows = new Attributes[otherEdges.length];
        for (int i = 0; i < otherEdges.length; i++) {
            otherRows[i] = otherEdges[i].getEdgeData().getAttributes();
        }
View Full Code Here

            //Create nodes:
            GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
            Graph graph = Lookup.getDefault().lookup(GraphController.class).getModel().getGraph();
            String id = null;
            Node node;
            Attributes nodeAttributes;
            reader = new CsvReader(new FileInputStream(file), separator, charset);
            reader.readHeaders();
            while (reader.readRecord()) {
                //Prepare the correct node to assign the attributes:
                if (idColumn != null) {
View Full Code Here

            Edge edge;
            String sourceId, targetId;
            Node source, target;
            String type;
            boolean directed;
            Attributes edgeAttributes;
            reader = new CsvReader(new FileInputStream(file), separator, charset);
            reader.readHeaders();
            while (reader.readRecord()) {
                sourceId = reader.get(sourceColumn);
                targetId = reader.get(targetColumn);
View Full Code Here

            return findNext(result);//Go to next search result
        }
        AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
        Object value;
        String str;
        Attributes attributes;
        AttributeColumn column;

        if (!result.getSearchOptions().isUseRegexReplaceMode()) {
            replacement = Matcher.quoteReplacement(replacement);//Avoid using groups and other regex aspects in the replacement
        }

        try {
            //Get value to re-match and replace:
            if (result.getFoundNode() != null) {
                attributes = result.getFoundNode().getNodeData().getAttributes();
                column = ac.getModel().getNodeTable().getColumn(result.getFoundColumnIndex());
            } else {
                attributes = result.getFoundEdge().getEdgeData().getAttributes();
                column = ac.getModel().getEdgeTable().getColumn(result.getFoundColumnIndex());
            }
            value = attributes.getValue(result.getFoundColumnIndex());
            str = value != null ? value.toString() : "";
            StringBuffer sb = new StringBuffer();

            //Match and replace the result:
            Matcher matcher = result.getSearchOptions().getRegexPattern().matcher(str.substring(result.getStart()));
View Full Code Here

TOP

Related Classes of org.gephi.graph.api.Attributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.