net.ontopia.topicmaps.impl.basic
Class Occurrence

java.lang.Object
  extended by net.ontopia.topicmaps.impl.basic.TMObject
      extended by net.ontopia.topicmaps.impl.basic.Occurrence
All Implemented Interfaces:
java.io.Serializable, OccurrenceIF, ReifiableIF, ScopedIF, TMObjectIF, TypedIF

public class Occurrence
extends TMObject
implements OccurrenceIF

INTERNAL: The basic occurrence implementation.

See Also:
Serialized Form

Field Summary
protected  LocatorIF datatype
           
protected  TopicIF reifier
           
protected  UniqueSet<TopicIF> scope
           
protected  TopicIF type
           
protected  java.lang.String value
           
 
Fields inherited from class net.ontopia.topicmaps.impl.basic.TMObject
MSG_NULL_ARGUMENT, sources
 
Method Summary
 void addTheme(TopicIF theme)
          PUBLIC: Add a topic to this scope.
protected  void fireEvent(java.lang.String event, java.lang.Object new_value, java.lang.Object old_value)
          INTERNAL: Fires an event, so that listeners can be informed about the event.
 LocatorIF getDataType()
          PUBLIC: Gets the data type of this occurrence.
 long getLength()
          PUBLIC: Returns the length of the occurrence value.
 LocatorIF getLocator()
          PUBLIC: Returns a LocatorIF representation of the occurrence value.
 java.io.Reader getReader()
          PUBLIC: Returns a Reader that allows you to stream the string representation of this occurrence.
 TopicIF getReifier()
          PUBLIC: Returns the topic that reifies this object.
 java.util.Collection<TopicIF> getScope()
          PUBLIC: Returns the set of topics that are the stated scope of this object.
 TopicIF getTopic()
          PUBLIC: Gets the topic for this occurrence.
 TopicIF getType()
          PUBLIC: Gets the type that this object is an instance of.
 java.lang.String getValue()
          PUBLIC: Gets the string representation of this occurrence.
protected  boolean isConnected()
           
 void remove()
          PUBLIC: Removes the object from its parent.
 void removeTheme(TopicIF theme)
          PUBLIC: Remove a topic from this scope.
protected  void setDataType(LocatorIF datatype)
           
 void setLocator(LocatorIF locator)
          PUBLIC: Same as setValue(locator.getAddress(), DataTypes.TYPE_URI).
 void setReader(java.io.Reader value, long length, LocatorIF datatype)
          PUBLIC: Sets the value and the data type of this occurrence using a reader.
 void setReifier(TopicIF _reifier)
          PUBLIC: Sets the reifier of this object.
 void setType(TopicIF type)
          PUBLIC: Sets the type that this object is an instance of.
 void setValue(java.lang.String value)
          PUBLIC: Same as setValue(value, DataTypes.TYPE_STRING).
 void setValue(java.lang.String value, LocatorIF datatype)
          PUBLIC: Sets the value and the data type of this occurrence using a string.
 java.lang.String toString()
           
 
Methods inherited from class net.ontopia.topicmaps.impl.basic.TMObject
addItemIdentifier, getItemIdentifiers, getObjectId, getTopicMap, isReadOnly, removeItemIdentifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.ontopia.topicmaps.core.TMObjectIF
addItemIdentifier, getItemIdentifiers, getObjectId, getTopicMap, isReadOnly, removeItemIdentifier
 

Field Detail

reifier

protected TopicIF reifier

type

protected TopicIF type

scope

protected UniqueSet<TopicIF> scope

value

protected java.lang.String value

datatype

protected LocatorIF datatype
Method Detail

remove

public void remove()
Description copied from interface: TMObjectIF
PUBLIC: Removes the object from its parent.

Specified by:
remove in interface TMObjectIF

getTopic

public TopicIF getTopic()
Description copied from interface: OccurrenceIF
PUBLIC: Gets the topic for this occurrence.

Specified by:
getTopic in interface OccurrenceIF
Returns:
The topic to which this occurrence belongs; an object implementing TopicIF.

getDataType

public LocatorIF getDataType()
Description copied from interface: OccurrenceIF
PUBLIC: Gets the data type of this occurrence.

Specified by:
getDataType in interface OccurrenceIF

setDataType

protected void setDataType(LocatorIF datatype)

getValue

public java.lang.String getValue()
Description copied from interface: OccurrenceIF
PUBLIC: Gets the string representation of this occurrence. This method will return null if the length of the value exceeds the supported maximum size.

