int v_id = Integer.parseInt(index) - 1; // go from 1-based to 0-based index
if (v_id >= num_vertices || v_id < 0) {
report.logIssue(new Issue(NbBundle.getMessage(ImporterPajek.class, "importerNET_error_dataformat4", v_id, num_vertices), Issue.Level.SEVERE));
}
NodeDraft node = verticesArray[v_id];
// only attach the label if there's one to attach
if (label != null && label.length() > 0) {
node.setLabel(label);
}
// parse the rest of the line
if (firstParts != -1 && parts != null && parts.length >= firstParts + 2) {
int i = firstParts;
//Coordinates
if (i < parts.length - 1) {
try {
float x = Float.parseFloat(parts[i]);
float y = Float.parseFloat(parts[i + 1]);
node.setX(x);
node.setY(y);
i++;
} catch (Exception e) {
report.logIssue(new Issue(NbBundle.getMessage(ImporterPajek.class, "importerNET_error_dataformat5", lineReader.getLineNumber()), Issue.Level.WARNING));
}
}
//Size
if (i < parts.length - 1) {
try {
float size = Float.parseFloat(parts[i]);
node.setSize(size);
i++;
} catch (Exception e) {
report.logIssue(new Issue(NbBundle.getMessage(ImporterPajek.class, "importerNET_error_dataformat6", lineReader.getLineNumber()), Issue.Level.WARNING));
}
}
// parse colors
for (; i < parts.length - 1; i++) {
// node's internal color
if ("ic".equals(parts[i])) {
String colorName = parts[i + 1].replaceAll(" ", ""); // remove spaces from color's name so we can look it up
Color color = getPajekColorFromName(colorName);
node.setColor(color);
break;
}
}
}
}