|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.mg4j.tool.Occurrence
A class denoting an occurrence.
An instance of this class is used to store an occurrence. The class stores the index of the term, the index of the document and the position (starting from 0) of the occurrence.
Field Summary | |
int |
docIndex
The document index. |
int |
docPosition
The position of this occurrence of term termIndex in document docIndex . |
int |
termIndex
The term index. |
Constructor Summary | |
Occurrence()
Creates a new occurrence with all fields initialised to zero. |
|
Occurrence(int termIndex,
int docIndex,
int docPosition)
Creates a new occurrence with given indices. |
Method Summary | |
int |
compareTo(Object o)
Compares this occurrence with another object. |
static void |
countSortOnDocuments(Occurrence[] in,
Occurrence[] out,
int len,
int[] count,
int n)
Performs a distribution-counting sort over a vector of occurrences using only docIndex as key. |
static void |
countSortOnTerms(Occurrence[] in,
Occurrence[] out,
int len,
int[] count,
int n)
Performs a distribution-counting sort over a vector of occurrences using only termIndex as key. |
boolean |
equals(Object o)
|
int |
hashCode()
|
static int |
readOccurrences(Occurrence[] occurrence,
int len,
InputBitStream in)
Reads a compressed stream of occurrences into a vector. |
void |
set(int termIndex,
int docIndex,
int docPosition)
Sets the fields of this occurrence. |
String |
toString()
|
static void |
writeOccurrences(Occurrence[] occurrence,
int len,
OutputBitStream out)
Writes in compressed form a vector of sorted occurrences. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public int termIndex
public int docIndex
public int docPosition
termIndex
in document docIndex
.
Constructor Detail |
public Occurrence()
public Occurrence(int termIndex, int docIndex, int docPosition)
termIndex
- the term index.docIndex
- the document index.docPosition
- the position of the occurrences in the document.Method Detail |
public void set(int termIndex, int docIndex, int docPosition)
termIndex
- the term index.docIndex
- the document index.docPosition
- the position of the occurrences in the document.public int hashCode()
public boolean equals(Object o)
public int compareTo(Object o)
Comparison between occurrences is lexicographical w.r.t. termIndex
,
docIndex
and docPosition
, in this order.
compareTo
in interface Comparable
o
- an occurrence.
ClassCastException
- if the argument is not an Occurrence
.compareTo(Object)
public String toString()
public static void countSortOnTerms(Occurrence[] in, Occurrence[] out, int len, int[] count, int n)
termIndex
as key.
in
- a vector of occurrences to be sorted.out
- a vector to store the sorted permutation of in
; its length must be at least len
.len
- the number of valid occurrences in occurrence
.count
- a vector to perform the counting; its length must be greater than n.n
- the number of keys (terms).public static void countSortOnDocuments(Occurrence[] in, Occurrence[] out, int len, int[] count, int n)
docIndex
as key.
in
- a vector of occurrences to be sorted.out
- a vector to store the sorted permutation of in
; its length must be at least len
.len
- the number of valid occurrences in occurrence
.count
- a vector to perform the counting; its length must be greater than n.n
- the number of keys (documents).public static void writeOccurrences(Occurrence[] occurrence, int len, OutputBitStream out) throws IOException
occurrence
- a vector of occurrences.len
- the number of valid occurrences in occurrence
.out
- an already opened bit stream where the output will be sent.
IOException
public static int readOccurrences(Occurrence[] occurrence, int len, InputBitStream in) throws IOException
occurrence
- a vector of occurrences.len
- the maximum number of occurrences to be read.in
- an already opened input bit stream.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |