Class AtomicComponent

    • Constructor Detail

      • AtomicComponent

        public AtomicComponent​(CompositeEntity container,
                               java.lang.String name)
                        throws IllegalActionException,
                               NameDuplicationException
        Construct an entity with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This entity will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace. This constructor write-synchronizes on the workspace.
        Parameters:
        container - The container entity.
        name - The name of the entity.
        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

      • initialize

        public void initialize()
                        throws IllegalActionException
        Initialize the component, which in this base class means doing nothing and returning immediately. This is invoked once after preinitialize() and again whenever the component needs to be reinitialized.
        Specified by:
        initialize in interface Component
        Throws:
        IllegalActionException - If initialization cannot be completed (not thrown in this base class).
      • newPort

        public Port newPort​(java.lang.String name)
                     throws IllegalActionException,
                            NameDuplicationException
        Create a new port with the specified name. The container of the port is set to this entity. This overrides the base class to create an instance of MethodCallPort. Derived classes may override this to further constrain the ports. This method is write-synchronized on the workspace and increments its version number.
        Overrides:
        newPort in class ComponentEntity
        Parameters:
        name - The new port name.
        Returns:
        The new port
        Throws:
        IllegalActionException - If the argument is null.
        NameDuplicationException - If this entity already has a port with the specified name.
      • preinitialize

        public void preinitialize()
                           throws IllegalActionException
        Preinitialize the component, which in this base class means doing nothing and returning immediately. This is invoked exactly once per execution of a model, before any other methods in this interface are invoked.
        Specified by:
        preinitialize in interface Component
        Throws:
        IllegalActionException - If preinitialization cannot be completed (not thrown in this base class).
      • run

        public void run()
                 throws IllegalActionException
        Execute the component, which in this base class means doing nothing and returning immediately. This is invoked after preinitialize() and initialize(), and may be invoked repeatedly.
        Specified by:
        run in interface Component
        Throws:
        IllegalActionException - If the run cannot be completed (not thrown in this base class).
      • wrapup

        public void wrapup()
                    throws IllegalActionException
        Wrap up an execution, which in this base class means doing nothing and returning immediately. This method is invoked exactly once per execution of a model. It finalizes an execution, typically closing files, displaying final results, etc. If any other method from this interface is invoked after this, it must begin with preinitialize().
        Specified by:
        wrapup in interface Component
        Throws:
        IllegalActionException - If wrapup fails.
      • _addPort

        protected void _addPort​(Port port)
                         throws IllegalActionException,
                                NameDuplicationException
        Add a port to this entity. This overrides the base class to throw an exception if the added port is not an instance of MethodCallPort. This method should not be used directly. Call the setContainer() method of the port instead. This method does not set the container of the port to point to this entity. It assumes that the port is in the same workspace as this entity, but does not check. The caller should check. Derived classes may override this method to further constrain to a subclass of MethodCallPort. This method is not synchronized on the workspace, so the caller should be.
        Overrides:
        _addPort in class Entity
        Parameters:
        port - The port to add to this entity.
        Throws:
        IllegalActionException - If the port class is not acceptable to this entity, or the port has no name.
        NameDuplicationException - If the port name collides with a name already in the entity.