public class NameGrabber extends Object implements Function<TopicIF,NameIF>
Modifier and Type | Field and Description |
---|---|
protected boolean |
grabOnlyTopicName
INTERNAL: Determine if grab should deliver only the most
appropiate basename even if there is a more apropiate variant.
|
protected boolean |
indicatorVariant |
protected Collection<TopicIF> |
scope
INTERNAL: Alternatively to
themeIndicator the
basename scope (collection of TopicIF objects) to decide
suitablity can be setup instantly. |
protected LocatorIF |
themeIndicator
PROTECTED: The subject indicator of the theme used to decide
suitability.
|
protected Collection<TopicIF> |
variantScope
INTERNAL: A collection containing topic themes used for specifying
the variant name scope.
|
Constructor and Description |
---|
NameGrabber(Collection<TopicIF> scope)
INTERNAL: Creates the grabber and sets the comparator to be a
ScopedIFComparator using the specified scope.
|
NameGrabber(Collection<TopicIF> basenameScope,
Collection<TopicIF> variantScope)
INTERNAL: Creates the grabber and sets the comparator to be a
ScopedIFComparator using the specified scope.
|
NameGrabber(Collection<TopicIF> basenameScope,
Collection<TopicIF> variantScope,
boolean grabOnlyTopicName)
INTERNAL: Creates the grabber and sets the comparator to be a
ScopedIFComparator using the specified scope.
|
NameGrabber(LocatorIF themeIndicator)
INTERNAL: Creates the grabber and sets the comparator to be a
ScopedIFComparator using the least constrained scope.
|
NameGrabber(LocatorIF themeIndicator,
boolean variant)
PUBLIC: Creates the grabber and sets the comparator to be a
ScopedIFComparator using the least constrained scope.
|
Modifier and Type | Method and Description |
---|---|
NameIF |
apply(TopicIF topic)
INTERNAL: Grabs the most appropiate base name (or if
grabOnlyTopicName is false allow also to return the
most appropiate VariantIF instance). |
boolean |
getGrabOnlyTopicName()
INTERNAL: Gets the grab policy.
|
void |
setGrabOnlyTopicName(boolean grabOnlyTopicName)
INTERNAL: Sets the grab policy, if only instances of BasenameIF
should be returned by grab, or also the more appropiate
VariantIF.
|
protected LocatorIF themeIndicator
protected boolean indicatorVariant
protected Collection<TopicIF> scope
themeIndicator
the
basename scope (collection of TopicIF objects) to decide
suitablity can be setup instantly.protected Collection<TopicIF> variantScope
protected boolean grabOnlyTopicName
public NameGrabber(LocatorIF themeIndicator)
public NameGrabber(LocatorIF themeIndicator, boolean variant)
variant
- Whether to use the indicator to set the variant
scope (if false it is used for the base name scope)public NameGrabber(Collection<TopicIF> scope)
public NameGrabber(Collection<TopicIF> basenameScope, Collection<TopicIF> variantScope)
public NameGrabber(Collection<TopicIF> basenameScope, Collection<TopicIF> variantScope, boolean grabOnlyTopicName)
grabOnlyTopicName
to
specify the policy) that have most in common with specified
scope.public void setGrabOnlyTopicName(boolean grabOnlyTopicName)
public boolean getGrabOnlyTopicName()
setGrabOnlyTopicName(boolean)
public NameIF apply(TopicIF topic)
grabOnlyTopicName
is false allow also to return the
most appropiate VariantIF instance). The name returned is the
first suitable base name belonging to a variant name found, when
the basenames of the give topic have been sorted using the
comparator. If there is no suitable base name belonging to a
variant name, then the last base name found is returned,
corresponding to the least constrained scope.apply
in interface Function<TopicIF,NameIF>
object
- The topic whose name is being grabbed; formally an object.throws
- OntopiaRuntimeException if object is not a topic.