Specified by:
getValue in interface OccurrenceIF

setValue

public void setValue(java.lang.String value)
Description copied from interface: OccurrenceIF
PUBLIC: Same as setValue(value, DataTypes.TYPE_STRING). This method is here primarily for backwards compatibility.

Specified by:
setValue in interface OccurrenceIF

setValue

public void setValue(java.lang.String value,
                     LocatorIF datatype)
Description copied from interface: OccurrenceIF
PUBLIC: Sets the value and the data type of this occurrence using a string. The value must conform to the correct string representation according to the datatype.

Specified by:
setValue in interface OccurrenceIF

getReader

public java.io.Reader getReader()
Description copied from interface: OccurrenceIF
PUBLIC: Returns a Reader that allows you to stream the string representation of this occurrence. Values of all sizes are supported by this method.

Specified by:
getReader in interface OccurrenceIF

setReader

public void setReader(java.io.Reader value,
                      long length,
                      LocatorIF datatype)
Description copied from interface: OccurrenceIF
PUBLIC: Sets the value and the data type of this occurrence using a reader. The reader value must conform to the correct string representation according to the datatype.

Specified by:
setReader in interface OccurrenceIF

getLocator

public LocatorIF getLocator()
Description copied from interface: OccurrenceIF
PUBLIC: Returns a LocatorIF representation of the occurrence value. This method will return null if the value is not of type xsd:anyURI (same as DataType.TYPE_URI). This method is here primarily for backwards compatibility.

Specified by:
getLocator in interface OccurrenceIF

setLocator

public void setLocator(LocatorIF locator)
Description copied from interface: OccurrenceIF
PUBLIC: Same as setValue(locator.getAddress(), DataTypes.TYPE_URI). This method is here primarily for backwards compatibility.

Specified by:
setLocator in interface OccurrenceIF

getLength

public long getLength()
Description copied from interface: OccurrenceIF
PUBLIC: Returns the length of the occurrence value. The number of characters in the string representation is returned.

Specified by:
getLength in interface OccurrenceIF

getScope

public java.util.Collection<TopicIF> getScope()
Description copied from interface: ScopedIF
PUBLIC: Returns the set of topics that are the stated scope of this object. Scoping topics inherited from parent objects are not included. There is no guarantee as to which order these topics are returned in.

Specified by:
getScope in interface ScopedIF
Returns:
A collection of TopicIF objects.

addTheme

public void addTheme(TopicIF theme)
Description copied from interface: ScopedIF
PUBLIC: Add a topic to this scope. (A topic used in a scope is also called a theme.) If the topic is already part of the scope the method call has no effect.

Specified by:
addTheme in interface ScopedIF
Parameters:
theme - A topic to be added to this scope; an object implementing TopicIF.

removeTheme

public void removeTheme(TopicIF theme)
Description copied from interface: ScopedIF
PUBLIC: Remove a topic from this scope. If the topic is not already in the scope this method has no effect. (A topic used in a scope is also called a theme.)

Specified by:
removeTheme in interface ScopedIF
Parameters:
theme - A topic to be removed from this scope; an object implementing TopicIF.

getType

public TopicIF getType()
Description copied from interface: TypedIF
PUBLIC: Gets the type that this object is an instance of.

Specified by:
getType in interface TypedIF
Returns:
The type of this object; an object implementing TopicIF.

setType

public void setType(TopicIF type)
Description copied from interface: TypedIF
PUBLIC: Sets the type that this object is an instance of.

Specified by:
setType in interface TypedIF
Parameters:
type - The type for this object; an object implementing TopicIF.

getReifier

public TopicIF getReifier()
Description copied from interface: ReifiableIF
PUBLIC: Returns the topic that reifies this object.

Specified by:
getReifier in interface ReifiableIF

setReifier

public void setReifier(TopicIF _reifier)
Description copied from interface: ReifiableIF
PUBLIC: Sets the reifier of this object.

Specified by:
setReifier in interface ReifiableIF

fireEvent

protected void fireEvent(java.lang.String event,
                         java.lang.Object new_value,
                         java.lang.Object old_value)
Description copied from class: TMObject
INTERNAL: Fires an event, so that listeners can be informed about the event. This method is typically called when the object id modified.

Overrides:
fireEvent in class TMObject

isConnected

protected boolean isConnected()
Overrides:
isConnected in class TMObject

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2000-2012 Ontopia.