Package ptolemy.kernel

Examples of ptolemy.kernel.Port


            // Have to copy _portList to avoid corrupting the iterator.
            List portListCopy = new LinkedList(portList());
            Iterator ports = portListCopy.iterator();

            while (ports.hasNext()) {
                Port port = (Port) ports.next();
                try {
                    MoMLChangeRequest request = new MoMLChangeRequest(this,
                            this, "<deletePort name=\"" + port.getName()
                                    + "\"/>");
                    request.setUndoable(true);
                    requestChange(request);
                } catch (Exception ex) {
                    // Ignore.
View Full Code Here


        }

        Iterator ports = portList().iterator();

        while (ports.hasNext()) {
            Port port = (Port) ports.next();
            port.exportMoML(output, depth);
        }

        output.write(exportLinks(depth, null));
    }
View Full Code Here

            Entity insideEntity = (Entity) entities.next();
            Iterator ports = result.portList().iterator();

            while (ports.hasNext()) {
                MirrorPort port = (MirrorPort) ports.next();
                Port insidePort = insideEntity.getPort(port.getName());

                if (insidePort instanceof MirrorPort) {
                    port.setAssociatedPort((MirrorPort) insidePort);
                }
            }
View Full Code Here

     @exception NameDuplicationException If the container already has a port
     *  with this name.
     */
    public Port newPort(String name) throws NameDuplicationException {
        try {
            Port result = new MirrorPort(this, name);

            // NOTE: We would like prevent deletion via MoML
            // (or name changes, for that matter), but the following
            // also prevents making it an input, which makes
            // adding ports via the port dialog fail.
View Full Code Here

                        String portName = castPort.getName();
                        Iterator entities = entityList().iterator();

                        if (entities.hasNext()) {
                            Entity insideEntity = (Entity) entities.next();
                            Port insidePort = insideEntity.getPort(portName);

                            if (insidePort == null) {
                                insidePort = insideEntity.newPort(portName);

                                if (insidePort instanceof IOPort) {
                                    IOPort castInsidePort = (IOPort) insidePort;
                                    castInsidePort.setInput(castPort.isInput());
                                    castInsidePort.setOutput(castPort
                                            .isOutput());
                                    castInsidePort.setMultiport(castPort
                                            .isMultiport());
                                }
                            }

                            if (insidePort instanceof MirrorPort) {
                                castPort
                                        .setAssociatedPort((MirrorPort) insidePort);
                            }

                            // Create a link only if it doesn't already exist.
                            List connectedPorts = insidePort
                                    .connectedPortList();

                            if (!connectedPorts.contains(castPort)) {
                                // There is no connection. Create one.
                                ComponentRelation newRelation = newRelation(uniqueName("relation"));
                                insidePort.link(newRelation);
                                castPort.link(newRelation);
                            }
                        }
                    } finally {
                        workspace().doneWriting();
View Full Code Here

        }

        Iterator ports = portList().iterator();

        while (ports.hasNext()) {
            Port port = (Port) ports.next();
            port.exportMoML(output, depth);
        }

        Iterator entities = entityList().iterator();

        while (entities.hasNext()) {
View Full Code Here

        // Have to copy the list to avoid a concurrent
        // modification exception.
        Iterator ports = (new LinkedList(portList())).iterator();

        while (ports.hasNext()) {
            Port port = (Port) ports.next();

            try {
                _inRemoveEntity = true;
                port.setContainer(null);
            } catch (KernelException e) {
                throw new InternalErrorException(e);
            } finally {
                _inRemoveEntity = false;
            }
View Full Code Here

        Iterator entities = entityList().iterator();

        while (entities.hasNext()) {
            Entity insideEntity = (Entity) entities.next();
            Port insidePort = insideEntity.getPort(port.getName());

            if (insidePort != null) {
                try {
                    insidePort.setContainer(null);
                } catch (KernelException ex) {
                    throw new InternalErrorException(ex);
                }
            }
        }
View Full Code Here

                if (container != null) {
                    Nameable modal = container.getContainer();

                    if (modal instanceof MultiCompositeActor) {
                        Port port = ((MultiCompositeActor) modal)
                                .getPort(getName());

                        if (port instanceof IOPort) {
                            ((IOPort) port).moveDown();
                            success = true;
View Full Code Here

                if (container != null) {
                    Nameable modal = container.getContainer();

                    if (modal instanceof MultiCompositeActor) {
                        Port port = ((MultiCompositeActor) modal)
                                .getPort(getName());

                        if (port instanceof IOPort) {
                            ((IOPort) port).moveToFirst();
                            success = true;
View Full Code Here

TOP

Related Classes of ptolemy.kernel.Port

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.