Package ch.nolix.core.container.matrix
Klasse Matrix<E>
java.lang.Object
ch.nolix.core.container.base.AbstractContainer<E>
ch.nolix.core.container.arraylist.AbstractExtendedContainer<E>
ch.nolix.core.container.matrix.Matrix<E>
- Typparameter:
E- is the type of the elements of aMatrix.
- Alle implementierten Schnittstellen:
Filterable<E>,Groupable<E>,IContainer<E>,IFilteringContainerViewProvider<E>,IIntervallContainerViewProvider<E>,IMappingContainerViewProvider<E>,Mappable<E>,AggregationRequestable<E>,ArrayMappable<E>,CountRequestable<E>,IndexRequestable<E>,IterableWithCopyableIterator<E>,SingleSearchable<E>,StoringRequestable<E>,StringMappable,IMatrix<E>,Clearable,EmptinessRequestable,MaterializationRequestable,Iterable<E>
A
Matrix is a AbstractContainer that stores its elements in
rows and columns. A Matrix is clearable.- Version:
- 2016-08-01
- Autor:
- Silvan Wyss
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungAdds a new column to the currentMatrixwith the given elements.Adds a new column to the currentMatrixwith the given elements.Adds a new row to the currentMatrixwith the given elements.Adds a new row to the currentMatrixwith the given elements.voidclear()Removes all elements of the currentMatrix.static <E2> Matrix<E2> static <E2> Matrix<E2> fromMatrix(IMatrix<E2> matrix) getColumn(int columnIndex) intThe time complexity of this implementation is O(1).intgetColumnIndexOf(int index) getCopy()The time complexity of this implementation is O(m * n) if: -This matrix contains m rows.intgetCount()The time complexity of this implementation is O(1).intgetIndexOf(int rowIndex, int columnIndex) getRow(int rowIndex) intThe time complexity of this implementation is O(1).intgetRowIndexOf(int index) getRows()getStoredAtOneBasedIndex(int oneBasedIndex) getStoredAtOneBasedRowIndexAndColumnIndex(int oneBasedRowIndex, int oneBasedColumnIndex) The time complexity of this implementation is O(1).booleaniterator()The time complexity of this implementation is O(1).voidSets the given element to the currentMatrixat the given index.voidsetAtOneBasedRowIndexAndColumnIndex(int oneBasedRowIndex, int oneBasedColumnIndex, E element) Sets the given element to the currentMatrixto the row with the given row index and the column with the given column index.The time complexity of this implementation is O(n) if the currentMatrixcontains n elements.<O> Matrix<O> The time complexity of this implementation is O(n) if: -This matrix contains n elements.The time complexity of this implementation is O(n) if the currentMatrixcontains n elements.toString()The time complexity of this implementation is O(n) if: -The currentMatrixcontains n elements.Von Klasse geerbte Methoden ch.nolix.core.container.arraylist.AbstractExtendedContainer
createEmptyMutableList, getViewFromOneBasedStartIndexToOneBasedEndIndex, getViewOf, getViewOfStoredSelected, toOrderedListVon Klasse geerbte Methoden ch.nolix.core.container.base.AbstractContainer
contains, containsAll, containsAll, containsAll, containsAny, containsAny, containsAnyOf, containsAnyOf, containsAsManyAs, containsEqualing, containsExactlyEqualingInSameOrder, containsExactlyInSameOrder, containsLessThan, containsMoreThan, containsNone, containsNone, containsNoneOf, containsOnce, containsOne, containsOne, containsOneEqualing, containsOnly, getAverage, getAverageOrZero, getCount, getCountOf, getMax, getMaxOrZero, getMedian, getMedianOrZero, getMin, getMinOrZero, getOneBasedIndexOfFirst, getOneBasedIndexOfFirstEqualElement, getOneBasedIndexOfFirstOccurrenceOf, getOptionalStoredFirst, getOptionalStoredFirst, getStandardDeviation, getStoredByMax, getStoredByMin, getStoredFirst, getStoredFirst, getStoredFirstOfType, getStoredInGroups, getStoredLast, getStoredOfType, getStoredOne, getStoredOne, getStoredOthers, getStoredSelected, getSum, getSumOfInts, getVariance, getViewFromOneBasedStartIndex, getViewToOneBasedEndIndex, getViewWithoutFirst, getViewWithoutFirst, getViewWithoutLast, getViewWithoutLast, isEmpty, to, toArray, toByteArray, toCharArray, toConcatenatedString, toDoubleArray, toIntArray, toLongArray, toMultiples, toNumbers, toReversedList, toStringArray, toStrings, toStringWithSeparator, toStringWithSeparator, toWithOneBasedIndexVon Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.commoncontainer.AggregationRequestable
getAverage, getAverageOrZero, getMax, getMaxOrZero, getMedian, getMedianOrZero, getMin, getMinOrZero, getStandardDeviation, getSum, getSumOfInts, getVarianceVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.commoncontainer.ArrayMappable
toArray, toByteArray, toCharArray, toDoubleArray, toIntArray, toLongArray, toStringArrayVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.commoncontainer.CountRequestable
getCount, getCountOfVon Schnittstelle geerbte Methoden ch.nolix.coreapi.state.staterequest.EmptinessRequestable
containsAny, isEmptyVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.base.Filterable
getStoredOfType, getStoredOthers, getStoredSelectedVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.base.Groupable
getStoredInGroupsVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.base.IContainer
toOrderedList, toReversedListVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.base.IFilteringContainerViewProvider
getViewOfStoredSelectedVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.base.IIntervallContainerViewProvider
getViewFromOneBasedStartIndex, getViewFromOneBasedStartIndexToOneBasedEndIndex, getViewToOneBasedEndIndex, getViewWithoutFirst, getViewWithoutFirst, getViewWithoutLast, getViewWithoutLastVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.base.IMappingContainerViewProvider
getViewOfVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.commoncontainer.IndexRequestable
getOneBasedIndexOfFirst, getOneBasedIndexOfFirstEqualElement, getOneBasedIndexOfFirstOccurrenceOfVon Schnittstelle geerbte Methoden java.lang.Iterable
forEach, spliteratorVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.base.Mappable
to, toMultiples, toNumbers, toStrings, toWithOneBasedIndexVon Schnittstelle geerbte Methoden ch.nolix.coreapi.state.staterequest.MaterializationRequestable
isViewVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.commoncontainer.SingleSearchable
getOptionalStoredFirst, getOptionalStoredFirst, getStoredByMax, getStoredByMin, getStoredFirst, getStoredFirst, getStoredFirstOfType, getStoredLast, getStoredOne, getStoredOneVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.commoncontainer.StoringRequestable
contains, containsAll, containsAll, containsAll, containsAny, containsAny, containsAnyOf, containsAnyOf, containsAsManyAs, containsEqualing, containsExactlyEqualingInSameOrder, containsExactlyInSameOrder, containsLessThan, containsMoreThan, containsNone, containsNone, containsNoneOf, containsOnce, containsOne, containsOne, containsOneEqualing, containsOnlyVon Schnittstelle geerbte Methoden ch.nolix.coreapi.container.commoncontainer.StringMappable
toConcatenatedString, toStringWithSeparator, toStringWithSeparator
-
Methodendetails
-
createEmpty
-
fromMatrix
- Typparameter:
E2- is the type of the elements of the given matrix.- Parameter:
matrix-- Gibt zurück:
- a new
Matrixwith the size and elements of the given matrix.
-
addColumn
Adds a new column to the currentMatrixwith the given elements. The complexity of this implementation is O(m + n) if: -The currentMatrixcontains 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 currentMatrixis 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 currentMatrixwith the given elements. The complexity of this implementation is O(m + n) if: -The currentMatrixcontains 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 currentMatrixis 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 currentMatrixwith the given elements. The complexity of this implementation is O(m + n) if: -The currentMatrixcontains 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 currentMatrixis 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 currentMatrixwith the given elements. The complexity of this implementation is O(m + n) if: -The currentMatrixcontains 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 currentMatrixis 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
Matrixwith 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 time complexity of this implementation is O(1).- Angegeben von:
getColumnCountin 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
Matrixat 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:
getColumnsin SchnittstelleIMatrix<E>- Gibt zurück:
- the columns of the current
Matrix.
-
getCopy
The time complexity of this implementation is O(m * n) if: -This matrix contains m rows. -This matrix contains n columns. -
getCount
public int getCount()The time complexity of this implementation is O(1).- Angegeben von:
getCountin SchnittstelleCountRequestable<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
Matrixat 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.
-
getStoredAtOneBasedIndex
- Angegeben von:
getStoredAtOneBasedIndexin SchnittstelleSingleSearchable<E>- Parameter:
oneBasedIndex-- Gibt zurück:
- the element of the current
Matrixat 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.
-
getStoredAtOneBasedRowIndexAndColumnIndex
The time complexity of this implementation is O(1).- Angegeben von:
getStoredAtOneBasedRowIndexAndColumnIndexin SchnittstelleIMatrix<E>- Parameter:
oneBasedRowIndex-oneBasedColumnIndex-- Gibt zurück:
- the element of the current
Matrixat 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.
-
getRow
- Parameter:
rowIndex-- Gibt zurück:
- the row of the current
Matrixat 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
Matrixat 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 time complexity of this implementation is O(1).- Angegeben von:
getRowCountin SchnittstelleIMatrix<E>- Gibt zurück:
- the number of rows of the current
Matrix.
-
isMaterialized
public boolean isMaterialized()- Angegeben von:
isMaterializedin SchnittstelleMaterializationRequestable- Gibt zurück:
- true if the current
MaterializationRequestableis materialized, false otherwise.
-
iterator
The time complexity of this implementation is O(1). -
setAt
Sets the given element to the currentMatrixat 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.
-
setAtOneBasedRowIndexAndColumnIndex
public void setAtOneBasedRowIndexAndColumnIndex(int oneBasedRowIndex, int oneBasedColumnIndex, E element) Sets the given element to the currentMatrixto the row with the given row index and the column with the given column index. The time complexity of this implementation is O(1).- Angegeben von:
setAtOneBasedRowIndexAndColumnIndexin SchnittstelleIMatrix<E>- Parameter:
oneBasedRowIndex-oneBasedColumnIndex-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 time 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 time complexity of this implementation is O(n) if the currentMatrixcontains n elements. -
toRightRotatedMatrix
The time complexity of this implementation is O(n) if the currentMatrixcontains n elements. -
toString
-