aminePlatform.kernel.ontology
Class Type

java.lang.Object
  extended byaminePlatform.kernel.ontology.CS
      extended byaminePlatform.kernel.ontology.Type
All Implemented Interfaces:
Node, java.io.Serializable, ToString
Direct Known Subclasses:
IndexedType, RelationType

public class Type
extends CS
implements java.io.Serializable

Title : ontology.Type Class

Description : Information on a Type can be its definition and/or its canon. Hence a Type object has two attributes : the inherited attribute 'description' which is used to store the definition and a new attribute for the canon (its specification is optional).

A particular type can be any combination of the two information: an 'empty' type without definition nor canon, a type with definition only, a type with canon only or a type with both definition and canon.

The attribute 'canon' is declared also as an Object to enable the use of any particular description scheme (we have developed tools for CG but other tools can be developed for other notations and used in combination with our definition of an Ontology).

Subclasses : RelationType

Copyright: Copyright (c) Adil KABBAJ, 2004-2009

See Also:
Serialized Form

Field Summary
 
Fields inherited from class aminePlatform.kernel.ontology.CS
S_CONTEXT, S_CSRULE, S_SITUATION, S_TYPE
 
Constructor Summary
Type()
          Create an 'empty' Type CS
Type(java.lang.Object definition)
          Create a new Type with the specified definition.
Type(java.lang.Object definition, java.lang.Object canon)
          Create a new Type with the specified definition and canon.
 
Method Summary
 void clear()
          Clear the content of the current Type
 void finalize()
          clear the fathers and children lists as well as the description of the current CS.
 java.util.ArrayList getArraySubTypes()
          Get all the subtypes of the current Type.
 java.util.ArrayList getArraySuperTypes()
          Get all the super types of the current Type.
 java.lang.Object getCanon()
          Get the canon of the current Type.
 java.util.Enumeration getComSubTypes(Type type2)
          Get (in a breadth-first order) the common subTypes of the current type and the specified type type2.
 java.util.Enumeration getComSuperTypes(Type type2)
          Get (in a breadth-first order) the common superTypes of the current type and the specified type type2.
 java.lang.Object getDefinition()
          Get the definition of the current Type.
 java.util.Enumeration getDirectSubTypes()
          Get the direct subtypes of the current Type.
 java.util.Enumeration getDirectSuperTypes()
          Get the direct super types of the current Type.
 java.util.Enumeration getIndividuals()
          Get the individuals of the current type.
 Type getMaxComSubType(Type type2)
          Get the maximal common subtype (a Type CS) of the current Type and the Type type2.
 Type getMinComSuperType(Type type2)
          For both minComSuperType and maxComSubType, a progressive breadth-first traversal of the ontology is done to get super(sub)types of both the current Type and the parameter Type type2.
 java.util.Enumeration getSubTypes()
          Get all the subtypes of the current Type.
 java.util.Enumeration getSuperTypes()
          Get all the super types of the current Type.
static boolean hasCanon(java.lang.Object obj)
          Check if the specified Object obj is a type and it has a canon
static boolean hasDefinition(java.lang.Object obj)
          Check if the specified Object obj is a defined type
static boolean isConceptType(java.lang.Object obj)
          Check if the specified Object obj is a Concept Type CS
static boolean isRelationType(java.lang.Object obj)
          Check if the specified Object obj is a Type CS
 boolean isSubType(Type type)
          Check if the current type is equal or is a subtype of the Type type.
 boolean isSuperType(Type type)
          Check if the current type is equal or is a superType of the specified Type.
static boolean isType(java.lang.Object obj)
          Check if the specified Object obj is a Type CS
 void removeCanon()
          Remove the description of the canon of the current Type.
 void removeDefinition()
          Remove the definition of the current Type.
 void setCanon(java.lang.Object description)
          Set the canon of the current Type to description.
 void setDefinition(java.lang.Object definition)
          Set the definition of the current Type to the specified definition.
protected  org.jdom.Element toContent(Ontology ontology)
          For the current type add the element that specifies its content to the XML ontology document.
protected  org.jdom.Element toCSKind(java.lang.String key)
          For the current type add the element that specifies its kind to the XML ontology document.
 java.lang.String toString(Lexicon lexicon)
          Implement the method toString(Lexicon) specified in the interface ToString.
 
Methods inherited from class aminePlatform.kernel.ontology.CS
addCSRule, addCSRule, addIncomeEdge, addOutcomeEdge, addSituation, canBeRemoved, copyNode, detach, getAdjacentNodes, getArrayOfChildren, getArrayOfFathers, getChildren, getContent, getCSRuleAt, getCSRules, getCSRulesAntecedent, getCSRulesConcequence, getDescription, getEdges, getFathers, getImmSubTypes, getImmSuperTypes2, getIncomeEdges, getLeftTopPoint, getMetaphors, getNbrChildren, getNbrCSRules, getNbrFathers, getNbrSituations, getNumberofEdges, getOutcomeEdges, getSituationAt, getSituations, getSituationsDescription, hasContentToDisplay, isAntecedent, isChild, isConceptType, isContext, isCS, isCSRule, isDescendant, isFather, isIndexedType, isIndividual, isMetaphor, isRelationType, isSituation, isType, link, removeCSRuleAt, removeDescription, removeLink, removeLink, removeLinkToSituation, removeSituationAt, setChildren, setDescription, setFathers, setIncomeEdges, setLeftTopPoint, setOutcomeEdges, setRectangle, toChildren, toDisplayString, toFathers, toLexicon, toXml
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Type

public Type()
Create an 'empty' Type CS


Type

public Type(java.lang.Object definition,
            java.lang.Object canon)
Create a new Type with the specified definition and canon.

Parameters:
definition - The definition of the current type. It could be null.
canon - The canon of the current type. It could be null.

Type

public Type(java.lang.Object definition)
Create a new Type with the specified definition.

Parameters:
definition - The definition of the current type. It could be null.
Method Detail

finalize

public void finalize()
Description copied from class: CS
clear the fathers and children lists as well as the description of the current CS.

Overrides:
finalize in class CS

toString

public java.lang.String toString(Lexicon lexicon)
                          throws ToStringException
Description copied from class: CS
Implement the method toString(Lexicon) specified in the interface ToString. It is in fact overriden in the sub-classes of CS

Specified by:
toString in interface ToString
Overrides:
toString in class CS
Parameters:
lexicon - Lexicon to use for the textual formulation
Returns:
a textual formulation of the current CS
Throws:
ToStringException

clear

public void clear()
Clear the content of the current Type

Overrides:
clear in class CS

isType

public static boolean isType(java.lang.Object obj)
Check if the specified Object obj is a Type CS

Parameters:
obj - An object
Returns:
true if obj is a Type CS

isConceptType

public static boolean isConceptType(java.lang.Object obj)
Check if the specified Object obj is a Concept Type CS

Parameters:
obj - An object
Returns:
true if obj is a Concept Type CS

isRelationType

public static boolean isRelationType(java.lang.Object obj)
Check if the specified Object obj is a Type CS

Parameters:
obj - An object
Returns:
true if obj is a Type CS

hasDefinition

public static boolean hasDefinition(java.lang.Object obj)
Check if the specified Object obj is a defined type

Parameters:
obj - An object
Returns:
true if the specified Object obj is a defined type

hasCanon

public static boolean hasCanon(java.lang.Object obj)
Check if the specified Object obj is a type and it has a canon

Parameters:
obj - An object
Returns:
true if the specified Object obj is a type and it has a canon

getDefinition

public java.lang.Object getDefinition()
Get the definition of the current Type.

Returns:
the definition of the current Type. The returned object should be casted to a particular description scheme (like CG or any other structure implemented in Java).

setDefinition

public void setDefinition(java.lang.Object definition)
Set the definition of the current Type to the specified definition.

Parameters:
definition - The (new) definition of the current Type

removeDefinition

public void removeDefinition()
Remove the definition of the current Type.


getCanon

public java.lang.Object getCanon()
Get the canon of the current Type.

Returns:
the canon of the current Type. The returned object should be casted to a particular description scheme.

setCanon

public void setCanon(java.lang.Object description)
Set the canon of the current Type to description.

Parameters:
description - The (new) description of the canon of the current Type

removeCanon

public void removeCanon()
Remove the description of the canon of the current Type.


getIndividuals

public java.util.Enumeration getIndividuals()
Get the individuals of the current type.

Returns:
an Enumeration over an ArrayList of Individual CSs for all the individuals of the current type. Return null if the type has no individual.

isSuperType

public boolean isSuperType(Type type)
Check if the current type is equal or is a superType of the specified Type. A progressive computation is done to determine the next superTypes and to check if the current Type is among the computed superTypes.

Parameters:
type - A Type CS
Returns:
true if the current type is equal or is a supertype of the type

isSubType

public boolean isSubType(Type type)
Check if the current type is equal or is a subtype of the Type type. In general, a Type has less fathers than children, that is why this method is defined in terms of isSuperType().

Parameters:
type - A Type CS
Returns:
true if the current type is equal or is a subtype of the specified type

getDirectSubTypes

public java.util.Enumeration getDirectSubTypes()
Get the direct subtypes of the current Type. Note that direct subTypes of a Type does not correspond (always) to its children list; a child could be, not only a subType CS, but also a situation or an individual and in both cases such a child is not considered as a subType.

Returns:
an Enumeration over an ArrayList of Type CSs that corresponds to the direct subtypes of the specified type. Return null if the current Type has no subType.

getSubTypes

public java.util.Enumeration getSubTypes()
Get all the subtypes of the current Type.

Returns:
an Enumeration over an ArrayList of Type CSs that correspond to all the subtypes of the current Type. Return null if the current Type has no subTypes.

getArraySubTypes

public java.util.ArrayList getArraySubTypes()
Get all the subtypes of the current Type.

Returns:
an ArrayList of Type CSs that correspond to all the subtypes of the current Type. Return null if the current Type has no subTypes.

getDirectSuperTypes

public java.util.Enumeration getDirectSuperTypes()
Get the direct super types of the current Type. Note that direct superTypes of a Type does not correspond (always) to its fathers list; a father could be a situation and in this case this father is not considered as a superType.

Returns:
an Enumeration over an ArrayList of Type CSs that corresponds to the direct super types of the current Type. Return null if the current Type has no superTypes.

getSuperTypes

public java.util.Enumeration getSuperTypes()
Get all the super types of the current Type.

Returns:
an Enumeration over an ArrayList of Type CSs that correspond to all the super types of the current Type. Return null if the current Type has no superTypes.

getArraySuperTypes

public java.util.ArrayList getArraySuperTypes()
Get all the super types of the current Type.

Returns:
an ArrayList of Type CSs that correspond to all the super types of the current Type. Return null if the current Type has no superTypes.

getMinComSuperType

public Type getMinComSuperType(Type type2)
For both minComSuperType and maxComSubType, a progressive breadth-first traversal of the ontology is done to get super(sub)types of both the current Type and the parameter Type type2. At each step (i.e. development of the next level), we check if the two arrays super(sub)Types have a common type. To avoid redundant comparisons, the elements of the first array correspond to couples : when we scan the first array and check for each element if it is contained also in the second array, we record in Index the index in the second array to indicate that the search has been done from the start of the second array to the element with the index and thus we avoid this search in the next check; we look only at the elements of the second array that come after the element at the index position.

Parameters:
type2 - A Type
Returns:
the minimal common supertype (a Type CS) of the current Type and type2 (the parameter). Return null if type2 is null or unknown or if there is no minimal common supertype for the current Type and type2.

getComSubTypes

public java.util.Enumeration getComSubTypes(Type type2)
Get (in a breadth-first order) the common subTypes of the current type and the specified type type2.

Parameters:
type2 - A Type CS
Returns:
in a breadth-first order the common subTypes of the current type and the specified type type2. Return null if the two types have no common subTypes.

getComSuperTypes

public java.util.Enumeration getComSuperTypes(Type type2)
Get (in a breadth-first order) the common superTypes of the current type and the specified type type2.

Parameters:
type2 - A Type CS
Returns:
in a breadth-first order the common superTypes of the current type and the specified type type2. Return null if the two types have no common superTypes.

getMaxComSubType

public Type getMaxComSubType(Type type2)
Get the maximal common subtype (a Type CS) of the current Type and the Type type2. See the comment associated to the method getMinComSuperType(Type) for the background of this operation.

Parameters:
type2 - A Type
Returns:
the maximal common subtype (a Type CS) of the current Type and the Type type2. Return null if type2 is null or unknown or if there is no maximal common subtype for the current Type and type2.

toCSKind

protected org.jdom.Element toCSKind(java.lang.String key)
For the current type add the element that specifies its kind to the XML ontology document.

Overrides:
toCSKind in class CS
Parameters:
key -
Returns:
cselement.

toContent

protected org.jdom.Element toContent(Ontology ontology)
For the current type add the element that specifies its content to the XML ontology document.

Overrides:
toContent in class CS
Parameters:
ontology -
Returns:
content.