notio
Class RelationTypeHierarchy

java.lang.Object
  |
  +--notio.TypeHierarchy
        |
        +--notio.RelationTypeHierarchy

public class RelationTypeHierarchy
extends notio.TypeHierarchy
implements java.io.Serializable

The relation type hierarchy class.

See Also:
Serialized Form

Field Summary
static java.lang.String ABSURD_TYPE_LABEL
          The predefined type label for the absurd type.
static java.lang.String UNIVERSAL_TYPE_LABEL
          The predefined type label for the universal type.
 
Constructor Summary
RelationTypeHierarchy()
          Constructs a new RelationTypeHierarchy.
 
Method Summary
 void addSubTypesToType(RelationType subjectType, RelationType[] newSubTypes)
          Adds the specified list of subtypes as sub types to the subject type.
 void addSubTypeToType(RelationType subjectType, RelationType newSubType)
          Adds the specified subtype to the subject type.
 void addSuperTypesToType(RelationType subjectType, RelationType[] newSuperTypes)
          Adds the specified list of supertypes as super types to the subject type.
 void addSuperTypeToType(RelationType subjectType, RelationType newSuperType)
          Adds the specified supertype to the subject type.
 void addTypeToHierarchy(RelationType newType)
          Adds a new type to this hierarchy with the Universal type as its only supertype, and the Absurd type as its only subtype.
 void addTypeToHierarchy(RelationType newType, RelationType[] supertypes, RelationType[] subtypes)
          Adds a new type to the hierarchy with the specified supertypes and subtypes.
 void addTypeToHierarchy(RelationType newType, RelationType supertype, RelationType subtype)
          Adds a new type to this hierarchy with the specified supertype and subtype.
 boolean getCaseSensitiveLabels()
          Returns true if the processing of type labels in this hierarchy is case-sensitive.
 RelationType[] getImmediateSubTypesOf(RelationType subjectType)
          Returns the immediate subtypes of the subject type in no particular order.
 RelationType[] getImmediateSuperTypesOf(RelationType subjectType)
          Returns the immediate subtypes of the subject type in no particular order.
 RelationType[] getProperSubTypesOf(RelationType subjectType)
          Returns all the subtypes of the subject type, not just the immediate subtypes, in no particular order.
 RelationType[] getProperSuperTypesOf(RelationType subjectType)
          Returns all the supertypes of the subject type, not just the immediate supertypes, in no particular order.
 RelationType getTypeByLabel(java.lang.String label)
          Looks up and returns the type object associated with the specified label.
 RelationType[] getUnlabelledTypes()
          Returns all unlabelled types in this hierarchy in no particular order.
 boolean isProperSubTypeOf(RelationType subject, RelationType object)
          Determines whether subject is a subtype of object.
 boolean isProperSuperTypeOf(RelationType subject, RelationType object)
          Determines whether subject is a proper supertype of object.
 boolean isSubTypeOf(RelationType subject, RelationType object)
          Determines whether subject is a subtype of object.
 boolean isSuperTypeOf(RelationType subject, RelationType object)
          Determines whether subject is a supertype of object.
 void removeTypeFromHierarchy(RelationType deadType)
          Removes a type from this hierarchy.
 void setCaseSensitiveLabels(boolean flag)
          Sets a flag indicating whether or not the processing of type labels within this hierarchy is case-sensitive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIVERSAL_TYPE_LABEL

public static final java.lang.String UNIVERSAL_TYPE_LABEL
The predefined type label for the universal type.

ABSURD_TYPE_LABEL

public static final java.lang.String ABSURD_TYPE_LABEL
The predefined type label for the absurd type.
Constructor Detail

RelationTypeHierarchy

public RelationTypeHierarchy()
Constructs a new RelationTypeHierarchy.
Method Detail

addTypeToHierarchy

public void addTypeToHierarchy(RelationType newType,
                               RelationType[] supertypes,
                               RelationType[] subtypes)
                        throws TypeAddError,
                               TypeChangeError
Adds a new type to the hierarchy with the specified supertypes and subtypes.
Parameters:
newType - the type being added.
supertypes - the array of supertypes to be used, or null (assumes universal type as only supertype).
subtypes - the array of subtypes to be used, or null (assumes absurd type as only subtype).
Throws:
TypeAddError - if type label is already in use by another type.
TypeChangeError - if specified supertypes or subtypes are not in hierarchy, or if addition of type creates a type order conflict.

addTypeToHierarchy

public void addTypeToHierarchy(RelationType newType,
                               RelationType supertype,
                               RelationType subtype)
                        throws TypeAddError,
                               TypeChangeError
Adds a new type to this hierarchy with the specified supertype and subtype.
Parameters:
newType - the type being added.
supertype - the single supertype to be used, or null (assumes universal type as subtype).
subtype - the single subtype to be used, or null (assumes absurd type as subtype).
Throws:
TypeAddError - if type label is already in use by another type.
TypeChangeError - if specified supertypes or subtypes are not in hierarchy, or if addition of a type creates a type order conflict.

addTypeToHierarchy

public void addTypeToHierarchy(RelationType newType)
                        throws TypeAddError
Adds a new type to this hierarchy with the Universal type as its only supertype, and the Absurd type as its only subtype. Note that unlike the other versions of this method, this does not throw notio.TypeChangeError since the Universal and Absurd types are always present in the hierarchy.
Parameters:
newType - the type being added.
Throws:
TypeAddError - if type label is already in use by another type.

