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:
java.util.Comparator

public class NameComparatorWithGenerality
extends NameComparator
implements java.util.Comparator

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(java.util.Collection context)
          Constructor used to make a comparator which will compare TopicNameIFs and VariantNameIFs using the context provided.
 
Method Summary
protected  java.lang.String getName(java.lang.Object 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
compare, 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(java.util.Collection context)
Constructor used to make a comparator which will compare TopicNameIFs and VariantNameIFs using the context provided.

Method Detail

getName

protected java.lang.String getName(java.lang.Object obj)
                            throws java.lang.ClassCastException
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
Throws:
java.lang.ClassCastException


Copyright © 2000-2012 Ontopia.