if (cancel) {
return;
}
//Create Node
NodeDraft node = container.factory().newNodeDraft();
Matcher m = pattern.matcher(nodeLine);
int count = 0;
String id = "";
while (m.find()) {
int start = m.start();
int end = m.end();
if (start != end) {
String data = nodeLine.substring(start, end);
data = data.trim();
if (!data.isEmpty() && !data.toLowerCase().equals("null")) {
if (count == 0) {
//Id
id = data;
node.setId(data);
} else if (count - 1 < nodeColumns.length) {
if (nodeColumns[count - 1] != null) {
setNodeData(node, nodeColumns[count - 1], data);
}
} else {
report.logIssue(new Issue(NbBundle.getMessage(ImporterGDF.class, "importerGDF_error_dataformat7", id), Issue.Level.SEVERE));
}
}
}
count++;
}
container.addNode(node);
Progress.progress(progressTicket); //Progress
}
//Edges
for (String edgeLine : edgeLines) {
if (cancel) {
return;
}
//Create Edge
EdgeDraft edge = container.factory().newEdgeDraft();
Matcher m = pattern.matcher(edgeLine);
int count = 0;
String id = "";
while (m.find()) {
int start = m.start();
int end = m.end();
if (start != end) {
String data = edgeLine.substring(start, end);
data = data.trim();
if (!data.isEmpty() && !data.toLowerCase().equals("null")) {
if (count == 0) {
NodeDraft nodeSource = container.getNode(data);
edge.setSource(nodeSource);
id = data;
} else if (count == 1) {
NodeDraft nodeTarget = container.getNode(data);
edge.setTarget(nodeTarget);
id += "," + data;
} else if (count - 2 < edgeColumns.length) {
if (edgeColumns[count - 2] != null) {
setEdgeData(edge, edgeColumns[count - 2], data);