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

java.lang.Object
  extended by net.ontopia.topicmaps.nav.utils.comparators.ContextNameGrabber
All Implemented Interfaces:
GrabberIF

public class ContextNameGrabber
extends java.lang.Object
implements GrabberIF

INTERNAL: Grabber that grabs the most appropriate basename from a topic and then the most appropriate variant name, if one can be found. If no better variant name can be found, the base name is used. This class is much used for grabbing display and sort names.


Field Summary
protected  java.util.Comparator bnComparator
           
protected  java.util.Comparator vnComparator
           
protected  DeciderIF within
           
 
Constructor Summary
ContextNameGrabber(java.util.Collection baseNameContext, java.util.Collection variantNameContext)
          INTERNAL: Creates a grabber; makes the comparators ScopedIFComparator for the given scopes.
 
Method Summary
 java.lang.Object grab(java.lang.Object topic)
          INTERNAL: Grabs the most appropriate base name for the given topic, using the comparator established at creation to compare available base names and if a sort variant is available it will be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

within

protected DeciderIF within

bnComparator

protected java.util.Comparator bnComparator

vnComparator

protected java.util.Comparator vnComparator
Constructor Detail

ContextNameGrabber

public ContextNameGrabber(java.util.Collection baseNameContext,
                          java.util.Collection variantNameContext)
INTERNAL: Creates a grabber; makes the comparators ScopedIFComparator for the given scopes.

Parameters:
baseNameContext - basename scope; a collection of TopicIF objects.
variantNameContext - variantname scope; a collection of TopicIF objects.
Method Detail

grab

public java.lang.Object grab(java.lang.Object topic)
INTERNAL: Grabs the most appropriate base name for the given topic, using the comparator established at creation to compare available base names and if a sort variant is available it will be used.

Specified by:
grab in interface GrabberIF
Parameters:
topic - A topic; formally an Object, but must implement TopicIF.
Returns:
object of class TopicNameIF or VariantNameIF
Throws:
throws - OntopiaRuntimeException if the given topic is not a TopicIF object.


Copyright © 2000-2012 Ontopia.