org.tmapi.core
Interface Variant

All Superinterfaces:
ScopedObject, TopicMapObject

public interface Variant
extends ScopedObject

Represents the topic map variant name construct. A variant name is qualified by zero or more parameters, each of which is a topic. This class uses the ScopedObject interface to managed the parameters.

A variant name may either reference an external resource (via the resource property) or contain inline string data (in the value property). A Variant with value will return null for resource and vice-versa.


Method Summary
 Topic getReifier()
          Returns the Topic that reifies this variant name.
 Locator getResource()
          Returns the resource reference locator associated with this variant.
 java.util.Set getScope()
          Returns the topics which define the parameters of this Variant.
 TopicName getTopicName()
          Returns the TopicName to which this variant belongs.
 java.lang.String getValue()
          Returns the data string associated with this variant.
 void remove()
          Removes this Variant from the collection of Variants managed by the parent TopicName object.
 void setResource(Locator loc)
          Sets the resource reference for this variant.
 void setValue(java.lang.String value)
          Sets the resource data string for this variant.
 
Methods inherited from interface org.tmapi.core.ScopedObject
addScopingTopic, removeScopingTopic
 
Methods inherited from interface org.tmapi.core.TopicMapObject
addSourceLocator, equals, getObjectId, getSourceLocators, getTopicMap, hashCode, removeSourceLocator
 

Method Detail

getTopicName

public TopicName getTopicName()
Returns the TopicName to which this variant belongs.

Returns:
A TopicName object.

getValue

public java.lang.String getValue()
Returns the data string associated with this variant.

Returns:
The value string of this variant, or null if the variant does not have a value data string.

setValue

public void setValue(java.lang.String value)
Sets the resource data string for this variant. This method will overwrite any existing value data string and will set the value of the resource property to null.


getResource

public Locator getResource()
Returns the resource reference locator associated with this variant.

Returns:
The Locator object for the resource reference, or null if this variant does not have a resource reference.

setResource

public void setResource(Locator loc)
Sets the resource reference for this variant. This method will overwrite any existing resource reference and will set the value property to null.


getReifier

public Topic getReifier()
Returns the Topic that reifies this variant name.

Returns:
A Topic instance or null if the variant name is not reified.

remove

public void remove()
            throws TMAPIException
Removes this Variant from the collection of Variants managed by the parent TopicName object.

Specified by:
remove in interface TopicMapObject
Throws:
TMAPIException - if the object cannot be removed from the container. Derived interfaces may define specific circumstances under which a subclass of TMAPIException must be raised. Implementations MUST NOT use a TMAPIException to wrap a failure raised in the underlying engine - such errors must always be wrapped in a TMAPIRuntimeException.

getScope

public java.util.Set getScope()
Returns the topics which define the parameters of this Variant. This method must return ONLY the topics which are the parameters of the Variant and NOT the topics which are in the scope of the parent TopicName instance. The return value may be an empty Set, but is never null.

Specified by:
getScope in interface ScopedObject
Returns:
An unmodifiable Set of Topic objects.