Table of contents

drawfbp

%3 cluster_74acad2b_6157_411b_ae84_b464d6d9e029 drawfbp cluster_b5a58498_0eed_437b_945a_ecb8d8c48122 Concepts cluster_525442f1_d324_45af_a46f_5654d02b8776 Code generation _b61b84a2_0ac4_4461_8026_f09eea6c5bbb Connections _20376f33_9ba1_463f_9968_e5a6308edc67 Sample generated Java code from the picture on Connections section _e03a9a3b_a943_418a_81fe_0305356bcd52 Elements _190a6c92_c43f_40ff_baff_f5f20f6669bc flow-based programming __0:cluster_74acad2b_6157_411b_ae84_b464d6d9e029->_190a6c92_c43f_40ff_baff_f5f20f6669bc

Concepts

Elements

  • Process

  • Initial IP

    Initial Information Packets

  • Enclosure

    • Looks like groups (or clusters in graphviz)

  • Subnet

  • ExtPorts

    • Come in 'input', 'output' and 'Out/In' variety

  • File

  • Person

  • Report

Connections

  • Elements can be connected.

  • Connections either have only one possible direction (IPs, extIn/extOut ports), none (person, file, report) or the direction is decided by which block was clicked first and last when establishing the connection.

Code generation

  • The tool can generate code in

    • Java

    • C#

    • JSON

    • FBP

Sample generated Java code from the picture on Connections section

  • Errors present during the generation

    • Class missing for 'subnet1' - Diagram needs to be updated

    • Class missing for 'process1' - Diagram needs to be updated

    • Class missing for 'process2' - Diagram needs to be updated

    • Class missing for 'process2' - Diagram needs to be updated

  • Elements not present on the generated code

    • Person

    • File

    • Report

    • Also, "legend" and "enclosure" where not shown on picture but where present on the diagram (and not on the resulting code).

package sample; //change package name if desired
        import com.jpaulmorrison.fbp.core.engine.*;
        @ComponentDescription("Click anywhere on selection area")
        @InPort("extportIn1")
        @OutPort("extportOut1")

        public class drw extends SubNet {
            String description = "Click anywhere on selection area";
            protected void define() {
                component("subnet1","Invalid class".class);
                component("SUBOI",SubOI.class);
                initialize("extportInOut1", component("SUBOI"), port("NAME"));
                component("process1","Invalid class".class);
                component("SUBIN",SubIn.class);
                initialize("extportIn1", component("SUBIN"), port("NAME"));
                component("SUBOUT",SubOut.class);
                initialize("extportOut1", component("SUBOUT"), port("NAME"));
                component("process2","Invalid class".class);
                initialize("IP1", component("process1"), port(""));
                connect(component("process1"), port("OUT"), component("subnet1"), port("IN"));
                connect(component("subnet1"), port("OUT"), component("process2"), port("IN"));
                connect(component("process2"), port("OUT"), component("SUBOI"), port("IN" ));
                connect(component("SUBIN"), port("OUT"), component("process1"), port("IN"));
                connect(component("process1"), port("OUT"), component("SUBOUT"), port("IN" ));
            }
        }

        /* Errors in generated code - they must be corrected for your program to run -
           remove this comment when you are done  */