Package org.egothor.stemmer
Class Row
java.lang.Object
org.egothor.stemmer.Row
The Row class represents a row in a matrix representation of a trie.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getCells()
Return the number of cells in use.int
Return the number of references (how many transitions) to other rows.int
Return the number of patch commands saved in this Row.int
Return the command in the Cell associated with the given Character.int
Return the number of patch commands were in the Cell associated with the given Character before the Trie containing this Row was reduced.int
Return the reference to the next Row in the Cell associated with the given Character.void
print
(PrintStream out) Write the contents of this Row to the printstream.void
Set the command in the Cell of the given Character to the given integer.void
Set the reference to the next row in the Cell of the given Character to the given integer.void
store
(DataOutput os) Write the contents of this Row to the given output stream.int
uniformCmd
(boolean eqSkip) Return the number of identical Cells (containing patch commands) in this Row.
-
Constructor Details
-
Row
Construct a Row object from input carried in via the given input stream.- Parameters:
is
- the input stream- Throws:
IOException
- if an I/O error occurs
-
Row
public Row()The default constructor for the Row object. -
Row
Construct a Row using the cells of the given Row.- Parameters:
old
- the Row to copy
-
-
Method Details
-
setCmd
Set the command in the Cell of the given Character to the given integer.- Parameters:
way
- the Character defining the Cellcmd
- the new command
-
setRef
Set the reference to the next row in the Cell of the given Character to the given integer.- Parameters:
way
- the Character defining the Cellref
- The new ref value
-
getCells
public int getCells()Return the number of cells in use.- Returns:
- the number of cells in use
-
getCellsPnt
public int getCellsPnt()Return the number of references (how many transitions) to other rows.- Returns:
- the number of references
-
getCellsVal
public int getCellsVal()Return the number of patch commands saved in this Row.- Returns:
- the number of patch commands
-
getCmd
Return the command in the Cell associated with the given Character.- Parameters:
way
- the Character associated with the Cell holding the desired command- Returns:
- the command
-
getCnt
Return the number of patch commands were in the Cell associated with the given Character before the Trie containing this Row was reduced.- Parameters:
way
- the Character associated with the desired Cell- Returns:
- the number of patch commands before reduction
-
getRef
Return the reference to the next Row in the Cell associated with the given Character.- Parameters:
way
- the Character associated with the desired Cell- Returns:
- the reference, or -1 if the Cell is
null
-
store
Write the contents of this Row to the given output stream.- Parameters:
os
- the output stream- Throws:
IOException
- if an I/O error occurs
-
uniformCmd
public int uniformCmd(boolean eqSkip) Return the number of identical Cells (containing patch commands) in this Row.- Parameters:
eqSkip
- when set tofalse
the removed patch commands are considered- Returns:
- the number of identical Cells, or -1 if there are (at least) two different cells
-
print
Write the contents of this Row to the printstream.
-