ptolemy.data.type
Interface Typeable

All Superinterfaces:
HasTypeConstraints
All Known Implementing Classes:
BaseUnit, ChannelPort, ChoiceParameter, ColorAttribute, Commutator.WidthDependentParameter, Commutator.WidthDependentParameter, Constraint, ContainerIgnoringAttribute, DDEIOPort, DebuggerParameter, DefaultDirectoryAttribute, DefaultModelAttribute, Distributor.WidthDependentParameter, Distributor.WidthDependentParameter, DoubleRangeParameter, Event.EventParameter, ExpertParameter, FileParameter, FilePortParameter, GTParameter, HierarchyFlatteningAttribute, IntRangeParameter, IterateOverArray.IteratePort, IterativeParameter, LocationAttribute, LocationParameter, MirrorPort, ModalPort, ModalPort, ModalRefinementPort, ModelExecutor.WrapperPort, ModelIOPort, ModelParameter, MultiCompositePort, NamedObjVariable, NameParameter, Parameter, ParameterPort, ParametersAttribute, PasswordAttribute, PortMatcher, PortParameter, Priority, PropertyParameter, PtalonExpressionParameter, PtalonParameter, PtinyOSNodeParameter, QueuedTypedIOPort, RefinementPort, RefinementPort, RefinementPort, RelationCollapsingAttribute, RelationHidingAttribute, SDFIOPort, SharedParameter, SingletonParameter, SizeAttribute, StringParameter, SynchronizeToRealtime, TableauParameter, TDLRefinementPort, TDLTaskPort, TemporaryVariable, TransformationMode, TransitionRefinementPort, TransitionRefinementPort, TypeAttribute, TypedIOPort, Variable, WindowPropertiesAttribute, WirelessIOPort

public interface Typeable
extends HasTypeConstraints

Interface for objects with types. This interface defines methods for setting and getting types and type constraints. Type constraints are represented as inequalities between Typeable objects.

Since:
Ptolemy II 0.4
Version:
$Id: Typeable.java 41477 2006-03-29 00:03:58Z cxh $
Author:
Yuhong Xiong, Xiaojun Liu, Edward A. Lee
See Also:
InequalityTerm
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (yuhong)

Method Summary
 Type getType()
          Return the type of this object.
 InequalityTerm getTypeTerm()
          Return an InequalityTerm representing this object.
 boolean isTypeAcceptable()
          Check whether the type of this object is acceptable.
 void setTypeAtLeast(InequalityTerm typeTerm)
          Constrain the type of this object to be equal to or greater than the type represented by the specified InequalityTerm.
 void setTypeAtLeast(Typeable lesser)
          Constrain the type of this object to be equal to or greater than the type of the argument.
 void setTypeAtMost(Type type)
          Constrain the type of this object to be equal to or less than the argument.
 void setTypeEquals(Type type)
          Set a type constraint that the type of this object equal the specified value.
 void setTypeSameAs(Typeable equal)
          Constrain the type of this object to be the same as the type of the argument.
 
Methods inherited from interface ptolemy.data.type.HasTypeConstraints
typeConstraints
 

Method Detail

getType

Type getType()
             throws IllegalActionException
Return the type of this object. An exception is thrown if the type cannot be determined. This can happen if the type of this object is dependent on some other objects whose value is not available yet.

Returns:
An instance of Type.
Throws:
IllegalActionException - If the type cannot be determined.

getTypeTerm

InequalityTerm getTypeTerm()
Return an InequalityTerm representing this object.

Returns:
An InequalityTerm.

isTypeAcceptable

boolean isTypeAcceptable()
Check whether the type of this object is acceptable.

Returns:
True if the type of this object is acceptable.

setTypeAtLeast

void setTypeAtLeast(Typeable lesser)
Constrain the type of this object to be equal to or greater than the type of the argument. Notice that this constraint is not enforced until type resolution is done, and is not enforced if type resolution is not done.

Parameters:
lesser - A Typeable object.

setTypeAtLeast

void setTypeAtLeast(InequalityTerm typeTerm)
Constrain the type of this object to be equal to or greater than the type represented by the specified InequalityTerm. Notice that this constraint is not enforced until type resolution is done, and is not enforced if type resolution is not done.

Parameters:
typeTerm - An InequalityTerm object.

setTypeAtMost

void setTypeAtMost(Type type)
                   throws IllegalActionException
Constrain the type of this object to be equal to or less than the argument. Because the argument is a concrete type, rather than a Typeable object (which may not yet have a type), the constraint is immediately enforced.

Parameters:
type - An instance of Type.
Throws:
IllegalActionException - If the type of this object already violates this constraint.

setTypeEquals

void setTypeEquals(Type type)
                   throws IllegalActionException
Set a type constraint that the type of this object equal the specified value.

Parameters:
type - An instance of Type.
Throws:
IllegalActionException - If the type of this object already violates this constraint.

setTypeSameAs

void setTypeSameAs(Typeable equal)
Constrain the type of this object to be the same as the type of the argument. Notice that this constraint is not enforced until type resolution is done, and is not enforced if type resolution is not done.

Parameters:
equal - The type that this object should be the same as.