Class TopicComparator
- java.lang.Object
-
- net.ontopia.topicmaps.nav.utils.comparators.TopicComparator
-
- All Implemented Interfaces:
Comparator<TopicIF>
public class TopicComparator extends Object implements Comparator<TopicIF>
INTERNAL: A Comparator for ordering topics alphabetically. Note that it does not look up the 'sort' topic for you, but that this must be provided explicitly to the constructors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TopicComparator.ComparatorNameStringifier
INTERNAL: Stringifier that stringifies TopicNameIFs and VariantNameIFs.
-
Field Summary
Fields Modifier and Type Field Description protected Function<TopicIF,NameIF>
nameGrabber
protected Function<NameIF,String>
nameStringifier
-
Constructor Summary
Constructors Constructor Description TopicComparator()
Empty constructor, used on application startup to initialise a "fast" comparator which will compare Topics using no context.TopicComparator(Collection<TopicIF> baseNameContext)
Constructor used to make a comparator which will compare Topics using the contexts provided.TopicComparator(Collection<TopicIF> baseNameContext, Collection<TopicIF> variantNameContext)
Constructor used to make a comparator which will compare Topics using the contexts provided.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(TopicIF o1, TopicIF o2)
implementing method which is required for Comparator interface.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
TopicComparator
public TopicComparator()
Empty constructor, used on application startup to initialise a "fast" comparator which will compare Topics using no context.
-
TopicComparator
public TopicComparator(Collection<TopicIF> baseNameContext)
Constructor used to make a comparator which will compare Topics using the contexts provided.
-
TopicComparator
public TopicComparator(Collection<TopicIF> baseNameContext, Collection<TopicIF> variantNameContext)
Constructor used to make a comparator which will compare Topics using the contexts provided. The variantNameContext will generally be a Sort topic if is available. This is the default applied by the application.
-
-
Method Detail
-
compare
public int compare(TopicIF o1, TopicIF o2)
implementing method which is required for Comparator interface.- Specified by:
compare
in interfaceComparator<TopicIF>
-
-