Subtrees hinzugefügt

This commit is contained in:
Thomas Schaller 2025-01-02 12:26:47 +01:00
parent 433a6f2eb1
commit a02bf698e6
19 changed files with 2775 additions and 0 deletions

View file

@ -0,0 +1,42 @@
public class Baustein implements Comparable<Baustein>{
// Anfang Attribute
private String zeichen;
private int anzahl;
// Ende Attribute
public Baustein(String zeichen) {
super();
anzahl = 1;
this.zeichen = zeichen;
}
// Anfang Methoden
public int compareTo(Baustein c) {
int anz = c.getAnzahl();
//ascending order
return anz - this.anzahl;
//descending order
//return compareQuantity - this.quantity;
}
public String getZeichen() {
return zeichen;
}
public int getAnzahl() {
return anzahl;
}
public void incAnzahl() {
anzahl++;
}
// Ende Methoden
}