step.typedef
Class Type

java.lang.Object
  |
  +--step.typedef.Type
All Implemented Interfaces:
StepDef

public class Type
extends Object
implements StepDef

Abstraction of a STEP type.


Field Summary
static String ARRAY_EXTENSION
          The name extension used for array types.
 
Method Summary
 boolean equals(Object o)
          Compare two types for equality.
 Type getParent()
          Get the parent of this type, if it is inherited.
 int hashCode()
          Get a hash code for this type.
 boolean isArrayType()
          Is this type an array type?
 boolean isParent(Type child)
           
 void setParent(Type parent)
          Set the parent for an inherited type.
 void setStepDL(String typeName)
          Set the STEP-DL name for this type.
 Type toArrayType()
          Get the array type with this type as its base.
 Type toBaseType()
          If this is an array type, get the base type.
 String toStepDL()
          Get the STEP-DL name for this type.
 String toString()
          Get this type as a string.
static Type v(StepObject o)
          Get the type for the given object.
static Type v(String name)
          Get the unique type with the given name.
static Type v(String name, Package pkg)
          Get the unique type with the given name in the given package.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ARRAY_EXTENSION

public static final String ARRAY_EXTENSION
The name extension used for array types.

See Also:
Constant Field Values
Method Detail

v

public static Type v(String name)
Get the unique type with the given name. If the type does not exist, it will be created.

See Also:
v(String,Package)

v

public static Type v(StepObject o)
Get the type for the given object. If the type does not exist, it will be created.

See Also:
v(String,Package)

v

public static Type v(String name,
                     Package pkg)
Get the unique type with the given name in the given package. If the type does not exist, it will be created.


getParent

public Type getParent()
Get the parent of this type, if it is inherited.

Returns:
the parent type, or null if there is no parent.

setParent

public void setParent(Type parent)
Set the parent for an inherited type.

Throws:
IllegalStateException - if a parent has already been set for this type.
IllegalArgumentException - if parent is null.

isParent

public boolean isParent(Type child)

isArrayType

public boolean isArrayType()
Is this type an array type?


toArrayType

public Type toArrayType()
Get the array type with this type as its base.


toBaseType

public Type toBaseType()
If this is an array type, get the base type.

Returns:
if this is an array type, the base type of the array.
Throws:
IllegalStateException - if the current type is not an array type.

equals

public boolean equals(Object o)
Compare two types for equality.

Two types are equal if they are the same object. This equality property is enforced by the creational pattern for types.

Overrides:
equals in class Object

hashCode

public int hashCode()
Get a hash code for this type.

Overrides:
hashCode in class Object

toString

public String toString()
Get this type as a string.

Overrides:
toString in class Object

toStepDL

public String toStepDL()
Get the STEP-DL name for this type.

Specified by:
toStepDL in interface StepDef

setStepDL

public void setStepDL(String typeName)
Set the STEP-DL name for this type.