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

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

public class VirtualTopicTypeStore<T extends VirtualTopicMapStore>
extends TopicTypeStore
implements IVirtualStore

Author:
Sven Krosse

Field Summary
private  java.util.Map<java.lang.String,java.util.Set<java.lang.String>> removedInstances
           
private  java.util.Map<java.lang.String,java.util.Set<java.lang.String>> removedSubtypes
           
private  java.util.Map<java.lang.String,java.util.Set<java.lang.String>> removedSupertypes
           
private  java.util.Map<java.lang.String,java.util.Set<java.lang.String>> removedTypes
           
 
Constructor Summary
VirtualTopicTypeStore(InMemoryTopicMapStore store)
           
 
Method Summary
 void addSupertype(de.topicmapslab.majortom.model.core.ITopic type, de.topicmapslab.majortom.model.core.ITopic supertype)
          Removing a super-type-sub-type-relation between the given types.
 void addType(de.topicmapslab.majortom.model.core.ITopic t, de.topicmapslab.majortom.model.core.ITopic type)
          Add a type-instance-relation between the given topics.
 void close()
          Remove all items from the internal store.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectInstances(de.topicmapslab.majortom.model.core.ITopic type)
          Return all direct-instances of the given topic type
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSubtypes(de.topicmapslab.majortom.model.core.ITopic type)
          Return all direct sub types of the given topic type
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSupertypes(de.topicmapslab.majortom.model.core.ITopic subtype)
          Return all direct super types of the given topic type
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectTypes(de.topicmapslab.majortom.model.core.ITopic instance)
          Return all direct-types of the given topic item
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getInstances()
          Return all transitive instances of the topic map;
protected  T getStore()
          Returns the internal reference of the topic map store.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSubtypes()
          Return all sub types of the topic map.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSupertypes()
          Return all super types of the topic map.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypes()
          Return all transitive types of the topic map.
protected  VirtualIdentityStore<T> getVirtualIdentityStore()
          Internal method to access the virtual-identity store
 void removeSupertype(de.topicmapslab.majortom.model.core.ITopic type, de.topicmapslab.majortom.model.core.ITopic supertype)
          Removing a super-type-sub-type-relation between the given types.
 void removeType(de.topicmapslab.majortom.model.core.ITopic t, de.topicmapslab.majortom.model.core.ITopic type)
          Removing a type-instance-relation between the given topics.
 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.
private  void storeAkoRelation(de.topicmapslab.majortom.model.core.ITopic type, de.topicmapslab.majortom.model.core.ITopic supertype)
          Store the old a-kind-of relation between the given topics
private  void storeIsaRelation(de.topicmapslab.majortom.model.core.ITopic t, de.topicmapslab.majortom.model.core.ITopic type)
          Store the old is-instance-of relation between the given topics
 
Methods inherited from class de.topicmapslab.majortom.inmemory.store.internal.TopicTypeStore
getInstances, getInstancesMap, getSubtypes, getSubtypes, getSubtypesMap, getSupertypes, getSupertypes, getSupertypesMap, getTypes, getTypesMap, removeTopic, replace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.topicmapslab.majortom.inmemory.store.model.IDataStore
replace
 

Field Detail

removedInstances

private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> removedInstances

removedTypes

private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> removedTypes

removedSupertypes

private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> removedSupertypes

removedSubtypes

private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> removedSubtypes
Constructor Detail

VirtualTopicTypeStore

public VirtualTopicTypeStore(InMemoryTopicMapStore store)
Parameters:
store -
Method Detail

close

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

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

getVirtualIdentityStore

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

Returns:
the virtual identity store

getStore

protected T getStore()
Returns the internal reference of the topic map store.

Overrides:
getStore in class TopicTypeStore
Returns:
the topic map store

addType

public void addType(de.topicmapslab.majortom.model.core.ITopic t,
                    de.topicmapslab.majortom.model.core.ITopic type)
Add a type-instance-relation between the given topics.

Overrides:
addType in class TopicTypeStore
Parameters:
t - the topic item
type - the type

addSupertype

public void addSupertype(de.topicmapslab.majortom.model.core.ITopic type,
                         de.topicmapslab.majortom.model.core.ITopic supertype)
Removing a super-type-sub-type-relation between the given types.

Overrides:
addSupertype in class TopicTypeStore
Parameters:
type - the topic type
supertype - the super type

removeType

public void removeType(de.topicmapslab.majortom.model.core.ITopic t,
                       de.topicmapslab.majortom.model.core.ITopic type)
Removing a type-instance-relation between the given topics.

Overrides:
removeType in class TopicTypeStore
Parameters:
t - the topic item
type - the type

storeIsaRelation

private void storeIsaRelation(de.topicmapslab.majortom.model.core.ITopic t,
                              de.topicmapslab.majortom.model.core.ITopic type)
Store the old is-instance-of relation between the given topics

Parameters:
t - the instance
type - the type

removeSupertype

public void removeSupertype(de.topicmapslab.majortom.model.core.ITopic type,
                            de.topicmapslab.majortom.model.core.ITopic supertype)
Removing a super-type-sub-type-relation between the given types.

Overrides:
removeSupertype in class TopicTypeStore
Parameters:
type - the topic type
supertype - the super type

storeAkoRelation

private void storeAkoRelation(de.topicmapslab.majortom.model.core.ITopic type,
                              de.topicmapslab.majortom.model.core.ITopic supertype)
Store the old a-kind-of relation between the given topics

Parameters:
type - the type
supertype - the supertype

getTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypes()
Return all transitive types of the topic map.

Overrides:
getTypes in class TopicTypeStore
Returns:
the types

getDirectTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectTypes(de.topicmapslab.majortom.model.core.ITopic instance)
Return all direct-types of the given topic item

Overrides:
getDirectTypes in class TopicTypeStore
Parameters:
instance - the topic item
Returns:
the direct types

getInstances

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getInstances()
Return all transitive instances of the topic map;

Overrides:
getInstances in class TopicTypeStore
Returns:
the instances

getDirectInstances

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectInstances(de.topicmapslab.majortom.model.core.ITopic type)
Return all direct-instances of the given topic type

Overrides:
getDirectInstances in class TopicTypeStore
Parameters:
type - the topic type
Returns:
the direct instances

getSupertypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSupertypes()
Return all super types of the topic map.

Overrides:
getSupertypes in class TopicTypeStore
Returns:
the types

getDirectSupertypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSupertypes(de.topicmapslab.majortom.model.core.ITopic subtype)
Return all direct super types of the given topic type

Overrides:
getDirectSupertypes in class TopicTypeStore
Parameters:
subtype - the topic type
Returns:
the super types

getSubtypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSubtypes()
Return all sub types of the topic map.

Overrides:
getSubtypes in class TopicTypeStore
Returns:
the types

getDirectSubtypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSubtypes(de.topicmapslab.majortom.model.core.ITopic type)
Return all direct sub types of the given topic type

Overrides:
getDirectSubtypes in class TopicTypeStore
Parameters:
type - the topic type
Returns:
the super types

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