de.topicmapslab.majortom.cache
Class ScopeCache

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

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


Field Summary
private  java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,de.topicmapslab.majortom.model.core.IScope> associationScopes
          storage map of association-scope relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IName,de.topicmapslab.majortom.model.core.IScope> nameScopes
          storage map of name-scope relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IOccurrence,de.topicmapslab.majortom.model.core.IScope> occurrenceScopes
          storage map of occurrence-scope relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> scopes
          storage map of scope-themes mapping
private  java.util.Map<de.topicmapslab.majortom.model.core.IVariant,de.topicmapslab.majortom.model.core.IScope> variantScopes
          storage map of variant-scope relation
 
Constructor Summary
ScopeCache()
           
 
Method Summary
 void cacheAssociationScope(de.topicmapslab.majortom.model.core.IAssociation association, de.topicmapslab.majortom.model.core.IScope scope)
          Cache the scope of the given association to the internal store
 void cacheNameScope(de.topicmapslab.majortom.model.core.IName name, de.topicmapslab.majortom.model.core.IScope scope)
          Cache the scope of the given name to the internal store
 void cacheOccurrenceScope(de.topicmapslab.majortom.model.core.IOccurrence occurrence, de.topicmapslab.majortom.model.core.IScope scope)
          Cache the scope of the given occurrence to the internal store
 void cacheScope(de.topicmapslab.majortom.model.core.IScopable scopable, de.topicmapslab.majortom.model.core.IScope scope)
          Cache the scope of the given construct to the internal store
 void cacheVariantScope(de.topicmapslab.majortom.model.core.IVariant variant, de.topicmapslab.majortom.model.core.IScope scope)
          Cache the scope of the given variant to the internal store
 void clear()
          
 de.topicmapslab.majortom.model.core.IScope getScope(java.util.Collection<de.topicmapslab.majortom.model.core.ITopic> themes)
          Returns the scope instance for the given themes
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IScopable scoped)
          Returns the scope of the scoped construct
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.ITopic... themes)
          Returns the scope instance for the given themes
<T extends de.topicmapslab.majortom.model.core.IScopable>
de.topicmapslab.majortom.model.core.IScope
getScope(java.util.Map<T,de.topicmapslab.majortom.model.core.IScope> map, T scoped)
          Secure extraction of the scope of the given scoped construct from the given map
 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

scopes

private java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> scopes
storage map of scope-themes mapping


nameScopes

private java.util.Map<de.topicmapslab.majortom.model.core.IName,de.topicmapslab.majortom.model.core.IScope> nameScopes
storage map of name-scope relation


occurrenceScopes

private java.util.Map<de.topicmapslab.majortom.model.core.IOccurrence,de.topicmapslab.majortom.model.core.IScope> occurrenceScopes
storage map of occurrence-scope relation


variantScopes

private java.util.Map<de.topicmapslab.majortom.model.core.IVariant,de.topicmapslab.majortom.model.core.IScope> variantScopes
storage map of variant-scope relation


associationScopes

private java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,de.topicmapslab.majortom.model.core.IScope> associationScopes
storage map of association-scope relation

Constructor Detail

ScopeCache

public ScopeCache()
Method Detail

clear

public void clear()


getScope

public de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.ITopic... themes)
Returns the scope instance for the given themes

Parameters:
themes - the themes
Returns:
the scope instance

getScope

public de.topicmapslab.majortom.model.core.IScope getScope(java.util.Collection<de.topicmapslab.majortom.model.core.ITopic> themes)
Returns the scope instance for the given themes

Parameters:
themes - the themes
Returns:
the scope instance

getScope

public <T extends de.topicmapslab.majortom.model.core.IScopable> de.topicmapslab.majortom.model.core.IScope getScope(java.util.Map<T,de.topicmapslab.majortom.model.core.IScope> map,
                                                                                                                     T scoped)
Secure extraction of the scope of the given scoped construct from the given map

Type Parameters:
T - the generic type of scoped item
Parameters:
map - the map
scoped - the scoped item
Returns:
the scope or null if the given map is null or does not contain the given key

getScope

public de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IScopable scoped)
Returns the scope of the scoped construct

Parameters:
scoped - the scoped construct
Returns:
the scope and never null

cacheScope

public void cacheScope(de.topicmapslab.majortom.model.core.IScopable scopable,
                       de.topicmapslab.majortom.model.core.IScope scope)
Cache the scope of the given construct to the internal store

Parameters:
scopable - the scoped item
scope - the scope

cacheAssociationScope

public void cacheAssociationScope(de.topicmapslab.majortom.model.core.IAssociation association,
                                  de.topicmapslab.majortom.model.core.IScope scope)
Cache the scope of the given association to the internal store

Parameters:
association - the association
scope - the scope

cacheNameScope

public void cacheNameScope(de.topicmapslab.majortom.model.core.IName name,
                           de.topicmapslab.majortom.model.core.IScope scope)
Cache the scope of the given name to the internal store

Parameters:
name - the name
scope - the scope

cacheOccurrenceScope

public void cacheOccurrenceScope(de.topicmapslab.majortom.model.core.IOccurrence occurrence,
                                 de.topicmapslab.majortom.model.core.IScope scope)
Cache the scope of the given occurrence to the internal store

Parameters:
occurrence - the occurrence
scope - the scope

cacheVariantScope

public void cacheVariantScope(de.topicmapslab.majortom.model.core.IVariant variant,
                              de.topicmapslab.majortom.model.core.IScope scope)
Cache the scope of the given variant to the internal store

Parameters:
variant - the variant
scope - the scope

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