com.timeindexing.index
Interface Index

All Superinterfaces:
IndexHeader
All Known Subinterfaces:
ExtendedIndex, IndexView, ManagedIndex, StoredIndex
All Known Implementing Classes:
AbstractIndex, ExternalIndex, FileIndex, IncoreIndex, InlineIndex, ShadowIndex, SQLIndex, TimeIndex

public interface Index
extends IndexHeader

An index. This is the generic interface to an index. It has all the methods for the header and for all the data requests.


Method Summary
 Index activate()
          Make the Index activated.
 boolean addDataType(ID typeID, java.lang.String typeName)
          Add a new data type
 IndexItem addItem(DataItem item)
          Add a Data Item to the Index.
 IndexItem addItem(DataItem item, Timestamp dataTime)
          Add a Data Item to the Index with a speicifed Data Timestamp
 IndexItem addItem(DataItem item, Timestamp dataTime, long annotation)
          Add a Data Item to the Index with a speicifed Data Timestamp and some annotation data
 IndexItem addReference(IndexItem item, Index other)
          Add a Reference to an IndexItem in a Index.
 IndexItem addReference(IndexItem item, Index other, Timestamp dataTime)
          Add a Reference to an IndexItem in a Index.
 IndexItem addReference(IndexItem item, Index other, Timestamp dataTime, long annotation)
          Add a Reference to an IndexItem in a Index.
 DoubleLinkedList apply(Function fn)
          Apply a function to all of the IndexItems, resulting in a List of results.
 IndexView asView()
          Get a view onto the Index.
 boolean close()
          Close the index.
 boolean commit()
          Commit all changes to the index.
 boolean contains(Timestamp t)
          Does a timestamp fall within the bounds of the Index.
 boolean contains(Timestamp t, IndexTimestampSelector sel)
          Does a timestamp fall within the bounds of the Index.
 IndexView filter(Function f)
          Filter some IndexItems out into a new IncoreIndex.
 int getAnnotationStyle()
          Get the annotation style.
 CachePolicy getCachePolicy()
          Get the CachePolicy
 java.lang.String getDataType(ID typeID)
          Get the type name of the things in the data stream.
 IndexItem getItem(long n)
          Get an Index Item from the Index.
 IndexItem getItem(Position p)
          Get an Index Item from the Index.
 IndexItem getItem(Timestamp t)
          Get an Index Item from the Index.
 IndexItem getItem(Timestamp t, IndexTimestampSelector sel, Lifetime lifetime)
          Get an Index Item from the Index.
 int getItemSize()
          Get the size of the index items.
 Timestamp getLastAccessTime()
          Get the last time an IndexItem was accessed from the index.
 boolean getLoadDataAutomatically()
          Does the index load data automatically when doing a get item.
 boolean hasAnnotations()
          Does this index have annotations.
 boolean hasDataType(java.lang.String typeName)
          Does this index have a typed name.
 boolean isActivated()
          Is the Index activated.
 boolean isChanged()
          Has the index changed in any way.
 boolean isClosed()
          Is the Index closed.
 boolean isWriteLocked()
          Has the Index been write-locked.
 java.util.Iterator iterator()
          Get an iterator over the IndexItems in the Index.
 TimestampMapping locate(Position p)
          Try and determine the Timestamp associated with the speicifed Position.
 TimestampMapping locate(Position p, IndexTimestampSelector sel, Lifetime lifetime)
          Try and determine the Timestamp associated with the speicifed Position.
 TimestampMapping locate(Timestamp t)
          Try and determine the position associated with the speicifed Timestamp.
 TimestampMapping locate(Timestamp t, IndexTimestampSelector sel, Lifetime lifetime)
          Try and determine the position associated with the speicifed Timestamp.
 IndexView map(Function f)
          Map a function to all of the IndexItems, resulting in a new IncoreIndex.
 IndexView select(AbsoluteTimestamp t, IntervalSpecifier intervalSpecifier)
          Select an Interval given a Timestamp and an IntervalSpecifier.
 IndexView select(AbsoluteTimestamp t, IntervalSpecifier intervalSpecifier, IndexTimestampSelector selector, Overlap overlap, Lifetime lifetime)
          Select an Interval given a Timestamp and an IntervalSpecifier.
 IndexView select(Interval interval)
          Select an Interval given an Interval object.
 IndexView select(Interval interval, IndexTimestampSelector selector, Overlap overlap, Lifetime lifetime)
          Select an Interval given an Interval object.
 boolean setAutoCommit(boolean commit)
          Set auto commit to be true or false.
 CachePolicy setCachePolicy(CachePolicy policy)
          Set a CachePolicy in order to manage the cache.
 boolean setLoadDataAutomatically(boolean load)
          Load data automatically when doing a get item.
 Index terminate()
          Make the Index finalized.
 Index updateDescription(Description description)
          Update the description of this index.
 
