Package ptolemy.domains.csp.kernel

Examples of ptolemy.domains.csp.kernel.ConditionalReceive


            ConditionalBranch[] branches = new ConditionalBranch[2];

            while (continueCDO) {
                // step 1
                guard = (_size < iDepth);
                branches[0] = new ConditionalReceive(guard, input, 0, 0);

                guard = (_size > 0);
                branches[1] = new ConditionalSend(guard, output, 0, 1,
                        _buffer[_readFrom]);
View Full Code Here


            _branchEnabled = true;
        } else {
            // Rendezvous with either the input or output
            // and act accordingly.
            ConditionalBranch[] branches = new ConditionalBranch[2];
            branches[0] = new ConditionalReceive(input, 0, 0);
            Token token = (Token) _buffer.get(0);
            branches[1] = new ConditionalSend(output, 0, 1, token);
            if (_debugging && _VERBOSE_DEBUGGING) {
                branches[0].addDebugListener(this);
                branches[1].addDebugListener(this);
View Full Code Here

            numberOfConditionals += grant.getWidth();
        }
        ConditionalBranch[] branches = new ConditionalBranch[numberOfConditionals];
        for (int i = 0; i < release.getWidth(); i++) {
            // The branch has channel i and ID i.
            branches[i] = new ConditionalReceive(release, i, i);
            if (_debugging && _VERBOSE_DEBUGGING) {
                branches[i].addDebugListener(this);
            }
        }
        if (_pool.size() > 0) {
View Full Code Here

                    "Barrier requires at least one input.");
        }
        ConditionalBranch[] branches = new ConditionalBranch[input.getWidth()];
        for (int i = 0; i < input.getWidth(); i++) {
            // The branch has channel i and ID i.
            branches[i] = new ConditionalReceive(input, i, i);
            if (_debugging && _VERBOSE_DEBUGGING) {
                branches[i].addDebugListener(this);
            }
        }
        if (_debugging) {
View Full Code Here

            while (continueCDO || (count < 25)) {
                ConditionalBranch[] branches = new ConditionalBranch[size];

                for (i = 0; i < size; i++) {
                    branches[i] = new ConditionalReceive(guards[i], input, i, i);
                }

                int successfulBranch = chooseBranch(branches);

                _branchCount[successfulBranch]++;
View Full Code Here

        for (int i = 0; i < _count.length; i++) {
            if (_count[i] > 0) {
                //ptActor.printDebug("Creating a ConditionalReceive to receive on port " +
                //        _indexToPort(i).getFullName() + ", channel " + _indexToChannelNumber(i));
                branches[i] = new ConditionalReceive(true, _indexToPort(i),
                        _indexToChannelNumber(i), i, _cbc);
            } else {
                branches[i] = new ConditionalReceive(false, _indexToPort(i),
                        _indexToChannelNumber(i), i, _cbc);
            }
        }

        return branches;
View Full Code Here

            _debug(new ExecEvent(this, ExecEvent.WAITING));

            ConditionalBranch[] requiredBranches = new ConditionalBranch[_numRequestInChannels];

            for (int i = 0; i < _numRequestInChannels; i++) {
                requiredBranches[i] = new ConditionalReceive(true,
                        requestInput, i, i);
            }

            br = chooseBranch(requiredBranches);

            if (br != -1) {
                IntToken token = (IntToken) requiredBranches[br].getToken();
                code = token.intValue();
                _winningPortChannelCode = new PortChannelCode(requestInput, br,
                        code);
            }

            //
            // State 2: Notify Contention Alarm of 1st Request
            //
            contendOutput.send(0, new Token());

            //
            // State 3: Wait for Contenders and Send Ack's
            //
            _debug(new ExecEvent(this, ExecEvent.ACCESSING));
            _losingPortChannelCodes = new LinkedList();

            boolean continueCDO = true;

            while (continueCDO) {
                requiredBranches = new ConditionalBranch[_numRequestInChannels + 1];

                for (int i = 0; i < _numRequestInChannels; i++) {
                    requiredBranches[i] = new ConditionalReceive(true,
                            requestInput, i, i);
                }

                int j = _numRequestInChannels;
                requiredBranches[j] = new ConditionalReceive(true,
                        contendInput, 0, j);

                br = chooseBranch(requiredBranches);

                // Contention Occurred...and might happen again
View Full Code Here

        }

        ConditionalBranch[] brchs = new ConditionalBranch[numReceivers];

        for (int i = 0; i < numReceivers; i++) {
            brchs[i] = new ConditionalReceive(_truth[i], inputPort, i, i);
        }

        int winner = chooseBranch(brchs);

        _winningBranch[winner] = true;
View Full Code Here

            int numBranches = _numInChannels + _numOutChannels;
            ConditionalBranch[] branches = new ConditionalBranch[numBranches];

            // Receive Branches
            for (int i = 0; i < _numInChannels; i++) {
                branches[i] = new ConditionalReceive(true, input, i, i);
            }

            // Send Branches
            for (int i = 0; i < _numOutChannels; i++) {
                branches[i + _numInChannels] = new ConditionalSend(true,
View Full Code Here

TOP

Related Classes of ptolemy.domains.csp.kernel.ConditionalReceive

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.