addSuperTypesToType

public void addSuperTypesToType(RelationType subjectType,
                                RelationType[] newSuperTypes)
                         throws TypeChangeError
Adds the specified list of supertypes as super types to the subject type.
Parameters:
subjectType - the type having supertypes added.
newSuperTypes - the array of types to be added as supertypes.
Throws:
TypeChangeError - if specified supertypes are not in hierarchy, or if addition of supertypes creates a type order conflict.

addSuperTypeToType

public void addSuperTypeToType(RelationType subjectType,
                               RelationType newSuperType)
                        throws TypeChangeError
Adds the specified supertype to the subject type.
Parameters:
subjectType - the type having a supertype added.
newSuperType - the supertype to be added.
Throws:
TypeChangeError - if specified supertype is not in hierarchy or, if addition of the supertype creates a type order conflict.

addSubTypesToType

public void addSubTypesToType(RelationType subjectType,
                              RelationType[] newSubTypes)
                       throws TypeChangeError
Adds the specified list of subtypes as sub types to the subject type.
Parameters:
subjectType - the type having subtypes added.
newSubTypes - the array of types to be added as subtypes.
Throws:
TypeChangeError - if specified subtypes are not in hierarchy, or if addition of subtypes creates a type order conflict.

addSubTypeToType

public void addSubTypeToType(RelationType subjectType,
                             RelationType newSubType)
                      throws TypeChangeError
Adds the specified subtype to the subject type.
Parameters:
subjectType - the type having a subtype added.
newSubType - the subtype to be added.
Throws:
TypeChangeError - if specified subtype is not in hierarchy or, if addition of the subtype creates a type order conflict.

removeTypeFromHierarchy

public void removeTypeFromHierarchy(RelationType deadType)
                             throws TypeRemoveError
Removes a type from this hierarchy.
Parameters:
deadType - the type being removed.
Throws:
TypeRemoveError - if specified type is not in hierarchy

getTypeByLabel

public RelationType getTypeByLabel(java.lang.String label)
Looks up and returns the type object associated with the specified label.
Parameters:
label - the label used to lookup.
Returns:
the type associated with the label or null if non-existant.

getUnlabelledTypes

public RelationType[] getUnlabelledTypes()
Returns all unlabelled types in this hierarchy in no particular order.
Returns:
an array of the unlabelled types in this hierarchy, possibly empty.

getProperSuperTypesOf

public RelationType[] getProperSuperTypesOf(RelationType subjectType)
Returns all the supertypes of the subject type, not just the immediate supertypes, in no particular order.
Parameters:
subjectType - the type whose supertypes will be returned.
Returns:
an array of the supertypes of the parent type, possibly empty.

getProperSubTypesOf

public RelationType[] getProperSubTypesOf(RelationType subjectType)
Returns all the subtypes of the subject type, not just the immediate subtypes, in no particular order.
Parameters:
subjectType - the type whose subtypes will be returned.
Returns:
an array of the subtypes of the subject type, possibly empty.

getImmediateSuperTypesOf

public RelationType[] getImmediateSuperTypesOf(RelationType subjectType)
Returns the immediate subtypes of the subject type in no particular order.
Parameters:
subjectType - the type whose immediate subtypes will be returned.
Returns:
an array of the immediate subtypes of the subject type, possibly empty.

getImmediateSubTypesOf

public RelationType[] getImmediateSubTypesOf(RelationType subjectType)
Returns the immediate subtypes of the subject type in no particular order.
Parameters:
subjectType - the type whose immediate subtypes will be returned.
Returns:
an array of the immediate subtypes of the subject type, possibly empty.

isSubTypeOf

public boolean isSubTypeOf(RelationType subject,
                           RelationType object)
Determines whether subject is a subtype of object.
Parameters:
subject - the potential subtype being tested.
object - the potential supertype being tested.
Returns:
true if subject is a subtype of object.

isSuperTypeOf

public boolean isSuperTypeOf(RelationType subject,
                             RelationType object)
Determines whether subject is a supertype of object.
Parameters:
subject - the potential supertype being tested.
object - the potential subtype being tested.
Returns:
true if subject is a supertype of object.

isProperSubTypeOf

public boolean isProperSubTypeOf(RelationType subject,
                                 RelationType object)
Determines whether subject is a subtype of object.
Parameters:
subject - the potential subtype being tested.
object - the potential supertype being tested.
Returns:
true if subject is a subtype of object.

isProperSuperTypeOf

public boolean isProperSuperTypeOf(RelationType subject,
                                   RelationType object)
Determines whether subject is a proper supertype of object.
Parameters:
subject - the potential supertype being tested.
object - the potential subtype being tested.
Returns:
true if subject is a supertype of object.

setCaseSensitiveLabels

public void setCaseSensitiveLabels(boolean flag)
Sets a flag indicating whether or not the processing of type labels within this hierarchy is case-sensitive.
Parameters:
flag - the flag setting for case-sensitivity.

getCaseSensitiveLabels

public boolean getCaseSensitiveLabels()
Returns true if the processing of type labels in this hierarchy is case-sensitive.
Returns:
true if the processing of type labels in this hierarchy is case-sensitive.


Copyright 1998-1999 Finnegan Southey