Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.heap
Class Deap<K extends Comparable<K> & Serializable,V extends Identifiable & Serializable>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.heap.MinMaxHeap<K,V>
      extended by de.lmu.ifi.dbs.elki.utilities.heap.Deap<K,V>
All Implemented Interfaces:
Page<Deap<K,V>>, Heap<K,V>, Externalizable, Serializable

 class Deap<K extends Comparable<K> & Serializable,V extends Identifiable & Serializable>
extends MinMaxHeap<K,V>
implements Page<Deap<K,V>>

Subclass of a MinMaxHeap that can be an entry in a persistent heap.

Author:
Elke Achtert

Field Summary
private  int cacheIndex
          The index of this deap in the cachePath of the persistent heap.
private  boolean dirty
          The dirty flag of this page.
private  int index
          The index of this Deap in the persistent heap.
private  int maxSize
          The maximum size of this deap.
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.heap.MinMaxHeap
heap, indices
 
Constructor Summary
Deap()
          Empty constructor for serialization purposes.
Deap(int maxSize, int index, int cacheIndex)
          Creates a new Deap with the specified parameters.
 
Method Summary
 int getCacheIndex()
          Returns the index of this deap in the cachePath of the persistent heap.
 Integer getID()
          Returns the unique id of this Page.
 int getIndex()
          Returns the index of this deap in the persistent heap.
 boolean isDirty()
          Returns true if this page is dirty, false otherwise.
 boolean isFull()
          Returns true if this deap is full, false otherwise.
 void moveAll(Deap<K,V> other)
          Moves all elements from this deap into the specified deap.
 void readExternal(ObjectInput in)
          The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
 void setCacheIndex(int cacheIndex)
          Sets the index of this deap in the cachePath of the persistent heap.
 void setDirty(boolean dirty)
          Sets the dirty flag of this page.
 void setFile(PageFile file)
          Sets the page file of this page.
 void setID(int id)
          Sets the unique id of this Page.
 void writeExternal(ObjectOutput out)
          The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.heap.MinMaxHeap
addNode, flowUp, getIndexOf, getMaxNode, getMinNode, getNodeAt, isEmpty, maxNode, minNode, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

private int index
The index of this Deap in the persistent heap.


cacheIndex

private int cacheIndex
The index of this deap in the cachePath of the persistent heap.


maxSize

private int maxSize
The maximum size of this deap.


dirty

private boolean dirty
The dirty flag of this page.

Constructor Detail

Deap

public Deap()
Empty constructor for serialization purposes.


Deap

public Deap(int maxSize,
            int index,
            int cacheIndex)
Creates a new Deap with the specified parameters.

Parameters:
maxSize - the maximum size of the deap
index - the index of this deap in the persistent heap
cacheIndex - the index of this deap in the cachePath of the persistent heap
Method Detail

getCacheIndex

public int getCacheIndex()
Returns the index of this deap in the cachePath of the persistent heap.

Returns:
the index of this deap in the cachePath of the persistent heap

setCacheIndex

public void setCacheIndex(int cacheIndex)
Sets the index of this deap in the cachePath of the persistent heap.

Parameters:
cacheIndex - the cache index to be set

isFull

public boolean isFull()
Returns true if this deap is full, false otherwise.

Returns:
true if this deap is full, false otherwise

moveAll

public void moveAll(Deap<K,V> other)
Moves all elements from this deap into the specified deap.

Parameters:
other - the deap to move all elements to

getID

public Integer getID()
Returns the unique id of this Page.

Specified by:
getID in interface Page<Deap<K extends Comparable<K> & Serializable,V extends Identifiable & Serializable>>
Returns:
the unique id of this Page

setID

public void setID(int id)
Sets the unique id of this Page.

Specified by:
setID in interface Page<Deap<K extends Comparable<K> & Serializable,V extends Identifiable & Serializable>>
Parameters:
id - the id to be set

setFile

public void setFile(PageFile file)
Sets the page file of this page.

Specified by:
setFile in interface Page<Deap<K extends Comparable<K> & Serializable,V extends Identifiable & Serializable>>
Parameters:
file - the page file to be set

isDirty

public boolean isDirty()
Returns true if this page is dirty, false otherwise.

Specified by:
isDirty in interface Page<Deap<K extends Comparable<K> & Serializable,V extends Identifiable & Serializable>>
Returns:
true if this page is dirty, false otherwise

setDirty

public void setDirty(boolean dirty)
Sets the dirty flag of this page.

Specified by:
setDirty in interface Page<Deap<K extends Comparable<K> & Serializable,V extends Identifiable & Serializable>>
Parameters:
dirty - the dirty flag to be set

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Specified by:
readExternal in interface Externalizable
Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

getIndex

public int getIndex()
Returns the index of this deap in the persistent heap.

Returns:
the index of this deap in the persistent heap

Release 0.1 (2008-07-10_1838)