Commit d8f16659 authored by saad.aswad's avatar saad.aswad

Merge branch 'master' into task2

# Conflicts:
#	src/main/java/SortList.java
parents 0d6fe042 8baca9c7
......@@ -3,15 +3,10 @@ public abstract class SortList {
public Entry head;
public long length;
public long conatinSuccess = 0;
public long conatinFailure = 0;
public long removeSuccess = 0;
public long removeFailure = 0;
public SortList() {
this.head = new Entry(Integer.MIN_VALUE);
this.head.next =new Entry(Integer.MAX_VALUE);
this.length = 0;
this.length = 2;
}
public abstract boolean add(Integer obj);
......@@ -27,6 +22,16 @@ public abstract class SortList {
}
}
public boolean checkSorted() {
Entry current = this.head.next;
while (current.next != null) {
if (current.object.compareTo(current.next.object) > 0) {
return false;
}
current = current.next;
}
return true;
}
}
......@@ -61,6 +61,9 @@ public class SyncListTest extends TestCase {
long listLengthAfterAdds = list.length;
System.out.println("Length of the list after adding: "+listLengthAfterAdds);
String listIsSorted = list.checkSorted() ? "The List is sorted" : "The list is not sorted";
System.out.println(listIsSorted);
long startC = System.currentTimeMillis();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment