001package systems.dmx.core.model;
002
003
004
005/**
006 * Collection of the data that makes up an {@link Association}.
007 *
008 * @author <a href="mailto:jri@deepamehta.de">Jörg Richter</a>
009 */
010public interface AssociationModel extends DMXObjectModel {
011
012    RoleModel getRoleModel1();
013
014    RoleModel getRoleModel2();
015
016    // ---
017
018    void setRoleModel1(RoleModel roleModel1);
019
020    void setRoleModel2(RoleModel roleModel2);
021
022    // --- Convenience Methods ---
023
024    /**
025     * @return  this association's role that matches the given role type.
026     *          If no role matches, null is returned.
027     *          If both roles are matching an exception is thrown.
028     */
029    RoleModel getRoleModel(String roleTypeUri);
030
031    boolean hasSameRoleTypeUris();
032
033    /**
034     * Checks if the given players match this association.
035     * The given role type URIs must be different.
036     * The player position ("1" vs. "2") is not relevant.
037     *
038     * @return  true if the given players match this association.
039     *
040     * @throws  IllegalArgumentException    if both given role type URIs are identical.
041     */
042    boolean matches(String roleTypeUri1, long playerId1, String roleTypeUri2, long playerId2);
043
044    long getOtherPlayerId(long id);
045
046    // ---
047
048    AssociationModel clone();
049}