summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Auto3.java
blob: 6a69a07d7fc5cfb0d92330b585574a4f5b739054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Auto3.java */

public class Auto3
implements Groesse, Comparable
{
  public String name;
  public int    erstzulassung;
  public int    leistung;
  public int    laenge;
  public int    hoehe;
  public int    breite;

  public int laenge()
  {
    return this.laenge;
  }

  public int hoehe()
  {
    return this.hoehe;
  }

  public int breite()
  {
    return this.breite;
  }

  public int compareTo(Object o)
  {
    int ret = 0;
    if (leistung < ((Auto3)o).leistung) {
      ret = -1;
    } else if (leistung > ((Auto3)o).leistung) {
      ret = 1;
    }
    return ret;
  }
}