@Override public AssociationRoleIF makeAssociationRole(AssociationIF assoc, TopicIF role_type, TopicIF player) { if (assoc == null) throw new NullPointerException(MSG_ASSOCATION_NOT_NULL); if (role_type == null) throw new NullPointerException(MSG_ASSOCIATION_ROLE_TYPE_NOT_NULL); if (player == null) throw new NullPointerException(MSG_ASSOCIATION_ROLE_PLAYER_NOT_NULL); CrossTopicMapException.check(assoc, this.tm); CrossTopicMapException.check(role_type, this.tm); CrossTopicMapException.check(player, this.tm); AssociationRoleIF assocrl = new AssociationRole(tm); ((Association)assoc).addRole(assocrl); assocrl.setType(role_type); assocrl.setPlayer(player); return assocrl; }
@Override public AssociationRoleIF makeAssociationRole(AssociationIF assoc, TopicIF role_type, TopicIF player) { if (assoc == null) throw new NullPointerException(MSG_ASSOCATION_NOT_NULL); if (role_type == null) throw new NullPointerException(MSG_ASSOCIATION_ROLE_TYPE_NOT_NULL); if (player == null) throw new NullPointerException(MSG_ASSOCIATION_ROLE_PLAYER_NOT_NULL); CrossTopicMapException.check(assoc, this.tm); CrossTopicMapException.check(role_type, this.tm); CrossTopicMapException.check(player, this.tm); AssociationRoleIF assocrl = new AssociationRole(txn); ((Association)assoc).addRole(assocrl); assocrl.setType(role_type); assocrl.setPlayer(player); return assocrl; }
RoleType toType = roleTypesTo.get(i); if (role.getType().equals(fromType.getTopicIF())) { if (!role.getType().equals(toType.getTopicIF())) role.setType(toType.getTopicIF());
@Override public void setType(Topic type) { Check.typeNotNull(this, type); Check.typeInTopicMap(getTopicMap(), type); wrapped.setType(topicMap.unwrapTopic(type)); }
RoleType toType = roleTypesTo.get(i); if (role.getType().equals(fromType.getTopicIF())) { if (!role.getType().equals(toType.getTopicIF())) role.setType(toType.getTopicIF());
@Override public AssociationIF makeAssociation(TopicIF assoc_type, TopicIF role_type, TopicIF player) { if (assoc_type == null) throw new NullPointerException(MSG_ASSOCIATION_TYPE_NOT_NULL); if (role_type == null) throw new NullPointerException(MSG_ASSOCIATION_ROLE_TYPE_NOT_NULL); if (player == null) throw new NullPointerException(MSG_ASSOCIATION_ROLE_PLAYER_NOT_NULL); CrossTopicMapException.check(assoc_type, this.tm); CrossTopicMapException.check(role_type, this.tm); CrossTopicMapException.check(player, this.tm); AssociationIF assoc = new Association(tm); tm.addAssociation(assoc); assoc.setType(assoc_type); AssociationRoleIF assocrl = new AssociationRole(tm); ((Association)assoc).addRole(assocrl); assocrl.setType(role_type); assocrl.setPlayer(player); return assoc; }
@Override public AssociationIF makeAssociation(TopicIF assoc_type, TopicIF role_type, TopicIF player) { if (assoc_type == null) throw new NullPointerException(MSG_ASSOCIATION_TYPE_NOT_NULL); if (role_type == null) throw new NullPointerException(MSG_ASSOCIATION_ROLE_TYPE_NOT_NULL); if (player == null) throw new NullPointerException(MSG_ASSOCIATION_ROLE_PLAYER_NOT_NULL); CrossTopicMapException.check(assoc_type, this.tm); CrossTopicMapException.check(role_type, this.tm); CrossTopicMapException.check(player, this.tm); AssociationIF assoc = new Association(txn); ((TopicMap)tm).addAssociation(assoc); assoc.setType(assoc_type); AssociationRoleIF assocrl = new AssociationRole(txn); ((Association)assoc).addRole(assocrl); assocrl.setType(role_type); assocrl.setPlayer(player); return assoc; }
@Override public void run() { AssociationRoleIF r = getAssociationRole(); TopicIF type = builder.makeTopic(); // create type this.data.put("type", type); r.setType(type); this.objectId = r.getObjectId(); this.value = type.getObjectId(); } });
@Override public void run() { AssociationRoleIF r = getAssociationRole(); TopicIF type = builder.makeTopic(); // create type type.addSubjectIdentifier(URILocator.create("type:cleared")); r.setType(type); TopicIF xtype = (TopicIF)this.data.remove("type"); // remove type xtype.remove(); this.objectId = r.getObjectId(); } });
public void testAssociationRolesDynamic() { TopicIF at1 = builder.makeTopic(); TopicIF art1 = builder.makeTopic(); TopicIF art2 = builder.makeTopic(); TopicIF player = builder.makeTopic(); AssociationIF a = builder.makeAssociation(at1); AssociationRoleIF r1 = builder.makeAssociationRole(a, art1, player); assertTrue("TopicMapIF.addAssociation does not update role type index", index.getAssociationRoles(art1).size() == 1); r1.setType(art2); assertTrue("AssociationRoleIF.setType(art2) does not update index", index.getAssociationRoles(art1).size() == 0); assertTrue("AssociationRoleIF.setType(art2) does not update index", index.getAssociationRoles(art2).size() == 1); r1.setType(art1); assertTrue("AssociationRoleIF.setType does not update index", index.getAssociationRoles(art1).size() == 1); assertTrue("AssociationRoleIF.setType does not update index", index.getAssociationRoles(art2).size() == 0); a.remove(); assertTrue("TopicMapIF.removeAssociation does not update role type index", index.getAssociationRoles(art1).size() == 0); }
role.setType(type);
r1E.setType(rt3E); assertTrue("p1E.rolesByType(rt1,at1).size is not 0.", p1E.getRolesByType(rt1E, at1E).size() == 0); assertTrue("p1E.rolesByType(rt1,at2).size is not 0.", p1E.getRolesByType(rt1E, at2E).size() == 0); assertTrue("p1B.rolesByType(rt1,at2).size is not 0.", p1B.getRolesByType(rt1B,at2B).size() == 0); r1B.setType(rt1B); assertTrue("p1B.rolesByType(rt3,at1).size is not 0.", p1B.getRolesByType(rt3B,at1B).size() == 0); assertTrue("p1B.rolesByType(rt3,at2).size is not 0.", p1B.getRolesByType(rt3B,at2B).size() == 0);
ar2.setType(ar2_type2);
ar.setType(other); afterTest();