org.teiid.internal.core.index
Class WordEntry

java.lang.Object
  extended by org.teiid.internal.core.index.WordEntry
All Implemented Interfaces:
Comparable<WordEntry>

public class WordEntry
extends Object
implements Comparable<WordEntry>


Field Summary
protected  int fNumRefs
           
protected  int[] fRefs
           
protected  char[] fWord
           
 
Constructor Summary
WordEntry()
           
WordEntry(char[] word)
           
 
Method Summary
 int addRef(int fileNum)
          Adds a reference and records the change in footprint.
 void addRefs(int[] refs)
          Adds a set of references and records the change in footprint.
 int compareTo(WordEntry other)
           
 int footprint()
          Returns the size of the wordEntry
 int getNumRefs()
          Returns the number of references, e.g.
 int getRef(int i)
          returns the file number in the i position in the list of references.
 int[] getRefs()
          Returns the references of the wordEntry (the number of the files it appears in).
 char[] getWord()
          returns the word of the wordEntry.
 void mapRefs(int[] mappings)
          Changes the references of the wordEntry to match the mapping.
 void reset(char[] word)
          Clears the wordEntry.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fWord

protected char[] fWord

fNumRefs

protected int fNumRefs

fRefs

protected int[] fRefs
Constructor Detail

WordEntry

public WordEntry()

WordEntry

public WordEntry(char[] word)
Method Detail

addRef

public int addRef(int fileNum)
Adds a reference and records the change in footprint.


addRefs

public void addRefs(int[] refs)
Adds a set of references and records the change in footprint.


footprint

public int footprint()
Returns the size of the wordEntry


getNumRefs

public int getNumRefs()
Returns the number of references, e.g. the number of files this word appears in.


getRef

public int getRef(int i)
returns the file number in the i position in the list of references.


getRefs

public int[] getRefs()
Returns the references of the wordEntry (the number of the files it appears in).


getWord

public char[] getWord()
returns the word of the wordEntry.


mapRefs

public void mapRefs(int[] mappings)
Changes the references of the wordEntry to match the mapping. For example,
if the current references are [1 3 4]
and mapping is [1 2 3 4 5]
in references 1 becomes mapping[1] = 2, 3->4, and 4->5
=> references = [2 4 5].


reset

public void reset(char[] word)
Clears the wordEntry.


toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(WordEntry other)
Specified by:
compareTo in interface Comparable<WordEntry>


Copyright © 2012. All Rights Reserved.