org.decisiondeck.xmcda_oo.utils.matrix
Class ConstantCompleteMatrix<Row,Column>

java.lang.Object
  extended by org.decisiondeck.xmcda_oo.utils.matrix.ConstantCompleteMatrix<Row,Column>
All Implemented Interfaces:
IRdFloatMatrix<Row,Column>, IRdZeroToOneMatrix<Row,Column>

public class ConstantCompleteMatrix<Row,Column>
extends Object
implements IRdZeroToOneMatrix<Row,Column>


Constructor Summary
ConstantCompleteMatrix(Set<Row> rows, Set<Column> columns, double constant)
           
 
Method Summary
 boolean approxEquals(IRdFloatMatrix<Row,Column> m2, double imprecision)
          Two matrix are "approximately equal" to a given degree of precision iff they contain values for the same mappings and the value they contain for each mapping are not more different than the given allowed imprecision.
 Set<Column> getColumns()
          Returns a read-only view of the columns existing in this matrix.
 Double getEntry(Row row, Column column)
          Returns the value at the position specified by the given row and column, of null if there is none.
 Set<Row> getRows()
          Returns a view of the rows existing in this matrix.
 int getValueCount()
           Gets the number of values in this matrix.
 boolean isComplete()
           A matrix is complete iff it contains a value for every possible position (row, column) where row and column are rows and columns existing in this matrix (i.e. corresponding to at least one value).
 boolean isEmpty()
          Checks whether this matrix contains no value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.decisiondeck.xmcda_oo.utils.matrix.IRdFloatMatrix
equals
 

Constructor Detail

ConstantCompleteMatrix

public ConstantCompleteMatrix(Set<Row> rows,
                              Set<Column> columns,
                              double constant)
Method Detail

getEntry

public Double getEntry(Row row,
                       Column column)
Description copied from interface: IRdZeroToOneMatrix
Returns the value at the position specified by the given row and column, of null if there is none.

Specified by:
getEntry in interface IRdFloatMatrix<Row,Column>
Specified by:
getEntry in interface IRdZeroToOneMatrix<Row,Column>
Parameters:
row - not null.
column - not null.
Returns:
the double value at that position (between zero and one inclusive), or null.

approxEquals

public boolean approxEquals(IRdFloatMatrix<Row,Column> m2,
                            double imprecision)
Description copied from interface: IRdFloatMatrix
Two matrix are "approximately equal" to a given degree of precision iff they contain values for the same mappings and the value they contain for each mapping are not more different than the given allowed imprecision.

Specified by:
approxEquals in interface IRdFloatMatrix<Row,Column>
Parameters:
m2 - the matrix to which to compare this object for approximate equality. If null, this method returns false.
imprecision - the maximal imprecision allowed.
Returns:
true iff the given matrix is approximately equal to this one.

getColumns

public Set<Column> getColumns()
Description copied from interface: IRdFloatMatrix
Returns a read-only view of the columns existing in this matrix. The returned set "read through" to the matrix, thus modifications of this matrix are reflected in the returned set.

Specified by:
getColumns in interface IRdFloatMatrix<Row,Column>
Returns:
the objects such that at least one value exists in this matrix at a position having the object as column. Not null. Empty iff this matrix is empty.

getRows

public Set<Row> getRows()
Description copied from interface: IRdFloatMatrix
Returns a view of the rows existing in this matrix. The returned set "read through" to the matrix, thus modifications of this matrix are reflected in the returned set. The view may be read-only (some objects may also support objects removal from the returned set).

Specified by:
getRows in interface IRdFloatMatrix<Row,Column>
Returns:
the objects such that at least one value exists in this matrix at a position having the object as row. Not null. Empty iff this matrix is empty.

getValueCount

public int getValueCount()
Description copied from interface: IRdFloatMatrix

Gets the number of values in this matrix.

Note that the word "size" is not used here because the size of the matrix could be understood as meaning its row count times its column count, which is the same as its value count only if it is complete.

Specified by:
getValueCount in interface IRdFloatMatrix<Row,Column>
Returns:
the count of values.

isComplete

public boolean isComplete()
Description copied from interface: IRdFloatMatrix

A matrix is complete iff it contains a value for every possible position (row, column) where row and column are rows and columns existing in this matrix (i.e. corresponding to at least one value). An empty matrix is complete.

Specified by:
isComplete in interface IRdFloatMatrix<Row,Column>
Returns:
true iff this matrix is complete.

isEmpty

public boolean isEmpty()
Description copied from interface: IRdFloatMatrix
Checks whether this matrix contains no value.

Specified by:
isEmpty in interface IRdFloatMatrix<Row,Column>
Returns:
true iff the matrix contains no value.


Copyright © 2011. All Rights Reserved.