jdrew.oo.util
Class Types

java.lang.Object
  extended byjdrew.oo.util.Types

public class Types
extends java.lang.Object

This class represents the types that are defined within OO jDREW's built-in term typing system. While a set of unary predicates can be used to represent type sorts using a built-in system is considerably more efficient and allows for the easier creation of generalized built-in relations.

Title: OO jDREW

Description: Reasoning Engine for the Semantic Web - Supporting OO RuleML 0.88

Copyright: Copyright (c) 2005


Field Summary
static java.lang.String FLOAT
          The name for the floating point number type in the type lattice.
static int IFLOAT
          The integer code for the floating point number type.
static int IINTEGER
          The integer code for the integer type.
static int INOTHING
          The integer code for the bottom of the type lattice (Nothing).
static java.lang.String INTEGER
          The name for the integer type in the type lattice.
static int INUMERIC
          The integer code for the numeric base type.
static int IOBJECT
          The integer code for the base type of the type system (Thing) - this value should not be used; ITHING should be used instead.
static int ISTRING
          The integer code for the String base type.
static int ITHING
          The integer code for the base type of the type system (Thing).
static java.lang.String NOTHING
          The name for the bottom of the type lattice (Nothing).
static java.lang.String NUMERIC
          The name for the base type for all numeric types in the type lattice.
static java.lang.String OBJECT
          The type name for the base type of the type system (Thing).
static java.lang.String STRING
          The name for the string type in the type lattice.
static java.util.Vector types
          A vector that contains all of the type names.
 
Constructor Summary
Types()
           
 
Method Summary
static int createType(java.lang.String name, java.lang.String[] parents)
          Define a new type in the type system.
static int greatestLowerBound(int[] classes)
          Find the greatest lower bound of a list of types, identified by integer codes.
static int greatestLowerBound(int class1, int class2)
          Find the greatest lower bound of two types.
static java.lang.String greatestLowerBound(java.lang.String[] classes)
          Find the lower bound of a group of type.
static java.lang.String greatestLowerBound(java.lang.String class1, java.lang.String class2)
          Find the greatest lower bound of type types.
static boolean isa(int subClass, int superClass)
          This method is a synonyom for the isSubClass(int subClass, int superClass) method.
static boolean isSubClass(int subClass, int superClass)
          Check to see if the type identified by subClass is is a subclass of the type identified by superClass.
static boolean isSubClass(java.lang.String subClass, java.lang.String superClass)
          Check to see if type subClass is a sub-type of type superClass.
static boolean isSuperClass(int superClass, int subClass)
          Check to see if one type is the super-type of another.
static boolean isSuperClass(java.lang.String superClass, java.lang.String subClass)
          Check to see if one type is the super-type of another type.
static boolean isTypeDefined(int id)
          Check to see if a type is defined for the identification integer passed.
static boolean isTypeDefined(java.lang.String name)
          Check to see if there is a type with a specified name already defined.
static void reset()
          A method to reset the type system.
static int typeID(java.lang.String name)
          Get the type identification integer associated with a type name.
static java.lang.String typeName(int id)
          Get the type name for a specified type identification number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IOBJECT

public static final int IOBJECT
The integer code for the base type of the type system (Thing) - this value should not be used; ITHING should be used instead. This is kept for compatability purposes.

See Also:
Constant Field Values

ITHING

public static final int ITHING
The integer code for the base type of the type system (Thing).

See Also:
Constant Field Values

OBJECT

public static final java.lang.String OBJECT
The type name for the base type of the type system (Thing).

See Also:
Constant Field Values

INOTHING

public static final int INOTHING
The integer code for the bottom of the type lattice (Nothing). This type inherits from all other types in the system.

See Also:
Constant Field Values

NOTHING

public static final java.lang.String NOTHING
The name for the bottom of the type lattice (Nothing).

See Also:
Constant Field Values

NUMERIC

public static final java.lang.String NUMERIC
The name for the base type for all numeric types in the type lattice.

See Also:
Constant Field Values

INTEGER

public static final java.lang.String INTEGER
The name for the integer type in the type lattice.

See Also:
Constant Field Values

FLOAT

public static final java.lang.String FLOAT
The name for the floating point number type in the type lattice.

See Also:
Constant Field Values

STRING

public static final java.lang.String STRING
The name for the string type in the type lattice.

See Also:
Constant Field Values

IINTEGER

public static int IINTEGER
The integer code for the integer type.


IFLOAT

public static int IFLOAT
The integer code for the floating point number type.


INUMERIC

public static int INUMERIC
The integer code for the numeric base type.


ISTRING

public static int ISTRING
The integer code for the String base type.


types

public static java.util.Vector types
A vector that contains all of the type names. The index of a type in this vector is the integer code that is used for that type.

Constructor Detail

Types

public Types()
Method Detail

