Class Row


  • public class Row
    extends Object
    The Row class represents a row in a matrix representation of a trie.
    • Constructor Summary

      Constructors 
      Constructor Description
      Row()
      The default constructor for the Row object.
      Row​(DataInput is)
      Construct a Row object from input carried in via the given input stream.
      Row​(Row old)
      Construct a Row using the cells of the given Row.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCells()
      Return the number of cells in use.
      int getCellsPnt()
      Return the number of references (how many transitions) to other rows.
      int getCellsVal()
      Return the number of patch commands saved in this Row.
      int getCmd​(Character way)
      Return the command in the Cell associated with the given Character.
      int getCnt​(Character way)
      Return the number of patch commands were in the Cell associated with the given Character before the Trie containing this Row was reduced.
      int getRef​(Character way)
      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 setCmd​(Character way, int cmd)
      Set the command in the Cell of the given Character to the given integer.
      void setRef​(Character way, int ref)
      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 Detail

      • Row

        public Row​(DataInput is)
            throws IOException
        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

        public Row​(Row old)
        Construct a Row using the cells of the given Row.
        Parameters:
        old - the Row to copy
    • Method Detail

      • setCmd

        public void setCmd​(Character way,
                           int cmd)
        Set the command in the Cell of the given Character to the given integer.
        Parameters:
        way - the Character defining the Cell
        cmd - the new command
      • setRef

        public void setRef​(Character way,
                           int ref)
        Set the reference to the next row in the Cell of the given Character to the given integer.
        Parameters:
        way - the Character defining the Cell
        ref - 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

        public int getCmd​(Character way)
        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

        public int getCnt​(Character way)
        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

        public int getRef​(Character way)
        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

        public void store​(DataOutput os)
                   throws IOException
        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 to false the removed patch commands are considered
        Returns:
        the number of identical Cells, or -1 if there are (at least) two different cells
      • print

        public void print​(PrintStream out)
        Write the contents of this Row to the printstream.