|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.twitterapime.util.QSort
public class QSort
This class implements QSort algorithm.
Constructor Summary | |
---|---|
QSort()
Default constructor. |
Method Summary | |
---|---|
protected java.lang.Object |
getElement(java.lang.Object ob)
Get an element to be sorted from a given object. |
protected boolean |
greater(java.lang.Object i1,
java.lang.Object i2)
Verify if a given object (1st param) is greater than another object (2nd param). |
boolean |
isAscendingSort()
Return if the sort is set up for ascending or descending. |
protected boolean |
lesser(java.lang.Object i1,
java.lang.Object i2)
Verify if a given object (1st param) is lesser than another object (2nd param). |
void |
quicksort(java.lang.Object[] items,
int s,
int e)
Start sorting a given array of objects. |
void |
setAscendingSortEnabled(boolean enabled)
Set enable the ascending sort or descending. |
protected void |
swap(java.lang.Object[] its,
int i1,
int i2)
Swap two objects from the array according to the given indexes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QSort()
Default constructor.
Method Detail |
---|
public void setAscendingSortEnabled(boolean enabled)
Set enable the ascending sort or descending.
enabled
- Enabled or disabled.public boolean isAscendingSort()
Return if the sort is set up for ascending or descending.
public void quicksort(java.lang.Object[] items, int s, int e)
Start sorting a given array of objects.
items
- Objects to be sorted.s
- Start index.e
- End index.protected java.lang.Object getElement(java.lang.Object ob)
Get an element to be sorted from a given object.
ob
- Object.
protected boolean lesser(java.lang.Object i1, java.lang.Object i2)
Verify if a given object (1st param) is lesser than another object (2nd param).
i1
- Object 1.i2
- Object 2.
protected boolean greater(java.lang.Object i1, java.lang.Object i2)
Verify if a given object (1st param) is greater than another object (2nd param).
i1
- Object 1.i2
- Object 2.
protected void swap(java.lang.Object[] its, int i1, int i2)
Swap two objects from the array according to the given indexes.
its
- Array of objects.i1
- Index of the 1st object.i2
- Index of the 2nd object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |