source: src/main/java/weka/classifiers/misc/monotone/BitMatrix.java @ 7

Last change on this file since 7 was 4, checked in by gnappo, 14 years ago

Import di weka.

File size: 3.7 KB
Line 
1/*
2 *    This program is free software; you can redistribute it and/or modify
3 *    it under the terms of the GNU General Public License as published by
4 *    the Free Software Foundation; either version 2 of the License, or
5 *    (at your option) any later version.
6 *
7 *    This program is distributed in the hope that it will be useful,
8 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 *    GNU General Public License for more details.
11 *
12 *    You should have received a copy of the GNU General Public License
13 *    along with this program; if not, write to the Free Software
14 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17/*
18 *    BitMatrix.java
19 *    Copyright (C) 2004 Stijn Lievens
20 *
21 */
22
23package weka.classifiers.misc.monotone;
24
25/**
26 * Interface specifying a simple matrix of booleans.  Operations are
27 * limited to setting, getting, clearing and counting.
28 * <p>
29 * This implementation is part of the master's thesis: "Studie
30 * en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd
31 * rangschikken", Stijn Lievens, Ghent University, 2004.
32 * </p>
33 *
34 * @author Stijn Lievens (stijn.lievens@ugent.be)
35 * @version $Revision: 5922 $
36 */
37public interface BitMatrix {
38
39  /**
40   * Return the element a the specified position.
41   *
42   * @param row the row of the position
43   * @param column the column of the position
44   * @return <code> true </code> if the bit at the
45   * specified position is set, <code> false </code>
46   * otherwise
47   */
48  public boolean get(int row, int column);
49
50  /**
51   * Sets the bit at the specified position to the specified
52   * value.
53   *
54   * @param row the row of the position
55   * @param column the column of the position
56   * @param bool the value to fill in
57   * @return the value of <code> bool </code>
58   */
59  public boolean set(int row, int column, boolean bool);
60
61  /**
62   * Sets the bit at the specified position to <code> true. </code>
63   * The return value indicates whether anything has changed,
64   * i.e.&nbsp; if the bit at the specified position was <code> true
65   * </code> before calling this method, then <code> false </code> is
66   * returned (and the bit remains <code> true </code> of course).
67   * In the other case <code> true </code> is returned.
68   *
69   * @param row the row of the position
70   * @param column the column of the position
71   * @return <code> true </code> if the bit was actually
72   * set, <code> false </code> otherwise
73   */
74  public boolean set(int row, int column);
75
76  /**
77   * Clears the bit at the specified position.  The return value indicates
78   * whether the bit was actually cleared, i.e.&nbsp; if the bit was
79   * originally <code> true </code> then <code> true </code> is returned.
80   * In the other case <code> false </code> is returned.
81   *
82   * @param row the row of the position
83   * @param column the column of the position
84   * @return <code> true </code> if the bit was actually
85   * cleared, <code> false </code> otherwise
86   */
87  public boolean clear(int row, int column);
88
89  /**
90   * Gets the number of rows.
91   *
92   * @return the number of rows of the matrix
93   */
94  public int rows();
95
96  /**
97   * Gets the number of columns.
98   *
99   * @return the number of columns of the matrix
100   */
101  public int columns();
102
103  /**
104   * Counts the number of bits that are set in the specified column.
105   *
106   * @param column index of the column
107   * @return the number of bits that are set in the requested column
108   */
109  public int columnCount(int column);
110
111  /**
112   * Counts the number of bits that are set in the specified row.
113   *
114   * @param row index of the row
115   * @return the number of bits that are set in the requested row
116   */
117  public int rowCount(int row);
118}
Note: See TracBrowser for help on using the repository browser.