[cooja] ContikiMoteType: Fix mapfile variable size parsing

For some longer variable names the lines are wrapped after the name
to display size information vertical aligned.
This commit is contained in:
Enrico Joerns 2014-08-05 17:25:38 +02:00
parent defcd1a34c
commit f5531dfa74

View file

@ -660,8 +660,17 @@ public class ContikiMoteType implements MoteType {
Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_1")
+ varName
+ Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_2"));
for (String line : mapFileData) {
Matcher matcher = pattern.matcher(line);
for (int idx = 0; idx < mapFileData.length; idx++) {
String parseString = mapFileData[idx];
Matcher matcher = pattern.matcher(parseString);
if (matcher.find()) {
return Integer.decode(matcher.group(1));
}
// second approach with lines joined
if (idx < mapFileData.length - 1) {
parseString += mapFileData[idx + 1];
}
matcher = pattern.matcher(parseString);
if (matcher.find()) {
return Integer.decode(matcher.group(1));
}