de.topicmapslab.majortom.inmemory.virtual.internal
Class VirtualAssociationStore<T extends VirtualTopicMapStore>

java.lang.Object
  extended by de.topicmapslab.majortom.inmemory.store.internal.AssociationStore
      extended by de.topicmapslab.majortom.inmemory.virtual.internal.VirtualAssociationStore<T>
All Implemented Interfaces:
IDataStore, IVirtualStore
Direct Known Subclasses:
LazyAssociationStore

public class VirtualAssociationStore<T extends VirtualTopicMapStore>
extends AssociationStore
implements IVirtualStore

Author:
Sven Krosse

Field Summary
private  java.util.Map<de.topicmapslab.majortom.model.core.IAssociationRole,de.topicmapslab.majortom.model.core.ITopic> changedPlayers
           
private  T store
           
 
Constructor Summary
VirtualAssociationStore(T store)
          constructor
 
Method Summary
 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> getAssociations()
          Return all stored associations
 de.topicmapslab.majortom.model.core.ITopic getPlayer(org.tmapi.core.Role r)
          Return the player of a specific role
 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.
 T getStore()
          Return the internal stored store instance.
protected  VirtualIdentityStore<T> getVirtualIdentityStore()
          Internal method to access the virtual-identity store
 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 removeVirtualConstruct(de.topicmapslab.majortom.model.core.IConstruct construct, de.topicmapslab.majortom.model.core.IConstruct newConstruct)
          Removes the virtual construct from the internal memory layer.
 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 de.topicmapslab.majortom.inmemory.store.internal.AssociationStore
addAssociation, getAssocaitionsPlayed, getAssociationMap, getPlayedRolesMap, getRolePlayersMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

store

private final T extends VirtualTopicMapStore store

changedPlayers

private java.util.Map<de.topicmapslab.majortom.model.core.IAssociationRole,de.topicmapslab.majortom.model.core.ITopic> changedPlayers
Constructor Detail

VirtualAssociationStore

public VirtualAssociationStore(T store)
constructor

Method Detail

getStore

public T getStore()
Return the internal stored store instance.

Returns:
the store the store instance

getVirtualIdentityStore

protected VirtualIdentityStore<T> getVirtualIdentityStore()
Internal method to access the virtual-identity store

Returns:
the virtual identity store

getPlayer

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

Overrides:
getPlayer in class AssociationStore
Parameters:
r - the role
Returns:
the player

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.

Overrides:
addRole in class AssociationStore
Parameters:
association - the parent association
role - the association role item
player - the role player

getAssociations

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

Overrides:
getAssociations in class AssociationStore
Returns:
the associations

getRoles

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

Overrides:
getRoles in class AssociationStore
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.

Overrides:
getRoles in class AssociationStore
Parameters:
player - the player
Returns:
the roles

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.

Overrides:
setPlayer in class AssociationStore
Parameters:
r - the role
player - the new player
Returns:
the old player

removeRole

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

Overrides:
removeRole in class AssociationStore
Parameters:
role - the role

removeAssociation

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

Overrides:
removeAssociation in class AssociationStore
Parameters:
association - the association item

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
Overrides:
replace in class AssociationStore
Parameters:
topic - the topic
replacement - the replacement
revision - the revision

close

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

Specified by:
close in interface IDataStore
Overrides:
close in class AssociationStore

removeVirtualConstruct

public void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IConstruct construct,
                                   de.topicmapslab.majortom.model.core.IConstruct newConstruct)
Removes the virtual construct from the internal memory layer. But does not delete the construct in underlying data store.

Specified by:
removeVirtualConstruct in interface IVirtualStore
Parameters:
construct - the construct to remove
newConstruct - the new construct