public Association(Property roleOne, Property roleTwo) { if (roleOne == null) { throw new IllegalArgumentException ("The roleOne parameter must be non null."); }  if (roleTwo == null) { throw new IllegalArgumentException ("The roleTwo parameter must be non null."); }  if (!roleOne.isRole()) { throw new IllegalArgumentException ("The roleOne parameter must be a role."); }  if (!roleTwo.isRole()) { throw new IllegalArgumentException ("The roleTwo parameter must be a role."); } if ( roleOne.getAssociation() != null ) { throw new IllegalArgumentException ("The roleOne parameter is already joined to an Association!");  } if ( roleTwo.getAssociation() != null ) { throw new IllegalArgumentException ("The roleTwo parameter is already joined to an Association!");  } m_roles[0] = roleOne; m_roles[1] = roleTwo; m_roles[0].setAssociation(this); m_roles[1].setAssociation(this);  if (roleOne.isComponent() && roleTwo.isComponent()) { error("Only ohe end of an association can be a component"); }  if (roleOne.isComposite() && roleTwo.isComposite()) { error("Only ohe end of an association can be a component"); }  for (int i = 0; i < m_roles.length; i++) { if (m_roles[i].isComponent() && m_roles[i].isComposite()) { m_roles[i].error("A role may not be both a composite " + "and a component"); } }  for (int i = 0; i < m_roles.length; i++) { Property role = m_roles[i]; Property other = getAssociatedProperty(role); if (role.isComponent()) { other.setComposite(true); } if (role.isComposite()) { other.setComponent(true); } }  m_linkType = new ObjectType ((m_roles[0].getType().getQualifiedName() + ":" + m_roles[0].getName() + "::" + m_roles[1].getType().getQualifiedName() + ":" + m_roles[1].getName() + "::Link").replace('.', '_'));  Property prop = new Property( m_roles[0].getName(), m_roles[0].getType(), Property.REQUIRED, m_roles[0].isComponent(), m_roles[0].isComposite()); prop.setLineInfo(m_roles[0]); m_linkType.addProperty(prop); m_linkType.addKeyProperty(m_roles[0].getName());  prop = new Property(m_roles[1].getName(), m_roles[1].getType(), Property.REQUIRED, m_roles[1].isComponent(), m_roles[1].isComposite()); prop.setLineInfo(m_roles[1]); m_linkType.addProperty(prop); m_linkType.addKeyProperty(m_roles[1].getName());   m_linkType.setEvent(ObjectType.INSERT, newEvent()); m_linkType.setEvent(ObjectType.DELETE, newEvent()); for (Iterator it = m_linkType.getKeyProperties(); it.hasNext(); ) { prop = (Property) it.next(); prop.setEvent(Property.ADD, newEvent()); prop.setEvent(Property.REMOVE, newEvent()); }
Association(Property p1, Property p2) { super(p1.m_prop.getRoot(), null, new CompoundKey(first(p1, p2), second(p1, p2))); m_roleOne = first(p1, p2); m_roleTwo = second(p1, p2);
    public Association(Property roleOne, Property roleTwo) {        if (roleOne == null) {            throw new IllegalArgumentException		("The roleOne parameter must be non null.");        }        if (roleTwo == null) {            throw new IllegalArgumentException		("The roleTwo parameter must be non null.");        }        if (!roleOne.isRole()) {            throw new IllegalArgumentException		("The roleOne parameter must be a role.");        }        if (!roleTwo.isRole()) {            throw new IllegalArgumentException		("The roleTwo parameter must be a role.");        }        if ( roleOne.getAssociation() != null ) {            throw new IllegalArgumentException		("The roleOne parameter is already joined to an Association!");        }        if ( roleTwo.getAssociation() != null ) {            throw new IllegalArgumentException		("The roleTwo parameter is already joined to an Association!");        }        m_roles[0] = roleOne;        m_roles[1] = roleTwo;        m_roles[0].setAssociation(this);        m_roles[1].setAssociation(this);        if (roleOne.isComponent() && roleTwo.isComponent()) {            error("Only ohe end of an association can be a component");        }        if (roleOne.isComposite() && roleTwo.isComposite()) {            error("Only ohe end of an association can be a component");        }        for (int i = 0; i < m_roles.length; i++) {            if (m_roles[i].isComponent() && m_roles[i].isComposite()) {                m_roles[i].error("A role may not be both a composite " +                                 "and a component");            }        }        for (int i = 0; i < m_roles.length; i++) {            Property role = m_roles[i];            Property other = getAssociatedProperty(role);            if (role.isComponent()) {                other.setComposite(true);            }            if (role.isComposite()) {                other.setComponent(true);            }        }	m_linkType = new ObjectType	    ((m_roles[0].getType().getQualifiedName() + ":" +	      m_roles[0].getName() + "::" +	      m_roles[1].getType().getQualifiedName() + ":" +	      m_roles[1].getName() + "::Link").replace('.', '_'));        Property prop = new Property(                                     m_roles[0].getName(), m_roles[0].getType(),                                     Property.REQUIRED, m_roles[0].isComponent(),                                     m_roles[0].isComposite());        prop.setLineInfo(m_roles[0]);        m_linkType.addProperty(prop);        m_linkType.addKeyProperty(m_roles[0].getName());        prop = new Property(m_roles[1].getName(), m_roles[1].getType(),                            Property.REQUIRED, m_roles[1].isComponent(),                            m_roles[1].isComposite());        prop.setLineInfo(m_roles[1]);        m_linkType.addProperty(prop);        m_linkType.addKeyProperty(m_roles[1].getName());        // Make sure the link type has an empty insert event.        m_linkType.setEvent(ObjectType.INSERT, newEvent());        m_linkType.setEvent(ObjectType.DELETE, newEvent());        for (Iterator it = m_linkType.getKeyProperties(); it.hasNext(); ) {            prop = (Property) it.next();            prop.setEvent(Property.ADD, newEvent());            prop.setEvent(Property.REMOVE, newEvent());        }    }