66import java .util .Map ;
77
88import de .uni_stuttgart .ils .reqif4j .datatypes .*;
9+ import de .uni_stuttgart .ils .reqif4j .specification .*;
910import org .w3c .dom .Element ;
1011import org .w3c .dom .Node ;
1112import org .w3c .dom .NodeList ;
1213
13- import de .uni_stuttgart .ils .reqif4j .specification .SpecHierarchy ;
14- import de .uni_stuttgart .ils .reqif4j .specification .SpecObject ;
15- import de .uni_stuttgart .ils .reqif4j .specification .SpecObjectType ;
16- import de .uni_stuttgart .ils .reqif4j .specification .SpecRelationType ;
17- import de .uni_stuttgart .ils .reqif4j .specification .SpecType ;
18- import de .uni_stuttgart .ils .reqif4j .specification .Specification ;
19- import de .uni_stuttgart .ils .reqif4j .specification .SpecificationType ;
20-
2114public class ReqIFCoreContent {
2215
2316
2417 private Map <String , Datatype > dataTypes = new LinkedHashMap <String , Datatype >();
2518 private Map <String , SpecType > specTypes = new LinkedHashMap <String , SpecType >();
2619 private Map <String , SpecObject > specObjects = new LinkedHashMap <String , SpecObject >();
20+ private Map <String , SpecRelation > specRelation = new LinkedHashMap <>();
2721 private Map <String , Specification > specifications = new LinkedHashMap <String , Specification >();
2822
2923
@@ -52,6 +46,12 @@ public Map<String, SpecObject> getSpecObjects() {
5246 public SpecObject getSpecObject (String id ) {
5347 return this .specObjects .get (id );
5448 }
49+ public Map <String , SpecRelation > getSpecRelation (){
50+ return this .specRelation ;
51+ }
52+ public SpecRelation getSpecRelation (String id ){
53+ return this .specRelation .get (id );
54+ }
5555
5656 public Map <String , Specification > getSpecifications () {
5757 return this .specifications ;
@@ -176,7 +176,19 @@ public ReqIFCoreContent(Element coreContent) {
176176 }
177177 }
178178
179-
179+
180+ if (coreContent .getElementsByTagName (ReqIFConst .SPEC_RELATION ).getLength () > 0 ){
181+ NodeList specRelations = coreContent .getElementsByTagName (ReqIFConst .SPEC_RELATION );
182+ for (int specrelation = 0 ; specrelation < specRelations .getLength (); specrelation ++) {
183+
184+ Node specRelation = specRelations .item (specrelation );
185+ String specRelID = specRelation .getAttributes ().getNamedItem (ReqIFConst .IDENTIFIER ).getTextContent ();
186+ String specRelTypeRef = ((Element )specRelation ).getElementsByTagName (ReqIFConst .SPEC_RELATION_TYPE_REF ).item (0 ).getTextContent ();
187+
188+
189+ this .specRelation .put (specRelID , new SpecRelation (specRelation , this .specTypes .get (specRelTypeRef )));
190+ }
191+ }
180192
181193
182194 if (coreContent .getElementsByTagName (ReqIFConst .SPECIFICATION ).getLength () > 0 ) {
@@ -186,7 +198,7 @@ public ReqIFCoreContent(Element coreContent) {
186198
187199 Node specification = specifications .item (spec );
188200 String specID = specification .getAttributes ().getNamedItem (ReqIFConst .IDENTIFIER ).getTextContent ();
189- String specTypeRef = ((Element )specification ).getElementsByTagName (ReqIFConst .SPECIFICATION_TYPE_REF ).item (0 ).getTextContent ();
201+ String specTypeRef = ((Element )specification ).getElementsByTagName (ReqIFConst .SPEC_TYPE_REF ).item (0 ).getTextContent ();
190202
191203 this .specifications .put (specID , new Specification (specification , this .specTypes .get (specTypeRef ), this .specObjects ));
192204 }
0 commit comments