de.topicmapslab.majortom.index.paged
Class PagedConstructIndexImpl<T extends de.topicmapslab.majortom.model.store.ITopicMapStore>

java.lang.Object
  extended by de.topicmapslab.majortom.index.IndexImpl<T>
      extended by de.topicmapslab.majortom.index.core.BaseCachedIndexImpl<T>
          extended by de.topicmapslab.majortom.index.paged.PagedConstructIndexImpl<T>
All Implemented Interfaces:
de.topicmapslab.majortom.model.event.ITopicMapListener, de.topicmapslab.majortom.model.index.IIndex, de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex, org.tmapi.index.Index
Direct Known Subclasses:
InMemoryPagedConstructIndex, JdbcPagedConstructIndex, PagedRedisConstructIndex

public abstract class PagedConstructIndexImpl<T extends de.topicmapslab.majortom.model.store.ITopicMapStore>
extends BaseCachedIndexImpl<T>
implements de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex, de.topicmapslab.majortom.model.event.ITopicMapListener

Implementation of IPagedConstructIndex

Author:
Sven Krosse

Nested Class Summary
(package private) static class PagedConstructIndexImpl.Type
           
 
Field Summary
private  java.util.Map<ConstructCacheKey,java.util.List<? extends org.tmapi.core.Construct>> cachedConstructs
           
private  java.util.Map<ConstructCacheKey,java.lang.Long> cachedNumbersOfChildren
           
private  java.util.Map<java.lang.Object,java.util.Set<ConstructCacheKey>> dependentKeys
           
 
Constructor Summary
PagedConstructIndexImpl(T store)
           
 
Method Summary
protected
<X extends org.tmapi.core.Construct>
void
cacheConstructs(PagedConstructIndexImpl.Type type, org.tmapi.core.Construct context, java.lang.Integer offset, java.lang.Integer limit, java.util.Comparator<X> comparator, java.util.List<X> values)
          Internal method to add dependent constructs of the given parent construct to internal cache
protected
<X extends org.tmapi.core.Construct>
void
cacheConstructs(PagedConstructIndexImpl.Type type, org.tmapi.core.Construct context, java.lang.Integer offset, java.lang.Integer limit, java.util.List<X> values)
          Internal method to add dependent constructs of the given parent construct to internal cache
protected  void cacheNumberOfConstructs(PagedConstructIndexImpl.Type type, org.tmapi.core.Construct context, java.lang.Long noc)
          Internal method to read the number of contained construct.
 void clear()
          Removed any cached content from internal cache
 void clearCache()
          Internal method to clear the cache
 void close()
          
protected  java.util.List<org.tmapi.core.Association> doGetAssociations(int offset, int limit)
          Returns all associations of the topic map as a list within the given range.
protected  java.util.List<org.tmapi.core.Association> doGetAssociations(int offset, int limit, java.util.Comparator<org.tmapi.core.Association> comparator)
          Returns all associations of the topic map as a sorted list within the given range.
protected  java.util.List<org.tmapi.core.Association> doGetAssociationsPlayed(org.tmapi.core.Topic topic, int offset, int limit)
          Returns all associations played by given topic as a list within the given range.
protected  java.util.List<org.tmapi.core.Association> doGetAssociationsPlayed(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Association> comparator)
          Returns all associations played by given topic as a sorted list within the given range.
protected  java.util.List<org.tmapi.core.Name> doGetNames(org.tmapi.core.Topic topic, int offset, int limit)
          Returns all names of the given topic as a list within the given range.
protected  java.util.List<org.tmapi.core.Name> doGetNames(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Name> comparator)
          Returns all names of the given topic as a sorted list within the given range.
protected  long doGetNumberOfAssociations()
          Return the number of associations of the topic map
protected  long doGetNumberOfAssociationsPlayed(org.tmapi.core.Topic topic)
          Return the number of played associations of the topic
protected  long doGetNumberOfNames(org.tmapi.core.Topic topic)
          Return the number of names of the topic
protected  long doGetNumberOfOccurrences(org.tmapi.core.Topic topic)
          Return the number of occurrences of the topic
