[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:
parent
defcd1a34c
commit
f5531dfa74
@ -660,8 +660,17 @@ public class ContikiMoteType implements MoteType {
|
|||||||
Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_1")
|
Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_1")
|
||||||
+ varName
|
+ varName
|
||||||
+ Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_2"));
|
+ Cooja.getExternalToolsSetting("MAPFILE_VAR_SIZE_2"));
|
||||||
for (String line : mapFileData) {
|
for (int idx = 0; idx < mapFileData.length; idx++) {
|
||||||
Matcher matcher = pattern.matcher(line);
|
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()) {
|
if (matcher.find()) {
|
||||||
return Integer.decode(matcher.group(1));
|
return Integer.decode(matcher.group(1));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user