Hallo,
ich habe folgendes Problem:
	
	
	
	
	
		
	
Hier die Spezifikation:
	
	
	
	
	
		
	
Dazu habe ich bisher folgenden Quellcode:
	
	
	
	
	
		
	
Erstmal meine Frage, wie gehe ich das jetzt bei "cons" an, mit imports soll es ja nicht umgesetzt werden.
			
			ich habe folgendes Problem:
		Java:
	
	Implementieren Sie einen Listen-ADT anhand der Spezifikation "SortedList.asl".
Die Elemente in der Liste sollen stets aufsteigend sortiert sein.
Beachten Sie folgende Punkte:
- Das Nat in der Spezifikation muss als int in Java übersetzt werden.
- Alle Variablen und Methoden müssen public sein.
- In Node müssen die Variablen value und next heißen.
- In SortedList muss die Variable first heißen.
- Die Methodennamen müssen identisch mit den functions aus der Spezifikation sein.
- Das Verhalten innerhalb der Methoden muss dem Verhalten der equations aus der Spezifikation entsprechen.
- Sie dürfen keine imports oder sonstige vorgefertigte Typen wie z.B. Arrays verwenden. 
Bitte benutzen Sie folgendes Schema für die Dateinamen Ihrer Lösung: SortedList.java, Node.java.
	
		Java:
	
	specification SortedList
imports
  bool
  nat
sorts
  SortedList
constructors
  nil : -> SortedList  // Empty list
hidden constructors
  cons' : Nat x SortedList -> SortedList // Head element and tail list
functions
  cons : Nat x SortedList -> SortedList //add element to SortedList
  head : SortedList -> Nat? // Head element
  tail : SortedList -> SortedList? // SortedList without head
  isNil : SortedList -> Bool // Test for nil SortedList
  length : SortedList -> Nat // Number of elements in the SortedList
  append : SortedList x SortedList -> SortedList // Append two SortedLists
  last : SortedList -> Nat? // Last element
  init : SortedList -> SortedList? // SortedList without last
variables
  n : Nat
  n1 : Nat
  l : SortedList
  l1 : SortedList
equations
  cons(n, nil) = cons'(n, nil)
  cons(n, cons'(n1, l)) = if(greater(n,n1)) then cons'(n1, cons(n, l)) else cons'(n, cons'(n1, l))
  head(cons'(n, l)) = n
  tail(cons'(n, l)) = l
  isNil(nil) = true
  isNil(cons'(n, l)) = false
  length(nil) = zero
  length(cons'(n, l)) = succ(length(l))
  append(l,nil) = l
  append(l, cons'(n, l1)) = append(cons(n,l),l1)
  last(cons'(n,l)) = if isNil(l) then n else last(l)
  init(cons'(n,l)) = if isNil(l) then nil else cons'(n, init(l))
	
		Java:
	
	public class SortedList {
	private Node first;
	private int n;
	private int n1;
	private SortedList l;
	private SortedList l1;
	public void cons() {
		if (l == null) {
		}
	}
	public int head() {
		return first.value;
	}
	public void tail() {
		first = first.next;
	}
	public boolean isNil() {
		if (first == null) {
			return true;
		}
		return false;
	}
	public int length() {
		
	}
	public void append() {
	}
	public int last() {
		if (l == null) {
		}
	}
	public void init() {
	}
}