protected  long doGetNumberOfRoles(org.tmapi.core.Association association)
          Return the number of roles of the association
protected  long doGetNumberOfRolesPlayed(org.tmapi.core.Topic topic)
          Return the number of played roles of the topic
protected  long doGetNumberOfSupertypes(org.tmapi.core.Topic topic)
          Return the number of supetypes of the topic
protected  long doGetNumberOfTopics()
          Return the number of topics
protected  long doGetNumberOfTypes(org.tmapi.core.Topic topic)
          Return the number of types of the topic
protected  long doGetNumberOfVariants(org.tmapi.core.Name name)
          Return the number of variants of the name
protected  java.util.List<org.tmapi.core.Occurrence> doGetOccurrences(org.tmapi.core.Topic topic, int offset, int limit)
          Returns all occurrences of the given topic as a list within the given range.
protected  java.util.List<org.tmapi.core.Occurrence> doGetOccurrences(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Occurrence> comparator)
          Returns all occurrences of the given topic as a sorted list within the given range.
protected  java.util.List<org.tmapi.core.Role> doGetRoles(org.tmapi.core.Association association, int offset, int limit)
          Returns all roles of the given association as a list within the given range.
protected  java.util.List<org.tmapi.core.Role> doGetRoles(org.tmapi.core.Association association, int offset, int limit, java.util.Comparator<org.tmapi.core.Role> comparator)
          Returns all roles of the given association as a sorted list within the given range.
protected  java.util.List<org.tmapi.core.Role> doGetRolesPlayed(org.tmapi.core.Topic topic, int offset, int limit)
          Returns all roles played by given topic as a list within the given range.
protected  java.util.List<org.tmapi.core.Role> doGetRolesPlayed(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Role> comparator)
          Returns all roles played by given topic as a sorted list within the given range.
protected  java.util.List<org.tmapi.core.Topic> doGetSupertypes(org.tmapi.core.Topic topic, int offset, int limit)
          Returns all supetypes of the given topic as a list within the given range.
protected  java.util.List<org.tmapi.core.Topic> doGetSupertypes(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Topic> comparator)
          Returns all supetypes of the given topic as a sorted list within the given range.
protected  java.util.List<org.tmapi.core.Topic> doGetTopics(int offset, int limit)
          Returns all topics of the topic map as a list within the given range.
protected  java.util.List<org.tmapi.core.Topic> doGetTopics(int offset, int limit, java.util.Comparator<org.tmapi.core.Topic> comparator)
          Returns all topics of the topic map within the given range.
protected  java.util.List<org.tmapi.core.Topic> doGetTypes(org.tmapi.core.Topic topic, int offset, int limit)
          Returns all types of the given topic as a list within the given range.
protected  java.util.List<org.tmapi.core.Topic> doGetTypes(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Topic> comparator)
          Returns all types of the given topic as a sorted list within the given range.
protected  java.util.List<org.tmapi.core.Variant> doGetVariants(org.tmapi.core.Name name, int offset, int limit)
          Returns all variants of the given name as a list within the given range.
protected  java.util.List<org.tmapi.core.Variant> doGetVariants(org.tmapi.core.Name name, int offset, int limit, java.util.Comparator<org.tmapi.core.Variant> comparator)
          Returns all variants of the given name as a sorted list within the given range.
private  ConstructCacheKey generateCacheKey(PagedConstructIndexImpl.Type type, org.tmapi.core.Construct context, java.lang.Integer offset, java.lang.Integer limit, java.util.Comparator<?> comparator)
          Generates a key for internal caching
 java.util.List<org.tmapi.core.Association> getAssociations(int offset, int limit)
          
 java.util.List<org.tmapi.core.Association> getAssociations(int offset, int limit, java.util.Comparator<org.tmapi.core.Association> comparator)
          
 java.util.List<org.tmapi.core.Association> getAssociationsPlayed(org.tmapi.core.Topic topic, int offset, int limit)
          
 java.util.List<org.tmapi.core.Association> getAssociationsPlayed(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Association> comparator)
          
private  java.util.Set<ConstructCacheKey> getDependentKeys(java.lang.Object criteria)
          Returns a set of cache keys dependents on the given criteria
 java.util.List<org.tmapi.core.Name> getNames(org.tmapi.core.Topic topic, int offset, int limit)
          
 java.util.List<org.tmapi.core.Name> getNames(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Name> comparator)
          
 long getNumberOfAssociations()
          
 long getNumberOfAssociationsPlayed(org.tmapi.core.Topic topic)
          
 long getNumberOfNames(org.tmapi.core.Topic topic)
          
 long getNumberOfOccurrences(org.tmapi.core.Topic topic)
          
 long getNumberOfRoles(org.tmapi.core.Association association)
          
 long getNumberOfRolesPlayed(org.tmapi.core.Topic topic)
          
 long getNumberOfSupertypes(org.tmapi.core.Topic topic)
          
 long getNumberOfTopics()
          
 long getNumberOfTypes(org.tmapi.core.Topic topic)
          
 long getNumberOfVariants(org.tmapi.core.Name name)
          
 java.util.List<org.tmapi.core.Occurrence> getOccurrences(org.tmapi.core.Topic topic, int offset, int limit)
          
 java.util.List<org.tmapi.core.Occurrence> getOccurrences(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Occurrence> comparator)
          
 java.util.List<org.tmapi.core.Role> getRoles(org.tmapi.core.Association association, int offset, int limit)
          
 java.util.List<org.tmapi.core.Role> getRoles(org.tmapi.core.Association association, int offset, int limit, java.util.Comparator<org.tmapi.core.Role> comparator)
          
 java.util.List<org.tmapi.core.Role> getRolesPlayed(org.tmapi.core.Topic topic, int offset, int limit)
          
 java.util.List<org.tmapi.core.Role> getRolesPlayed(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Role> comparator)
          
 java.util.List<org.tmapi.core.Topic> getSupertypes(org.tmapi.core.Topic topic, int offset, int limit)
          
 java.util.List<org.tmapi.core.Topic> getSupertypes(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Topic> comparator)
          
 java.util.List<org.tmapi.core.Topic> getTopics(int offset, int limit)
          
 java.util.List<org.tmapi.core.Topic> getTopics(int offset, int limit, java.util.Comparator<org.tmapi.core.Topic> comparator)
          
 java.util.List<org.tmapi.core.Topic> getTypes(org.tmapi.core.Topic topic, int offset, int limit)
          
 java.util.List<org.tmapi.core.Topic> getTypes(org.tmapi.core.Topic topic, int offset, int limit, java.util.Comparator<org.tmapi.core.Topic> comparator)
          
 java.util.List<org.tmapi.core.Variant> getVariants(org.tmapi.core.Name name, int offset, int limit)
          
 java.util.List<org.tmapi.core.Variant> getVariants(org.tmapi.core.Name name, int offset, int limit, java.util.Comparator<org.tmapi.core.Variant> comparator)
          
 void open()
          
protected
<X extends org.tmapi.core.Construct>
java.util.List<X>
readConstructs(PagedConstructIndexImpl.Type type, org.tmapi.core.Construct context, java.lang.Integer offset, java.lang.Integer limit)
          Internal method to read dependent constructs of the given parent construct from cache.
protected
<X extends org.tmapi.core.Construct>
java.util.List<X>
readConstructs(PagedConstructIndexImpl.Type type, org.tmapi.core.Construct context, java.lang.Integer offset, java.lang.Integer limit, java.util.Comparator<?> comparator)
          Internal method to read dependent constructs of the given parent construct from cache.
protected  java.lang.Long readNumberOfConstructs(PagedConstructIndexImpl.Type type, org.tmapi.core.Construct context)
          Internal method to read the number of contained construct.
 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 de.topicmapslab.majortom.index.core.BaseCachedIndexImpl
isCachingEnabled, isOnTransactionContext, isOnTransactionContext, isOnTransactionContext, isOnTransactionContext, isOnTransactionContext
 
Methods inherited from class de.topicmapslab.majortom.index.IndexImpl
getTopicMapStore, isAutoUpdated, isOpen, reindex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tmapi.index.Index
isAutoUpdated, isOpen, reindex
 

Field Detail

cachedNumbersOfChildren

private java.util.Map<ConstructCacheKey,java.lang.Long> cachedNumbersOfChildren

cachedConstructs

private java.util.Map<ConstructCacheKey,java.util.List<? extends org.tmapi.core.Construct>> cachedConstructs

dependentKeys

private java.util.Map<java.lang.Object,java.util.Set<ConstructCacheKey>> dependentKeys
Constructor Detail

PagedConstructIndexImpl

public PagedConstructIndexImpl(T store)
Parameters:
store -
Method Detail

getAssociations

public java.util.List<org.tmapi.core.Association> getAssociations(int offset,
                                                                  int limit)

Specified by:
getAssociations in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getAssociations

public java.util.List<org.tmapi.core.Association> getAssociations(int offset,
                                                                  int limit,
                                                                  java.util.Comparator<org.tmapi.core.Association> comparator)

Specified by:
getAssociations in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfAssociations

public long getNumberOfAssociations()

Specified by:
getNumberOfAssociations in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getAssociationsPlayed

public java.util.List<org.tmapi.core.Association> getAssociationsPlayed(org.tmapi.core.Topic topic,
                                                                        int offset,
                                                                        int limit)

Specified by:
getAssociationsPlayed in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getAssociationsPlayed

public java.util.List<org.tmapi.core.Association> getAssociationsPlayed(org.tmapi.core.Topic topic,
                                                                        int offset,
                                                                        int limit,
                                                                        java.util.Comparator<org.tmapi.core.Association> comparator)

Specified by:
getAssociationsPlayed in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfAssociationsPlayed

public long getNumberOfAssociationsPlayed(org.tmapi.core.Topic topic)

Specified by:
getNumberOfAssociationsPlayed in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNames

public java.util.List<org.tmapi.core.Name> getNames(org.tmapi.core.Topic topic,
                                                    int offset,
                                                    int limit)

Specified by:
getNames in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNames

public java.util.List<org.tmapi.core.Name> getNames(org.tmapi.core.Topic topic,
                                                    int offset,
                                                    int limit,
                                                    java.util.Comparator<org.tmapi.core.Name> comparator)

Specified by:
getNames in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfNames

public long getNumberOfNames(org.tmapi.core.Topic topic)

Specified by:
getNumberOfNames in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getOccurrences

public java.util.List<org.tmapi.core.Occurrence> getOccurrences(org.tmapi.core.Topic topic,
                                                                int offset,
                                                                int limit)

Specified by:
getOccurrences in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getOccurrences

public java.util.List<org.tmapi.core.Occurrence> getOccurrences(org.tmapi.core.Topic topic,
                                                                int offset,
                                                                int limit,
                                                                java.util.Comparator<org.tmapi.core.Occurrence> comparator)

Specified by:
getOccurrences in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfOccurrences

public long getNumberOfOccurrences(org.tmapi.core.Topic topic)

Specified by:
getNumberOfOccurrences in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getRoles

public java.util.List<org.tmapi.core.Role> getRoles(org.tmapi.core.Association association,
                                                    int offset,
                                                    int limit)

Specified by:
getRoles in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getRoles

public java.util.List<org.tmapi.core.Role> getRoles(org.tmapi.core.Association association,
                                                    int offset,
                                                    int limit,
                                                    java.util.Comparator<org.tmapi.core.Role> comparator)

Specified by:
getRoles in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfRoles

public long getNumberOfRoles(org.tmapi.core.Association association)

Specified by:
getNumberOfRoles in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getRolesPlayed

public java.util.List<org.tmapi.core.Role> getRolesPlayed(org.tmapi.core.Topic topic,
                                                          int offset,
                                                          int limit)

Specified by:
getRolesPlayed in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getRolesPlayed

public java.util.List<org.tmapi.core.Role> getRolesPlayed(org.tmapi.core.Topic topic,
                                                          int offset,
                                                          int limit,
                                                          java.util.Comparator<org.tmapi.core.Role> comparator)

Specified by:
getRolesPlayed in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfRolesPlayed

public long getNumberOfRolesPlayed(org.tmapi.core.Topic topic)

Specified by:
getNumberOfRolesPlayed in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getSupertypes

public java.util.List<org.tmapi.core.Topic> getSupertypes(org.tmapi.core.Topic topic,
                                                          int offset,
                                                          int limit)

Specified by:
getSupertypes in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getSupertypes

public java.util.List<org.tmapi.core.Topic> getSupertypes(org.tmapi.core.Topic topic,
                                                          int offset,
                                                          int limit,
                                                          java.util.Comparator<org.tmapi.core.Topic> comparator)

Specified by:
getSupertypes in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfSupertypes

public long getNumberOfSupertypes(org.tmapi.core.Topic topic)

Specified by:
getNumberOfSupertypes in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getTopics

public java.util.List<org.tmapi.core.Topic> getTopics(int offset,
                                                      int limit)

Specified by:
getTopics in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getTopics

public java.util.List<org.tmapi.core.Topic> getTopics(int offset,
                                                      int limit,
                                                      java.util.Comparator<org.tmapi.core.Topic> comparator)

Specified by:
getTopics in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfTopics

public long getNumberOfTopics()

Specified by:
getNumberOfTopics in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getTypes

public java.util.List<org.tmapi.core.Topic> getTypes(org.tmapi.core.Topic topic,
                                                     int offset,
                                                     int limit)

Specified by:
getTypes in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getTypes

public java.util.List<org.tmapi.core.Topic> getTypes(org.tmapi.core.Topic topic,
                                                     int offset,
                                                     int limit,
                                                     java.util.Comparator<org.tmapi.core.Topic> comparator)

Specified by:
getTypes in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfTypes

public long getNumberOfTypes(org.tmapi.core.Topic topic)

Specified by:
getNumberOfTypes in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getVariants

public java.util.List<org.tmapi.core.Variant> getVariants(org.tmapi.core.Name name,
                                                          int offset,
                                                          int limit)

Specified by:
getVariants in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getVariants

public java.util.List<org.tmapi.core.Variant> getVariants(org.tmapi.core.Name name,
                                                          int offset,
                                                          int limit,
                                                          java.util.Comparator<org.tmapi.core.Variant> comparator)

Specified by:
getVariants in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

getNumberOfVariants

public long getNumberOfVariants(org.tmapi.core.Name name)

Specified by:
getNumberOfVariants in interface de.topicmapslab.majortom.model.index.paging.IPagedConstructIndex

readNumberOfConstructs

protected final java.lang.Long readNumberOfConstructs(PagedConstructIndexImpl.Type type,
                                                      org.tmapi.core.Construct context)
Internal method to read the number of contained construct.

Parameters:
type - the class
context - the context
Returns:
dependent constructs from cache

cacheNumberOfConstructs

protected final void cacheNumberOfConstructs(PagedConstructIndexImpl.Type type,
                                             org.tmapi.core.Construct context,
                                             java.lang.Long noc)
Internal method to read the number of contained construct.

Parameters:
type - the class
context - the context
noc - the number of constructs to cache

readConstructs

protected final <X extends org.tmapi.core.Construct> java.util.List<X> readConstructs(PagedConstructIndexImpl.Type type,
                                                                                      org.tmapi.core.Construct context,
                                                                                      java.lang.Integer offset,
                                                                                      java.lang.Integer limit)
Internal method to read dependent constructs of the given parent construct from cache.

Type Parameters:
X - the type of dependent constructs
Parameters:
type - the type
context - the context
offset - the offset or null
limit - the limit or null
Returns:
dependent constructs from cache

readConstructs

protected final <X extends org.tmapi.core.Construct> java.util.List<X> readConstructs(PagedConstructIndexImpl.Type type,
                                                                                      org.tmapi.core.Construct context,
                                                                                      java.lang.Integer offset,
                                                                                      java.lang.Integer limit,
                                                                                      java.util.Comparator<?> comparator)
Internal method to read dependent constructs of the given parent construct from cache.

Type Parameters:
X - the type of dependent constructs
Parameters:
type - the type
context - the context
offset - the offset or null
limit - the limit or null
comparator - the comparator or null
Returns:
dependent constructs from cache

cacheConstructs

protected final <X extends org.tmapi.core.Construct> void cacheConstructs(PagedConstructIndexImpl.Type type,
                                                                          org.tmapi.core.Construct context,
                                                                          java.lang.Integer offset,
                                                                          java.lang.Integer limit,
                                                                          java.util.List<X> values)
Internal method to add dependent constructs of the given parent construct to internal cache

Type Parameters:
X - the type of dependent constructs
Parameters:
type - the type
context - the context
offset - the offset or null
limit - the limit or null
values - the values to store

cacheConstructs

protected final <X extends org.tmapi.core.Construct> void cacheConstructs(PagedConstructIndexImpl.Type type,
                                                                          org.tmapi.core.Construct context,
                                                                          java.lang.Integer offset,
                                                                          java.lang.Integer limit,
                                                                          java.util.Comparator<X> comparator,
                                                                          java.util.List<X> values)
Internal method to add dependent constructs of the given parent construct to internal cache

Type Parameters:
X - the type of dependent constructs
Parameters:
type - the type
context - the context
offset - the offset or null
limit - the limit or null
comparator - the comparator or null
values - the values to store

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

clearCache

public final void clearCache()
Internal method to clear the cache

Specified by:
clearCache in class BaseCachedIndexImpl<T extends de.topicmapslab.majortom.model.store.ITopicMapStore>

generateCacheKey

private ConstructCacheKey generateCacheKey(PagedConstructIndexImpl.Type type,
                                           org.tmapi.core.Construct context,
                                           java.lang.Integer offset,
                                           java.lang.Integer limit,
                                           java.util.Comparator<?> comparator)
Generates a key for internal caching

Parameters:
type - the type
context - the context
offset - the offset or null
limit - the limit or null
comparator - the comparator or null
Returns:
the generated cache key;

getDependentKeys

private java.util.Set<ConstructCacheKey> getDependentKeys(java.lang.Object criteria)
Returns a set of cache keys dependents on the given criteria

Parameters:
criteria - the criteria
Returns:
all dependent keys

open

public void open()

Specified by:
open in interface org.tmapi.index.Index
Overrides:
open in class BaseCachedIndexImpl<T extends de.topicmapslab.majortom.model.store.ITopicMapStore>

close

public void close()

Specified by:
close in interface org.tmapi.index.Index
Overrides:
close in class BaseCachedIndexImpl<T extends de.topicmapslab.majortom.model.store.ITopicMapStore>

doGetTypes

protected java.util.List<org.tmapi.core.Topic> doGetTypes(org.tmapi.core.Topic topic,
                                                          int offset,
                                                          int limit)
Returns all types of the given topic as a list within the given range.

Parameters:
topic - the topic whose types should be returned
offset - the offset
limit - the limit
Returns:
all types of the given topic as a list within the given range.

doGetTypes

protected java.util.List<org.tmapi.core.Topic> doGetTypes(org.tmapi.core.Topic topic,
                                                          int offset,
                                                          int limit,
                                                          java.util.Comparator<org.tmapi.core.Topic> comparator)
Returns all types of the given topic as a sorted list within the given range.

Parameters:
topic - the topic whose types should be returned
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all types of the given topic as a sorted list within the given range.

doGetNumberOfTypes

protected long doGetNumberOfTypes(org.tmapi.core.Topic topic)
Return the number of types of the topic

Parameters:
topic - the topic whose number of types should be returned
Returns:
the number of types

doGetSupertypes

protected java.util.List<org.tmapi.core.Topic> doGetSupertypes(org.tmapi.core.Topic topic,
                                                               int offset,
                                                               int limit)
Returns all supetypes of the given topic as a list within the given range.

Parameters:
topic - the topic whose supetypes should be returned
offset - the offset
limit - the limit
Returns:
all supetypes of the given topic as a list within the given range.

doGetSupertypes

protected java.util.List<org.tmapi.core.Topic> doGetSupertypes(org.tmapi.core.Topic topic,
                                                               int offset,
                                                               int limit,
                                                               java.util.Comparator<org.tmapi.core.Topic> comparator)
Returns all supetypes of the given topic as a sorted list within the given range.

