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

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

public class TopicTypeStore
extends java.lang.Object
implements IDataStore

Internal data store of topic and topic type relations

Author:
Sven Krosse

Field Summary
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> instances
          internal storage of the type-instance relations
private  InMemoryTopicMapStore store
          the parent store
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> subtypes
          internal storage of the type-subtypes relations
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> supertypes
          internal storage of the type-supertypes relations
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> types
          internal storage of the instance-types relations
 
Constructor Summary
TopicTypeStore(InMemoryTopicMapStore store)
          constructor
 
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
private  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectInstancesByAssociation(de.topicmapslab.majortom.model.core.ITopic type)
          Return all direct-instances of the given topic type by using the internal topic map data model associations
 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
private  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSubtypesByAssociation(de.topicmapslab.majortom.model.core.ITopic type)
          Return all direct-subtypes of the given topic type by using the internal topic map data model associations
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSupertypes(de.topicmapslab.majortom.model.core.ITopic type)
          Return all direct super types of the given topic type
private  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSupertypesByAssociation(de.topicmapslab.majortom.model.core.ITopic type)
          Return all direct-supertypes of the given topic type by using the internal topic map data model associations
 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
private  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectTypesByAssociation(de.topicmapslab.majortom.model.core.ITopic instance)
          Return all direct-types of the given topic type by using the internal topic map data model associations
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getInstances()
          Return all transitive instances of the topic map;
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getInstances(de.topicmapslab.majortom.model.core.ITopic type)
          Return all transitive instances of the given topic type.
private  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getInstancesByAssociation()
          Return all instances of the topic map by using the internal topic map data model associations
protected  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getInstancesMap()
          internal storage of the type-instance relations
protected  de.topicmapslab.majortom.model.store.ITopicMapStore 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> getSubtypes(de.topicmapslab.majortom.model.core.ITopic type)
          Return all sub types of the given topic type.
protected  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSubtypes(de.topicmapslab.majortom.model.core.ITopic type, java.util.Set<de.topicmapslab.majortom.model.core.ITopic> known)
          Return all sub types of the given topic type.
private  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSubtypesByAssociation()
          Return all sub types of the topic map by using the internal topic map data model associations
protected  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getSubtypesMap()
          internal storage of the type-subtypes relations
 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> getSupertypes(de.topicmapslab.majortom.model.core.ITopic type)
          Return all super types of the given topic type
protected  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSupertypes(de.topicmapslab.majortom.model.core.ITopic type, java.util.Set<de.topicmapslab.majortom.model.core.ITopic> known)
          Return all super types of the given topic type
private  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSupertypesByAssociation()
          Return all supertypes of the topic map by using the internal topic map data model associations
protected  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getSupertypesMap()
           
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypes()
          Return all transitive types of the topic map.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypes(de.topicmapslab.majortom.model.core.ITopic instance)
          Return all transitive types of the given topic item.
private  java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypesByAssociation()
          Return all types of the topic map by using the internal topic map data model associations
protected  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getTypesMap()
          internal storage of the instance-types relations
 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.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> removeTopic(de.topicmapslab.majortom.model.core.ITopic topic)
          Removing the given topic from the internal store and all dependent relations.
 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

supertypes

private java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> supertypes
internal storage of the type-supertypes relations


instances

private java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> instances
internal storage of the type-instance relations


types

private java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> types
internal storage of the instance-types relations


subtypes

private java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> subtypes
internal storage of the type-subtypes relations


store

private final InMemoryTopicMapStore store
the parent store

Constructor Detail

TopicTypeStore

public TopicTypeStore(InMemoryTopicMapStore store)
constructor

Parameters:
store - the parent store
Method Detail

close

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

Specified by:
close in interface IDataStore

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

Parameters:
type - the topic type
Returns:
the direct instances

getDirectInstancesByAssociation

private java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectInstancesByAssociation(de.topicmapslab.majortom.model.core.ITopic type)
Return all direct-instances of the given topic type by using the internal topic map data model associations

Parameters:
type - the topic type
Returns:
the direct instances

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

Parameters:
instance - the topic item
Returns:
the direct types

getDirectTypesByAssociation

private java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectTypesByAssociation(de.topicmapslab.majortom.model.core.ITopic instance)
Return all direct-types of the given topic type by using the internal topic map data model associations

Parameters:
type - the topic type
Returns:
the direct types

getInstances

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

Parameters:
type - the topic type
Returns:
the instances

getInstances

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

Returns:
the instances

getInstancesByAssociation

private java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getInstancesByAssociation()
Return all instances of the topic map by using the internal topic map data model associations

Returns:
the instances

getTypes

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

Parameters:
instance - the topic item
Returns:
the types

getTypes

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

Returns:
the types

getTypesByAssociation

private java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypesByAssociation()
Return all types of the topic map by using the internal topic map data model associations

Returns:
the types

getDirectSupertypes

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

Parameters:
type - the topic type
Returns:
the super types

getDirectSupertypesByAssociation

private java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSupertypesByAssociation(de.topicmapslab.majortom.model.core.ITopic type)
Return all direct-supertypes of the given topic type by using the internal topic map data model associations

Parameters:
type - the topic type
Returns:
the direct supertypes

getSupertypes

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

Parameters:
type - the topic type
Returns:
the super types

getSupertypes

protected final java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSupertypes(de.topicmapslab.majortom.model.core.ITopic type,
                                                                                        java.util.Set<de.topicmapslab.majortom.model.core.ITopic> known)
Return all super types of the given topic type

Parameters:
type - the topic type
known - a set containing all known type to enable cycle detection
Returns:
the super types

getSupertypes

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

Returns:
the types

getSupertypesByAssociation

private java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSupertypesByAssociation()
Return all supertypes of the topic map by using the internal topic map data model associations

Returns:
the supertypes

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

Parameters:
type - the topic type
Returns:
the super types

getDirectSubtypesByAssociation

private java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getDirectSubtypesByAssociation(de.topicmapslab.majortom.model.core.ITopic type)
Return all direct-subtypes of the given topic type by using the internal topic map data model associations

Parameters:
type - the topic type
Returns:
the direct subtypes

getSubtypes

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

Parameters:
type - the topic type
Returns:
the sub types

getSubtypes

protected java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSubtypes(de.topicmapslab.majortom.model.core.ITopic type,
                                                                                java.util.Set<de.topicmapslab.majortom.model.core.ITopic> known)
Return all sub types of the given topic type.

Parameters:
type - the topic type
known - a set containing all known types, to enable cycle detection
Returns:
the sub types

getSubtypes

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

Returns:
the types

getSubtypesByAssociation

private java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getSubtypesByAssociation()
Return all sub types of the topic map by using the internal topic map data model associations

Returns:
the subtypes

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.

Parameters:
t - the topic item
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.

Parameters:
type - the topic type
supertype - the super type

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.

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.

Parameters:
type - the topic type
supertype - the super type

removeTopic

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> removeTopic(de.topicmapslab.majortom.model.core.ITopic topic)
Removing the given topic from the internal store and all dependent relations.

Parameters:
topic - the topic
Returns:
the removed dependent topics

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

getStore

protected de.topicmapslab.majortom.model.store.ITopicMapStore getStore()
Returns the internal reference of the topic map store.

Returns:
the topic map store

getSupertypesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getSupertypesMap()

getInstancesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getInstancesMap()
internal storage of the type-instance relations


getTypesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getTypesMap()
internal storage of the instance-types relations


getSubtypesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getSubtypesMap()
internal storage of the type-subtypes relations