org.tmapi.core
Interface Occurrence

All Superinterfaces:
ScopedObject, TopicMapObject

public interface Occurrence
extends ScopedObject

Represents the topic map occurrence construct. An occurrence may either reference an external resource (via the resource property) or contain inline string data (in the value property). An occurrence with value will return null for resource and vice-versa.


Method Summary
 Topic getReifier()
          Returns the Topic that reifies this occurrence.
 Locator getResource()
          Returns the resource reference locator associated with this occurrence.
 Topic getTopic()
          Returns the topic to which this occurrence belongs.
 Topic getType()
          Returns the topic which defines the type of this occurrence.
 java.lang.String getValue()
          Returns the data string associated with this occurrence.
 void remove()
          Removes this Occurrence from the collection of Occurrences managed by the parent Topic.
 void setResource(Locator loc)
          Sets the resource reference for this occurrence.
 void setType(Topic type)
          Sets the topic which defines the type of this occurrence.
 void setValue(java.lang.String value)
          Sets the value data string for this occurrence.
 
Methods inherited from interface org.tmapi.core.ScopedObject
addScopingTopic, getScope, removeScopingTopic
 
Methods inherited from interface org.tmapi.core.TopicMapObject
addSourceLocator, equals, getObjectId, getSourceLocators, getTopicMap, hashCode, removeSourceLocator
 

Method Detail

getTopic

public Topic getTopic()
Returns the topic to which this occurrence belongs.

Returns:
The Topic object which contains this Occurrence.

setType

public void setType(Topic type)
Sets the topic which defines the type of this occurrence. Overwrites any existing type information.

Parameters:
type - The Topic which defines the type of this Occurrence, or null to remove any existing type.

getType

public Topic getType()
Returns the topic which defines the type of this occurrence.

Returns:
The Topic object which defines the type of this Occurrence, or null if there is no occurrence type.

getValue

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

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

setValue

public void setValue(java.lang.String value)
Sets the value data string for this occurrence. 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 occurrence.

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

setResource

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

Parameters:
loc - The Locator object which reference the resource

getReifier

public Topic getReifier()
Returns the Topic that reifies this occurrence.

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

remove

public void remove()
            throws TMAPIException
Removes this Occurrence from the collection of Occurrences managed by the parent Topic.

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.