/** * Compares all SubPackage objects of two Package objects. * * @param xPackage Package from the Schema, of which all Packages should be compared. * @param gPackage Package from the SchemaGraph, of which all Packages should be compared. */ private final void compareAllSubPackages( de.uni_koblenz.jgralab.schema.Package xPackage, Package gPackage) { // Map of SubPackages is cloned Map<String, de.uni_koblenz.jgralab.schema.Package> subPackages = new HashMap<String, de.uni_koblenz.jgralab.schema.Package>(xPackage.getSubPackages()); // Loop over all ContainsSubPackage edges for (ContainsSubPackage containsSubPackage : gPackage.getContainsSubPackageIncidences(OUTGOING)) { assertTrue( "Omega should be an instance of \"Package\".", containsSubPackage.getOmega() instanceof Package); Package gSubPackage = containsSubPackage.getOmega(); de.uni_koblenz.jgralab.schema.Package subpackage = schema.getPackage(gSubPackage.get_qualifiedName()); // The references shouldn't be null assertTrue("There is no corresponding Package in Schema.", subpackage != null); assertTrue( "There is no corresponding Package in Schema.", subPackages.containsKey(subpackage.getSimpleName())); // Gets, removes and compares both Package objects with each other comparePackage(subPackages.remove(subpackage.getSimpleName()), gSubPackage); } // There shouldn't be any Package left in the map assertTrue( "There are more Packages in the Schema then in the SchemaGraph.", subPackages.isEmpty()); }