|
ReportMill 7.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.reportmill.foundation.RMObject
com.reportmill.foundation.RMSort
This class provides a basic description for comparison and sorting with a simple key and order (ascending or descending). You can create a new order like this:
RMSort titleFirst = new RMSort("title");
RMSort bestRevenueFirst = new RMSort("revenue", ORDER_DESCEND);
This class also provides useful static methods for comparison and sorting:
RMSort.sort(myList, "title"); // Sort myList by its contents' title method (alphabetically) RMSort.sort(myList, bestRevenueFirst); // Sort myList by its contents' revenue method (largest first) List mySortList = new ArrayList(); mySortList.add(bestRevenueFirst); mySortList.add(titleFirst); RMSort.sort(myList, mySortList); // Sort myList by revenue and title
| Nested Class Summary | |
static interface |
RMSort.Comparator
Defines an interface for objects to implementation compare functionality. |
static class |
RMSort.DefaultComparator
Defines a default implementation of the Comparator interface to compare common object types. |
| Field Summary | |
static RMSort.DefaultComparator |
defaultComparator
|
static byte |
ORDER_ASCEND
|
static byte |
ORDER_DESCEND
|
static byte |
ORDER_SAME
|
| Constructor Summary | |
RMSort()
Creates a plain sort with no key. |
|
RMSort(java.lang.String aKey)
Creates a sort with the given key and ORDER_ASCEND. |
|
RMSort(java.lang.String aKey,
int anOrder)
Creates a sort with the given key and order. |
|
| Method Summary | |
static int |
compare(java.lang.Object obj1,
java.lang.Object obj2)
Returns a description of how the given two objects compare in terms of order: ORDER_SAME, ORDER_ASCEND or ORDER_DESCEND. |
boolean |
equals(java.lang.Object anObj)
Standard equals implementation. |
void |
flip()
Deprecated - use getFlipped instead, RMSort should be immutable. |
java.lang.Object |
fromXML(com.ribs.RXArchiver anArchiver,
com.ribs.RXElement anElement)
XML unarchival. |
RMSort |
getFlipped()
This method returns a sort with the same key but opposite order. |
java.lang.String |
getKey()
This method returns the _key for this sort. |
int |
getOrder()
This method returns the order for this sort. |
java.lang.Object |
initWithArchiver(com.reportmill.foundation.RMArchiver anArchiver)
Legacy archival. |
static java.util.List |
sort(java.util.List aList)
Returns the given list sorted by RMSort's default comparator. |
static java.util.List |
sort(java.util.List aList,
java.util.List aSortList)
Returns the given list sorted by the given list of sorts. |
static java.util.List |
sort(java.util.List aList,
java.lang.Object context)
Returns the given list, sorted by RMSort's default comparator with the given context. |
static java.util.List |
sort(java.util.List aList,
RMSort.Comparator c,
java.lang.Object context)
Returns the given list sorted by a given RMSort Compartor with the given context. |
static java.util.List |
sort(java.util.List aList,
RMSort aSort)
Returns the given list sorted by the given sort. |
static java.util.List |
sort(java.util.List aList,
java.lang.String aKey)
Returns the given list sorted by the given key in ORDER_ASCEND. |
static java.util.Vector |
sortedList(java.util.List aList,
java.lang.String aKey)
Returns a new list from the given list sorted by the given key in ORDER_ASCEND. |
com.ribs.RXElement |
toXML(com.ribs.RXArchiver anArchiver)
XML archival. |
| Methods inherited from class com.reportmill.foundation.RMObject |
archiverClassName, clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals |
| Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final byte ORDER_SAME
public static final byte ORDER_ASCEND
public static final byte ORDER_DESCEND
public static RMSort.DefaultComparator defaultComparator
| Constructor Detail |
public RMSort()
public RMSort(java.lang.String aKey)
public RMSort(java.lang.String aKey,
int anOrder)
| Method Detail |
public java.lang.String getKey()
public int getOrder()
public RMSort getFlipped()
public void flip()
public static int compare(java.lang.Object obj1,
java.lang.Object obj2)
public static java.util.Vector sortedList(java.util.List aList,
java.lang.String aKey)
public static java.util.List sort(java.util.List aList,
java.lang.String aKey)
public static java.util.List sort(java.util.List aList,
RMSort aSort)
public static java.util.List sort(java.util.List aList,
java.util.List aSortList)
public static java.util.List sort(java.util.List aList)
public static java.util.List sort(java.util.List aList,
java.lang.Object context)
public static java.util.List sort(java.util.List aList,
RMSort.Comparator c,
java.lang.Object context)
public boolean equals(java.lang.Object anObj)
public java.lang.Object initWithArchiver(com.reportmill.foundation.RMArchiver anArchiver)
public com.ribs.RXElement toXML(com.ribs.RXArchiver anArchiver)
public java.lang.Object fromXML(com.ribs.RXArchiver anArchiver,
com.ribs.RXElement anElement)
|
ReportMill 7.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||