de.topicmapslab.majortom.cache
Class TypedCache

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

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

Internal data store of type-typed relations

Author:
Sven Krosse

Field Summary
private  java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,de.topicmapslab.majortom.model.core.ITopic> associationTypes
          storage map of the association-type relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IName,de.topicmapslab.majortom.model.core.ITopic> nameTypes
          storage map of the name-type relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IOccurrence,de.topicmapslab.majortom.model.core.ITopic> occurrenceTypes
          storage map of the occurrence-type relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IAssociationRole,de.topicmapslab.majortom.model.core.ITopic> roleTypes
          storage map of the role-type relation
private  java.util.Map<java.lang.Class<? extends de.topicmapslab.majortom.model.core.ITypeable>,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> types
          map containing all known types
 
Constructor Summary
TypedCache()
           
 
Method Summary
 void cacheAssociationType(de.topicmapslab.majortom.model.core.IAssociation association, de.topicmapslab.majortom.model.core.ITopic type)
          Cache the type of the given association to internal cache.
 void cacheNameType(de.topicmapslab.majortom.model.core.IName name, de.topicmapslab.majortom.model.core.ITopic type)
          Cache the type of the given name to internal cache.
 void cacheOccurrenceType(de.topicmapslab.majortom.model.core.IOccurrence occurrence, de.topicmapslab.majortom.model.core.ITopic type)
          Cache the type of the given occurrence to internal cache.
 void cacheRoleType(de.topicmapslab.majortom.model.core.IAssociationRole role, de.topicmapslab.majortom.model.core.ITopic type)
          Cache the type of the given role to internal cache.
 void cacheType(de.topicmapslab.majortom.model.core.ITypeable typeable, de.topicmapslab.majortom.model.core.ITopic type)
          Cache the type of the given typed construct to internal cache.
 void clear()
          
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getAssociationTypes()
          Return a set containing all topic types used as type of an association item.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getCharacteristicTypes()
          Return a set containing all topic types used as type of a characteristics item.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getNameTypes()
          Return a set containing all topic types used as type of a name item.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getOccurrenceTypes()
          Return a set containing all topic types used as type of an occurrence item.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getRoleTypes()
          Return a set containing all topic types used as type of a role item.
<T extends de.topicmapslab.majortom.model.core.ITypeable>
de.topicmapslab.majortom.model.core.ITopic
getType(java.util.Map<T,de.topicmapslab.majortom.model.core.ITopic> map, T typed)
          Secure extraction of the type of the given typed attribute from the given map
 de.topicmapslab.majortom.model.core.ITopic getType(org.tmapi.core.Typed typed)
          Return the type of the typed attribute
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypes(java.lang.Class<? extends de.topicmapslab.majortom.model.core.ITypeable> clazz)
          Return a set containing all topic types used as type of constructs of the given class
 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

types

private java.util.Map<java.lang.Class<? extends de.topicmapslab.majortom.model.core.ITypeable>,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> types
map containing all known types


nameTypes

private java.util.Map<de.topicmapslab.majortom.model.core.IName,de.topicmapslab.majortom.model.core.ITopic> nameTypes
storage map of the name-type relation


occurrenceTypes

private java.util.Map<de.topicmapslab.majortom.model.core.IOccurrence,de.topicmapslab.majortom.model.core.ITopic> occurrenceTypes
storage map of the occurrence-type relation


associationTypes

private java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,de.topicmapslab.majortom.model.core.ITopic> associationTypes
storage map of the association-type relation


roleTypes

private java.util.Map<de.topicmapslab.majortom.model.core.IAssociationRole,de.topicmapslab.majortom.model.core.ITopic> roleTypes
storage map of the role-type relation

Constructor Detail

TypedCache

TypedCache()
Method Detail

clear

public void clear()


getType

public <T extends de.topicmapslab.majortom.model.core.ITypeable> de.topicmapslab.majortom.model.core.ITopic getType(java.util.Map<T,de.topicmapslab.majortom.model.core.ITopic> map,
                                                                                                                    T typed)
Secure extraction of the type of the given typed attribute from the given map

Type Parameters:
T - the generic type of the typed
Parameters:
map - the map containing the type
typed - the typed
Returns:
the type or null if the key is not contained by the given map or the map is null

getType

public de.topicmapslab.majortom.model.core.ITopic getType(org.tmapi.core.Typed typed)
Return the type of the typed attribute

Parameters:
typed - the typed item
Returns:
the type

getCharacteristicTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getCharacteristicTypes()
Return a set containing all topic types used as type of a characteristics item.

Returns:
a set of all types

getTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getTypes(java.lang.Class<? extends de.topicmapslab.majortom.model.core.ITypeable> clazz)
Return a set containing all topic types used as type of constructs of the given class

Parameters:
clazz - the class of constructs
Returns:
a set of all types

getRoleTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getRoleTypes()
Return a set containing all topic types used as type of a role item.

Returns:
a set of all types

getAssociationTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getAssociationTypes()
Return a set containing all topic types used as type of an association item.

Returns:
a set of all types

getNameTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getNameTypes()
Return a set containing all topic types used as type of a name item.

Returns:
a set of all types

getOccurrenceTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getOccurrenceTypes()
Return a set containing all topic types used as type of an occurrence item.

Returns:
a set of all types

cacheType

public void cacheType(de.topicmapslab.majortom.model.core.ITypeable typeable,
                      de.topicmapslab.majortom.model.core.ITopic type)
Cache the type of the given typed construct to internal cache.

Parameters:
typeable - the typed construct
type - the type

cacheAssociationType

public void cacheAssociationType(de.topicmapslab.majortom.model.core.IAssociation association,
                                 de.topicmapslab.majortom.model.core.ITopic type)
Cache the type of the given association to internal cache.

Parameters:
association - the association
type - the type

cacheNameType

public void cacheNameType(de.topicmapslab.majortom.model.core.IName name,
                          de.topicmapslab.majortom.model.core.ITopic type)
Cache the type of the given name to internal cache.

Parameters:
name - the name
type - the type

cacheOccurrenceType

public void cacheOccurrenceType(de.topicmapslab.majortom.model.core.IOccurrence occurrence,
                                de.topicmapslab.majortom.model.core.ITopic type)
Cache the type of the given occurrence to internal cache.

Parameters:
occurrence - the occurrence
type - the type

cacheRoleType

public void cacheRoleType(de.topicmapslab.majortom.model.core.IAssociationRole role,
                          de.topicmapslab.majortom.model.core.ITopic type)
Cache the type of the given role to internal cache.

Parameters:
role - the role
type - the type

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