-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModelloBSTTab.java
More file actions
49 lines (43 loc) · 1.11 KB
/
Copy pathModelloBSTTab.java
File metadata and controls
49 lines (43 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import javax.swing.table.AbstractTableModel;
import java.util.ArrayList;
class ModelloBSTTab extends AbstractTableModel {
private final ArrayList<Riga> righe;
ModelloBSTTab(ArrayList<Riga> righe) {
this.righe = righe;
}
@Override
public int getRowCount() {
return righe.size();
}
@Override
public int getColumnCount() {
return 4;
}
@Override
public String getColumnName(int column) {
switch (column) {
case 0:
return "Pos.";
case 1:
return "Contenuto";
case 2:
return "Figlio Sx";
default:
return "Figlio Dx";
}
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Riga riga = righe.get(rowIndex);
switch (columnIndex) {
case 0:
return riga.getPosizione();
case 1:
return riga.getValore();
case 2:
return riga.getPosSx();
default:
return riga.getPosDx();
}
}
}