org.tmapi.core
Interface Construct

All Known Subinterfaces:
Association, DatatypeAware, Name, Occurrence, Reifiable, Role, Scoped, Topic, TopicMap, Typed, Variant

public interface Construct

Base interface for all Topic Maps constructs.

Version:
$Rev: 141 $ - $Date: 2010-01-17 22:22:27 +0100 (So, 17 Jan 2010) $
Author:
The TMAPI Project

Method Summary
 void addItemIdentifier(Locator itemIdentifier)
          Adds an item identifier.
 boolean equals(java.lang.Object other)
          Returns true if the other object is equal to this one.
 java.lang.String getId()
          Returns the identifier of this construct.
 java.util.Set<Locator> getItemIdentifiers()
          Returns the item identifiers of this Topic Maps construct.
 Construct getParent()
          Returns the parent of this construct.
 TopicMap getTopicMap()
          Returns the TopicMap instance to which this Topic Maps construct belongs.
 int hashCode()
          Returns the hash code value.
 void remove()
          Deletes this construct from its parent container.
 void removeItemIdentifier(Locator itemIdentifier)
          Removes an item identifier.
 

Method Detail

getParent

Construct getParent()
Returns the parent of this construct. This method returns null iff this construct is a TopicMap instance.

Returns:
The parent of this construct or null iff the construct is an instance of TopicMap.

getTopicMap

TopicMap getTopicMap()
Returns the TopicMap instance to which this Topic Maps construct belongs. A TopicMap instance returns itself.

Returns:
The topic map instance to which this construct belongs.

getId

java.lang.String getId()
Returns the identifier of this construct. This property has no representation in the Topic Maps - Data Model.

The ID can be anything, so long as no other Construct in the same topic map has the same ID.

Returns:
An identifier which identifies this construct uniquely within a topic map.

getItemIdentifiers

java.util.Set<Locator> getItemIdentifiers()
Returns the item identifiers of this Topic Maps construct. The return value may be empty but must never be null.

Returns:
An unmodifiable set of Locators representing the item identifiers.

addItemIdentifier

void addItemIdentifier(Locator itemIdentifier)
                       throws ModelConstraintException
Adds an item identifier. It is not allowed to have two Constructs in the same TopicMap with the same item identifier. If the two objects are Topics, then they must be merged. If at least one of the two objects is not a Topic, an IdentityConstraintException must be reported.

Parameters:
itemIdentifier - The item identifier to be added; must not be null.
Throws:
IdentityConstraintException - If another construct has an item identifier which is equal to itemIdentifier.
ModelConstraintException - If the item identifier is null.

removeItemIdentifier

void removeItemIdentifier(Locator itemIdentifier)
Removes an item identifier.

Parameters:
itemIdentifier - The item identifier to be removed from this construct, if present (null is ignored).

remove

void remove()
Deletes this construct from its parent container. After invocation of this method, the construct is in an undefined state and must not be used further.


equals

boolean equals(java.lang.Object other)
Returns true if the other object is equal to this one. Equality must be the result of comparing the identity (this == other) of the two objects. Note: This equality test does not reflect any equality rule according to the Topic Maps - Data Model (TMDM) by intention.

Overrides:
equals in class java.lang.Object
Parameters:
other - The object to compare this object against.
Returns:
(this == other)

hashCode

int hashCode()
Returns the hash code value. The returned hash code is equal to the hash code of System.identityHashCode(this).

Overrides:
hashCode in class java.lang.Object
Returns:
System.identityHashCode(this)