Parameters:
topic - the topic whose supetypes should be returned
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all supetypes of the given topic as a sorted list within the given range.

doGetNumberOfSupertypes

protected long doGetNumberOfSupertypes(org.tmapi.core.Topic topic)
Return the number of supetypes of the topic

Parameters:
topic - the topic whose number of supertypes should be returned
Returns:
the number of supertypes

doGetNames

protected java.util.List<org.tmapi.core.Name> doGetNames(org.tmapi.core.Topic topic,
                                                         int offset,
                                                         int limit)
Returns all names of the given topic as a list within the given range.

Parameters:
topic - the topic whose names should be returned
offset - the offset
limit - the limit
Returns:
all names of the given topic as a list within the given range.

doGetNames

protected java.util.List<org.tmapi.core.Name> doGetNames(org.tmapi.core.Topic topic,
                                                         int offset,
                                                         int limit,
                                                         java.util.Comparator<org.tmapi.core.Name> comparator)
Returns all names of the given topic as a sorted list within the given range.

Parameters:
topic - the topic whose names should be returned
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all names of the given topic as a sorted list within the given range.

doGetNumberOfNames

protected long doGetNumberOfNames(org.tmapi.core.Topic topic)
Return the number of names of the topic

Parameters:
topic - the topic whose number of names should be returned
Returns:
the number of names

doGetOccurrences

protected java.util.List<org.tmapi.core.Occurrence> doGetOccurrences(org.tmapi.core.Topic topic,
                                                                     int offset,
                                                                     int limit)
Returns all occurrences of the given topic as a list within the given range.

Parameters:
topic - the topic whose occurrences should be returned
offset - the offset
limit - the limit
Returns:
all occurrences of the given topic as a list within the given range.

doGetOccurrences

protected java.util.List<org.tmapi.core.Occurrence> doGetOccurrences(org.tmapi.core.Topic topic,
                                                                     int offset,
                                                                     int limit,
                                                                     java.util.Comparator<org.tmapi.core.Occurrence> comparator)
Returns all occurrences of the given topic as a sorted list within the given range.

Parameters:
topic - the topic whose occurrences should be returned
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all occurrences of the given topic as a sorted list within the given range.

doGetNumberOfOccurrences

protected long doGetNumberOfOccurrences(org.tmapi.core.Topic topic)
Return the number of occurrences of the topic

Parameters:
topic - the topic whose number of occurrences should be returned
Returns:
the number of occurrences

doGetVariants

protected java.util.List<org.tmapi.core.Variant> doGetVariants(org.tmapi.core.Name name,
                                                               int offset,
                                                               int limit)
Returns all variants of the given name as a list within the given range.

Parameters:
name - the name whose variants should be returned
offset - the offset
limit - the limit
Returns:
all variants of the given name as a list within the given range.

doGetVariants

protected java.util.List<org.tmapi.core.Variant> doGetVariants(org.tmapi.core.Name name,
                                                               int offset,
                                                               int limit,
                                                               java.util.Comparator<org.tmapi.core.Variant> comparator)
Returns all variants of the given name as a sorted list within the given range.

Parameters:
name - the name whose variants should be returned
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all variants of the given name as a sorted list within the given range.

doGetNumberOfVariants

protected long doGetNumberOfVariants(org.tmapi.core.Name name)
Return the number of variants of the name

Parameters:
name - the name whose number of variants should be returned
Returns:
the number of variants

doGetRoles

protected java.util.List<org.tmapi.core.Role> doGetRoles(org.tmapi.core.Association association,
                                                         int offset,
                                                         int limit)
Returns all roles of the given association as a list within the given range.

Parameters:
association - the association whose roles should be returned
offset - the offset
limit - the limit
Returns:
all roles of the given association as a list within the given range.

doGetRoles

protected java.util.List<org.tmapi.core.Role> doGetRoles(org.tmapi.core.Association association,
                                                         int offset,
                                                         int limit,
                                                         java.util.Comparator<org.tmapi.core.Role> comparator)
Returns all roles of the given association as a sorted list within the given range.

Parameters:
association - the association whose roles should be returned
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all roles of the given association as a sorted list within the given range.

doGetNumberOfRoles

