Class NameComparator

java.lang.Object
net.ontopia.topicmaps.nav.utils.comparators.NameComparator
All Implemented Interfaces:
Comparator<NameIF>
Direct Known Subclasses:
NameComparatorWithGenerality

public class NameComparator extends Object implements Comparator<NameIF>
INTERNAL: A Comparator for ordering TopicNameIFs and VariantNameIFs alphabetically (case-independent).
  • Field Details

  • Constructor Details

    • NameComparator

      public NameComparator()
      Empty constructor, used on application startup to initialise a "fast" comparator which will compare TopicNameIFs and VariantNameIFs using no context.
    • NameComparator

      public NameComparator(Collection<TopicIF> context)
      Constructor used to make a comparator which will compare TopicNameIFs and VariantNameIFs using the context provided.
  • Method Details

    • initSortNameGrabber

      protected final void initSortNameGrabber(TMObjectIF tmObj)
      INTERNAL: setup variant sort name grabber. Attention: reuse same sort name grabber for this NameComparator object instance, so be sure all objects are in the same topicmap.
    • 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.
    • compare

      public int compare(NameIF o1, NameIF o2)
      Compares two TopicNameIFs / VariantNameIFs.
      Specified by:
      compare in interface Comparator<NameIF>