- \r
- @Override\r
- public int getComponentCount() {\r
- return 2;\r
- }\r
- \r
- @Override\r
- public Datatype getComponentType(int index) {\r
- if (index==0) return keyType;\r
- if (index==1) return valueType;\r
- throw new IllegalArgumentException();\r
- }\r
- \r
- @Override\r
- public Datatype getComponentType(ChildReference path) {\r
- if (path==null) return this;\r
- if (path instanceof IndexReference) {\r
- IndexReference ir = (IndexReference) path;\r
- if (ir.index==0) return keyType.getComponentType(path.childReference);\r
- if (ir.index==1) return valueType.getComponentType(path.childReference);\r
- }\r
- if (path instanceof LabelReference) {\r
- LabelReference lr = (LabelReference) path;\r
- if (lr.label.equals("0") || lr.label.equals("key")) return keyType.getComponentType(path.childReference);\r
- if (lr.label.equals("1") || lr.label.equals("value")) return valueType.getComponentType(path.childReference);\r
- }\r
- if (path instanceof NameReference) {\r
- NameReference nr = (NameReference) path;\r
- if (nr.name.equals("key")) return keyType.getComponentType(path.childReference);\r
- if (nr.name.equals("value")) return valueType.getComponentType(path.childReference);\r
- }\r
- throw new IllegalArgumentException();\r
+
+ @Override
+ public int getComponentCount() {
+ return 2;
+ }
+
+ @Override
+ public Datatype getComponentType(int index) {
+ if (index==0) return keyType;
+ if (index==1) return valueType;
+ throw new IllegalArgumentException();
+ }
+
+ @Override
+ public Datatype getComponentType(ChildReference path) {
+ if (path==null) return this;
+ if (path instanceof IndexReference) {
+ IndexReference ir = (IndexReference) path;
+ if (ir.index==0) return keyType.getComponentType(path.childReference);
+ if (ir.index==1) return valueType.getComponentType(path.childReference);
+ }
+ if (path instanceof LabelReference) {
+ LabelReference lr = (LabelReference) path;
+ if (lr.label.equals("0") || lr.label.equals("key")) return keyType.getComponentType(path.childReference);
+ if (lr.label.equals("1") || lr.label.equals("value")) return valueType.getComponentType(path.childReference);
+ }
+ if (path instanceof NameReference) {
+ NameReference nr = (NameReference) path;
+ if (nr.name.equals("key")) return keyType.getComponentType(path.childReference);
+ if (nr.name.equals("value")) return valueType.getComponentType(path.childReference);
+ }
+ throw new IllegalArgumentException();