Implementierung des Binärbaums - Teil 2: Einfügen
This commit is contained in:
@@ -7,16 +7,28 @@
|
||||
*/
|
||||
public class Wortpaar implements Datenelement
|
||||
{
|
||||
// Attribute
|
||||
String wortDeutsch;
|
||||
String wortEnglisch;
|
||||
|
||||
/**
|
||||
* Konstruktor für Objekte der Klasse Wortpaar
|
||||
*/
|
||||
public Wortpaar()
|
||||
{
|
||||
public Wortpaar(String wortDeutsch, String wortEnglisch) {
|
||||
this.wortDeutsch = wortDeutsch;
|
||||
this.wortEnglisch = wortEnglisch;
|
||||
}
|
||||
|
||||
public String gibSchlüssel() {
|
||||
return this.wortDeutsch;
|
||||
}
|
||||
|
||||
// weitere Methoden
|
||||
public boolean istGleich(Datenelement anderesWortpaar) {
|
||||
return this.gibSchlüssel().equals(anderesWortpaar.gibSchlüssel());
|
||||
}
|
||||
|
||||
public boolean istGrößerAls(Datenelement anderesWortpaar) {
|
||||
return this.gibSchlüssel().compareTo(anderesWortpaar.gibSchlüssel()) > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user