Class NameComparatorWithGenerality
- java.lang.Object
-
- net.ontopia.topicmaps.nav.utils.comparators.NameComparator
-
- net.ontopia.topicmaps.nav.utils.comparators.NameComparatorWithGenerality
-
- All Implemented Interfaces:
Comparator<NameIF>
public class NameComparatorWithGenerality extends NameComparator
INTERNAL: A Comparator for ordering TopicNameIFs and VariantNameIFs first after their generality (determined by the number of themes in their scopes, which means that the name in the unconstrained scope would always appear first) and second alphabetically (case-independent).
-
-
Field Summary
-
Fields inherited from class net.ontopia.topicmaps.nav.utils.comparators.NameComparator
scopes, sortNameGrabber, vnGrabber
-
-
Constructor Summary
Constructors Constructor Description NameComparatorWithGenerality()
Empty constructor, used on application startup to initialise a "fast" comparator which will compare TopicNameIFs and VariantNameIFs using no context.NameComparatorWithGenerality(Collection<TopicIF> context)
Constructor used to make a comparator which will compare TopicNameIFs and VariantNameIFs using the context provided.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getName(NameIF obj)
INTERNAL: helper method which gets out of the object the base name or variant name value.-
Methods inherited from class net.ontopia.topicmaps.nav.utils.comparators.NameComparator
compare, initSortNameGrabber
-
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
-
NameComparatorWithGenerality
public NameComparatorWithGenerality()
Empty constructor, used on application startup to initialise a "fast" comparator which will compare TopicNameIFs and VariantNameIFs using no context.
-
NameComparatorWithGenerality
public NameComparatorWithGenerality(Collection<TopicIF> context)
Constructor used to make a comparator which will compare TopicNameIFs and VariantNameIFs using the context provided.
-
-
Method Detail
-
getName
protected String getName(NameIF obj)
INTERNAL: helper method which gets out of the object the base name or variant name value. If it's a basename try to retrieve the sort variant name for it. The resulting string contains first the number of themes and after that the name.- Overrides:
getName
in classNameComparator
-
-