Package ptolemy.distributed.actor

Examples of ptolemy.distributed.actor.DistributedDirector


            System.out.println("Received Connections: "
                    + connections.toString());
        }

        int number = 0;
        DistributedDirector director = (DistributedDirector) compositeActor
                .getDirector();

        for (Iterator portsIterator = connections.keySet().iterator(); portsIterator
                .hasNext();) {
            String portName = (String) portsIterator.next();
            IOPort port = (IOPort) ((ComponentEntity) actor).getPort(portName);
            DistributedTypedIORelation relation = null;

            if (port.isInput()) {
                Integer[][] integerReceivers = (Integer[][]) connections
                        .get(portName);

                if (VERBOSE) {
                    System.out.println("Receivers received for "
                            + portName
                            + "\n"
                            + DistributedUtilities
                                    .integersArrayToString(integerReceivers));
                }

                for (int i = 0; i < integerReceivers.length; i++) {
                    try {
                        relation = (DistributedTypedIORelation) compositeActor
                                .newRelation(portName + number);
                        number += 1;

                        if (VERBOSE) {
                            System.out.println("> for Port : " + portName
                                    + " created Relation: "
                                    + relation.getName());
                        }

                        port.link(relation);
                    } catch (NameDuplicationException e) {
                        KernelException.stackTraceToString(e);
                    } catch (IllegalActionException e) {
                        KernelException.stackTraceToString(e);
                    }
                }

                director.setListOfIds(DistributedUtilities
                        .convertIntegersToList(integerReceivers));

                try {
                    port.createReceivers();
                } catch (IllegalActionException e) {
                    KernelException.stackTraceToString(e);
                }

                if (VERBOSE) {
                    System.out.println("Receivers created for "
                            + portName
                            + "\n"
                            + DistributedUtilities.receiversArrayToString(port
                                    .getReceivers()));
                }
            }

            if (port.isOutput()) {
                try {
                    relation = (DistributedTypedIORelation) compositeActor
                            .newRelation(portName);

                    if (VERBOSE) {
                        System.out.println("> for Port : " + portName
                                + " created Relation: " + relation.getName());
                    }

                    port.link(relation);
                } catch (NameDuplicationException e) {
                    KernelException.stackTraceToString(e);
                } catch (IllegalActionException e) {
                    KernelException.stackTraceToString(e);
                }

                relation.setServicesReceiversListMap((HashMap) connections
                        .get(portName));
            }
        }

        idsReceiversMap = director.getIdsReceiversMap();

        if (VERBOSE) {
            System.out.println("IDs Receivers Map: "
                    + idsReceiversMap.keySet().toString());
        }
View Full Code Here

TOP

Related Classes of ptolemy.distributed.actor.DistributedDirector

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.