|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.logging.AbstractLoggable
de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
de.lmu.ifi.dbs.elki.index.tree.TreeIndex<O,N,E>
O
- the type of DatabaseObject to be stored in the indexN
- the type of Node used in the indexE
- the type of Entry used in the indexpublic abstract class TreeIndex<O extends DatabaseObject,N extends Node<N,E>,E extends Entry>
Abstract super class for all tree based index classes.
Field Summary | |
---|---|
static OptionID |
CACHE_SIZE_ID
OptionID for CACHE_SIZE_PARAM |
private IntParameter |
CACHE_SIZE_PARAM
Parameter to specify the size of the cache in bytes, must be an integer equal to or greater than 0. |
protected int |
cacheSize
Holds the value of CACHE_SIZE_PARAM . |
protected int |
dirCapacity
The capacity of a directory node (= 1 + maximum number of entries in a directory node). |
protected int |
dirMinimum
The minimum number of entries in a directory node. |
protected PageFile<N> |
file
The file storing the entries of this index. |
static OptionID |
FILE_ID
OptionID for FILE_PARAM |
private FileParameter |
FILE_PARAM
Optional parameter that specifies the name of the file storing the index. |
private String |
fileName
Holds the name of the file storing the index specified by FILE_PARAM , null if FILE_PARAM is not specified. |
protected boolean |
initialized
True if this index is already initialized. |
protected int |
leafCapacity
The capacity of a leaf node (= 1 + maximum number of entries in a leaf node). |
protected int |
leafMinimum
The minimum number of entries in a leaf node. |
static OptionID |
PAGE_SIZE_ID
OptionID for PAGE_SIZE_PARAM |
private IntParameter |
PAGE_SIZE_PARAM
Parameter to specify the size of a page in bytes, must be an integer greater than 0. |
protected int |
pageSize
Holds the value of PAGE_SIZE_PARAM . |
private E |
rootEntry
The entry representing the root node. |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable |
---|
optionHandler |
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debug, logger |
Constructor Summary | |
---|---|
TreeIndex()
Adds parameters FILE_PARAM , PAGE_SIZE_PARAM , and
CACHE_SIZE_PARAM to the option handler additionally to parameters
of super class. |
Method Summary | |
---|---|
void |
close()
Closes this index. |
protected abstract void |
createEmptyRoot(O object)
Creates an empty root node and writes it to file. |
protected TreeIndexHeader |
createHeader()
Creates a header for this index structure which is an instance of TreeIndexHeader . |
protected abstract N |
createNewDirectoryNode(int capacity)
Creates a new directory node with the specified capacity. |
protected abstract N |
createNewLeafNode(int capacity)
Creates a new leaf node with the specified capacity. |
protected abstract E |
createRootEntry()
Creates an entry representing the root node. |
long |
getLogicalPageAccess()
Returns the logical page access of this index. |
N |
getNode(E entry)
Returns the node that is represented by the specified entry. |
N |
getNode(int nodeID)
Returns the node with the specified id. |
long |
getPhysicalReadAccess()
Returns the physical read access of this index. |
long |
getPhysicalWriteAccess()
Returns the physical write access of this index. |
protected N |
getRoot()
Reads the root node of this index from the file. |
E |
getRootEntry()
Returns the entry representing the root if this index. |
protected TreeIndexPath<E> |
getRootPath()
Returns the path to the root of this tree. |
protected void |
initialize(O object)
Initializes the index. |
protected abstract void |
initializeCapacities(O object,
boolean verbose)
Determines the maximum and minimum number of entries in a node. |
protected void |
initializeFromFile()
Initializes this index from an existing persistent file. |
protected abstract void |
postDelete(O o)
Performs necessary operations after deleting the specified object. |
protected abstract void |
preInsert(E entry)
Performs necessary operations before inserting the specified entry. |
void |
resetPageAccess()
Resets the three counters for page access, i.e., the counters for physical read and write access, and the counter for logical page access. |
List<String> |
setParameters(List<String> args)
Calls the super method AbstractParameterizable#setParameters(args)} and sets additionally the values of the parameters FILE_PARAM ,
PAGE_SIZE_PARAM . |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable |
---|
addOption, addParameterizable, addParameterizable, checkGlobalParameterConstraints, collectOptions, getAttributeSettings, getParameters, rememberParametersExcept, removeOption, removeParameterizable, shortDescription |
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.lmu.ifi.dbs.elki.index.Index |
---|
delete, insert, insert, setDatabase |
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable |
---|
checkGlobalParameterConstraints, collectOptions, getParameters, shortDescription |
Field Detail |
---|
public static final OptionID FILE_ID
FILE_PARAM
private final FileParameter FILE_PARAM
Key: -treeindex.file
private String fileName
FILE_PARAM
, null if FILE_PARAM
is not specified.
public static final OptionID PAGE_SIZE_ID
PAGE_SIZE_PARAM
private final IntParameter PAGE_SIZE_PARAM
Default value: 4000
Key: -treeindex.pagesize
protected int pageSize
PAGE_SIZE_PARAM
.
public static final OptionID CACHE_SIZE_ID
CACHE_SIZE_PARAM
private final IntParameter CACHE_SIZE_PARAM
Default value: Integer.MAX_VALUE
Key: -treeindex.cachesize
protected int cacheSize
CACHE_SIZE_PARAM
.
protected PageFile<N extends Node<N,E>> file
protected boolean initialized
protected int dirCapacity
protected int leafCapacity
protected int dirMinimum
protected int leafMinimum
private E extends Entry rootEntry
Constructor Detail |
---|
public TreeIndex()
FILE_PARAM
, PAGE_SIZE_PARAM
, and
CACHE_SIZE_PARAM
to the option handler additionally to parameters
of super class.
Method Detail |
---|
public List<String> setParameters(List<String> args) throws ParameterException
FILE_PARAM
,
PAGE_SIZE_PARAM
.
setParameters
in interface Parameterizable
setParameters
in class AbstractParameterizable
args
- parameters to set the attributes accordingly to
ParameterException
- in case of wrong parameter-settingpublic final long getPhysicalReadAccess()
Index
getPhysicalReadAccess
in interface Index<O extends DatabaseObject>
resetPageAccess
.public final long getPhysicalWriteAccess()
Index
getPhysicalWriteAccess
in interface Index<O extends DatabaseObject>
resetPageAccess
.public final long getLogicalPageAccess()
Index
getLogicalPageAccess
in interface Index<O extends DatabaseObject>
resetPageAccess
.public final void resetPageAccess()
Index
resetPageAccess
in interface Index<O extends DatabaseObject>
public final void close()
Index
close
in interface Index<O extends DatabaseObject>
public final E getRootEntry()
public final N getNode(int nodeID)
nodeID
- the page id of the node to be returned
public final N getNode(E entry)
entry
- the entry representing the node to be returned
protected TreeIndexHeader createHeader()
TreeIndexHeader
. Subclasses may need to overwrite this method if
they need a more specialized header.
protected void initializeFromFile()
protected final void initialize(O object)
object
- an object that will be stored in the indexprotected final TreeIndexPath<E> getRootPath()
protected N getRoot()
protected abstract void initializeCapacities(O object, boolean verbose)
object
- an object that will be stored in the indexverbose
- flag to allow verbose messagesprotected abstract void createEmptyRoot(O object)
object
- an object that will be stored in the indexprotected abstract E createRootEntry()
protected abstract N createNewLeafNode(int capacity)
capacity
- the capacity of the new node
protected abstract N createNewDirectoryNode(int capacity)
capacity
- the capacity of the new node
protected abstract void preInsert(E entry)
entry
- the entry to be insertedprotected abstract void postDelete(O o)
o
- the object to be deleted
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |