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

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

public class ScopeStore
extends java.lang.Object
implements IDataStore

Internal data store of scoped-scope relations

Author:
Sven Krosse

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  de.topicmapslab.majortom.model.core.IScope emptyScope
          empty scope
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.IAssociation>> scopedAssociations
          storage map of scope-association relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IName>> scopedNames
          storage map of scope-name relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence>> scopedOccurrences
          storage map of scope-occurrence relation
private  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IVariant>> scopedVariants
          storage map of scope-variant 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  de.topicmapslab.majortom.model.store.ITopicMapStore store
          the topic map store
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
ScopeStore(de.topicmapslab.majortom.model.store.ITopicMapStore store)
          constructor
 
Method Summary
 void close()
          Remove all items from the internal store.
protected  boolean containsScopeable(de.topicmapslab.majortom.model.core.IScopable scopable)
          Method checks if the given object is stored by the current data store.
protected  de.topicmapslab.majortom.model.core.IScope createEmptyScope()
          Generates a new empty scope construct
protected  java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,de.topicmapslab.majortom.model.core.IScope> getAssociationScopeMap()
          storage map of association-scope relation
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getAssociationScopes()
          Return all scopes used by association items.
 de.topicmapslab.majortom.model.core.IScope getEmptyScope()
          Returns the empty scope object.
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getNameScopes()
          Return all scopes used by name items.
protected  java.util.Map<de.topicmapslab.majortom.model.core.IName,de.topicmapslab.majortom.model.core.IScope> getNameScopesMap()
          storage map of name-scope relation
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getOccurrenceScopes()
          Return all scopes used by occurrence items.
protected  java.util.Map<de.topicmapslab.majortom.model.core.IOccurrence,de.topicmapslab.majortom.model.core.IScope> getOccurrenceScopesMap()
          storage map of occurrence-scope relation
 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.IAssociation scoped)
          Returns the scope of the scoped construct
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IName scoped)
          Returns the scope of the scoped construct
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IOccurrence scoped)
          Returns the scope of the scoped construct
 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
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IVariant scoped)
          Returns the scope of the scoped construct
 java.util.Set<de.topicmapslab.majortom.model.core.IScopable> getScoped(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped items of the given scope.
protected  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IAssociation>> getScopedAssociationMap()
          storage map of scope-association relation
 java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getScopedAssociations(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped association items of the given scope.
 java.util.Set<de.topicmapslab.majortom.model.core.IName> getScopedNames(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped name items of the given scope.
protected  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IName>> getScopedNamesMap()
          storage map of scope-name relation
 java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getScopedOccurrences(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped occurrences of the given scope.
protected  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence>> getScopedOccurrencesMap()
          storage map of scope-occurrence relation
 java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getScopedVariants(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped variant items of the given scope.
protected  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IVariant>> getScopedVariantsMap()
          storage map of scope-variant relation
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getScopes()
          Returns all scopes
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getScopes(de.topicmapslab.majortom.model.core.ITopic theme)
          Return all scopes containing the given theme
protected  java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.ITopic>> getScopesMap()
           
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.IScope> getVariantScopes()
          Return all scopes used by variant items.
protected  java.util.Map<de.topicmapslab.majortom.model.core.IVariant,de.topicmapslab.majortom.model.core.IScope> getVariantScopesMap()
          storage map of variant-scope relation
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IAssociation scoped)
          Remove the relation between the scoped construct and the stored scope.
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IName scoped)
          Remove the relation between the scoped construct and the stored scope.
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IOccurrence scoped)
          Remove the relation between the scoped construct and the stored scope.
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IScopable scoped)
          Remove the relation between the scoped construct and the stored scope.
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IVariant scoped)
          Remove the relation between the scoped construct and the stored scope.
 java.util.Set<de.topicmapslab.majortom.model.core.IScopable> removeScopes(de.topicmapslab.majortom.model.core.ITopic theme)
          Removing the theme and all dependent scopes and scoped objects.
 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.
 void setScope(de.topicmapslab.majortom.model.core.IAssociation scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 void setScope(de.topicmapslab.majortom.model.core.IName scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 void setScope(de.topicmapslab.majortom.model.core.IOccurrence scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 void setScope(de.topicmapslab.majortom.model.core.IScopable scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 void setScope(de.topicmapslab.majortom.model.core.IVariant scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 boolean usedAsTheme(de.topicmapslab.majortom.model.core.ITopic theme)
          Method checks if the given topic is used as theme.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

store

private final de.topicmapslab.majortom.model.store.ITopicMapStore store
the topic map store


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


scopedNames

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


scopedOccurrences

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


scopedVariants

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


scopedAssociations

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


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


emptyScope

private de.topicmapslab.majortom.model.core.IScope emptyScope
empty scope

Constructor Detail

ScopeStore

public ScopeStore(de.topicmapslab.majortom.model.store.ITopicMapStore store)
constructor

Parameters:
store - the topic map store
Method Detail

getStore

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

Returns:
the topic map store

createEmptyScope

protected de.topicmapslab.majortom.model.core.IScope createEmptyScope()
Generates a new empty scope construct

Returns:
the scope construct

close

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

Specified by:
close in interface IDataStore

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

getScoped

public java.util.Set<de.topicmapslab.majortom.model.core.IScopable> getScoped(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped items of the given scope.

Parameters:
scope - the scope
Returns:
the scoped construct

getScopedOccurrences

public java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getScopedOccurrences(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped occurrences of the given scope.

Parameters:
scope - the scope
Returns:
the scoped occurrences

getScopedNames

public java.util.Set<de.topicmapslab.majortom.model.core.IName> getScopedNames(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped name items of the given scope.

Parameters:
scope - the scope
Returns:
the scoped names

getScopedVariants

public java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getScopedVariants(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped variant items of the given scope.

Parameters:
scope - the scope
Returns:
the scoped variant items

getScopedAssociations

public java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getScopedAssociations(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped association items of the given scope.

Parameters:
scope - the scope
Returns:
the scoped association items

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

getScope

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

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

getScope

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

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

getScope

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

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

getScope

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

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

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IScopable scoped)
Remove the relation between the scoped construct and the stored scope.

Parameters:
scoped - the scoped construct
Returns:
the old scope

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IAssociation scoped)
Remove the relation between the scoped construct and the stored scope.

Parameters:
scoped - the scoped construct
Returns:
the old scope

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IOccurrence scoped)
Remove the relation between the scoped construct and the stored scope.

Parameters:
scoped - the scoped construct
Returns:
the old scope

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IName scoped)
Remove the relation between the scoped construct and the stored scope.

Parameters:
scoped - the scoped construct
Returns:
the old scope

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IVariant scoped)
Remove the relation between the scoped construct and the stored scope.

Parameters:
scoped - the scoped construct
Returns:
the old scope

setScope

public void setScope(de.topicmapslab.majortom.model.core.IScopable scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Parameters:
scoped - the scoped construct
s - the scope

setScope

public void setScope(de.topicmapslab.majortom.model.core.IAssociation scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Parameters:
scoped - the scoped construct
s - the scope

setScope

public void setScope(de.topicmapslab.majortom.model.core.IOccurrence scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Parameters:
scoped - the scoped construct
s - the scope

setScope

public void setScope(de.topicmapslab.majortom.model.core.IName scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Parameters:
scoped - the scoped construct
s - the scope

setScope

public void setScope(de.topicmapslab.majortom.model.core.IVariant scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Parameters:
scoped - the scoped construct
s - the scope

getEmptyScope

public de.topicmapslab.majortom.model.core.IScope getEmptyScope()
Returns the empty scope object.

Returns:
the empty scope object

usedAsTheme

public boolean usedAsTheme(de.topicmapslab.majortom.model.core.ITopic theme)
Method checks if the given topic is used as theme.

Parameters:
theme - the theme
Returns:
true if the topic is used as theme, false otherwise.

removeScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScopable> removeScopes(de.topicmapslab.majortom.model.core.ITopic theme)
Removing the theme and all dependent scopes and scoped objects.

Parameters:
theme - the theme
Returns:
the removed scoped objects

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

getScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getScopes(de.topicmapslab.majortom.model.core.ITopic theme)
Return all scopes containing the given theme

Parameters:
theme - the theme
Returns:
a collection of all themes

getNameScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getNameScopes()
Return all scopes used by name items.

Returns:
all scopes

getOccurrenceScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getOccurrenceScopes()
Return all scopes used by occurrence items.

Returns:
all scopes

getAssociationScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getAssociationScopes()
Return all scopes used by association items.

Returns:
all scopes

getVariantScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getVariantScopes()
Return all scopes used by variant items.

Returns:
all scopes

containsScopeable

protected final boolean containsScopeable(de.topicmapslab.majortom.model.core.IScopable scopable)
Method checks if the given object is stored by the current data store.

Parameters:
scopable - the object to check
Returns:
true if the data store contains a scope relation for the given object, false otherwise.

getScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getScopes()
Returns all scopes

Returns:
the scopes

getScopesMap

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

getScopedNamesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IName>> getScopedNamesMap()
storage map of scope-name relation


getScopedOccurrencesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence>> getScopedOccurrencesMap()
storage map of scope-occurrence relation


getScopedVariantsMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IVariant>> getScopedVariantsMap()
storage map of scope-variant relation


getScopedAssociationMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IScope,java.util.Set<de.topicmapslab.majortom.model.core.IAssociation>> getScopedAssociationMap()
storage map of scope-association relation


getNameScopesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IName,de.topicmapslab.majortom.model.core.IScope> getNameScopesMap()
storage map of name-scope relation


getOccurrenceScopesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IOccurrence,de.topicmapslab.majortom.model.core.IScope> getOccurrenceScopesMap()
storage map of occurrence-scope relation


getVariantScopesMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IVariant,de.topicmapslab.majortom.model.core.IScope> getVariantScopesMap()
storage map of variant-scope relation


getAssociationScopeMap

protected java.util.Map<de.topicmapslab.majortom.model.core.IAssociation,de.topicmapslab.majortom.model.core.IScope> getAssociationScopeMap()
storage map of association-scope relation