Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.collections
Class DenseMatrix<E>

    java.lang.Object
      java.util.AbstractCollection<E>
          umontreal.iro.lecuyer.collections.AbstractMatrix<E>
              umontreal.iro.lecuyer.collections.DenseMatrix<E>

Type Parameters:
  `E` - the element type.

All Implemented Interfaces:
  Serializable, Cloneable, Iterable<E>, Collection<E>, RandomAccess, Matrix<E>

    public class DenseMatrix<E>

extends AbstractMatrix<E>
implements Cloneable, Serializable, RandomAccess

Represents a matrix storing elements in an array.

See Also:
  Serialized Form

Field Summary

Fields inherited from class umontreal.iro.lecuyer.collections.AbstractMatrix
`modCount`

Constructor Summary
`DenseMatrix(E[][] elements)` Constructs a new matrix from the 2D array `elements`.
`DenseMatrix(int rows, int columns)` Constructs a new dense matrix with `rows` rows, `columns` columns, and filled with `null` elements.
`DenseMatrix(Matrix<? extends E> matrix)` Constructs a new matrix from the matrix `matrix`.

Method Summary
`protected DenseMatrix<E>` | `clone()`
`int` | `columns()` Returns the number of columns in this matrix.
`E` | `get(int r, int c)` Returns the element at index (`r`, `c`) of the matrix.
`int` | `rows()` Returns the number of rows in this matrix.
`E` | `set(int r, int c, E value)` Sets the element at index (`r`, `c`) of the matrix to `value`, and returns the element previously at that position.
`void` | `setColumns(int numColumns)` Sets the number of columns of this matrix to `numColumns`.
`void` | `setRows(int numRows)` Sets the number of rows of this matrix to `numRows`.

Methods inherited from class umontreal.iro.lecuyer.collections.AbstractMatrix
`asList, equals, hashCode, isEmpty, iterator, size, to2DArray, to2DArray, toString, viewColumn, viewPart, viewRow`

Methods inherited from class java.util.AbstractCollection
`add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Collection
`add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray`

Constructor Detail

### DenseMatrix

    public DenseMatrix(int rows,
                       int columns)

  Constructs a new dense matrix with `rows` rows, `columns` columns, and filled with `null` elements.

  Parameters:
    `rows` - the number of rows.
    `columns` - the number of columns.

### DenseMatrix

    public DenseMatrix(E[][] elements)

  Constructs a new matrix from the 2D array `elements`.

  Parameters:
    `elements` - the elements of the matrix.

### DenseMatrix

    public DenseMatrix(Matrix<? extends E> matrix)

  Constructs a new matrix from the matrix `matrix`.

  Parameters:
    `matrix` - the source matrix.

Method Detail

### columns

    public int columns()

  Description copied from interface: `Matrix`
  Returns the number of columns in this matrix.

  Specified by:
    `columns` in interface `Matrix<E>`
  Returns:
    the number of columns in this matrix.

### rows

    public int rows()

  Description copied from interface: `Matrix`
  Returns the number of rows in this matrix.

  Specified by:
    `rows` in interface `Matrix<E>`
  Returns:
    the number of rows in this matrix.

### get

    public E get(int r,
                 int c)

  Description copied from interface: `Matrix`
  Returns the element at index (`r`, `c`) of the matrix.

  Specified by:
    `get` in interface `Matrix<E>`
  Parameters:
    `r` - the row index.
    `c` - the column index.
  Returns:
    the value of the element.

### setColumns

    public void setColumns(int numColumns)

  Description copied from interface: `Matrix`
  Sets the number of columns of this matrix to `numColumns`. If `numColumns` is smaller than `Matrix.columns()`, the last columns of the matrix are removed. If `numColumns` is greater than `Matrix.columns()`, new columns filled with `null` references are added to the matrix. This method is optional, and throws an `UnsupportedOperationException` if not implemented.

  Specified by:
    `setColumns` in interface `Matrix<E>`
  Parameters:
    `numColumns` - the new number of columns in the matrix.

### setRows

    public void setRows(int numRows)

  Description copied from interface: `Matrix`
  Sets the number of rows of this matrix to `numRows`. If `numRows` is smaller than `Matrix.rows()`, the last rows of the matrix are removed. If `numRows` is greater than `Matrix.rows()`, new rows filled with `null` references are added to the matrix. This method is optional, and throws an `UnsupportedOperationException` if not implemented.

  Specified by:
    `setRows` in interface `Matrix<E>`
  Parameters:
    `numRows` - the new number of rows in the matrix.

### set

    public E set(int r,
                 int c,
                 E value)

  Description copied from interface: `Matrix`
  Sets the element at index (`r`, `c`) of the matrix to `value`, and returns the element previously at that position. This method is optional, and throws an `UnsupportedOperationException` if not implemented.

  Specified by:
    `set` in interface `Matrix<E>`
  Overrides:
    `set` in class `AbstractMatrix<E>`
  Parameters:
    `r` - the row index.
    `c` - the column index.
    `value` - the value of the element.
  Returns:
    the previous value of the element.

### clone

    protected DenseMatrix<E> clone()

  Overrides:
    `clone` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.