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.Matrix
The wrapped matrix.private static final long
For 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 UnsupportedOperationException
Returns the exception to throw when a setter method is invoked.clone()
Returns a copy of this matrix that users can modify.double
getElement
(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.int
Returns the number of columns in the wrapped matrix.int
Returns the number of rows in the wrapped matrix.boolean
Returnstrue
if the wrapped matrix is the identity matrix.void
setElement
(int row, int column, double value) Unconditionally throwsUnsupportedOperationException
since this view is unmodifiable.void
setElements
(double[] elements) Unconditionally throwsUnsupportedOperationException
since this view is unmodifiable.void
Unconditionally throwsUnsupportedOperationException
since 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:
getNumRow
in interfaceorg.opengis.referencing.operation.Matrix
-
getNumCol
public int getNumCol()Returns the number of columns in the wrapped matrix.- Specified by:
getNumCol
in interfaceorg.opengis.referencing.operation.Matrix
-
isIdentity
public boolean isIdentity()Returnstrue
if the wrapped matrix is the identity matrix.- Specified by:
isIdentity
in interfaceorg.opengis.referencing.operation.Matrix
- Specified by:
isIdentity
in classMatrixSIS
- 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 interfaceorg.opengis.referencing.operation.Matrix
- Specified by:
getElement
in 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:
getElements
in 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:
getExtendedElements
in 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 throwsUnsupportedOperationException
since this view is unmodifiable.- Specified by:
setElements
in 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 throwsUnsupportedOperationException
since this view is unmodifiable.- Specified by:
setElement
in interfaceorg.opengis.referencing.operation.Matrix
-
transpose
public void transpose()Unconditionally throwsUnsupportedOperationException
since this view is unmodifiable. -
clone
Returns a copy of this matrix that users can modify.
-