org.tm4j.topicmap.utils.extractors
Class VariantNameExtractor

java.lang.Object
  extended byorg.tm4j.topicmap.utils.extractors.ExtractorBase
      extended byorg.tm4j.topicmap.utils.extractors.VariantNameExtractor
All Implemented Interfaces:
uk.co.jezuk.mango.BinaryFunction, uk.co.jezuk.mango.UnaryFunction

public class VariantNameExtractor
extends ExtractorBase
implements uk.co.jezuk.mango.BinaryFunction

An extractor function which takes a Topic as input and returns a Variant instance as output The Variant returned will be selected from all Variants of the BaseNames of the Topic as follows:

  1. First the BaseName which has the most preferred themes in its scope, and at least one Variant is selected. If there is a tie, then an arbitrary selection is made.
  2. The Variant that has the most preferred parameters is selected. In the case of a tie, an arbitrary selection is made.

Author:
Kal Describe VariantNameExtractor here.

Constructor Summary
VariantNameExtractor()
           
 
Method Summary
 java.lang.Object _extract(java.lang.Object in)
           
 void addPreferredParameter(Topic param)
          Adds a Topic to the list of preferred Variant parameters.
 void addPreferredTheme(Topic theme)
          Adds a Topic to the list of preferred BaseName themes.
 java.lang.Object fn(java.lang.Object in, java.lang.Object arg)
           
 
Methods inherited from class org.tm4j.topicmap.utils.extractors.ExtractorBase
fn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariantNameExtractor

public VariantNameExtractor()
Method Detail

addPreferredTheme

public void addPreferredTheme(Topic theme)
Adds a Topic to the list of preferred BaseName themes.

Parameters:
theme - the preferred theme to add

addPreferredParameter

public void addPreferredParameter(Topic param)
Adds a Topic to the list of preferred Variant parameters.

Parameters:
param - the preferred parameter to add

_extract

public java.lang.Object _extract(java.lang.Object in)
Specified by:
_extract in class ExtractorBase

fn

public java.lang.Object fn(java.lang.Object in,
                           java.lang.Object arg)
Specified by:
fn in interface uk.co.jezuk.mango.BinaryFunction