Package net.ontopia.topicmaps.utils
Class TypeHierarchyUtils
java.lang.Object
net.ontopia.topicmaps.utils.TypeHierarchyUtils
INTERNAL: This class provides utility functions for traversing class
hierarchies which are expressed using the Published Subject
Indicators (PSIs) defined by the XTM 1.0 Specification. Operations
provided by this class are not thread-safe.
-
Constructor Summary
ConstructorsConstructorDescriptionINTERNAL: Creates and initialises a new instance of the utility class. -
Method Summary
Modifier and TypeMethodDescriptiongetSubclasses(TopicIF klass) INTERNAL: Returns the topics which are subtypes of the topic klass.getSubclasses(TopicIF klass, int level) INTERNAL: Returns the topics which are subtypes of the given typing topic down to a given level.getSuperclasses(TopicIF klass) INTERNAL: Returns the topics which are supertypes of the given typing topicgetSuperclasses(TopicIF klass, int level) INTERNAL: Returns the topics which are supertypes of the given typing topic up to a given level.getSupertypes(TopicIF typed) INTERNAL: Returns the topics which types of the objecttypedand all their supertypes.getSupertypes(TopicIF typed, boolean excludeTypes) INTERNAL: Returns the topics which types the objecttyped(if notexcludeTypesis set to true) and all their supertypes.getSupertypes(TypedIF typed) INTERNAL: Returns the topic which types the singly typed objecttypedand all of its supertypes.booleanisAssociatedWith(TopicIF start, TopicIF associated) INTERNAL: Returns true if the two topics are directly or indirectly associated under the association type and rolespec definitions provided in the constructor for this walker.booleanisInstanceOf(TopicIF typed, TopicIF klass) INTERNAL: Determines if thetypedis an instance of the typeklass.booleanisInstanceOf(TypedIF typed, TopicIF klass) INTERNAL: Determines if the singly-typed objecttypedis an instance of the typeklass.
-
Constructor Details
-
TypeHierarchyUtils
public TypeHierarchyUtils()INTERNAL: Creates and initialises a new instance of the utility class.
-
-
Method Details
-
isInstanceOf
INTERNAL: Determines if the singly-typed objecttypedis an instance of the typeklass. This function returns true iftypedis a direct instance ofklassor if it is an instance of some subtype ofklass.- Parameters:
typed- the given typedIF objectklass- a topicIF object; the given type- Returns:
- boolean; true iff the given typedIF is an instance of the given type or an instance of a subtype of the given type
-
isInstanceOf
INTERNAL: Determines if thetypedis an instance of the typeklass. This function returns true iftypedis a direct instance ofklassor if it is an instance of some subclass ofklass.- Parameters:
typed- the given typedIF objectklass- a topicIF object; the given type- Returns:
- boolean; true if the given object is an instance of the given type or an instance of a subtype of the given type
-
isAssociatedWith
INTERNAL: Returns true if the two topics are directly or indirectly associated under the association type and rolespec definitions provided in the constructor for this walker. The calculation is performed using a depth-first traversal of the tree formed by the associations concerned, which aborts as soon as the associated topic is found.- Parameters:
start- The topic to begin computation from; an object implementing TopicIF.associated- The topic to be found in the association; an object implementing TopicIF.- Returns:
- Boolean: true if the given topics are directly or indirectly associated
-
getSuperclasses
INTERNAL: Returns the topics which are supertypes of the given typing topic- Parameters:
klass- a topicIF; the given typing topic- Returns:
- an unmodifiable collection of topicIF objects; the supertypes of the given topic
-
getSuperclasses
INTERNAL: Returns the topics which are supertypes of the given typing topic up to a given level. If the level is 1 only the immediate superclasses are returned, at level 2 immediate superclasses and their immediate superclasses are returned, and so on. To get all superclasses, regardless of level, use the variant of this method which has no numeric parameter.- Parameters:
klass- a topicIF; the given typing topiclevel- the level to which superclasses are to be found- Returns:
- an unmodifiable collection of topicIF objects; the supertypes of the given topic
- Since:
- 1.2.5
-
getSubclasses
INTERNAL: Returns the topics which are subtypes of the topic klass.- Parameters:
klass- a topicIF; the given typing topic- Returns:
- a collection of topicIF objects; the subtypes of the given topic
-
getSubclasses
INTERNAL: Returns the topics which are subtypes of the given typing topic down to a given level. If the level is 1 only the immediate subclasses are returned, at level 2 immediate subclasses and their immediate subclasses are returned, and so on. To get all subclasses, regardless of level, use the variant of this method which has no numeric parameter.- Parameters:
klass- a topicIF; the given typing topiclevel- the level to which subclasses are to be found- Returns:
- a collection of topicIF objects; the subtypes of the given topic
- Since:
- 1.2.5
-
getSupertypes
INTERNAL: Returns the topic which types the singly typed objecttypedand all of its supertypes.- Parameters:
typed- a typedIF object- Returns:
- a collection of topicIF objects; the type and all supertypes of the given typedIF object.
-
getSupertypes
INTERNAL: Returns the topics which types of the objecttypedand all their supertypes.- Parameters:
typed- a topic- Returns:
- a collection of topicIF objects; the type and all supertypes of the given object
-
getSupertypes
INTERNAL: Returns the topics which types the objecttyped(if notexcludeTypesis set to true) and all their supertypes.- Parameters:
typed- a topicexcludeTypes- types of specified topic are not in returned collection- Returns:
- a collection of topicIF objects; the type and all supertypes of the given object
- Since:
- 1.1
-