|
|
|
|
@ -31,16 +31,19 @@ class Scoreboard {
|
|
|
|
|
this.table = new Table();
|
|
|
|
|
this.table.addColumn("equipe");
|
|
|
|
|
this.table.addColumn("score");
|
|
|
|
|
this.table.addColumn("tour");
|
|
|
|
|
for (int i = 0 ; i < nombreEquipes; i++) {
|
|
|
|
|
TableRow scoreEquipe = this.table.addRow();
|
|
|
|
|
|
|
|
|
|
scoreEquipe.setInt("equipe", i+1);
|
|
|
|
|
scoreEquipe.setInt("score", 0);
|
|
|
|
|
scoreEquipe.setInt("tour", 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// typage forcé pour que .sort() fonctionne sur la colonne score
|
|
|
|
|
this.table.setColumnType("score", "int");
|
|
|
|
|
this.table.setColumnType("tour", "int");
|
|
|
|
|
this.dataIntegrityCheck();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -50,6 +53,7 @@ class Scoreboard {
|
|
|
|
|
|
|
|
|
|
this.table.addColumn("equipe");
|
|
|
|
|
this.table.addColumn("score");
|
|
|
|
|
this.table.addColumn("tour");
|
|
|
|
|
|
|
|
|
|
for (int i = 0 ; i < equipes.length; i++) {
|
|
|
|
|
Equipe e = equipes[i];
|
|
|
|
|
@ -57,6 +61,7 @@ class Scoreboard {
|
|
|
|
|
|
|
|
|
|
scoreEquipe.setInt("equipe", e.id+1);
|
|
|
|
|
scoreEquipe.setInt("score", e.score);
|
|
|
|
|
scoreEquipe.setInt("tour", e.tour);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveTable(this.table, "data/"+this.dataSource, "csv");
|
|
|
|
|
@ -72,14 +77,20 @@ class Scoreboard {
|
|
|
|
|
return this.table.getInt(i, "score");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int getTour(int i) {
|
|
|
|
|
return this.table.getInt(i, "tour");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void applyScores() {
|
|
|
|
|
for (TableRow row : this.table.rows()) {
|
|
|
|
|
equipes[row.getInt("equipe")-1].setScore(row.getInt("score"));
|
|
|
|
|
equipes[row.getInt("equipe")-1].setTour(row.getInt("tour"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void applyScore(int equipe, int score) {
|
|
|
|
|
void applyScore(int equipe, int score, int tour) {
|
|
|
|
|
this.table.findRow(str(equipe+1), "equipe").setInt("score", score);
|
|
|
|
|
this.table.findRow(str(equipe+1), "equipe").setInt("tour", tour);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Iterable <TableRow> findRows(String value, String name) {
|
|
|
|
|
@ -113,7 +124,7 @@ class Scoreboard {
|
|
|
|
|
// suppression des dernières lignes jusqu'à revenir à l'équilibre
|
|
|
|
|
for (int i = rowCount; i>rowCount-diff; i--) {
|
|
|
|
|
this.table.removeRow(i-1);
|
|
|
|
|
//println("Socreboard.removeRow", i-1);
|
|
|
|
|
//println("Scoreboard.removeRow", i-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|