public void finalizeDomain(boolean checkForMissingExternals) { // go through each of the relations and add their slots to the // corresponding classes... for (DomainRelation rel : relations.values()) { List<Role> roles = rel.getRoles(); int numRoles = roles.size(); if (numRoles != 2) { if (numRoles > 2) { throw new RuntimeException("Can't handle with more than two roles yet!"); } } Role r0 = roles.get(0); Role r1 = roles.get(1); r0.getType().addRoleSlot(r1); r1.getType().addRoleSlot(r0); } checkForRepeatedSlots(); registerAnnotatedSlots(); if (checkForMissingExternals) { for (String externalName : external.keySet()) { if (!isBuiltinEntity(externalName) && !classes.containsKey(externalName)) { throw new RuntimeException( externalName + " was defined as an external entity but there is no concrete definition of it!"); } } } finalized = true; }
public void addRelation(DomainRelation domRelation) { checkNotFinalized(); checkNameUnique(domRelation.getFullName()); relations.put(domRelation.getFullName(), domRelation); }