Package ptolemy.kernel

Examples of ptolemy.kernel.ComponentEntity


                    getDocumentation(configuration, className, context);
                    break;
                case 0:
                    // Build
                    // Need to create an effigy and tableau.
                    ComponentEntity effigy = context
                            .getEntity("DocBuilderEffigy");
                    if (effigy == null) {
                        try {
                            effigy = new DocBuilderEffigy(context,
                                    "DocBuilderEffigy");
                        } catch (KernelException exception) {
                            throw new InternalErrorException(exception);
                        }
                    }
                    if (!(effigy instanceof DocBuilderEffigy)) {
                        MessageHandler.error("Found an effigy named "
                                + "DocBuilderEffigy that "
                                + "is not an instance of DocBuilderEffigy!");
                    }
                    //((DocEffigy) effigy).setDocAttribute(docAttribute);
                    ComponentEntity tableau = ((Effigy) effigy)
                            .getEntity("DocBuilderTableau");
                    if (tableau == null) {
                        try {
                            tableau = new DocBuilderTableau(
                                    (DocBuilderEffigy) effigy,
View Full Code Here


     * @param taget the target of the documentation viewing
     */
    private void showDocAttributeTableau(DocAttribute docAttribute,
            NamedObj target) {
        // Need to create an effigy and tableau.
        ComponentEntity effigy = null;
        Effigy context = Configuration.findEffigy(target);
        if (_effigy == null) {
            if (context == null) {
                context = Configuration.findEffigy(target.getContainer());
                if (context == null) {
                    MessageHandler.error("Cannot find an effigy for "
                            + target.getFullName());
                }
                effigy = context.getEntity("DocEffigy");
            }
        } else {
            effigy = _effigy;
        }

        if (effigy == null) {
            try {
                effigy = new DocEffigy(context, "DocEffigy");
            } catch (KernelException exception) {
                throw new InternalErrorException(exception);
            }
        }
        if (!(effigy instanceof DocEffigy)) {
            MessageHandler.error("Found an effigy named DocEffigy that "
                    + "is not an instance of DocEffigy!");
        }
        ((DocEffigy) effigy).setDocAttribute(docAttribute);
        ComponentEntity tableau = ((Effigy) effigy).getEntity("DocTableau");
        if (tableau == null) {
            try {
                tableau = new DocTableau((DocEffigy) effigy, "DocTableau");

                ((DocTableau) tableau).setTitle("Documentation for "
View Full Code Here

        public Tableau createTableau(Effigy effigy) throws Exception {
            if (!(effigy instanceof PtolemyEffigy)) {
                return null;
            }

            ComponentEntity entity = effigy.getEntity("gtTableau");
            if (entity != null && entity instanceof GTTableau) {
                return (Tableau) entity;
            }

            NamedObj model = ((PtolemyEffigy) effigy).getModel();
View Full Code Here

            System.out.println(">> Creating Ports Receivers Map: ");
        }

        for (Iterator keysIterator = actorsThreadsMap.keySet().iterator(); keysIterator
                .hasNext();) {
            ComponentEntity actor = (ComponentEntity) keysIterator.next();

            HashMap portsReceiversMap = new HashMap();
            HashMap portTypes = new HashMap();

            Iterator allPorts = actor.portList().iterator();

            while (allPorts.hasNext()) {
                IOPort currentPort = (IOPort) allPorts.next();
                Receiver[][] receivers = new Receiver[0][0];

                if (currentPort.isOutput()) {
                    receivers = currentPort.getRemoteReceivers();
                }

                if (currentPort.isInput()) {
                    receivers = currentPort.getReceivers();
                }

                if (!currentPort.connectedPortList().isEmpty()) {
                    portTypes.put(currentPort.getName(),
                            ((TypedIOPort) currentPort).getType());
                }

                if (receivers.length > 0) {
                    if (VERBOSE) {
                        System.out.print("Port: "
                                + currentPort.getFullName()
                                + "\n"
                                + DistributedUtilities
                                        .receiversArrayToString(receivers));
                    }

                    if (currentPort.isOutput()) {
                        portsReceiversMap.put(currentPort.getName(),
                                createServicesReceiversMap(receivers));
                    }

                    if (currentPort.isInput()) {
                        portsReceiversMap.put(currentPort.getName(),
                                DistributedUtilities
                                        .convertReceiversToIntegers(receivers));
                    }
                }
            }

            ServiceItem server = ((ClientThread) actorsThreadsMap.get(actor))
                    .getService();
            DistributedActor distributedActor = (DistributedActor) server.service;

            try {
                if (VERBOSE) {
                    System.out.println("Setting connections to: "
                            + actor.getFullName() + " in: "
                            + server.serviceID.toString());
                    System.out.println("Setting port Types: "
                            + actor.getFullName() + " in: "
                            + server.serviceID.toString());
                }

                distributedActor.setConnections(portsReceiversMap);
                distributedActor.setPortTypes(portTypes);
View Full Code Here

            System.out.println("Distributing Actors Onto Servers");
        }

        for (Iterator keysIterator = actorsThreadsMap.keySet().iterator(); keysIterator
                .hasNext();) {
            ComponentEntity actor = (ComponentEntity) keysIterator.next();
            ServiceItem server = ((ClientThread) actorsThreadsMap.get(actor))
                    .getService();

            DistributedActor distributedActor = (DistributedActor) server.service;

            try {
                if (VERBOSE) {
                    System.out.println("Loading class: "
                            + actor.getClass().getName() + " in: "
                            + server.serviceID.toString());
                }

                distributedActor.loadMoML(actor.exportMoML());

                // Is this needed?
                distributedActor.initialize();
            } catch (RemoteException e) {
                KernelException.stackTraceToString(e);
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
            if (entity instanceof Actor) {
                allActorList.addLast(entity);
            }
View Full Code Here

            CompositeEntity container = (CompositeEntity) getContainer();

            // 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) {
View Full Code Here

    private void printActorsOntoServersMap() {
        System.out.println("Actors-Servers Map:");

        for (Iterator keysIterator = actorsThreadsMap.keySet().iterator(); keysIterator
                .hasNext();) {
            ComponentEntity actor = (ComponentEntity) keysIterator.next();
            ServiceItem server = ((ClientThread) actorsThreadsMap.get(actor))
                    .getService();
            System.out.println(server.serviceID.toString() + "\t <--- "
                    + actor.getFullName());
        }
    }
View Full Code Here

        if (container == null) {
            // Remove all tableaux.
            Iterator tableaux = entityList(Tableau.class).iterator();

            while (tableaux.hasNext()) {
                ComponentEntity tableau = (ComponentEntity) tableaux.next();
                tableau.setContainer(null);
            }

            // Remove all contained effigies as well.
            Iterator effigies = entityList(Effigy.class).iterator();

            while (effigies.hasNext()) {
                ComponentEntity effigy = (ComponentEntity) effigies.next();
                effigy.setContainer(null);
            }

            if (uri != null) {
                try {
                    URL url = uri.getURL();
View Full Code Here

        NamedObj toplevel = parser.parse(docBase, xmlFile);
        _workspace = toplevel.workspace();

        if ((_fragment != null) && !_fragment.trim().equals("")) {
            // A fragment was specified, so we should look inside.
            ComponentEntity inside = null;

            if (toplevel instanceof CompositeEntity) {
                inside = ((CompositeEntity) toplevel).getEntity(_fragment);
            }
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.