org.tm4j.topicmap
Interface Association

All Superinterfaces:
ScopedObject, TopicMapObject
All Known Implementing Classes:
UnifiedAssociation

public interface Association
extends ScopedObject

This interface describes an association between one or more topics, subject indicators, or resources. The type of the Association is defined by an optional typing Topic, and its validity may or may not be restricted to a particular scope, defined by a set of Topics. An association contains one or more Member objects whose roles may be defined by role-specifying Topics.

Author:
Kal Ahmed
See Also:
Topic, Member, ScopedObject

Method Summary
 void addMember(Member member)
          Adds a new Member to the association.
 Member createMember(java.lang.String id)
          Creates a new Member and adds it to this Association.
 Member createMember(java.lang.String id, Locator resourceLoc, Topic roleSpec, java.util.Collection players)
          Creates a new Member and adds it to this Association.
 void dispose()
          This method should be invoked when the object is no longer needed.
 java.util.Collection getMembers()
          Returns the Members that the Association contains.
 java.util.Collection getMembersOfRole(Topic roleSpec)
          Returns the Member objects which play the specified role in this association.
 TopicMap getParent()
          Returns the TopicMap object which contains this Association object.
 Topic getType()
          Gets the Topic defining the type of the Association.
 boolean isOfType(Topic type)
          Determines whether the type of the association is described by type.
 void removeMember(Member member)
          Removes a member from this association.
 void setMembers(Member[] members)
          Defines the member constructs which are members of this association.
 void setType(Topic type)
          Sets the Topic defining the type of this Association.
 
Methods inherited from interface org.tm4j.topicmap.ScopedObject
addTheme, getScope, inScope, inScope, removeTheme, setScope
 
Methods inherited from interface org.tm4j.topicmap.TopicMapObject
addMultiValuePropertyChangeListener, addMultiValuePropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addSourceLocator, addVetoableChangeListener, destroy, fireMultiValuePropertyChange, fireMultiValuePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getID, getResourceLocator, getSourceLocators, getTopicMap, removeMultiValuePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener, removeSourceLocator, removeVetoableChangeListener, setID, setResourceLocator
 

Method Detail

dispose

public void dispose()
Description copied from interface: ScopedObject
This method should be invoked when the object is no longer needed. Its implementation should ensure that any contained objects are disposed and that any external references are cleared out.

Specified by:
dispose in interface ScopedObject

getMembers

public java.util.Collection getMembers()
Returns the Members that the Association contains.

Returns:
An unmodifiable collection of the Member objects defining the members of this Association. If no members are currently defined for this association, the returned collection is empty; it is never null.

setMembers

public void setMembers(Member[] members)
                throws java.beans.PropertyVetoException
Defines the member constructs which are members of this association.

Parameters:
members - the new set of members to be part of this association. If this is null, all the existing members of this association are removed.
Throws:
java.beans.PropertyVetoException

addMember

public void addMember(Member member)
               throws java.beans.PropertyVetoException
Adds a new Member to the association.

If member is a member of another association, then it will be removed from that association and added to this association.

If member is a member of this association already, then this method has no effect.

Parameters:
member - The Member to be added.
Throws:
java.beans.PropertyVetoException

createMember

public Member createMember(java.lang.String id)
                    throws DuplicateObjectIDException,
                           java.beans.PropertyVetoException
Creates a new Member and adds it to this Association.

Parameters:
id - the unique ID to be assigned to the newly created Member object. If null, then the back-end will assign a unique ID to the object.
Throws:
DuplicateObjectIDException
java.beans.PropertyVetoException

createMember

public Member createMember(java.lang.String id,
                           Locator resourceLoc,
                           Topic roleSpec,
                           java.util.Collection players)
                    throws DuplicateObjectIDException,
                           java.beans.PropertyVetoException,
                           DuplicateResourceLocatorException
Creates a new Member and adds it to this Association.

Parameters:
id - the unique ID to be assigned to the newly created Member object. If this parameter is null, then the back-end will assign a unique ID to the object.
resourceLoc - the address of the syntactic element that caused the creation of this Member (e.g. the address of the XTM member element). This parameter may be null for Member objects not created from syntactic elements or created from syntactic elements with no address.
roleSpec - the topic which defines the role played in the association. This parameter may be null for a Member which plays no defined role in the association.
players - the role players. This parameter must be a Collection of Topics.
Throws:
DuplicateObjectIDException
java.beans.PropertyVetoException
DuplicateResourceLocatorException

removeMember

public void removeMember(Member member)
                  throws java.beans.PropertyVetoException
Removes a member from this association.

Parameters:
member - The member to be removed.
Throws:
java.beans.PropertyVetoException

getType

public Topic getType()
Gets the Topic defining the type of the Association.

Returns:
The Topic defining the type of this Association. If there is no such Topic, null is returned.

setType

public void setType(Topic type)
             throws java.beans.PropertyVetoException
Sets the Topic defining the type of this Association.

Parameters:
type - The Topic to define the type of the association.
Throws:
java.beans.PropertyVetoException

isOfType

public boolean isOfType(Topic type)
Determines whether the type of the association is described by type.

Returns:
true if the type of this Association is defined by the topic type, false otherwise.

getMembersOfRole

public java.util.Collection getMembersOfRole(Topic roleSpec)
Returns the Member objects which play the specified role in this association. The Member objects returned are the ones whose role is defined by the specified Topic or by another Topic which is merged with the specified Topic.

Parameters:
roleSpec - The Topic specifying the role that the returned Members must play.
Returns:
An unmodifiable Collection of Member objects.

getParent

public TopicMap getParent()
Returns the TopicMap object which contains this Association object.

Returns:
The parent TopicMap object.