reset

public static void reset()
A method to reset the type system. Any clause related data structres that were created before a call to reset() cannot be used after the reset as the integer codes may no longer be valid.


createType

public static int createType(java.lang.String name,
                             java.lang.String[] parents)
Define a new type in the type system. The user must specify the name of the type and the names of all direct superclasses.

Parameters:
name - String The name of the new type to be defined.
parents - String[] An array containing the name of all direct superclasses of the type.
Returns:
int The integer code for the type, this is what is stored in a Term objects type instance variable.

typeName

public static java.lang.String typeName(int id)
Get the type name for a specified type identification number.

Parameters:
id - int The integer typy identification number of the type.
Returns:
String The name of the type defined by that

typeID

public static int typeID(java.lang.String name)
Get the type identification integer associated with a type name.

Parameters:
name - String The name of the type to get the identification number for.
Returns:
int The identification integer associated with the type.

isTypeDefined

public static boolean isTypeDefined(int id)
Check to see if a type is defined for the identification integer passed.

Parameters:
id - int The type identification integer.
Returns:
boolean true if there is a type with an identification integer equal to id, false otherwise.

isTypeDefined

public static boolean isTypeDefined(java.lang.String name)
Check to see if there is a type with a specified name already defined.

Parameters:
name - String The type name to check.
Returns:
boolean true if there is a type defined with with a name equal to the passed name, false otherwise.

isa

public static boolean isa(int subClass,
                          int superClass)
This method is a synonyom for the isSubClass(int subClass, int superClass) method.

Parameters:
subClass - int The integer identification number of the sub-type to test.
superClass - int The integer identification number of the super-type to test.
Returns:
boolean true if the type identified by subClass is a sub-type of the type identified by superClass, for if subClass and superClass are the same types, false otherwise.

isSubClass

public static boolean isSubClass(int subClass,
                                 int superClass)
Check to see if the type identified by subClass is is a subclass of the type identified by superClass.

Parameters:
subClass - int The integer identification number of the sub-type to test.
superClass - int The integer identification number of the super-type to test.
Returns:
boolean true if the type identified by subClass is a sub-type of the type identified by superClass, for if subClass and superClass are the same types, false otherwise.

isSubClass

public static boolean isSubClass(java.lang.String subClass,
                                 java.lang.String superClass)
Check to see if type subClass is a sub-type of type superClass.

Parameters:
subClass - String The sub-type to check.
superClass - String The super-type to check.
Returns:
boolean true if subClass is a sub-type of superClass, or if they are the same type, false otherwise.

isSuperClass

public static boolean isSuperClass(int superClass,
                                   int subClass)
Check to see if one type is the super-type of another.

Parameters:
superClass - int The integer identification of the super-type.
subClass - int The integer identification of the sub-type
Returns:
boolean true if the type identified by superClass is a super-type of the type identified by subClass, or if they are the same type, false otherwise.

isSuperClass

public static boolean isSuperClass(java.lang.String superClass,
                                   java.lang.String subClass)
Check to see if one type is the super-type of another type.

Parameters:
superClass - String The super-type to check.
subClass - String The sub-type to check.
Returns:
boolean true if superClass is a super-type of subClass, of if they are the same type, false otherwise.

greatestLowerBound

public static int greatestLowerBound(int class1,
                                     int class2)
Find the greatest lower bound of two types. Identified by integer codes.

Parameters:
class1 - int The integer code for type 1.
class2 - int The integer code for type 2.
Returns:
int The integer code of the greatest lower bound of the two types. If this is negative one (-1) then they have no real greatest lower bound, only the artificial lower bound of 'Nothing'.

greatestLowerBound

public static java.lang.String greatestLowerBound(java.lang.String class1,
                                                  java.lang.String class2)
Find the greatest lower bound of type types.

Parameters:
class1 - String The first type.
class2 - String The second type.
Returns:
String The name of the type that is the greatest lower bound of the two types. If this is "Nothing" then they have no real greatest lower bound, just the artificial lower bound of 'Nothing'.

greatestLowerBound

public static int greatestLowerBound(int[] classes)
Find the greatest lower bound of a list of types, identified by integer codes.

Parameters:
classes - int[] An array containing the integer codes of the types to find the greatest lower bound for.
Returns:
int The integer code for the type that is the greatest lower bound of the passed types. If this is negative one (-1) then the passed types have no real lower bound, just the artificial lower bound 'Nothing'.

greatestLowerBound

public static java.lang.String greatestLowerBound(java.lang.String[] classes)
Find the lower bound of a group of type.

Parameters:
classes - String[] An array containing the types to find the greatest lower bound of.
Returns:
String The name of the type that is the greatest lower bound of the types that are passed. If this is "Nothing" then the passed types have no real lower bound, only the artificial lower bound of 'Nothing'.