Package ch.nolix.core.container.matrix
Klasse Matrix<E>
java.lang.Object
ch.nolix.core.container.base.Container<E>
ch.nolix.core.container.matrix.Matrix<E>
- Typparameter:
E
- is the type of the elements of aMatrix
.
- Alle implementierten Schnittstellen:
IContainer<E>
,IMappableContainer<E>
,ISearchableContainer<E>
,IStatisticalConainer<E>
,IterableWithCopyableIterator<E>
,StoringRequestable<E>
,IMatrix<E>
,Clearable
,EmptinessRequestable
,MaterializationRequestable
,Iterable<E>
- Version:
- 2016-08-01
- Autor:
- Silvan Wyss
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungAdds a new column to the currentMatrix
with the given elements.Adds a new column to the currentMatrix
with the given elements.Adds a new row to the currentMatrix
with the given elements.Adds a new row to the currentMatrix
with the given elements.void
clear()
Removes all elements of the currentMatrix
.protected <E2> ILinkedList
<E2> createEmptyMutableList
(Marker<E2> marker) static <E2> Matrix
<E2> fromMatrix
(IMatrix<E2> matrix) getColumn
(int columnIndex) int
The complexity of this implementation is O(1).int
getColumnIndexOf
(int index) getCopy()
The complexity of this implementation is O(m * n) if: -This matrix contains m rows.int
getCount()
The complexity of this implementation is O(1).int
getIndexOf
(int rowIndex, int columnIndex) getRow
(int rowIndex) int
The complexity of this implementation is O(1).int
getRowIndexOf
(int index) getRows()
getStoredAt1BasedIndex
(int p1BasedIndex) getStoredAt1BasedRowIndexAndColumnIndex
(int p1BasedRowIndex, int p1BasedColumnIndex) The complexity of this implementation is O(1).boolean
iterator()
The complexity of this implementation is O(1).void
Sets the given element to the currentMatrix
at the given index.void
setAt1BasedRowIndexAndColumnIndex
(int p1BasedRowIndex, int p1BasedColumnIndex, E element) Sets the given element to the currentMatrix
to the row with the given row index and the column with the given column index.The complexity of this implementation is O(n) if the currentMatrix
contains n elements.<O> Matrix
<O> The complexity of this implementation is O(n) if: -This matrix contains n elements.<C extends Comparable<C>>
IContainer<E> toOrderedList
(Function<E, C> norm) The complexity of this implementation is O(n) if the currentMatrix
contains n elements.toString()
The complexity of this implementation is O(n) if: -The currentMatrix
contains n elements.Von Klasse geerbte Methoden ch.nolix.core.container.base.Container
contains, containsAll, containsAll, containsAny, containsAny, containsAny, containsAnyOf, containsAsManyAs, containsEqualing, containsExactlyInSameOrder, containsLessThan, containsMoreThan, containsNone, containsNone, containsNoneOf, containsOnce, containsOne, containsOne, containsOneEqualing, containsOnly, containsOnlyEqualingAndViceVersa, from1BasedStartIndex, from1BasedStartIndexUntil1BasedEndIndex, get1BasedIndexOfFirst, get1BasedIndexOfFirstEqualElement, get1BasedIndexOfFirstOccuranceOf, getAverage, getAverageOrZero, getCount, getCount, getMax, getMaxOrZero, getMedian, getMedianOrZero, getMin, getMinOrZero, getOptionalStoredFirst, getOptionalStoredFirst, getStandardDeviation, getStoredAny, getStoredByMax, getStoredByMin, getStoredFirst, getStoredFirst, getStoredGroups, getStoredOfType, getStoredOne, getStoredOne, getStoredOther, getStoredSelected, getSum, getSumOfIntegers, getVariance, isEmpty, to, toArray, toByteArray, toCharArray, toConcatenatedString, toDoubleArray, toFromGroups, toIntArray, toLongArray, toReversedList, toStringArray, toStrings, toStringWithSeparator, toStringWithSeparator, until1BasedIndex, withoutFirst, withoutFirst, withoutLast, withoutLast
Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.nolix.coreapi.stateapi.staterequestapi.EmptinessRequestable
containsAny, isEmpty
Von Schnittstelle geerbte Methoden ch.nolix.coreapi.containerapi.baseapi.IContainer
from1BasedStartIndex, from1BasedStartIndexUntil1BasedEndIndex, get1BasedIndexOfFirst, get1BasedIndexOfFirstEqualElement, get1BasedIndexOfFirstOccuranceOf, toReversedList, toStringArray, toStrings, toStringWithSeparator, toStringWithSeparator, until1BasedIndex, withoutFirst, withoutFirst, withoutLast, withoutLast
Von Schnittstelle geerbte Methoden ch.nolix.coreapi.containerapi.baseapi.IMappableContainer
to, toArray, toByteArray, toCharArray, toConcatenatedString, toDoubleArray, toFromGroups, toIntArray, toLongArray
Von Schnittstelle geerbte Methoden ch.nolix.coreapi.containerapi.baseapi.ISearchableContainer
getOptionalStoredFirst, getOptionalStoredFirst, getStoredAny, getStoredByMax, getStoredByMin, getStoredFirst, getStoredFirst, getStoredGroups, getStoredOfType, getStoredOne, getStoredOne, getStoredOther, getStoredSelected
Von Schnittstelle geerbte Methoden ch.nolix.coreapi.containerapi.baseapi.IStatisticalConainer
getAverage, getAverageOrZero, getCount, getCount, getMax, getMaxOrZero, getMedian, getMedianOrZero, getMin, getMinOrZero, getStandardDeviation, getSum, getSumOfIntegers, getVariance
Von Schnittstelle geerbte Methoden java.lang.Iterable
forEach, spliterator
Von Schnittstelle geerbte Methoden ch.nolix.coreapi.stateapi.staterequestapi.MaterializationRequestable
isView
Von Schnittstelle geerbte Methoden ch.nolix.coreapi.containerapi.baseapi.StoringRequestable
contains, containsAll, containsAll, containsAny, containsAny, containsAnyOf, containsAsManyAs, containsEqualing, containsExactlyInSameOrder, containsLessThan, containsMoreThan, containsNone, containsNone, containsNoneOf, containsOnce, containsOne, containsOne, containsOneEqualing, containsOnly, containsOnlyEqualingAndViceVersa
-
Konstruktordetails
-
Matrix
public Matrix()
-
-
Methodendetails
-
fromMatrix
- Typparameter:
E2
- is the type of the elements of the given matrix.- Parameter:
matrix
-- Gibt zurück:
- a new
Matrix
with the size and elements of the given matrix.
-
addColumn
Adds a new column to the currentMatrix
with the given elements. The complexity of this implementation is O(m + n) if: -The currentMatrix
contains m elements. -n elements are given.- Parameter:
element
-elements
-- Gibt zurück:
- the current
Matrix
. - Löst aus:
ArgumentIsNullException
- if the given elements is null.ArgumentIsNullException
- if one of the given elements is null.UnequalArgumentException
- if the currentMatrix
is not empty and if not as many elements are given as the number of rows of the currentMatrix
.
-
addColumn
Adds a new column to the currentMatrix
with the given elements. The complexity of this implementation is O(m + n) if: -The currentMatrix
contains m elements. -n elements are given.- Parameter:
elements
-- Gibt zurück:
- the current
Matrix
. - Löst aus:
ArgumentIsNullException
- if the given elements is null.ArgumentIsNullException
- if one of the given elements is null.UnequalArgumentException
- if the currentMatrix
is not empty and if not as many elements are given as the number of rows of the currentMatrix
.
-
addRow
Adds a new row to the currentMatrix
with the given elements. The complexity of this implementation is O(m + n) if: -The currentMatrix
contains m rows. -n elements are given.- Parameter:
element
-elements
-- Gibt zurück:
- the current
Matrix
. - Löst aus:
ArgumentIsNullException
- if the given elements is null.ArgumentIsNullException
- if one of the given elements is null.UnequalArgumentException
- the currentMatrix
is not empty and if not as many elements are given as the number of columns of the currentMatrix
.
-
addRow
Adds a new row to the currentMatrix
with the given elements. The complexity of this implementation is O(m + n) if: -The currentMatrix
contains m rows. -n elements are given.- Parameter:
elements
-- Gibt zurück:
- the current
Matrix
. - Löst aus:
ArgumentIsNullException
- if the given elements is null.ArgumentIsNullException
- if one of the given elements is null.UnequalArgumentException
- the currentMatrix
is not empty and if not as many elements are given as the number of columns of the currentMatrix
.
-
clear
public void clear()Removes all elements of the currentMatrix
. The complexity of this implementation is O(1). -
getColumn
- Parameter:
columnIndex
-- Gibt zurück:
- the column of the current
Matrix
with the given column index. - Löst aus:
NonPositiveArgumentException
- if the given column index is not positive.BiggerArgumentException
- if the given column index is bigger than the number of columns of the currentMatrix
.
-
getColumnCount
public int getColumnCount()The complexity of this implementation is O(1).- Angegeben von:
getColumnCount
in SchnittstelleIMatrix<E>
- Gibt zurück:
- the number of columns of the current
Matrix
.
-
getColumnIndexOf
public int getColumnIndexOf(int index) - Parameter:
index
-- Gibt zurück:
- the index of the column of the element of the current
Matrix
at the given index. - Löst aus:
NonPositiveArgumentException
- if the given index is not positive.BiggerArgumentException
- if the given index is bigger than the number of elements of the currentMatrix
.
-
getColumns
- Angegeben von:
getColumns
in SchnittstelleIMatrix<E>
- Gibt zurück:
- the columns of the current
Matrix
.
-
getCopy
The complexity of this implementation is O(m * n) if: -This matrix contains m rows. -This matrix contains n columns. -
getCount
public int getCount()The complexity of this implementation is O(1).- Angegeben von:
getCount
in SchnittstelleIStatisticalConainer<E>
- Gibt zurück:
- the number of elements of the current
Matrix
.
-
getIndexOf
public int getIndexOf(int rowIndex, int columnIndex) - Parameter:
rowIndex
-columnIndex
-- Gibt zurück:
- the index of the element of the current
Matrix
at the given row index and column index. - Löst aus:
NonPositiveArgumentException
- if the given row index is not positive.BiggerArgumentException
- if the given row index is bigger than the number of rows of the currentMatrix
.NonPositiveArgumentException
- if the given column index is not positive.BiggerArgumentException
- if the given column index is bigger than the number of columns of the currentMatrix
.
-
getStoredAt1BasedIndex
- Angegeben von:
getStoredAt1BasedIndex
in SchnittstelleISearchableContainer<E>
- Parameter:
p1BasedIndex
-- Gibt zurück:
- the element of the current
Matrix
at the given index . - Löst aus:
NonPositiveArgumentException
- if the given index is not positive.BiggerArgumentException
- if the given index is bigger than the number of elements of the currentMatrix
.
-
getStoredAt1BasedRowIndexAndColumnIndex
The complexity of this implementation is O(1).- Angegeben von:
getStoredAt1BasedRowIndexAndColumnIndex
in SchnittstelleIMatrix<E>
- Parameter:
p1BasedRowIndex
-p1BasedColumnIndex
-- Gibt zurück:
- the element of the current
Matrix
at the given row index and column index. - Löst aus:
NonPositiveArgumentException
- if the given row index is not positive.BiggerArgumentException
- if the given row index is bigger than the number of rows of the currentMatrix
.NonPositiveArgumentException
- if the given column index is not positive.BiggerArgumentException
- if the given column index is bigger than the number of columns of the currentMatrix
.
-
getStoredLast
- Angegeben von:
getStoredLast
in SchnittstelleISearchableContainer<E>
- Gibt zurück:
- the last element of the current
ISearchableContainer
.
-
getRow
- Parameter:
rowIndex
-- Gibt zurück:
- the row of the current
Matrix
at the given row index. - Löst aus:
NonPositiveArgumentException
- if the given row index is not positive.BiggerArgumentException
- if the given row index is bigger than the number of rows of the currentMatrix
.
-
getRowIndexOf
public int getRowIndexOf(int index) - Parameter:
index
-- Gibt zurück:
- the index of the row of the element of the current
Matrix
at the given index. - Löst aus:
NonPositiveArgumentException
- if the given index is not positive.BiggerArgumentException
- if the given index is bigger than the number of elements of the currentMatrix
.
-
getRows
-
getRowCount
public int getRowCount()The complexity of this implementation is O(1).- Angegeben von:
getRowCount
in SchnittstelleIMatrix<E>
- Gibt zurück:
- the number of rows of the current
Matrix
.
-
isMaterialized
public boolean isMaterialized()- Angegeben von:
isMaterialized
in SchnittstelleMaterializationRequestable
- Gibt zurück:
- true if the current
MaterializationRequestable
is materialized, false otherwise.
-
iterator
The complexity of this implementation is O(1). -
setAt
Sets the given element to the currentMatrix
at the given index. The complexity of this implementation is O(1).- Parameter:
index
-element
-- Löst aus:
NonPositiveArgumentException
- if the given index is not positive.BiggerArgumentException
- if the given index is bigger than the number of elements of the currentMatrix
.ArgumentIsNullException
- if the given element is null.
-
setAt1BasedRowIndexAndColumnIndex
public void setAt1BasedRowIndexAndColumnIndex(int p1BasedRowIndex, int p1BasedColumnIndex, E element) Sets the given element to the currentMatrix
to the row with the given row index and the column with the given column index. The complexity of this implementation is O(1).- Angegeben von:
setAt1BasedRowIndexAndColumnIndex
in SchnittstelleIMatrix<E>
- Parameter:
p1BasedRowIndex
-p1BasedColumnIndex
-element
-- Löst aus:
NonPositiveArgumentException
- if the given row index is not positive.BiggerArgumentException
- if the given row index is bigger than the number of rows of the currentMatrix
.NonPositiveArgumentException
- if the given column index is not positive.BiggerArgumentException
- if the given column index is bigger than the number of columns of the currentMatrix
.ArgumentIsNullException
- if the given element is null.
-
toMatrix
The complexity of this implementation is O(n) if: -This matrix contains n elements. -The given transformer has a complexity of O(1).- Typparameter:
O
- is the type of the elements the given transformer returns.- Parameter:
transformer
-- Gibt zurück:
- a new matrix with the elements the given transformer transforms of
the elements of the current
Matrix
.
-
toLeftRotatedMatrix
The complexity of this implementation is O(n) if the currentMatrix
contains n elements. -
toOrderedList
- Angegeben von:
toOrderedList
in SchnittstelleIContainer<E>
- Typparameter:
C
- is the type of theComparable
s the given norm returns.- Parameter:
norm
-- Gibt zurück:
- a new
IContainer
with the elements of the currentIContainer
ordered from the smallest to the biggest element according to the given norm.
-
toRightRotatedMatrix
The complexity of this implementation is O(n) if the currentMatrix
contains n elements. -
toString
-
createEmptyMutableList
- Angegeben von:
createEmptyMutableList
in KlasseContainer<E>
- Typparameter:
E2
- is the type of the elements the createdILinkedList
can contain.- Parameter:
marker
-- Gibt zurück:
- a new empty
ILinkedList
.
-