Package ptolemy.actor

Class TypedAtomicActor

    • Field Detail

      • _typesValid

        protected boolean _typesValid
        Whether or not the resolved types are still valid.
    • Constructor Detail

      • TypedAtomicActor

        public TypedAtomicActor()
        Construct an actor in the default workspace with an empty string as its name. The object is added to the workspace directory. Increment the version number of the workspace.
      • TypedAtomicActor

        public TypedAtomicActor​(Workspace workspace)
        Construct an actor in the specified workspace with an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. The object is added to the workspace directory. Increment the version number of the workspace.
        Parameters:
        workspace - The workspace that will list the entity.
      • TypedAtomicActor

        public TypedAtomicActor​(CompositeEntity container,
                                java.lang.String name)
                         throws IllegalActionException,
                                NameDuplicationException
        Create a new actor in the specified container with the specified name. The name must be unique within the container or an exception is thrown. The container argument must not be null, or a NullPointerException will be thrown.
        Parameters:
        container - The container.
        name - The name of this actor within the container.
        Throws:
        IllegalActionException - If this actor cannot be contained by the proposed container (see the setContainer() method).
        NameDuplicationException - If the name coincides with an entity already in the container.
    • Method Detail

      • attributeTypeChanged

        public void attributeTypeChanged​(Attribute attribute)
                                  throws IllegalActionException
        React to a change in the type of an attribute. This method is called by a contained attribute when its type changes. In this base class, the method informs the director to invalidate type resolution, if the director is not null. Thus, by default, attribute type changes cause type resolution to be redone at the next opportunity. If an actor does not allow attribute types to change, then it should override this method.
        Overrides:
        attributeTypeChanged in class NamedObj
        Parameters:
        attribute - The attribute whose type changed.
        Throws:
        IllegalActionException - Not thrown in this base class. Derived classes can throw this exception if type change is not allowed.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        clone() is not supported, call clone(Workspace workspace) instead. Usually it is a mistake for an actor to have a clone() method and call super.clone(), instead the actor should have a clone(Workspace workspace) method and call super.clone(workspace).
        Overrides:
        clone in class NamedObj
        Returns:
        A new NamedObj.
        Throws:
        java.lang.CloneNotSupportedException - Always thrown.
      • isBackwardTypeInferenceEnabled

        public boolean isBackwardTypeInferenceEnabled()
        Return true if backward type inference is enabled in the first opaque composite actor up the hierarchy, or false otherwise.
        Specified by:
        isBackwardTypeInferenceEnabled in interface TypedActor
        Returns:
        true If backward type inference is enabled, or false otherwise.
      • typeConstraints

        public final java.util.Set<Inequality> typeConstraints()
        Return the type constraints of this actor. The constraints have the form of a list of inequalities that are gathered by calling a set of protected non-final methods that can be overridden for customization. First, _customTypeConstraints() is called. This method is defined as an empty stub in the base class, that is to be overridden by subclasses that require a specific set of constraints to be setup. Second, _defaultTypeConstraints() is called. Its purpose is to setup type constraints between inputs and outputs that have no types declared. It ensures that outputs are greater than or equal to inputs, meaning that lossless conversion is possible on the tokens that pass through the actor. Finally, _containedTypeConstraints() is called to collect all type constraints that are stored in the contained Typeables. Note that all constraints are cached and only recomputed if necessary. This method is read-synchronized on the workspace.
        Specified by:
        typeConstraints in interface TypedActor
        Returns:
        A list of instances of Inequality.
        See Also:
        Inequality
      • typeConstraintList

        @Deprecated
        public java.util.List<Inequality> typeConstraintList()
        Deprecated.
        Use typeConstraints().
        Return the type constraints of this variable. The constraints include the ones explicitly set to this variable, plus the constraint that the type of this variable must be no less than its current type, if it has one. The constraints are a list of inequalities.
        Returns:
        a list of Inequality objects.
        See Also:
        Inequality
      • _containedTypeConstraints

        protected java.util.Set<Inequality> _containedTypeConstraints()
        Collect all type constraints from contained Typeables (ports, variables, and parameters).
        Returns:
        A set of type constraints
      • _defaultTypeConstraints

        protected java.util.Set<Inequality> _defaultTypeConstraints()
        Return the default type constraints. These constraints involve only undeclared ports and require outputs to be greater than or equal to inputs. In addition, if backward type inference is enabled, then also establish constraint that require inputs to be greater than or equal to outputs. With backward type inference, the types of undeclared inputs and outputs are unified. Override this method to eliminate the default type constraints, or to specify different ones.
        Returns:
        A set of type constraints
      • _customTypeConstraints

        protected java.util.Set<Inequality> _customTypeConstraints()
        Empty stub to be used for setting up custom type constraints for subclasses of this actor.
        Returns:
        null
      • _fireAt

        protected void _fireAt​(Time time)
                        throws IllegalActionException
        Request a firing of this actor at the specified time and throw an exception if the director does not agree to do it at the requested time. This is a convenience method provided because many actors need it.
        Parameters:
        time - The requested time.
        Throws:
        IllegalActionException - If the director does not agree to fire the actor at the specified time, or if there is no director.
      • _fireAt

        protected void _fireAt​(double time)
                        throws IllegalActionException
        Request a firing of this actor at the specified time and throw an exception if the director does not agree to do it at the requested time. This is a convenience method provided because many actors need it.
        Parameters:
        time - The requested time, as a double.
        Throws:
        IllegalActionException - If the director does not agree to fire the actor at the specified time, or if there is no director.