|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unipi.di.rs.RankSelect
public class RankSelect
An index implementing rank
and select
functions over binary files.
The index uses the classes Rank
and Select
to create two
different indexes and execute both the rank
and the select
operations
in constant time.
Field Summary |
---|
Fields inherited from interface it.unipi.di.rs.IRankSelect |
---|
DISK, MEMORY |
Constructor Summary | |
---|---|
RankSelect(Directory tdb,
String source)
Creates an object from a source contained in a Directory and initializes basic data structures; it will be necessary to use a specific method to create data structures or load them. |
|
RankSelect(String source)
Creates an object and initializes basic data structures; it will be necessary to use a specific method to create data structures or load them. |
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 directory)
This methods acts as IRankSelect.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 directory)
This methods acts as IRankSelect.store() , but store data structures inside a Directory |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RankSelect(String source) throws IOException
source
- name of file to index
IOException
public RankSelect(Directory tdb, String source) throws IOException
source
- the name of the source file inside the Directorytdb
- the Directory
that contains the source
IOException
Method Detail |
---|
public long Scard() throws IOException
IRankSelect
Scard
in interface IRankSelect
IOException
public long Ssize()
IRankSelect
Ssize
in interface IRankSelect
public long ISize() throws IOException
IRankSelect
ISize
in interface IRankSelect
IOException
public void createIndex(int mode) throws IOException
IRankSelect
createIndex
in interface IRankSelect
mode
- the mode of creation (IRankSelect.MEMORY
or IRankSelect.DISK
)
IOException
public void createIndex(int mode, float spaceOccupancy) throws IOException
IRankSelect
createIndex
in interface IRankSelect
mode
- the mode of creation (IRankSelect.MEMORY
or IRankSelect.DISK
)spaceOccupancy
- is the space occupancy in terms of % of the source dimension that the index must achieve
IOException
public long rank0(long pos) throws IOException
IRankSelect
rank0
in interface IRankSelect
pos
- is the position to analyze
IOException
public long rank1(long pos) throws IOException
IRankSelect
rank1
in interface IRankSelect
pos
- is the position to analyze
IOException
public long select1(long rank) throws IOException
IRankSelect
select1
in interface IRankSelect
rank
- is the rank to find
IOException
public void store() throws IOException
IRankSelect
store
in interface IRankSelect
IOException
public void store(Directory directory) throws IOException
IRankSelect
IRankSelect.store()
, but store data structures inside a Directory
store
in interface IRankSelect
directory
- the destination Directory; must be opened in WRITE_MODE
IOException
public void load() throws IOException
IRankSelect
load
in interface IRankSelect
IOException
public void load(Directory directory) throws IOException
IRankSelect
IRankSelect.load()
, but load data structures from a Directory
load
in interface IRankSelect
directory
- the source Directory; must be opened in READ_MODE
IOException
public long count1(long start, long end) throws IOException
IRankSelect
count1
in interface IRankSelect
IOException
public boolean get(long index) throws IOException
IRankSelect
get
in interface IRankSelect
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |