org.tm4j.topicmap.unified
Class UnifiedAssociation

java.lang.Object
  extended byorg.tm4j.topicmap.unified.UnifiedTopicMapObject
      extended byorg.tm4j.topicmap.unified.UnifiedScopedObject
          extended byorg.tm4j.topicmap.unified.UnifiedAssociation
All Implemented Interfaces:
Association, ScopedObject, TopicMapObject

public class UnifiedAssociation
extends UnifiedScopedObject
implements Association

Wrapper class around an object implementing the Association interface. This wrapper enforces a read-only interface and returns UnifiedTopic and UnifiedMember instances from the get...() methods.


Field Summary
 
Fields inherited from class org.tm4j.topicmap.unified.UnifiedTopicMapObject
m_tm
 
Constructor Summary
UnifiedAssociation(UnifiedTopicMap tm, Association base)
           
 
Method Summary
 void addMember(Member m)
          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.
 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 m)
          Removes a member from this association.
 void setMembers(Member[] m)
          Defines the member constructs which are members of this association.
 void setType(Topic t)
          Sets the Topic defining the type of this Association.
 
Methods inherited from class org.tm4j.topicmap.unified.UnifiedScopedObject
addTheme, dispose, getScope, inScope, inScope, removeTheme, setScope
 
Methods inherited from class org.tm4j.topicmap.unified.UnifiedTopicMapObject
addMultiValuePropertyChangeListener, addMultiValuePropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addSourceLocator, addVetoableChangeListener, destroy, equals, fireMultiValuePropertyChange, fireMultiValuePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getBaseObject, getID, getResourceLocator, getSourceLocators, getTopicMap, hashCode, removeMultiValuePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener, removeSourceLocator, removeVetoableChangeListener, setID, setResourceLocator, unsupported
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tm4j.topicmap.Association
dispose
 
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
 

Constructor Detail

UnifiedAssociation

public UnifiedAssociation(UnifiedTopicMap tm,
                          Association base)
Method Detail

getMembersOfRole

public java.util.Collection getMembersOfRole(Topic roleSpec)
Description copied from interface: Association
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.

Specified by:
getMembersOfRole in interface Association
Parameters:
roleSpec - The Topic specifying the role that the returned Members must play.
Returns:
An unmodifiable Collection of Member objects.

getParent

public TopicMap getParent()
Description copied from interface: Association
Returns the TopicMap object which contains this Association object.

Specified by:
getParent in interface Association
Returns:
The parent TopicMap object.

getType

public Topic getType()
Description copied from interface: Association
Gets the Topic defining the type of the Association.

Specified by:
getType in interface Association
Returns:
The Topic defining the type of this Association. If there is no such Topic, null is returned.

isOfType

public boolean isOfType(Topic type)
Description copied from interface: Association
Determines whether the type of the association is described by type.

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

getMembers

public java.util.Collection getMembers()
Description copied from interface: Association
Returns the Members that the Association contains.

Specified by:
getMembers in interface Association
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.

addMember

public void addMember(Member m)
Description copied from interface: Association
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.

Specified by:
addMember in interface Association
Parameters:
m - The Member to be added.

setMembers

public void setMembers(Member[] m)
Description copied from interface: Association
Defines the member constructs which are members of this association.

Specified by:
setMembers in interface Association
Parameters:
m - the new set of members to be part of this association. If this is null, all the existing members of this association are removed.

createMember

public Member createMember(java.lang.String id)
Description copied from interface: Association
Creates a new Member and adds it to this Association.

Specified by:
createMember in interface 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.

createMember

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

Specified by:
createMember in interface 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 m)
Description copied from interface: Association
Removes a member from this association.

Specified by:
removeMember in interface Association
Parameters:
m - The member to be removed.

setType

public void setType(Topic t)
Description copied from interface: Association
Sets the Topic defining the type of this Association.

Specified by:
setType in interface Association
Parameters:
t - The Topic to define the type of the association.