it.unipi.di.rs
Interface IRankSelect

All Known Implementing Classes:
Rank, RankSelect, Select, SparseRank, SparseSelect

public interface IRankSelect

Main methods for Rank & Select based indexes.

Invoke the load method before to access a previously built index.

Author:
Claudio Corsi, Paolo Ferragina, Alessandro Barilari

Field Summary
static int DISK
           
static int MEMORY
           
 
Method Summary
 long count1(long start, long end)
          Returns the number of 1s in the selected range of the source
 void createIndex(int mode)
          Creates the index in memory or on disk.
 void createIndex(int mode, float spaceOccupancy)
          Creates the index in memory or on disk using the specified amount of space
 boolean get(long index)
          Returns the value at the specified position
 long ISize()
          Returns the size in bits of the index
 void load()
          Loads the data structures from the default file(s)
 void load(Directory input)
          This methods acts as load(), but load data structures from a Directory
 long rank0(long pos)
          Returns the rank0 at the pos-th bit (starting from 0)
 long rank1(long pos)
          Returns the rank1 at the pos-th bit (starting from 0)
 long Scard()
          Returns the number of 1s in the source
 long select1(long rank)
          Returns the position of the rank-th 1 (starting from 0)
 long Ssize()
          Returns the size in bits of the source file.
 void store()
          Stores data structures in the default file(s).
 void store(Directory output)
          This methods acts as store(), but store data structures inside a Directory
 

Field Detail

MEMORY

static final int MEMORY
See Also:
Constant Field Values

DISK

static final int DISK
See Also:
Constant Field Values
Method Detail

createIndex

void createIndex(int mode)
                 throws IOException
Creates the index in memory or on disk.

Parameters:
mode - the mode of creation (MEMORY or DISK)
Throws:
IOException

createIndex

void createIndex(int mode,
                 float spaceOccupancy)
                 throws IOException
Creates the index in memory or on disk using the specified amount of space

Parameters:
mode - the mode of creation (MEMORY or DISK)
spaceOccupancy - is the space occupancy in terms of % of the source dimension that the index must achieve
Throws:
IOException

Ssize

long Ssize()
Returns the size in bits of the source file.


ISize

long ISize()
           throws IOException
Returns the size in bits of the index

Throws:
IOException

Scard

long Scard()
           throws IOException
Returns the number of 1s in the source

Throws:
IOException

get

boolean get(long index)
            throws IOException
Returns the value at the specified position

Returns:
the boolean value of the i-th bit of the source (starting from 0)
Throws:
IOException

count1

long count1(long start,
            long end)
            throws IOException
Returns the number of 1s in the selected range of the source

Returns:
the number of 1s in the range [start, end]
Throws:
IOException

rank1

long rank1(long pos)
           throws IOException
Returns the rank1 at the pos-th bit (starting from 0)

Parameters:
pos - is the position to analyze
Throws:
IOException

rank0

long rank0(long pos)
           throws IOException
Returns the rank0 at the pos-th bit (starting from 0)

Parameters:
pos - is the position to analyze
Throws:
IOException

select1

long select1(long rank)
             throws IOException
Returns the position of the rank-th 1 (starting from 0)

Parameters:
rank - is the rank to find
Throws:
IOException

load

void load()
          throws IOException
Loads the data structures from the default file(s)

Throws:
IOException

load

void load(Directory input)
          throws IOException
This methods acts as load(), but load data structures from a Directory

Parameters:
input - the source Directory; must be opened in READ_MODE
Throws:
IOException

store

void store()
           throws IOException
Stores data structures in the default file(s). Previous data contained in the output file will be deleted.

Throws:
IOException

store

void store(Directory output)
           throws IOException
This methods acts as store(), but store data structures inside a Directory

Parameters:
output - the destination Directory; must be opened in WRITE_MODE
Throws:
IOException