de.topicmapslab.majortom.cache
Class TopicTypeCache

java.lang.Object
  extended by de.topicmapslab.majortom.cache.TopicTypeCache
All Implemented Interfaces:
de.topicmapslab.majortom.model.event.ITopicMapListener

 class TopicTypeCache
extends java.lang.Object
implements de.topicmapslab.majortom.model.event.ITopicMapListener

Internal data store of topic and topic type relations

Author:
Sven Krosse

Nested Class Summary
(package private) static class TopicTypeCache.Key
          enumeration specify the key for internal maps
 
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  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>> transitiveInstances
          internal storage of the type-instance relations
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> transitiveSubtypes
          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>> transitiveSupertypes
          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>> transitiveTypes
          internal storage of the instance-types relations
private  java.util.Map<TopicTypeCache.Key,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> typeHierarchy
          Map storing the type-hierarchy
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
TopicTypeCache()
           
 
Method Summary
 void cacheSupertypes(de.topicmapslab.majortom.model.core.ITopic topic, java.util.Set<de.topicmapslab.majortom.model.core.ITopic> set)
          Cache the given supertypes of the topic to the internal cache
 void cacheTypes(de.topicmapslab.majortom.model.core.ITopic topic, java.util.Set<de.topicmapslab.majortom.model.core.ITopic> set)
          Cache the given types of the topic to the internal cache
 void clear()
          
 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 type)
          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;
 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.
 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.
 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
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypeHierarchy(java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> map, de.topicmapslab.majortom.model.core.ITopic key)
          Secure extraction of the values from the given map.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypeHierarchy(TopicTypeCache.Key type)
          Returns the type-hierarchy of the specified type ( instances, types, subtypes or supertypes ) of the topic map.
 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.
 void topicMapChanged(java.lang.String id, de.topicmapslab.majortom.model.event.TopicMapEventType event, org.tmapi.core.Construct notifier, java.lang.Object newValue, java.lang.Object oldValue)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeHierarchy

private java.util.Map<TopicTypeCache.Key,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> typeHierarchy
Map storing the type-hierarchy


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


transitiveSupertypes

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


transitiveInstances

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


transitiveTypes

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


transitiveSubtypes

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

Constructor Detail

TopicTypeCache

TopicTypeCache()
Method Detail

clear

public void clear()


getTypeHierarchy

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypeHierarchy(java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> map,
                                                                                  de.topicmapslab.majortom.model.core.ITopic key)
Secure extraction of the values from the given map.

Parameters:
map - the map
key - the key
Returns:
the values or null if the map does not contains the given key or is null

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

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

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

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

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

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

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

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

getTypeHierarchy

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypeHierarchy(TopicTypeCache.Key type)
Returns the type-hierarchy of the specified type ( instances, types, subtypes or supertypes ) of the topic map.

Parameters:
type - the key
Returns:
the type-hierarchy

getInstances

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

Returns:
the instances

getTypes

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

Returns:
the types

getSupertypes

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

Returns:
the types

getSubtypes

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

Returns:
the types

cacheTypes

public void cacheTypes(de.topicmapslab.majortom.model.core.ITopic topic,
                       java.util.Set<de.topicmapslab.majortom.model.core.ITopic> set)
Cache the given types of the topic to the internal cache

Parameters:
topic - the topic
set - the types

cacheSupertypes

public void cacheSupertypes(de.topicmapslab.majortom.model.core.ITopic topic,
                            java.util.Set<de.topicmapslab.majortom.model.core.ITopic> set)
Cache the given supertypes of the topic to the internal cache

Parameters:
topic - the topic
set - the supertypes

topicMapChanged

public void topicMapChanged(java.lang.String id,
                            de.topicmapslab.majortom.model.event.TopicMapEventType event,
                            org.tmapi.core.Construct notifier,
                            java.lang.Object newValue,
                            java.lang.Object oldValue)

Specified by:
topicMapChanged in interface de.topicmapslab.majortom.model.event.ITopicMapListener