Class UnmodifiableMatrix

java.lang.Object
org.apache.sis.referencing.operation.matrix.MatrixSIS
org.apache.sis.referencing.operation.matrix.UnmodifiableMatrix
All Implemented Interfaces:
Serializable, Cloneable, ExtendedPrecisionMatrix, LenientComparable, org.opengis.referencing.operation.Matrix

final class UnmodifiableMatrix extends MatrixSIS implements ExtendedPrecisionMatrix
A unmodifiable view of a matrix. This matrix is immutable only if the wrapped matrix is not modified anymore after UnmodifiableMatrix construction.
Since:
0.6
Version:
0.7
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • matrix

      private final org.opengis.referencing.operation.Matrix matrix
      The wrapped matrix.
  • Constructor Details

    • UnmodifiableMatrix

      UnmodifiableMatrix(org.opengis.referencing.operation.Matrix matrix)
      Creates a unmodifiable view of the given matrix.
  • Method Details

    • getNumRow

      public int getNumRow()
      Returns the number of rows in the wrapped matrix.
      Specified by:
      getNumRow in interface org.opengis.referencing.operation.Matrix
    • getNumCol

      public int getNumCol()
      Returns the number of columns in the wrapped matrix.
      Specified by:
      getNumCol in interface org.opengis.referencing.operation.Matrix
    • isIdentity

      public boolean isIdentity()
      Returns true if the wrapped matrix is the identity matrix.
      Specified by:
      isIdentity in interface org.opengis.referencing.operation.Matrix
      Specified by:
      isIdentity in class MatrixSIS
      Returns:
      true if this matrix is an identity matrix.
      See Also:
    • getElement

      public double getElement(int row, int column)
      Returns the element in the wrapped matrix at the given row and column.
      Specified by:
      getElement in interface org.opengis.referencing.operation.Matrix
      Specified by:
      getElement in class MatrixSIS
      Parameters:
      row - the row index, from 0 inclusive to Matrix.getNumRow() exclusive.
      column - the column index, from 0 inclusive to Matrix.getNumCol() exclusive.
      Returns:
      the current value at the given row and column.
    • getElements

      public double[] getElements()
      Returns all elements in the wrapped matrix in a row-major array.
      Overrides:
      getElements in class MatrixSIS
      Returns:
      a copy of all current matrix elements in a row-major array.
    • getExtendedElements

      public double[] getExtendedElements()
      Returns elements together with their error terms if available, or just the elements otherwise.
      Specified by:
      getExtendedElements in interface ExtendedPrecisionMatrix
      Returns:
      a copy of matrix elements, potentially followed by error terms.
    • canNotModify

      private UnsupportedOperationException canNotModify()
      Returns the exception to throw when a setter method is invoked.
    • setElements

      public void setElements(double[] elements)
      Unconditionally throws UnsupportedOperationException since this view is unmodifiable.
      Specified by:
      setElements in class MatrixSIS
      Parameters:
      elements - The new matrix elements in a row-major array.
      See Also:
    • setElement

      public void setElement(int row, int column, double value)
      Unconditionally throws UnsupportedOperationException since this view is unmodifiable.
      Specified by:
      setElement in interface org.opengis.referencing.operation.Matrix
    • transpose

      public void transpose()
      Unconditionally throws UnsupportedOperationException since this view is unmodifiable.
      Specified by:
      transpose in class MatrixSIS
    • clone

      public MatrixSIS clone()
      Returns a copy of this matrix that users can modify.
      Specified by:
      clone in interface org.opengis.referencing.operation.Matrix
      Overrides:
      clone in class MatrixSIS
      Returns:
      a new matrix of the same class and with the same values than this matrix.
      See Also: