net.ontopia.topicmaps.utils
Class TopicVariantNameGrabber

java.lang.Object
  extended by net.ontopia.topicmaps.utils.TopicVariantNameGrabber
All Implemented Interfaces:
GrabberIF

public class TopicVariantNameGrabber
extends java.lang.Object
implements GrabberIF

INTERNAL: Grabber that grabs the most highest ranked variant name by scope from a topic, ignoring the scope of the base names.

The grabber uses a ScopedIFComparator internally to rank all the variant names of the given topic. If the topic has no applicable variant names, null is returned.

Since:
2.0.3

Field Summary
protected  java.util.Comparator comparator
          PROTECTED: The comparator used to sort the variant names.
 
Constructor Summary
TopicVariantNameGrabber(java.util.Collection scope)
          INTERNAL: Creates a grabber.
TopicVariantNameGrabber(java.util.Comparator comparator)
          INTERNAL: Creates a grabber which uses the given comparator.
 
Method Summary
 java.lang.Object grab(java.lang.Object topic)
          INTERNAL: Grabs the most appropriate variant name for the given topic name, using the comparator established at creation to compare available variant names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparator

protected java.util.Comparator comparator
PROTECTED: The comparator used to sort the variant names.

Constructor Detail

TopicVariantNameGrabber

public TopicVariantNameGrabber(java.util.Collection scope)
INTERNAL: Creates a grabber.

Parameters:
scope - A scope; a collection of TopicIF objects.

TopicVariantNameGrabber

public TopicVariantNameGrabber(java.util.Comparator comparator)
INTERNAL: Creates a grabber which uses the given comparator.

Parameters:
comparator - The given comparator
Method Detail

grab

public java.lang.Object grab(java.lang.Object topic)
INTERNAL: Grabs the most appropriate variant name for the given topic name, using the comparator established at creation to compare available variant names.

Specified by:
grab in interface GrabberIF
Parameters:
topic - an object, but must implement TopicIF
Returns:
the most applicable variant name, or null.
Throws:
throws - OntopiaRuntimeException if the given topic is not a TopicIF object.


Copyright © 2000-2012 Ontopia.