class ImporterTGF implements FileImporter, LongTask {

    //Architecture
    private Reader reader;
    private ContainerLoader container;
    private Report report;
    private ProgressTicket progressTicket;
    private boolean cancel = false;

    @Override
    public boolean execute(ContainerLoader container) {
        this.container = container;
        this.report = new Report();
        LineNumberReader lineReader = ImportUtils.getTextReader(reader);
        try {
            importData(lineReader);
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            try {
                lineReader.close();
            } catch (IOException ex) {
            }
        }
        return !cancel;
    }

    private void importData(LineNumberReader reader) throws Exception {<FILL_FUNCTION_BODY>}

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

    private void addEdge(String source, String target, String label) {
        NodeDraft sourceNode;
        if (!container.nodeExists(source)) {
            sourceNode = container.factory().newNodeDraft(source);
            container.addNode(sourceNode);
        } else {
            sourceNode = container.getNode(source);
        }
        NodeDraft targetNode;
        if (!container.nodeExists(target)) {
            targetNode = container.factory().newNodeDraft(target);
            container.addNode(targetNode);
        } else {
            targetNode = container.getNode(target);
        }
        if (!container.edgeExists(sourceNode.getId(), targetNode.getId())) {
            EdgeDraft edge = container.factory().newEdgeDraft();
            edge.setSource(sourceNode);
            edge.setTarget(targetNode);
            if (label != null) {
                edge.setLabel(label);
            }
            container.addEdge(edge);
        }
    }

    @Override
    public void setReader(Reader reader) {
        this.reader = reader;
    }

    @Override
    public ContainerLoader getContainer() {
        return container;
    }

    @Override
    public Report getReport() {
        return report;
    }

    @Override
    public boolean cancel() {
        cancel = true;
        return true;
    }

    @Override
    public void setProgressTicket(ProgressTicket progressTicket) {
        this.progressTicket = progressTicket;
    }
}

        Progress.start(progressTicket);        //Progress

        List<String> nodes = new ArrayList<>();
        List<String> edges = new ArrayList<>();
        boolean isNode = true;
        for (; reader.ready(); ) {
            String line = reader.readLine().trim();
            if ("#".equalsIgnoreCase(line)) {
                isNode = false;
            } else if (line != null && !line.isEmpty()) {
                if (isNode) {
                    nodes.add(line);
                } else {
                    edges.add(line);
                }
            }
        }

        Progress.switchToDeterminate(progressTicket, nodes.size() + edges.size());

        if (nodes.isEmpty()) {
            report.logIssue(new Issue(NbBundle.getMessage(ImporterTGF.class, "importerTGF_error_emptynodes"),
                Issue.Level.CRITICAL));
        }
        for (String n : nodes) {
            if (n.contains(" ")) {
                addNode(n.substring(0, n.indexOf(" ")), n.substring(n.indexOf(" ")));
            } else {
                addNode(n, n);
            }
        }
        Progress.progress(progressTicket);      //Progress
        for (String e : edges) {
            int firstSpace = e.indexOf(" ");
            int secondSpace = e.indexOf(" ", firstSpace + 1);
            String[] tempFields = e.split(" ");
            String from = tempFields[0];
            String to = tempFields[1];
            if (secondSpace == -1) {
                addEdge(from, to, null);
            } else {
                addEdge(from, to, e.substring(secondSpace));
            }

        }
        Progress.progress(progressTicket);      //Progress
    
<no_super_class>