ptolemy.actor.util
Class ActorTypeUtil

java.lang.Object
  extended by ptolemy.actor.util.ActorTypeUtil

public class ActorTypeUtil
extends java.lang.Object

This class includes a number of utility methods and classes that simplify the generation of type constraints.

Since:
Ptolemy II 6.1
Version:
$Id: ActorTypeUtil.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Stephen neuendorffer
Accepted Rating:
Red (neuendor)
Proposed Rating:
Red (neuendor)

Nested Class Summary
private static class ActorTypeUtil.TypeableSizedArrayVariableTypeTerm
          An InequalityTerm representing an array types whose elements have the type of the specified typeable.
 
Constructor Summary
ActorTypeUtil()
           
 
Method Summary
static InequalityTerm arrayOf(Typeable typeable, Variable length)
          Return a type constraint that can be used to contrain another typeable object to have a type related to an array whose element type is the type of the specified typeable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActorTypeUtil

public ActorTypeUtil()
Method Detail

arrayOf

public static InequalityTerm arrayOf(Typeable typeable,
                                     Variable length)
                              throws IllegalActionException
Return a type constraint that can be used to contrain another typeable object to have a type related to an array whose element type is the type of the specified typeable. A typical usage of this is as follows:
      output.setTypeAtLeast(ArrayType.arrayOf(input, length));
  
where input and output are ports (this is the type constraint of SequenceToArray, for example), and length is a Variable that determines the length of the array. If length has a constant value, then the resulting type will have a length specified. If length does not have a constant value, the the type will have an indeterminate length.

Parameters:
typeable - A typeable.
length - Variable specifying the length of array.
Returns:
An InequalityTerm that can be passed to methods like setTypeAtLeast() of the Typeable interface.
Throws:
IllegalActionException - If the specified typeable cannot be set to an array type.