BooleanBitMatrix

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.misc.monotone
Class BooleanBitMatrix

    java.lang.Object
      weka.classifiers.misc.monotone.BooleanBitMatrix

All Implemented Interfaces:
  BitMatrix, RevisionHandler

    public class BooleanBitMatrix

extends java.lang.Object
implements BitMatrix, RevisionHandler

This class is a very simple implementation of a BitMatrix. In fact, it uses a two-dimensional array of booleans, so it is not very space efficient.

This implementation is part of the master's thesis: "Studie en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd rangschikken", Stijn Lievens, Ghent University, 2004.

Version:
  $Revision: 1.2 $
Author:
  Stijn Lievens (stijn.lievens@ugent.be)

Constructor Summary
`BooleanBitMatrix(BooleanBitMatrix bm)` A copy constructor.
`BooleanBitMatrix(int rows, int columns)` Construct a `BitMatrix` with the indicated number of rows and columns.

Method Summary
`boolean` | `clear(int row, int column)` Clears the bit at the specified position.
`int` | `columnCount(int column)` Counts the number of bits that are set in the specified column.
`int` | `columns()` Gets the number of columns.
`boolean` | `get(int row, int column)` Returns the element a the specified position.
`java.lang.String` | `getRevision()` Returns the revision string.
`int` | `rowCount(int row)` Counts the number of bits that are set in the specified row.
`int` | `rows()` Gets the number of rows.
`boolean` | `set(int row, int column)` Sets the bit at the specified position to `true.`
`boolean` | `set(int row, int column, boolean bool)` Sets the bit at the specified position to the specified value.
`java.lang.String` | `toString()` Create a compact string representation of the matrix.
`BooleanBitMatrix` | `transpose()` Swap the rows and the columns of the `BooleanBitMatrix.`
`void` | `transposeInPlace()` Swaps the rows and the columns of the `BooleanBitMatrix,` without creating a new object.

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

Constructor Detail

### BooleanBitMatrix

    public BooleanBitMatrix(int rows,
                            int columns)

  Construct a `BitMatrix` with the indicated number of rows and columns. All bits are initially set to `false` .

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

### BooleanBitMatrix

    public BooleanBitMatrix(BooleanBitMatrix bm)

  A copy constructor. Constructs a copy of the given `BitMatrix` .

  Parameters:
    `bm` - the `BitMatrix` to be copied.

Method Detail

### get

    public boolean get(int row,
                       int column)

  Returns the element a the specified position.

  Specified by:
    `get` in interface `BitMatrix`
  Parameters:
    `row` - the row of the position
    `column` - the column of the position
  Returns:
    `true` if the bit at the specified position is set, `false` otherwise

### set

    public boolean set(int row,
                       int column,
                       boolean bool)

  Sets the bit at the specified position to the specified value.

  Specified by:
    `set` in interface `BitMatrix`
  Parameters:
    `row` - the row of the position
    `column` - the column of the position
    `bool` - the value to fill in
  Returns:
    the value of `bool`

### set

    public boolean set(int row,
                       int column)

  Sets the bit at the specified position to `true.`

  Specified by:
    `set` in interface `BitMatrix`
  Parameters:
    `row` - the row of the position
    `column` - the column of the position
  Returns:
    `true` if the bit was actually set, `false` otherwise

### clear

    public boolean clear(int row,
                         int column)

  Clears the bit at the specified position.

  Specified by:
    `clear` in interface `BitMatrix`
  Parameters:
    `row` - the row of the position
    `column` - the column of the position
  Returns:
    `true` if the bit was actually cleared, `false` otherwise

### rows

    public int rows()

  Gets the number of rows.

  Specified by:
    `rows` in interface `BitMatrix`
  Returns:
    the number of rows of the matrix

### columns

    public int columns()

  Gets the number of columns.

  Specified by:
    `columns` in interface `BitMatrix`
  Returns:
    the number of columns of the matrix

### columnCount

    public int columnCount(int column)

  Counts the number of bits that are set in the specified column.

  Specified by:
    `columnCount` in interface `BitMatrix`
  Parameters:
    `column` - index of the column of which the bits are to be counted
  Returns:
    the number of bits that are set in the requested column

### rowCount

    public int rowCount(int row)

  Counts the number of bits that are set in the specified row.

  Specified by:
    `rowCount` in interface `BitMatrix`
  Parameters:
    `row` - index of the row of which the bits are to be counted
  Returns:
    the number of bits that are set in the requested row

### transpose

    public BooleanBitMatrix transpose()

  Swap the rows and the columns of the `BooleanBitMatrix.`

  Returns:
    the transposed matrix

### transposeInPlace

    public void transposeInPlace()
                          throws java.lang.IllegalArgumentException

  Swaps the rows and the columns of the `BooleanBitMatrix,` without creating a new object. The `BooleanBitMatrix` must be a square matrix.

  Throws:
    `java.lang.IllegalArgumentException` - if the `BooleanBitMatrix` is not square.

### toString

    public java.lang.String toString()

  Create a compact string representation of the matrix.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a `String` representing the matrix, row by row.

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Returns:
    the revision

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD