Commit 80ba2ab9 authored by patrick.lambert's avatar patrick.lambert
Browse files

bug fix in ( )

parent cdf4e2f9
......@@ -77,48 +77,47 @@ public class RIOBasinNetworkObserverPresence extends ObserverListener implements
public void init(Pilot pilot) {
this.pilot = pilot;
if (this.colorScaleEnum == null) {
if (this.colorScaleEnum == null)
this.colorScaleEnum = ColorScaleEnum.RedsScale;
try {
// open the file
FileReader reader = new FileReader(presenceFileName);
// Parsing the file
Scanner scanner = new Scanner(reader);
scanner.useLocale(Locale.ENGLISH); // to have a point as decimal
// separator !!!
// scanner.useDelimiter(Pattern.compile("[;,\r\n]"));
// read the headers
String[] headers = scanner.nextLine().split(",");
presences = new TreeMap<String, Map<String, Integer>>();
for (int i = 2; i < headers.length; i++) {
presences.put(headers[i], new TreeMap<String, Integer>());
}
try {
// open the file
FileReader reader = new FileReader(presenceFileName);
// Parsing the file
Scanner scanner = new Scanner(reader);
scanner.useLocale(Locale.ENGLISH); // to have a point as decimal
// separator !!!
// scanner.useDelimiter(Pattern.compile("[;,\r\n]"));
// read the headers
String[] headers = scanner.nextLine().split(",");
presences = new TreeMap<String, Map<String, Integer>>();
for (int i = 2; i < headers.length; i++) {
presences.put(headers[i], new TreeMap<String, Integer>());
}
// read the lines
while (scanner.hasNextLine()) {
String[] fields = scanner.nextLine().split(",");
// System.out.println(Arrays.toString(fields));
// read the lines
while (scanner.hasNextLine()) {
String[] fields = scanner.nextLine().split(",");
// System.out.println(Arrays.toString(fields));
for (int j = 2; j < headers.length; j++) {
if (j >= fields.length)
for (int j = 2; j < headers.length; j++) {
if (j >= fields.length)
presences.get(headers[j]).put(fields[1], -1);
else {
if (fields[j].compareTo("") == 0)
presences.get(headers[j]).put(fields[1], -1);
else {
if (fields[j].compareTo("") == 0)
presences.get(headers[j]).put(fields[1], -1);
else
presences.get(headers[j]).put(fields[1], Integer.valueOf(fields[j]));
}
else
presences.get(headers[j]).put(fields[1], Integer.valueOf(fields[j]));
}
}
// reader.close();
// scanner.close();
} catch (Exception e) {
e.printStackTrace();
}
// reader.close();
// scanner.close();
} catch (Exception e) {
e.printStackTrace();
}
// the Jpanal that holds all the components to be displayed
display = new JPanel(new BorderLayout());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment