Package org.apache.wiki.pages
Class PageSorter
java.lang.Object
org.apache.wiki.pages.PageSorter
- All Implemented Interfaces:
- java.util.Comparator<java.lang.String>
public class PageSorter extends java.lang.Object implements java.util.Comparator<java.lang.String>
Wrapper class for managing and using the PageNameComparator.
 
Note - this class is deliberately not null safe. Never call any of the methods with a null argument!
- 
Field SummaryFields Modifier and Type Field Description protected static java.lang.StringPROP_PAGE_NAME_COMPARATOR
- 
Constructor SummaryConstructors Constructor Description PageSorter()Default constructor uses Java "natural" ordering.PageSorter(java.util.Comparator<java.lang.String> comparator)Construct with a particular comparator.
- 
Method SummaryModifier and Type Method Description intcompare(java.lang.String pageName1, java.lang.String pageName2)Compare two page names (String version).booleanequals(java.lang.Object o)voidinitialize(java.util.Properties props)Called by Engine to initialise this instance.voidsort(java.lang.String[] nameArray)Sorts the specified array into ascending order based on the PageNameComparator.voidsort(java.util.List<java.lang.String> nameList)Sorts the specified list into ascending order based on the PageNameComparator.Methods inherited from class java.lang.Objectclone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparatorreversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
- 
Field Details- 
PROP_PAGE_NAME_COMPARATOR- See Also:
- Constant Field Values
 
 
- 
- 
Constructor Details- 
PageSorterpublic PageSorter()Default constructor uses Java "natural" ordering.
- 
PageSorterConstruct with a particular comparator.- Parameters:
- comparator- the Comparator to use
 
 
- 
- 
Method Details- 
compareCompare two page names (String version).- Specified by:
- comparein interface- java.util.Comparator<java.lang.String>
- Parameters:
- pageName1- the first page name
- pageName2- the second page name
- Returns:
- see java.util.Comparator
- See Also:
- Comparator.compare(java.lang.Object, java.lang.Object)
 
- 
equals- Specified by:
- equalsin interface- java.util.Comparator<java.lang.String>
- Overrides:
- equalsin class- java.lang.Object
 
- 
initializeCalled by Engine to initialise this instance. Tries to use class given by the PROP_PAGE_NAME_COMPARATOR property as the page name comparator. Uses a default comparator if this property is not set or there is any problem loading the specified class.- Parameters:
- props- this Engine's properties.
 
- 
sortSorts the specified list into ascending order based on the PageNameComparator. The actual sort is done usingList.sort().- Parameters:
- nameList- the page names to be sorted
 
- 
sortSorts the specified array into ascending order based on the PageNameComparator. The actual sort is done usingArrays.sort().- Parameters:
- nameArray- the page names to be sorted
 
 
-