Class Matrix<T>


  • public class Matrix<T>
    extends Object
    • Constructor Detail

      • Matrix

        public Matrix​(T[][] data)
      • Matrix

        public Matrix​(Class<T> type,
                      int rows,
                      int columns)
    • Method Detail

      • validateArray

        public static <T> T[][] validateArray​(T[][] array)
                                       throws MatrixException,
                                              NullPointerException
        Validates if array is a well-formed array in terms of a matrix.

        Well-formed arrays meet the following criteria:
        - Both dimensions have a size greater than 0.
        - No nested array may be null.
        - All nested arrays have the same size.

        Type Parameters:
        T -
        Parameters:
        array -
        Throws:
        MatrixException
        NullPointerException
      • getType

        public Class<T> getType()
      • getElementAt

        public T getElementAt​(int rowIndex,
                              int colIndex)
        Parameters:
        rowIndex -
        colIndex -
      • setElementAt

        public T setElementAt​(int rowIndex,
                              int colIndex,
                              T newElement)
        Parameters:
        rowIndex -
        colIndex -
        newElement -
        Returns:
        the old element at position (rowIndex, colIndex)
      • swapElements

        public void swapElements​(int rowIndex1,
                                 int colIndex1,
                                 int rowIndex2,
                                 int colIndex2)
        Parameters:
        rowIndex1 -
        colIndex1 -
        rowIndex2 -
        colIndex2 -