|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.colorado.cs.ns2.util.SortTimeLine
public class SortTimeLine
This class implements the Quicksort algorithm for sorting the discrete event timeline.
Constructor Summary | |
---|---|
SortTimeLine()
|
Method Summary | |
---|---|
private static int |
partition(java.util.Vector<TimeLine> timeLine,
int l,
int r)
The quicksort partition method. |
static void |
quicksort(java.util.Vector<TimeLine> timeLine)
Quick sort helper method. |
private static void |
quicksort(java.util.Vector<TimeLine> timeLine,
int l,
int r)
Recursive quicksort routine uses divide and conquer approach to quickly sort two halves of the Vector. |
private static void |
swap(java.util.Vector<TimeLine> timeLine,
int element1,
int element2)
Swap two elements of the vector, timeLine[e1] & timeLine[e2]. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SortTimeLine()
Method Detail |
---|
private static void swap(java.util.Vector<TimeLine> timeLine, int element1, int element2)
timeLine
- The timeline.element1
- The index of element 1.element2
- The index of element 2.public static void quicksort(java.util.Vector<TimeLine> timeLine)
timeLine
- private static void quicksort(java.util.Vector<TimeLine> timeLine, int l, int r)
timeLine
- The timeline Vector.l
- The left index.r
- The right index.private static int partition(java.util.Vector<TimeLine> timeLine, int l, int r)
timeLine
- The timeline Vector.l
- The left index.r
- The right index.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |