Friday, February 24, 2017


Next example from the "examples" folder of the perkun package. The definition section contains the code:

// the OptimizerThread class creates an instance of the Optimizer class (created by zubr)
// and runs the loop.

protected static class OptimizerThread extends Thread {
    private Optimizer optimizer;

    public void run() {
        optimizer = new Optimizer();

public static void main(String[] args) {
    frame = new JFrame();
    frame.setSize(new Dimension(800, 600));
    OptimizerThread t = new OptimizerThread();
In short - we create a thread that creates an optimizer and calls its method "loop". In the loop the optimizer runs as long as the predefined boolean variable isLoopRunning equals true. This variable is defined by zubr, you do not need to define it, but you can access it in the Optimizer.

Try to execute the example with zubr:

zubr example13_with_optimizer_thread.zubr >

That is all - it will create a Java class with the code shown above included. But the optimizer (although running) does not communicate with the outer world. It is no good for us. We need to define some optimizer's methods to do it. We will do it in next examples.

Download zubr from

No comments:

Post a Comment