de.topicmapslab.majortom.inmemory.store.internal
Class AssociationStore

java.lang.Object
  extended by de.topicmapslab.majortom.inmemory.store.internal.AssociationStore
All Implemented Interfaces:
IDataStore
Direct Known Subclasses:
VirtualAssociationStore

public class AssociationStore
extends java.lang.Object
implements IDataStore

Internal data store of association and role informations

Author:
Sven Krosse

Field Summary
private  java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole>> associations
          internal storage map of association-roles relations
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole>> playedRoles
          internal storage map of player-roles relations
private  java.util.Map<de.topicmapslab.majortom.model.core.IAssociationRole,de.topicmapslab.majortom.model.core.ITopic> rolePlayers
          internal storage map of role-player relations
 
Constructor Summary
AssociationStore()
           
 
Method Summary
 void addAssociation(de.topicmapslab.majortom.model.core.IAssociation association)
          Register a new association item.
 void addRole(de.topicmapslab.majortom.model.core.IAssociation association, de.topicmapslab.majortom.model.core.IAssociationRole role, de.topicmapslab.majortom.model.core.ITopic player)
          Register a new association role item at the internal store.
 void close()
          Remove all items from the internal store.
 java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getAssocaitionsPlayed(de.topicmapslab.majortom.model.core.ITopic player)
          Return the played associations of the given role player.
protected  java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole>> getAssociationMap()
           
 java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getAssociations()
          Return all stored associations
protected  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole>> getPlayedRolesMap()
           
 de.topicmapslab.majortom.model.core.ITopic getPlayer(org.tmapi.core.Role r)
          Return the player of a specific role
protected  java.util.Map<de.topicmapslab.majortom.model.core.IAssociationRole,de.topicmapslab.majortom.model.core.ITopic> getRolePlayersMap()
           
 java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole> getRoles(org.tmapi.core.Association association)
          Return all roles of the given association
 java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole> getRoles(de.topicmapslab.majortom.model.core.ITopic player)
          Return the played roles of the given role player.
 void removeAssociation(de.topicmapslab.majortom.model.core.IAssociation association)
          Remove an association item.
 void removeRole(de.topicmapslab.majortom.model.core.IAssociationRole role)
          Remove a role from the internal store.
 void replace(de.topicmapslab.majortom.model.core.ITopic topic, de.topicmapslab.majortom.model.core.ITopic replacement, de.topicmapslab.majortom.model.revision.IRevision revision)
          Replace each reference of the given topic by the given replacement.
 de.topicmapslab.majortom.model.core.ITopic setPlayer(de.topicmapslab.majortom.model.core.IAssociationRole r, de.topicmapslab.majortom.model.core.ITopic player)
          Modify the player of a specific role.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

associations

private java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole>> associations
internal storage map of association-roles relations


rolePlayers

private java.util.Map<de.topicmapslab.majortom.model.core.IAssociationRole,de.topicmapslab.majortom.model.core.ITopic> rolePlayers
internal storage map of role-player relations


playedRoles

private java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole>> playedRoles
internal storage map of player-roles relations

Constructor Detail

AssociationStore

public AssociationStore()
Method Detail

close

public void close()
Remove all items from the internal store.

Specified by:
close in interface IDataStore

getRoles

public java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole> getRoles(org.tmapi.core.Association association)
Return all roles of the given association

Parameters:
association - the association
Returns:
the roles

getRoles

public java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole> getRoles(de.topicmapslab.majortom.model.core.ITopic player)
Return the played roles of the given role player.

Parameters:
player - the player
Returns:
the roles

getAssocaitionsPlayed

public java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getAssocaitionsPlayed(de.topicmapslab.majortom.model.core.ITopic player)
Return the played associations of the given role player.

Parameters:
player - the player
Returns:
the associations

getAssociations

public java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getAssociations()
Return all stored associations

Returns:
the associations

getPlayer

public de.topicmapslab.majortom.model.core.ITopic getPlayer(org.tmapi.core.Role r)
Return the player of a specific role

Parameters:
r - the role
Returns:
the player

removeAssociation

public void removeAssociation(de.topicmapslab.majortom.model.core.IAssociation association)
Remove an association item.

Parameters:
association - the association item

removeRole

public void removeRole(de.topicmapslab.majortom.model.core.IAssociationRole role)
Remove a role from the internal store.

Parameters:
role - the role

addAssociation

public void addAssociation(de.topicmapslab.majortom.model.core.IAssociation association)
Register a new association item.

Parameters:
association - the association item

addRole

public void addRole(de.topicmapslab.majortom.model.core.IAssociation association,
                    de.topicmapslab.majortom.model.core.IAssociationRole role,
                    de.topicmapslab.majortom.model.core.ITopic player)
Register a new association role item at the internal store.

Parameters:
association - the parent association
role - the association role item
player - the role player

setPlayer

public de.topicmapslab.majortom.model.core.ITopic setPlayer(de.topicmapslab.majortom.model.core.IAssociationRole r,
                                                            de.topicmapslab.majortom.model.core.ITopic player)
Modify the player of a specific role.

Parameters:
r - the role
player - the new player
Returns:
the old player

replace

public void replace(de.topicmapslab.majortom.model.core.ITopic topic,
                    de.topicmapslab.majortom.model.core.ITopic replacement,
                    de.topicmapslab.majortom.model.revision.IRevision revision)
Replace each reference of the given topic by the given replacement.

Specified by:
replace in interface IDataStore
Parameters:
topic - the topic
replacement - the replacement
revision - the revision

getPlayedRolesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole>> getPlayedRolesMap()
Returns:
the playedRoles

getRolePlayersMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IAssociationRole,de.topicmapslab.majortom.model.core.ITopic> getRolePlayersMap()
Returns:
the rolePlayers

getAssociationMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole>> getAssociationMap()