Package ptolemy.kernel

Examples of ptolemy.kernel.ComponentEntity


                synchronized (this) {
                    try {
                        workspace().getWriteAccess();

                        // Entity most recently added.
                        ComponentEntity entity = null;

                        // Delete any previously contained entities.
                        // The strategy here is a bit tricky if this MirrorComposite
                        // is within a class definition (that is, if it has derived objects).
                        // The key is that derived objects do not permit deletion (via
                        // MoML) of contained entities. They cannot because this would
                        // violate the invariant of classes where derived objects
                        // always contain the same objects as their parents.
                        // Thus, if this is derived, we _cannot_ delete contained
                        // entities. Thus, we should not generate entity removal
                        // commands.
                        List priorEntities = entityList();
                        Iterator priors = priorEntities.iterator();

                        while (priors.hasNext()) {
                            ComponentEntity prior = (ComponentEntity) priors
                                    .next();

                            // If there is at least one more contained object,
                            // then delete this one.
                            // NOTE: How do we prevent the user from attempting to
                            // override the contained object in a subclass?
                            // It doesn't work to not remove this if the object
                            // is derived, because then derived objects won't
                            // track the prototype.
                            if (priors.hasNext()) {
                                prior.setContainer(null);
                            } else {
                                // The last entity in the entityList is
                                // the one that we just added.
                                entity = prior;
                            }
View Full Code Here


        }

        Iterator entities = entityList().iterator();

        while (entities.hasNext()) {
            ComponentEntity entity = (ComponentEntity) entities.next();
            entity.exportMoML(output, depth);
        }
    }
View Full Code Here

                        .next();
                portParameter.update();
            }

            String controlValue = container.control.getToken().toString();
            ComponentEntity refinement = container.getEntity(controlValue);
            if (!(refinement instanceof Refinement)) {
                refinement = container._default;
            }
            container._current = (Refinement) refinement;
View Full Code Here

        /**
         * Return the rendered visual representation of this node.
         */
        public Figure render(Object n) {
            ComponentEntity actor = (ComponentEntity) _controller
                    .getGraphModel().getSemanticObject(n);

            boolean isEllipse = actor instanceof ListenWire
                    || actor instanceof ListenFork
                    || actor instanceof ListenClock
                    || actor instanceof ListenSink
                    || actor instanceof ListenFeedBackDelay;

            BasicFigure f;

            if (isEllipse) {
                f = new BasicEllipse(0, 0, _size, _size);
                f.setFillPaint(Color.blue);
            } else {
                f = new BasicRectangle(0, 0, _size, _size);
                f.setFillPaint(Color.pink);
            }

            String label = actor.getName();
            LabelWrapper w = new LabelWrapper(f, label);
            w.setAnchor(SwingConstants.SOUTH);
            w.getLabel().setAnchor(SwingConstants.NORTH);
            return w;
        }
View Full Code Here

    public void deAnnotateGraph() {
        StringBuffer moml = new StringBuffer();
        Iterator entities = _model.entityList(ComponentEntity.class).iterator();

        while (entities.hasNext()) {
            ComponentEntity entity = (ComponentEntity) (entities.next());
            String entityDeletes = _deletesIfNecessary(entity);
            moml.append("<entity name=\"" + entity.getName() + "\">");

            if (entityDeletes != null) {
                moml.append(entityDeletes);
            }

            Iterator ports = entity.portList().iterator();

            while (ports.hasNext()) {
                Port port = (Port) (ports.next());
                String portDeletes = _deletesIfNecessary(port);
View Full Code Here

            CompositeActor model = (CompositeActor) object;

            // Loop over all the model instance classes.
            for (Iterator entities = model.deepEntityList().iterator(); entities
                    .hasNext();) {
                ComponentEntity entity = (ComponentEntity) entities.next();

                // recurse.
                copyAttributesOtherThanVariable(entity);
            }
        }
View Full Code Here

                    if (names != null && names.length() > 0) {
                        StringBuffer moml = new StringBuffer("<group>");
                        for (int i = 0; i < names.length(); i++) {
                            String name = ((StringToken) names.getElement(i))
                                    .stringValue();
                            ComponentEntity entity = ((CompositeEntity) container)
                                    .getEntity(name);
                            if (entity != null) {
                                moml.append("<entity name=\"");
                                moml.append(name);
                                moml.append("\">");
View Full Code Here

        _debug("---------------------------------------");

        Iterator actors = entityList.iterator();

        while (actors.hasNext()) {
            ComponentEntity actor = (ComponentEntity) actors.next();

            if (!actor.isAtomic()) {
                _debug(" **COMPOSITE** ");
            }

            _debug(" ");
        }
View Full Code Here

            // Look for the PtinyOSDirector inside the destination TinyOS node.
            NamedObj wirelessNode = destination.getContainer();
            if (wirelessNode instanceof CompositeEntity) {
                // Note: this relies on the fact that the MicaBoard
                // always contains a MicaCompositeActor
                ComponentEntity micaCompositeActor = ((CompositeEntity) wirelessNode)
                        .getEntity("MicaCompositeActor");
                if (micaCompositeActor instanceof MicaCompositeActor) {
                    // Get the director of the MicaCompositeActor.
                    Director director = ((MicaCompositeActor) micaCompositeActor)
                            .getDirector();
View Full Code Here

import ptolemy.kernel.ComponentEntity;

public class ComponentEntityTimeTest {
    public static void main(String args[]) {
        ComponentEntity entities[] = new ComponentEntity[10000];
        long startTime = System.currentTimeMillis();

        for (int i = 0; i < 10000; i++) {
            entities[i] = new ComponentEntity();
        }
        long stopTime = System.currentTimeMillis();
        Runtime runtime = Runtime.getRuntime();
        long totalMemory = runtime.totalMemory() / 1024;
        long freeMemory = runtime.freeMemory() / 1024;
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.