net.ontopia.topicmaps.nav.utils.comparators
Class NameComparatorWithGenerality

java.lang.Object
  extended by net.ontopia.topicmaps.nav.utils.comparators.NameComparator
      extended by 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, SORT_LOCATOR, sortNameGrabber, vnGrabber
 
Constructor Summary
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
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
 

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


Copyright © 2000-2012 Ontopia.