Package javaflow.network.api

Examples of javaflow.network.api.PortReference


        if (!isComponentName(toReference)){
            if (!NetworkApiUtil.isPortName(toReference)){
                throw new Error(toReference+" is not existing component name or suitable port name");
            }
            PortReference portReference = PortReference.parse(toReference);
            stepReady(portReference);

            return new CreateNextConnection(){
                @Override
                public CreateNextConnection to(String portReference) {
View Full Code Here


        super(componentName);
        this.componentClass = componentClass;
    }

    public PortReference port(String portName) {
        return new PortReference(name(), portName);
    }
View Full Code Here

    public Class<? extends Component> componentClass() {
        return componentClass;
    }

    public PortReference port(String portName, int i) {
        return new PortReference(name(), portName, i);
    }
View Full Code Here

public class PortReferenceTest {

    @Test
    public void simplePort() {
        PortReference ref = PortReference.parse("in.OUT");
        Assert.assertEquals(ref.componentName(), "in");
        Assert.assertEquals(ref.portName(), "OUT");
        Assert.assertEquals(ref.componentAndPortName(), "in.OUT");
        Assert.assertFalse(ref.isArrayPort());
        Assert.assertEquals(ref.toString(), "in.OUT");
    }
View Full Code Here

        Assert.assertEquals(ref.toString(), "in.OUT");
    }

    @Test(expectedExceptions = Error.class)
    public void simplePortArrayIndexThrowsError() {
        PortReference ref = PortReference.parse("in.OUT");
        ref.portIndex();
    }
View Full Code Here

        ref.portIndex();
    }

    @Test
    public void arrayPort() {
        PortReference ref = PortReference.parse("in.BLAAH[0]");
        Assert.assertEquals(ref.componentName(), "in");
        Assert.assertEquals(ref.portName(), "BLAAH");
        Assert.assertEquals(ref.componentAndPortName(), "in.BLAAH");
        Assert.assertTrue(ref.isArrayPort());
        Assert.assertEquals(ref.portIndex(), 0);
        Assert.assertEquals(ref.toString(), "in.BLAAH[0]");
    }
View Full Code Here

        Assert.assertEquals(ref.toString(), "in.BLAAH[0]");
    }

    @Test
    public void simplePortNoComponent() {
        PortReference ref = PortReference.parse("OUT");
        Assert.assertEquals(ref.componentName(), null);
        Assert.assertEquals(ref.portName(), "OUT");
        Assert.assertEquals(ref.componentAndPortName(), null);
        Assert.assertFalse(ref.isArrayPort());
        Assert.assertEquals(ref.toString(), "OUT");
    }
View Full Code Here

        Assert.assertEquals(ref.toString(), "OUT");
    }

    @Test
    public void arrayPortNoComponent() {
        PortReference ref = PortReference.parse("BLAAH[0]");
        Assert.assertEquals(ref.componentName(), null);
        Assert.assertEquals(ref.portName(), "BLAAH");
        Assert.assertEquals(ref.componentAndPortName(), null);
        Assert.assertTrue(ref.isArrayPort());
        Assert.assertEquals(ref.portIndex(), 0);
        Assert.assertEquals(ref.toString(), "BLAAH[0]");
    }
View Full Code Here

    }

    OutputPortImpl get(int i) {
        while (i >= outputs.size()) {
            int index = outputs.size();
            OutputPortImpl out = new OutputPortImpl(new PortReference(componentName, portBaseName, index));
            outputs.add(out);
            out.setOwner(owner);
        }
        return outputs.get(i);
    }
View Full Code Here

    }

    InputPortImpl get(int i) {
        while (i >= inports.size()) {
            int index = inports.size();
            InputPortImpl in = new InputPortImpl(new PortReference(componentName, portBaseName, index));
            inports.add(in);
            owner.inputPortOpened();
            in.setOwner(owner);
        }
        return inports.get(i);
View Full Code Here

TOP

Related Classes of javaflow.network.api.PortReference

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.