Class AbstractMatrix<R,C,V>
java.lang.Object
ubic.gemma.core.util.matrix.AbstractMatrix<R,C,V>
- All Implemented Interfaces:
Serializable, Matrix2D<R,C, V>
- Direct Known Subclasses:
DoubleMatrix, IntegerMatrix, ObjectMatrixImpl, StringMatrix
- Author:
- pavlidis
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddColumnName(C s) Add a column name when we don't care what the index will be.final voidaddRowName(R s) Add a row name when we don't care what the index will be.double[][]Attempt to coerce the entries into doubles.voidSet all values in the matrix to the given value.protected voidcheckColRange(int startCol, int endCol) protected voidcheckRowRange(int startRow, int endRow) final booleancontainsColumnName(C columnName) final booleancontainsRowName(R rowName) final intgetColIndexByName(C columnKey) Get the index of a column by name.final CgetColName(int i) Gte the column name for an index.final intGet the index of a row by name..final RgetRowName(int i) Get the row name for an indexfinal booleanCheck if this matrix has a valid set of column names.booleanTest for the presence of missing values (null, or in the case of numbers, NaN)final booleanfinal booleanfinal intReturn the number of missing values in the matrix.final voidsetColumnName(C s, int i) Add a column name associated with an index.voidsetColumnNames(List<C> v) final voidsetRowName(R s, int i) Add a row name associated with a row index.final voidsetRowNames(List<R> v) abstract intsize()
-
Field Details
-
MAX_ROWS_TO_PRINT
protected static final int MAX_ROWS_TO_PRINT- See Also:
-
-
Constructor Details
-
AbstractMatrix
public AbstractMatrix()
-
-
Method Details
-
addColumnName
Add a column name when we don't care what the index will be. The index will be set by the method. This is useful for when we need to set up a matrix before we know how many column or rows there are.- Specified by:
addColumnNamein interfaceMatrix2D<R,C, V> - Parameters:
s-
-
addRowName
Add a row name when we don't care what the index will be. The index will be set by the method. This is useful for when we need to set up a matrix before we know how many column or rows there are.- Parameters:
s-
-
asDoubles
public double[][] asDoubles()Description copied from interface:Matrix2DAttempt to coerce the entries into doubles.Numeric entries (Double, BigDecimal, Integer, BigInteger) and Strings that can be parsed as doubles are converted. Booleans are converted to 1 or 0. Dates are converted via Date.getDate(). Null entries are rendered as Double.NaN. For entries that are other types of objects, the HashCode is used.
-
assign
-
containsColumnName
-
containsRowName
-
getColIndexByName
-
getColName
-
getColNames
-
getRowIndexByName
-
getRowName
-
getRowNameMapIterator
-
getRowNames
-
hasColNames
-
hasMissingValues
public boolean hasMissingValues()Test for the presence of missing values (null, or in the case of numbers, NaN)- Returns:
-
hasRow
-
hasRowNames
public final boolean hasRowNames()- Specified by:
hasRowNamesin interfaceMatrix2D<R,C, V> - Returns:
- boolean
-
numMissing
-
setColumnName
-
setColumnNames
-
setRowName
-
setRowNames
-
size
public abstract int size() -
checkColRange
protected void checkColRange(int startCol, int endCol) -
checkRowRange
protected void checkRowRange(int startRow, int endRow)
-