2023-10-05 23:49:36 +02:00
|
|
|
/*
|
|
|
|
============================================================
|
|
|
|
This is the "Blockeintrag" 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-07 09:54:07 +01:00
|
|
|
import Domain.Spieler;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
2023-11-07 11:55:51 +01:00
|
|
|
class Blockeintrag {
|
2023-11-05 20:40:16 +01:00
|
|
|
private int punkte;
|
|
|
|
private int stiche;
|
2023-11-07 10:31:04 +01:00
|
|
|
private Spieler id;
|
2023-10-10 21:13:21 +02:00
|
|
|
public Blockeintrag() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-11-07 10:31:04 +01:00
|
|
|
public Blockeintrag(int punkte, int stiche, Spieler id) {
|
2023-11-05 20:40:16 +01:00
|
|
|
if(stiche < 0){
|
|
|
|
throw new IllegalArgumentException("Ihre Stiche dürfen nicht im Negativen bereich sein");
|
|
|
|
}
|
2023-10-10 21:13:21 +02:00
|
|
|
this.stiche = stiche;
|
2023-11-05 20:40:16 +01:00
|
|
|
this.punkte = punkte;
|
2023-11-07 10:31:04 +01:00
|
|
|
this.id = id;
|
2023-10-10 21:13:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getPunkte() {
|
|
|
|
return this.punkte;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getStiche() {
|
|
|
|
return this.stiche;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setStiche(int stiche) {
|
2023-11-05 20:40:16 +01:00
|
|
|
if (stiche < 0){
|
|
|
|
throw new IllegalArgumentException("Ihre Stich dürfen nicht im Negative bereich sein");
|
|
|
|
}
|
2023-10-10 21:13:21 +02:00
|
|
|
this.stiche = stiche;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPunkte(int punkte) {
|
|
|
|
this.punkte = punkte;
|
|
|
|
}
|
2023-11-07 09:54:07 +01:00
|
|
|
|
2023-11-07 10:31:04 +01:00
|
|
|
public Spieler getId() {
|
|
|
|
return id;
|
2023-11-07 09:54:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object ob){
|
|
|
|
if (this == ob) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (ob == null || getClass() != ob.getClass()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Blockeintrag andererEintrag = (Blockeintrag) ob;
|
|
|
|
return this.punkte == andererEintrag.punkte && this.stiche == andererEintrag.stiche
|
2023-11-07 10:31:04 +01:00
|
|
|
&& Objects.equals(this.id, andererEintrag.id);
|
2023-11-07 09:54:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
2023-11-07 10:31:04 +01:00
|
|
|
return Objects.hash(punkte, stiche, id);
|
2023-11-07 09:54:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return getPunkte() + ", S: " + getStiche() + " | ";
|
|
|
|
}
|
2023-10-05 23:49:36 +02:00
|
|
|
}
|