}
//Get Compound Roles
for(int j =0; j < superRolesTreeModel.getChildCount(superRolesTopNode);j++){
String currentSuperRoleName = superRolesTreeModel.getChild(superRolesTopNode, j).toString();
CompoundRole currentSuperRole = new CompoundRole(currentSuperRoleName);
allCompoundRoles.add(currentSuperRole);
SuperRolesTreeNode currentNode = (SuperRolesTreeNode) superRolesTreeModel.getChild(superRolesTopNode, j);
// Get all Children of each Compound Role Branches
for(int i =0; i < superRolesTreeModel.getChildCount(currentNode);i++){
String currentRoleName = (String) superRolesTreeModel.getChild(currentNode, i).toString();
for (int t=0;t<allRoles.size();t++) {
Iterator<?> it = allRoles.iterator();
while (it.hasNext()) {
Role currentRole = (Role) it.next();
if (currentRoleName.equals(currentRole.name)) {
currentRole.addAncestor(currentSuperRole);
currentSuperRole.addRole(currentRole);
}
}
}
}
}
//Get Compound Groups
for(int j =0; j < superGroupsTreeModel.getChildCount(superGroupsTopNode);j++){
String currentSuperGroupName = superGroupsTreeModel.getChild(superGroupsTopNode, j).toString();
CompoundGroup currentSuperGroup = new CompoundGroup(currentSuperGroupName);
allCompoundGroups.add(currentSuperGroup);
SuperGroupsTreeNode currentNode = (SuperGroupsTreeNode) superGroupsTreeModel.getChild(superGroupsTopNode, j);
// Get all Children of each Compound Group Branches
for(int i =0; i < superGroupsTreeModel.getChildCount(currentNode);i++){
String currentGroupName = (String) superGroupsTreeModel.getChild(currentNode, i).toString();
Iterator<?> it = allGroups.iterator();
while (it.hasNext()) {
Group currentGroup = (Group) it.next();
if (currentGroupName.equals(currentGroup.name)) {
currentGroup.addAncestor(currentSuperGroup);
currentSuperGroup.addGroup(currentGroup);
}
}
}
}
//Fill empty sets
Iterator<?> it = allAssignedComponents.iterator();
while (it.hasNext()) {
Component currentComponent = (Component) it.next();
if (currentComponent.roleAncestor.size() == 0) {
currentComponent.addAncestorRole(new Role(""));
}
}
it = allGroups.iterator();
while (it.hasNext()) {
Group currentGroup = (Group) it.next();
if (currentGroup.children.size() == 0) {
currentGroup.addChild(new Component(""));
}
if (currentGroup.ancestors.size() == 0) {
currentGroup.addAncestor(new CompoundGroup(""));
}
}
it = allRoles.iterator();
while (it.hasNext()) {
Role currentRole = (Role) it.next();
if (currentRole.children.size() == 0) {
currentRole.addChild(new Component(""));
}
if (currentRole.ancestors.size() == 0) {
currentRole.addAncestor(new CompoundRole(""));
}
}
}