Package net.ontopia.topicmaps.utils
Class NameGrabber
java.lang.Object
net.ontopia.topicmaps.utils.NameGrabber
INTERNAL: Grabber that grabs the most suitable name from a topic,
measured by whether it contains a particular theme in its scope.
If the topic has a variant name with the given theme the belonging
basename will be chosen. If not, the base name in the least
constrained scope will be chosen.
- Since:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanINTERNAL: Determine if grab should deliver only the most appropiate basename even if there is a more apropiate variant.protected booleanprotected Collection<TopicIF>INTERNAL: Alternatively tothemeIndicatorthe basename scope (collection of TopicIF objects) to decide suitablity can be setup instantly.protected LocatorIFPROTECTED: The subject indicator of the theme used to decide suitability.protected Collection<TopicIF>INTERNAL: A collection containing topic themes used for specifying the variant name scope. -
Constructor Summary
ConstructorsConstructorDescriptionNameGrabber(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. -
Method Summary
Modifier and TypeMethodDescriptionINTERNAL: Grabs the most appropiate base name (or ifgrabOnlyTopicNameis false allow also to return the most appropiate VariantIF instance).booleanINTERNAL: Gets the grab policy.voidsetGrabOnlyTopicName(boolean grabOnlyTopicName) INTERNAL: Sets the grab policy, if only instances of BasenameIF should be returned by grab, or also the more appropiate VariantIF.
-
Field Details
-
themeIndicator
PROTECTED: The subject indicator of the theme used to decide suitability. -
indicatorVariant
protected boolean indicatorVariant -
scope
INTERNAL: Alternatively tothemeIndicatorthe basename scope (collection of TopicIF objects) to decide suitablity can be setup instantly.- Since:
- 1.1.2
-
variantScope
INTERNAL: A collection containing topic themes used for specifying the variant name scope.- Since:
- 1.2.1
-
grabOnlyTopicName
protected boolean grabOnlyTopicNameINTERNAL: Determine if grab should deliver only the most appropiate basename even if there is a more apropiate variant. Default value is true.- Since:
- 1.2.2
-
-
Constructor Details
-
NameGrabber
INTERNAL: Creates the grabber and sets the comparator to be a ScopedIFComparator using the least constrained scope. Grabs names that have the topic defined by the given PSI locator in their scope. By default the theme is used in the variant scope. -
NameGrabber
PUBLIC: Creates the grabber and sets the comparator to be a ScopedIFComparator using the least constrained scope. Grabs names that have the topic defined by the given PSI locator in their scope.- Parameters:
variant- Whether to use the indicator to set the variant scope (if false it is used for the base name scope)- Since:
- 2.0
-
NameGrabber
INTERNAL: Creates the grabber and sets the comparator to be a ScopedIFComparator using the specified scope. Grabs names that have most in common with specified scope.- Since:
- 1.1.2
-
NameGrabber
INTERNAL: Creates the grabber and sets the comparator to be a ScopedIFComparator using the specified scope. Grabs base names that have most in common with specified scope.- Since:
- 1.2.1
-
NameGrabber
public 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. Grabs names (basename or variant, usegrabOnlyTopicNameto specify the policy) that have most in common with specified scope.- Since:
- 1.2.2
-
-
Method Details
-
setGrabOnlyTopicName
public 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.- Since:
- 1.2.2
-
getGrabOnlyTopicName
public boolean getGrabOnlyTopicName()INTERNAL: Gets the grab policy.- Since:
- 1.2.2
- See Also:
-
apply
INTERNAL: Grabs the most appropiate base name (or ifgrabOnlyTopicNameis 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.
-