protected long doGetNumberOfRoles(org.tmapi.core.Association association)
Return the number of roles of the association

Parameters:
association - the association whose number of roles should be returned
Returns:
the number of roles

doGetAssociations

protected java.util.List<org.tmapi.core.Association> doGetAssociations(int offset,
                                                                       int limit)
Returns all associations of the topic map as a list within the given range.

Parameters:
offset - the offset
limit - the limit
Returns:
all associations as a list within the given range.

doGetAssociations

protected java.util.List<org.tmapi.core.Association> doGetAssociations(int offset,
                                                                       int limit,
                                                                       java.util.Comparator<org.tmapi.core.Association> comparator)
Returns all associations of the topic map as a sorted list within the given range.

Parameters:
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all associations as a sorted list within the given range.

doGetNumberOfAssociations

protected long doGetNumberOfAssociations()
Return the number of associations of the topic map

Returns:
the number of associations

doGetAssociationsPlayed

protected java.util.List<org.tmapi.core.Association> doGetAssociationsPlayed(org.tmapi.core.Topic topic,
                                                                             int offset,
                                                                             int limit)
Returns all associations played by given topic as a list within the given range.

Parameters:
topic - the topic whose played associations should be returned
offset - the offset
limit - the limit
Returns:
all associations played by given topic as a list within the given range.

doGetAssociationsPlayed

protected java.util.List<org.tmapi.core.Association> doGetAssociationsPlayed(org.tmapi.core.Topic topic,
                                                                             int offset,
                                                                             int limit,
                                                                             java.util.Comparator<org.tmapi.core.Association> comparator)
Returns all associations played by given topic as a sorted list within the given range.

Parameters:
topic - the topic whose played associations should be returned
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all associations played by given topic as a sorted list within the given range.

doGetNumberOfAssociationsPlayed

protected long doGetNumberOfAssociationsPlayed(org.tmapi.core.Topic topic)
Return the number of played associations of the topic

Parameters:
topic - the topic whose number of played associations should be returned
Returns:
the number of played associations

doGetRolesPlayed

protected java.util.List<org.tmapi.core.Role> doGetRolesPlayed(org.tmapi.core.Topic topic,
                                                               int offset,
                                                               int limit)
Returns all roles played by given topic as a list within the given range.

Parameters:
topic - the topic whose played roles should be returned
offset - the offset
limit - the limit
Returns:
all roles played by given topic as a list within the given range.

doGetRolesPlayed

protected java.util.List<org.tmapi.core.Role> doGetRolesPlayed(org.tmapi.core.Topic topic,
                                                               int offset,
                                                               int limit,
                                                               java.util.Comparator<org.tmapi.core.Role> comparator)
Returns all roles played by given topic as a sorted list within the given range.

Parameters:
topic - the topic whose played roles should be returned
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all roles played by given topic as a sorted list within the given range.

doGetNumberOfRolesPlayed

protected long doGetNumberOfRolesPlayed(org.tmapi.core.Topic topic)
Return the number of played roles of the topic

Parameters:
topic - the topic whose number of played roles should be returned
Returns:
the number of played roles

doGetTopics

protected java.util.List<org.tmapi.core.Topic> doGetTopics(int offset,
                                                           int limit)
Returns all topics of the topic map as a list within the given range.

Parameters:
offset - the offset
limit - the limit
Returns:
all topic as a list within the given range.

doGetTopics

protected java.util.List<org.tmapi.core.Topic> doGetTopics(int offset,
                                                           int limit,
                                                           java.util.Comparator<org.tmapi.core.Topic> comparator)
Returns all topics of the topic map within the given range.

Parameters:
offset - the offset
limit - the limit
comparator - the comparator
Returns:
all topic as a sorted list within the given range.

doGetNumberOfTopics

protected long doGetNumberOfTopics()
Return the number of topics

Returns:
the number of topics

clear

public void clear()
Removed any cached content from internal cache

Specified by:
clear in interface de.topicmapslab.majortom.model.index.IIndex
Overrides:
clear in class BaseCachedIndexImpl<T extends de.topicmapslab.majortom.model.store.ITopicMapStore>