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

java.lang.Object
  extended by net.ontopia.topicmaps.nav.utils.comparators.ContextNameGrabber
All Implemented Interfaces:
GrabberIF<TopicIF,NameIF>

public class ContextNameGrabber
extends Object
implements GrabberIF<TopicIF,NameIF>

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  Comparator<TopicNameIF> bnComparator
           
protected  Comparator<VariantNameIF> vnComparator
           
protected  DeciderIF<VariantNameIF> within
           
 
Constructor Summary
ContextNameGrabber(Collection<TopicIF> baseNameContext, Collection<TopicIF> variantNameContext)
          INTERNAL: Creates a grabber; makes the comparators ScopedIFComparator for the given scopes.
 
Method Summary
 NameIF grab(TopicIF mytopic)
          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<VariantNameIF> within

bnComparator

protected Comparator<TopicNameIF> bnComparator

vnComparator

protected Comparator<VariantNameIF> vnComparator
Constructor Detail

ContextNameGrabber

public ContextNameGrabber(Collection<TopicIF> baseNameContext,
                          Collection<TopicIF> 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 NameIF grab(TopicIF mytopic)
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<TopicIF,NameIF>
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.