Package ptolemy.kernel

Examples of ptolemy.kernel.ComponentEntity


            Iterator ports = contPort.connectedPortList().iterator();

            while (ports.hasNext()) {
                IOPort connectedPort = (IOPort) ports.next();
                ComponentEntity connectedEntity = (ComponentEntity) connectedPort
                        .getContainer();

                if (connectedPort.isOpaque() && !connectedEntity.isAtomic()
                        && connectedPort.isOutput()) {
                    // The port container of this receiver is
                    // connected to the outside of a boundary port.
                    // Now determine if this receiver's channel is
                    // connected to the boundary port.
View Full Code Here


                _insideBoundaryCacheIsOn = false;
                _isInsideBoundaryValue = false;
                return _isInsideBoundaryValue;
            }

            ComponentEntity innerEntity = (ComponentEntity) innerPort
                    .getContainer();

            if ((innerEntity != null) && !innerEntity.isAtomic()
                    && innerPort.isOpaque()) {
                // The containing receiver is contained by the port
                // of a composite actor.
                if (innerPort.isOutput() && !innerPort.isInput()) {
                    _isInsideBoundaryValue = true;
View Full Code Here

                _outsideBoundaryCacheIsOn = false;
                _isOutsideBoundaryValue = false;
                return _isOutsideBoundaryValue;
            }

            ComponentEntity innerEntity = (ComponentEntity) innerPort
                    .getContainer();

            if ((innerEntity != null) && !innerEntity.isAtomic()
                    && innerPort.isOpaque()) {
                // The containing receiver is contained by the port
                // of a composite actor.
                if (innerPort.isOutput() && !innerPort.isInput()) {
                    _isOutsideBoundaryValue = false;
View Full Code Here

        Figure result = null;
        Nameable container = getContainer();

        if (container instanceof CompositeEntity) {
            CompositeEntity myContainer = ((CompositeEntity) container);
            ComponentEntity entity = null;
            Iterator entities = myContainer.entityList().iterator();

            while (entities.hasNext()) {
                entity = (ComponentEntity) entities.next();
            }

            try {
                if (entity != null) {
                    // Look for an icon within the entity.
                    EditorIcon icon = null;
                    Iterator icons = entity.attributeList(EditorIcon.class)
                            .iterator();

                    while (icons.hasNext()) {
                        icon = (EditorIcon) icons.next();
                    }

                    if (icon != null) {
                        result = icon.createBackgroundFigure();
                    } else {
                        // If there is no icon, then maybe there is an
                        // _iconDescription attribute.
                        SingletonConfigurableAttribute description = (SingletonConfigurableAttribute) entity
                                .getAttribute("_iconDescription",
                                        SingletonConfigurableAttribute.class);

                        if (description != null) {
                            // Look for an icon description in my container.
View Full Code Here

            stringWriter.write("<group>\n");

            Iterator classes = classDefinitionList().iterator();

            while (classes.hasNext()) {
                ComponentEntity entity = (ComponentEntity) classes.next();
                entity.exportMoML(stringWriter, 1);
            }

            Iterator entities = entityList().iterator();

            while (entities.hasNext()) {
                ComponentEntity entity = (ComponentEntity) entities.next();
                entity.exportMoML(stringWriter, 1);
            }

            stringWriter.write("</group>");
            return stringWriter.toString();
        } catch (IOException ex) {
View Full Code Here

        public Iterator nodes(Object composite) {
            Locatable location = (Locatable) composite;
            Nameable container = location.getContainer();

            if (container instanceof ComponentEntity) {
                ComponentEntity entity = (ComponentEntity) container;
                return entity.portList().iterator();
            } else {
                return new NullIterator();
            }
        }
View Full Code Here

        LinkedList allActorList = new LinkedList();

        // Populate it.
        for (Iterator entities = container.deepEntityList().iterator(); entities
                .hasNext();) {
            ComponentEntity entity = (ComponentEntity) entities.next();

            // Fill allActorList with the list of things that we can schedule
            // FIXME: What if other things can be scheduled than actors?
            if (entity instanceof Actor) {
                allActorList.addLast(entity);
            }
        }

        // externalRates maps from external
        // ports to the number of tokens that that port
        // will produce or consume in each firing.
        // It gets populated with the fractional production ratios
        // and is used in the end to set final rates on external ports.
        // This map is initialized to zero.
        Map externalRates = new TreeMap(new DFUtilities.NamedObjComparator());

        // Initialize externalRates to zero.
        for (Iterator ports = container.portList().iterator(); ports.hasNext();) {
            IOPort port = (IOPort) ports.next();
            externalRates.put(port, Fraction.ZERO);
        }

        // An association between all the relations in a simulation and
        // and array of the maximum number of tokens that are ever
        // waiting on that relation.
        Map minimumBufferSize = new TreeMap(
                new DFUtilities.NamedObjComparator());

        // Initialize the buffer size of each relation to zero.
        for (Iterator relations = container.relationList().iterator(); relations
                .hasNext();) {
            Relation relation = (Relation) relations.next();
            minimumBufferSize.put(relation, Integer.valueOf(0));
        }

        // First solve the balance equations
        Map entityToFiringsPerIteration = _solveBalanceEquations(container,
                allActorList, externalRates);

        if (_debugging && VERBOSE) {
            _debug("Firing Ratios: " + entityToFiringsPerIteration.toString());
        }

        // A list that contains actors that do not fire.
        LinkedList deadActorList = new LinkedList();
        LinkedList liveActorList = new LinkedList();

        // Populate deadActorList.
        for (Iterator actors = allActorList.iterator(); actors.hasNext();) {
            ComponentEntity actor = (ComponentEntity) actors.next();

            // Remove this actor from the firing sequence if it will
            // not be fired.
            Fraction firing = (Fraction) entityToFiringsPerIteration.get(actor);

            if (_debugging && VERBOSE) {
                _debug("Actor " + actor.getName() + "fires "
                        + firing.getNumerator() + " times.");
            }

            if (firing.getNumerator() == 0) {
                if (_debugging && VERBOSE) {
View Full Code Here

                    continue;
                }

                SDFReceiver receiver = (SDFReceiver) receivers[channel][copy];
                IOPort connectedPort = receivers[channel][copy].getContainer();
                ComponentEntity connectedActor = (ComponentEntity) connectedPort
                        .getContainer();

                // Increment the number of waiting tokens.
                receiver._waitingTokens += createdTokens;
View Full Code Here

        List<ComponentEntity> entities = new LinkedList<ComponentEntity>();
        boolean needRefresh = false;
        for (int i = 0; i < rows.length; i++) {
            String replacementName = _getCellEditorValue((JPanel) _tableModel
                    .getValueAt(rows[i], 2));
            ComponentEntity entity = replacement.getEntity(replacementName);
            if (entity == null) {
                needRefresh = true;
            } else {
                entities.add(entity);
            }
View Full Code Here

                CompositeEntity actorLibrary = (CompositeEntity) configuration
                        .getEntity("actor library");
                CompositeEntity library = gtLibrary.getLibrary();
                for (Object entityObject : actorLibrary.entityList()) {
                    try {
                        ComponentEntity libraryEntity =
                            (ComponentEntity) entityObject;
                        ComponentEntity entity = (ComponentEntity) libraryEntity
                                .clone(library.workspace());
                        entity.setContainer(library);
                    } catch (Exception e) {
                        // Ignore this entity in the actor library because we
                        // don't know how to import it.
                    }
                }
View Full Code Here

TOP

Related Classes of ptolemy.kernel.ComponentEntity

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.