www.sdmetrics.com

com.sdmetrics.metrics
Class MatrixData

java.lang.Object
  extended by com.sdmetrics.metrics.MatrixData

public class MatrixData
extends java.lang.Object

Data structure to store the data for one matrix. The rows of each matrix are the source model elements from which the relation of the matrix originates, the columns are the target model elements. The cell values show the presence or number of relations between the two model elements of the respective row and column.


Method Summary
 ModelElement getColumnElement(int col)
          Gets the target model element in a column of this relation matrix.
 Matrix getMatrixDefinition()
          Gets the definition of the matrix.
 int getNumberOfColumns()
          Gets the number of columns (target model elements) of this relation matrix.
 int getNumberOfRows()
          Gets the number of rows (source model elements) of this relation matrix.
 ModelElement getRowElement(int row)
          Gets the source element in a row of this relation matrix.
 java.lang.Integer getValueAt(int row, int col)
          Gets the value of a cell of this relation matrix.
 boolean isEmpty()
          Tests if this relation matrix is empty (a null matrix).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMatrixDefinition

public Matrix getMatrixDefinition()
Gets the definition of the matrix.

Returns:
Definition of the matrix in the metric definition file.

getNumberOfRows

public int getNumberOfRows()
Gets the number of rows (source model elements) of this relation matrix.

Returns:
The number R of rows of the matrix. Valid row indices run from 0 to R-1.

getNumberOfColumns

public int getNumberOfColumns()
Gets the number of columns (target model elements) of this relation matrix.

Returns:
The number C of columns of the matrix. Valid column indices run from 0 to C-1.

isEmpty

public boolean isEmpty()
Tests if this relation matrix is empty (a null matrix).

Returns:
true if all cells of the matrix are zero, false if there is at least one non-zero entry.

getValueAt

public java.lang.Integer getValueAt(int row,
                                    int col)
Gets the value of a cell of this relation matrix.

Parameters:
row - Row index of the cell to access.
col - Column index of the cell to access.
Returns:
Value of the specified cell.

getRowElement

public ModelElement getRowElement(int row)
Gets the source element in a row of this relation matrix.

Parameters:
row - Row index.
Returns:
The model element at the specified row.

getColumnElement

public ModelElement getColumnElement(int col)
Gets the target model element in a column of this relation matrix.

Parameters:
col - Column index.
Returns:
The model element at the specified column.

www.sdmetrics.com