Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.Nameable


                    IOPort weightPort = (IOPort) weightPorts.next();

                    if (!temporarySourcePortList.contains(weightPort)) {
                        temporarySourcePortList.add(weightPort);

                        Nameable weightPlace = weightPort.getContainer();

                        if (weightPlace instanceof PetriNetActor) {
                            if (weightPort.isOutput()) {
                                newRelationList.addAll(weightPort
                                        .insideRelationList());
View Full Code Here


                    IOPort weightPort = (IOPort) weightPorts.next();

                    if (!temporaryDestinationPortList.contains(weightPort)) {
                        temporaryDestinationPortList.add(weightPort);

                        Nameable weightPlace = weightPort.getContainer();

                        if (weightPlace instanceof PetriNetActor) {
                            if (weightPort.isOutput()) {
                                newRelationList.addAll(weightPort
                                        .linkedRelationList());
                            } else if (weightPort.isInput()) {
                                newRelationList.addAll(weightPort
                                        .insideRelationList());
                            }
                        } else if (weightPlace instanceof Place) {
                            // Don't do anything for Place
                        } else {
                            _debug("something wrong "
                                    + weightPlace.getFullName());
                        }
                    }
                }

                int weightNumber = _getWeightNumber(weights);
                LinkedList forwardConnectedPlaces = _findForwardConnectedPlaces(weights);
                Iterator forwardConnectedPlace = forwardConnectedPlaces
                        .iterator();
                int itemCount = 0;

                while (forwardConnectedPlace.hasNext()) {
                    Place forwardPlace = (Place) forwardConnectedPlace.next();
                    itemCount++;

                    int oldToken = forwardPlace.getMarking();
                    forwardPlace.increaseMarking(weightNumber);

                    if (_debugging) {
                        _debug("              the " + itemCount + " place is "
                                + forwardPlace.getFullName() + " old  "
                                + oldToken + " new "
                                + forwardPlace.getMarking());
                    }
                }
            }

            newRelationList.remove(weights);
        }

        LinkedList backRelationList = new LinkedList();
        Iterator inputPorts = transition.inputPortList().iterator();

        while (inputPorts.hasNext()) {
            IOPort inPort = (IOPort) inputPorts.next();
            backRelationList.addAll(inPort.linkedRelationList());
        }

        LinkedList temporarySourcePortList = new LinkedList();

        while (backRelationList.size() > 0) {
            IORelation weights = (IORelation) backRelationList.getFirst();

            if (weights != null) {
                Iterator weightPorts = weights.linkedSourcePortList()
                        .iterator();

                while (weightPorts.hasNext()) {
                    IOPort weightPort = (IOPort) weightPorts.next();

                    if (!temporarySourcePortList.contains(weightPort)) {
                        temporarySourcePortList.add(weightPort);

                        Nameable weightPlace = weightPort.getContainer();

                        if (weightPlace instanceof PetriNetActor) {
                            if (weightPort.isOutput()) {
                                backRelationList.addAll(weightPort
                                        .insideRelationList());
View Full Code Here

            throws IllegalActionException {
        Iterator actors = container.entityList().iterator();
        LinkedList readyComponentList = new LinkedList();

        while (actors.hasNext()) {
            Nameable component = (Nameable) actors.next();

            if (component instanceof PetriNetActor) {
                PetriNetActor petriNetActor = (PetriNetActor) component;

                if (petriNetActor.prefire()) {
View Full Code Here

            if (_debugging) {
                _debug(componentCount + " transitions ready");
            }

            int randomCount = generator.nextInt(componentCount);
            Nameable chosenTransition = (Nameable) components.get(randomCount);

            if (chosenTransition instanceof PetriNetActor) {
                PetriNetActor realPetriNetActor = (PetriNetActor) chosenTransition;
                _fireHierarchicalPetriNetOnce(realPetriNetActor);
            } else if (chosenTransition instanceof TypedCompositeActor) {
View Full Code Here

                IOPort weightPort = (IOPort) weightPorts.next();

                if (!temporaryDestinationPortList.contains(weightPort)) {
                    temporaryDestinationPortList.add(weightPort);

                    Nameable weightPlace = weightPort.getContainer();

                    if (weightPlace instanceof PetriNetActor) {
                        if (weightPort.isOutput()) {
                            newRelationList.addAll(weightPort
                                    .linkedRelationList());
View Full Code Here

                IOPort weightPort = (IOPort) weightPorts.next();

                if (!temporarySourcePortList.contains(weightPort)) {
                    temporarySourcePortList.add(weightPort);

                    Nameable weightPlace = weightPort.getContainer();

                    if (weightPlace instanceof PetriNetActor) {
                        if (weightPort.isOutput()) {
                            newRelationList.addAll(weightPort
                                    .insideRelationList());
View Full Code Here

        LinkedList componentList = director.findTransitions(this);
        Iterator components = componentList.iterator();

        while (components.hasNext()) {
            Nameable componentActor = (Nameable) components.next();

            if (componentActor instanceof TypedCompositeActor) {
                TypedCompositeActor transitionComponent = (TypedCompositeActor) componentActor;

                if (director.isTransitionReady(transitionComponent)) {
View Full Code Here

    public boolean prefire() throws IllegalActionException {
        if (_debugging) {
            _debug("HybridModalDirector: Called prefire().");
        }
        _resetAllReceivers();
        Nameable container = getContainer();
        if (container instanceof Actor) {
            Director executiveDirector = ((Actor) container)
                    .getExecutiveDirector();
            if (executiveDirector != null) {
                Time outTime = executiveDirector.getModelTime();
View Full Code Here

            ComponentRelation relation = (ComponentRelation) relations.next();
            Iterator linkedObjects = relation.linkedObjectsList().iterator();
            while (linkedObjects.hasNext()) {
                Object linkedObject = linkedObjects.next();

                Nameable relationContainer = relation.getContainer();
                if (linkedObject instanceof Relation) {

                    Relation linkedRelation = (Relation) linkedObject;
                    Nameable linkedObjectContainer = linkedRelation
                            .getContainer();
                    if (relationContainer != linkedObjectContainer
                            && linkedObjectContainer.getContainer() != relationContainer) {
                        relation.unlink(linkedRelation);
                    }
                } else {
                    // Must be a port.
                    Port linkedPort = (Port) linkedObject;
                    Nameable linkedObjectContainer = linkedPort.getContainer();
                    if (relationContainer != linkedObjectContainer
                            && linkedObjectContainer.getContainer() != relationContainer) {
                        linkedPort.unlink(relation);
                    }
                }
            }
        }
View Full Code Here

                return null;
            }

            _refinement = new TypedActor[size];

            Nameable container = getContainer();
            TypedCompositeActor containerContainer = (TypedCompositeActor) container
                    .getContainer();
            int index = 0;

            while (tokenizer.hasMoreTokens()) {
                String name = tokenizer.nextToken().trim();
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.Nameable

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.