|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.data.type.StructuredType
public abstract class StructuredType
Base class for structured type. Making this an abstract class (not an interface) allows the methods to be protected. All the types of the same structured type (e.g. all the array types) must form a lattice. Each instance of a structured type must know how to compare itself with another instance of the same structured type, and compute the least upper bound and greatest lower bound. This class defines methods for these operations.
Subclasses should override clone() to do a deep cloning.
Red (cxh) |
Red (yuhong) |
Field Summary | |
---|---|
protected static int |
MAXDEPTHBOUND
Set up a bound for the max depth of structured types. |
Fields inherited from interface ptolemy.data.type.Type |
---|
HASH_INVALID, HASH_MAX |
Constructor Summary | |
---|---|
StructuredType()
|
Method Summary | |
---|---|
protected abstract int |
_compare(StructuredType type)
Compare this type with the specified type. |
protected abstract StructuredType |
_getRepresentative()
Return a static instance of this structured type. |
protected abstract StructuredType |
_greatestLowerBound(StructuredType type)
Return the greatest lower bound of this type with the specified type. |
protected abstract StructuredType |
_leastUpperBound(StructuredType type)
Return the least upper bound of this type with the specified type. |
Type |
add(Type rightArgumentType)
Return a new type which represents the type that results from adding a token of this type and a token of the given argument type. |
abstract java.lang.Object |
clone()
Return a deep copy of this StructuredType. |
int |
depth()
Return the depth of a structured type. |
Type |
divide(Type rightArgumentType)
Return a new type which represents the type that results from dividing a token of this type and a token of the given argument type. |
int |
getTypeHash()
Return a perfect hash for this type. |
abstract void |
initialize(Type type)
Set the elements that have declared type BaseType.UNKNOWN to the specified type. |
boolean |
isAbstract()
Return true if this type does not correspond to a single token class. |
Type |
modulo(Type rightArgumentType)
Return a new type which represents the type that results from moduloing a token of this type and a token of the given argument type. |
Type |
multiply(Type rightArgumentType)
Return a new type which represents the type that results from multiplying a token of this type and a token of the given argument type. |
Type |
one()
Return the type of the multiplicative identity for elements of this type. |
Type |
subtract(Type rightArgumentType)
Return a new type which represents the type that results from subtracting a token of this type and a token of the given argument type. |
void |
updateType(StructuredType newType)
Update this StructuredType to the specified Structured Type. |
Type |
zero()
Return the type of the additive identity for elements of this type. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ptolemy.data.type.Type |
---|
convert, equals, getTokenClass, isCompatible, isConstant, isInstantiable, isSubstitutionInstance, toString |
Field Detail |
---|
protected static final int MAXDEPTHBOUND
Constructor Detail |
---|
public StructuredType()
Method Detail |
---|
public Type add(Type rightArgumentType)
add
in interface Type
rightArgumentType
- The type to add to this type.
public abstract java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface Type
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- Not thrown in this base class.public Type divide(Type rightArgumentType)
divide
in interface Type
rightArgumentType
- The type to divide with this type.
public int depth()
public int getTypeHash()
getTypeHash
in interface Type
public boolean isAbstract()
isAbstract
in interface Type
public abstract void initialize(Type type)
type
- A Type.public Type modulo(Type rightArgumentType)
modulo
in interface Type
rightArgumentType
- The type to add to this type.
public Type multiply(Type rightArgumentType)
multiply
in interface Type
rightArgumentType
- The type to multiply by this type.
public Type one()
one
in interface Type
public Type subtract(Type rightArgumentType)
subtract
in interface Type
rightArgumentType
- The type to add to this type.
public void updateType(StructuredType newType) throws IllegalActionException
newType
- A StructuredType.
IllegalActionException
- If the specified type has a
different structure.public Type zero()
zero
in interface Type
protected abstract int _compare(StructuredType type)
type
- a StructuredType.
java.lang.IllegalArgumentException
- If the specified type is
not the same structured type as this one.protected abstract StructuredType _getRepresentative()
protected abstract StructuredType _greatestLowerBound(StructuredType type)
type
- a StructuredType.
java.lang.IllegalArgumentException
- If the specified type is
not the same structured type as this one.protected abstract StructuredType _leastUpperBound(StructuredType type)
type
- a StructuredType.
java.lang.IllegalArgumentException
- If the specified type is
not the same structured type as this one.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |