if (contextObject instanceof Model) {
Model model = (Model) contextObject;
if (elementName.equals("listOfGroups")) {
GroupsModelPlugin groupModelPlugin = new GroupsModelPlugin(model);
model.addExtension(GroupsConstants.namespaceURI, groupModelPlugin);
return groupModelPlugin.getListOfGroups();
}
} else if (contextObject instanceof Group) {
Group group = (Group) contextObject;
if (elementName.equals("listOfMembers")) {
return group.getListOfMembers();
}
else if (elementName.equals("listOfMemberConstraints")) {
return group.getListOfMemberConstraints();
}
}
else if (contextObject instanceof ListOf<?>) {
ListOf<SBase> listOf = (ListOf<SBase>) contextObject;
if (elementName.equals("group")) {
Model model = (Model) listOf.getParentSBMLObject();
GroupsModelPlugin extendeModel = (GroupsModelPlugin) model.getExtension(GroupsConstants.namespaceURI);
Group group = new Group();
extendeModel.addGroup(group);
return group;
} else if (elementName.equals("member")) {
Member member = new Member();
listOf.add(member);