org.tmapi.core
Interface Association

All Superinterfaces:
ScopedObject, TopicMapObject

public interface Association
extends ScopedObject

Represents the topic map association construct.


Method Summary
 AssociationRole createAssociationRole(Topic player, Topic type)
          Creates a new AssociationRole representing a role in this association.
 java.util.Set getAssociationRoles()
          Returns the AssociationRole objects representing all of the roles in this association.
 Topic getReifier()
          Returns the Topic that reifies this association.
 Topic getType()
          Returns the topic which defines the type of the association.
 void remove()
          Removes this Association from the collection of Associations managed by the parent TopicMap.
 void setType(Topic type)
          Sets the topic which defines the type of the association.
 
Methods inherited from interface org.tmapi.core.ScopedObject
addScopingTopic, getScope, removeScopingTopic
 
Methods inherited from interface org.tmapi.core.TopicMapObject
addSourceLocator, equals, getObjectId, getSourceLocators, getTopicMap, hashCode, removeSourceLocator
 

Method Detail

setType

public void setType(Topic type)
Sets the topic which defines the type of the association. Replaces any existing type.

Parameters:
type - The topic specifying the new type of the association, or null to set the association to be untyped.

getType

public Topic getType()
Returns the topic which defines the type of the association.

Returns:
The Topic object which defines the type of the association, or null if the association is untyped.

createAssociationRole

public AssociationRole createAssociationRole(Topic player,
                                             Topic type)
Creates a new AssociationRole representing a role in this association.

Parameters:
player - The topic playing the role or null if there is no player of this role.
type - The topic defining the role of the new AssociationRole, or null if the role is untyped.
Returns:
The newly created AssociationRole.

getAssociationRoles

public java.util.Set getAssociationRoles()
Returns the AssociationRole objects representing all of the roles in this association. The return value may be an empty Set, but is never null.

Returns:
An unmodifiable Set of AssociationRole objects.

getReifier

public Topic getReifier()
Returns the Topic that reifies this association.

Returns:
A Topic instance or null if the association is not reified.

remove

public void remove()
            throws TMAPIException
Removes this Association from the collection of Associations managed by the parent TopicMap. This method must also remove all contained AssociationRole objects.

Specified by:
remove in interface TopicMapObject
Throws:
TMAPIException - if the object cannot be removed from the container. Derived interfaces may define specific circumstances under which a subclass of TMAPIException must be raised. Implementations MUST NOT use a TMAPIException to wrap a failure raised in the underlying engine - such errors must always be wrapped in a TMAPIRuntimeException.