Logic Code Builder - LCBObjectiveUse visual tools to represent complex logic and generate code in any programing language.
BenefitsUsing LCB decouples the information and data manipulation from the decision making, this separation reduces the complexity of the problem.
Basic ExamplesThis is a
... [More]
basic flow chart example:
This flow chart will generate this code:
package org.lcb.samples.sample1;
public class Sample1Logic
{
private final Sample1App app;
public Sample1Logic(Sample1App app)
{
this.app = app;
}
public void start()
{
if(app.isMorning()) /*este es el url*/
{
app.sayGoodMorning();
}
else
{
if(app.isAfternoon())
{
app.sayGoodAfternoon();
}
else
{
if(app.isNight())
{
app.sayGoodNight();
}
else
{
app.sayHi();
}
}
}
}
}Sample1 project is located at sample1/lcbproject/sample1.lcb.xml
This sample2 is a pseudo-code
This flow chart will generate this code:
package org.lcb.samples.sample2;
public class Sample2Logic
{
private final Sample1App app;
public Sample2Logic(Sample1App app)
{
this.app = app;
}
public void start()
{
if(condition1)
{
if(condition2)
{
if(condition3)
{
statement2
}
else
{
if(condition4)
{
statement2
}
else
{
if(condition5)
{
if(condiont6)
{
statement3
stup2();
}
else
{
procedureSample();
}
}
else
{
procedureSample();
}
}
}
}
else
{
stup0();
}
}
else
{
stup0();
}
}
private void stup0()
{
statement1
stup2();
}
private void procedureSample()
{
statement4
}
private void stup2()
{
statement5
statement6
for(int i = 0 ; condiont7Loop; i++ )
{
statement7
}
statement8
}
}Sample2 project is located at sample1/lcbproject/sample2.lcb.xml
The codeThe code is organized to provide an easy way to integrate different Visual Tools and Templates engines.
Language generation. LCB uses templates to generate code. This templates can be rewritten to generate any language. (no recompilation required) Java templates are located at directory 'templates/java'
There is only one ready to use implementation for templates.
tringTemplate http://www.stringtemplate.org.
Project configurationLCB use a XML file with all the information required to generated the code. The XML contains the input file, templates and the output file.
The input file contains the graphic data. Templates are divided in main template: Specifies the format for the output file. Each project must define its own main template. statements templates: The statements of the target language. procedures templates: If the target language support procedures this archive will be specify the procedure declaration and call format.
Visual Tools.Two interfaces are used to integrate visual tools
org.lcb.graphs.api.Application
org.lcb.graphs.api.IGraphDataSee class org.decision.graphs.yed.YEdApp.java
There are two ready to use implementation for Visual tools
yEd - Java™ Graph Editor QSEE Super Lite
yEd - Java™ Graph Editor"yEd is a very powerful graph editor that is written entirely in the Java programming language. It can be used to quickly and effectively generate drawings and to apply automatic layouts to a range of different diagrams and networks"
You can find more information at http://www.yworks.com/en/products_yed_about.htm
The project implements a reader for the XML generated by yEd - Java™ Graph Editor, using the flow chart graph is easy to create the visual representation of the logic.
To use yEd specify this in project file:
file="yEdFile.graphml"
/>
QSEE Super Lite"The QSEE multi-CASE tool is a collection of sub-tools designed to aid in the analysis and design of software type systems." Flow Charts are the only charts supported.
You can find more information at http://www.leedsmet.ac.uk/qsee/complete.htm, please license information
The project implements a reader for the XML generated by QSEE Super Lite
To use QSEE specify this in project file:
file="testMethods.graphml"
name="Flow Chart Name"
/>
Java templatesJava templates are ready to use.
Project File SampleThis must be in a file with extension .xml
Motivation to create this toolI was working in my project and found a major problem with my bots that required to check a lot of states and conditions, so I decided to try some visual programming tools and rule based systems. The problem with this tools was that they need a framework and/or have their own language, plus the IDE and debugging tools where incomplete or out of date.
So I decided to try something simple, and use a FSM, a flow chart tool and generate Java from the output file, so I can have the best of the two worlds, a visual representation and Java code, the result was this tool.
I thought maybe this could help others, so I decided to make it public, please let me know what do you think or if you want to use it and need something extra, let me know, I can help.
AboutLuis Carlos Hernandez Vega luiskarlos@gmail.com [Less]