Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.ChangeRequest


     *
     * @param lineName Name of line previously created.
     */
    protected void _removeLine(String lineName) {
        String moml = "<deleteProperty name=\"" + lineName + "\"/>";
        ChangeRequest request = new MoMLChangeRequest(this, getContainer(),
                moml) {
            protected void _execute() throws Exception {
                try {
                    super._execute();
                } catch (Exception e) {
View Full Code Here


                // requests.
                if (_changeRequests != null) {
                    Iterator requests = _changeRequests.iterator();

                    while (requests.hasNext()) {
                        ChangeRequest request = (ChangeRequest) requests.next();
                        container.requestChange(request);
                    }

                    _changeRequests = null;
                }
View Full Code Here

        }

        _readOutputsFromRefinement();

        if (_sendRequest) {
            ChangeRequest request = new ChangeRequest(this,
                    "choose a transition") {
                protected void _execute() throws KernelException,
                        IllegalActionException {
                    FSMActor controller = getController();
                    State currentState = controller.currentState();
                    chooseNextNonTransientState(currentState);
                }
            };

            request.setPersistent(false);
            container.requestChange(request);
        }
    }
View Full Code Here

        CompositeActor container = (CompositeActor) getContainer();

        if (_sendRequest) {
            _sendRequest = false;

            ChangeRequest request = new ChangeRequest(this, "make a transition") {
                protected void _execute() throws KernelException {
                    _sendRequest = true;

                    // The super.postfire() method is called here.
                    makeStateTransition();
                }
            };

            request.setPersistent(false);
            container.requestChange(request);
        }

        return _refinementPostfire;
    }
View Full Code Here

        final CompositeActor container = (CompositeActor) director
                .getContainer();

        // FIXME: These buffer sizes should be properties of input ports,
        // not properties of relations.
        ChangeRequest request = new ChangeRequest(this, "Record buffer sizes") {
            protected void _execute() throws KernelException {
                Iterator relations = container.relationList().iterator();

                while (relations.hasNext()) {
                    Relation relation = (Relation) relations.next();
                    Object bufferSizeObject = minimumBufferSizes.get(relation);

                    if (bufferSizeObject instanceof Integer) {
                        int bufferSize = ((Integer) bufferSizeObject)
                                .intValue();
                        DFUtilities.setOrCreate(relation, "bufferSize",
                                bufferSize);

                        if (_debugging) {
                            _debug("Adding bufferSize parameter to "
                                    + relation.getName() + " with value "
                                    + bufferSize);
                        }
                    } else if (bufferSizeObject instanceof String) {
                        String bufferSizeExpression = (String) bufferSizeObject;
                        DFUtilities.setOrCreate(relation, "bufferSize", "\""
                                + bufferSizeExpression + "\"");

                        if (_debugging) {
                            _debug("Adding bufferSize parameter to "
                                    + relation.getName() + " with expression "
                                    + bufferSizeExpression);
                        }
                    } else if (bufferSizeObject == null) {
                    } else {
                        throw new InternalErrorException(
                                "Invalid value found "
                                        + "in buffer size map.\nValue is of type "
                                        + bufferSizeObject.getClass().getName()
                                        + ".\nIt should be of type Integer or String.\n");
                    }
                }
            }
        };

        // Indicate that the change is non-persistent, so that
        // the UI doesn't prompt to save.
        request.setPersistent(false);
        container.requestChange(request);
    }
View Full Code Here

    protected void _saveFiringCounts(final Map entityToFiringsPerIteration) {
        Director director = (Director) getContainer();
        final CompositeActor container = (CompositeActor) director
                .getContainer();

        ChangeRequest request = new ChangeRequest(this,
                "Record firings per iteration") {
            protected void _execute() throws KernelException {
                Iterator entities = entityToFiringsPerIteration.keySet()
                        .iterator();

                while (entities.hasNext()) {
                    Entity entity = (Entity) entities.next();
                    int firingCount = ((Integer) entityToFiringsPerIteration
                            .get(entity)).intValue();
                    DFUtilities.setOrCreate(entity, "firingsPerIteration",
                            firingCount);

                    if (_debugging) {
                        _debug("Adding firingsPerIteration parameter to "
                                + entity.getName() + " with value "
                                + firingCount);
                    }
                }
            }
        };

        // Indicate that the change is non-persistent, so that
        // the UI doesn't prompt to save.
        request.setPersistent(false);
        container.requestChange(request);
    }
View Full Code Here

                // requests.
                if (_changeRequests != null) {
                    Iterator requests = _changeRequests.iterator();

                    while (requests.hasNext()) {
                        ChangeRequest request = (ChangeRequest) requests.next();
                        entity.requestChange(request);
                    }

                    _changeRequests = null;
                }
View Full Code Here

                // requests.
                if (_changeRequests != null) {
                    Iterator requests = _changeRequests.iterator();

                    while (requests.hasNext()) {
                        ChangeRequest request = (ChangeRequest) requests.next();
                        container.requestChange(request);
                    }

                    _changeRequests = null;
                }
View Full Code Here

     @exception IllegalActionException If the superclass throws it.
     */
    public void fire() throws IllegalActionException {
        super.fire();

        ChangeRequest doRandomize = new ChangeRequest(this, "randomize nodes") {
            protected void _execute() throws IllegalActionException {
                _randomize();
            }
        };

View Full Code Here

        _top.connect(_clock.output, _rec.input);
    }

    public void insertClock() {
        // Create an anonymous inner class
        ChangeRequest change = new ChangeRequest(_top, "test2") {
            public void _execute() throws IllegalActionException,
                    NameDuplicationException {
                _clock.output.unlinkAll();
                _rec.input.unlinkAll();
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.ChangeRequest

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.