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
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final org.opengis.referencing.operation.MatrixThe wrapped matrix.private static final longFor cross-version compatibility.Fields inherited from interface org.apache.sis.internal.referencing.ExtendedPrecisionMatrix
IDENTITY, ZERO -
Constructor Summary
ConstructorsConstructorDescriptionUnmodifiableMatrix(org.opengis.referencing.operation.Matrix matrix) Creates a unmodifiable view of the given matrix. -
Method Summary
Modifier and TypeMethodDescriptionprivate UnsupportedOperationExceptionReturns the exception to throw when a setter method is invoked.clone()Returns a copy of this matrix that users can modify.doublegetElement(int row, int column) Returns the element in the wrapped matrix at the given row and column.double[]Returns all elements in the wrapped matrix in a row-major array.double[]Returns elements together with their error terms if available, or just the elements otherwise.intReturns the number of columns in the wrapped matrix.intReturns the number of rows in the wrapped matrix.booleanReturnstrueif the wrapped matrix is the identity matrix.voidsetElement(int row, int column, double value) Unconditionally throwsUnsupportedOperationExceptionsince this view is unmodifiable.voidsetElements(double[] elements) Unconditionally throwsUnsupportedOperationExceptionsince this view is unmodifiable.voidUnconditionally throwsUnsupportedOperationExceptionsince this view is unmodifiable.Methods inherited from class org.apache.sis.referencing.operation.matrix.MatrixSIS
castOrCopy, convertAfter, convertBefore, ensureLengthMatch, ensureNumRowMatch, ensureSizeMatch, equals, equals, equals, get, getElements, getElements, getInteger, getNumber, hashCode, indexOutOfBounds, inverse, isAffine, isAffine, isExtendedPrecision, multiply, multiply, normalizeColumns, removeColumns, removeRows, set, setElements, setMatrix, setNumber, solve, toString, translate
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
matrix
private final org.opengis.referencing.operation.Matrix matrixThe 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:
getNumRowin interfaceorg.opengis.referencing.operation.Matrix
-
getNumCol
public int getNumCol()Returns the number of columns in the wrapped matrix.- Specified by:
getNumColin interfaceorg.opengis.referencing.operation.Matrix
-
isIdentity
public boolean isIdentity()Returnstrueif the wrapped matrix is the identity matrix.- Specified by:
isIdentityin interfaceorg.opengis.referencing.operation.Matrix- Specified by:
isIdentityin classMatrixSIS- Returns:
trueif 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:
getElementin interfaceorg.opengis.referencing.operation.Matrix- Specified by:
getElementin classMatrixSIS- Parameters:
row- the row index, from 0 inclusive toMatrix.getNumRow()exclusive.column- the column index, from 0 inclusive toMatrix.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:
getElementsin classMatrixSIS- 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:
getExtendedElementsin interfaceExtendedPrecisionMatrix- Returns:
- a copy of matrix elements, potentially followed by error terms.
-
canNotModify
Returns the exception to throw when a setter method is invoked. -
setElements
public void setElements(double[] elements) Unconditionally throwsUnsupportedOperationExceptionsince this view is unmodifiable.- Specified by:
setElementsin classMatrixSIS- Parameters:
elements- The new matrix elements in a row-major array.- See Also:
-
setElement
public void setElement(int row, int column, double value) Unconditionally throwsUnsupportedOperationExceptionsince this view is unmodifiable.- Specified by:
setElementin interfaceorg.opengis.referencing.operation.Matrix
-
transpose
public void transpose()Unconditionally throwsUnsupportedOperationExceptionsince this view is unmodifiable. -
clone
Returns a copy of this matrix that users can modify.
-