Class PetriNetActor

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class PetriNetActor
    extends TypedCompositeActor
    A Petri net Actor

    As defined in the PetriNetDirector.java, a PetriNetActor is a directed and weighted graph G = (V, E) containing three kinds of nodes: Places p_i, Transitions t_i, and PetriNetActors PA_i, i.e., V = {p_i} union {t_i} union {PA_i} , where each PA_i itself is again defined as a PetriNetActor. Each node of V is called a component of the PetriNetActor G. A PetriNetActor is implemented as an extension of TypedCompositeActor. The current file contains two main methods: fire() and prefire(). More details of PetriNetActor can be found in PetriNetDirector.java.

    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Yuke Wang
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Constructor Detail

      • PetriNetActor

        public PetriNetActor()
        Construct a PetriNetActor in the default workspace with an empty string as its name. Add the actor to the workspace directory. Increment the version number of the workspace.
      • PetriNetActor

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

        public PetriNetActor​(CompositeEntity container,
                             java.lang.String name)
                      throws IllegalActionException,
                             NameDuplicationException
        Create a PetriNetActor 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 the entity cannot be contained by the proposed container.
        NameDuplicationException - If the name coincides with an entity already in the container.
    • Method Detail

      • prefire

        public boolean prefire()
                        throws IllegalActionException
        This method tests whether the PetriNetActor or its component contains any enabled Transitions or not. If any of the components is enabled, the method returns true, otherwise returns false.
        Specified by:
        prefire in interface Executable
        Overrides:
        prefire in class CompositeActor
        Returns:
        true or false, a PetriNetActor is ready to fire or not.
        Throws:
        IllegalActionException - If testReadyTransition throws exception.