projects
/
fleet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
79a94fc
)
ShipDescription: add support for conditional sections
author
Adam Megacz
<adam@megacz.com>
Sun, 20 Sep 2009 19:33:39 +0000
(12:33 -0700)
committer
Adam Megacz
<adam@megacz.com>
Sun, 20 Sep 2009 19:33:39 +0000
(12:33 -0700)
src/edu/berkeley/fleet/two/ShipDescription.java
patch
|
blob
|
history
diff --git
a/src/edu/berkeley/fleet/two/ShipDescription.java
b/src/edu/berkeley/fleet/two/ShipDescription.java
index
6752e70
..
19be168
100644
(file)
--- a/
src/edu/berkeley/fleet/two/ShipDescription.java
+++ b/
src/edu/berkeley/fleet/two/ShipDescription.java
@@
-40,6
+40,21
@@
public class ShipDescription implements Iterable<DockDescription> {
sectionName = sectionName.substring(1);
while(sectionName.endsWith("="))
sectionName = sectionName.substring(0, sectionName.length()-1);
sectionName = sectionName.substring(1);
while(sectionName.endsWith("="))
sectionName = sectionName.substring(0, sectionName.length()-1);
+ sectionName = sectionName.trim();
+
+ if (sectionName.indexOf(':') != -1) {
+ String subtype = sectionName.substring(sectionName.indexOf(':')+1);
+ sectionName = sectionName.substring(0, sectionName.indexOf(':'));
+ boolean good = false;
+ for(Class c = fleet.getClass(); c!=Object.class; c = c.getSuperclass()) {
+ if (subtype.equals(c.getSimpleName()))
+ good = true;
+ }
+ if (!good) {
+ sectionName = null;
+ continue;
+ }
+ }
sectionName = sectionName.trim().toLowerCase();
continue;
}
sectionName = sectionName.trim().toLowerCase();
continue;
}