Package net.ontopia.topicmaps.utils
Class VariantNameGrabber
- java.lang.Object
-
- net.ontopia.topicmaps.utils.VariantNameGrabber
-
- All Implemented Interfaces:
Function<TopicNameIF,VariantNameIF>
public class VariantNameGrabber extends Object implements Function<TopicNameIF,VariantNameIF>
INTERNAL: Grabber that grabs the most highest ranked variant name by scope from a basename. The grabber uses a ScopedIFComparator internally to rank the variant names of the given basename. If the basename has no applicable variant names, null is returned.
-
-
Field Summary
Fields Modifier and Type Field Description protected Comparator<? super VariantNameIF>
comparator
PROTECTED: The comparator used to sort the variant names.
-
Constructor Summary
Constructors Constructor Description VariantNameGrabber(Collection<TopicIF> scope)
INTERNAL: Creates a grabber; makes the comparator a ScopedIFComparator for the given scope.VariantNameGrabber(Comparator<? super VariantNameIF> comparator)
INTERNAL: Creates a grabber which uses the given comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VariantNameIF
apply(TopicNameIF basename)
INTERNAL: Grabs the most appropriate variant name for the given base name, using the comparator established at creation to compare available variant names.
-
-
-
Field Detail
-
comparator
protected Comparator<? super VariantNameIF> comparator
PROTECTED: The comparator used to sort the variant names.
-
-
Constructor Detail
-
VariantNameGrabber
public VariantNameGrabber(Collection<TopicIF> scope)
INTERNAL: Creates a grabber; makes the comparator a ScopedIFComparator for the given scope.- Parameters:
scope
- A scope; a collection of TopicIF objects.
-
VariantNameGrabber
public VariantNameGrabber(Comparator<? super VariantNameIF> comparator)
INTERNAL: Creates a grabber which uses the given comparator.- Parameters:
comparator
- The given comparator
-
-
Method Detail
-
apply
public VariantNameIF apply(TopicNameIF basename)
INTERNAL: Grabs the most appropriate variant name for the given base name, using the comparator established at creation to compare available variant names.- Specified by:
apply
in interfaceFunction<TopicNameIF,VariantNameIF>
- Parameters:
basename
- an object, but must implement TopicNameIF.- Returns:
- the most applicable variant name, or null.
-
-