Package ptolemy.actor

Examples of ptolemy.actor.QueueReceiver


        /** Return a new instance of QueueReceiver.
         *  @return A new instance of QueueReceiver.
         *  @see QueueReceiver
         */
        public Receiver newReceiver() {
            return new QueueReceiver();
        }
View Full Code Here


            Receiver[][] farReceivers = outputPort.getRemoteReceivers();

            for (int i = 0; i < farReceivers.length; i++) {
                if (i < outputPort.getWidthInside()) {
                    for (int j = 0; j < farReceivers[i].length; j++) {
                        QueueReceiver farReceiver = (QueueReceiver) farReceivers[i][j];
                        int rate = _getTokenConsumptionRate(farReceiver);

                        // According to the definition of deferrability,
                        // we need to find the minimum rate associated with
                        // this channel. -1 is actually the largest rate in
View Full Code Here

     *  in the receiver to the value specified by the director parameter
     *  <i>maximumReceiverCapacity</i> if that value is greater than 0.
     @return A new QueueReceiver.
     */
    public Receiver newReceiver() {
        QueueReceiver receiver = new QueueReceiver();

        try {
            int capacity = ((IntToken) maximumReceiverCapacity.getToken())
                    .intValue();

            if (capacity > 0) {
                receiver.setCapacity(capacity);
            }
        } catch (IllegalActionException e) {
            throw new InternalErrorException(e);
        }

View Full Code Here

            while (inputPorts.hasNext()) {
                IOPort inputPort = (IOPort) inputPorts.next();
                Receiver[][] deepReceivers = inputPort.deepGetReceivers();
                foundNotSatisfiedReceiver: for (int i = 0; i < deepReceivers.length; i++) {
                    for (int j = 0; j < deepReceivers[i].length; j++) {
                        QueueReceiver deepReceiver = (QueueReceiver) deepReceivers[i][j];
                        IOPort port = deepReceiver.getContainer();

                        // We don't consider the weird case where the input
                        // port is directly connected to an output port
                        // of the container.
                        if (port.getContainer() != getContainer()) {
                            int tokenConsumptionRate = _getTokenConsumptionRate(deepReceiver);

                            if (deepReceiver.size() < tokenConsumptionRate) {
                                isDeadlocked = false;
                                break foundNotSatisfiedReceiver;
                            }
                        }
                    }
View Full Code Here

            IOPort outputPort = (IOPort) outputPorts.next();
            Receiver[][] farReceivers = outputPort.getRemoteReceivers();

            for (int i = 0; i < farReceivers.length; i++) {
                for (int j = 0; j < farReceivers[i].length; j++) {
                    QueueReceiver farReceiver = (QueueReceiver) farReceivers[i][j];
                    IOPort port = farReceiver.getContainer();

                    // Having a self-loop doesn't make it deferrable.
                    if (port.getContainer() == outputPort.getContainer()) {
                        continue;
                    }

                    int tokenConsumptionRate = _getTokenConsumptionRate(farReceiver);

                    if ((tokenConsumptionRate >= 0)
                            && (farReceiver.size() >= tokenConsumptionRate)) {
                        deferrable = true;

                        // Here we find the maximum of the token numbers for
                        // the actor's output channels which satisfy the demand
                        // of destination actors while checking deferrability.
                        // The advantage of this is that it only adds a small
                        // additional operation for now. If later on we need
                        // this information, we don't need to do traversing
                        // again. The disadvantage is that 1) we can return
                        // from this method as soon as deferrable == true if we
                        // don't perform this additional operation. 2) We will
                        // not need this information if it turns out not all
                        // enabled actors are deferrable. Therefore another
                        // approach is to perform this operation only when
                        // needed, i.e., when all enabled actor are deferrable.
                        if (farReceiver.size() > maxSize) {
                            maxSize = farReceiver.size();
                        }
                    }
                }
            }
        }
View Full Code Here

        /** Return a new instance of QueueReceiver.
         *  @return A new instance of QueueReceiver.
         *  @see QueueReceiver
         */
        public Receiver newReceiver() {
            return new QueueReceiver();
        }
View Full Code Here

TOP

Related Classes of ptolemy.actor.QueueReceiver

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.