Class MirrorPort

    • Constructor Detail

      • MirrorPort

        public MirrorPort​(Workspace workspace)
                   throws IllegalActionException
        Construct a port 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 port.
        Throws:
        IllegalActionException - If port parameters cannot be initialized.
    • Method Detail

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the object into the specified workspace. This overrides the base class to unset the associated port. Users of this class are responsible for resetting it in their clone methods.
        Overrides:
        clone in class TypedIOPort
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new NamedObj.
        Throws:
        java.lang.CloneNotSupportedException - If any of the attributes cannot be cloned.
        See Also:
        NamedObj.exportMoML(java.io.Writer, int, String)
      • getAssociatedPort

        public MirrorPort getAssociatedPort()
        Return the associated port, or null if there is none.
        Returns:
        The associated port, or null if there is none.
        See Also:
        setAssociatedPort(MirrorPort)
      • setAssociatedPort

        public void setAssociatedPort​(MirrorPort port)
        Specify an associated port. Once this is specified, then any changes made to this port (its name, whether it is an input or output, and whether it is a multiport) are mirrored in the associated port, and any changes made in the associated port are mirrored here.
        Parameters:
        port - The associated port.
        See Also:
        getAssociatedPort()
      • setContainer

        public void setContainer​(Entity container)
                          throws IllegalActionException,
                                 NameDuplicationException
        Override the base class so that if the container is being set to null, then the associated port is also deleted (via a change request). Note that if the container of this port is changed to something other than null, there is no reasonable basis for changing the container of the associated port, so it is left unchanged.
        Overrides:
        setContainer in class IOPort
        Parameters:
        container - The proposed container.
        Throws:
        IllegalActionException - If the proposed container is not a ComponentEntity, doesn't implement Actor, or has no name, or the port and container are not in the same workspace. Or it's not null
        NameDuplicationException - If the container already has a port with the name of this port.
        See Also:
        Port.getContainer(), Port._checkContainer(Entity)
      • setInput

        public void setInput​(boolean isInput)
                      throws IllegalActionException
        Override the base class to also set the associated port, if there is one.
        Overrides:
        setInput in class IOPort
        Parameters:
        isInput - True to make this an input port.
        Throws:
        IllegalActionException - If changing the port status is not permitted.
      • setMultiport

        public void setMultiport​(boolean isMultiport)
                          throws IllegalActionException
        Override the base class to also set the associated port, if there is one.
        Overrides:
        setMultiport in class IOPort
        Parameters:
        isMultiport - True to make this a multiport.
        Throws:
        IllegalActionException - If changing the port status is not permitted.
      • setOutput

        public void setOutput​(boolean isOutput)
                       throws IllegalActionException
        Override the base class to also set the associated port, if there is one.
        Overrides:
        setOutput in class IOPort
        Parameters:
        isOutput - True to make this an output port.
        Throws:
        IllegalActionException - If changing the port status is not permitted.