com.hardcode.gdbms.engine.data.indexes
Class IndexSetImpl

java.lang.Object
  extended by com.hardcode.gdbms.engine.data.indexes.IndexSetImpl
All Implemented Interfaces:
BaseIndexSet, VariableIndexSet

public class IndexSetImpl
extends java.lang.Object
implements VariableIndexSet

Implementación del conjunto de índices que guarda en memoria hasta un límite y a partir de ese límite pasa todos los índices a disco

Author:
Fernando González Cortés

Constructor Summary
IndexSetImpl()
          Creates a new IndexSetImpl object.
IndexSetImpl(int limit)
          Creates a new IndexSetImpl object.
 
Method Summary
 void addIndex(long index)
          Añade un índice al conjunto
 void close()
          Cierra el fichero de índices
 long getIndex(long nth)
          Devuelve el índice nth-ésimo si se invocó previamente a indexSetComplete y lanza una excepción en caso contrario
 long getIndexCount()
          Devuelve el número de índices si se invocó previamente a indexSetComplete y lanza una excepción en caso contrario
 long[] getIndexes()
          DOCUMENT ME!
 void indexSetComplete()
          Cierra el conjunto de índices para el almacenamiento, a partir de una llamada a este método no se puede escribir ningún índice más, sólamente se pueden leer
 void open()
          Abre el almacenamiento del índice para la escritura de los índices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexSetImpl

public IndexSetImpl()
Creates a new IndexSetImpl object.


IndexSetImpl

public IndexSetImpl(int limit)
Creates a new IndexSetImpl object.

Parameters:
limit - límite a partir del cual se guardan todos los índices en disco
Method Detail

addIndex

public void addIndex(long index)
              throws java.io.IOException
Añade un índice al conjunto

Specified by:
addIndex in interface VariableIndexSet
Parameters:
index - índice a añadir
Throws:
java.io.IOException - Si se produce un error al escribir en el disco
java.lang.RuntimeException

getIndex

public long getIndex(long nth)
              throws java.io.IOException
Devuelve el índice nth-ésimo si se invocó previamente a indexSetComplete y lanza una excepción en caso contrario

Specified by:
getIndex in interface BaseIndexSet
Parameters:
nth - índice de índice que se quiere obtener
Returns:
indice nth-ésimo
Throws:
java.io.IOException - Si se produce un error accediendo a disco
java.lang.RuntimeException

getIndexCount

public long getIndexCount()
Devuelve el número de índices si se invocó previamente a indexSetComplete y lanza una excepción en caso contrario

Specified by:
getIndexCount in interface BaseIndexSet
Returns:
número de índices
Throws:
java.lang.RuntimeException

indexSetComplete

public void indexSetComplete()
                      throws java.io.IOException
Description copied from interface: VariableIndexSet
Cierra el conjunto de índices para el almacenamiento, a partir de una llamada a este método no se puede escribir ningún índice más, sólamente se pueden leer

Specified by:
indexSetComplete in interface VariableIndexSet
Throws:
java.io.IOException - Si se produce un fallo al cerrar los streams de salida
See Also:
VariableIndexSet.indexSetComplete()

open

public void open()
          throws java.io.IOException
Description copied from interface: VariableIndexSet
Abre el almacenamiento del índice para la escritura de los índices. En caso de un almacenamiento permanente se usará un fichero temporal

Specified by:
open in interface VariableIndexSet
Throws:
java.io.IOException - Si se produce un fallo al abrir
See Also:
com.hardcode.gdbms.engine.data.indexes.VariableIndexSet#open(java.io.File)

close

public void close()
           throws java.io.IOException
Description copied from interface: BaseIndexSet
Cierra el fichero de índices

Specified by:
close in interface BaseIndexSet
Throws:
java.io.IOException - Si se produce un fallo al cerrar
See Also:
BaseIndexSet.close()

getIndexes

public long[] getIndexes()
                  throws java.io.IOException
DOCUMENT ME!

Specified by:
getIndexes in interface VariableIndexSet
Returns:
DOCUMENT ME!
Throws:
java.io.IOException
See Also:
VariableIndexSet.getIndexes()


Copyright © 2005-2006 . All Rights Reserved.