de.topicmapslab.majortom.inmemory.virtual.internal
Class VirtualCharacteristicsStore<T extends VirtualTopicMapStore>

java.lang.Object
  extended by de.topicmapslab.majortom.inmemory.store.internal.CharacteristicsStore
      extended by de.topicmapslab.majortom.inmemory.virtual.internal.VirtualCharacteristicsStore<T>
All Implemented Interfaces:
IDataStore, IVirtualStore
Direct Known Subclasses:
LazyCharacteristicsStore

public class VirtualCharacteristicsStore<T extends VirtualTopicMapStore>
extends CharacteristicsStore
implements IVirtualStore

Author:
Sven Krosse

Field Summary
private  java.util.Set<java.lang.String> changedDatatypes
           
private  T store
           
 
Constructor Summary
VirtualCharacteristicsStore(T store, de.topicmapslab.majortom.model.core.ILocator xsdString, int initialCapacity)
          constructor
 
Method Summary
 void addName(de.topicmapslab.majortom.model.core.ITopic t, de.topicmapslab.majortom.model.core.IName n)
          Add the given name to the internal data store.
 void addOccurrence(de.topicmapslab.majortom.model.core.ITopic t, de.topicmapslab.majortom.model.core.IOccurrence o)
          Add the given occurrence to the internal data store.
 void addVariant(de.topicmapslab.majortom.model.core.IName n, de.topicmapslab.majortom.model.core.IVariant v)
          Add the given variant to the internal data store.
 void close()
          Remove all items from the internal store.
 de.topicmapslab.majortom.model.core.ILocator getDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware dataTypeAware)
          Returns the data type of the given data-type-aware
 java.util.Set<de.topicmapslab.majortom.model.core.IDatatypeAware> getDatatypeAwares(de.topicmapslab.majortom.model.core.ILocator locator)
          Returns all data-typed items with the given data type.
 java.util.Set<de.topicmapslab.majortom.model.core.IName> getNames()
          Returns the names of all topics.
 java.util.Set<de.topicmapslab.majortom.model.core.IName> getNames(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the names of the given topic.
 java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getOccurrences()
          Returns the occurrences of all topics.
 java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getOccurrences(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the occurrences of the given topic.
protected  T getStore()
          Returns the internal reference of the topic map store.
 java.lang.Object getValue(de.topicmapslab.majortom.model.core.IConstruct obj)
          Returns the value of the given object
 java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getVariants()
          Returns the variants of the all names.
 java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getVariants(de.topicmapslab.majortom.model.core.IName n)
          Returns the variants of the given name.
protected  VirtualIdentityStore<T> getVirtualIdentityStore()
          Internal method to access the virtual-identity store
 void removeName(de.topicmapslab.majortom.model.core.IName n)
          Remove the given name from the internal data store.
 void removeOccurrence(de.topicmapslab.majortom.model.core.IOccurrence o)
          Remove the given occurrence from the internal data store.
 void removeTopic(de.topicmapslab.majortom.model.core.ITopic topic)
          Remove the given topic as parent from the internal store
 void removeVariant(de.topicmapslab.majortom.model.core.IVariant v)
          Remove the given occurrence from the internal data store.
 void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IConstruct construct, de.topicmapslab.majortom.model.core.IConstruct newConstruct)
          Removes the virtual construct from the internal memory layer.
private  void replaceDatatypeBinding(de.topicmapslab.majortom.model.core.IDatatypeAware construct, de.topicmapslab.majortom.model.core.IDatatypeAware newConstruct)
          Internal method to replace datatype mappings
private  void replaceValueBinding(de.topicmapslab.majortom.model.core.IConstruct construct, de.topicmapslab.majortom.model.core.IConstruct newConstruct)
          Internal method to replace value mappings
 de.topicmapslab.majortom.model.core.ILocator setDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware dataTypeAware, de.topicmapslab.majortom.model.core.ILocator dataType)
          Modify the data type of the given data-type-aware
 java.lang.Object setValue(de.topicmapslab.majortom.model.core.IConstruct obj, java.lang.Object value)
          Modify the value of the given object
 
Methods inherited from class de.topicmapslab.majortom.inmemory.store.internal.CharacteristicsStore
containsDatatype, getCharacteristics, getCharacteristics, getDataTypedMap, getDataTypesMap, getNamesByValue, getNamesByValue, getNamesByValueMap, getNamesMap, getOccurrencesByValue, getOccurrencesByValue, getOccurrencesByValueMap, getOccurrencesMap, getValueAsString, getValuesMap, getVariantsByValue, getVariantsByValue, getVariantsByValueMap, getVariantsMap, replace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.topicmapslab.majortom.inmemory.store.model.IDataStore
replace
 

Field Detail

store

private final T extends VirtualTopicMapStore store

changedDatatypes

private java.util.Set<java.lang.String> changedDatatypes
Constructor Detail

VirtualCharacteristicsStore

public VirtualCharacteristicsStore(T store,
                                   de.topicmapslab.majortom.model.core.ILocator xsdString,
                                   int initialCapacity)
constructor

Parameters:
store - the transaction store
xsdString - the locator of XSD string
initialCapacity - the initial capacity
Method Detail

close

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

Specified by:
close in interface IDataStore
Overrides:
close in class CharacteristicsStore

getVirtualIdentityStore

protected VirtualIdentityStore<T> getVirtualIdentityStore()
Internal method to access the virtual-identity store

Returns:
the virtual identity store

getStore

protected T getStore()
Returns the internal reference of the topic map store.

Returns:
the topic map store

addName

public void addName(de.topicmapslab.majortom.model.core.ITopic t,
                    de.topicmapslab.majortom.model.core.IName n)
Add the given name to the internal data store.

Overrides:
addName in class CharacteristicsStore
Parameters:
t - the parent topic
n - the name

addOccurrence

public void addOccurrence(de.topicmapslab.majortom.model.core.ITopic t,
                          de.topicmapslab.majortom.model.core.IOccurrence o)
Add the given occurrence to the internal data store.

Overrides:
addOccurrence in class CharacteristicsStore
Parameters:
t - the parent topic

addVariant

public void addVariant(de.topicmapslab.majortom.model.core.IName n,
                       de.topicmapslab.majortom.model.core.IVariant v)
Add the given variant to the internal data store.

Overrides:
addVariant in class CharacteristicsStore
Parameters:
n - the name
v - the variant

getDatatype

public de.topicmapslab.majortom.model.core.ILocator getDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware dataTypeAware)
Returns the data type of the given data-type-aware

Overrides:
getDatatype in class CharacteristicsStore
Parameters:
dataTypeAware - the data-type-aware
Returns:
the data type

getDatatypeAwares

public java.util.Set<de.topicmapslab.majortom.model.core.IDatatypeAware> getDatatypeAwares(de.topicmapslab.majortom.model.core.ILocator locator)
Returns all data-typed items with the given data type.

Overrides:
getDatatypeAwares in class CharacteristicsStore
Parameters:
locator - the data type
Returns:
a set

getNames

public java.util.Set<de.topicmapslab.majortom.model.core.IName> getNames()
Returns the names of all topics.

Overrides:
getNames in class CharacteristicsStore
Returns:
the names

getNames

public java.util.Set<de.topicmapslab.majortom.model.core.IName> getNames(de.topicmapslab.majortom.model.core.ITopic t)
Returns the names of the given topic.

Overrides:
getNames in class CharacteristicsStore
Parameters:
t - the topic
Returns:
the names

getOccurrences

public java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getOccurrences()
Returns the occurrences of all topics.

Overrides:
getOccurrences in class CharacteristicsStore
Returns:
the occurrences

getOccurrences

public java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getOccurrences(de.topicmapslab.majortom.model.core.ITopic t)
Returns the occurrences of the given topic.

Overrides:
getOccurrences in class CharacteristicsStore
Parameters:
t - the topic
Returns:
the occurrences

getVariants

public java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getVariants()
Returns the variants of the all names.

Overrides:
getVariants in class CharacteristicsStore
Returns:
the variants

getVariants

public java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getVariants(de.topicmapslab.majortom.model.core.IName n)
Returns the variants of the given name.

Overrides:
getVariants in class CharacteristicsStore
Parameters:
n - the name
Returns:
the variants

getValue

public java.lang.Object getValue(de.topicmapslab.majortom.model.core.IConstruct obj)
Returns the value of the given object

Overrides:
getValue in class CharacteristicsStore
Parameters:
obj - the object
Returns:
the value

setValue

public java.lang.Object setValue(de.topicmapslab.majortom.model.core.IConstruct obj,
                                 java.lang.Object value)
Modify the value of the given object

Overrides:
setValue in class CharacteristicsStore
Parameters:
obj - the object
value - the new value
Returns:
the old value

setDatatype

public de.topicmapslab.majortom.model.core.ILocator setDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware dataTypeAware,
                                                                de.topicmapslab.majortom.model.core.ILocator dataType)
Modify the data type of the given data-type-aware

Overrides:
setDatatype in class CharacteristicsStore
Parameters:
dataTypeAware - the data-type-aware
dataType - the new data type
Returns:
the old data type

removeTopic

public void removeTopic(de.topicmapslab.majortom.model.core.ITopic topic)
Remove the given topic as parent from the internal store

Overrides:
removeTopic in class CharacteristicsStore
Parameters:
topic - the topic to remove

removeName

public void removeName(de.topicmapslab.majortom.model.core.IName n)
Remove the given name from the internal data store.

Overrides:
removeName in class CharacteristicsStore
Parameters:
n - the name

removeVariant

public void removeVariant(de.topicmapslab.majortom.model.core.IVariant v)
Remove the given occurrence from the internal data store.

Overrides:
removeVariant in class CharacteristicsStore
Parameters:
v - the variant

removeOccurrence

public void removeOccurrence(de.topicmapslab.majortom.model.core.IOccurrence o)
Remove the given occurrence from the internal data store.

Overrides:
removeOccurrence in class CharacteristicsStore
Parameters:
o - the occurrence

removeVirtualConstruct

public void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IConstruct construct,
                                   de.topicmapslab.majortom.model.core.IConstruct newConstruct)
Removes the virtual construct from the internal memory layer. But does not delete the construct in underlying data store.

Specified by:
removeVirtualConstruct in interface IVirtualStore
Parameters:
construct - the construct to remove
newConstruct - the new construct

replaceValueBinding

private void replaceValueBinding(de.topicmapslab.majortom.model.core.IConstruct construct,
                                 de.topicmapslab.majortom.model.core.IConstruct newConstruct)
Internal method to replace value mappings

Parameters:
construct - the old construct
newConstruct - the new construct

replaceDatatypeBinding

private void replaceDatatypeBinding(de.topicmapslab.majortom.model.core.IDatatypeAware construct,
                                    de.topicmapslab.majortom.model.core.IDatatypeAware newConstruct)
Internal method to replace datatype mappings

Parameters:
construct - the old construct
newConstruct - the new construct