2023-10-05 23:49:36 +02:00
|
|
|
/*
|
|
|
|
============================================================
|
|
|
|
This is the "Blockzeile" file from Author: Philipp Kotte
|
|
|
|
written on: 05 / 10 / 2023 at: 23:44
|
|
|
|
============================================================
|
|
|
|
*/
|
2023-10-10 21:22:33 +02:00
|
|
|
package Domain.Block;
|
2023-10-05 23:49:36 +02:00
|
|
|
|
2023-11-05 20:40:16 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2023-11-07 11:55:51 +01:00
|
|
|
class Blockzeile {
|
2023-10-11 17:15:09 +02:00
|
|
|
|
|
|
|
/*------------------------------------------*/
|
|
|
|
// statische Konstanten
|
|
|
|
/*------------------------------------------*/
|
|
|
|
|
|
|
|
/*------------------------------------------*/
|
|
|
|
// statische Attribute(zB. zähler)
|
|
|
|
/*------------------------------------------*/
|
|
|
|
|
|
|
|
/*------------------------------------------*/
|
|
|
|
// Attribute jedes Objektes
|
|
|
|
/*------------------------------------------*/
|
|
|
|
|
2023-10-10 21:13:21 +02:00
|
|
|
private int rundenNummer;
|
2023-11-05 20:40:16 +01:00
|
|
|
private ArrayList<Blockeintrag> eintraege;
|
2023-10-05 23:49:36 +02:00
|
|
|
|
2023-10-11 17:15:09 +02:00
|
|
|
/*------------------------------------------*/
|
|
|
|
// Konstruktoren (default und spezifische)
|
|
|
|
/*------------------------------------------*/
|
|
|
|
|
2023-11-05 20:40:16 +01:00
|
|
|
public Blockzeile(){
|
|
|
|
|
2023-10-05 23:49:36 +02:00
|
|
|
}
|
|
|
|
|
2023-11-07 09:54:07 +01:00
|
|
|
public Blockzeile(int rundenNummer, Blockeintrag eintrag) {
|
2023-11-05 20:40:16 +01:00
|
|
|
this.rundenNummer = rundenNummer;
|
|
|
|
this.eintraege = new ArrayList<>();
|
2023-11-07 09:54:07 +01:00
|
|
|
addEintrag(eintrag);
|
2023-11-05 20:40:16 +01:00
|
|
|
}
|
2023-10-11 17:15:09 +02:00
|
|
|
/*------------------------------------------*/
|
|
|
|
// statische Methoden
|
|
|
|
/*------------------------------------------*/
|
|
|
|
|
|
|
|
/*------------------------------------------*/
|
|
|
|
// Getter und Setter
|
|
|
|
/*------------------------------------------*/
|
2023-11-05 20:40:16 +01:00
|
|
|
public int getRundenNummer() {
|
|
|
|
return rundenNummer;
|
|
|
|
}
|
2023-10-11 17:15:09 +02:00
|
|
|
|
2023-11-05 20:40:16 +01:00
|
|
|
public void setRundenNummer(int rundenNummer) {
|
|
|
|
this.rundenNummer = rundenNummer;
|
|
|
|
}
|
2023-10-11 17:15:09 +02:00
|
|
|
/*------------------------------------------*/
|
|
|
|
// @Overrides
|
|
|
|
/*------------------------------------------*/
|
|
|
|
|
|
|
|
/*------------------------------------------*/
|
|
|
|
// öffentliche Methodes
|
|
|
|
/*------------------------------------------*/
|
|
|
|
|
2023-11-07 09:54:07 +01:00
|
|
|
public void addEintrag(Blockeintrag eintrag) {
|
2023-11-05 20:40:16 +01:00
|
|
|
if(eintraege != null){
|
2023-11-07 09:54:07 +01:00
|
|
|
eintraege.add(eintrag);
|
2023-10-10 21:13:21 +02:00
|
|
|
}
|
2023-10-11 16:56:05 +02:00
|
|
|
}
|
2023-10-05 23:49:36 +02:00
|
|
|
|
|
|
|
public Blockeintrag[] getDaten() {
|
2023-11-05 20:40:16 +01:00
|
|
|
return eintraege.toArray(new Blockeintrag[0]);
|
2023-10-05 23:49:36 +02:00
|
|
|
}
|
2023-10-11 17:15:09 +02:00
|
|
|
/*------------------------------------------*/
|
|
|
|
// Hilfsmethoden (privat)
|
|
|
|
/*------------------------------------------*/
|
|
|
|
|
2023-11-05 20:40:16 +01:00
|
|
|
public Blockeintrag[] getValidDaten() {
|
|
|
|
Blockeintrag[] dataArray = getDaten();
|
|
|
|
|
|
|
|
for (Blockeintrag eintrag : dataArray) {
|
|
|
|
if (eintrag == null) {
|
|
|
|
throw new IllegalStateException("Das Array ist leer");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dataArray;
|
|
|
|
}
|
2023-10-05 23:49:36 +02:00
|
|
|
}
|