Package ptolemy.actor

Examples of ptolemy.actor.IOPort


        // Populate a map from identifier to the input port represented.
        _identifierToPort.clear();

        for (Iterator inputPorts = inputPortList().iterator(); inputPorts
                .hasNext();) {
            IOPort inPort = (IOPort) inputPorts.next();
            _setIdentifierToPort(inPort.getName(), inPort);
            _setIdentifierToPort(inPort.getName() + "_isPresent", inPort);
            _setIdentifierToPort(inPort.getName() + "Array", inPort);

            for (int i = 0; i < inPort.getWidth(); i++) {
                _setIdentifierToPort(inPort.getName() + "_" + i, inPort);
                _setIdentifierToPort(inPort.getName() + "_" + i + "_isPresent",
                        inPort);
                _setIdentifierToPort(inPort.getName() + "_" + i + "Array",
                        inPort);
            }
        }

        _inputTokenMap.clear();
View Full Code Here


     */
    public void readInputs() throws IllegalActionException {
        Iterator inPorts = inputPortList().iterator();

        while (inPorts.hasNext() && !_stopRequested) {
            IOPort p = (IOPort) inPorts.next();
            int width = p.getWidth();

            for (int channel = 0; channel < width; ++channel) {
                _readInputs(p, channel);
            }
        }
View Full Code Here

     */
    public void readOutputsFromRefinement() throws IllegalActionException {
        Iterator inPorts = inputPortList().iterator();

        while (inPorts.hasNext() && !_stopRequested) {
            IOPort p = (IOPort) inPorts.next();
            int width = p.getWidth();

            for (int channel = 0; channel < width; ++channel) {
                if (_isRefinementOutput(p, channel)) {
                    _readInputs(p, channel);
                }
View Full Code Here

                // Determine the boolean flags for each input port.
                Iterator inPorts = inputPortList().iterator();

                while (inPorts.hasNext()) {
                    IOPort inPort = (IOPort) inPorts.next();
                    boolean[] flags = new boolean[inPort.getWidth()];

                    if ((actors == null) || (actors.length == 0)) {
                        java.util.Arrays.fill(flags, false);
                        stateMap.put(inPort, flags);
                        continue;
                    }

                    Iterator relations = inPort.linkedRelationList().iterator();
                    int channelIndex = 0;

                    while (relations.hasNext()) {
                        IORelation relation = (IORelation) relations.next();
                        boolean linked = false;

                        for (int i = 0; i < actors.length; ++i) {
                            Iterator outports = actors[i].outputPortList()
                                    .iterator();

                            while (outports.hasNext()) {
                                IOPort outport = (IOPort) outports.next();
                                linked = linked | outport.isLinked(relation);
                            }
                        }

                        for (int j = 0; j < relation.getWidth(); ++j) {
                            flags[channelIndex + j] = linked;
View Full Code Here

    private void _createReceivers() throws IllegalActionException {
        try {
            workspace().getWriteAccess();
            Iterator inputPorts = inputPortList().iterator();
            while (inputPorts.hasNext()) {
                IOPort inPort = (IOPort) inputPorts.next();
                inPort.createReceivers();
            }
        } finally {
            workspace().doneWriting();
        }
    }
View Full Code Here

     @exception IllegalActionException If any port throws it.
     */
    private void _resetReceivers() throws IllegalActionException {
        Iterator inputPorts = inputPortList().iterator();
        while (inputPorts.hasNext()) {
            IOPort inPort = (IOPort) inputPorts.next();
            Receiver[][] receivers = inPort.getReceivers();
            for (int i = 0; i < receivers.length; i++) {
                if (receivers[i] != null) {
                    for (int j = 0; j < receivers[i].length; j++) {
                        if (receivers[i][j] != null) {
                            receivers[i][j].reset();
View Full Code Here

        }

        Iterator connectedPorts = trigger.sourcePortList().iterator();

        while (connectedPorts.hasNext()) {
            IOPort port = (IOPort) connectedPorts.next();

            if (port.isInput() && port instanceof WirelessIOPort) {
                // Found the port.
                Token propertiesValue = ((WirelessIOPort) port)
                        .getProperties(0);

                // Do not send properties if the port has no destinations.
View Full Code Here

        output.setTypeEquals(BaseType.UNKNOWN);

        Iterator connectedPorts = trigger.sourcePortList().iterator();

        while (connectedPorts.hasNext()) {
            IOPort port = (IOPort) connectedPorts.next();

            if (port.isInput() && port instanceof WirelessIOPort) {
                // Found the port.
                Entity container = (Entity) (port.getContainer());
                String channelName = ((WirelessIOPort) port).outsideChannel
                        .stringValue();
                CompositeEntity container2 = (CompositeEntity) container
                        .getContainer();
View Full Code Here

        // remaining tokens from other input ports.
        // Otherwise, this actor handles one port at each firing
        // and requests refiring at the current time to handle the
        // the remaining ports that have tokens.
        for (int i = 0; i < size; i++) {
            IOPort port = (IOPort) portArray[i];

            if (port.hasToken(0)) {
                if (firstAvailableToken == null) {
                    // we see the first available tokens
                    String label = port.getName();
                    firstAvailableToken = port.get(0);

                    UnionToken outputToken = new UnionToken(label,
                            firstAvailableToken);
                    output.send(0, outputToken);

                    while (port.hasToken(0)) {
                        label = port.getName();

                        Token value = port.get(0);
                        outputToken = new UnionToken(label, value);
                        output.send(0, outputToken);
                    }
                } else {
                    if (discard) {
                        // this token is not the first available token
                        // in this firing, consume and discard all tokens
                        // from the input channel
                        while (port.hasToken(0)) {
                            // Token token = port.get(0);
                            port.get(0);
                        }
                    } else {
                        // Refiring the actor to handle the other tokens
                        // that are still in ports.
                        getDirector().fireAtCurrentTime(this);
View Full Code Here

            // The following will throw an exception if the value is
            // not a RecordToken.
            Iterator connectedPorts = output.sinkPortList().iterator();

            while (connectedPorts.hasNext()) {
                IOPort port = (IOPort) connectedPorts.next();

                if (port.isOutput() && port instanceof WirelessIOPort) {
                    // Found the port.
                    ((WirelessIOPort) port).outsideTransmitProperties
                            .setToken(propertiesValue);
                }
            }
View Full Code Here

TOP

Related Classes of ptolemy.actor.IOPort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.