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).
  • Constructor Details

    • 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 Details

    • 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 class NameComparator