|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.misc.monotone.BooleanBitMatrix
public class BooleanBitMatrix
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.
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 |
---|
public BooleanBitMatrix(int rows, int columns)
BitMatrix
with the indicated
number of rows and columns. All bits are initially
set to false
.
rows
- the number of rowscolumns
- the number of columnpublic BooleanBitMatrix(BooleanBitMatrix bm)
BitMatrix
.
bm
- the BitMatrix
to be copied.Method Detail |
---|
public boolean get(int row, int column)
get
in interface BitMatrix
row
- the row of the positioncolumn
- the column of the position
true
if the bit at the
specified position is set, false
otherwisepublic boolean set(int row, int column, boolean bool)
set
in interface BitMatrix
row
- the row of the positioncolumn
- the column of the positionbool
- the value to fill in
bool
public boolean set(int row, int column)
true.
set
in interface BitMatrix
row
- the row of the positioncolumn
- the column of the position
true
if the bit was actually
set, false
otherwisepublic boolean clear(int row, int column)
clear
in interface BitMatrix
row
- the row of the positioncolumn
- the column of the position
true
if the bit was actually
cleared, false
otherwisepublic int rows()
rows
in interface BitMatrix
public int columns()
columns
in interface BitMatrix
public int columnCount(int column)
columnCount
in interface BitMatrix
column
- index of the column of which the bits are to be counted
public int rowCount(int row)
rowCount
in interface BitMatrix
row
- index of the row of which the bits are to be counted
public BooleanBitMatrix transpose()
BooleanBitMatrix.
public void transposeInPlace() throws java.lang.IllegalArgumentException
BooleanBitMatrix,
without creating a new object.
The BooleanBitMatrix
must be a square matrix.
java.lang.IllegalArgumentException
- if the BooleanBitMatrix
is not square.public java.lang.String toString()
toString
in class java.lang.Object
String
representing the matrix,
row by row.public java.lang.String getRevision()
getRevision
in interface RevisionHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |