Projekt

Obecné

Profil

Stáhnout (1.76 KB) Statistiky
| Větev: | Revize:
1
package vldc.aswi.model.table.contingencyTable;
2

    
3
import java.util.ArrayList;
4
import java.util.List;
5

    
6
/**
7
 * Class representing one row in Contingency table. Rows are represented as tree with given level.
8
 */
9
public class ContingencyTableRow {
10

    
11
    /** True if current row is header, false if not. */
12
    private boolean isHeader;
13

    
14
    /** Level of current row. */
15
    private int level;
16

    
17
    /** List of cells in current row. */
18
    private List<ContingencyTableRowCell> cells;
19

    
20
    /**
21
     * Constructor.
22
     * @param isHeader - True if current row is header, false if not.
23
     * @param level - Level of current row.
24
     */
25
    public ContingencyTableRow(boolean isHeader, int level) {
26
        this.isHeader = isHeader;
27
        this.level = level;
28

    
29
        cells = new ArrayList<>();
30
    }
31

    
32
    /**
33
     * Add new cell into current row.
34
     * @param cell - New cell.
35
     */
36
    public void addTableRowCell(ContingencyTableRowCell cell) {
37
        cells.add(cell);
38
    }
39

    
40
    /**
41
     * Check if current row is header or not.
42
     * @return True if current row is header, false if not.
43
     */
44
    public boolean isHeader() {
45
        return isHeader;
46
    }
47

    
48
    /**
49
     * Get level of current cell.
50
     * @return
51
     */
52
    public int getLevel() {
53
        return level;
54
    }
55

    
56
    /**
57
     * Get all cells in current row.
58
     * @return List of cells.
59
     */
60
    public List<ContingencyTableRowCell> getCells() {
61
        return cells;
62
    }
63

    
64
    /**
65
     * Overriding toString method for debugging.
66
     * @return String.
67
     */
68
    @Override
69
    public String toString() {
70
        String str = "";
71
        for (ContingencyTableRowCell contingencyTableRowCell : cells) {
72
            str += contingencyTableRowCell.toString();
73
            str += "\t|\t";
74
        }
75

    
76
        return str;
77
    }
78
}
(1-1/2)