Class Size


  • public class Size
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int cols  
      private int rows  
    • Constructor Summary

      Constructors 
      Constructor Description
      Size()  
      Size​(int columns, int rows)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void copy​(Size size)  
      int cursorPos​(int row, int col)
      A cursor position combines a row number with a column position.
      boolean equals​(java.lang.Object o)  
      int getColumns()  
      int getRows()  
      int hashCode()  
      void setColumns​(int columns)  
      void setRows​(int rows)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • rows

        private int rows
      • cols

        private int cols
    • Constructor Detail

      • Size

        public Size()
      • Size

        public Size​(int columns,
                    int rows)
    • Method Detail

      • getColumns

        public int getColumns()
      • setColumns

        public void setColumns​(int columns)
      • getRows

        public int getRows()
      • setRows

        public void setRows​(int rows)
      • cursorPos

        public int cursorPos​(int row,
                             int col)
        A cursor position combines a row number with a column position.

        Note each row has col+1 different column positions, including the right margin.

        Parameters:
        col - the new column
        row - the new row
        Returns:
        the cursor position
      • copy

        public void copy​(Size size)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object