Class AbstractMatrix<R,​C,​V>

    • Constructor Detail

      • AbstractMatrix

        public AbstractMatrix()
    • Method Detail

      • addColumnName

        public final void addColumnName​(C s)
        Add a column name when we don't care what the index will be. The index will be set by the method. This is useful for when we need to set up a matrix before we know how many column or rows there are.
        Specified by:
        addColumnName in interface Matrix2D<R,​C,​V>
        Parameters:
        s -
      • addRowName

        public final void addRowName​(R s)
        Add a row name when we don't care what the index will be. The index will be set by the method. This is useful for when we need to set up a matrix before we know how many column or rows there are.
        Parameters:
        s -
      • asDoubles

        public double[][] asDoubles()
        Description copied from interface: Matrix2D
        Attempt to coerce the entries into doubles.

        Numeric entries (Double, BigDecimal, Integer, BigInteger) and Strings that can be parsed as doubles are converted. Booleans are converted to 1 or 0. Dates are converted via Date.getDate(). Null entries are rendered as Double.NaN. For entries that are other types of objects, the HashCode is used.

        Specified by:
        asDoubles in interface Matrix2D<R,​C,​V>
        Returns:
      • assign

        public void assign​(V value)
        Description copied from interface: Matrix2D
        Set all values in the matrix to the given value.
        Specified by:
        assign in interface Matrix2D<R,​C,​V>
      • containsColumnName

        public final boolean containsColumnName​(C columnName)
        Specified by:
        containsColumnName in interface Matrix2D<R,​C,​V>
        Returns:
      • containsRowName

        public final boolean containsRowName​(R rowName)
        Specified by:
        containsRowName in interface Matrix2D<R,​C,​V>
        Returns:
      • getColIndexByName

        public final int getColIndexByName​(C columnKey)
        Description copied from interface: Matrix2D
        Get the index of a column by name.
        Specified by:
        getColIndexByName in interface Matrix2D<R,​C,​V>
        Parameters:
        columnKey - String
        Returns:
        int
      • getColName

        public final C getColName​(int i)
        Description copied from interface: Matrix2D
        Gte the column name for an index.
        Specified by:
        getColName in interface Matrix2D<R,​C,​V>
        Parameters:
        i - int
        Returns:
        java.lang.String
      • getColNames

        public final List<C> getColNames()
        Specified by:
        getColNames in interface Matrix2D<R,​C,​V>
        Returns:
        list of column names. Do not modify this list. Use the addColumnName methods.
      • getRowIndexByName

        public final int getRowIndexByName​(R s)
        Description copied from interface: Matrix2D
        Get the index of a row by name..
        Specified by:
        getRowIndexByName in interface Matrix2D<R,​C,​V>
        Parameters:
        s - String
        Returns:
        int
      • getRowName

        public final R getRowName​(int i)
        Description copied from interface: Matrix2D
        Get the row name for an index
        Specified by:
        getRowName in interface Matrix2D<R,​C,​V>
        Parameters:
        i - int
        Returns:
        java.lang.String
      • hasColNames

        public final boolean hasColNames()
        Description copied from interface: Matrix2D
        Check if this matrix has a valid set of column names.
        Specified by:
        hasColNames in interface Matrix2D<R,​C,​V>
        Returns:
        boolean
      • hasMissingValues

        public boolean hasMissingValues()
        Test for the presence of missing values (null, or in the case of numbers, NaN)
        Returns:
      • hasRow

        public final boolean hasRow​(R r)
        Specified by:
        hasRow in interface Matrix2D<R,​C,​V>
        Parameters:
        r - Object
        Returns:
        boolean
      • hasRowNames

        public final boolean hasRowNames()
        Specified by:
        hasRowNames in interface Matrix2D<R,​C,​V>
        Returns:
        boolean
      • numMissing

        public final int numMissing()
        Description copied from interface: Matrix2D
        Return the number of missing values in the matrix.
        Specified by:
        numMissing in interface Matrix2D<R,​C,​V>
        Returns:
      • setColumnName

        public final void setColumnName​(C s,
                                        int i)
        Description copied from interface: Matrix2D
        Add a column name associated with an index.
        Specified by:
        setColumnName in interface Matrix2D<R,​C,​V>
        Parameters:
        s - Object a column name
        i - int the column index associated with this name
      • setRowName

        public final void setRowName​(R s,
                                     int i)
        Description copied from interface: Matrix2D
        Add a row name associated with a row index.
        Specified by:
        setRowName in interface Matrix2D<R,​C,​V>
        Parameters:
        s - Object
        i - int
      • size

        public abstract int size()
      • checkColRange

        protected void checkColRange​(int startCol,
                                     int endCol)
      • checkRowRange

        protected void checkRowRange​(int startRow,
                                     int endRow)