Package org.gephi.io.importer.api

Examples of org.gephi.io.importer.api.NodeDraft


        if (id.isEmpty()) {
            report.logIssue(new Issue(NbBundle.getMessage(ImporterGraphML.class, "importerGraphML_error_nodeid"), Issue.Level.SEVERE));
            return;
        }

        NodeDraft node = null;
        if (container.nodeExists(id)) {
            node = container.getNode(id);
        } else {
            node = container.factory().newNodeDraft();
        }
        node.setId(id);

        //Parent
        if (parent != null) {
            node.setParent(parent);
        }

        if (!container.nodeExists(id)) {
            container.addNode(node);
        }
View Full Code Here


            }
        }

        EdgeDraft edge = container.factory().newEdgeDraft();

        NodeDraft nodeSource = container.getNode(source);
        NodeDraft nodeTarget = container.getNode(target);
        edge.setSource(nodeSource);
        edge.setTarget(nodeTarget);

        //Type
        if (!directed.isEmpty()) {
View Full Code Here

            Progress.switchToDeterminate(progressTicket, num_vertices);        //Progress

            verticesArray = new NodeDraft[num_vertices];
            for (int i = 0; i < num_vertices; i++) {
                NodeDraft node = container.factory().newNodeDraft();
                String label = "" + (i + 1);
                node.setId(label);
                node.setLabel(label);
                verticesArray[i] = node;
            }

            curLine = null;
            while (reader.ready()) {
View Full Code Here

        } else {
            String nodeId = nodeID(streamTokenizer);
            streamTokenizer.nextToken();

            if (streamTokenizer.ttype == '-') {
                NodeDraft nodeDraft = getOrCreateNode(nodeId);
                edgeStructure(streamTokenizer, nodeDraft);
            } else if (streamTokenizer.ttype == '[') {
                NodeDraft nodeDraft = getOrCreateNode(nodeId);
                nodeAttributes(streamTokenizer, nodeDraft);
            }
        }
    }
View Full Code Here

        }
    }

    protected NodeDraft getOrCreateNode(String id) {
        if (!container.nodeExists(id)) {
            NodeDraft nodeDraft = container.factory().newNodeDraft();
            nodeDraft.setId(id);
            container.addNode(nodeDraft);
            return nodeDraft;
        }
        return container.getNode(id);
    }
View Full Code Here

        if (id.isEmpty()) {
            report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_nodeid"), Issue.Level.SEVERE));
            return;
        }

        NodeDraft node = null;
        if (container.nodeExists(id)) {
            node = container.getNode(id);
        } else {
            node = container.factory().newNodeDraft();
        }
        node.setId(id);
        node.setLabel(label);

        //Parent
        if (parent != null) {
            node.setParent(parent);
        } else if (!pid.isEmpty()) {
            NodeDraft parentNode = container.getNode(pid);
            if (parentNode == null) {
                report.logIssue(new Issue(NbBundle.getMessage(ImporterGEXF.class, "importerGEXF_error_pid_notfound", pid, id), Issue.Level.SEVERE));
            } else {
                node.setParent(parentNode);
            }
View Full Code Here

            }
        }

        EdgeDraft edge = container.factory().newEdgeDraft();

        NodeDraft nodeSource = container.getNode(source);
        NodeDraft nodeTarget = container.getNode(target);
        edge.setSource(nodeSource);
        edge.setTarget(nodeTarget);

        //Type
        if (!edgeType.isEmpty()) {
View Full Code Here

        }

    }

    private void addNode(String id, String label) {
        NodeDraft node;
        if (!container.nodeExists(id)) {
            node = container.factory().newNodeDraft();
            node.setId(id);
            node.setLabel(label);
            container.addNode(node);
        }
    }
View Full Code Here

    private void addEdge(String source, String target) {
        addEdge(source, target, 1);
    }

    private void addEdge(String source, String target, float weight) {
        NodeDraft sourceNode;
        if (!container.nodeExists(source)) {
            sourceNode = container.factory().newNodeDraft();
            sourceNode.setId(source);
            container.addNode(sourceNode);
        } else {
            sourceNode = container.getNode(source);
        }
        NodeDraft targetNode;
        if (!container.nodeExists(target)) {
            targetNode = container.factory().newNodeDraft();
            targetNode.setId(target);
            container.addNode(targetNode);
        } else {
            targetNode = container.getNode(target);
        }
        EdgeDraft edge = container.getEdge(sourceNode, targetNode);
View Full Code Here

        return s.startsWith(";");
    }

    private void parseNodes(String[] tokens) {
        for (int i = 1; i < tokens.length; i++) {
            NodeDraft node = container.factory().newNodeDraft();
            String id = tokens[i];
            node.setId(id);
            container.addNode(node);
        }
    }
View Full Code Here

TOP

Related Classes of org.gephi.io.importer.api.NodeDraft

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.