Methods inherited from interface com.timeindexing.index.IndexHeader
getDataPathName, getDataSize, getDescription, getEndTime, getFirstDataTime, getFirstTime, getID, getIndexDataType, getIndexPathName, getIndexType, getLastDataTime, getLastTime, getLength, getName, getStartTime, getURI, isFixedSizeData, isInTimeOrder, isReadOnly, isTerminated
 

Method Detail

getItemSize

int getItemSize()
Get the size of the index items.


getDataType

java.lang.String getDataType(ID typeID)
Get the type name of the things in the data stream.


hasDataType

boolean hasDataType(java.lang.String typeName)
Does this index have a typed name.


addDataType

boolean addDataType(ID typeID,
                    java.lang.String typeName)
Add a new data type

Returns:
true, if a new type was added; false, if the index had this ID/typeName pair already

hasAnnotations

boolean hasAnnotations()
Does this index have annotations.


getAnnotationStyle

int getAnnotationStyle()
Get the annotation style. Either inline or external.


updateDescription

Index updateDescription(Description description)
Update the description of this index.


addItem

IndexItem addItem(DataItem item)
                  throws IndexTerminatedException,
                         IndexClosedException,
                         IndexActivationException,
                         AddItemException
Add a Data Item to the Index.

Throws:
IndexTerminatedException
IndexClosedException
IndexActivationException
AddItemException

addItem

IndexItem addItem(DataItem item,
                  Timestamp dataTime)
                  throws IndexTerminatedException,
                         IndexClosedException,
                         IndexActivationException,
                         AddItemException
Add a Data Item to the Index with a speicifed Data Timestamp

Throws:
IndexTerminatedException
IndexClosedException
IndexActivationException
AddItemException

addItem

IndexItem addItem(DataItem item,
                  Timestamp dataTime,
                  long annotation)
                  throws IndexTerminatedException,
                         IndexClosedException,
                         IndexActivationException,
                         AddItemException
Add a Data Item to the Index with a speicifed Data Timestamp and some annotation data

Throws:
IndexTerminatedException
IndexClosedException
IndexActivationException
AddItemException

addReference

IndexItem addReference(IndexItem item,
                       Index other)
                       throws IndexTerminatedException,
                              IndexClosedException,
                              IndexActivationException,
                              AddItemException
Add a Reference to an IndexItem in a Index. The Data Timestamp of the IndexItem is passed into this Index.

Throws:
IndexTerminatedException
IndexClosedException
IndexActivationException
AddItemException

addReference

IndexItem addReference(IndexItem item,
                       Index other,
                       Timestamp dataTime)
                       throws IndexTerminatedException,
                              IndexClosedException,
                              IndexActivationException,
                              AddItemException
Add a Reference to an IndexItem in a Index. The Data Timestamp of the IndexItem is the one specified.

Throws:
IndexTerminatedException
IndexClosedException
IndexActivationException
AddItemException

addReference

IndexItem addReference(IndexItem item,
                       Index other,
                       Timestamp dataTime,
                       long annotation)
                       throws IndexTerminatedException,
                              IndexClosedException,
                              IndexActivationException,
                              AddItemException
Add a Reference to an IndexItem in a Index. The Data Timestamp of the IndexItem is the one specified, as is the annotation value.

Throws:
IndexTerminatedException
IndexClosedException
IndexActivationException
AddItemException

getItem

IndexItem getItem(long n)
                  throws GetItemException,
                         IndexClosedException
Get an Index Item from the Index.

Throws:
GetItemException
IndexClosedException

getItem

IndexItem getItem(Position p)
                  throws GetItemException,
                         IndexClosedException
Get an Index Item from the Index.

Throws:
GetItemException
IndexClosedException

getItem

IndexItem getItem(Timestamp t)
                  throws GetItemException,
                         IndexClosedException
Get an Index Item from the Index. Uses IndexTimestampSelector.DATA and Lifetime.CONTINUOUS as defaults.

Throws:
GetItemException
IndexClosedException

getItem

IndexItem getItem(Timestamp t,
                  IndexTimestampSelector sel,
                  Lifetime lifetime)
                  throws GetItemException,
                         IndexClosedException
Get an Index Item from the Index.

Throws:
GetItemException
IndexClosedException

contains

boolean contains(Timestamp t)
Does a timestamp fall within the bounds of the Index. Uses IndexTimestampSelector.DATA as a default. The bounds are the first time data is put in and the last time data is put in the Index.


contains

boolean contains(Timestamp t,
                 IndexTimestampSelector sel)
Does a timestamp fall within the bounds of the Index. The bounds are the first time data is put in and the last time data is put in the Index.


locate

TimestampMapping locate(Timestamp t)
Try and determine the position associated with the speicifed Timestamp. Uses IndexTimestampSelector.DATA and Lifetime.CONTINUOUS as defaults. Returns a TimestampMapping which contains the original time and the found position.


locate

TimestampMapping locate(Timestamp t,
                        IndexTimestampSelector sel,
                        Lifetime lifetime)
Try and determine the position associated with the speicifed Timestamp. Returns a TimestampMapping which contains the original time and the found position.


locate

TimestampMapping locate(Position p)
Try and determine the Timestamp associated with the speicifed Position. Uses IndexTimestampSelector.DATA and Lifetime.CONTINUOUS as defaults. Returns a TimestampMapping which contains the original Position and the found Timestamp.


locate

TimestampMapping locate(Position p,
                        IndexTimestampSelector sel,
                        Lifetime lifetime)
Try and determine the Timestamp associated with the speicifed Position. Returns a TimestampMapping which contains the original Position and the found Timestamp.


select

IndexView select(Interval interval)
Select an Interval given an Interval object. Defaults to using IndexTimestampSelector.DATA, Overlap.FREE, and Lifetime.CONTINUOUS, as these are the most common values. Returns null if it cant be done.


select

IndexView select(AbsoluteTimestamp t,
                 IntervalSpecifier intervalSpecifier)
Select an Interval given a Timestamp and an IntervalSpecifier. Defaults to using IndexTimestampSelector.DATA, Overlap.FREE, and Lifetime.CONTINUOUS, as these are the most common values. Returns null if it cant be done.


select

IndexView select(Interval interval,
                 IndexTimestampSelector selector,
                 Overlap overlap,
                 Lifetime lifetime)
Select an Interval given an Interval object. Returns null if it cant be done.


select

IndexView select(AbsoluteTimestamp t,
                 IntervalSpecifier intervalSpecifier,
                 IndexTimestampSelector selector,
                 Overlap overlap,
                 Lifetime lifetime)
Select an Interval given a Timestamp and an IntervalSpecifier.


filter

IndexView filter(Function f)
                 throws TimeIndexException
Filter some IndexItems out into a new IncoreIndex.

Throws:
TimeIndexException

map

IndexView map(Function f)
              throws TimeIndexException
Map a function to all of the IndexItems, resulting in a new IncoreIndex.

Throws:
TimeIndexException

apply

DoubleLinkedList apply(Function fn)
                       throws TimeIndexException
Apply a function to all of the IndexItems, resulting in a List of results.

Throws:
TimeIndexException

getLastAccessTime

Timestamp getLastAccessTime()
Get the last time an IndexItem was accessed from the index.


isActivated

boolean isActivated()
Is the Index activated.


activate

Index activate()
               throws IndexReadOnlyException,
                      IndexWriteLockedException
Make the Index activated. It is not possible to add items to an Index that is not active.

Throws:
IndexReadOnlyException
IndexWriteLockedException

terminate

Index terminate()
Make the Index finalized. It is not possible to add items ever again to an Index that has been terminated.


commit

boolean commit()
               throws IndexCommitException
Commit all changes to the index. Intened to sync all associated streams and files, and this sets the end time too.

Throws:
IndexCommitException

setAutoCommit

boolean setAutoCommit(boolean commit)
Set auto commit to be true or false. When auto commit is true, then every addItem() is automatically committed.

Returns:
the previous value of auto commit.

isClosed

boolean isClosed()
Is the Index closed.


close

boolean close()
              throws IndexCloseException
Close the index. Intened to close all associated streams and files, and this sets the end time too.

Throws:
IndexCloseException

isChanged

boolean isChanged()
Has the index changed in any way.


isWriteLocked

boolean isWriteLocked()
Has the Index been write-locked.


iterator

java.util.Iterator iterator()
Get an iterator over the IndexItems in the Index.


asView

IndexView asView()
Get a view onto the Index.


getCachePolicy

CachePolicy getCachePolicy()
Get the CachePolicy


setCachePolicy

CachePolicy setCachePolicy(CachePolicy policy)
Set a CachePolicy in order to manage the cache. Setting a new CachePolicy in the middle of operation can lose some timing information held by the existing CachePolicy, so use with care.

Returns:
the old policy if the policy was set

getLoadDataAutomatically

boolean getLoadDataAutomatically()
Does the index load data automatically when doing a get item.


setLoadDataAutomatically

boolean setLoadDataAutomatically(boolean load)
Load data automatically when doing a get item.

Returns:
the previous value of this status


Timeindexing 2008