
public class PageSorter extends Object implements Comparator
Note - this class is deliberately not null safe. Never call any of the methods with a null argument!
| Modifier and Type | Field and Description |
|---|---|
protected static String |
PROP_PAGE_NAME_COMPARATOR |
| Constructor and Description |
|---|
PageSorter()
Default constructor uses Java "natural" ordering.
|
PageSorter(Comparator<String> comparator)
Construct with a particular comparator.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(Object o1,
Object o2)
Compare two page names (Object version).
|
int |
compare(String pageName1,
String pageName2)
Compare two page names (String version).
|
int |
compare(WikiPage page1,
WikiPage page2)
Compare two pages (WikiPage version).
|
boolean |
equals(Object o) |
void |
initialize(Properties props)
Called by WikiEngine to initialise this instance.
|
void |
sort(List<String> nameList)
Sorts the specified list into ascending order based on the
PageNameComparator.
|
void |
sort(String[] nameArray)
Sorts the specified array into ascending order based on the
PageNameComparator.
|
void |
sortPages(List<Object> pageList)
Sorts the specified list into ascending order based on the
PageNameComparator.
|
void |
sortPages(Object[] pageArray)
Sorts the specified array into ascending order based on the
PageNameComparator.
|
protected static final String PROP_PAGE_NAME_COMPARATOR
public PageSorter()
public PageSorter(Comparator<String> comparator)
comparator - the Comparator to usepublic int compare(Object o1, Object o2)
compare in interface ComparatorIllegalArgumentException - if incorrect argument types.Comparator.compare(java.lang.Object, java.lang.Object)public int compare(String pageName1, String pageName2)
pageName1 - the first page namepageName2 - the second page nameComparator.compare(java.lang.Object, java.lang.Object)public int compare(WikiPage page1, WikiPage page2)
page1 - the first pagepage2 - the second pageComparator.compare(java.lang.Object, java.lang.Object)public boolean equals(Object o)
equals in interface Comparatorequals in class Objectpublic void initialize(Properties props)
props - this WikiEngine's properties.public void sort(List<String> nameList)
Collections.sort().nameList - the page names to be sortedpublic void sort(String[] nameArray)
Arrays.sort().nameArray - the page names to be sortedpublic void sortPages(List<Object> pageList)
Collections.sort().pageList - the pages to be sortedpublic void sortPages(Object[] pageArray)
Arrays.sort().pageArray - the pages to be sortedCopyright © 2001-2018 The Apache Software Foundation. All rights reserved.