Skip to content
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.

Commit

Permalink
Fix bug 860825
Browse files Browse the repository at this point in the history
  • Loading branch information
mbastian committed Sep 29, 2011
1 parent 7d8c0c2 commit 908cb1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ importerNET_error_dataformat2 = Blank line detected at line {0}
importerNET_error_dataformat3 = Unbalanced (or too many) quote marks at line {0}
importerNET_error_dataformat4 = Vertex number ''{0}'' not in the range [1,{1}]
importerNET_error_dataformat5 = Vertex coordinates conversion problem at line {0}. Must be float number.
importerNET_error_dataformat6 = Vertex size conversion problem at line {0}. Must be float number.
importerNET_error_dataformat7 = Edge weight parsing issue at line {0}. Must be a float number.

importerGraphML_error_syntax1 = Syntax error, the file must start with the <graphml> markup.
importerGraphML_error_syntax2 = Syntax error, node ''{0}'' must be nested in a <graph> markup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class ImporterPajek implements FileImporter, LongTask {

// Crayola colors used by Pajek
private static final HashMap<String, Integer> PAJEK_COLORS = new HashMap<String, Integer>();

static {
PAJEK_COLORS.put("Apricot", 0xFDD9B5);
PAJEK_COLORS.put("Aquamarine", 0x78DBE2);
Expand Down Expand Up @@ -144,7 +145,6 @@ public class ImporterPajek implements FileImporter, LongTask {
PAJEK_COLORS.put("YellowGreen", 0xC5E384);
PAJEK_COLORS.put("YellowOrange", 0xFFB653);
}

//Architecture
private Reader reader;
private LineNumberReader lineReader;
Expand Down Expand Up @@ -308,13 +308,27 @@ private void readVertex(String curLine, int num_vertices) throws Exception {
}
}

//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;
}
}
}
Expand Down Expand Up @@ -383,7 +397,7 @@ private String readArcsOrEdges(String curLine, BufferedReader br) throws Excepti
try {
edgeWeight = new Float(st.nextToken());
} catch (Exception e) {
report.logIssue(new Issue(NbBundle.getMessage(ImporterPajek.class, "importerNET_error_dataformat5", lineReader.getLineNumber()), Issue.Level.WARNING));
report.logIssue(new Issue(NbBundle.getMessage(ImporterPajek.class, "importerNET_error_dataformat7", lineReader.getLineNumber()), Issue.Level.WARNING));
}

edge.setWeight(edgeWeight);
Expand Down

0 comments on commit 908cb1a

Please sign in to comment.