Class ContextNameGrabber

  • All Implemented Interfaces:
    Function<TopicIF,​NameIF>

    public class ContextNameGrabber
    extends Object
    implements Function<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.
    • 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

      • apply

        public NameIF apply​(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:
        apply in interface Function<TopicIF,​NameIF>
        Parameters:
        topic - A topic; formally an Object, but must implement TopicIF.
        Returns:
        object of class TopicNameIF or VariantNameIF