CPD Results

The following document contains the results of PMD's CPD 6.46.0.

Duplications

File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 19
@Log
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Valid
////@Validated
public class ComputerKurzweilProperties implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    @Valid @Getter @Setter public Allinone allinone = new Allinone();
    @Valid @Getter @Setter public Mandelbrot mandelbrot = new Mandelbrot();
    @Valid @Getter @Setter public MandelbrotZoom mandelbrotZoom = new MandelbrotZoom();
    @Valid @Getter @Setter public SimulatedEvolution simulatedevolution = new SimulatedEvolution();
    @Valid @Getter @Setter public Cca cca = new Cca();
    @Valid @Getter @Setter public WienerProcess randomwalk = new WienerProcess();
    @Valid @Getter @Setter public Dla dla = new Dla();
    @Valid @Getter @Setter public Kochsnowflake kochsnowflake = new Kochsnowflake();
    @Valid @Getter @Setter public Samegame samegame = new Samegame();
    @Valid @Getter @Setter public Sierpinskitriangle sierpinskitriangle = new Sierpinskitriangle();
    @Valid @Getter @Setter public Tetris tetris = new Tetris();
    @Valid @Getter @Setter public Turmite turmite = new Turmite();
    @Valid @Getter @Setter public Wator wator = new Wator();
    @Valid @Getter @Setter public Gameoflive gameoflive = new Gameoflive();

    public static ComputerKurzweilProperties propertiesFactory(File conf){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf.getAbsolutePath());
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            InputStream input = new FileInputStream(conf);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public static ComputerKurzweilProperties propertiesFactory(String conf, String jar){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf);
        log.info("propertiesFactory jar:  "+jar);
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            JarFile jarFile = new JarFile(jar);
            JarEntry entry = jarFile.getJarEntry(conf);
            InputStream input = jarFile.getInputStream(entry);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public String getSubtitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getSubtitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getSubtitle();
            case SIMULATED_EVOLUTION:
                return this.getSimulatedevolution().getView().getSubtitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getSubtitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getSubtitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getSubtitle();
            case SAME_GAME:
                return this.getSamegame().getView().getSubtitle();
            case SIERPINSKI_TRIANGLE:
                return this.getSierpinskitriangle().getView().getSubtitle();
            case TETRIS:
                return this.getTetris().getView().getSubtitle();
            case TURMITE:
                return this.getTurmite().getView().getSubtitle();
            case WATOR:
                return this.getWator().getView().getSubtitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getSubtitle();
            default:
                return "UNDEFINED";
        }
    }

    public String getTitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getTitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getTitle();
            case SIMULATED_EVOLUTION:
                return  this.getSimulatedevolution().getView().getTitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getTitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getTitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getTitle();
            case SAME_GAME:
                return this.getSamegame().getView().getTitle();
            case SIERPINSKI_TRIANGLE:
                return  this.getSierpinskitriangle().getView().getTitle();
            case TETRIS:
                return  this.getTetris().getView().getTitle();
            case TURMITE:
                return this.getTurmite().getView().getTitle();
            case WATOR:
                return this.getWator().getView().getTitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getTitle();
            default:
                return "UNDEFINED";
        }
    }

    ////@Validated
    @ToString
    public static class Allinone {

        @Valid @Getter @Setter public Lattice lattice = new Lattice();
        @Valid @Getter @Setter public View view = new View();

        ////@Validated
        @ToString
        public static class Lattice {
            @NotNull  @Getter @Setter private Integer width;
            @NotNull  @Getter @Setter private Integer height;
        }

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String copyright;
            @NotNull  @Getter @Setter private Integer borderPaddingX;
            @NotNull  @Getter @Setter private Integer borderPaddingY;
            @NotNull  @Getter @Setter private Integer titleHeight;
            @NotBlank @Getter @Setter private String startStopp;
            @NotBlank @Getter @Setter private String start;
            @NotBlank @Getter @Setter private String stop;
            @NotBlank @Getter @Setter private String info;
        }
    }

    ////@Validated
    @ToString
    public static class Mandelbrot {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class MandelbrotZoom {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class SimulatedEvolution {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();
        @Valid @Getter @Setter public CellConf cellConf = new CellConf();
        @Valid @Getter @Setter public Population population = new Population();
        @Valid @Getter @Setter public Food food = new Food();
        @Valid @Getter @Setter public GardenOfEden gardenOfEden = new GardenOfEden();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer exitStatus;
            @NotNull  @Getter @Setter private Integer queueMaxLength;
        }

        ////@Validated
        @ToString
        public static class CellConf {
            @NotNull  @Getter @Setter private Integer fatMax;
            @NotNull  @Getter @Setter private Integer fatHungerMax;
            @NotNull  @Getter @Setter private Integer fatMinimumForSex;
            @NotNull  @Getter @Setter private Integer fatAtBirth;
            @NotNull  @Getter @Setter private Integer fatPerFood;
            @NotNull  @Getter @Setter private Integer ageOfAdulthood;
            @NotNull  @Getter @Setter private Integer ageOld;
            @NotNull  @Getter @Setter private Integer ageMax;
        }

        ////@Validated
        @ToString
        public static class Population {
            @NotNull  @Getter @Setter private Integer initialPopulation;
            @NotBlank @Getter @Setter private String panelPopulationStatistics;
            @NotBlank @Getter @Setter private String panelLifeCycleStatistics;
            @NotBlank @Getter @Setter private String youngCellsLabel;
            @NotBlank @Getter @Setter private String youngAndFatCellsLabel;
            @NotBlank @Getter @Setter private String fullAgeCellsLabel;
            @NotBlank @Getter @Setter private String hungryCellsLabel;
            @NotBlank @Getter @Setter private String oldCellsLabel;
            @NotBlank @Getter @Setter private String populationLabel;
            @NotBlank @Getter @Setter private String generationOldestLabel;
            @NotBlank @Getter @Setter private String generationYoungestLabel;
        }

        ////@Validated
        @ToString
        public static class Food {
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer foodPerDayFieldColumns;
            @NotBlank @Getter @Setter private String foodPerDayLabel;
            @NotBlank @Getter @Setter private String foodPerDayBorderLabel;
            @NotBlank @Getter @Setter private String buttonFoodPerDayIncrease;
            @NotBlank @Getter @Setter private String buttonFoodPerDayDecrease;
            @NotBlank @Getter @Setter private String panelFood;
        }

        ////@Validated
        @ToString
        public static class GardenOfEden {
            @NotBlank @Getter @Setter private String panelGardenOfEden;
            @NotNull  @Getter @Setter private Boolean gardenOfEdenEnabled;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledString;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledToggleButton;
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisor;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisorPadding;
        }
    }

    ////@Validated
    @ToString
    public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class WienerProcess {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    //@Validated
    @ToString
    public static class Dla {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Kochsnowflake {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Samegame {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Sierpinskitriangle {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Tetris {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Turmite {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Wator {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Gameoflive{

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public ComputerKurzweilProperties.Wator.View.Neighborhood neighborhood = new Wator.View.Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 17
@Log
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Valid
////@Validated
public class ComputerKurzweilProperties implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    @Valid @Getter @Setter public Allinone allinone = new Allinone();
    @Valid @Getter @Setter public Mandelbrot mandelbrot = new Mandelbrot();
    @Valid @Getter @Setter public SimulatedEvolution simulatedevolution = new SimulatedEvolution();
    @Valid @Getter @Setter public Cca cca = new Cca();
    @Valid @Getter @Setter public WienerProcess randomwalk = new WienerProcess();
    @Valid @Getter @Setter public Dla dla = new Dla();
    @Valid @Getter @Setter public Kochsnowflake kochsnowflake = new Kochsnowflake();
    @Valid @Getter @Setter public Samegame samegame = new Samegame();
    @Valid @Getter @Setter public Sierpinskitriangle sierpinskitriangle = new Sierpinskitriangle();
    @Valid @Getter @Setter public Tetris tetris = new Tetris();
    @Valid @Getter @Setter public Turmite turmite = new Turmite();
    @Valid @Getter @Setter public Wator wator = new Wator();
    @Valid @Getter @Setter public Gameoflive gameoflive = new Gameoflive();

    ////@Validated
    @ToString
    public static class Allinone {

        @Valid @Getter @Setter public Lattice lattice = new Lattice();
        @Valid @Getter @Setter public View view = new View();

        ////@Validated
        @ToString
        public static class Lattice {
            @NotNull  @Getter @Setter private Integer width;
            @NotNull  @Getter @Setter private Integer height;
        }

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String copyright;
            @NotNull  @Getter @Setter private Integer borderPaddingX;
            @NotNull  @Getter @Setter private Integer borderPaddingY;
            @NotNull  @Getter @Setter private Integer titleHeight;
            @NotBlank @Getter @Setter private String startStopp;
            @NotBlank @Getter @Setter private String start;
            @NotBlank @Getter @Setter private String stop;
            @NotBlank @Getter @Setter private String info;
        }
    }

    ////@Validated
    @ToString
    public static class Mandelbrot {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class SimulatedEvolution {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();
        @Valid @Getter @Setter public CellConf cellConf = new CellConf();
        @Valid @Getter @Setter public Population population = new Population();
        @Valid @Getter @Setter public Food food = new Food();
        @Valid @Getter @Setter public GardenOfEden gardenOfEden = new GardenOfEden();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer exitStatus;
            @NotNull  @Getter @Setter private Integer queueMaxLength;
        }

        ////@Validated
        @ToString
        public static class CellConf {
            @NotNull  @Getter @Setter private Integer fatMax;
            @NotNull  @Getter @Setter private Integer fatHungerMax;
            @NotNull  @Getter @Setter private Integer fatMinimumForSex;
            @NotNull  @Getter @Setter private Integer fatAtBirth;
            @NotNull  @Getter @Setter private Integer fatPerFood;
            @NotNull  @Getter @Setter private Integer ageOfAdulthood;
            @NotNull  @Getter @Setter private Integer ageOld;
            @NotNull  @Getter @Setter private Integer ageMax;
        }

        ////@Validated
        @ToString
        public static class Population {
            @NotNull  @Getter @Setter private Integer initialPopulation;
            @NotBlank @Getter @Setter private String panelPopulationStatistics;
            @NotBlank @Getter @Setter private String panelLifeCycleStatistics;
            @NotBlank @Getter @Setter private String youngCellsLabel;
            @NotBlank @Getter @Setter private String youngAndFatCellsLabel;
            @NotBlank @Getter @Setter private String fullAgeCellsLabel;
            @NotBlank @Getter @Setter private String hungryCellsLabel;
            @NotBlank @Getter @Setter private String oldCellsLabel;
            @NotBlank @Getter @Setter private String populationLabel;
            @NotBlank @Getter @Setter private String generationOldestLabel;
            @NotBlank @Getter @Setter private String generationYoungestLabel;
        }

        ////@Validated
        @ToString
        public static class Food {
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer foodPerDayFieldColumns;
            @NotBlank @Getter @Setter private String foodPerDayLabel;
            @NotBlank @Getter @Setter private String foodPerDayBorderLabel;
            @NotBlank @Getter @Setter private String buttonFoodPerDayIncrease;
            @NotBlank @Getter @Setter private String buttonFoodPerDayDecrease;
            @NotBlank @Getter @Setter private String panelFood;
        }

        ////@Validated
        @ToString
        public static class GardenOfEden {
            @NotBlank @Getter @Setter private String panelGardenOfEden;
            @NotNull  @Getter @Setter private Boolean gardenOfEdenEnabled;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledString;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledToggleButton;
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisor;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisorPadding;
        }
    }

    ////@Validated
    @ToString
    public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class WienerProcess {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    //@Validated
    @ToString
    public static class Dla {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Kochsnowflake {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Samegame {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Sierpinskitriangle {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Tetris {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Turmite {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Wator {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Gameoflive{

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public ComputerKurzweilProperties.Wator.View.Neighborhood neighborhood = new Wator.View.Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    public static ComputerKurzweilProperties propertiesFactory(File conf){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf.getAbsolutePath());
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            InputStream input = new FileInputStream(conf);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public static ComputerKurzweilProperties propertiesFactory(String conf, String jar){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf);
        log.info("propertiesFactory jar:  "+jar);
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            JarFile jarFile = new JarFile(jar);
            JarEntry entry = jarFile.getJarEntry(conf);
            InputStream input = jarFile.getInputStream(entry);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public String getSubtitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getSubtitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getSubtitle();
            case SIMULATED_EVOLUTION:
                return this.getSimulatedevolution().getView().getSubtitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getSubtitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getSubtitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getSubtitle();
            case SAME_GAME:
                return this.getSamegame().getView().getSubtitle();
            case SIERPINSKI_TRIANGLE:
                return this.getSierpinskitriangle().getView().getSubtitle();
            case TETRIS:
                return this.getTetris().getView().getSubtitle();
            case TURMITE:
                return this.getTurmite().getView().getSubtitle();
            case WATOR:
                return this.getWator().getView().getSubtitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getSubtitle();
            default:
                return "UNDEFINED";
        }
    }

    public String getTitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getTitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getTitle();
            case SIMULATED_EVOLUTION:
                return  this.getSimulatedevolution().getView().getTitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getTitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getTitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getTitle();
            case SAME_GAME:
                return this.getSamegame().getView().getTitle();
            case SIERPINSKI_TRIANGLE:
                return  this.getSierpinskitriangle().getView().getTitle();
            case TETRIS:
                return  this.getTetris().getView().getTitle();
            case TURMITE:
                return this.getTurmite().getView().getTitle();
            case WATOR:
                return this.getWator().getView().getTitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getTitle();
            default:
                return "UNDEFINED";
        }
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 76
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 102
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 76
public static class Mandelbrot {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class SimulatedEvolution {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();
        @Valid @Getter @Setter public CellConf cellConf = new CellConf();
        @Valid @Getter @Setter public Population population = new Population();
        @Valid @Getter @Setter public Food food = new Food();
        @Valid @Getter @Setter public GardenOfEden gardenOfEden = new GardenOfEden();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer exitStatus;
            @NotNull  @Getter @Setter private Integer queueMaxLength;
        }

        ////@Validated
        @ToString
        public static class CellConf {
            @NotNull  @Getter @Setter private Integer fatMax;
            @NotNull  @Getter @Setter private Integer fatHungerMax;
            @NotNull  @Getter @Setter private Integer fatMinimumForSex;
            @NotNull  @Getter @Setter private Integer fatAtBirth;
            @NotNull  @Getter @Setter private Integer fatPerFood;
            @NotNull  @Getter @Setter private Integer ageOfAdulthood;
            @NotNull  @Getter @Setter private Integer ageOld;
            @NotNull  @Getter @Setter private Integer ageMax;
        }

        ////@Validated
        @ToString
        public static class Population {
            @NotNull  @Getter @Setter private Integer initialPopulation;
            @NotBlank @Getter @Setter private String panelPopulationStatistics;
            @NotBlank @Getter @Setter private String panelLifeCycleStatistics;
            @NotBlank @Getter @Setter private String youngCellsLabel;
            @NotBlank @Getter @Setter private String youngAndFatCellsLabel;
            @NotBlank @Getter @Setter private String fullAgeCellsLabel;
            @NotBlank @Getter @Setter private String hungryCellsLabel;
            @NotBlank @Getter @Setter private String oldCellsLabel;
            @NotBlank @Getter @Setter private String populationLabel;
            @NotBlank @Getter @Setter private String generationOldestLabel;
            @NotBlank @Getter @Setter private String generationYoungestLabel;
        }

        ////@Validated
        @ToString
        public static class Food {
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer foodPerDayFieldColumns;
            @NotBlank @Getter @Setter private String foodPerDayLabel;
            @NotBlank @Getter @Setter private String foodPerDayBorderLabel;
            @NotBlank @Getter @Setter private String buttonFoodPerDayIncrease;
            @NotBlank @Getter @Setter private String buttonFoodPerDayDecrease;
            @NotBlank @Getter @Setter private String panelFood;
        }

        ////@Validated
        @ToString
        public static class GardenOfEden {
            @NotBlank @Getter @Setter private String panelGardenOfEden;
            @NotNull  @Getter @Setter private Boolean gardenOfEdenEnabled;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledString;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledToggleButton;
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisor;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisorPadding;
        }
    }

    ////@Validated
    @ToString
    public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class WienerProcess {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    //@Validated
    @ToString
    public static class Dla {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Kochsnowflake {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Samegame {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Sierpinskitriangle {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Tetris {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Turmite {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Wator {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Gameoflive{

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public ComputerKurzweilProperties.Wator.View.Neighborhood neighborhood = new Wator.View.Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    public static ComputerKurzweilProperties propertiesFactory(File conf){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf.getAbsolutePath());
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            InputStream input = new FileInputStream(conf);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public static ComputerKurzweilProperties propertiesFactory(String conf, String jar){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf);
        log.info("propertiesFactory jar:  "+jar);
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            JarFile jarFile = new JarFile(jar);
            JarEntry entry = jarFile.getJarEntry(conf);
            InputStream input = jarFile.getInputStream(entry);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public String getSubtitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getSubtitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getSubtitle();
            case SIMULATED_EVOLUTION:
                return this.getSimulatedevolution().getView().getSubtitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getSubtitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getSubtitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getSubtitle();
            case SAME_GAME:
                return this.getSamegame().getView().getSubtitle();
            case SIERPINSKI_TRIANGLE:
                return this.getSierpinskitriangle().getView().getSubtitle();
            case TETRIS:
                return this.getTetris().getView().getSubtitle();
            case TURMITE:
                return this.getTurmite().getView().getSubtitle();
            case WATOR:
                return this.getWator().getView().getSubtitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getSubtitle();
            default:
                return "UNDEFINED";
        }
    }

    public String getTitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getTitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getTitle();
            case SIMULATED_EVOLUTION:
                return  this.getSimulatedevolution().getView().getTitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getTitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getTitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getTitle();
            case SAME_GAME:
                return this.getSamegame().getView().getTitle();
            case SIERPINSKI_TRIANGLE:
                return  this.getSierpinskitriangle().getView().getTitle();
            case TETRIS:
                return  this.getTetris().getView().getTitle();
            case TURMITE:
                return this.getTurmite().getView().getTitle();
            case WATOR:
                return this.getWator().getView().getTitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getTitle();
            default:
                return "UNDEFINED";
        }
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 145
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 171
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 318
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 145
@NotBlank @Getter @Setter private String youngCellsLabel;
            @NotBlank @Getter @Setter private String youngAndFatCellsLabel;
            @NotBlank @Getter @Setter private String fullAgeCellsLabel;
            @NotBlank @Getter @Setter private String hungryCellsLabel;
            @NotBlank @Getter @Setter private String oldCellsLabel;
            @NotBlank @Getter @Setter private String populationLabel;
            @NotBlank @Getter @Setter private String generationOldestLabel;
            @NotBlank @Getter @Setter private String generationYoungestLabel;
        }

        ////@Validated
        @ToString
        public static class Food {
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer foodPerDayFieldColumns;
            @NotBlank @Getter @Setter private String foodPerDayLabel;
            @NotBlank @Getter @Setter private String foodPerDayBorderLabel;
            @NotBlank @Getter @Setter private String buttonFoodPerDayIncrease;
            @NotBlank @Getter @Setter private String buttonFoodPerDayDecrease;
            @NotBlank @Getter @Setter private String panelFood;
        }

        ////@Validated
        @ToString
        public static class GardenOfEden {
            @NotBlank @Getter @Setter private String panelGardenOfEden;
            @NotNull  @Getter @Setter private Boolean gardenOfEdenEnabled;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledString;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledToggleButton;
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisor;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisorPadding;
        }
    }

    ////@Validated
    @ToString
    public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class WienerProcess {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    //@Validated
    @ToString
    public static class Dla {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Kochsnowflake {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Samegame {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Sierpinskitriangle {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Tetris {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Turmite {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Wator {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Gameoflive{

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public ComputerKurzweilProperties.Wator.View.Neighborhood neighborhood = new Wator.View.Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    public static ComputerKurzweilProperties propertiesFactory(File conf){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf.getAbsolutePath());
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            InputStream input = new FileInputStream(conf);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public static ComputerKurzweilProperties propertiesFactory(String conf, String jar){
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 45
public GaussianNumberPlane(KochSnowflakeModel model) {
        this.worldDimensions = model.getWorldDimensions();
        this.lattice = new int[worldDimensions.getWidth()][worldDimensions.getHeight()];
        this.complexWorldDimensions = new ComplexNumber(
            complexWorldDimensionRealX,
            complexWorldDimensionImgY
        );
        this.complexCenterForMandelbrot = new ComplexNumber(
            complexCenterForMandelbrotRealX,
            complexCenterForMandelbrotImgY
        );
        this.complexCenterForJulia = new ComplexNumber(
            complexCenterForJuliaRealX,
            complexCenterForJuliaImgY
        );
        start();
    }

    public void setModeZoom() {
        this.setZoomLevel(1);
        this.setZoomCenter(complexCenterForMandelbrot);
    }

    public synchronized void start(){
        zoomLevel = 1;
        for(int y = 0;y < this.worldDimensions.getY(); y++){
            for(int x=0; x < worldDimensions.getX(); x++){
                lattice[x][y] = YET_UNCOMPUTED;
            }
        }
    }

    public synchronized int getCellStatusFor(int x,int y){
        return (lattice[x][y])<0?0:lattice[x][y];
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForJulia(Point turingPosition) {
        double realX = complexCenterForJulia.getReal()
            + (complexWorldDimensions.getReal()*turingPosition.getX())/worldDimensions.getX();
        double imgY = complexCenterForJulia.getImg()
            + (complexWorldDimensions.getImg()*turingPosition.getY())/worldDimensions.getY();
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForMandelbrot(Point turingPosition) {
        double realX = (
            complexCenterForMandelbrot.getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / worldDimensions.getX()
        );
        double imgY = (
            complexCenterForMandelbrot.getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / worldDimensions.getY()
        );
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForZoomedMandelbrot(Point turingPosition) {
        double realX = (
            ( complexCenterForMandelbrot.getReal() / this.getZoomLevel() )
            + getZoomCenter().getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / ( worldDimensions.getX() * this.getZoomLevel() )
        );
        double imgY = (
            ( complexCenterForMandelbrot.getImg() / this.getZoomLevel() )
            + getZoomCenter().getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / ( worldDimensions.getY() * this.getZoomLevel() )
        );
        return new ComplexNumber(realX,imgY);
    }

    public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }

    private synchronized void computeTheJuliaSetForC(ComplexNumber c) {
        for(int y = 0; y < worldDimensions.getY(); y++) {
            for (int x = 0; x < worldDimensions.getX(); x++) {
                Point zPoint = new Point(x, y);
                ComplexNumber z = this.getComplexNumberFromLatticeCoordsForJulia(zPoint);
                lattice[x][y] = z.computeJuliaSet(c);
            }
        }
    }

    public synchronized void computeTheJuliaSetFor(Point pointFromMandelbrotSet) {
        ComplexNumber c = getComplexNumberFromLatticeCoordsForMandelbrot(pointFromMandelbrotSet);
        this.complexNumberForJuliaSetC = c;
        computeTheJuliaSetForC(c);
    }

    public void zoomIntoTheMandelbrotSet(Point zoomPoint) {
        //log.info("zoomIntoTheMandelbrotSet: "+ zoomPoint +" - old:  "+this.getZoomCenter());
        this.inceaseZoomLevel();
        if(this.getZoomLevel() == 2){
            ComplexNumber complexCenter = new ComplexNumber(this.complexCenterForMandelbrot);
            complexCenterForZoomedMandelbrot.push(complexCenter);
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForMandelbrot(zoomPoint));
        } else {
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForZoomedMandelbrot(zoomPoint));
        }
        complexCenterForZoomedMandelbrot.push(this.getZoomCenter());
        //log.info("zoomPoint:     "+ zoomPoint);
        //log.info("zoomCenterNew: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }

    public void zoomOutOfTheMandelbrotSet() {
        //log.info("zoomOutOfTheMandelbrotSet: " + this.getZoomCenter());
        if(this.getZoomLevel()>1){
            this.deceaseZoomLevel();
            this.setZoomCenter(complexCenterForZoomedMandelbrot.pop());
        }
        //log.info("zoomCenter: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }

    public void zoomIntoTheJuliaSetFor(Point zoomPoint) {
        ComplexNumber c = this.complexNumberForJuliaSetC;
        computeTheJuliaSetForC(c);
    }

    public void zoomOutOfTheJuliaSet() {
    }

    public synchronized int getZoomLevel() {
        return zoomLevel;
    }

    public synchronized void setZoomLevel(int zoomLevel) {
        this.zoomLevel = zoomLevel;
    }

    public synchronized int inceaseZoomLevel() {
        return zoomLevel *= 2;
    }

    public synchronized int deceaseZoomLevel() {
        return zoomLevel /= 2;
    }

    public synchronized ComplexNumber getZoomCenter() {
        return zoomCenter;
    }

    public synchronized void setZoomCenter(ComplexNumber zoomCenter) {
        this.zoomCenter = zoomCenter;
    }

}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 52
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 52
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 52
public GaussianNumberPlane(MandelbrotZoomModel model) {
        this.worldDimensions = model.getWorldDimensions();
        this.lattice = new int[worldDimensions.getWidth()][worldDimensions.getHeight()];
        this.complexWorldDimensions = new ComplexNumber(
            complexWorldDimensionRealX,
            complexWorldDimensionImgY
        );
        this.complexCenterForMandelbrot = new ComplexNumber(
            complexCenterForMandelbrotRealX,
            complexCenterForMandelbrotImgY
        );
        this.complexCenterForJulia = new ComplexNumber(
            complexCenterForJuliaRealX,
            complexCenterForJuliaImgY
        );
        start();
    }

    public void setModeZoom() {
        this.setZoomLevel(1);
        this.setZoomCenter(complexCenterForMandelbrot);
    }

    public synchronized void start(){
        zoomLevel = 1;
        for(int y = 0;y < this.worldDimensions.getY(); y++){
            for(int x=0; x < worldDimensions.getX(); x++){
                lattice[x][y] = YET_UNCOMPUTED;
            }
        }
    }

    public synchronized int getCellStatusFor(int x,int y){
        return (lattice[x][y])<0?0:lattice[x][y];
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForJulia(Point turingPosition) {
        double realX = complexCenterForJulia.getReal()
            + (complexWorldDimensions.getReal()*turingPosition.getX())/worldDimensions.getX();
        double imgY = complexCenterForJulia.getImg()
            + (complexWorldDimensions.getImg()*turingPosition.getY())/worldDimensions.getY();
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForMandelbrot(Point turingPosition) {
        double realX = (
            complexCenterForMandelbrot.getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / worldDimensions.getX()
        );
        double imgY = (
            complexCenterForMandelbrot.getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / worldDimensions.getY()
        );
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForZoomedMandelbrot(Point turingPosition) {
        double realX = (
            ( complexCenterForMandelbrot.getReal() / this.getZoomLevel() )
            + getZoomCenter().getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / ( worldDimensions.getX() * this.getZoomLevel() )
        );
        double imgY = (
            ( complexCenterForMandelbrot.getImg() / this.getZoomLevel() )
            + getZoomCenter().getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / ( worldDimensions.getY() * this.getZoomLevel() )
        );
        return new ComplexNumber(realX,imgY);
    }

    public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }

    private synchronized void computeTheJuliaSetForC(ComplexNumber c) {
        for(int y = 0; y < worldDimensions.getY(); y++) {
            for (int x = 0; x < worldDimensions.getX(); x++) {
                Point zPoint = new Point(x, y);
                ComplexNumber z = this.getComplexNumberFromLatticeCoordsForJulia(zPoint);
                lattice[x][y] = z.computeJuliaSet(c);
            }
        }
    }

    public synchronized void computeTheJuliaSetFor(Point pointFromMandelbrotSet) {
        ComplexNumber c = getComplexNumberFromLatticeCoordsForMandelbrot(pointFromMandelbrotSet);
        this.complexNumberForJuliaSetC = c;
        computeTheJuliaSetForC(c);
    }

    public void zoomIntoTheMandelbrotSet(Point zoomPoint) {
        //log.info("zoomIntoTheMandelbrotSet: "+ zoomPoint +" - old:  "+this.getZoomCenter());
        this.inceaseZoomLevel();
        if(this.getZoomLevel() == 2){
            ComplexNumber complexCenter = new ComplexNumber(this.complexCenterForMandelbrot);
            complexCenterForZoomedMandelbrot.push(complexCenter);
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForMandelbrot(zoomPoint));
        } else {
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForZoomedMandelbrot(zoomPoint));
        }
        complexCenterForZoomedMandelbrot.push(this.getZoomCenter());
        //log.info("zoomPoint:     "+ zoomPoint);
        //log.info("zoomCenterNew: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }

    public void zoomOutOfTheMandelbrotSet() {
        //log.info("zoomOutOfTheMandelbrotSet: " + this.getZoomCenter());
        if(this.getZoomLevel()>1){
            this.deceaseZoomLevel();
            this.setZoomCenter(complexCenterForZoomedMandelbrot.pop());
        }
        //log.info("zoomCenter: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }

    public void zoomIntoTheJuliaSetFor(Point zoomPoint) {
        ComplexNumber c = this.complexNumberForJuliaSetC;
        computeTheJuliaSetForC(c);
    }

    public void zoomOutOfTheJuliaSet() {
    }

    public synchronized int getZoomLevel() {
        return zoomLevel;
    }

    public synchronized int inceaseZoomLevel() {
        return zoomLevel *= 2;
    }

    public synchronized int deceaseZoomLevel() {
        return zoomLevel /= 2;
    }

    public synchronized void setZoomLevel(int zoomLevel) {
        this.zoomLevel = zoomLevel;
    }

    public synchronized ComplexNumber getZoomCenter() {
        return zoomCenter;
    }

    public synchronized void setZoomCenter(ComplexNumber zoomCenter) {
        this.zoomCenter = zoomCenter;
    }

}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 52
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 45
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 52
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 52
public GaussianNumberPlane(KochSnowflakeModel model) {
        this.worldDimensions = model.getWorldDimensions();
        this.lattice = new int[worldDimensions.getWidth()][worldDimensions.getHeight()];
        this.complexWorldDimensions = new ComplexNumber(
            complexWorldDimensionRealX,
            complexWorldDimensionImgY
        );
        this.complexCenterForMandelbrot = new ComplexNumber(
            complexCenterForMandelbrotRealX,
            complexCenterForMandelbrotImgY
        );
        this.complexCenterForJulia = new ComplexNumber(
            complexCenterForJuliaRealX,
            complexCenterForJuliaImgY
        );
        start();
    }

    public void setModeZoom() {
        this.setZoomLevel(1);
        this.setZoomCenter(complexCenterForMandelbrot);
    }

    public synchronized void start(){
        zoomLevel = 1;
        for(int y = 0;y < this.worldDimensions.getY(); y++){
            for(int x=0; x < worldDimensions.getX(); x++){
                lattice[x][y] = YET_UNCOMPUTED;
            }
        }
    }

    public synchronized int getCellStatusFor(int x,int y){
        return (lattice[x][y])<0?0:lattice[x][y];
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForJulia(Point turingPosition) {
        double realX = complexCenterForJulia.getReal()
            + (complexWorldDimensions.getReal()*turingPosition.getX())/worldDimensions.getX();
        double imgY = complexCenterForJulia.getImg()
            + (complexWorldDimensions.getImg()*turingPosition.getY())/worldDimensions.getY();
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForMandelbrot(Point turingPosition) {
        double realX = (
            complexCenterForMandelbrot.getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / worldDimensions.getX()
        );
        double imgY = (
            complexCenterForMandelbrot.getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / worldDimensions.getY()
        );
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForZoomedMandelbrot(Point turingPosition) {
        double realX = (
            ( complexCenterForMandelbrot.getReal() / this.getZoomLevel() )
            + getZoomCenter().getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / ( worldDimensions.getX() * this.getZoomLevel() )
        );
        double imgY = (
            ( complexCenterForMandelbrot.getImg() / this.getZoomLevel() )
            + getZoomCenter().getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / ( worldDimensions.getY() * this.getZoomLevel() )
        );
        return new ComplexNumber(realX,imgY);
    }

    public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }

    private synchronized void computeTheJuliaSetForC(ComplexNumber c) {
        for(int y = 0; y < worldDimensions.getY(); y++) {
            for (int x = 0; x < worldDimensions.getX(); x++) {
                Point zPoint = new Point(x, y);
                ComplexNumber z = this.getComplexNumberFromLatticeCoordsForJulia(zPoint);
                lattice[x][y] = z.computeJuliaSet(c);
            }
        }
    }

    public synchronized void computeTheJuliaSetFor(Point pointFromMandelbrotSet) {
        ComplexNumber c = getComplexNumberFromLatticeCoordsForMandelbrot(pointFromMandelbrotSet);
        this.complexNumberForJuliaSetC = c;
        computeTheJuliaSetForC(c);
    }

    public void zoomIntoTheMandelbrotSet(Point zoomPoint) {
        //log.info("zoomIntoTheMandelbrotSet: "+ zoomPoint +" - old:  "+this.getZoomCenter());
        this.inceaseZoomLevel();
        if(this.getZoomLevel() == 2){
            ComplexNumber complexCenter = new ComplexNumber(this.complexCenterForMandelbrot);
            complexCenterForZoomedMandelbrot.push(complexCenter);
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForMandelbrot(zoomPoint));
        } else {
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForZoomedMandelbrot(zoomPoint));
        }
        complexCenterForZoomedMandelbrot.push(this.getZoomCenter());
        //log.info("zoomPoint:     "+ zoomPoint);
        //log.info("zoomCenterNew: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }

    public void zoomOutOfTheMandelbrotSet() {
        //log.info("zoomOutOfTheMandelbrotSet: " + this.getZoomCenter());
        if(this.getZoomLevel()>1){
            this.deceaseZoomLevel();
            this.setZoomCenter(complexCenterForZoomedMandelbrot.pop());
        }
        //log.info("zoomCenter: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }

    public void zoomIntoTheJuliaSetFor(Point zoomPoint) {
        ComplexNumber c = this.complexNumberForJuliaSetC;
        computeTheJuliaSetForC(c);
    }

    public void zoomOutOfTheJuliaSet() {
    }

    public synchronized int getZoomLevel() {
        return zoomLevel;
    }

    public synchronized void setZoomLevel(int zoomLevel) {
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 145
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 145
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 145
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 145
@ToString
    public static class Allinone {

        @Valid @Getter @Setter public Lattice lattice = new Lattice();
        @Valid @Getter @Setter public View view = new View();

        ////@Validated
        @ToString
        public static class Lattice {
            @NotNull  @Getter @Setter private Integer width;
            @NotNull  @Getter @Setter private Integer height;
        }

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String copyright;
            @NotNull  @Getter @Setter private Integer borderPaddingX;
            @NotNull  @Getter @Setter private Integer borderPaddingY;
            @NotNull  @Getter @Setter private Integer titleHeight;
            @NotBlank @Getter @Setter private String startStopp;
            @NotBlank @Getter @Setter private String start;
            @NotBlank @Getter @Setter private String stop;
            @NotBlank @Getter @Setter private String info;
        }
    }

    ////@Validated
    @ToString
    public static class Mandelbrot {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class MandelbrotZoom {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class SimulatedEvolution {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();
        @Valid @Getter @Setter public CellConf cellConf = new CellConf();
        @Valid @Getter @Setter public Population population = new Population();
        @Valid @Getter @Setter public Food food = new Food();
        @Valid @Getter @Setter public GardenOfEden gardenOfEden = new GardenOfEden();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer exitStatus;
            @NotNull  @Getter @Setter private Integer queueMaxLength;
        }

        ////@Validated
        @ToString
        public static class CellConf {
            @NotNull  @Getter @Setter private Integer fatMax;
            @NotNull  @Getter @Setter private Integer fatHungerMax;
            @NotNull  @Getter @Setter private Integer fatMinimumForSex;
            @NotNull  @Getter @Setter private Integer fatAtBirth;
            @NotNull  @Getter @Setter private Integer fatPerFood;
            @NotNull  @Getter @Setter private Integer ageOfAdulthood;
            @NotNull  @Getter @Setter private Integer ageOld;
            @NotNull  @Getter @Setter private Integer ageMax;
        }

        ////@Validated
        @ToString
        public static class Population {
            @NotNull  @Getter @Setter private Integer initialPopulation;
            @NotBlank @Getter @Setter private String panelPopulationStatistics;
            @NotBlank @Getter @Setter private String panelLifeCycleStatistics;
            @NotBlank @Getter @Setter private String youngCellsLabel;
            @NotBlank @Getter @Setter private String youngAndFatCellsLabel;
            @NotBlank @Getter @Setter private String fullAgeCellsLabel;
            @NotBlank @Getter @Setter private String hungryCellsLabel;
            @NotBlank @Getter @Setter private String oldCellsLabel;
            @NotBlank @Getter @Setter private String populationLabel;
            @NotBlank @Getter @Setter private String generationOldestLabel;
            @NotBlank @Getter @Setter private String generationYoungestLabel;
        }

        ////@Validated
        @ToString
        public static class Food {
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer foodPerDayFieldColumns;
            @NotBlank @Getter @Setter private String foodPerDayLabel;
            @NotBlank @Getter @Setter private String foodPerDayBorderLabel;
            @NotBlank @Getter @Setter private String buttonFoodPerDayIncrease;
            @NotBlank @Getter @Setter private String buttonFoodPerDayDecrease;
            @NotBlank @Getter @Setter private String panelFood;
        }

        ////@Validated
        @ToString
        public static class GardenOfEden {
            @NotBlank @Getter @Setter private String panelGardenOfEden;
            @NotNull  @Getter @Setter private Boolean gardenOfEdenEnabled;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledString;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledToggleButton;
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisor;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisorPadding;
        }
    }

    ////@Validated
    @ToString
    public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java apps :: insourcing :: Simulated Evolution 25
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilContext.java apps :: legacy :: Simulated Evolution 29
private final Random random;
    private final ComputerKurzweilProperties properties;

    public ComputerKurzweilContext(
        ComputerKurzweilProperties computerKurzweilProperties
    ) {
        this.properties = computerKurzweilProperties;
        long seed = new Date().getTime();
        this.random = new Random(seed);
    }

    public CompoundBorder getTabbedPaneBorder() {
        return getBorder();
    }

    public CompoundBorder getFrameBorder(){
        return getBorder();
    }

    public CompoundBorder getBorder(){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }

    public CompoundBorder getBorder(String label){
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(label),
            BorderFactory.createEmptyBorder(top,left,bottom,right)
        );
    }

    private CompoundBorder getDoubleBorder(){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(left,right,top,bottom),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }

    private CompoundBorder getDoubleBorder(String label){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(left,right,top,bottom),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }

    public CompoundBorder getBottomButtonsPanelBorder(){
        return getDoubleBorder();
    }

    public CompoundBorder getBottomButtonsPanelBorder(String label){
        return getDoubleBorder(label);
    }

    private Border getZeroBorder() {
        int top = 0;
        int left = 0;
        int bottom = 0;
        int right = 0;
        return BorderFactory.createEmptyBorder(top,left,bottom,right);
    }

    public Border getTabBorder() {
        return getZeroBorder();
    }

    public Border getCanvasBorder() {
        return getZeroBorder();
    }

    public LatticePoint getWorldDimensions(){
        int x = this.properties.getAllinone().getLattice().getWidth();
        int y = this.properties.getAllinone().getLattice().getHeight();
        return new LatticePoint(x,y);
    }

    public LatticePoint getNextRandomLatticePoint() {
        int x = this.properties.getAllinone().getLattice().getWidth();
        int y = this.properties.getAllinone().getLattice().getHeight();
        int nextX = this.getRandom().nextInt(x);
        int nextY = this.getRandom().nextInt(y);
        LatticePoint p = new LatticePoint(nextX,nextY);
        p.normalize(this.getWorldDimensions());
        p.absoluteValue();
        return p;
    }

    public LifeCycle getNewCellLifeCycle() {
        return new LifeCycle(this.properties.getSimulatedevolution().getCellConf().getFatAtBirth());
    }

    public CellCore getNewCellCore() {
        return new CellCore(this.random);
    }

    public void start(){ }

    public void stop() { }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/cca/model/CyclicCellularAutomatonLattice.java apps :: insourcing :: Cyclic Cellular Automaton 19
org/woehlke/computer/kurzweil/cyclic/cellular/automaton/model/CyclicCellularAutomatonLattice.java apps :: legacy :: Cyclic Cellular Automaton 23
public class CyclicCellularAutomatonLattice implements Serializable {

    private static final long serialVersionUID = -594681595882016258L;

    private Random random;

    private volatile int[][][] lattice;
    private volatile int source;
    private volatile int target;

    private final ObjectRegistry ctx;

    private volatile LatticeNeighbourhood neighbourhood;

    public CyclicCellularAutomatonLattice(ObjectRegistry ctx) {
        this.ctx = ctx;
        random = new Random(new Date().getTime());
        startVonNeumann();
    }

    private void initCreateLattice(){
        lattice = new int[2]
            [(int) this.ctx.getConfig().getLatticeDimensions().getX()]
            [(int) this.ctx.getConfig().getLatticeDimensions().getY()];
        source = 0;
        target = 1;
    }

    private void initFillLatticeByRandom(){
        for(int y = 0; y<this.ctx.getConfig().getLatticeDimensions().getY(); y++){
            for(int x = 0; x<this.ctx.getConfig().getLatticeDimensions().getX(); x++){
                lattice[source][x][y] = random.nextInt(ctx.getColorScheme().getMaxState());
            }
        }
    }

    public synchronized void step(){
        //System.out.print(".");
        Point worldDimensions = this.ctx.getConfig().getLatticeDimensions();
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                lattice[target][x][y] = lattice[source][x][y];
                int nextState = (lattice[source][x][y] + 1) % ctx.getColorScheme().getMaxState();
                int west = (int) ((x-1+worldDimensions.getX())%worldDimensions.getX());
                int north = (int) ((y-1+worldDimensions.getY())%worldDimensions.getY());
                int east = (int) ((x+1+worldDimensions.getX())%worldDimensions.getX());
                int south = (int) ((y+1+worldDimensions.getY())%worldDimensions.getY());
                if(neighbourhood == MOORE_NEIGHBORHOOD || neighbourhood == WOEHLKE_NEIGHBORHOOD) {
                    //North-West
                    if (nextState == lattice[source][west][north]) {
                        lattice[target][x][y] = nextState;
                        continue;
                    }
                    //North-East
                    if (nextState == lattice[source][east][north]) {
                        lattice[target][x][y] = nextState;
                        continue;
                    }
                    if(neighbourhood == MOORE_NEIGHBORHOOD) {
                        //South-East
                        if (nextState == lattice[source][east][south]) {
                            lattice[target][x][y] = nextState;
                            continue;
                        }
                    }
                    //SouthWest
                    if (nextState == lattice[source][west][south]) {
                        lattice[target][x][y] = nextState;
                        continue;
                    }
                }
                //North
                if (nextState == lattice[source][x][north]
                ) {
                    lattice[target][x][y] = nextState;
                    continue;
                }
                //East
                if(nextState == lattice[source][east][y]){
                    lattice[target][x][y] = nextState;
                    continue;
                }
                if(neighbourhood == MOORE_NEIGHBORHOOD || neighbourhood == VON_NEUMANN_NEIGHBORHOOD) {
                    //South
                    if (nextState == lattice[source][x][south]) {
                        lattice[target][x][y] = nextState;
                        continue;
                    }
                }
                //West
                if(nextState == lattice[source][west][y]){
                    lattice[target][x][y] = nextState;
                }
            }
        }
        this.source = (this.source + 1 ) % 2;
        this.target =  (this.target + 1 ) % 2;
    }

    public int getCellStatusFor(int x,int y){
        return this.lattice[source][x][y];
    }

    public synchronized void startVonNeumann() {
        initCreateLattice();
        initFillLatticeByRandom();
        this.neighbourhood=VON_NEUMANN_NEIGHBORHOOD;
    }

    public synchronized void startMoore() {
        initCreateLattice();
        initFillLatticeByRandom();
        this.neighbourhood=MOORE_NEIGHBORHOOD;
    }

    public synchronized void startWoehlke() {
        initCreateLattice();
        initFillLatticeByRandom();
        this.neighbourhood=WOEHLKE_NEIGHBORHOOD;
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 17
@Log
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Valid
////@Validated
public class ComputerKurzweilProperties implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    @Valid @Getter @Setter public Allinone allinone = new Allinone();
    @Valid @Getter @Setter public Mandelbrot mandelbrot = new Mandelbrot();
    @Valid @Getter @Setter public SimulatedEvolution simulatedevolution = new SimulatedEvolution();
    @Valid @Getter @Setter public Cca cca = new Cca();
    @Valid @Getter @Setter public WienerProcess randomwalk = new WienerProcess();
    @Valid @Getter @Setter public Dla dla = new Dla();
    @Valid @Getter @Setter public Kochsnowflake kochsnowflake = new Kochsnowflake();
    @Valid @Getter @Setter public Samegame samegame = new Samegame();
    @Valid @Getter @Setter public Sierpinskitriangle sierpinskitriangle = new Sierpinskitriangle();
    @Valid @Getter @Setter public Tetris tetris = new Tetris();
    @Valid @Getter @Setter public Turmite turmite = new Turmite();
    @Valid @Getter @Setter public Wator wator = new Wator();
    @Valid @Getter @Setter public Gameoflive gameoflive = new Gameoflive();

    ////@Validated
    @ToString
    public static class Allinone {

        @Valid @Getter @Setter public Lattice lattice = new Lattice();
        @Valid @Getter @Setter public View view = new View();

        ////@Validated
        @ToString
        public static class Lattice {
            @NotNull  @Getter @Setter private Integer width;
            @NotNull  @Getter @Setter private Integer height;
        }

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String copyright;
            @NotNull  @Getter @Setter private Integer borderPaddingX;
            @NotNull  @Getter @Setter private Integer borderPaddingY;
            @NotNull  @Getter @Setter private Integer titleHeight;
            @NotBlank @Getter @Setter private String startStopp;
            @NotBlank @Getter @Setter private String start;
            @NotBlank @Getter @Setter private String stop;
            @NotBlank @Getter @Setter private String info;
        }
    }

    ////@Validated
    @ToString
    public static class Mandelbrot {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class SimulatedEvolution {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();
        @Valid @Getter @Setter public CellConf cellConf = new CellConf();
        @Valid @Getter @Setter public Population population = new Population();
        @Valid @Getter @Setter public Food food = new Food();
        @Valid @Getter @Setter public GardenOfEden gardenOfEden = new GardenOfEden();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer exitStatus;
            @NotNull  @Getter @Setter private Integer queueMaxLength;
        }

        ////@Validated
        @ToString
        public static class CellConf {
            @NotNull  @Getter @Setter private Integer fatMax;
            @NotNull  @Getter @Setter private Integer fatHungerMax;
            @NotNull  @Getter @Setter private Integer fatMinimumForSex;
            @NotNull  @Getter @Setter private Integer fatAtBirth;
            @NotNull  @Getter @Setter private Integer fatPerFood;
            @NotNull  @Getter @Setter private Integer ageOfAdulthood;
            @NotNull  @Getter @Setter private Integer ageOld;
            @NotNull  @Getter @Setter private Integer ageMax;
        }

        ////@Validated
        @ToString
        public static class Population {
            @NotNull  @Getter @Setter private Integer initialPopulation;
            @NotBlank @Getter @Setter private String panelPopulationStatistics;
            @NotBlank @Getter @Setter private String panelLifeCycleStatistics;
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java apps :: insourcing :: Simulated Evolution 31
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilContext.java apps :: legacy :: Simulated Evolution 35
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java Computer Kurzweil :: App 34
this.properties = computerKurzweilProperties;
        long seed = new Date().getTime();
        this.random = new Random(seed);
    }

    public CompoundBorder getTabbedPaneBorder() {
        return getBorder();
    }

    public CompoundBorder getFrameBorder(){
        return getBorder();
    }

    public CompoundBorder getBorder(){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }

    public CompoundBorder getBorder(String label){
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(label),
            BorderFactory.createEmptyBorder(top,left,bottom,right)
        );
    }

    private CompoundBorder getDoubleBorder(){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(left,right,top,bottom),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }

    private CompoundBorder getDoubleBorder(String label){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(left,right,top,bottom),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }

    public CompoundBorder getBottomButtonsPanelBorder(){
        return getDoubleBorder();
    }

    public CompoundBorder getBottomButtonsPanelBorder(String label){
        return getDoubleBorder(label);
    }

    private Border getZeroBorder() {
        int top = 0;
        int left = 0;
        int bottom = 0;
        int right = 0;
        return BorderFactory.createEmptyBorder(top,left,bottom,right);
    }

    public Border getTabBorder() {
        return getZeroBorder();
    }

    public Border getCanvasBorder() {
        return getZeroBorder();
    }

    public LatticePoint getWorldDimensions(){
        int x = this.properties.getAllinone().getLattice().getWidth();
        int y = this.properties.getAllinone().getLattice().getHeight();
        return new LatticePoint(x,y);
    }

    public LatticePoint getNextRandomLatticePoint() {
        int x = this.properties.getAllinone().getLattice().getWidth();
        int y = this.properties.getAllinone().getLattice().getHeight();
        int nextX = this.getRandom().nextInt(x);
        int nextY = this.getRandom().nextInt(y);
        LatticePoint p = new LatticePoint(nextX,nextY);
        p.normalize(this.getWorldDimensions());
        p.absoluteValue();
        return p;
    }

    public LifeCycle getNewCellLifeCycle() {
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 32
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 28
private final Point worldDimensions;

    public final static int YET_UNCOMPUTED = -1;

    private final static double complexWorldDimensionRealX = 3.2d;
    private final static double complexWorldDimensionImgY = 2.34d;
    private final static double complexCenterForMandelbrotRealX = -2.2f;
    private final static double complexCenterForMandelbrotImgY = -1.17f;
    private final static double complexCenterForJuliaRealX = -1.6d;
    private final static double complexCenterForJuliaImgY =  -1.17d;

    private volatile ComplexNumber complexWorldDimensions;
    private volatile ComplexNumber complexCenterForMandelbrot;
    private volatile ComplexNumber complexCenterForJulia;

    public volatile int zoomLevel;

    private volatile Deque<ComplexNumber> complexCenterForZoomedMandelbrot = new ArrayDeque<>();

    private volatile ComplexNumber zoomCenter;

    //public static Logger log = Logger.getLogger(GaussianNumberPlane.class.getName());

    public GaussianNumberPlane(ApplicationModel model) {
        this.worldDimensions = model.getWorldDimensions();
        this.lattice = new int[worldDimensions.getWidth()][worldDimensions.getHeight()];
        this.complexWorldDimensions = new ComplexNumber(
            complexWorldDimensionRealX,
            complexWorldDimensionImgY
        );
        this.complexCenterForMandelbrot = new ComplexNumber(
            complexCenterForMandelbrotRealX,
            complexCenterForMandelbrotImgY
        );
        this.complexCenterForJulia = new ComplexNumber(
            complexCenterForJuliaRealX,
            complexCenterForJuliaImgY
        );
        start();
    }

    public void setModeZoom() {
        this.setZoomLevel(1);
        this.setZoomCenter(complexCenterForMandelbrot);
    }

    public synchronized void start(){
        zoomLevel = 1;
        for(int y = 0;y < this.worldDimensions.getY(); y++){
            for(int x=0; x < worldDimensions.getX(); x++){
                lattice[x][y] = YET_UNCOMPUTED;
            }
        }
    }

    public synchronized int getCellStatusFor(int x,int y){
        return (lattice[x][y])<0?0:lattice[x][y];
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForJulia(Point turingPosition) {
        double realX = complexCenterForJulia.getReal()
            + (complexWorldDimensions.getReal()*turingPosition.getX())/worldDimensions.getX();
        double imgY = complexCenterForJulia.getImg()
            + (complexWorldDimensions.getImg()*turingPosition.getY())/worldDimensions.getY();
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForMandelbrot(Point turingPosition) {
        double realX = (
            complexCenterForMandelbrot.getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / worldDimensions.getX()
        );
        double imgY = (
            complexCenterForMandelbrot.getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / worldDimensions.getY()
        );
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForZoomedMandelbrot(Point turingPosition) {
        double realX = (
            ( complexCenterForMandelbrot.getReal() / this.getZoomLevel() )
            + getZoomCenter().getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / ( worldDimensions.getX() * this.getZoomLevel() )
        );
        double imgY = (
            ( complexCenterForMandelbrot.getImg() / this.getZoomLevel() )
            + getZoomCenter().getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / ( worldDimensions.getY() * this.getZoomLevel() )
        );
        return new ComplexNumber(realX,imgY);
    }

    public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 481
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 507
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 481
public static ComputerKurzweilProperties propertiesFactory(File conf){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf.getAbsolutePath());
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            InputStream input = new FileInputStream(conf);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public static ComputerKurzweilProperties propertiesFactory(String conf, String jar){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf);
        log.info("propertiesFactory jar:  "+jar);
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            JarFile jarFile = new JarFile(jar);
            JarEntry entry = jarFile.getJarEntry(conf);
            InputStream input = jarFile.getInputStream(entry);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public String getSubtitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getSubtitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getSubtitle();
            case SIMULATED_EVOLUTION:
                return this.getSimulatedevolution().getView().getSubtitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getSubtitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getSubtitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getSubtitle();
            case SAME_GAME:
                return this.getSamegame().getView().getSubtitle();
            case SIERPINSKI_TRIANGLE:
                return this.getSierpinskitriangle().getView().getSubtitle();
            case TETRIS:
                return this.getTetris().getView().getSubtitle();
            case TURMITE:
                return this.getTurmite().getView().getSubtitle();
            case WATOR:
                return this.getWator().getView().getSubtitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getSubtitle();
            default:
                return "UNDEFINED";
        }
    }

    public String getTitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getTitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getTitle();
            case SIMULATED_EVOLUTION:
                return  this.getSimulatedevolution().getView().getTitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getTitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getTitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getTitle();
            case SAME_GAME:
                return this.getSamegame().getView().getTitle();
            case SIERPINSKI_TRIANGLE:
                return  this.getSierpinskitriangle().getView().getTitle();
            case TETRIS:
                return  this.getTetris().getView().getTitle();
            case TURMITE:
                return this.getTurmite().getView().getTitle();
            case WATOR:
                return this.getWator().getView().getTitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getTitle();
            default:
                return "UNDEFINED";
        }
    }
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/model/CellCore.java apps :: insourcing :: Simulated Evolution 31
org/woehlke/computer/kurzweil/simulated/evolution/model/cell/CellCore.java apps :: legacy :: Simulated Evolution 35
private List<Integer> dna;

    private final static int MIN_VALUE = 0;
    private final static int MAX_VALUE = 16;
    private final static int MAX_INITIAL_VALUE = 8;

    /**
     * Random Generator is set from outside by Constructor.
     */
    private Random random;

    public CellCore(Random random) {
        dna = new ArrayList<Integer>();
        this.random = random;
        for (int i = 0; i < Orientation.values().length; i++) {
            int gen = random.nextInt() % MAX_INITIAL_VALUE;
            dna.add(gen);
        }
    }

    private CellCore(Random random, List<Integer> rna) {
        this.random = random;
        dna = new ArrayList<Integer>();
        dna.addAll(rna);
    }

    /**
     * Mitosis is the Cell Core Division where the DNA changes for Evolution.
     * After Mitosis this Cell Core is one of the two Children.
     *
     * @see Cell#performReproductionByCellDivision()
     *
     * @return the other Child CellCore.
     */
    public CellCore performMitosis() {
        List<Integer> rna = new ArrayList<Integer>();
        for (Integer dnaBase:dna) {
            rna.add(dnaBase);
        }
        CellCore child = new CellCore(random, rna);
        int baseIndex = random.nextInt() % Orientation.values().length;
        if (baseIndex < MIN_VALUE) {
            baseIndex *= -1;
        }
        Orientation base[] = Orientation.values();
        this.decrease(base[baseIndex]);
        child.increase(base[baseIndex]);
        return child;
    }

    private void increase(Orientation base) {
        int value = dna.get(base.ordinal());
        if (value == MAX_VALUE) {
            for (int i = 0; i < dna.size(); i++) {
                Integer val = dna.get(i);
                val--;
                dna.set(i, val);
            }
        }
        Integer val = dna.get(base.ordinal());
        val++;
        dna.set(base.ordinal(), val);
    }

    private void decrease(Orientation base) {
        int value = dna.get(base.ordinal());
        if (value == -MAX_VALUE) {
            for (int i = 0; i < dna.size(); i++) {
                Integer val = dna.get(i);
                val++;
                dna.set(i, val);
            }
            dna.set(base.ordinal(), 0);
        } else {
            dna.set(base.ordinal(), value-1);
        }
    }

    /**
     * @return gives a new Orientation based on the Combinition of Random and DNA.
     */
    public Orientation getRandomOrientation() {
        Orientation orientation = Orientation.FORWARD;
        int dnaLength = Orientation.values().length;
        double sumDna = 0.0;
        for (int i = 0; i < dnaLength; i++) {
            double val = dna.get(i).longValue() ^ 2;
            if (val < MIN_VALUE) {
                val *= -1;
            }
            sumDna += val;
        }
        double sum = 0.0;
        double[] rna = new double[dnaLength];
        for (int i = 0; i < dnaLength; i++) {
            double val = dna.get(i).longValue() ^ 2;
            if (val < MIN_VALUE) {
                val *= -1;
            }
            sum += val / sumDna;
            rna[i] = sum;
        }
        if (sumDna != 0) {
            double val = Double.valueOf(random.nextInt(MAX_VALUE) ^ 2);
            if (val < MIN_VALUE) {
                val *= -1;
            }
            double sumRandom = val / Double.valueOf(MAX_VALUE ^ 2);
            if (sumRandom < MIN_VALUE) {
                sumRandom *= -1;
            }
            int newInt = 0;
            for (int i = 0; i < dnaLength; i++) {
                if (sumRandom > rna[i]) {
                    newInt = i;
                }
            }
            orientation = Orientation.values()[newInt];
        }
        return orientation;
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 76
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 76
public static class MandelbrotZoom {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class SimulatedEvolution {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();
        @Valid @Getter @Setter public CellConf cellConf = new CellConf();
        @Valid @Getter @Setter public Population population = new Population();
        @Valid @Getter @Setter public Food food = new Food();
        @Valid @Getter @Setter public GardenOfEden gardenOfEden = new GardenOfEden();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer exitStatus;
            @NotNull  @Getter @Setter private Integer queueMaxLength;
        }

        ////@Validated
        @ToString
        public static class CellConf {
            @NotNull  @Getter @Setter private Integer fatMax;
            @NotNull  @Getter @Setter private Integer fatHungerMax;
            @NotNull  @Getter @Setter private Integer fatMinimumForSex;
            @NotNull  @Getter @Setter private Integer fatAtBirth;
            @NotNull  @Getter @Setter private Integer fatPerFood;
            @NotNull  @Getter @Setter private Integer ageOfAdulthood;
            @NotNull  @Getter @Setter private Integer ageOld;
            @NotNull  @Getter @Setter private Integer ageMax;
        }

        ////@Validated
        @ToString
        public static class Population {
            @NotNull  @Getter @Setter private Integer initialPopulation;
            @NotBlank @Getter @Setter private String panelPopulationStatistics;
            @NotBlank @Getter @Setter private String panelLifeCycleStatistics;
            @NotBlank @Getter @Setter private String youngCellsLabel;
            @NotBlank @Getter @Setter private String youngAndFatCellsLabel;
            @NotBlank @Getter @Setter private String fullAgeCellsLabel;
            @NotBlank @Getter @Setter private String hungryCellsLabel;
            @NotBlank @Getter @Setter private String oldCellsLabel;
            @NotBlank @Getter @Setter private String populationLabel;
            @NotBlank @Getter @Setter private String generationOldestLabel;
            @NotBlank @Getter @Setter private String generationYoungestLabel;
        }

        ////@Validated
        @ToString
        public static class Food {
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer foodPerDayFieldColumns;
            @NotBlank @Getter @Setter private String foodPerDayLabel;
            @NotBlank @Getter @Setter private String foodPerDayBorderLabel;
            @NotBlank @Getter @Setter private String buttonFoodPerDayIncrease;
            @NotBlank @Getter @Setter private String buttonFoodPerDayDecrease;
            @NotBlank @Getter @Setter private String panelFood;
        }

        ////@Validated
        @ToString
        public static class GardenOfEden {
            @NotBlank @Getter @Setter private String panelGardenOfEden;
            @NotNull  @Getter @Setter private Boolean gardenOfEdenEnabled;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledString;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledToggleButton;
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisor;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisorPadding;
        }
    }

    ////@Validated
    @ToString
    public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 52
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 45
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 45
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 55
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 52
public GaussianNumberPlane(KochSnowflakeModel model) {
        this.worldDimensions = model.getWorldDimensions();
        this.lattice = new int[worldDimensions.getWidth()][worldDimensions.getHeight()];
        this.complexWorldDimensions = new ComplexNumber(
            complexWorldDimensionRealX,
            complexWorldDimensionImgY
        );
        this.complexCenterForMandelbrot = new ComplexNumber(
            complexCenterForMandelbrotRealX,
            complexCenterForMandelbrotImgY
        );
        this.complexCenterForJulia = new ComplexNumber(
            complexCenterForJuliaRealX,
            complexCenterForJuliaImgY
        );
        start();
    }

    public void setModeZoom() {
        this.setZoomLevel(1);
        this.setZoomCenter(complexCenterForMandelbrot);
    }

    public synchronized void start(){
        zoomLevel = 1;
        for(int y = 0;y < this.worldDimensions.getY(); y++){
            for(int x=0; x < worldDimensions.getX(); x++){
                lattice[x][y] = YET_UNCOMPUTED;
            }
        }
    }

    public synchronized int getCellStatusFor(int x,int y){
        return (lattice[x][y])<0?0:lattice[x][y];
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForJulia(Point turingPosition) {
        double realX = complexCenterForJulia.getReal()
            + (complexWorldDimensions.getReal()*turingPosition.getX())/worldDimensions.getX();
        double imgY = complexCenterForJulia.getImg()
            + (complexWorldDimensions.getImg()*turingPosition.getY())/worldDimensions.getY();
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForMandelbrot(Point turingPosition) {
        double realX = (
            complexCenterForMandelbrot.getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / worldDimensions.getX()
        );
        double imgY = (
            complexCenterForMandelbrot.getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / worldDimensions.getY()
        );
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForZoomedMandelbrot(Point turingPosition) {
        double realX = (
            ( complexCenterForMandelbrot.getReal() / this.getZoomLevel() )
            + getZoomCenter().getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / ( worldDimensions.getX() * this.getZoomLevel() )
        );
        double imgY = (
            ( complexCenterForMandelbrot.getImg() / this.getZoomLevel() )
            + getZoomCenter().getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / ( worldDimensions.getY() * this.getZoomLevel() )
        );
        return new ComplexNumber(realX,imgY);
    }

    public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Koch Snowflake 15
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Sierpinski Triangle 15
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Turmite 15
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: WaTor 15
public class ComplexNumber implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    public final static int MAX_ITERATIONS = 64;
    private final static double DIVERGENCE_THRESHOLD = 4.0d;
    private volatile double real;
    private volatile double img;
    private volatile int iterations;
    private volatile boolean inMandelbrotSet;
    private volatile boolean inJuliaSet;

    public ComplexNumber() {
        this.real = 0.0d;
        this.img = 0.0d;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public ComplexNumber(ComplexNumber complexNumber) {
        this.real = complexNumber.real;
        this.img = complexNumber.img;
        this.iterations=complexNumber.iterations;
        this.inMandelbrotSet=complexNumber.inMandelbrotSet;
        this.inJuliaSet=complexNumber.inJuliaSet;
    }

    public ComplexNumber(double real, double img) {
        this.real = real;
        this.img = img;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public double getReal() {
        return real;
    }

    public double getImg() {
        return img;
    }

    public ComplexNumber plus(ComplexNumber complexNumber){
        double newRealZ = this.real + complexNumber.real;
        double newImgZ = this.img + complexNumber.img;
        return new ComplexNumber(newRealZ,newImgZ);
    }

    public ComplexNumber square(){
        double realZ=real;
        double imgZ=img;
        double newRealZ=realZ*realZ-imgZ*imgZ;
        double newImgZ=2*realZ*imgZ;
        return new ComplexNumber(newRealZ,newImgZ);
    }

    public synchronized int computeMandelbrotSet() {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber();
        do {
            iterationsTmp++;
            z = z.square().plus(this);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inMandelbrotSet = z.isNotDivergent();
        this.iterations = this.inMandelbrotSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized int computeJuliaSet(ComplexNumber c) {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber(this);
        do {
            iterationsTmp++;
            z = z.square().plus(c);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inJuliaSet = z.isNotDivergent();
        this.iterations = this.inJuliaSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized boolean isInMandelbrotSet() {
        return inMandelbrotSet;
    }

    public synchronized boolean isInJuliaSet() {
        return inJuliaSet;
    }

    public synchronized boolean isNotDivergent(){
        return (( real*real + img*img ) < DIVERGENCE_THRESHOLD);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ComplexNumber)) return false;
        ComplexNumber that = (ComplexNumber) o;
        return Double.compare(that.getReal(), getReal()) == 0 &&
            Double.compare(that.getImg(), getImg()) == 0 &&
            iterations == that.iterations &&
            isInMandelbrotSet() == that.isInMandelbrotSet() &&
            isInJuliaSet() == that.isInJuliaSet();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getReal(), getImg(), iterations, isInMandelbrotSet(), isInJuliaSet());
    }

    @Override
    public String toString() {
        return "ComplexNumber{" +
            "real=" + real +
            ", img=" + img +
            ", iterations=" + iterations +
            ", inMandelbrotSet=" + inMandelbrotSet +
            ", inJuliaSet=" + inJuliaSet +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Mandelbrot :: Julia 15
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Mandelbrot :: Zoom 15
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/ComplexNumber.java apps :: legacy :: Mandelbrot 15
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java Computer Kurzweil :: App 16
public class ComplexNumber implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    private volatile double real;
    private volatile double img;

    public final static int MAX_ITERATIONS = 64;
    private final static double DIVERGENCE_THRESHOLD = 4.0d;

    public double getReal() {
        return real;
    }

    public double getImg() {
        return img;
    }

    public ComplexNumber() {
        this.real = 0.0d;
        this.img = 0.0d;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public ComplexNumber(ComplexNumber complexNumber) {
        this.real = complexNumber.real;
        this.img = complexNumber.img;
        this.iterations=complexNumber.iterations;
        this.inMandelbrotSet=complexNumber.inMandelbrotSet;
        this.inJuliaSet=complexNumber.inJuliaSet;
    }

    public ComplexNumber(double real, double img) {
        this.real = real;
        this.img = img;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public ComplexNumber plus(ComplexNumber complexNumber){
        double newRealZ = this.real + complexNumber.real;
        double newImgZ = this.img + complexNumber.img;
        return new ComplexNumber(newRealZ,newImgZ);
    }

    public ComplexNumber square(){
        double realZ=real;
        double imgZ=img;
        double newRealZ=realZ*realZ-imgZ*imgZ;
        double newImgZ=2*realZ*imgZ;
        return new ComplexNumber(newRealZ,newImgZ);
    }

    private volatile int iterations;
    private volatile boolean inMandelbrotSet;
    private volatile boolean inJuliaSet;

    public synchronized int computeMandelbrotSet() {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber();
        do {
            iterationsTmp++;
            z = z.square().plus(this);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inMandelbrotSet = z.isNotDivergent();
        this.iterations = this.inMandelbrotSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized int computeJuliaSet(ComplexNumber c) {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber(this);
        do {
            iterationsTmp++;
            z = z.square().plus(c);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inJuliaSet = z.isNotDivergent();
        this.iterations = this.inJuliaSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized boolean isInMandelbrotSet() {
        return inMandelbrotSet;
    }

    public synchronized boolean isInJuliaSet() {
        return inJuliaSet;
    }

    public synchronized boolean isNotDivergent(){
        return (( real*real + img*img ) < DIVERGENCE_THRESHOLD);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ComplexNumber)) return false;
        ComplexNumber that = (ComplexNumber) o;
        return Double.compare(that.getReal(), getReal()) == 0 &&
            Double.compare(that.getImg(), getImg()) == 0 &&
            iterations == that.iterations &&
            isInMandelbrotSet() == that.isInMandelbrotSet() &&
            isInJuliaSet() == that.isInJuliaSet();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getReal(), getImg(), iterations, isInMandelbrotSet(), isInJuliaSet());
    }

    @Override
    public String toString() {
        return "ComplexNumber{" +
            "real=" + real +
            ", img=" + img +
            ", iterations=" + iterations +
            ", inMandelbrotSet=" + inMandelbrotSet +
            ", inJuliaSet=" + inJuliaSet +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/ComplexNumber.java apps :: legacy :: Mandelbrot to Julia 18
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/ComplexNumber.java Mandelbrot Zoom 18
public class ComplexNumber {

    private volatile double real;
    private volatile double img;

    public final static int MAX_ITERATIONS = 64;
    private final static double DIVERGENCE_THRESHOLD = 4.0d;

    public double getReal() {
        return real;
    }

    public double getImg() {
        return img;
    }

    public ComplexNumber() {
        this.real = 0.0d;
        this.img = 0.0d;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public ComplexNumber(ComplexNumber complexNumber) {
        this.real = complexNumber.real;
        this.img = complexNumber.img;
        this.iterations=complexNumber.iterations;
        this.inMandelbrotSet=complexNumber.inMandelbrotSet;
        this.inJuliaSet=complexNumber.inJuliaSet;
    }

    public ComplexNumber(double real, double img) {
        this.real = real;
        this.img = img;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public ComplexNumber plus(ComplexNumber complexNumber){
        double newRealZ = this.real + complexNumber.real;
        double newImgZ = this.img + complexNumber.img;
        return new ComplexNumber(newRealZ,newImgZ);
    }

    public ComplexNumber square(){
        double realZ=real;
        double imgZ=img;
        double newRealZ=realZ*realZ-imgZ*imgZ;
        double newImgZ=2*realZ*imgZ;
        return new ComplexNumber(newRealZ,newImgZ);
    }

    private volatile int iterations;
    private volatile boolean inMandelbrotSet;
    private volatile boolean inJuliaSet;

    public synchronized int computeMandelbrotSet() {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber();
        do {
            iterationsTmp++;
            z = z.square().plus(this);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inMandelbrotSet = z.isNotDivergent();
        this.iterations = this.inMandelbrotSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized int computeJuliaSet(ComplexNumber c) {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber(this);
        do {
            iterationsTmp++;
            z = z.square().plus(c);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inJuliaSet = z.isNotDivergent();
        this.iterations = this.inJuliaSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized boolean isInMandelbrotSet() {
        return inMandelbrotSet;
    }

    public synchronized boolean isInJuliaSet() {
        return inJuliaSet;
    }

    public synchronized boolean isNotDivergent(){
        return (( real*real + img*img ) < DIVERGENCE_THRESHOLD);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ComplexNumber)) return false;
        ComplexNumber that = (ComplexNumber) o;
        return Double.compare(that.getReal(), getReal()) == 0 &&
            Double.compare(that.getImg(), getImg()) == 0 &&
            iterations == that.iterations &&
            isInMandelbrotSet() == that.isInMandelbrotSet() &&
            isInJuliaSet() == that.isInJuliaSet();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getReal(), getImg(), iterations, isInMandelbrotSet(), isInJuliaSet());
    }

    @Override
    public String toString() {
        return "ComplexNumber{" +
            "real=" + real +
            ", img=" + img +
            ", iterations=" + iterations +
            ", inMandelbrotSet=" + inMandelbrotSet +
            ", inJuliaSet=" + inJuliaSet +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Mandelbrot :: Julia 19
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Mandelbrot :: Zoom 19
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/ComplexNumber.java apps :: legacy :: Mandelbrot to Julia 20
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/ComplexNumber.java Mandelbrot Zoom 20
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/ComplexNumber.java apps :: legacy :: Mandelbrot 19
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java Computer Kurzweil :: App 20
private volatile double real;
    private volatile double img;

    public final static int MAX_ITERATIONS = 64;
    private final static double DIVERGENCE_THRESHOLD = 4.0d;

    public double getReal() {
        return real;
    }

    public double getImg() {
        return img;
    }

    public ComplexNumber() {
        this.real = 0.0d;
        this.img = 0.0d;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public ComplexNumber(ComplexNumber complexNumber) {
        this.real = complexNumber.real;
        this.img = complexNumber.img;
        this.iterations=complexNumber.iterations;
        this.inMandelbrotSet=complexNumber.inMandelbrotSet;
        this.inJuliaSet=complexNumber.inJuliaSet;
    }

    public ComplexNumber(double real, double img) {
        this.real = real;
        this.img = img;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public ComplexNumber plus(ComplexNumber complexNumber){
        double newRealZ = this.real + complexNumber.real;
        double newImgZ = this.img + complexNumber.img;
        return new ComplexNumber(newRealZ,newImgZ);
    }

    public ComplexNumber square(){
        double realZ=real;
        double imgZ=img;
        double newRealZ=realZ*realZ-imgZ*imgZ;
        double newImgZ=2*realZ*imgZ;
        return new ComplexNumber(newRealZ,newImgZ);
    }

    private volatile int iterations;
    private volatile boolean inMandelbrotSet;
    private volatile boolean inJuliaSet;

    public synchronized int computeMandelbrotSet() {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber();
        do {
            iterationsTmp++;
            z = z.square().plus(this);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inMandelbrotSet = z.isNotDivergent();
        this.iterations = this.inMandelbrotSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized int computeJuliaSet(ComplexNumber c) {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber(this);
        do {
            iterationsTmp++;
            z = z.square().plus(c);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inJuliaSet = z.isNotDivergent();
        this.iterations = this.inJuliaSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized boolean isInMandelbrotSet() {
        return inMandelbrotSet;
    }

    public synchronized boolean isInJuliaSet() {
        return inJuliaSet;
    }

    public synchronized boolean isNotDivergent(){
        return (( real*real + img*img ) < DIVERGENCE_THRESHOLD);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ComplexNumber)) return false;
        ComplexNumber that = (ComplexNumber) o;
        return Double.compare(that.getReal(), getReal()) == 0 &&
            Double.compare(that.getImg(), getImg()) == 0 &&
            iterations == that.iterations &&
            isInMandelbrotSet() == that.isInMandelbrotSet() &&
            isInJuliaSet() == that.isInJuliaSet();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getReal(), getImg(), iterations, isInMandelbrotSet(), isInJuliaSet());
    }

    @Override
    public String toString() {
        return "ComplexNumber{" +
            "real=" + real +
            ", img=" + img +
            ", iterations=" + iterations +
            ", inMandelbrotSet=" + inMandelbrotSet +
            ", inJuliaSet=" + inJuliaSet +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 496
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 522
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 917
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 496
}

    public static ComputerKurzweilProperties propertiesFactory(String conf, String jar){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf);
        log.info("propertiesFactory jar:  "+jar);
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            JarFile jarFile = new JarFile(jar);
            JarEntry entry = jarFile.getJarEntry(conf);
            InputStream input = jarFile.getInputStream(entry);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public String getSubtitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getSubtitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getSubtitle();
            case SIMULATED_EVOLUTION:
                return this.getSimulatedevolution().getView().getSubtitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getSubtitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getSubtitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getSubtitle();
            case SAME_GAME:
                return this.getSamegame().getView().getSubtitle();
            case SIERPINSKI_TRIANGLE:
                return this.getSierpinskitriangle().getView().getSubtitle();
            case TETRIS:
                return this.getTetris().getView().getSubtitle();
            case TURMITE:
                return this.getTurmite().getView().getSubtitle();
            case WATOR:
                return this.getWator().getView().getSubtitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getSubtitle();
            default:
                return "UNDEFINED";
        }
    }

    public String getTitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getTitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getTitle();
            case SIMULATED_EVOLUTION:
                return  this.getSimulatedevolution().getView().getTitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getTitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getTitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getTitle();
            case SAME_GAME:
                return this.getSamegame().getView().getTitle();
            case SIERPINSKI_TRIANGLE:
                return  this.getSierpinskitriangle().getView().getTitle();
            case TETRIS:
                return  this.getTetris().getView().getTitle();
            case TURMITE:
                return this.getTurmite().getView().getTitle();
            case WATOR:
                return this.getWator().getView().getTitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getTitle();
            default:
                return "UNDEFINED";
        }
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 60
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 60
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 60
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 60
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 917
}

    public static ComputerKurzweilProperties propertiesFactory(String conf, String jar){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf);
        log.info("propertiesFactory jar:  "+jar);
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            JarFile jarFile = new JarFile(jar);
            JarEntry entry = jarFile.getJarEntry(conf);
            InputStream input = jarFile.getInputStream(entry);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public String getSubtitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getSubtitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getSubtitle();
            case SIMULATED_EVOLUTION:
                return this.getSimulatedevolution().getView().getSubtitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getSubtitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getSubtitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getSubtitle();
            case SAME_GAME:
                return this.getSamegame().getView().getSubtitle();
            case SIERPINSKI_TRIANGLE:
                return this.getSierpinskitriangle().getView().getSubtitle();
            case TETRIS:
                return this.getTetris().getView().getSubtitle();
            case TURMITE:
                return this.getTurmite().getView().getSubtitle();
            case WATOR:
                return this.getWator().getView().getSubtitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getSubtitle();
            default:
                return "UNDEFINED";
        }
    }

    public String getTitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getTitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getTitle();
            case SIMULATED_EVOLUTION:
                return  this.getSimulatedevolution().getView().getTitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getTitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getTitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getTitle();
            case SAME_GAME:
                return this.getSamegame().getView().getTitle();
            case SIERPINSKI_TRIANGLE:
                return  this.getSierpinskitriangle().getView().getTitle();
            case TETRIS:
                return  this.getTetris().getView().getTitle();
            case TURMITE:
                return this.getTurmite().getView().getTitle();
            case WATOR:
                return this.getWator().getView().getTitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getTitle();
            default:
                return "UNDEFINED";
        }
    }
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeTab.java apps :: insourcing :: Koch Snowflake 43
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleTab.java apps :: insourcing :: Sierpinski Triangle 43
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteTab.java apps :: insourcing :: Turmite 43
org/woehlke/computer/kurzweil/tabs/wator/WatorTab.java apps :: insourcing :: WaTor 43
this.mandelbrotController = new KochSnowflakeController(mandelbrotModel, this);
        PanelButtons panelButtons = new PanelButtons(this.mandelbrotModel);
        PanelSubtitle panelSubtitle = new PanelSubtitle(properties.getWator().getView().getSubtitle());
        PanelCopyright panelCopyright = new PanelCopyright(properties.getAllinone().getView().getCopyright());
        JSeparator separator = new JSeparator();
        rootPane.setLayout(layout);
        rootPane.add(panelSubtitle);
        rootPane.add(canvas);
        rootPane.add(panelCopyright);
        rootPane.add(separator);
        rootPane.add(panelButtons);
        addWindowListener(this);
        this.canvas.addMouseListener(   this);
        showMeInit();
        setModeSwitch();
        this.mandelbrotController.start();
    }

    public void windowOpened(WindowEvent e) {
        showMe();
    }

    public void windowClosing(WindowEvent e) {
        this.mandelbrotController.exit();
    }

    public void windowClosed(WindowEvent e) {
        this.mandelbrotController.exit();
    }

    public void windowIconified(WindowEvent e) {}

    public void windowDeiconified(WindowEvent e) {
        showMe();
    }

    public void windowActivated(WindowEvent e) {
        showMe();
    }

    public void windowDeactivated(WindowEvent e) {}


    @Override
    public void mouseClicked(MouseEvent e) {
        Point c = new Point(e.getX(), e.getY());
        this.mandelbrotModel.click(c);
        showMe();
    }

    @Override
    public void mousePressed(MouseEvent e) {}

    @Override
    public void mouseReleased(MouseEvent e) {}

    @Override
    public void mouseEntered(MouseEvent e) {}

    @Override
    public void mouseExited(MouseEvent e) {}

    public void showMeInit() {
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = this.rootPane.getWidth();
        double height  = this.canvas.getHeight() + 180;
        double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        int myheight = Double.valueOf(height).intValue();
        int mywidth = Double.valueOf(width).intValue();
        int mystartX = Double.valueOf(startX).intValue();
        int mystartY = Double.valueOf(startY).intValue();
        this.rectangleBounds = new Rectangle(mystartX, mystartY, mywidth, myheight);
        this.dimensionSize = new Dimension(mywidth, myheight);
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setVisible(true);
        toFront();
    }

    /**
     * TODO write doc.
     */
    public void showMe() {
        this.pack();
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setVisible(true);
        this.toFront();
    }

    public void setModeSwitch() {
        canvas.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    }

    public void setModeZoom() {
        canvas.setCursor(new Cursor(Cursor.HAND_CURSOR));
    }

    public KochSnowflakeCanvas getCanvas() {
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/zoom/config/Config.java Mandelbrot Zoom 24
org/woehlke/computer/kurzweil/mandelbrot/config/Config.java apps :: legacy :: Mandelbrot 23
private String title;
    private String subtitle;
    private String copyright;
    private int width;
    private int height;

    private String buttonsLabel;
    private String buttonsSwitch;
    private String buttonsZoom;
    private String buttonsZoomOut;

    public Config() {
        String appPropertiesFile = (APP_PROPERTIES_FILENAME);
        Properties prop = new Properties();
        try (
            InputStream input = new FileInputStream(appPropertiesFile)) {
            prop.load(input);
            /*
            for( Object key : prop.keySet()){
                System.out.println(prop.get(key).toString());
            }
            */
            title = prop.getProperty(KEY_TITLE,TITLE);
            subtitle = prop.getProperty(KEY_SUBTITLE,SUBTITLE);
            copyright = prop.getProperty(KEY_COPYRIGHT,COPYRIGHT);
            String widthString = prop.getProperty(KEY_WIDTH,WIDTH);
            String heightString = prop.getProperty(KEY_HEIGHT,HEIGHT);
            width = Integer.parseInt(widthString);
            height = Integer.parseInt(heightString);
            buttonsLabel = prop.getProperty(KEY_BUTTONS_LABEL,BUTTONS_LABEL);
            buttonsSwitch = prop.getProperty(KEY_BUTTONS_SWITCH,BUTTONS_SWITCH);
            buttonsZoom = prop.getProperty(KEY_BUTTONS_ZOOM,BUTTONS_ZOOM);
            buttonsZoomOut = prop.getProperty(KEY_BUTTONS_ZOOMOUT,BUTTONS_ZOOMOUT);
        } catch (IOException ex) {
            System.out.println(ex.getLocalizedMessage());
        }
    }

    public String getTitle() {
        return title;
    }

    public String getSubtitle() {
        return subtitle;
    }

    public String getCopyright() {
        return copyright;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public String getButtonsLabel() {
        return buttonsLabel;
    }

    public String getButtonsSwitch() {
        return buttonsSwitch;
    }

    public String getButtonsZoom() {
        return buttonsZoom;
    }

    public String getButtonsZoomOut() {
        return buttonsZoomOut;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Config)) return false;
        Config config = (Config) o;
        return getWidth() == config.getWidth() &&
            getHeight() == config.getHeight() &&
            Objects.equals(getTitle(), config.getTitle()) &&
            Objects.equals(getSubtitle(), config.getSubtitle()) &&
            Objects.equals(getCopyright(), config.getCopyright()) &&
            Objects.equals(getButtonsLabel(), config.getButtonsLabel()) &&
            Objects.equals(getButtonsSwitch(), config.getButtonsSwitch()) &&
            Objects.equals(getButtonsZoom(), config.getButtonsZoom()) &&
            Objects.equals(getButtonsZoomOut(), config.getButtonsZoomOut());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getTitle(), getSubtitle(), getCopyright(), getWidth(), getHeight(), getButtonsLabel(), getButtonsSwitch(), getButtonsZoom(), getButtonsZoomOut());
    }

    @Override
    public String toString() {
        return "Config{" +
            "title='" + title + '\'' +
            ", subtitle='" + subtitle + '\'' +
            ", copyright='" + copyright + '\'' +
            ", width=" + width +
            ", height=" + height +
            ", buttonsLabel='" + buttonsLabel + '\'' +
            ", buttonsSwitch='" + buttonsSwitch + '\'' +
            ", buttonsZoom='" + buttonsZoom + '\'' +
            ", buttonsZoomOut='" + buttonsZoomOut + '\'' +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeTab.java apps :: insourcing :: Koch Snowflake 45
org/woehlke/computer/kurzweil/tabs/mandelbrotzoom/MandelbrotZoomTab.java apps :: insourcing :: Mandelbrot :: Zoom 45
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleTab.java apps :: insourcing :: Sierpinski Triangle 45
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteTab.java apps :: insourcing :: Turmite 45
org/woehlke/computer/kurzweil/tabs/wator/WatorTab.java apps :: insourcing :: WaTor 45
PanelSubtitle panelSubtitle = new PanelSubtitle(properties.getWator().getView().getSubtitle());
        PanelCopyright panelCopyright = new PanelCopyright(properties.getAllinone().getView().getCopyright());
        JSeparator separator = new JSeparator();
        rootPane.setLayout(layout);
        rootPane.add(panelSubtitle);
        rootPane.add(canvas);
        rootPane.add(panelCopyright);
        rootPane.add(separator);
        rootPane.add(panelButtons);
        addWindowListener(this);
        this.canvas.addMouseListener(   this);
        showMeInit();
        setModeSwitch();
        this.mandelbrotController.start();
    }

    public void windowOpened(WindowEvent e) {
        showMe();
    }

    public void windowClosing(WindowEvent e) {
        this.mandelbrotController.exit();
    }

    public void windowClosed(WindowEvent e) {
        this.mandelbrotController.exit();
    }

    public void windowIconified(WindowEvent e) {}

    public void windowDeiconified(WindowEvent e) {
        showMe();
    }

    public void windowActivated(WindowEvent e) {
        showMe();
    }

    public void windowDeactivated(WindowEvent e) {}


    @Override
    public void mouseClicked(MouseEvent e) {
        Point c = new Point(e.getX(), e.getY());
        this.mandelbrotModel.click(c);
        showMe();
    }

    @Override
    public void mousePressed(MouseEvent e) {}

    @Override
    public void mouseReleased(MouseEvent e) {}

    @Override
    public void mouseEntered(MouseEvent e) {}

    @Override
    public void mouseExited(MouseEvent e) {}

    public void showMeInit() {
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = this.rootPane.getWidth();
        double height  = this.canvas.getHeight() + 180;
        double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        int myheight = Double.valueOf(height).intValue();
        int mywidth = Double.valueOf(width).intValue();
        int mystartX = Double.valueOf(startX).intValue();
        int mystartY = Double.valueOf(startY).intValue();
        this.rectangleBounds = new Rectangle(mystartX, mystartY, mywidth, myheight);
        this.dimensionSize = new Dimension(mywidth, myheight);
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setVisible(true);
        toFront();
    }

    /**
     * TODO write doc.
     */
    public void showMe() {
        this.pack();
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setVisible(true);
        this.toFront();
    }

    public void setModeSwitch() {
        canvas.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    }

    public void setModeZoom() {
        canvas.setCursor(new Cursor(Cursor.HAND_CURSOR));
    }

    public KochSnowflakeCanvas getCanvas() {
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 507
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 533
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 1020
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 928
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 507
InputStream input = jarFile.getInputStream(entry);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public String getSubtitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getSubtitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getSubtitle();
            case SIMULATED_EVOLUTION:
                return this.getSimulatedevolution().getView().getSubtitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getSubtitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getSubtitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getSubtitle();
            case SAME_GAME:
                return this.getSamegame().getView().getSubtitle();
            case SIERPINSKI_TRIANGLE:
                return this.getSierpinskitriangle().getView().getSubtitle();
            case TETRIS:
                return this.getTetris().getView().getSubtitle();
            case TURMITE:
                return this.getTurmite().getView().getSubtitle();
            case WATOR:
                return this.getWator().getView().getSubtitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getSubtitle();
            default:
                return "UNDEFINED";
        }
    }

    public String getTitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getTitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getTitle();
            case SIMULATED_EVOLUTION:
                return  this.getSimulatedevolution().getView().getTitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getTitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getTitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getTitle();
            case SAME_GAME:
                return this.getSamegame().getView().getTitle();
            case SIERPINSKI_TRIANGLE:
                return  this.getSierpinskitriangle().getView().getTitle();
            case TETRIS:
                return  this.getTetris().getView().getTitle();
            case TURMITE:
                return this.getTurmite().getView().getTitle();
            case WATOR:
                return this.getWator().getView().getTitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getTitle();
            default:
                return "UNDEFINED";
        }
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 71
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 71
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 1020
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 71
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 71
InputStream input = jarFile.getInputStream(entry);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public String getSubtitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getSubtitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getSubtitle();
            case SIMULATED_EVOLUTION:
                return this.getSimulatedevolution().getView().getSubtitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getSubtitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getSubtitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getSubtitle();
            case SAME_GAME:
                return this.getSamegame().getView().getSubtitle();
            case SIERPINSKI_TRIANGLE:
                return this.getSierpinskitriangle().getView().getSubtitle();
            case TETRIS:
                return this.getTetris().getView().getSubtitle();
            case TURMITE:
                return this.getTurmite().getView().getSubtitle();
            case WATOR:
                return this.getWator().getView().getSubtitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getSubtitle();
            default:
                return "UNDEFINED";
        }
    }

    public String getTitle(TabType tabType){
        switch (tabType){
            case CYCLIC_CELLULAR_AUTOMATON:
                return this.getCca().getView().getTitle();
            case DIFFUSION_LIMITED_AGGREGATION:
                return this.getDla().getView().getTitle();
            case SIMULATED_EVOLUTION:
                return  this.getSimulatedevolution().getView().getTitle();
            case MANDELBROT_SET:
                return this.getMandelbrot().getView().getTitle();
            case RANDOM_WALK_WIENER_PROCESS:
                return this.getRandomwalk().getView().getTitle();
            case KOCH_SNOWFLAKE:
                return this.getKochsnowflake().getView().getTitle();
            case SAME_GAME:
                return this.getSamegame().getView().getTitle();
            case SIERPINSKI_TRIANGLE:
                return  this.getSierpinskitriangle().getView().getTitle();
            case TETRIS:
                return  this.getTetris().getView().getTitle();
            case TURMITE:
                return this.getTurmite().getView().getTitle();
            case WATOR:
                return this.getWator().getView().getTitle();
            case CONWAYS_GAME_OF_LIFE:
                return this.getGameoflive().getView().getTitle();
            default:
                return "UNDEFINED";
        }
    }
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 19
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 17
@Log
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
@Valid
////@Validated
public class ComputerKurzweilProperties implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    @Valid @Getter @Setter public Allinone allinone = new Allinone();
    @Valid @Getter @Setter public Mandelbrot mandelbrot = new Mandelbrot();
    @Valid @Getter @Setter public SimulatedEvolution simulatedevolution = new SimulatedEvolution();
    @Valid @Getter @Setter public Cca cca = new Cca();
    @Valid @Getter @Setter public WienerProcess randomwalk = new WienerProcess();
    @Valid @Getter @Setter public Dla dla = new Dla();
    @Valid @Getter @Setter public Kochsnowflake kochsnowflake = new Kochsnowflake();
    @Valid @Getter @Setter public Samegame samegame = new Samegame();
    @Valid @Getter @Setter public Sierpinskitriangle sierpinskitriangle = new Sierpinskitriangle();
    @Valid @Getter @Setter public Tetris tetris = new Tetris();
    @Valid @Getter @Setter public Turmite turmite = new Turmite();
    @Valid @Getter @Setter public Wator wator = new Wator();
    @Valid @Getter @Setter public Gameoflive gameoflive = new Gameoflive();

    ////@Validated
    @ToString
    public static class Allinone {

        @Valid @Getter @Setter public Lattice lattice = new Lattice();
        @Valid @Getter @Setter public View view = new View();

        ////@Validated
        @ToString
        public static class Lattice {
            @NotNull  @Getter @Setter private Integer width;
            @NotNull  @Getter @Setter private Integer height;
        }

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String copyright;
            @NotNull  @Getter @Setter private Integer borderPaddingX;
            @NotNull  @Getter @Setter private Integer borderPaddingY;
            @NotNull  @Getter @Setter private Integer titleHeight;
            @NotBlank @Getter @Setter private String startStopp;
            @NotBlank @Getter @Setter private String start;
            @NotBlank @Getter @Setter private String stop;
            @NotBlank @Getter @Setter private String info;
        }
    }

    ////@Validated
    @ToString
    public static class Mandelbrot {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class SimulatedEvolution {
File Project Line
org/woehlke/computer/kurzweil/tabs/dla/model/Point.java apps :: insourcing :: Diffusion Limited Aggregation 20
org/woehlke/computer/kurzweil/dla/model/Point.java apps :: legacy :: Diffusion Limited Aggregation 21
private int x = 0;
    private int y = 0;

    public Point(Point p) {
        this.x = p.getX();
        this.y = p.getY();
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void killNagative() {
        if (y < 0) {
            y *= -1;
        }
        if (x < 0) {
            x *= -1;
        }
    }

    public void add(Point p) {
        this.x += p.getX();
        this.y += p.getY();
    }

    public void normalize(Point p) {
        this.x %= p.getX();
        this.y %= p.getY();
    }

    public Point[] getNeighbourhood(Point max){
        Point neighbourhood[] = new Point[9];
        int maxX = max.getX();
        int maxY = max.getY();
        neighbourhood[0]= new Point((this.x+maxX-1) % maxX,(this.y+maxY-1) % maxY);
        neighbourhood[1]= new Point((this.x+maxX-1) % maxX,this.y);
        neighbourhood[2]= new Point((this.x+maxX-1) % maxX,(this.y+maxY+1) % maxY);
        neighbourhood[3]= new Point(this.x,(this.y+maxY-1) % maxY);
        neighbourhood[4]= new Point(this.x,this.y);
        neighbourhood[5]= new Point(this.x,(this.y+maxY+1) % maxY);
        neighbourhood[6]= new Point((this.x+maxX+1) % maxX,(this.y+maxY-1) % maxY);
        neighbourhood[7]= new Point((this.x+maxX+1) % maxX,this.y);
        neighbourhood[8]= new Point((this.x+maxX+1) % maxX,(this.y+maxY+1) % maxY);
        return neighbourhood;
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/model/WorldPoint.java apps :: insourcing :: Simulated Evolution 28
org/woehlke/computer/kurzweil/simulated/evolution/model/world/WorldPoint.java apps :: legacy :: Simulated Evolution 32
private int x = 0;

    /**
     * Vertical Y-Coordinate. Also used as Height;
     */
    private int y = 0;

    public WorldPoint(WorldPoint p) {
        this.x = p.getX();
        this.y = p.getY();
    }

    public WorldPoint(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void killNagative() {
        if (y < 0) {
            y *= -1;
        }
        if (x < 0) {
            x *= -1;
        }
    }

    public void add(WorldPoint p) {
        this.x += p.getX();
        this.y += p.getY();
    }

    public void normalize(WorldPoint p) {
        this.x %= p.getX();
        this.y %= p.getY();
    }


    /**
     * Get Neighbourhood.
     * @param max - limit the dimensions of the world around
     * @return The Set of Points belonging to the Neighbourhood of the position given by this Point Object.
     */
    public WorldPoint[] getNeighbourhood(WorldPoint max){
        WorldPoint neighbourhood[] = new WorldPoint[9];
        int maxX = max.getX();
        int maxY = max.getY();
        neighbourhood[0]= new WorldPoint((this.x+maxX-1) % maxX,(this.y+maxY-1) % maxY);
        neighbourhood[1]= new WorldPoint((this.x+maxX-1) % maxX,this.y);
        neighbourhood[2]= new WorldPoint((this.x+maxX-1) % maxX,(this.y+maxY+1) % maxY);
        neighbourhood[3]= new WorldPoint(this.x,(this.y+maxY-1) % maxY);
        neighbourhood[4]= new WorldPoint(this.x,this.y);
        neighbourhood[5]= new WorldPoint(this.x,(this.y+maxY+1) % maxY);
        neighbourhood[6]= new WorldPoint((this.x+maxX+1) % maxX,(this.y+maxY-1) % maxY);
        neighbourhood[7]= new WorldPoint((this.x+maxX+1) % maxX,this.y);
        neighbourhood[8]= new WorldPoint((this.x+maxX+1) % maxX,(this.y+maxY+1) % maxY);
        return neighbourhood;
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/view/ApplicationFrame.java apps :: legacy :: Mandelbrot to Julia 68
org/woehlke/computer/kurzweil/mandelbrot/zoom/view/ApplicationFrame.java Mandelbrot Zoom 67
rootPane.add(panelCopyright);
        this.addWindowListener(this);
        this.canvas.addMouseListener(   this);
        this.showMeInit();
        this.setModeSwitch();
        this.controllerThread.start();
    }

    public void windowOpened(WindowEvent e) {
        showMe();
    }

    public void windowClosing(WindowEvent e) {
        this.controllerThread.exit();
    }

    public void windowClosed(WindowEvent e) {
        this.controllerThread.exit();
    }

    public void windowIconified(WindowEvent e) {}

    public void windowDeiconified(WindowEvent e) {
        showMe();
    }

    public void windowActivated(WindowEvent e) {
        showMe();
    }

    public void windowDeactivated(WindowEvent e) {}


    @Override
    public void mouseClicked(MouseEvent e) {
        Point c = new Point(e.getX(), e.getY());
        this.applicationModel.click(c);
        showMe();
    }

    @Override
    public void mousePressed(MouseEvent e) {}

    @Override
    public void mouseReleased(MouseEvent e) {}

    @Override
    public void mouseEntered(MouseEvent e) {}

    @Override
    public void mouseExited(MouseEvent e) {}

    /**
     * Things to do, to show the Application Window started by Constructor
     */
    public void showMeInit() {
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = this.rootPane.getWidth();
        double height  = this.canvas.getHeight() + 180;
        double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        int myheight = Double.valueOf(height).intValue();
        int mywidth = Double.valueOf(width).intValue();
        int mystartX = Double.valueOf(startX).intValue();
        int mystartY = Double.valueOf(startY).intValue();
        this.rectangleBounds = new Rectangle(mystartX, mystartY, mywidth, myheight);
        this.dimensionSize = new Dimension(mywidth, myheight);
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setVisible(true);
        toFront();
    }

    /**
     * Things to do, to show the Application Window again.
     */
    public void showMe() {
        this.pack();
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setVisible(true);
        this.toFront();
    }

    public void setModeSwitch() {
        canvas.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    }

    public ApplicationCanvas getCanvas() {
        return canvas;
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/model/Cell.java apps :: insourcing :: Simulated Evolution 35
org/woehlke/computer/kurzweil/simulated/evolution/model/cell/Cell.java apps :: legacy :: Simulated Evolution 36
private CellCore cellCore;

    /**
     * The Cell's state is position, orientation and LifeCycle
     */
    private WorldPoint position;

    /**
     * The Cell's state is position, orientation and LifeCycle
     */
    private Orientation orientation;

    /**
     * The Cell's state is position, orientation and LifeCycle
     */
    private LifeCycle lifeCycle;

    /**
     * The World Dimensions in which this Cell can move.
     */
    private WorldPoint max;

    /**
     * Random Generator is set from outside by Constructor.
     */
    private Random random;

    public Cell(WorldPoint max, WorldPoint position, Random random) {
        this.max = new WorldPoint(max);
        this.position = new WorldPoint(position);
        this.random = random;
        this.cellCore = new CellCore(random);
        this.max.killNagative();
        this.position.setX(random.nextInt() % max.getX());
        this.position.setY(random.nextInt() % max.getY());
        this.position.killNagative();
        this.orientation = getRandomOrientation();
        this.lifeCycle = new LifeCycle();
    }

    private Cell(int fat, CellCore rna, WorldPoint position, WorldPoint max, Random random) {
        lifeCycle = new LifeCycle(fat);
        this.max = new WorldPoint(max);
        this.position = new WorldPoint(position);
        this.random = random;
        this.cellCore = rna;
        orientation = getRandomOrientation();
    }

    private Orientation getRandomOrientation() {
        int dnaLength = Orientation.values().length;
        int dnaBase = random.nextInt(dnaLength);
        if (dnaBase < 0) {
            dnaBase *= -1;
        }
        return Orientation.values()[dnaBase];
    }

    private void getNextOrientation() {
        Orientation randomOrientation = cellCore.getRandomOrientation();
        int iOrientation = orientation.ordinal();
        int iRandomOrientation = randomOrientation.ordinal();
        int newOrientation = (iOrientation + iRandomOrientation) % Orientation.values().length;
        orientation = Orientation.values()[newOrientation];
    }

    /**
     * The Cell moves on the Step in a Direction choosen by Random and DNA.
     */
    public void move() {
        if(lifeCycle.move()){
            getNextOrientation();
            position.add(orientation.getMove());
            position.add(max);
            position.normalize(max);
        }
    }

    /**
     * After performing Reproduction by Cell Division this Cell is one of the two Children this Method returns the other Child.
     *
     * @see CellCore#performMitosis()
     *
     * @return the other Child
     */
    public Cell performReproductionByCellDivision() {
        CellCore rna = cellCore.performMitosis();
        lifeCycle.haveSex();
        Cell child = new Cell(lifeCycle.getFat(), rna, position, max, random);
        return child;
    }

    /**
     * @return The new Position after the last move.
     */
    public WorldPoint getPosition() {
        return position;
    }

    /**
     * @return true, if this Cell is able to perform Reproduction by Cell Division
     */
    public boolean isPregnant() {
        return lifeCycle.isPregnant();
    }

    /**
     * Eat the available Food in this Position
     * @param food the available Food in this Position
     */
    public void eat(int food) {
        lifeCycle.eat(food);
    }

    /**
     * @return true, if this Cell died of hunger
     */
    public boolean died() {
        return lifeCycle.isDead();
    }

    /**
     * @return the LifeCycleStatus of this Cell
     */
    public LifeCycleStatus getLifeCycleStatus(){
        return lifeCycle.getLifeCycleStatus();
    }

}
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/PanelSubtitle.java apps :: insourcing :: Simulated Evolution 20
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/PanelSubtitle.java apps :: legacy :: Simulated Evolution 28
public PanelSubtitle(String text) {
        this.setLayout(new FlowLayoutCenter());
        this.add(new JLabel(text));
    }

   // @Override
    public void showMe() {
        this.setVisible(true);
    }

    public static PanelSubtitle getPanelSubtitleForApplication(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getAllinone().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForCca(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getCca().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForDla(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getDla().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSimulatedEvolution(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSimulatedevolution().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSimulatedKochSnowflake(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getKochsnowflake().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForMandelbrot(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getMandelbrot().getView().getSubtitle();
        return new PanelSubtitle(text);
    }


    public static PanelSubtitle getPanelSubtitleForSameGame(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSamegame().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSierpinskiTriangle(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSierpinskitriangle().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSierpinskiTetris(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getTetris().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSierpinskiTurmite(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getTurmite().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSierpinskiWaTor(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getWator().getView().getSubtitle();
        return new PanelSubtitle(text);
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/PanelTitle.java apps :: insourcing :: Simulated Evolution 20
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/PanelTitle.java apps :: legacy :: Simulated Evolution 28
public PanelTitle(String text) {
        this.setLayout(new FlowLayoutCenter());
        this.add(new JLabel(text));
    }

    //@Override
    public void showMe() {
        this.setVisible(true);
    }

    public static PanelTitle getPanelTitleForApplication(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getAllinone().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForCca(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getCca().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForDla(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getDla().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSimulatedEvolution(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSimulatedevolution().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSimulatedKochSnowflake(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getKochsnowflake().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForMandelbrot(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getMandelbrot().getView().getTitle();
        return new PanelTitle(text);
    }


    public static PanelTitle getPanelTitleForSameGame(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSamegame().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSierpinskiTriangle(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSierpinskitriangle().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSierpinskiTetris(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getTetris().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSierpinskiTurmite(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getTurmite().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSierpinskiWaTor(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getWator().getView().getTitle();
        return new PanelTitle(text);
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/view/ApplicationFrame.java apps :: legacy :: Mandelbrot to Julia 72
org/woehlke/computer/kurzweil/mandelbrot/zoom/view/ApplicationFrame.java Mandelbrot Zoom 71
org/woehlke/computer/kurzweil/mandelbrot/view/ApplicationFrame.java apps :: legacy :: Mandelbrot 56
this.setModeSwitch();
        this.controllerThread.start();
    }

    public void windowOpened(WindowEvent e) {
        showMe();
    }

    public void windowClosing(WindowEvent e) {
        this.controllerThread.exit();
    }

    public void windowClosed(WindowEvent e) {
        this.controllerThread.exit();
    }

    public void windowIconified(WindowEvent e) {}

    public void windowDeiconified(WindowEvent e) {
        showMe();
    }

    public void windowActivated(WindowEvent e) {
        showMe();
    }

    public void windowDeactivated(WindowEvent e) {}


    @Override
    public void mouseClicked(MouseEvent e) {
        Point c = new Point(e.getX(), e.getY());
        this.applicationModel.click(c);
        showMe();
    }

    @Override
    public void mousePressed(MouseEvent e) {}

    @Override
    public void mouseReleased(MouseEvent e) {}

    @Override
    public void mouseEntered(MouseEvent e) {}

    @Override
    public void mouseExited(MouseEvent e) {}

    /**
     * Things to do, to show the Application Window started by Constructor
     */
    public void showMeInit() {
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = this.rootPane.getWidth();
        double height  = this.canvas.getHeight() + 180;
        double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        int myheight = Double.valueOf(height).intValue();
        int mywidth = Double.valueOf(width).intValue();
        int mystartX = Double.valueOf(startX).intValue();
        int mystartY = Double.valueOf(startY).intValue();
        this.rectangleBounds = new Rectangle(mystartX, mystartY, mywidth, myheight);
        this.dimensionSize = new Dimension(mywidth, myheight);
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setVisible(true);
        toFront();
    }

    /**
     * Things to do, to show the Application Window again.
     */
    public void showMe() {
        this.pack();
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setVisible(true);
        this.toFront();
    }

    public void setModeSwitch() {
        canvas.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    }

    public ApplicationCanvas getCanvas() {
File Project Line
org/woehlke/computer/kurzweil/tabs/cca/config/Config.java apps :: insourcing :: Cyclic Cellular Automaton 14
org/woehlke/computer/kurzweil/cyclic/cellular/automaton/config/Config.java apps :: legacy :: Cyclic Cellular Automaton 20
private String title;
    private String subtitle;
    private int width;
    private int height;
    private String neighborhood;
    private String buttonVonNeumann;
    private String buttonMoore;
    private String buttonWoehlke;

    private static final int TITLE_HEIGHT = 30;

    public Config() {
        String appPropertiesFile = (APP_PROPERTIES_FILENAME);
        Properties prop = new Properties();
        try (
            InputStream input = new FileInputStream(appPropertiesFile)) {
            prop.load(input);
            for( Object key : prop.keySet()){
                //System.out.println(prop.get(key).toString());
            }
            title = prop.getProperty(KEY_TITLE,TITLE);
            subtitle = prop.getProperty(KEY_SUBTITLE,SUBTITLE);
            String widthString = prop.getProperty(KEY_WIDTH,WIDTH);
            String heightString = prop.getProperty(KEY_HEIGHT,HEIGHT);
            width = Integer.parseInt(widthString);
            height = Integer.parseInt(heightString);
            neighborhood=prop.getProperty(KEY_NEIGHBORHOOD,NEIGHBORHOOD);
            buttonVonNeumann=prop.getProperty(KEY_BUTTON_VON_NEUMANN,BUTTON_VON_NEUMANN);
            buttonMoore=prop.getProperty(KEY_BUTTON_MOORE,BUTTON_MOORE);
            buttonWoehlke=prop.getProperty(KEY_BUTTON_WOEHLKE,BUTTON_WOEHLKE);
        } catch (IOException ex) {
            System.out.println(ex.getLocalizedMessage());
        }
    }

    public Rectangle getFrameBounds(){
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double startX = (screenSize.getWidth() - height) / 2d;
        double startY = (screenSize.getHeight() - width) / 2d;
        int myheight = Double.valueOf(height).intValue()+TITLE_HEIGHT;
        int mywidth = Double.valueOf(width).intValue();
        int mystartX = Double.valueOf(startX).intValue();
        int mystartY = Double.valueOf(startY).intValue();
        return new Rectangle(mystartX, mystartY, mywidth, myheight);
    }

    public Rectangle getCanvasBounds(){
        return new Rectangle(0, 0, width , height);
    }

    public Point getLatticeDimensions(){
        return new Point(width,height);
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public String getTitle() {
        return title;
    }

    public String getSubtitle() {
        return subtitle;
    }

    public String getNeighborhood() {
        return neighborhood;
    }

    public String getButtonVonNeumann() {
        return buttonVonNeumann;
    }

    public String getButtonMoore() {
        return buttonMoore;
    }

    public String getButtonWoehlke() {
        return buttonWoehlke;
    }


}
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/PanelSubtitle.java apps :: insourcing :: Simulated Evolution 26
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/PanelSubtitle.java apps :: legacy :: Simulated Evolution 34
org/woehlke/computer/kurzweil/commons/widgets/PanelSubtitle.java Computer Kurzweil :: App 26
public void showMe() {
        this.setVisible(true);
    }

    public static PanelSubtitle getPanelSubtitleForApplication(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getAllinone().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForCca(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getCca().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForDla(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getDla().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSimulatedEvolution(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSimulatedevolution().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSimulatedKochSnowflake(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getKochsnowflake().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForMandelbrot(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getMandelbrot().getView().getSubtitle();
        return new PanelSubtitle(text);
    }


    public static PanelSubtitle getPanelSubtitleForSameGame(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSamegame().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSierpinskiTriangle(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSierpinskitriangle().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSierpinskiTetris(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getTetris().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSierpinskiTurmite(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getTurmite().getView().getSubtitle();
        return new PanelSubtitle(text);
    }

    public static PanelSubtitle getPanelSubtitleForSierpinskiWaTor(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getWator().getView().getSubtitle();
        return new PanelSubtitle(text);
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/PanelTitle.java apps :: insourcing :: Simulated Evolution 26
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/PanelTitle.java apps :: legacy :: Simulated Evolution 33
org/woehlke/computer/kurzweil/commons/widgets/PanelTitle.java Computer Kurzweil :: App 26
public void showMe() {
        this.setVisible(true);
    }

    public static PanelTitle getPanelTitleForApplication(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getAllinone().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForCca(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getCca().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForDla(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getDla().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSimulatedEvolution(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSimulatedevolution().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSimulatedKochSnowflake(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getKochsnowflake().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForMandelbrot(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getMandelbrot().getView().getTitle();
        return new PanelTitle(text);
    }


    public static PanelTitle getPanelTitleForSameGame(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSamegame().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSierpinskiTriangle(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getSierpinskitriangle().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSierpinskiTetris(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getTetris().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSierpinskiTurmite(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getTurmite().getView().getTitle();
        return new PanelTitle(text);
    }

    public static PanelTitle getPanelTitleForSierpinskiWaTor(ComputerKurzweilContext ctx) {
        String text = ctx.getProperties().getWator().getView().getTitle();
        return new PanelTitle(text);
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/LatticeNeighbourhood.java apps :: insourcing :: Simulated Evolution 10
org/woehlke/computer/kurzweil/commons/model/LatticeNeighbourhood.java Computer Kurzweil :: App 10
@Log
@Getter
@ToString
@EqualsAndHashCode
public class LatticeNeighbourhood implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    private final LatticeNeighbourhoodType neighbourhoodType;
    private final int maxX;
    private final int maxY;
    private final int x;
    private final int y;

    private LatticePoint[] neighbourhood;

    public LatticeNeighbourhood(
        int maxX,  int maxY, int x,  int y,
        LatticeNeighbourhoodType neighbourhoodType
    ) {
        this.neighbourhoodType = neighbourhoodType;
        this.maxX = maxX;
        this.maxY = maxY;
        this.x = x;
        this.y = y;
        this.neighbourhood = getNeighbourhoodPoints();
    }

    /**
     * Get Neighbourhood.
     *
     * @return The Set of Points belonging to the Neighbourhood of the position given by this Point Object.
     */
    private LatticePoint[] getNeighbourhoodPoints() {
        LatticePointNeighbourhoodPosition[] positions = LatticePointNeighbourhoodPosition.getNeighbourhoodFor(neighbourhoodType);
        this.neighbourhood = new LatticePoint[positions.length];
        for(int i = 0; i < positions.length; i++){
            this.neighbourhood[i] = new LatticePoint(
                (x + maxX + positions[i].getX()) % maxX,
                (y + maxY + positions[i].getY()) % maxY
            );
        }
        return this.neighbourhood;
    }

    public static LatticePoint[] get(int worldX, int worldY, int myX, int myY) {
        LatticeNeighbourhoodType neighbourhoodType = LatticeNeighbourhoodType.MOORE_NEIGHBORHOOD;
        LatticeNeighbourhood n = new LatticeNeighbourhood(worldX, worldY, myX, myY, neighbourhoodType);
        return n.getNeighbourhoodPoints();
    }

    public static LatticePoint[] getMoore(int worldX, int worldY, int myX, int myY) {
        LatticeNeighbourhoodType neighbourhoodType = LatticeNeighbourhoodType.MOORE_NEIGHBORHOOD;
        LatticeNeighbourhood n = new LatticeNeighbourhood(worldX, worldY, myX, myY, neighbourhoodType);
        return n.getNeighbourhoodPoints();
    }

    public static LatticePoint[] getVonNeumann(int worldX, int worldY, int myX, int myY) {
        LatticeNeighbourhoodType neighbourhoodType = LatticeNeighbourhoodType.VON_NEUMANN_NEIGHBORHOOD;
        LatticeNeighbourhood n = new LatticeNeighbourhood(worldX, worldY, myX, myY, neighbourhoodType);
        return n.getNeighbourhoodPoints();
    }

    public static LatticePoint[] getWoehlke(int worldX, int worldY, int myX, int myY) {
        LatticeNeighbourhoodType neighbourhoodType = LatticeNeighbourhoodType.WOEHLKE_NEIGHBORHOOD;
        LatticeNeighbourhood n = new LatticeNeighbourhood(worldX, worldY, myX, myY, neighbourhoodType);
        return n.getNeighbourhoodPoints();
    }

}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 102
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 157
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 202
public static class MandelbrotZoom {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class SimulatedEvolution {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();
        @Valid @Getter @Setter public CellConf cellConf = new CellConf();
        @Valid @Getter @Setter public Population population = new Population();
        @Valid @Getter @Setter public Food food = new Food();
        @Valid @Getter @Setter public GardenOfEden gardenOfEden = new GardenOfEden();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer exitStatus;
            @NotNull  @Getter @Setter private Integer queueMaxLength;
        }

        ////@Validated
        @ToString
        public static class CellConf {
            @NotNull  @Getter @Setter private Integer fatMax;
            @NotNull  @Getter @Setter private Integer fatHungerMax;
            @NotNull  @Getter @Setter private Integer fatMinimumForSex;
            @NotNull  @Getter @Setter private Integer fatAtBirth;
            @NotNull  @Getter @Setter private Integer fatPerFood;
            @NotNull  @Getter @Setter private Integer ageOfAdulthood;
            @NotNull  @Getter @Setter private Integer ageOld;
            @NotNull  @Getter @Setter private Integer ageMax;
        }

        ////@Validated
        @ToString
        public static class Population {
            @NotNull  @Getter @Setter private Integer initialPopulation;
            @NotBlank @Getter @Setter private String panelPopulationStatistics;
            @NotBlank @Getter @Setter private String panelLifeCycleStatistics;
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 65
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Julia 66
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 72
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 65
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 65
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 65
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 75
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 72
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 72
this.setZoomCenter(complexCenterForMandelbrot);
    }

    public synchronized void start(){
        zoomLevel = 1;
        for(int y = 0;y < this.worldDimensions.getY(); y++){
            for(int x=0; x < worldDimensions.getX(); x++){
                lattice[x][y] = YET_UNCOMPUTED;
            }
        }
    }

    public synchronized int getCellStatusFor(int x,int y){
        return (lattice[x][y])<0?0:lattice[x][y];
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForJulia(Point turingPosition) {
        double realX = complexCenterForJulia.getReal()
            + (complexWorldDimensions.getReal()*turingPosition.getX())/worldDimensions.getX();
        double imgY = complexCenterForJulia.getImg()
            + (complexWorldDimensions.getImg()*turingPosition.getY())/worldDimensions.getY();
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForMandelbrot(Point turingPosition) {
        double realX = (
            complexCenterForMandelbrot.getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / worldDimensions.getX()
        );
        double imgY = (
            complexCenterForMandelbrot.getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / worldDimensions.getY()
        );
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForZoomedMandelbrot(Point turingPosition) {
        double realX = (
            ( complexCenterForMandelbrot.getReal() / this.getZoomLevel() )
            + getZoomCenter().getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / ( worldDimensions.getX() * this.getZoomLevel() )
        );
        double imgY = (
            ( complexCenterForMandelbrot.getImg() / this.getZoomLevel() )
            + getZoomCenter().getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / ( worldDimensions.getY() * this.getZoomLevel() )
        );
        return new ComplexNumber(realX,imgY);
    }

    public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
File Project Line
org/woehlke/computer/kurzweil/commons/model/LatticeNeighbourhood.java apps :: insourcing :: Simulated Evolution 18
org/woehlke/computer/kurzweil/simulated/evolution/model/lattice/LatticeNeighbourhood.java apps :: legacy :: Simulated Evolution 26
org/woehlke/computer/kurzweil/commons/model/LatticeNeighbourhood.java Computer Kurzweil :: App 18
private final LatticeNeighbourhoodType neighbourhoodType;
    private final int maxX;
    private final int maxY;
    private final int x;
    private final int y;

    private LatticePoint[] neighbourhood;

    public LatticeNeighbourhood(
        int maxX,  int maxY, int x,  int y,
        LatticeNeighbourhoodType neighbourhoodType
    ) {
        this.neighbourhoodType = neighbourhoodType;
        this.maxX = maxX;
        this.maxY = maxY;
        this.x = x;
        this.y = y;
        this.neighbourhood = getNeighbourhoodPoints();
    }

    /**
     * Get Neighbourhood.
     *
     * @return The Set of Points belonging to the Neighbourhood of the position given by this Point Object.
     */
    private LatticePoint[] getNeighbourhoodPoints() {
        LatticePointNeighbourhoodPosition[] positions = LatticePointNeighbourhoodPosition.getNeighbourhoodFor(neighbourhoodType);
        this.neighbourhood = new LatticePoint[positions.length];
        for(int i = 0; i < positions.length; i++){
            this.neighbourhood[i] = new LatticePoint(
                (x + maxX + positions[i].getX()) % maxX,
                (y + maxY + positions[i].getY()) % maxY
            );
        }
        return this.neighbourhood;
    }

    public static LatticePoint[] get(int worldX, int worldY, int myX, int myY) {
        LatticeNeighbourhoodType neighbourhoodType = LatticeNeighbourhoodType.MOORE_NEIGHBORHOOD;
        LatticeNeighbourhood n = new LatticeNeighbourhood(worldX, worldY, myX, myY, neighbourhoodType);
        return n.getNeighbourhoodPoints();
    }

    public static LatticePoint[] getMoore(int worldX, int worldY, int myX, int myY) {
        LatticeNeighbourhoodType neighbourhoodType = LatticeNeighbourhoodType.MOORE_NEIGHBORHOOD;
        LatticeNeighbourhood n = new LatticeNeighbourhood(worldX, worldY, myX, myY, neighbourhoodType);
        return n.getNeighbourhoodPoints();
    }

    public static LatticePoint[] getVonNeumann(int worldX, int worldY, int myX, int myY) {
        LatticeNeighbourhoodType neighbourhoodType = LatticeNeighbourhoodType.VON_NEUMANN_NEIGHBORHOOD;
        LatticeNeighbourhood n = new LatticeNeighbourhood(worldX, worldY, myX, myY, neighbourhoodType);
        return n.getNeighbourhoodPoints();
    }

    public static LatticePoint[] getWoehlke(int worldX, int worldY, int myX, int myY) {
        LatticeNeighbourhoodType neighbourhoodType = LatticeNeighbourhoodType.WOEHLKE_NEIGHBORHOOD;
        LatticeNeighbourhood n = new LatticeNeighbourhood(worldX, worldY, myX, myY, neighbourhoodType);
        return n.getNeighbourhoodPoints();
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/SimulatedEvolutionModel.java apps :: insourcing :: Simulated Evolution 45
org/woehlke/computer/kurzweil/simulated/evolution/model/SimulatedEvolutionModel.java apps :: legacy :: Simulated Evolution 47
private List<Cell> cells;

    /**
     * Start with 20 Cells.
     */
    private final int INITIAL_POPULATION = 20;

    /**
     * Random Generator used for Bacteria Motion.
     */
    private Random random;

    /**
     * Definition of the World's Size in Pixel Width and Height.
     */
    private WorldPoint worldDimensions;

    /**
     * Map of the World monitoring growth and eating food.
     */
    private SimulatedEvolutionWorldLattice simulatedEvolutionWorldLattice;

    //@Getter
    //private SimulatedEvolutionPopulationContainer simulatedEvolutionPopulationContainer;

    @Getter
    private SimulatedEvolutionParameter simulatedEvolutionParameter;

    public SimulatedEvolutionModel(WorldPoint worldDimensions) {
        long seed = new Date().getTime();
        random = new Random(seed);
        this.worldDimensions = worldDimensions;
        simulatedEvolutionWorldLattice = new SimulatedEvolutionWorldLattice(this.worldDimensions,random);
        createPopulation();
        simulatedEvolutionParameter = new SimulatedEvolutionParameter();
        //simulatedEvolutionPopulationContainer = new SimulatedEvolutionPopulationContainer(tabCtx);
    }

    /**
     * Create the initial Population of Bacteria Cells and give them their position in the World.
     */
    private void createPopulation() {
        cells = new ArrayList<Cell>();
        for (int i = 0; i < INITIAL_POPULATION; i++) {
            int x = random.nextInt(worldDimensions.getX());
            int y = random.nextInt(worldDimensions.getY());
            if (x < 0) {
                x *= -1;
            }
            if (y < 0) {
                y *= -1;
            }
            WorldPoint pos = new WorldPoint(x, y);
            Cell cell = new Cell(worldDimensions, pos, random);
            cells.add(cell);
        }
    }

    /**
     * One Step of Time in the World in which the Population of Bacteria Cell perform Life:
     * Every Cell moves, eats, dies of hunger, and it has sex: splitting into two children with changed DNA.
     */
    public void letLivePopulation() {
        simulatedEvolutionWorldLattice.letFoodGrow();
        WorldPoint pos;
        List<Cell> children = new ArrayList<Cell>();
        List<Cell> died = new ArrayList<Cell>();
        for (Cell cell:cells) {
            cell.move();
            if(cell.died()){
                died.add(cell);
            } else {
                pos = cell.getPosition();
                int food = simulatedEvolutionWorldLattice.eat(pos);
                cell.eat(food);
                if (cell.isPregnant()) {
                    Cell child = cell.performReproductionByCellDivision();
                    children.add(child);
                }
            }
        }
        for(Cell dead:died){
            cells.remove(dead);
        }
        cells.addAll(children);
    }

    public List<Cell> getAllCells(){
        return cells;
    }

    public boolean hasFood(int x, int y) {
        return simulatedEvolutionWorldLattice.hasFood(x,y);
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Koch Snowflake 73
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Mandelbrot :: Julia 75
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Mandelbrot :: Zoom 75
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Sierpinski Triangle 73
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Turmite 73
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: WaTor 73
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/ComplexNumber.java apps :: legacy :: Mandelbrot to Julia 76
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/ComplexNumber.java Mandelbrot Zoom 76
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/ComplexNumber.java apps :: legacy :: Mandelbrot 75
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java Computer Kurzweil :: App 76
public synchronized int computeMandelbrotSet() {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber();
        do {
            iterationsTmp++;
            z = z.square().plus(this);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inMandelbrotSet = z.isNotDivergent();
        this.iterations = this.inMandelbrotSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized int computeJuliaSet(ComplexNumber c) {
        int iterationsTmp = 0;
        ComplexNumber z = new ComplexNumber(this);
        do {
            iterationsTmp++;
            z = z.square().plus(c);
        } while (z.isNotDivergent() && (iterationsTmp < MAX_ITERATIONS));
        this.inJuliaSet = z.isNotDivergent();
        this.iterations = this.inJuliaSet?0:iterationsTmp;
        return this.iterations;
    }

    public synchronized boolean isInMandelbrotSet() {
        return inMandelbrotSet;
    }

    public synchronized boolean isInJuliaSet() {
        return inJuliaSet;
    }

    public synchronized boolean isNotDivergent(){
        return (( real*real + img*img ) < DIVERGENCE_THRESHOLD);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ComplexNumber)) return false;
        ComplexNumber that = (ComplexNumber) o;
        return Double.compare(that.getReal(), getReal()) == 0 &&
            Double.compare(that.getImg(), getImg()) == 0 &&
            iterations == that.iterations &&
            isInMandelbrotSet() == that.isInMandelbrotSet() &&
            isInJuliaSet() == that.isInJuliaSet();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getReal(), getImg(), iterations, isInMandelbrotSet(), isInJuliaSet());
    }

    @Override
    public String toString() {
        return "ComplexNumber{" +
            "real=" + real +
            ", img=" + img +
            ", iterations=" + iterations +
            ", inMandelbrotSet=" + inMandelbrotSet +
            ", inJuliaSet=" + inJuliaSet +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Koch Snowflake 14
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Mandelbrot :: Julia 14
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Mandelbrot :: Zoom 14
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Sierpinski Triangle 14
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Turmite 14
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: WaTor 14
public class MandelbrotTuringPositions implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    private volatile Point turingPosition;
    private volatile Point worldDimensions;
    private volatile Point firstSetPosition;

    private volatile MandelbrotTuringDirection turingDirection;

    private volatile int steps;

    public MandelbrotTuringPositions(Point worldDimensions) {
        this.worldDimensions = worldDimensions;
        start();
    }

    public void start() {
        this.steps = 0;
        this.turingPosition = new Point((worldDimensions.getX()-2),(worldDimensions.getY()/2+11));
        this.turingDirection = MandelbrotTuringDirection.LEFT;
    }

    public synchronized void markFirstSetPosition(){
        this.firstSetPosition = turingPosition;
        this.steps = 0;
    }

    public synchronized Point getTuringPosition() {
        return turingPosition;
    }

    public synchronized void goForward() {
        this.steps++;
        switch (this.turingDirection){
            case UP:
                this.turingPosition.moveUp();
                break;
            case RIGHT:
                this.turingPosition.moveRight();
                break;
            case DOWN:
                this.turingPosition.moveDown();
                break;
            case LEFT:
                this.turingPosition.moveLeft();
                break;
            default:
                break;
        }
    }

    public synchronized void turnRight() {
        MandelbrotTuringDirection newTuringDirection;
        switch (this.turingDirection){
            case UP: newTuringDirection = MandelbrotTuringDirection.RIGHT; break;
            case RIGHT: newTuringDirection = MandelbrotTuringDirection.DOWN; break;
            case DOWN: newTuringDirection = MandelbrotTuringDirection.LEFT; break;
            case LEFT: newTuringDirection = MandelbrotTuringDirection.UP; break;
            default: newTuringDirection = this.turingDirection; break;
        }
        this.turingDirection = newTuringDirection;
    }

    public synchronized void turnLeft() {
        MandelbrotTuringDirection newTuringDirection;
        switch (this.turingDirection){
            case UP: newTuringDirection = MandelbrotTuringDirection.LEFT; break;
            case RIGHT: newTuringDirection = MandelbrotTuringDirection.UP; break;
            case DOWN: newTuringDirection = MandelbrotTuringDirection.RIGHT; break;
            case LEFT: newTuringDirection = MandelbrotTuringDirection.DOWN; break;
            default: newTuringDirection = this.turingDirection; break;
        }
        this.turingDirection = newTuringDirection;
    }

    public synchronized boolean isFinishedWalkAround() {
        return (this.turingPosition.equals(this.firstSetPosition)) && (this.steps>100);
    }

}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/model/turing/TuringPositions.java apps :: legacy :: Mandelbrot 16
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/model/turing/TuringPositions.java Computer Kurzweil :: App 14
public class TuringPositions implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    private volatile Point turingPosition;
    private volatile Point worldDimensions;
    private volatile Point firstSetPosition;

    private volatile TuringDirection turingDirection;

    private volatile int steps;

    public TuringPositions(Point worldDimensions) {
        this.worldDimensions = worldDimensions;
        start();
    }

    public void start() {
        this.steps = 0;
        this.turingPosition = new Point((worldDimensions.getX()-2),(worldDimensions.getY()/2+11));
        this.turingDirection = TuringDirection.LEFT;
    }

    public synchronized void markFirstSetPosition(){
        this.firstSetPosition = turingPosition;
        this.steps = 0;
    }

    public synchronized Point getTuringPosition() {
        return turingPosition;
    }

    public synchronized void goForward() {
        this.steps++;
        switch (this.turingDirection){
            case UP:
                this.turingPosition.moveUp();
                break;
            case RIGHT:
                this.turingPosition.moveRight();
                break;
            case DOWN:
                this.turingPosition.moveDown();
                break;
            case LEFT:
                this.turingPosition.moveLeft();
                break;
            default:
                break;
        }
    }

    public synchronized void turnRight() {
        TuringDirection newTuringDirection;
        switch (this.turingDirection){
            case UP: newTuringDirection = TuringDirection.RIGHT; break;
            case RIGHT: newTuringDirection = TuringDirection.DOWN; break;
            case DOWN: newTuringDirection = TuringDirection.LEFT; break;
            case LEFT: newTuringDirection = TuringDirection.UP; break;
            default: newTuringDirection = this.turingDirection; break;
        }
        this.turingDirection = newTuringDirection;
    }

    public synchronized void turnLeft() {
        TuringDirection newTuringDirection;
        switch (this.turingDirection){
            case UP: newTuringDirection = TuringDirection.LEFT; break;
            case RIGHT: newTuringDirection = TuringDirection.UP; break;
            case DOWN: newTuringDirection = TuringDirection.RIGHT; break;
            case LEFT: newTuringDirection = TuringDirection.DOWN; break;
            default: newTuringDirection = this.turingDirection; break;
        }
        this.turingDirection = newTuringDirection;
    }

    public synchronized boolean isFinishedWalkAround() {
        return (this.turingPosition.equals(this.firstSetPosition)) && (this.steps>100);
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/model/SimulatedEvolutionWorldLattice.java apps :: insourcing :: Simulated Evolution 29
org/woehlke/computer/kurzweil/simulated/evolution/model/lattice/SimulatedEvolutionWorldLattice.java apps :: legacy :: Simulated Evolution 34
private int worldMapFood[][];

    /**
     * How much food per Time Step (a day) shall be placed in this World.
     */
    private final int FOOD_PER_DAY = 10;

    /**
     * A Garden of Eden is an Area where much more Food grows within the same time.
     * As a Result of Evolution you will find sucessful Bacteria Cells with a different DNA and Motion as outside the Garden of Eden.
     */
    private final boolean EABLE_GARDEN_OF_EDEN = true;

    /**
     * Random Generator used for placing food, coming from another Object.
     */
    private Random random;

    /**
     * Dimension for the Grid inside the WorldMapFood which is the Same as in World Data Model and in the View.
     */
    private WorldPoint dimensions;

    public SimulatedEvolutionWorldLattice(WorldPoint dimensions, Random random){
        this.dimensions=dimensions;
        worldMapFood = new int[this.dimensions.getX()][this.dimensions.getY()];
        this.random=random;
    }

    /**
     * Delivers new food to random positions.
     */
    public void letFoodGrow() {
        int f = 0;
        while (f < FOOD_PER_DAY) {
            f++;
            int x = random.nextInt(this.dimensions.getX());
            int y = random.nextInt(this.dimensions.getY());
            if (x < 0) {
                x *= -1;
            }
            if (y < 0) {
                y *= -1;
            }
            worldMapFood[x][y]++;
        }
        if(EABLE_GARDEN_OF_EDEN){
            f = 0;
            int startx = this.dimensions.getX() / 5;
            int starty = this.dimensions.getY() / 5;
            while (f < FOOD_PER_DAY*4) {
                f++;
                int x = random.nextInt(startx);
                int y = random.nextInt(starty);
                if (x < 0) {
                    x *= -1;
                }
                if (y < 0) {
                    y *= -1;
                }
                worldMapFood[x+startx*2][y+starty*2]++;
            }
        }
    }

    public boolean hasFood(int x, int y) {
        return worldMapFood[x][y] > 0;
    }

    /**
     * Reduces Food in the Grid by eating and delivers the food energy to the eating Cell.
     *
     * @see LifeCycle
     *
     * @param position where is the food and the eating cell
     * @return the engergy of the food, will be added to cell's fat.
     */
    public int eat(WorldPoint position) {
        WorldPoint neighbourhood[] = position.getNeighbourhood(this.dimensions);
        int food=0;
        for (WorldPoint neighbourhoodPosition:neighbourhood){
            food += worldMapFood[neighbourhoodPosition.getX()][neighbourhoodPosition.getY()];
            worldMapFood[neighbourhoodPosition.getX()][neighbourhoodPosition.getY()]=0;
        }
        return food;
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/turing/TuringPositions.java apps :: legacy :: Mandelbrot to Julia 19
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/turing/TuringPositions.java Mandelbrot Zoom 19
public class TuringPositions {

    private volatile Point turingPosition;
    private volatile Point worldDimensions;
    private volatile Point firstSetPosition;

    private volatile TuringDirection turingDirection;

    private volatile int steps;

    public TuringPositions(Point worldDimensions) {
        this.worldDimensions = worldDimensions;
        start();
    }

    public void start() {
        this.steps = 0;
        this.turingPosition = new Point((worldDimensions.getX()-2),(worldDimensions.getY()/2+11));
        this.turingDirection = TuringDirection.LEFT;
    }

    public synchronized void markFirstSetPosition(){
        this.firstSetPosition = turingPosition;
        this.steps = 0;
    }

    public synchronized Point getTuringPosition() {
        return turingPosition;
    }

    public synchronized void goForward() {
        this.steps++;
        switch (this.turingDirection){
            case UP:
                this.turingPosition.moveUp();
                break;
            case RIGHT:
                this.turingPosition.moveRight();
                break;
            case DOWN:
                this.turingPosition.moveDown();
                break;
            case LEFT:
                this.turingPosition.moveLeft();
                break;
            default:
                break;
        }
    }

    public synchronized void turnRight() {
        TuringDirection newTuringDirection;
        switch (this.turingDirection){
            case UP: newTuringDirection = TuringDirection.RIGHT; break;
            case RIGHT: newTuringDirection = TuringDirection.DOWN; break;
            case DOWN: newTuringDirection = TuringDirection.LEFT; break;
            case LEFT: newTuringDirection = TuringDirection.UP; break;
            default: newTuringDirection = this.turingDirection; break;
        }
        this.turingDirection = newTuringDirection;
    }

    public synchronized void turnLeft() {
        TuringDirection newTuringDirection;
        switch (this.turingDirection){
            case UP: newTuringDirection = TuringDirection.LEFT; break;
            case RIGHT: newTuringDirection = TuringDirection.UP; break;
            case DOWN: newTuringDirection = TuringDirection.RIGHT; break;
            case LEFT: newTuringDirection = TuringDirection.DOWN; break;
            default: newTuringDirection = this.turingDirection; break;
        }
        this.turingDirection = newTuringDirection;
    }

    public synchronized boolean isFinishedWalkAround() {
        return (this.turingPosition.equals(this.firstSetPosition)) && (this.steps>100);
    }

}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/turing/TuringPositions.java apps :: legacy :: Mandelbrot to Julia 21
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/turing/TuringPositions.java Mandelbrot Zoom 21
org/woehlke/computer/kurzweil/mandelbrot/model/turing/TuringPositions.java apps :: legacy :: Mandelbrot 20
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/model/turing/TuringPositions.java Computer Kurzweil :: App 18
private volatile Point turingPosition;
    private volatile Point worldDimensions;
    private volatile Point firstSetPosition;

    private volatile TuringDirection turingDirection;

    private volatile int steps;

    public TuringPositions(Point worldDimensions) {
        this.worldDimensions = worldDimensions;
        start();
    }

    public void start() {
        this.steps = 0;
        this.turingPosition = new Point((worldDimensions.getX()-2),(worldDimensions.getY()/2+11));
        this.turingDirection = TuringDirection.LEFT;
    }

    public synchronized void markFirstSetPosition(){
        this.firstSetPosition = turingPosition;
        this.steps = 0;
    }

    public synchronized Point getTuringPosition() {
        return turingPosition;
    }

    public synchronized void goForward() {
        this.steps++;
        switch (this.turingDirection){
            case UP:
                this.turingPosition.moveUp();
                break;
            case RIGHT:
                this.turingPosition.moveRight();
                break;
            case DOWN:
                this.turingPosition.moveDown();
                break;
            case LEFT:
                this.turingPosition.moveLeft();
                break;
            default:
                break;
        }
    }

    public synchronized void turnRight() {
        TuringDirection newTuringDirection;
        switch (this.turingDirection){
            case UP: newTuringDirection = TuringDirection.RIGHT; break;
            case RIGHT: newTuringDirection = TuringDirection.DOWN; break;
            case DOWN: newTuringDirection = TuringDirection.LEFT; break;
            case LEFT: newTuringDirection = TuringDirection.UP; break;
            default: newTuringDirection = this.turingDirection; break;
        }
        this.turingDirection = newTuringDirection;
    }

    public synchronized void turnLeft() {
        TuringDirection newTuringDirection;
        switch (this.turingDirection){
            case UP: newTuringDirection = TuringDirection.LEFT; break;
            case RIGHT: newTuringDirection = TuringDirection.UP; break;
            case DOWN: newTuringDirection = TuringDirection.RIGHT; break;
            case LEFT: newTuringDirection = TuringDirection.DOWN; break;
            default: newTuringDirection = this.turingDirection; break;
        }
        this.turingDirection = newTuringDirection;
    }

    public synchronized boolean isFinishedWalkAround() {
        return (this.turingPosition.equals(this.firstSetPosition)) && (this.steps>100);
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/population/PopulationStatisticsElementsPanelLifeCycle.java apps :: insourcing :: Simulated Evolution 30
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/population/PopulationStatisticsElementsPanelLifeCycle.java apps :: legacy :: Simulated Evolution 34
private final PopulationStatisticsElement youngCellsElement;
    private final PopulationStatisticsElement youngAndFatCellsElement;
    private final PopulationStatisticsElement fullAgeCellsElement;
    private final PopulationStatisticsElement hungryCellsElement;
    private final PopulationStatisticsElement oldCellsElement;

    private final String borderLabel;

    private final int initialPopulation;
    private final String youngCellsLabel;
    private final String youngAndFatCellsLabel;
    private final String fullAgeCellsLabel;
    private final String hungryCellsLabel;
    private final String oldCellsLabel;

    private final SimulatedEvolutionContext tabCtx;
    private final CompoundBorder border;
    private final FlowLayoutCenter layout;
    private final FlowLayout layoutSubPanel;

    private SimulatedEvolutionPopulation population;

    public PopulationStatisticsElementsPanelLifeCycle(
      SimulatedEvolutionContext tabCtx
    ) {
        super(tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation().getPanelPopulationStatistics(),tabCtx.getCtx().getProperties());
        this.tabCtx = tabCtx;
        layoutSubPanel = new FlowLayout();
        this.setLayout(layoutSubPanel);
        borderLabel = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation().getPanelPopulationStatistics();
        layout = new FlowLayoutCenter();
        border = tabCtx.getCtx().getBottomButtonsPanelBorder(borderLabel);
        this.setLayout(layout);
        this.setBorder(border);
        ComputerKurzweilProperties.SimulatedEvolution.Population cfg = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation();
        initialPopulation = cfg.getInitialPopulation();
        youngCellsLabel = cfg.getYoungCellsLabel();
        youngAndFatCellsLabel = cfg.getYoungAndFatCellsLabel();
        fullAgeCellsLabel = cfg.getFullAgeCellsLabel();
        hungryCellsLabel = cfg.getHungryCellsLabel();
        oldCellsLabel = cfg.getOldCellsLabel();
        youngCellsElement = new PopulationStatisticsElement(youngCellsLabel,YOUNG);
        youngAndFatCellsElement = new PopulationStatisticsElement(youngAndFatCellsLabel,YOUNG_AND_FAT);
        fullAgeCellsElement = new PopulationStatisticsElement(fullAgeCellsLabel,FULL_AGE);
        hungryCellsElement = new PopulationStatisticsElement(hungryCellsLabel,HUNGRY);
        oldCellsElement = new PopulationStatisticsElement(oldCellsLabel,OLD);
        this.add(youngCellsElement);
        this.add(youngAndFatCellsElement);
        this.add(fullAgeCellsElement);
        this.add(hungryCellsElement);
        this.add(oldCellsElement);
        update();
    }

    public void update() {
        /*
        population = this.tabCtx.getTabModel().getPopulationContainer().getCurrentGeneration();
        youngCellsElement.setText(population.getYoungCells());
        youngAndFatCellsElement.setText(population.getYoungAndFatCells());
        fullAgeCellsElement.setText(population.getFullAgeCells());
        hungryCellsElement.setText(population.getHungryCells());
        oldCellsElement.setText(population.getOldCells());
        */
    }

}
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/SubTabImpl.java apps :: insourcing :: Simulated Evolution 13
org/woehlke/computer/kurzweil/commons/widgets/SubTabImpl.java Computer Kurzweil :: App 13
@Getter
@ToString
public abstract class SubTabImpl extends JPanel implements HasTabTitle {

    private static final long serialVersionUID = 7526471155622776147L;

    private final String title;
    private final String subTitle;
    private final String toolTipText;
    private final Icon icon;
    private final int keyEvent;
    private final ComputerKurzweilProperties properties;
    private final CompoundBorder border;
    private final FlowLayoutCenter layout;

    public SubTabImpl(String title, String subTitle, String toolTipText, Icon icon, int keyEvent, ComputerKurzweilProperties properties) {
        this.title = title;
        this.subTitle = subTitle;
        this.toolTipText = toolTipText;
        this.icon = icon;
        this.keyEvent = keyEvent;
        this.properties = properties;
        this.border = getDoubleBorder();
        this.setBorder(  this.border);
        this.layout = new FlowLayoutCenter();
        this.setLayout( this.layout);
    }

    public SubTabImpl(String title, ComputerKurzweilProperties properties) {
        this.title = title;
        this.subTitle = title;
        this.toolTipText = title;
        this.icon = null;
        this.keyEvent = KeyEvent.CHAR_UNDEFINED;
        this.properties = properties;
        this.border = getDoubleBorder();
        this.setBorder(  this.border);
        this.layout = new FlowLayoutCenter();
        this.setLayout( this.layout);
    }

    private CompoundBorder getDoubleBorder(){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(left,right,top,bottom),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeTab.java apps :: insourcing :: Koch Snowflake 89
org/woehlke/computer/kurzweil/tabs/mandelbrotzoom/MandelbrotZoomTab.java apps :: insourcing :: Mandelbrot :: Zoom 89
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleTab.java apps :: insourcing :: Sierpinski Triangle 89
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteTab.java apps :: insourcing :: Turmite 89
org/woehlke/computer/kurzweil/tabs/wator/WatorTab.java apps :: insourcing :: WaTor 89
org/woehlke/computer/kurzweil/mandelbrot/view/ApplicationFrame.java apps :: legacy :: Mandelbrot 88
this.mandelbrotModel.click(c);
        showMe();
    }

    @Override
    public void mousePressed(MouseEvent e) {}

    @Override
    public void mouseReleased(MouseEvent e) {}

    @Override
    public void mouseEntered(MouseEvent e) {}

    @Override
    public void mouseExited(MouseEvent e) {}

    public void showMeInit() {
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = this.rootPane.getWidth();
        double height  = this.canvas.getHeight() + 180;
        double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        int myheight = Double.valueOf(height).intValue();
        int mywidth = Double.valueOf(width).intValue();
        int mystartX = Double.valueOf(startX).intValue();
        int mystartY = Double.valueOf(startY).intValue();
        this.rectangleBounds = new Rectangle(mystartX, mystartY, mywidth, myheight);
        this.dimensionSize = new Dimension(mywidth, myheight);
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setVisible(true);
        toFront();
    }

    /**
     * TODO write doc.
     */
    public void showMe() {
        this.pack();
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setVisible(true);
        this.toFront();
    }

    public void setModeSwitch() {
        canvas.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    }

    public void setModeZoom() {
        canvas.setCursor(new Cursor(Cursor.HAND_CURSOR));
    }

    public KochSnowflakeCanvas getCanvas() {
File Project Line
org/woehlke/computer/kurzweil/tabs/dla/model/Particles.java apps :: insourcing :: Diffusion Limited Aggregation 25
org/woehlke/computer/kurzweil/dla/model/Particles.java apps :: legacy :: Diffusion Limited Aggregation 26
private Point worldDimensions;

    private List<Point> particles = new ArrayList<Point>();

    private Random random;

    private Dendrite dendrite;

    public Particles(Point worldDimensions) {
        this.worldDimensions=worldDimensions;
        random = new Random(new Date().getTime());
        for(int i=0; i<NUMBER_OF_PARTICLES;i++){
            int x = random.nextInt(worldDimensions.getX());
            int y = random.nextInt(worldDimensions.getY());
            particles.add(new Point(x>=0?x:-x,y>=0?y:-y));
        }
        this.dendrite = new Dendrite(worldDimensions);
    }

    public List<Point> getParticles() {
        return particles;
    }

    public void move() {
        List<Point> newParticles = new ArrayList<Point>();
        for(Point particle:particles){
            int x = particle.getX()+worldDimensions.getX();
            int y = particle.getY()+worldDimensions.getY();
            int direction = random.nextInt(4);
            switch (direction>=0?direction:-direction){
                case 0: y--; break;
                case 1: x++; break;
                case 2: y++; break;
                case 3: x--; break;
            }
            x %= worldDimensions.getX();
            y %= worldDimensions.getY();
            particle.setX(x);
            particle.setY(y);
            if(!dendrite.hasDendriteNeighbour(particle)){
                newParticles.add(particle);
            }
        }
        particles=newParticles;
    }

    public int getDendriteColor(int x, int y) {
        return dendrite.getAgeForPixel(x,y);
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeTab.java apps :: insourcing :: Koch Snowflake 89
org/woehlke/computer/kurzweil/tabs/mandelbrotzoom/MandelbrotZoomTab.java apps :: insourcing :: Mandelbrot :: Zoom 89
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleTab.java apps :: insourcing :: Sierpinski Triangle 89
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteTab.java apps :: insourcing :: Turmite 89
org/woehlke/computer/kurzweil/tabs/wator/WatorTab.java apps :: insourcing :: WaTor 89
org/woehlke/computer/kurzweil/mandelbrot/julia/view/ApplicationFrame.java apps :: legacy :: Mandelbrot to Julia 104
org/woehlke/computer/kurzweil/mandelbrot/zoom/view/ApplicationFrame.java Mandelbrot Zoom 103
this.mandelbrotModel.click(c);
        showMe();
    }

    @Override
    public void mousePressed(MouseEvent e) {}

    @Override
    public void mouseReleased(MouseEvent e) {}

    @Override
    public void mouseEntered(MouseEvent e) {}

    @Override
    public void mouseExited(MouseEvent e) {}

    public void showMeInit() {
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = this.rootPane.getWidth();
        double height  = this.canvas.getHeight() + 180;
        double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        int myheight = Double.valueOf(height).intValue();
        int mywidth = Double.valueOf(width).intValue();
        int mystartX = Double.valueOf(startX).intValue();
        int mystartY = Double.valueOf(startY).intValue();
        this.rectangleBounds = new Rectangle(mystartX, mystartY, mywidth, myheight);
        this.dimensionSize = new Dimension(mywidth, myheight);
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setVisible(true);
        toFront();
    }

    /**
     * TODO write doc.
     */
    public void showMe() {
        this.pack();
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setVisible(true);
        this.toFront();
    }

    public void setModeSwitch() {
        canvas.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    }

    public void setModeZoom() {
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/SubTabImpl.java apps :: insourcing :: Simulated Evolution 19
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/SubTabImpl.java apps :: legacy :: Simulated Evolution 27
org/woehlke/computer/kurzweil/commons/widgets/SubTabImpl.java Computer Kurzweil :: App 19
private final String title;
    private final String subTitle;
    private final String toolTipText;
    private final Icon icon;
    private final int keyEvent;
    private final ComputerKurzweilProperties properties;
    private final CompoundBorder border;
    private final FlowLayoutCenter layout;

    public SubTabImpl(String title, String subTitle, String toolTipText, Icon icon, int keyEvent, ComputerKurzweilProperties properties) {
        this.title = title;
        this.subTitle = subTitle;
        this.toolTipText = toolTipText;
        this.icon = icon;
        this.keyEvent = keyEvent;
        this.properties = properties;
        this.border = getDoubleBorder();
        this.setBorder(  this.border);
        this.layout = new FlowLayoutCenter();
        this.setLayout( this.layout);
    }

    public SubTabImpl(String title, ComputerKurzweilProperties properties) {
        this.title = title;
        this.subTitle = title;
        this.toolTipText = title;
        this.icon = null;
        this.keyEvent = KeyEvent.CHAR_UNDEFINED;
        this.properties = properties;
        this.border = getDoubleBorder();
        this.setBorder(  this.border);
        this.layout = new FlowLayoutCenter();
        this.setLayout( this.layout);
    }

    private CompoundBorder getDoubleBorder(){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(left,right,top,bottom),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/model/LifeCycle.java apps :: insourcing :: Simulated Evolution 31
org/woehlke/computer/kurzweil/simulated/evolution/model/cell/LifeCycle.java apps :: legacy :: Simulated Evolution 35
private int fat;

    /**
     * Status of the LifeCycle is fat, age and hunger.
     */
    private int age;

    /**
     * Status of the LifeCycle is fat, age and hunger.
     */
    private int hunger;


    /**
     * LifeCycle Threshold Parameter
     */
    private final static int MAX_FAT = 2000;

    /**
     * LifeCycle Threshold Parameter
     */
    private final static int MAX_HUNGER = 1000;

    /**
     * LifeCycle Threshold Parameter
     */
    private final static int FULL_AGE = 200;

    /**
     * LifeCycle Threshold Parameter
     */
    private final static int FAT_MINIMUM_FOR_SEX = 800;

    /**
     * LifeCycle Threshold Parameter
     */
    private final static int FAT_AT_BIRTH = 500;

    /**
     * LifeCycle Threshold Parameter
     */
    private final static int FAT_PER_FOOD = 25;

    /**
     * LifeCycle Threshold Parameter
     */
    private final static int OLD_AGE = 800;

    /** LifeCycle Threshold Parameter */
    private final static int MAX_AGE = 1000;

    public LifeCycle() {
        hunger = 0;
        age = 0;
        fat = FAT_AT_BIRTH;
    }

    public LifeCycle(int fatAtBirth) {
        hunger = 0;
        age = 0;
        fat = fatAtBirth;
    }

    /**
     * moving consumes food energy
     * @return true, if cell has enough energy to move.
     */
    public boolean move() {
        age++;
        if (fat > 0) {
            fat--;
            return true;
        } else {
            hunger++;
            return false;
        }
    }

    /**
     * having sex by cell division changes age and fat.
     */
    public void haveSex() {
        fat /= 2;
        age = 0;
    }

    /**
     * @return has enough age and fat for having sex.
     */
    public boolean isPregnant() {
        return (age >= FULL_AGE) && (fat >= FAT_MINIMUM_FOR_SEX);
    }

    /**
     * @return died by hunger. found and eaten too few food and so too few fat.
     */
    public boolean isDead() {
        return (hunger >= MAX_HUNGER) || (age >= MAX_AGE);
    }

    /**
     * @param food eat the found food and add the energy to the cells fat.
     */
    public void eat(int food) {
        if (fat + food* FAT_PER_FOOD <= MAX_FAT) {
            fat += food* FAT_PER_FOOD;
        }  else {
            fat = MAX_FAT;
        }
    }

    public int getFat() {
        return fat;
    }

    public LifeCycleStatus getLifeCycleStatus(){
        if(fat==0 && hunger>=0){
            return LifeCycleStatus.HUNGRY;
        }
        if(age<FULL_AGE){
            if(fat< FAT_MINIMUM_FOR_SEX){
                return LifeCycleStatus.YOUNG;
            } else {
                return LifeCycleStatus.YOUNG_AND_FAT;
            }
        } else {
            if (age<OLD_AGE) {
                return LifeCycleStatus.FULL_AGE;
            } else {
                if (age < MAX_AGE) {
                    return LifeCycleStatus.OLD;
                } else {
                    return LifeCycleStatus.DEAD;
                }
            }
        }
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/dla/view/WorldCanvas.java apps :: insourcing :: Diffusion Limited Aggregation 26
org/woehlke/computer/kurzweil/dla/view/WorldCanvas.java apps :: legacy :: Diffusion Limited Aggregation 26
private Particles particles;
    private Point worldDimensions;

    private final Color MEDIUM = Color.BLACK;
    private final Color PARTICLES = Color.BLUE;

    public WorldCanvas(Point worldDimensions, Particles particles) {
        this.worldDimensions = worldDimensions;
        this.setBackground(MEDIUM);
        this.setSize(this.worldDimensions.getX(), this.worldDimensions.getY());
        this.particles=particles;
    }

    public void paint(Graphics g) {
        super.paintComponent(g);
        int width = worldDimensions.getX();
        int height = worldDimensions.getY();
        g.setColor(MEDIUM);
        g.fillRect(0,0,width,height);
        g.setColor(PARTICLES);
        for(Point pixel:particles.getParticles()){
            g.drawLine(pixel.getX(),pixel.getY(),pixel.getX(),pixel.getY());
        }
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                int age = particles.getDendriteColor(x,y);
                if(age>0){
                    age /= 25;
                    int blue = (age / 256) % (256*256);
                    int green = (age % 256);
                    int red = 255;
                    Color ageColor = new Color(red,green,blue);
                    g.setColor(ageColor);
                    g.drawLine(x,y,x,y);
                }
            }
        }
    }

    public void update(Graphics g) {
        paint(g);
    }

    public Point getWorldDimensions() {
        return worldDimensions;
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/SimulatedEvolutionTab.java apps :: insourcing :: Simulated Evolution 40
org/woehlke/computer/kurzweil/simulated/evolution/view/SimulatedEvolutionTab.java apps :: legacy :: Simulated Evolution 43
private final static String TITLE = "Simulated Evolution";

    private final static int EXIT_STATUS = 0;

    private final static String APPLET_POSITION = "Center";

    private final static int HEIGHT_OF_TITLE = 30;

    private final static int START_POSITION_ON_SCREEN_X = 100;

    private final static int START_POSITION_ON_SCREEN_Y = 100;

    private SimulatedEvolutionApplet simulatedEvolutionApplet;

    private final SimulatedEvolutionParameter simulatedEvolutionParameter;

    private final ComputerKurzweilContext ctx;

    private final SimulatedEvolutionContext tabCtx;

    private final ComputerKurzweilProperties properties;

    private void setMyBounds(){
        int x = START_POSITION_ON_SCREEN_X;
        int y = START_POSITION_ON_SCREEN_Y;
        int width = simulatedEvolutionApplet.getCanvasDimensions().getX();
        int height = simulatedEvolutionApplet.getCanvasDimensions().getY() + HEIGHT_OF_TITLE;
        setBounds(x, y, width, height);
    }

    public SimulatedEvolutionTab(ComputerKurzweilProperties properties) {
        super(TITLE);
        this.properties = properties;
        simulatedEvolutionParameter = new SimulatedEvolutionParameter();
        simulatedEvolutionApplet = new SimulatedEvolutionApplet();
        simulatedEvolutionApplet.init();
        add(APPLET_POSITION, simulatedEvolutionApplet);
        this.ctx = new ComputerKurzweilContext(properties);
        this.tabCtx = new SimulatedEvolutionContext(this,ctx);
        pack();
        setVisible(true);
        toFront();
        addWindowListener(this);
    }

    public void windowOpened(WindowEvent e) {
        setMyBounds();
        setVisible(true);
        toFront();
    }

    public void windowClosing(WindowEvent e) {
        System.exit(EXIT_STATUS);
    }

    public void windowClosed(WindowEvent e) {
        System.exit(EXIT_STATUS);
    }

    public void windowIconified(WindowEvent e) {

    }

    public void windowDeiconified(WindowEvent e) {
        setMyBounds();
        setVisible(true);
        toFront();
    }

    public void windowActivated(WindowEvent e) {
        toFront();
    }

    public void windowDeactivated(WindowEvent e) {
    }

    public void update(){}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 145
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 145
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 84
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 145
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 145
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 43
@ToString
    public static class Allinone {

        @Valid @Getter @Setter public Lattice lattice = new Lattice();
        @Valid @Getter @Setter public View view = new View();

        ////@Validated
        @ToString
        public static class Lattice {
            @NotNull  @Getter @Setter private Integer width;
            @NotNull  @Getter @Setter private Integer height;
        }

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String copyright;
            @NotNull  @Getter @Setter private Integer borderPaddingX;
            @NotNull  @Getter @Setter private Integer borderPaddingY;
            @NotNull  @Getter @Setter private Integer titleHeight;
            @NotBlank @Getter @Setter private String startStopp;
            @NotBlank @Getter @Setter private String start;
            @NotBlank @Getter @Setter private String stop;
            @NotBlank @Getter @Setter private String info;
        }
    }

    ////@Validated
    @ToString
    public static class Mandelbrot {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class MandelbrotZoom {
File Project Line
org/woehlke/computer/kurzweil/commons/model/LatticePoint.java apps :: insourcing :: Simulated Evolution 21
org/woehlke/computer/kurzweil/commons/model/LatticePoint.java Computer Kurzweil :: App 21
@Log
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public class LatticePoint implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

  /**
   * Horizontal X-Coordinate. Also used as Width;
   */
  private int x = 0;

  /**
   * Vertical Y-Coordinate. Also used as Height;
   */
  private int y = 0;

    public LatticePoint(LatticePoint other) {
        this.x = other.getX();
        this.y = other.getY();
    }

  public int getWidth() {
    return x;
  }

  public int getHeight() {
    return y;
  }

  public void absoluteValue() {
      x *= Integer.signum(x);
      y *= Integer.signum(y);
  }

  public void killNegative() {
        absoluteValue();
    }

  public void plus(LatticePoint p) {
    this.x += p.getX();
    this.y += p.getY();
    absoluteValue();
  }

    public void moveBy(LatticePoint p) {
        this.x += p.getX();
        this.y += p.getY();
    }

  public void normalize(LatticePoint p) {
    this.x %= p.getX();
    this.y %= p.getY();
  }

    public void moveUp() {
        y--;
    }

    public void moveRight() {
        x++;
    }

    public void moveDown() {
        y++;
    }

    public void moveLeft() {
        x--;
    }

    public LatticePoint copy() {
        return new LatticePoint(this);
    }

    public static LatticePoint start(LatticePoint worldDimensions){
        return new LatticePoint(
            (worldDimensions.getX()-2),
            ((worldDimensions.getY()/2)+11)
        );
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/cca/config/ObjectRegistry.java apps :: insourcing :: Cyclic Cellular Automaton 16
org/woehlke/computer/kurzweil/cyclic/cellular/automaton/config/ObjectRegistry.java apps :: legacy :: Cyclic Cellular Automaton 17
private volatile CyclicCellularAutomatonController controller;
    private volatile CyclicCellularAutomatonCanvas canvas;
    private volatile CyclicCellularAutomatonLattice lattice;
    private volatile CyclicCellularAutomatonFrame frame;
    private volatile Config config;
    private volatile ColorScheme colorScheme;
    private volatile PanelButtons panelButtons;
    private volatile PanelSubtitle subtitle;

    public ObjectRegistry() {
        this.config = new Config();
        this.colorScheme = new ColorScheme();
        this.lattice = new CyclicCellularAutomatonLattice(this);
        this.canvas = new CyclicCellularAutomatonCanvas(this);
        this.controller = new CyclicCellularAutomatonController(this);
        this.panelButtons = new PanelButtons(this);
        this.subtitle = new PanelSubtitle(this);
    }

    public CyclicCellularAutomatonController getController() {
        return controller;
    }

    public void setController(CyclicCellularAutomatonController controller) {
        this.controller = controller;
    }

    public CyclicCellularAutomatonCanvas getCanvas() {
        return canvas;
    }

    public void setCanvas(CyclicCellularAutomatonCanvas canvas) {
        this.canvas = canvas;
    }

    public CyclicCellularAutomatonLattice getLattice() {
        return lattice;
    }

    public void setLattice(CyclicCellularAutomatonLattice lattice) {
        this.lattice = lattice;
    }

    public CyclicCellularAutomatonFrame getFrame() {
        return frame;
    }

    public void setFrame(CyclicCellularAutomatonFrame frame) {
        this.frame = frame;
    }

    public ColorScheme getColorScheme() {
        return colorScheme;
    }

    public void setColorScheme(ColorScheme colorScheme) {
        this.colorScheme = colorScheme;
    }

    public PanelButtons getPanelButtons() {
        return panelButtons;
    }

    public void setPanelButtons(PanelButtons panelButtons) {
        this.panelButtons = panelButtons;
    }

    public PanelSubtitle getSubtitle() {
        return subtitle;
    }

    public void setSubtitle(PanelSubtitle subtitle) {
        this.subtitle = subtitle;
    }

    public Config getConfig() {
        return config;
    }

    public void setConfig(Config config) {
        this.config = config;
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/LatticePointNeighbourhoodPosition.java apps :: insourcing :: Simulated Evolution 5
org/woehlke/computer/kurzweil/simulated/evolution/model/lattice/LatticePointNeighbourhoodPosition.java apps :: legacy :: Simulated Evolution 13
org/woehlke/computer/kurzweil/commons/model/LatticePointNeighbourhoodPosition.java Computer Kurzweil :: App 5
@Getter
public enum LatticePointNeighbourhoodPosition {

    CENTER(0,0),
    NORTH(0,-1),
    EAST(1,0),
    SOUTH(0,1),
    WEST(-1,0),
    NORTH_EAST(1,-1),
    SOUTH_EAST(1,1),
    SOUTH_WEST(-1,1),
    NORTH_WEST(-1,-1);

    private final int x;
    private final int y;

    LatticePointNeighbourhoodPosition(int x, int y){
        this.x = x;
        this.y = y;
    }

    public static LatticePointNeighbourhoodPosition[] getNeighbourhoodFor(
        LatticeNeighbourhoodType neighbourhoodType
    ){
        LatticePointNeighbourhoodPosition[] result;
        switch (neighbourhoodType) {
            case VON_NEUMANN_NEIGHBORHOOD:
                result = new LatticePointNeighbourhoodPosition[4];
                result[0]=NORTH;
                result[1]=EAST;
                result[2]=SOUTH;
                result[3]=WEST;
                break;
            case MOORE_NEIGHBORHOOD:
                result = new LatticePointNeighbourhoodPosition[8];
                result[0]=NORTH_WEST;
                result[1]=NORTH;
                result[2]=NORTH_EAST;
                result[3]=EAST;
                result[4]=SOUTH_EAST;
                result[5]=SOUTH;
                result[6]=SOUTH_WEST;
                result[7]=WEST;
                break;
            case WOEHLKE_NEIGHBORHOOD:
                result = new LatticePointNeighbourhoodPosition[6];
                result[0]=NORTH_WEST;
                result[1]=NORTH;
                result[2]=NORTH_EAST;
                result[3]=EAST;
                result[4]=SOUTH_WEST;
                result[5]=WEST;
                break;
            default:
                result = new LatticePointNeighbourhoodPosition[1];
                result[0]=CENTER;
                break;
        }
        return result;
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/population/PopulationStatisticsElementsPanelCounted.java apps :: insourcing :: Simulated Evolution 32
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/population/PopulationStatisticsElementsPanelCounted.java apps :: legacy :: Simulated Evolution 36
private final PopulationStatisticsElement populationElement;
    private final PopulationStatisticsElement generationOldestElement;
    private final PopulationStatisticsElement generationYoungestElement;
    private final String borderLabel;

    private final int initialPopulation;
    private final String populationLabel;
    private final String generationOldestLabel;
    private final String generationYoungestLabel;

    private final SimulatedEvolutionContext tabCtx;
    private final CompoundBorder border;
    private final FlowLayoutCenter layout;
    private final FlowLayout layoutSubPanel;

    private SimulatedEvolutionPopulation population;

    public PopulationStatisticsElementsPanelCounted(
        SimulatedEvolutionContext tabCtx
    ) {
        super(tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation().getPanelPopulationStatistics(),tabCtx.getCtx().getProperties());
        this.tabCtx = tabCtx;
        layoutSubPanel = new FlowLayout();
        this.setLayout(layoutSubPanel);
        borderLabel = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation().getPanelPopulationStatistics();
        layout = new FlowLayoutCenter();
        border = tabCtx.getCtx().getBottomButtonsPanelBorder(borderLabel);
        this.setLayout(layout);
        this.setBorder(border);
        ComputerKurzweilProperties.SimulatedEvolution.Population cfg = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation();
        initialPopulation = cfg.getInitialPopulation();
        populationLabel = cfg.getPopulationLabel();
        generationOldestLabel = cfg.getGenerationOldestLabel();
        generationYoungestLabel = cfg.getGenerationYoungestLabel();
        populationElement = new PopulationStatisticsElement(populationLabel,POPULATION);
        generationYoungestElement = new PopulationStatisticsElement(generationYoungestLabel,POPULATION);
        generationOldestElement = new PopulationStatisticsElement(generationOldestLabel,POPULATION);
        PopulationStatisticsElement[] elements = {
            populationElement,
            generationYoungestElement,
            generationOldestElement
        };
        for(PopulationStatisticsElement ps : elements){
            this.add(ps);
        }
        update();
    }

    public void update() {
        /*
        population = this.tabCtx.getTabModel().getPopulationContainer().getCurrentGeneration();
        populationElement.setText(population.getPopulation());
        generationYoungestElement.setText(population.getGenerationYoungest());
        generationOldestElement.setText(population.getGenerationOldest());
        */
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/model/population/SimulatedEvolutionPopulationContainer.java apps :: insourcing :: Simulated Evolution 27
org/woehlke/computer/kurzweil/simulated/evolution/model/population/SimulatedEvolutionPopulationContainer.java apps :: legacy :: Simulated Evolution 33
private final SimulatedEvolutionContext tabCtx;
    private final int initialPopulation;
    private final ConcurrentLinkedQueue<SimulatedEvolutionPopulation> statistics = new ConcurrentLinkedQueue<>();
    private final List<Cell> cells;
    private long worldIteration;
    private final int queueMaxLength;

    public SimulatedEvolutionPopulationContainer(
        SimulatedEvolutionContext tabCtx
    ) {
        this.tabCtx = tabCtx;
        worldIteration = 0L;
        cells = new ArrayList<>();
        queueMaxLength = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getControl().getQueueMaxLength();
        initialPopulation = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation().getInitialPopulation();
        createInitialPopulation();
    }

    public void createInitialPopulation() {
        cells.clear();
        WorldPoint max = new WorldPoint(640,400);
        WorldPoint position = new WorldPoint(40,40);
        Random random = new Random((new Date()).getTime());
        for (int i = 0; i < initialPopulation ; i++) {
            Cell cell = new Cell(max,position,random);
            cells.add(cell);
        }
    }

    public void push(SimulatedEvolutionPopulation populationCensus) {
        worldIteration++;
        populationCensus.setWorldIteration(worldIteration);
        statistics.add(populationCensus);
        if (statistics.size() > queueMaxLength) {
            statistics.poll();
        }
        log.info(worldIteration + " : " + populationCensus);
    }

    public SimulatedEvolutionPopulation getCurrentGeneration() {
        SimulatedEvolutionPopulation currentGeneration = statistics.peek();
        if(currentGeneration == null){
            log.info(worldIteration + "statistics.peek() == null ");
            currentGeneration = new SimulatedEvolutionPopulation();
        }
        return currentGeneration;
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/turing/MandelbrotTuringMachine.java apps :: legacy :: Mandelbrot to Julia 22
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/turing/MandelbrotTuringMachine.java Mandelbrot Zoom 23
public class MandelbrotTuringMachine {

    private volatile GaussianNumberPlane gaussianNumberPlane;
    private volatile TuringPositions turingPositions;
    private volatile TuringPhaseState turingPhaseState;

    public MandelbrotTuringMachine(ApplicationModel model) {
        this.gaussianNumberPlane = model.getGaussianNumberPlane();
        this.turingPhaseState = new TuringPhaseState();
        this.turingPositions = new TuringPositions(model.getWorldDimensions());
        start();
    }

    public void start() {
        this.turingPhaseState.start();
        this.gaussianNumberPlane.start();
        this.turingPositions.start();
    }

    public synchronized boolean step() {
        boolean repaint=true;
        switch(turingPhaseState.getTuringTuringPhase()){
            case SEARCH_THE_SET:
                stepGoToSet();
                repaint=false;
                break;
            case WALK_AROUND_THE_SET:
                stepWalkAround();
                break;
            case FILL_THE_OUTSIDE_WITH_COLOR:
                fillTheOutsideWithColors();
                break;
            case FINISHED:
            default:
                repaint=false;
                break;
        }
        return repaint;
    }

    private void stepGoToSet(){
        if(this.gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.markFirstSetPosition();
            this.turingPhaseState.finishSearchTheSet();
        } else {
            this.turingPositions.goForward();
        }
    }

    private void stepWalkAround(){
        if(gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.turnRight();
        } else {
            this.turingPositions.turnLeft();
        }
        this.turingPositions.goForward();
        if(this.turingPositions.isFinishedWalkAround()){
            this.turingPhaseState.finishWalkAround();
        }
    }

    private void fillTheOutsideWithColors(){
        this.gaussianNumberPlane.fillTheOutsideWithColors();
        this.turingPhaseState.finishFillTheOutsideWithColors();
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Koch Snowflake 16
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Mandelbrot :: Julia 16
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Mandelbrot :: Zoom 16
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Sierpinski Triangle 16
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Turmite 16
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: WaTor 16
org/woehlke/computer/kurzweil/mandelbrot/model/helper/Point.java apps :: legacy :: Mandelbrot 16
public class Point implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    private volatile int x = 0;
    private volatile int y = 0;

    public Point() {
    }

    public Point(Point p) {
        this.x = p.getX();
        this.y = p.getY();
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void moveUp() {
        y--;
    }

    public void moveRight() {
        x++;
    }

    public void moveDown() {
        y++;
    }

    public void moveLeft() {
        x--;
    }

    public int getWidth(){
        return x;
    }
    public int getHeight() { return y; }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Point)) return false;
        Point point = (Point) o;
        return getX() == point.getX() &&
            getY() == point.getY();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getX(), getY());
    }

    @Override
    public String toString() {
        return "Point{" +
            "x=" + x +
            ", y=" + y +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/PanelStartStopButtons.java apps :: insourcing :: Simulated Evolution 11
org/woehlke/computer/kurzweil/commons/widgets/PanelStartStopButtons.java Computer Kurzweil :: App 11
@Log
@ToString(exclude={"startButton","stopButton"})
public class PanelStartStopButtons extends SubTabImpl implements Startable, SubTab {

    private static final long serialVersionUID = 7526471155622776147L;

    private final String labelStart;
    private final String labelStop;
    @Getter
    private final JButton startButton;
    @Getter
    private final JButton stopButton;

    public PanelStartStopButtons(Tab tab){
        super(tab.getCtx().getProperties().getAllinone().getView().getStartStopp(),tab.getCtx().getProperties());
        labelStart = tab.getCtx().getProperties().getAllinone().getView().getStart();
        labelStop = tab.getCtx().getProperties().getAllinone().getView().getStop();
        this.startButton = new JButton(labelStart);
        this.stopButton = new JButton(labelStop);
        this.startButton.setEnabled(true);
        this.stopButton.setEnabled(false);
        this.add(this.startButton);
        this.add(this.stopButton);
        this.startButton.addActionListener(tab);
        this.stopButton.addActionListener(tab);
    }

    @Override
    public void start() {
        log.info("start");
        this.startButton.setEnabled(false);
        this.stopButton.setEnabled(true);
        log.info("started");
    }

    @Override
    public void stop() {
        log.info("stop");
        this.startButton.setEnabled(true);
        this.stopButton.setEnabled(false);
        log.info("stopped");
    }

}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/turing/MandelbrotTuringMachine.java apps :: legacy :: Mandelbrot to Julia 24
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/turing/MandelbrotTuringMachine.java Mandelbrot Zoom 25
org/woehlke/computer/kurzweil/mandelbrot/model/turing/MandelbrotTuringMachine.java apps :: legacy :: Mandelbrot 22
private volatile GaussianNumberPlane gaussianNumberPlane;
    private volatile TuringPositions turingPositions;
    private volatile TuringPhaseState turingPhaseState;

    public MandelbrotTuringMachine(ApplicationModel model) {
        this.gaussianNumberPlane = model.getGaussianNumberPlane();
        this.turingPhaseState = new TuringPhaseState();
        this.turingPositions = new TuringPositions(model.getWorldDimensions());
        start();
    }

    public void start() {
        this.turingPhaseState.start();
        this.gaussianNumberPlane.start();
        this.turingPositions.start();
    }

    public synchronized boolean step() {
        boolean repaint=true;
        switch(turingPhaseState.getTuringTuringPhase()){
            case SEARCH_THE_SET:
                stepGoToSet();
                repaint=false;
                break;
            case WALK_AROUND_THE_SET:
                stepWalkAround();
                break;
            case FILL_THE_OUTSIDE_WITH_COLOR:
                fillTheOutsideWithColors();
                break;
            case FINISHED:
            default:
                repaint=false;
                break;
        }
        return repaint;
    }

    private void stepGoToSet(){
        if(this.gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.markFirstSetPosition();
            this.turingPhaseState.finishSearchTheSet();
        } else {
            this.turingPositions.goForward();
        }
    }

    private void stepWalkAround(){
        if(gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.turnRight();
        } else {
            this.turingPositions.turnLeft();
        }
        this.turingPositions.goForward();
        if(this.turingPositions.isFinishedWalkAround()){
            this.turingPhaseState.finishWalkAround();
        }
    }

    private void fillTheOutsideWithColors(){
        this.gaussianNumberPlane.fillTheOutsideWithColors();
        this.turingPhaseState.finishFillTheOutsideWithColors();
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 322
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 197
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 223
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 322
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 451
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 322
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 322
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 197
@ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class WienerProcess {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    //@Validated
    @ToString
    public static class Dla {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Kochsnowflake {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/SimulatedEvolutionCanvas.java apps :: insourcing :: Simulated Evolution 33
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/SimulatedEvolutionCanvas.java apps :: legacy :: Simulated Evolution 37
@Setter
    private SimulatedEvolutionModel tabModel;

    private WorldPoint worldDimensions;

    private final Color WATER = Color.BLACK;
    private final Color FOOD = Color.GREEN;

    public SimulatedEvolutionCanvas(WorldPoint worldDimensions) {
        this.worldDimensions = worldDimensions;
        this.setBackground(WATER);
        this.setSize(this.worldDimensions.getX(), this.worldDimensions.getY());
    }

    /**
     * Paint the World on the Canvas and show Food and Bacteria Cells.
     * @param g Graphics Context with the Tools for Painting.
     */
    public void paint(Graphics g) {
        super.paintComponent(g);
        int width = worldDimensions.getX();
        int height = worldDimensions.getY();
        g.setColor(WATER);
        g.fillRect(0,0,width,height);
        g.setColor(FOOD);
        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                if (tabModel.hasFood(x, y)) {
                    g.drawLine(x,y,x,y);
                }
            }
        }
        List<Cell> population = tabModel.getAllCells();
        for (Cell p:population) {
            WorldPoint[] square = p.getPosition().getNeighbourhood(worldDimensions);
            g.setColor(p.getLifeCycleStatus().getColor());
            for(WorldPoint pixel:square){
                g.drawLine(pixel.getX(),pixel.getY(),pixel.getX(),pixel.getY());
            }
        }
    }

    public void update(Graphics g) {
        paint(g);
    }

}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/common/Point.java apps :: legacy :: Mandelbrot to Julia 17
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/common/Point.java Mandelbrot Zoom 19
public class Point {

    private volatile int x = 0;
    private volatile int y = 0;

    public Point() {
    }

    public Point(Point p) {
        this.x = p.getX();
        this.y = p.getY();
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void moveUp() {
        y--;
    }

    public void moveRight() {
        x++;
    }

    public void moveDown() {
        y++;
    }

    public void moveLeft() {
        x--;
    }

    public int getWidth(){
        return x;
    }
    public int getHeight() { return y; }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Point)) return false;
        Point point = (Point) o;
        return getX() == point.getX() &&
            getY() == point.getY();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getX(), getY());
    }

    @Override
    public String toString() {
        return "Point{" +
            "x=" + x +
            ", y=" + y +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 119
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 126
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 119
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 119
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 119
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot to Julia 134
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 126
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 126
public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }

    private synchronized void computeTheJuliaSetForC(ComplexNumber c) {
        for(int y = 0; y < worldDimensions.getY(); y++) {
            for (int x = 0; x < worldDimensions.getX(); x++) {
                Point zPoint = new Point(x, y);
                ComplexNumber z = this.getComplexNumberFromLatticeCoordsForJulia(zPoint);
                lattice[x][y] = z.computeJuliaSet(c);
            }
        }
    }

    public synchronized void computeTheJuliaSetFor(Point pointFromMandelbrotSet) {
        ComplexNumber c = getComplexNumberFromLatticeCoordsForMandelbrot(pointFromMandelbrotSet);
        this.complexNumberForJuliaSetC = c;
        computeTheJuliaSetForC(c);
    }
File Project Line
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Koch Snowflake 20
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Mandelbrot :: Julia 20
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Mandelbrot :: Zoom 20
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Sierpinski Triangle 20
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Turmite 20
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: WaTor 20
org/woehlke/computer/kurzweil/mandelbrot/julia/model/common/Point.java apps :: legacy :: Mandelbrot to Julia 19
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/common/Point.java Mandelbrot Zoom 21
org/woehlke/computer/kurzweil/mandelbrot/model/helper/Point.java apps :: legacy :: Mandelbrot 20
private volatile int x = 0;
    private volatile int y = 0;

    public Point() {
    }

    public Point(Point p) {
        this.x = p.getX();
        this.y = p.getY();
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void moveUp() {
        y--;
    }

    public void moveRight() {
        x++;
    }

    public void moveDown() {
        y++;
    }

    public void moveLeft() {
        x--;
    }

    public int getWidth(){
        return x;
    }
    public int getHeight() { return y; }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Point)) return false;
        Point point = (Point) o;
        return getX() == point.getX() &&
            getY() == point.getY();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getX(), getY());
    }

    @Override
    public String toString() {
        return "Point{" +
            "x=" + x +
            ", y=" + y +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 63
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 70
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 63
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 63
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 63
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot to Julia 76
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 73
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 70
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 70
public void setModeZoom() {
        this.setZoomLevel(1);
        this.setZoomCenter(complexCenterForMandelbrot);
    }

    public synchronized void start(){
        zoomLevel = 1;
        for(int y = 0;y < this.worldDimensions.getY(); y++){
            for(int x=0; x < worldDimensions.getX(); x++){
                lattice[x][y] = YET_UNCOMPUTED;
            }
        }
    }

    public synchronized int getCellStatusFor(int x,int y){
        return (lattice[x][y])<0?0:lattice[x][y];
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForJulia(Point turingPosition) {
        double realX = complexCenterForJulia.getReal()
            + (complexWorldDimensions.getReal()*turingPosition.getX())/worldDimensions.getX();
        double imgY = complexCenterForJulia.getImg()
            + (complexWorldDimensions.getImg()*turingPosition.getY())/worldDimensions.getY();
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForMandelbrot(Point turingPosition) {
        double realX = (
            complexCenterForMandelbrot.getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / worldDimensions.getX()
        );
        double imgY = (
            complexCenterForMandelbrot.getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / worldDimensions.getY()
        );
        return new ComplexNumber(realX,imgY);
    }
File Project Line
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Koch Snowflake 26
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Mandelbrot :: Julia 26
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Mandelbrot :: Zoom 26
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Sierpinski Triangle 26
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Turmite 26
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: WaTor 26
public MandelbrotTuringMachine(KochSnowflakeModel model) {
        this.gaussianNumberPlane = model.getGaussianNumberPlane();
        this.turingPhaseState = new MandelbrotTuringPhaseState();
        this.turingPositions = new MandelbrotTuringPositions(model.getWorldDimensions());
        start();
    }

    public void start() {
        this.turingPhaseState.start();
        this.gaussianNumberPlane.start();
        this.turingPositions.start();
    }

    public synchronized boolean step() {
        boolean repaint=true;
        switch(turingPhaseState.getTuringTuringPhase()){
            case SEARCH_THE_SET:
                stepGoToSet();
                repaint=false;
                break;
            case WALK_AROUND_THE_SET:
                stepWalkAround();
                break;
            case FILL_THE_OUTSIDE_WITH_COLOR:
                fillTheOutsideWithColors();
                break;
            case FINISHED:
            default:
                repaint=false;
                break;
        }
        return repaint;
    }

    private void stepGoToSet(){
        if(this.gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.markFirstSetPosition();
            this.turingPhaseState.finishSearchTheSet();
        } else {
            this.turingPositions.goForward();
        }
    }

    private void stepWalkAround(){
        if(gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.turnRight();
        } else {
            this.turingPositions.turnLeft();
        }
        this.turingPositions.goForward();
        if(this.turingPositions.isFinishedWalkAround()){
            this.turingPhaseState.finishWalkAround();
        }
    }

    private void fillTheOutsideWithColors(){
        this.gaussianNumberPlane.fillTheOutsideWithColors();
        this.turingPhaseState.finishFillTheOutsideWithColors();
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/turing/MandelbrotTuringMachine.java apps :: legacy :: Mandelbrot to Julia 28
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/turing/MandelbrotTuringMachine.java Mandelbrot Zoom 29
org/woehlke/computer/kurzweil/mandelbrot/model/turing/MandelbrotTuringMachine.java apps :: legacy :: Mandelbrot 26
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/model/turing/MandelbrotTuringMachine.java Computer Kurzweil :: App 26
public MandelbrotTuringMachine(ApplicationModel model) {
        this.gaussianNumberPlane = model.getGaussianNumberPlane();
        this.turingPhaseState = new TuringPhaseState();
        this.turingPositions = new TuringPositions(model.getWorldDimensions());
        start();
    }

    public void start() {
        this.turingPhaseState.start();
        this.gaussianNumberPlane.start();
        this.turingPositions.start();
    }

    public synchronized boolean step() {
        boolean repaint=true;
        switch(turingPhaseState.getTuringTuringPhase()){
            case SEARCH_THE_SET:
                stepGoToSet();
                repaint=false;
                break;
            case WALK_AROUND_THE_SET:
                stepWalkAround();
                break;
            case FILL_THE_OUTSIDE_WITH_COLOR:
                fillTheOutsideWithColors();
                break;
            case FINISHED:
            default:
                repaint=false;
                break;
        }
        return repaint;
    }

    private void stepGoToSet(){
        if(this.gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.markFirstSetPosition();
            this.turingPhaseState.finishSearchTheSet();
        } else {
            this.turingPositions.goForward();
        }
    }

    private void stepWalkAround(){
        if(gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.turnRight();
        } else {
            this.turingPositions.turnLeft();
        }
        this.turingPositions.goForward();
        if(this.turingPositions.isFinishedWalkAround()){
            this.turingPhaseState.finishWalkAround();
        }
    }

    private void fillTheOutsideWithColors(){
        this.gaussianNumberPlane.fillTheOutsideWithColors();
        this.turingPhaseState.finishFillTheOutsideWithColors();
    }
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 271
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 271
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 318
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 271
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 271
@NotBlank @Getter @Setter private String youngCellsLabel;
            @NotBlank @Getter @Setter private String youngAndFatCellsLabel;
            @NotBlank @Getter @Setter private String fullAgeCellsLabel;
            @NotBlank @Getter @Setter private String hungryCellsLabel;
            @NotBlank @Getter @Setter private String oldCellsLabel;
            @NotBlank @Getter @Setter private String populationLabel;
            @NotBlank @Getter @Setter private String generationOldestLabel;
            @NotBlank @Getter @Setter private String generationYoungestLabel;
        }

        ////@Validated
        @ToString
        public static class Food {
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer foodPerDayFieldColumns;
            @NotBlank @Getter @Setter private String foodPerDayLabel;
            @NotBlank @Getter @Setter private String foodPerDayBorderLabel;
            @NotBlank @Getter @Setter private String buttonFoodPerDayIncrease;
            @NotBlank @Getter @Setter private String buttonFoodPerDayDecrease;
            @NotBlank @Getter @Setter private String panelFood;
        }

        ////@Validated
        @ToString
        public static class GardenOfEden {
            @NotBlank @Getter @Setter private String panelGardenOfEden;
            @NotNull  @Getter @Setter private Boolean gardenOfEdenEnabled;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledString;
            @NotBlank @Getter @Setter private String gardenOfEdenEnabledToggleButton;
            @NotNull  @Getter @Setter private Integer foodPerDay;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisor;
            @NotNull  @Getter @Setter private Integer gardenOfEdenLatticeDivisorPadding;
        }
    }

    ////@Validated
    @ToString
    public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/commons/model/LatticePoint.java apps :: insourcing :: Simulated Evolution 35
org/woehlke/computer/kurzweil/simulated/evolution/model/lattice/LatticePoint.java apps :: legacy :: Simulated Evolution 39
org/woehlke/computer/kurzweil/commons/model/LatticePoint.java Computer Kurzweil :: App 35
private int x = 0;

  /**
   * Vertical Y-Coordinate. Also used as Height;
   */
  private int y = 0;

    public LatticePoint(LatticePoint other) {
        this.x = other.getX();
        this.y = other.getY();
    }

  public int getWidth() {
    return x;
  }

  public int getHeight() {
    return y;
  }

  public void absoluteValue() {
      x *= Integer.signum(x);
      y *= Integer.signum(y);
  }

  public void killNegative() {
        absoluteValue();
    }

  public void plus(LatticePoint p) {
    this.x += p.getX();
    this.y += p.getY();
    absoluteValue();
  }

    public void moveBy(LatticePoint p) {
        this.x += p.getX();
        this.y += p.getY();
    }

  public void normalize(LatticePoint p) {
    this.x %= p.getX();
    this.y %= p.getY();
  }

    public void moveUp() {
        y--;
    }

    public void moveRight() {
        x++;
    }

    public void moveDown() {
        y++;
    }

    public void moveLeft() {
        x--;
    }

    public LatticePoint copy() {
        return new LatticePoint(this);
    }

    public static LatticePoint start(LatticePoint worldDimensions){
        return new LatticePoint(
            (worldDimensions.getX()-2),
            ((worldDimensions.getY()/2)+11)
        );
    }

}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Julia 66
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot to Julia 78
start();
    }

    /*
    public void setModeZoom() {
        this.setZoomLevel(1);
        this.setZoomCenter(complexCenterForMandelbrot);
    }
*/

    public synchronized void start(){
        zoomLevel = 1;
        for(int y = 0;y < this.worldDimensions.getY(); y++){
            for(int x=0; x < worldDimensions.getX(); x++){
                lattice[x][y] = YET_UNCOMPUTED;
            }
        }
    }

    public synchronized int getCellStatusFor(int x,int y){
        return (lattice[x][y])<0?0:lattice[x][y];
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForJulia(Point turingPosition) {
        double realX = complexCenterForJulia.getReal()
            + (complexWorldDimensions.getReal()*turingPosition.getX())/worldDimensions.getX();
        double imgY = complexCenterForJulia.getImg()
            + (complexWorldDimensions.getImg()*turingPosition.getY())/worldDimensions.getY();
        return new ComplexNumber(realX,imgY);
    }

    private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForMandelbrot(Point turingPosition) {
        double realX = (
            complexCenterForMandelbrot.getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / worldDimensions.getX()
        );
        double imgY = (
            complexCenterForMandelbrot.getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / worldDimensions.getY()
        );
        return new ComplexNumber(realX,imgY);
    }
File Project Line
org/woehlke/computer/kurzweil/tabs/TabType.java apps :: insourcing :: Koch Snowflake 7
org/woehlke/computer/kurzweil/tabs/TabType.java apps :: insourcing :: Mandelbrot :: Julia 7
org/woehlke/computer/kurzweil/tabs/TabType.java apps :: insourcing :: Mandelbrot :: Zoom 7
org/woehlke/computer/kurzweil/tabs/TabType.java apps :: insourcing :: Sierpinski Triangle 7
org/woehlke/computer/kurzweil/tabs/TabType.java apps :: insourcing :: Simulated Evolution 7
org/woehlke/computer/kurzweil/tabs/TabType.java apps :: insourcing :: Turmite 7
org/woehlke/computer/kurzweil/tabs/TabType.java apps :: insourcing :: WaTor 7
org/woehlke/computer/kurzweil/simulated/evolution/view/tabs/TabType.java apps :: legacy :: Simulated Evolution 15
org/woehlke/computer/kurzweil/tabs/TabType.java Computer Kurzweil :: App 7
@Getter
public enum TabType {

    CYCLIC_CELLULAR_AUTOMATON(
        KeyEvent.VK_1,
        true,
        "Cyclic Cellular Automaton",
        "Cyclic Cellular Automaton",
        "Cyclic Cellular Automaton"
    ),
    DIFFUSION_LIMITED_AGGREGATION(
        KeyEvent.VK_2,
        true,
        "Diffusion Limited Aggregation",
        "Fractal Random Walk due to Brownian Motion Cluster",
        "Diffusion Limited Aggregation. Fractal Random Walk due to Brownian Motion Cluster"
    ),
    SIMULATED_EVOLUTION(
        KeyEvent.VK_3,
        true,
        "Simulated Evolution",
        "Artificial Life Simulation of Bacteria Motion depending on DNA and their Evolution",
        "Artificial Life Simulation of Bacteria Motion depending on DNA and their Evolution"
    ),
    MANDELBROT_SET(
        KeyEvent.VK_4,
        true,
        "Mandelbrot Set",
        "Fractal Mandelbrot Set drawn by a Turing Machine",
        "Fractal Mandelbrot Set drawn by a Turing Machine"
    ),
    RANDOM_WALK_WIENER_PROCESS(
        KeyEvent.VK_5,
        true,
        "Random Walk",
        "Brownian Motion by Fractal Random Walk",
        "Random Walk. Brownian Motion by Fractal Random Walk"
    ),
    KOCH_SNOWFLAKE(
        KeyEvent.VK_6,
        false,
        "Koch Snowflake",
        "Fractal Koch Snowflake",
        "Fractal Koch Snowflake"
    ),
    SAME_GAME(
        KeyEvent.VK_7,
        false,
        "Same Game",
        "Play the Same Game",
        "Play the Same Game"
    ),
    SIERPINSKI_TRIANGLE(
        KeyEvent.VK_0,
        false,
        "Sierpinski Triangle'",
        "Fractal Sierpinski Triangle",
        "Fractal Sierpinski Triangle"
    ),
    TETRIS(
        KeyEvent.VK_8,
        false,
        "Tetris",
        "Play Tetris",
        "Play Tetris"
    ),
    TURMITE(
        KeyEvent.VK_9,
        false,
        "Turmite",
        "Turmites as Turing Machines with 2D Tape",
        "Turmites as Turing Machines with 2D Tape"
    ),
    WATOR(
        KeyEvent.VK_A,
        false,
        "WaTor",
        "Population Dynamics on Planet Water Torus",
        "Population Dynamics on Planet Water Torus"
    ),
    CONWAYS_GAME_OF_LIFE(
        KeyEvent.VK_B,
        false,
        "Conways Game of Life",
        "Conways Game of Life Cellular Automaton",
        "Conways Game of Life Cellular Automaton"
    );

    private int keyEvent;
    private boolean active;
    private String title;
    private String subTitle;
    private String tooltip;

    TabType(int keyEvent, boolean active, String title, String subTitle, String tooltip){
        this.keyEvent=keyEvent;
        this.active=active;
        this.title=title;
        this.subTitle=subTitle;
        this.tooltip=tooltip;
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeTab.java apps :: insourcing :: Koch Snowflake 53
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/Mandelbrot2JuliaTab.java apps :: insourcing :: Mandelbrot :: Julia 49
org/woehlke/computer/kurzweil/tabs/mandelbrotzoom/MandelbrotZoomTab.java apps :: insourcing :: Mandelbrot :: Zoom 53
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleTab.java apps :: insourcing :: Sierpinski Triangle 53
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteTab.java apps :: insourcing :: Turmite 53
org/woehlke/computer/kurzweil/tabs/wator/WatorTab.java apps :: insourcing :: WaTor 53
rootPane.add(panelButtons);
        addWindowListener(this);
        this.canvas.addMouseListener(   this);
        showMeInit();
        setModeSwitch();
        this.mandelbrotController.start();
    }

    public void windowOpened(WindowEvent e) {
        showMe();
    }

    public void windowClosing(WindowEvent e) {
        this.mandelbrotController.exit();
    }

    public void windowClosed(WindowEvent e) {
        this.mandelbrotController.exit();
    }

    public void windowIconified(WindowEvent e) {}

    public void windowDeiconified(WindowEvent e) {
        showMe();
    }

    public void windowActivated(WindowEvent e) {
        showMe();
    }

    public void windowDeactivated(WindowEvent e) {}


    @Override
    public void mouseClicked(MouseEvent e) {
        Point c = new Point(e.getX(), e.getY());
        this.mandelbrotModel.click(c);
        showMe();
    }

    @Override
    public void mousePressed(MouseEvent e) {}

    @Override
    public void mouseReleased(MouseEvent e) {}

    @Override
    public void mouseEntered(MouseEvent e) {}

    @Override
    public void mouseExited(MouseEvent e) {}

    public void showMeInit() {
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = this.rootPane.getWidth();
        double height  = this.canvas.getHeight() + 180;
File Project Line
org/woehlke/computer/kurzweil/tabs/cca/config/ColorScheme.java apps :: insourcing :: Cyclic Cellular Automaton 14
org/woehlke/computer/kurzweil/tabs/cca/views/CyclicCellularAutomatonColorScheme.java Computer Kurzweil :: App 15
org/woehlke/computer/kurzweil/tabs/randomwalk/canvas/RandomWalkColorScheme.java Computer Kurzweil :: App 15
public ColorScheme(){
        List<Color> stateColorList = new ArrayList<>();
        stateColorList.add(Color.BLACK);
        stateColorList.add(Color.DARK_GRAY);
        stateColorList.add(Color.GRAY);
        stateColorList.add(Color.LIGHT_GRAY);
        stateColorList.add(Color.WHITE);
        stateColorList.add(Color.MAGENTA);
        stateColorList.add(Color.RED);
        stateColorList.add(Color.ORANGE);
        stateColorList.add(Color.YELLOW);
        stateColorList.add(Color.PINK);
        stateColorList.add(Color.BLUE);
        stateColorList.add(Color.CYAN);
        stateColorList.add(Color.GREEN);
        stateColorList.add(new Color(54,12,88));
        stateColorList.add(new Color(154,112,38));
        stateColorList.add(new Color(234,123,254));
        stateColor = new Color[stateColorList.toArray().length];
        for(int i=0; i < stateColorList.toArray().length; i++){
            stateColor[i] = (Color) stateColorList.get(i);
        }
    }

    public int getMaxState(){
        return stateColor.length;
    }

    public Color getColorForState(int state){
        return stateColor[state];
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Koch Snowflake 29
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Mandelbrot :: Julia 29
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Mandelbrot :: Zoom 29
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Sierpinski Triangle 29
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: Turmite 29
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringMachine.java apps :: insourcing :: WaTor 29
org/woehlke/computer/kurzweil/mandelbrot/julia/model/turing/MandelbrotTuringMachine.java apps :: legacy :: Mandelbrot to Julia 31
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/turing/MandelbrotTuringMachine.java Mandelbrot Zoom 32
org/woehlke/computer/kurzweil/mandelbrot/model/turing/MandelbrotTuringMachine.java apps :: legacy :: Mandelbrot 29
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/model/turing/MandelbrotTuringMachine.java Computer Kurzweil :: App 29
this.turingPositions = new MandelbrotTuringPositions(model.getWorldDimensions());
        start();
    }

    public void start() {
        this.turingPhaseState.start();
        this.gaussianNumberPlane.start();
        this.turingPositions.start();
    }

    public synchronized boolean step() {
        boolean repaint=true;
        switch(turingPhaseState.getTuringTuringPhase()){
            case SEARCH_THE_SET:
                stepGoToSet();
                repaint=false;
                break;
            case WALK_AROUND_THE_SET:
                stepWalkAround();
                break;
            case FILL_THE_OUTSIDE_WITH_COLOR:
                fillTheOutsideWithColors();
                break;
            case FINISHED:
            default:
                repaint=false;
                break;
        }
        return repaint;
    }

    private void stepGoToSet(){
        if(this.gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.markFirstSetPosition();
            this.turingPhaseState.finishSearchTheSet();
        } else {
            this.turingPositions.goForward();
        }
    }

    private void stepWalkAround(){
        if(gaussianNumberPlane.isInMandelbrotSet(this.turingPositions.getTuringPosition())){
            this.turingPositions.turnRight();
        } else {
            this.turingPositions.turnLeft();
        }
        this.turingPositions.goForward();
        if(this.turingPositions.isFinishedWalkAround()){
            this.turingPhaseState.finishWalkAround();
        }
    }

    private void fillTheOutsideWithColors(){
        this.gaussianNumberPlane.fillTheOutsideWithColors();
        this.turingPhaseState.finishFillTheOutsideWithColors();
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/view/ApplicationCanvas.java apps :: legacy :: Mandelbrot to Julia 31
org/woehlke/computer/kurzweil/mandelbrot/zoom/view/ApplicationCanvas.java Mandelbrot Zoom 29
private final static long serialVersionUID = 242L;

    private volatile ApplicationModel app;
    private volatile Dimension preferredSize;

    public ApplicationCanvas(ApplicationModel app) {
        this.app = app;
        int width = this.app.getWorldDimensions().getWidth();
        int height = this.app.getWorldDimensions().getHeight();
        this.preferredSize = new Dimension(width, height);
        this.setSize(this.preferredSize);
        this.setPreferredSize(preferredSize);
    }

    public void paint(Graphics g) {
        this.setSize(this.preferredSize);
        this.setPreferredSize(preferredSize);
        super.paintComponent(g);
        int red = 0;
        int green = 0;
        int blue = 0;
        for(int y = 0; y < app.getWorldDimensions().getY(); y++){
            for(int x = 0; x < app.getWorldDimensions().getX(); x++){
                blue = (((app.getCellStatusFor(x,y))*4)%256);
                Color stateColor = new Color(red, green, blue);
                g.setColor(stateColor);
                g.drawLine(x,y,x,y);
            }
        }
    }

    public void update(Graphics g) {
        paint(g);
    }

}
File Project Line
org/woehlke/computer/kurzweil/commons/model/Bounds.java apps :: insourcing :: Simulated Evolution 13
org/woehlke/computer/kurzweil/commons/model/Bounds.java Computer Kurzweil :: App 10
@Log
@Getter
@ToString
@AllArgsConstructor
@EqualsAndHashCode
public class Bounds implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    private final int myStartX;
    private final int myStartY;
    private final int myWidth;
    private final int myHeight;

    public Bounds(double height, double width, Dimension screenSize){
        double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        myStartX = Double.valueOf(startX).intValue();
        myStartY = Double.valueOf(startY).intValue();
        myWidth = Double.valueOf(width).intValue();
        myHeight = Double.valueOf(height).intValue();
    }

    public static Bounds getFrameBounds(JRootPane rootPane){
        double width = rootPane.getWidth();
        double height = rootPane.getHeight();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        return new Bounds(height,width,screenSize);
    }

    public static Bounds getCanvas(JRootPane rootPane){
        double width = rootPane.getWidth();
        double height = rootPane.getHeight();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        return new Bounds(height,width,screenSize);
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/food/FoodPerDayPanel.java apps :: insourcing :: Simulated Evolution 21
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/food/FoodPerDayPanel.java apps :: legacy :: Simulated Evolution 26
@ToString.Exclude
    private final SimulatedEvolutionContext tabCtx;
    private final String foodPerDayBorderLabel;
    private final FoodPerDayLabel foodPerDayLabel;
    private final FoodPerDayTextField foodPerDayTextField;
    private final FoodPerDayIncreaseButton foodPerDayIncreaseButton;
    private final FoodPerDayDecreaseButton foodPerDayDecreaseButton;
    private final SimulatedEvolutionModel tabModel;

    public FoodPerDayPanel(SimulatedEvolutionContext tabCtx) {
        super(tabCtx.getCtx().getProperties().getSimulatedevolution().getFood().getFoodPerDayLabel(),tabCtx.getCtx().getProperties());
        this.tabCtx = tabCtx;
        this.tabModel = this.tabCtx.getTabModel();
        this.foodPerDayLabel = new FoodPerDayLabel(this.tabCtx);
        this.foodPerDayTextField = new FoodPerDayTextField(this.tabCtx);
        this.foodPerDayIncreaseButton = new FoodPerDayIncreaseButton(this.tabCtx);
        this.foodPerDayDecreaseButton = new FoodPerDayDecreaseButton(this.tabCtx);
        this.foodPerDayBorderLabel = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getFood().getFoodPerDayLabel();
        //this.foodPerDayBorder = this.tabCtx.getCtx().getBorder(this.foodPerDayBorderLabel);
        //this.setBorder(this.foodPerDayBorder);
        this.add(this.foodPerDayLabel);
        this.add(this.foodPerDayTextField);
        this.add(this.foodPerDayIncreaseButton);
        this.add(this.foodPerDayDecreaseButton);
    }

    public void addActionListener(TabPanel myTabPanel) {
        this.foodPerDayIncreaseButton.addActionListener(myTabPanel);
        this.foodPerDayDecreaseButton.addActionListener(myTabPanel);
    }

    public void update() {
        //int foodPerDay = tabModel.getSimulatedEvolutionParameter().getFoodPerDay();
        //this.foodPerDayTextField.setFoodPerDay(foodPerDay);
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Koch Snowflake 28
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Mandelbrot :: Julia 28
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Mandelbrot :: Zoom 28
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Sierpinski Triangle 28
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: Turmite 28
org/woehlke/computer/kurzweil/commons/model/turing/Point.java apps :: insourcing :: WaTor 28
org/woehlke/computer/kurzweil/mandelbrot/julia/model/common/Point.java apps :: legacy :: Mandelbrot to Julia 27
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/common/Point.java Mandelbrot Zoom 29
org/woehlke/computer/kurzweil/mandelbrot/model/helper/Point.java apps :: legacy :: Mandelbrot 28
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/model/turing/Point.java Computer Kurzweil :: App 33
this.y = p.getY();
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void moveUp() {
        y--;
    }

    public void moveRight() {
        x++;
    }

    public void moveDown() {
        y++;
    }

    public void moveLeft() {
        x--;
    }

    public int getWidth(){
        return x;
    }
    public int getHeight() { return y; }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Point)) return false;
        Point point = (Point) o;
        return getX() == point.getX() &&
            getY() == point.getY();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getX(), getY());
    }

    @Override
    public String toString() {
        return "Point{" +
            "x=" + x +
            ", y=" + y +
            '}';
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 122
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Julia 124
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 129
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 122
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 122
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 122
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 129
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 129
return position.isInMandelbrotSet();
    }

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }

    private synchronized void computeTheJuliaSetForC(ComplexNumber c) {
        for(int y = 0; y < worldDimensions.getY(); y++) {
            for (int x = 0; x < worldDimensions.getX(); x++) {
                Point zPoint = new Point(x, y);
                ComplexNumber z = this.getComplexNumberFromLatticeCoordsForJulia(zPoint);
                lattice[x][y] = z.computeJuliaSet(c);
            }
        }
    }

    public synchronized void computeTheJuliaSetFor(Point pointFromMandelbrotSet) {
        ComplexNumber c = getComplexNumberFromLatticeCoordsForMandelbrot(pointFromMandelbrotSet);
        this.complexNumberForJuliaSetC = c;
        computeTheJuliaSetForC(c);
    }

    public void zoomIntoTheMandelbrotSet(Point zoomPoint) {
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeModel.java apps :: insourcing :: Koch Snowflake 36
org/woehlke/computer/kurzweil/tabs/mandelbrotzoom/MandelbrotZoomModel.java apps :: insourcing :: Mandelbrot :: Zoom 38
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleModel.java apps :: insourcing :: Sierpinski Triangle 38
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteModel.java apps :: insourcing :: Turmite 38
org/woehlke/computer/kurzweil/tabs/wator/WatorModel.java apps :: insourcing :: WaTor 38
this.applicationStateMachine = new KochSnowflakeTabStateMachine();
    }

    public synchronized boolean click(Point c) {
        applicationStateMachine.click();
        boolean repaint = true;
        switch (applicationStateMachine.getApplicationState()) {
            case MANDELBROT:
                mandelbrotTuringMachine.start();
                repaint = false;
                break;
            //case JULIA_SET:
            //    gaussianNumberPlane.computeTheJuliaSetFor(c);
            //    break;
            case MANDELBROT_ZOOM:
                gaussianNumberPlane.zoomIntoTheMandelbrotSet(c);
                break;
            //case JULIA_SET_ZOOM:
            //    gaussianNumberPlane.zoomIntoTheJuliaSetFor(c);
            //    break;
        }
        return repaint;
    }

    public synchronized boolean step() {
        boolean repaint = false;
        switch (applicationStateMachine.getApplicationState()) {
            case MANDELBROT:
                repaint = mandelbrotTuringMachine.step();
                break;
            //case JULIA_SET:
            case MANDELBROT_ZOOM:
            //case JULIA_SET_ZOOM:
                break;
        }
        return repaint;
    }

    public synchronized int getCellStatusFor(int x, int y) {
        return gaussianNumberPlane.getCellStatusFor(x, y);
    }

    public Point getWorldDimensions() {
        int width = properties.getAllinone().getLattice().getWidth();
        int height = properties.getAllinone().getLattice().getHeight();
        return new Point(width, height);
    }

    public void setModeSwitch() {
        this.applicationStateMachine.setModeSwitch();
        this.frame.setModeSwitch();
    }

    public void setModeZoom() {
        this.gaussianNumberPlane.setModeZoom();
        this.applicationStateMachine.setModeZoom();
        this.frame.setModeZoom();
    }

    public GaussianNumberPlane getGaussianNumberPlane() {
        return gaussianNumberPlane;
    }

    public KochSnowflakeTab getFrame() {
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Julia 124
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot to Julia 137
return new ComplexNumber(realX,imgY);
    }

    /*
    public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }
*/

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }

    private synchronized void computeTheJuliaSetForC(ComplexNumber c) {
        for(int y = 0; y < worldDimensions.getY(); y++) {
            for (int x = 0; x < worldDimensions.getX(); x++) {
                Point zPoint = new Point(x, y);
                ComplexNumber z = this.getComplexNumberFromLatticeCoordsForJulia(zPoint);
                lattice[x][y] = z.computeJuliaSet(c);
            }
        }
    }

    public synchronized void computeTheJuliaSetFor(Point pointFromMandelbrotSet) {
        ComplexNumber c = getComplexNumberFromLatticeCoordsForMandelbrot(pointFromMandelbrotSet);
        this.complexNumberForJuliaSetC = c;
        computeTheJuliaSetForC(c);
    }
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/view/ApplicationCanvas.java apps :: legacy :: Mandelbrot to Julia 33
org/woehlke/computer/kurzweil/mandelbrot/zoom/view/ApplicationCanvas.java Mandelbrot Zoom 31
org/woehlke/computer/kurzweil/mandelbrot/view/ApplicationCanvas.java apps :: legacy :: Mandelbrot 23
private volatile ApplicationModel app;
    private volatile Dimension preferredSize;

    public ApplicationCanvas(ApplicationModel app) {
        this.app = app;
        int width = this.app.getWorldDimensions().getWidth();
        int height = this.app.getWorldDimensions().getHeight();
        this.preferredSize = new Dimension(width, height);
        this.setSize(this.preferredSize);
        this.setPreferredSize(preferredSize);
    }

    public void paint(Graphics g) {
        this.setSize(this.preferredSize);
        this.setPreferredSize(preferredSize);
        super.paintComponent(g);
        int red = 0;
        int green = 0;
        int blue = 0;
        for(int y = 0; y < app.getWorldDimensions().getY(); y++){
            for(int x = 0; x < app.getWorldDimensions().getX(); x++){
                blue = (((app.getCellStatusFor(x,y))*4)%256);
                Color stateColor = new Color(red, green, blue);
                g.setColor(stateColor);
                g.drawLine(x,y,x,y);
            }
        }
    }

    public void update(Graphics g) {
        paint(g);
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/dla/view/desktop/DiffusionLimitedAggregationFrame.java apps :: insourcing :: Diffusion Limited Aggregation 33
org/woehlke/computer/kurzweil/dla/view/desktop/DiffusionLimitedAggregationFrame.java apps :: legacy :: Diffusion Limited Aggregation 34
private DiffusionLimitedAggregationApplet exe;

    public DiffusionLimitedAggregationFrame() {
        super(TITLE);
        exe = new DiffusionLimitedAggregationApplet();
        exe.init();
        add("Center", exe);
        setBounds(100, 100, exe.getCanvasDimensions().getX(), exe.getCanvasDimensions().getY() + 30);
        pack();
        setVisible(true);
        toFront();
        addWindowListener(this);
    }

    public void windowOpened(WindowEvent e) {
        setBounds(100, 100, exe.getCanvasDimensions().getX(), exe.getCanvasDimensions().getY() + 30);
        setVisible(true);
        toFront();
    }

    public void windowClosing(WindowEvent e) {
        System.exit(0);
    }

    public void windowClosed(WindowEvent e) {
        System.exit(0);
    }

    public void windowIconified(WindowEvent e) {

    }

    public void windowDeiconified(WindowEvent e) {
        setBounds(100, 100, exe.getCanvasDimensions().getX(), exe.getCanvasDimensions().getY() + 30);
        setVisible(true);
        toFront();
    }

    public void windowActivated(WindowEvent e) {
        toFront();
    }

    public void windowDeactivated(WindowEvent e) {
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 155
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 162
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 155
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 155
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 155
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 149
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 162
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 162
}

    public void zoomIntoTheMandelbrotSet(Point zoomPoint) {
        //log.info("zoomIntoTheMandelbrotSet: "+ zoomPoint +" - old:  "+this.getZoomCenter());
        this.inceaseZoomLevel();
        if(this.getZoomLevel() == 2){
            ComplexNumber complexCenter = new ComplexNumber(this.complexCenterForMandelbrot);
            complexCenterForZoomedMandelbrot.push(complexCenter);
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForMandelbrot(zoomPoint));
        } else {
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForZoomedMandelbrot(zoomPoint));
        }
        complexCenterForZoomedMandelbrot.push(this.getZoomCenter());
        //log.info("zoomPoint:     "+ zoomPoint);
        //log.info("zoomCenterNew: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }

    public void zoomOutOfTheMandelbrotSet() {
        //log.info("zoomOutOfTheMandelbrotSet: " + this.getZoomCenter());
        if(this.getZoomLevel()>1){
            this.deceaseZoomLevel();
            this.setZoomCenter(complexCenterForZoomedMandelbrot.pop());
        }
        //log.info("zoomCenter: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }

    public void zoomIntoTheJuliaSetFor(Point zoomPoint) {
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeTab.java apps :: insourcing :: Koch Snowflake 110
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/Mandelbrot2JuliaTab.java apps :: insourcing :: Mandelbrot :: Julia 106
org/woehlke/computer/kurzweil/tabs/mandelbrotzoom/MandelbrotZoomTab.java apps :: insourcing :: Mandelbrot :: Zoom 110
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleTab.java apps :: insourcing :: Sierpinski Triangle 110
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteTab.java apps :: insourcing :: Turmite 110
org/woehlke/computer/kurzweil/tabs/wator/WatorTab.java apps :: insourcing :: WaTor 110
org/woehlke/computer/kurzweil/mandelbrot/julia/view/ApplicationFrame.java apps :: legacy :: Mandelbrot to Julia 128
org/woehlke/computer/kurzweil/mandelbrot/zoom/view/ApplicationFrame.java Mandelbrot Zoom 124
org/woehlke/computer/kurzweil/mandelbrot/view/ApplicationFrame.java apps :: legacy :: Mandelbrot 109
double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        int myheight = Double.valueOf(height).intValue();
        int mywidth = Double.valueOf(width).intValue();
        int mystartX = Double.valueOf(startX).intValue();
        int mystartY = Double.valueOf(startY).intValue();
        this.rectangleBounds = new Rectangle(mystartX, mystartY, mywidth, myheight);
        this.dimensionSize = new Dimension(mywidth, myheight);
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setVisible(true);
        toFront();
    }

    /**
     * TODO write doc.
     */
    public void showMe() {
        this.pack();
        this.setBounds(this.rectangleBounds);
        this.setSize(this.dimensionSize);
        this.setPreferredSize(this.dimensionSize);
        this.setVisible(true);
        this.toFront();
    }

    public void setModeSwitch() {
        canvas.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
    }

    public void setModeZoom() {
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeCanvas.java apps :: insourcing :: Koch Snowflake 24
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/Mandelbrot2JuliaCanvas.java apps :: insourcing :: Mandelbrot :: Julia 24
org/woehlke/computer/kurzweil/tabs/mandelbrotzoom/MandelbrotZoomCanvas.java apps :: insourcing :: Mandelbrot :: Zoom 24
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleCanvas.java apps :: insourcing :: Sierpinski Triangle 26
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteCanvas.java apps :: insourcing :: Turmite 24
org/woehlke/computer/kurzweil/tabs/wator/WatorCanvas.java apps :: insourcing :: WaTor 26
org/woehlke/computer/kurzweil/mandelbrot/julia/view/ApplicationCanvas.java apps :: legacy :: Mandelbrot to Julia 36
org/woehlke/computer/kurzweil/mandelbrot/zoom/view/ApplicationCanvas.java Mandelbrot Zoom 34
org/woehlke/computer/kurzweil/mandelbrot/view/ApplicationCanvas.java apps :: legacy :: Mandelbrot 26
public KochSnowflakeCanvas(KochSnowflakeModel app) {
        this.app = app;
        int width = this.app.getWorldDimensions().getWidth();
        int height = this.app.getWorldDimensions().getHeight();
        this.preferredSize = new Dimension(width, height);
        this.setSize(this.preferredSize);
        this.setPreferredSize(preferredSize);
    }

    public void paint(Graphics g) {
        this.setSize(this.preferredSize);
        this.setPreferredSize(preferredSize);
        super.paintComponent(g);
        int red = 0;
        int green = 0;
        int blue = 0;
        for(int y = 0; y < app.getWorldDimensions().getY(); y++){
            for(int x = 0; x < app.getWorldDimensions().getX(); x++){
                blue = (((app.getCellStatusFor(x,y))*4)%256);
                Color stateColor = new Color(red, green, blue);
                g.setColor(stateColor);
                g.drawLine(x,y,x,y);
            }
        }
    }

    public void update(Graphics g) {
        paint(g);
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/cca/view/CyclicCellularAutomatonCanvas.java apps :: insourcing :: Cyclic Cellular Automaton 19
org/woehlke/computer/kurzweil/cyclic/cellular/automaton/view/CyclicCellularAutomatonCanvas.java apps :: legacy :: Cyclic Cellular Automaton 20
public class CyclicCellularAutomatonCanvas extends JComponent implements Serializable {

    private static final long serialVersionUID = -3057254130516052936L;

    private ObjectRegistry ctx;

    public CyclicCellularAutomatonCanvas(ObjectRegistry ctx) {
        this.ctx = ctx;
        Dimension preferredSize = new Dimension(
            (int) ctx.getConfig().getLatticeDimensions().getX(),
            (int) ctx.getConfig().getLatticeDimensions().getY()
        );
        this.setPreferredSize(preferredSize);
    }

    public void paint(Graphics g) {
        super.paintComponent(g);
        for(int y = 0; y < ctx.getConfig().getLatticeDimensions().getY(); y++){
            for(int x = 0; x < ctx.getConfig().getLatticeDimensions().getX(); x++){
                int state = this.ctx.getLattice().getCellStatusFor(x,y);
                Color stateColor = this.ctx.getColorScheme().getColorForState(state);
                g.setColor(stateColor);
                g.drawLine(x,y,x,y);
            }
        }
    }

    public void update(Graphics g) {
        paint(g);
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/cca/config/ColorScheme.java apps :: insourcing :: Cyclic Cellular Automaton 12
org/woehlke/computer/kurzweil/cyclic/cellular/automaton/config/ColorScheme.java apps :: legacy :: Cyclic Cellular Automaton 18
private Color[] stateColor;

    public ColorScheme(){
        List<Color> stateColorList = new ArrayList<>();
        stateColorList.add(Color.BLACK);
        stateColorList.add(Color.DARK_GRAY);
        stateColorList.add(Color.GRAY);
        stateColorList.add(Color.LIGHT_GRAY);
        stateColorList.add(Color.WHITE);
        stateColorList.add(Color.MAGENTA);
        stateColorList.add(Color.RED);
        stateColorList.add(Color.ORANGE);
        stateColorList.add(Color.YELLOW);
        stateColorList.add(Color.PINK);
        stateColorList.add(Color.BLUE);
        stateColorList.add(Color.CYAN);
        stateColorList.add(Color.GREEN);
        stateColorList.add(new Color(54,12,88));
        stateColorList.add(new Color(154,112,38));
        stateColorList.add(new Color(234,123,254));
        stateColor = new Color[stateColorList.toArray().length];
        for(int i=0; i < stateColorList.toArray().length; i++){
            stateColor[i] = (Color) stateColorList.get(i);
File Project Line
org/woehlke/computer/kurzweil/commons/model/Bounds.java apps :: insourcing :: Simulated Evolution 22
org/woehlke/computer/kurzweil/simulated/evolution/model/world/Bounds.java apps :: legacy :: Simulated Evolution 30
org/woehlke/computer/kurzweil/commons/model/Bounds.java Computer Kurzweil :: App 19
private final int myStartX;
    private final int myStartY;
    private final int myWidth;
    private final int myHeight;

    public Bounds(double height, double width, Dimension screenSize){
        double startX = (screenSize.getWidth() - width) / 2d;
        double startY = (screenSize.getHeight() - height) / 2d;
        myStartX = Double.valueOf(startX).intValue();
        myStartY = Double.valueOf(startY).intValue();
        myWidth = Double.valueOf(width).intValue();
        myHeight = Double.valueOf(height).intValue();
    }

    public static Bounds getFrameBounds(JRootPane rootPane){
        double width = rootPane.getWidth();
        double height = rootPane.getHeight();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        return new Bounds(height,width,screenSize);
    }

    public static Bounds getCanvas(JRootPane rootPane){
        double width = rootPane.getWidth();
        double height = rootPane.getHeight();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        return new Bounds(height,width,screenSize);
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/dla/model/Dendrite.java apps :: insourcing :: Diffusion Limited Aggregation 20
org/woehlke/computer/kurzweil/dla/model/Dendrite.java apps :: legacy :: Diffusion Limited Aggregation 21
private int worldMap[][];
    private Point dimensions;
    private int age=1;

    public Dendrite(Point dimensions) {
        this.dimensions = dimensions;
        worldMap = new int[dimensions.getX()][dimensions.getY()];
        int x = dimensions.getX() / 2;
        int y = dimensions.getY() / 2;
        worldMap[x][y]=age;
        age++;
    }

    public boolean hasDendriteNeighbour(Point pixel){
        if(worldMap[pixel.getX()][pixel.getY()]==0){
            Point[] neighbours=pixel.getNeighbourhood(dimensions);
            for(Point neighbour:neighbours){
               if(worldMap[neighbour.getX()][neighbour.getY()]>0){
                   worldMap[pixel.getX()][pixel.getY()]=age;
                   age++;
                   return true;
               }
            }
            return false;
        } else {
           return true;
        }
    }

    public int getAgeForPixel(int x,int y){
        return worldMap[x][y];
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/garden/GardenOfEdenPanelRow.java apps :: insourcing :: Simulated Evolution 21
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/garden/GardenOfEdenPanelRow.java apps :: legacy :: Simulated Evolution 26
@ToString.Exclude
    private final SimulatedEvolutionContext tabCtx;
    @ToString.Exclude
    private final SimulatedEvolutionModel tabModel;
    private final GardenOfEdenCheckBox gardenOfEdenEnabled;
    private final GardenOfEdenToggleButton buttonToggleGardenOfEden;
    //private final GardenOfEdenPanel gardenOfEdenPanel;

    public GardenOfEdenPanelRow(SimulatedEvolutionContext tabCtx) {
        super("Garden of Eden",tabCtx.getCtx().getProperties());
        this.tabCtx = tabCtx;
        this.tabModel = this.tabCtx.getTabModel();
        this.gardenOfEdenEnabled = new GardenOfEdenCheckBox(this.tabCtx);
        this.buttonToggleGardenOfEden = new GardenOfEdenToggleButton(this.tabCtx);
        /*
        this.gardenOfEdenPanel = new GardenOfEdenPanel(this.tabCtx);
        this.gardenOfEdenPanel.add(this.gardenOfEdenEnabled);
        this.gardenOfEdenPanel.add(this.buttonToggleGardenOfEden);
        this.add( this.gardenOfEdenPanel);
        */
        this.add(this.gardenOfEdenEnabled);
        this.add(this.buttonToggleGardenOfEden);
    }

    public void setSelected(boolean selected) {
        this.tabModel.getSimulatedEvolutionParameter().setGardenOfEdenEnabled(selected);
        update();
    }

    public void toggleGardenOfEden() {
        this.tabModel.getSimulatedEvolutionParameter().toggleGardenOfEden();
        update();
    }

    public void addActionListener(TabPanel myTabPanel) {
        this.buttonToggleGardenOfEden.addActionListener(myTabPanel);
    }

    public void update() {
        boolean enabled = tabModel.getSimulatedEvolutionParameter().isGardenOfEdenEnabled();
        this.buttonToggleGardenOfEden.setSelected(enabled);
        this.gardenOfEdenEnabled.setSelected(enabled);
    }
}
File Project Line
org/woehlke/computer/kurzweil/cyclic/cellular/automaton/config/ColorScheme.java apps :: legacy :: Cyclic Cellular Automaton 20
org/woehlke/computer/kurzweil/tabs/cca/views/CyclicCellularAutomatonColorScheme.java Computer Kurzweil :: App 15
org/woehlke/computer/kurzweil/tabs/randomwalk/canvas/RandomWalkColorScheme.java Computer Kurzweil :: App 15
public ColorScheme() {
        List<Color> stateColorList = new ArrayList<>();
        stateColorList.add(Color.BLACK);
        stateColorList.add(Color.DARK_GRAY);
        stateColorList.add(Color.GRAY);
        stateColorList.add(Color.LIGHT_GRAY);
        stateColorList.add(Color.WHITE);
        stateColorList.add(Color.MAGENTA);
        stateColorList.add(Color.RED);
        stateColorList.add(Color.ORANGE);
        stateColorList.add(Color.YELLOW);
        stateColorList.add(Color.PINK);
        stateColorList.add(Color.BLUE);
        stateColorList.add(Color.CYAN);
        stateColorList.add(Color.GREEN);
        stateColorList.add(new Color(54, 12, 88));
        stateColorList.add(new Color(154, 112, 38));
        stateColorList.add(new Color(234, 123, 254));
        stateColor = new Color[stateColorList.toArray().length];
        for (int i = 0; i < stateColorList.toArray().length; i++) {
            stateColor[i] = stateColorList.get(i);
File Project Line
org/woehlke/computer/kurzweil/tabs/cca/control/CyclicCellularAutomatonController.java apps :: insourcing :: Cyclic Cellular Automaton 17
org/woehlke/computer/kurzweil/cyclic/cellular/automaton/control/CyclicCellularAutomatonController.java apps :: legacy :: Cyclic Cellular Automaton 18
public class CyclicCellularAutomatonController extends Thread
        implements Runnable, Serializable {

    private static final int THREAD_SLEEP_TIME = 100;

    private static final long serialVersionUID = 3642865135701767557L;

    private Boolean goOn;

    private final ObjectRegistry ctx;

    public CyclicCellularAutomatonController(ObjectRegistry ctx) {
        this.ctx = ctx;
        goOn = Boolean.TRUE;
    }

    public void run() {
        boolean doIt;
        do {
            synchronized (goOn) {
                doIt = goOn.booleanValue();
            }
            ctx.getLattice().step();
            ctx.getCanvas().repaint();
            try { sleep(THREAD_SLEEP_TIME); }
            catch (InterruptedException e) { e.printStackTrace(); }
        }
        while (doIt);
    }

    public void exit() {
        synchronized (goOn) {
            goOn = Boolean.FALSE;
        }
    }


    public void pushButtonVonNeumann() {
        ctx.getLattice().startVonNeumann();
    }

    public void pushButtonMoore() {
        ctx.getLattice().startMoore();
    }

    public void pushButtonWoehlke() {
        ctx.getLattice().startWoehlke();
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot to Julia 134
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 129
public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 32
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 31
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 31
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 32
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 37
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 32
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 32
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 29
@Valid @Getter @Setter public MandelbrotZoom mandelbrotZoom = new MandelbrotZoom();
    @Valid @Getter @Setter public SimulatedEvolution simulatedevolution = new SimulatedEvolution();
    @Valid @Getter @Setter public Cca cca = new Cca();
    @Valid @Getter @Setter public WienerProcess randomwalk = new WienerProcess();
    @Valid @Getter @Setter public Dla dla = new Dla();
    @Valid @Getter @Setter public Kochsnowflake kochsnowflake = new Kochsnowflake();
    @Valid @Getter @Setter public Samegame samegame = new Samegame();
    @Valid @Getter @Setter public Sierpinskitriangle sierpinskitriangle = new Sierpinskitriangle();
    @Valid @Getter @Setter public Tetris tetris = new Tetris();
    @Valid @Getter @Setter public Turmite turmite = new Turmite();
    @Valid @Getter @Setter public Wator wator = new Wator();
    @Valid @Getter @Setter public Gameoflive gameoflive = new Gameoflive();
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/SimulatedEvolutionApplet.java apps :: insourcing :: Simulated Evolution 34
org/woehlke/computer/kurzweil/simulated/evolution/view/SimulatedEvolutionApplet.java apps :: legacy :: Simulated Evolution 46
private Label title = new Label("      Artificial Life Simulation of Bacteria Motion depending on DNA - (C) 2013 Thomas Woehlke");

    /**
     * ControllerThread for Interachtions between Model and View (MVC-Pattern).
     */
    private SimulatedEvolutionController simulatedEvolutionController;

    /**
     * The View for the World. Food and Cells are painted to the Canvas.
     */
    private SimulatedEvolutionCanvas canvas;

    /**
     * Data Model for the Simulation. The World contains the Bacteria Cells and the Food.
     */
    private SimulatedEvolutionModel simulatedEvolutionModel;

    public void init() {
        int scale = 2;
        int width = 320 * scale;
        int height = 234 * scale;
        this.setLayout(new BorderLayout());
        this.add(title, BorderLayout.NORTH);
        simulatedEvolutionController = new SimulatedEvolutionController();
        WorldPoint worldDimensions = new WorldPoint(width,height);
        simulatedEvolutionModel = new SimulatedEvolutionModel(worldDimensions);
        canvas = new SimulatedEvolutionCanvas(worldDimensions);
        canvas.setTabModel(simulatedEvolutionModel);
        this.add(canvas, BorderLayout.CENTER);
        simulatedEvolutionController.setCanvas(canvas);
        simulatedEvolutionController.setSimulatedEvolutionModel(simulatedEvolutionModel);
        simulatedEvolutionController.start();
    }

    public void destroy() {
    }

    public void stop() {
    }

    public WorldPoint getCanvasDimensions() {
        return canvas.getWorldDimensions();
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/food/FoodPerDayTextField.java apps :: insourcing :: Simulated Evolution 18
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/food/FoodPerDayTextField.java apps :: legacy :: Simulated Evolution 25
@ToString.Exclude
    private final SimulatedEvolutionContext tabCtx;
    private final String foodPerDayTextFieldString;
    private final int foodPerDayTextFieldCols;

    public FoodPerDayTextField(SimulatedEvolutionContext tabCtx) {
        super(
            tabCtx.getCtx().getProperties().getSimulatedevolution().getFood().getFoodPerDay()+"",
            tabCtx.getCtx().getProperties().getSimulatedevolution().getFood().getFoodPerDayFieldColumns()
        );
        this.tabCtx = tabCtx;
        this.foodPerDayTextFieldString = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getFood().getFoodPerDay()+"";
        this.foodPerDayTextFieldCols = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getFood().getFoodPerDayFieldColumns();
    }

    public void setFoodPerDay(int foodPerDay){
        this.setText(""+foodPerDay);
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/PanelStartStopButtons.java apps :: insourcing :: Simulated Evolution 24
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/PanelStartStopButtons.java apps :: legacy :: Simulated Evolution 32
org/woehlke/computer/kurzweil/commons/widgets/PanelStartStopButtons.java Computer Kurzweil :: App 24
public PanelStartStopButtons(Tab tab){
        super(tab.getCtx().getProperties().getAllinone().getView().getStartStopp(),tab.getCtx().getProperties());
        labelStart = tab.getCtx().getProperties().getAllinone().getView().getStart();
        labelStop = tab.getCtx().getProperties().getAllinone().getView().getStop();
        this.startButton = new JButton(labelStart);
        this.stopButton = new JButton(labelStop);
        this.startButton.setEnabled(true);
        this.stopButton.setEnabled(false);
        this.add(this.startButton);
        this.add(this.stopButton);
        this.startButton.addActionListener(tab);
        this.stopButton.addActionListener(tab);
    }
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 383
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 414
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 445
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 476
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 507
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 383
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 414
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 445
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 476
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 507
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 383
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 414
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 445
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 476
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 507
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 383
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 414
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 445
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 476
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 507
public static class Kochsnowflake {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Samegame {
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 258
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 290
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 322
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 354
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 386
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 418
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 284
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 316
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 348
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 380
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 412
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 444
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 560
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 625
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 690
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 755
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 820
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 885
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 258
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 290
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 322
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 354
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 386
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 418
public static class Kochsnowflake {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Samegame {
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/PanelWithTitleBorder.java apps :: insourcing :: Simulated Evolution 11
org/woehlke/computer/kurzweil/commons/widgets/PanelWithTitleBorder.java Computer Kurzweil :: App 11
@Log
@Getter
public class PanelWithTitleBorder extends JPanel {

    private static final long serialVersionUID = 7526471155622776147L;

    private final FlowLayoutCenter panelStartStopButtonsLayout;
    private final CompoundBorder panelStartStopButtonsBorder;

    public PanelWithTitleBorder(String label, ComputerKurzweilProperties p) {
        panelStartStopButtonsLayout = new FlowLayoutCenter();
        int top = p.getAllinone().getView().getBorderPaddingY();
        int left = p.getAllinone().getView().getBorderPaddingX();
        int bottom = p.getAllinone().getView().getBorderPaddingY();
        int right = p.getAllinone().getView().getBorderPaddingX();
        panelStartStopButtonsBorder = BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(label),
            BorderFactory.createEmptyBorder(top,left,bottom,right)
        );
        this.setLayout(panelStartStopButtonsLayout);
        this.setBorder(panelStartStopButtonsBorder);
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/population/PopulationStatisticsElementsPanelCounted.java apps :: insourcing :: Simulated Evolution 49
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/population/PopulationStatisticsElementsPanelLifeCycle.java apps :: insourcing :: Simulated Evolution 52
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/population/PopulationStatisticsElementsPanelCounted.java apps :: legacy :: Simulated Evolution 53
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/population/PopulationStatisticsElementsPanelLifeCycle.java apps :: legacy :: Simulated Evolution 56
public PopulationStatisticsElementsPanelCounted(
        SimulatedEvolutionContext tabCtx
    ) {
        super(tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation().getPanelPopulationStatistics(),tabCtx.getCtx().getProperties());
        this.tabCtx = tabCtx;
        layoutSubPanel = new FlowLayout();
        this.setLayout(layoutSubPanel);
        borderLabel = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation().getPanelPopulationStatistics();
        layout = new FlowLayoutCenter();
        border = tabCtx.getCtx().getBottomButtonsPanelBorder(borderLabel);
        this.setLayout(layout);
        this.setBorder(border);
        ComputerKurzweilProperties.SimulatedEvolution.Population cfg = this.tabCtx.getCtx().getProperties().getSimulatedevolution().getPopulation();
        initialPopulation = cfg.getInitialPopulation();
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/ui/PanelButtons.java apps :: insourcing :: Koch Snowflake 30
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/ui/PanelButtons.java apps :: insourcing :: Sierpinski Triangle 31
org/woehlke/computer/kurzweil/tabs/turmite/ui/PanelButtons.java apps :: insourcing :: Turmite 31
org/woehlke/computer/kurzweil/commons/ui/PanelButtons.java apps :: insourcing :: WaTor 30
public PanelButtons(KochSnowflakeModel model) {
        this.model = model;
        JLabel buttonsLabel = new JLabel(model.getProperties().getWator().getView().getButtonsLabel());
        /*
        this.radioButtonsSwitch = new JRadioButton(model.getProperties().getMandelbrot().getView().getButtonsSwitch());
        this.radioButtonsSwitch.setMnemonic(RADIO_BUTTONS_SWITCH.ordinal());
        this.radioButtonsSwitch.setSelected(true);
        this.radioButtonsSwitch.addActionListener(this);
        this.radioButtonsZoom = new JRadioButton(model.getProperties().getMandelbrot().getView().getButtonsSwitch());
        this.radioButtonsZoom.setMnemonic(RADIO_BUTTONS_ZOOM.ordinal());
        this.radioButtonsZoom.addActionListener(this);
        this.radioButtonsGroup = new ButtonGroup();
        this.radioButtonsGroup.add(radioButtonsSwitch);
        this.radioButtonsGroup.add(radioButtonsZoom);
         */
        this.zoomOut = new JButton(model.getProperties().getWator().getView().getButtonsZoomOut());
        this.zoomOut.addActionListener(this);
        FlowLayout layout = new FlowLayout();
        this.setLayout(layout);
        this.add(buttonsLabel);
        //this.add(radioButtonsSwitch);
        //this.add(radioButtonsZoom);
        this.add(zoomOut);
    }

    /**
     * TODO write doc.
     */
    @Override
    public void actionPerformed(ActionEvent ae) {
        //if (ae.getSource() == this.radioButtonsSwitch) {
        //    this.model.setModeSwitch();
        //} else
            //if(ae.getSource() == this.radioButtonsZoom) {
           // this.model.setModeZoom();
        //} else
        if(ae.getSource() == this.zoomOut){
            this.model.zoomOut();
            this.model.getFrame().getCanvas().repaint();
        }
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/population/PopulationStatisticsElement.java apps :: insourcing :: Simulated Evolution 19
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/population/PopulationStatisticsElement.java apps :: legacy :: Simulated Evolution 25
private final JLabel label;
    private final JTextField statistics;
    private final LifeCycleStatus lifeCycleStatus;
    private final int cols = 3;
    private final String defaultTextField = "0";

    public PopulationStatisticsElement(String label, LifeCycleStatus lifeCycleStatus) {
        this.label = new JLabel(label);
        this.lifeCycleStatus = lifeCycleStatus;
        this.statistics = new JTextField(defaultTextField,cols);
        this.add(this.label);
        this.add(this.statistics);
        statistics.setBackground(this.lifeCycleStatus.getColorBackground());
        statistics.setForeground(this.lifeCycleStatus.getColorForeground());
    }

    public void setText(int value){
        this.statistics.setText(""+value);
    }

    public void setText(long value){
        this.statistics.setText(""+value);
    }
}
File Project Line
org/woehlke/computer/kurzweil/tabs/dla/view/applet/DiffusionLimitedAggregationApplet.java apps :: insourcing :: Diffusion Limited Aggregation 32
org/woehlke/computer/kurzweil/dla/view/applet/DiffusionLimitedAggregationApplet.java apps :: legacy :: Diffusion Limited Aggregation 32
private Label title = new Label(TITLE);
    private ControllerThread controllerThread;
    private WorldCanvas canvas;
    private Particles particles;

    public void init() {
        int scale = 2;
        int width = 320 * scale;
        int height = 234 * scale;
        this.setLayout(new BorderLayout());
        this.add(title, BorderLayout.NORTH);
        Point worldDimensions = new Point(width,height);
        particles = new Particles(worldDimensions);
        canvas = new WorldCanvas(worldDimensions,particles);
        this.add(canvas, BorderLayout.CENTER);
        controllerThread = new ControllerThread(canvas,particles);
        controllerThread.start();
    }

    public void destroy() {
    }

    public void stop() {
    }

    public Point getCanvasDimensions() {
        return canvas.getWorldDimensions();
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/control/ControllerThread.java apps :: legacy :: Mandelbrot to Julia 24
org/woehlke/computer/kurzweil/mandelbrot/zoom/control/ControllerThread.java Mandelbrot Zoom 24
public class ControllerThread extends Thread implements Runnable {

    private volatile ApplicationModel applicationModel;
    private volatile ApplicationFrame frame;

    private final int THREAD_SLEEP_TIME = 1;

    private volatile Boolean goOn;

    public ControllerThread(ApplicationModel model, ApplicationFrame frame) {
        this.frame = frame;
        this.applicationModel = model;
        goOn = Boolean.TRUE;
    }

    public void run() {
        boolean doIt;
        do {
            synchronized (goOn) {
                doIt = goOn.booleanValue();
            }
            if(this.applicationModel.step()){
                frame.getCanvas().repaint();
            }
            try { sleep(THREAD_SLEEP_TIME); }
            catch (InterruptedException e) { }
        }
        while (doIt);
    }

    public void exit() {
        synchronized (goOn) {
            goOn = Boolean.FALSE;
        }
    }

}
File Project Line
org/woehlke/computer/kurzweil/tabs/cca/view/CyclicCellularAutomatonFrame.java apps :: insourcing :: Cyclic Cellular Automaton 40
org/woehlke/computer/kurzweil/cyclic/cellular/automaton/view/CyclicCellularAutomatonFrame.java apps :: legacy :: Cyclic Cellular Automaton 41
rootPane.add(ctx.getPanelButtons());
        addWindowListener(this);
        ctx.getController().start();
        showMe();
    }

    public void showMe() {
        pack();
        this.setBounds(ctx.getConfig().getFrameBounds());
        setVisible(true);
        toFront();
    }

    public void windowOpened(WindowEvent e) {
        showMe();
    }

    public void windowClosing(WindowEvent e) {
        System.exit(0);
    }

    public void windowClosed(WindowEvent e) {
        System.exit(0);
    }

    public void windowIconified(WindowEvent e) { }

    public void windowDeiconified(WindowEvent e) {
        showMe();
    }

    public void windowActivated(WindowEvent e) {
        toFront();
    }

    public void windowDeactivated(WindowEvent e) {
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/view/PanelButtons.java apps :: legacy :: Mandelbrot 46
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/views/PanelButtons.java Computer Kurzweil :: App 46
this.zoomOut = new JButton(model.getConfig().getButtonsZoomOut());
        this.zoomOut.addActionListener(this);
        FlowLayout layout = new FlowLayout();
        this.setLayout(layout);
        this.add(buttonsLabel);
        this.add(radioButtonsSwitch);
        this.add(radioButtonsZoom);
        this.add(zoomOut);
    }

    /**
     * TODO write doc.
     */
    @Override
    public void actionPerformed(ActionEvent ae) {
        if (ae.getSource() == this.radioButtonsSwitch) {
            this.model.setModeSwitch();
        } else if(ae.getSource() == this.radioButtonsZoom) {
            this.model.setModeZoom();
        } else if(ae.getSource() == this.zoomOut){
            this.model.zoomOut();
            this.model.getFrame().getCanvas().repaint();
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 308
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 383
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 414
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 445
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 476
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 507
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 308
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 383
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 414
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 445
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 476
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 507
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 308
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 383
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 414
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 445
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 476
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 507
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 308
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 383
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 414
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 445
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 476
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 507
public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 182
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 258
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 290
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 322
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 354
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 386
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 418
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 208
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 284
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 316
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 348
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 380
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 412
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 444
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 421
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 560
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 625
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 690
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 755
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 820
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 885
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 182
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 258
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 290
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 322
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 354
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 386
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 418
public static class Cca {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {

            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;

            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
File Project Line
org/woehlke/computer/kurzweil/commons/widgets/PanelWithTitleBorder.java apps :: insourcing :: Simulated Evolution 17
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/PanelWithTitleBorder.java apps :: legacy :: Simulated Evolution 26
org/woehlke/computer/kurzweil/commons/widgets/PanelWithTitleBorder.java Computer Kurzweil :: App 17
private final FlowLayoutCenter panelStartStopButtonsLayout;
    private final CompoundBorder panelStartStopButtonsBorder;

    public PanelWithTitleBorder(String label, ComputerKurzweilProperties p) {
        panelStartStopButtonsLayout = new FlowLayoutCenter();
        int top = p.getAllinone().getView().getBorderPaddingY();
        int left = p.getAllinone().getView().getBorderPaddingX();
        int bottom = p.getAllinone().getView().getBorderPaddingY();
        int right = p.getAllinone().getView().getBorderPaddingX();
        panelStartStopButtonsBorder = BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(label),
            BorderFactory.createEmptyBorder(top,left,bottom,right)
        );
        this.setLayout(panelStartStopButtonsLayout);
        this.setBorder(panelStartStopButtonsBorder);
    }
}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/control/ControllerThread.java apps :: legacy :: Mandelbrot to Julia 26
org/woehlke/computer/kurzweil/mandelbrot/zoom/control/ControllerThread.java Mandelbrot Zoom 26
org/woehlke/computer/kurzweil/mandelbrot/control/ControllerThread.java apps :: legacy :: Mandelbrot 22
private volatile ApplicationModel applicationModel;
    private volatile ApplicationFrame frame;

    private final int THREAD_SLEEP_TIME = 1;

    private volatile Boolean goOn;

    public ControllerThread(ApplicationModel model, ApplicationFrame frame) {
        this.frame = frame;
        this.applicationModel = model;
        goOn = Boolean.TRUE;
    }

    public void run() {
        boolean doIt;
        do {
            synchronized (goOn) {
                doIt = goOn.booleanValue();
            }
            if(this.applicationModel.step()){
                frame.getCanvas().repaint();
            }
            try { sleep(THREAD_SLEEP_TIME); }
            catch (InterruptedException e) { }
        }
        while (doIt);
    }

    public void exit() {
        synchronized (goOn) {
            goOn = Boolean.FALSE;
        }
    }

}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 103
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Julia 111
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 110
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 103
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 103
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 103
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot to Julia 117
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 113
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 110
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 110
private synchronized ComplexNumber getComplexNumberFromLatticeCoordsForZoomedMandelbrot(Point turingPosition) {
        double realX = (
            ( complexCenterForMandelbrot.getReal() / this.getZoomLevel() )
            + getZoomCenter().getReal()
            + ( complexWorldDimensions.getReal() * turingPosition.getX() )
            / ( worldDimensions.getX() * this.getZoomLevel() )
        );
        double imgY = (
            ( complexCenterForMandelbrot.getImg() / this.getZoomLevel() )
            + getZoomCenter().getImg()
            + ( complexWorldDimensions.getImg() * turingPosition.getY() )
            / ( worldDimensions.getY() * this.getZoomLevel() )
        );
        return new ComplexNumber(realX,imgY);
    }
File Project Line
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/Mandelbrot2JuliaModel.java apps :: insourcing :: Mandelbrot :: Julia 38
org/woehlke/computer/kurzweil/mandelbrot/julia/model/ApplicationModel.java apps :: legacy :: Mandelbrot to Julia 42
this.applicationStateMachine = new Mandelbrot2JuliaStateMachine();
    }

    public synchronized boolean click(Point c) {
        applicationStateMachine.click();
        boolean repaint = true;
        switch (applicationStateMachine.getApplicationState()) {
            case MANDELBROT:
                mandelbrotTuringMachine.start();
                repaint = false;
                break;
            case JULIA_SET:
                gaussianNumberPlane.computeTheJuliaSetFor(c);
                break;
        }
        return repaint;
    }

    public synchronized boolean step() {
        boolean repaint = false;
        switch (applicationStateMachine.getApplicationState()) {
            case MANDELBROT:
                repaint = mandelbrotTuringMachine.step();
                break;
            case JULIA_SET:
                break;
        }
        return repaint;
    }

    public synchronized int getCellStatusFor(int x, int y) {
        return gaussianNumberPlane.getCellStatusFor(x, y);
    }

    public Point getWorldDimensions() {
        int width = properties.getAllinone().getLattice().getWidth();
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/garden/GardenOfEdenCheckBox.java apps :: insourcing :: Simulated Evolution 18
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/garden/GardenOfEdenCheckBox.java apps :: legacy :: Simulated Evolution 25
@ToString.Exclude
    private final SimulatedEvolutionContext tabCtx;
    private final String gardenOfEdenEnabledString;
    private final boolean gardenOfEdenEnabledSelected;

    public GardenOfEdenCheckBox(SimulatedEvolutionContext tabCtx) {
        super(
            tabCtx.getCtx().getProperties().getSimulatedevolution().getGardenOfEden().getGardenOfEdenEnabledString(),
            tabCtx.getCtx().getProperties().getSimulatedevolution().getGardenOfEden().getGardenOfEdenEnabled()
        );

        this.gardenOfEdenEnabledSelected = tabCtx.getCtx().getProperties().getSimulatedevolution().getGardenOfEden().getGardenOfEdenEnabled();
        this.gardenOfEdenEnabledString = tabCtx.getCtx().getProperties().getSimulatedevolution().getGardenOfEden().getGardenOfEdenEnabledString();
        this.tabCtx = tabCtx;
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 157
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 164
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 157
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 157
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 157
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot to Julia 173
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 151
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 164
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 164
public void zoomIntoTheMandelbrotSet(Point zoomPoint) {
        //log.info("zoomIntoTheMandelbrotSet: "+ zoomPoint +" - old:  "+this.getZoomCenter());
        this.inceaseZoomLevel();
        if(this.getZoomLevel() == 2){
            ComplexNumber complexCenter = new ComplexNumber(this.complexCenterForMandelbrot);
            complexCenterForZoomedMandelbrot.push(complexCenter);
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForMandelbrot(zoomPoint));
        } else {
            this.setZoomCenter(getComplexNumberFromLatticeCoordsForZoomedMandelbrot(zoomPoint));
        }
        complexCenterForZoomedMandelbrot.push(this.getZoomCenter());
        //log.info("zoomPoint:     "+ zoomPoint);
        //log.info("zoomCenterNew: " + this.getZoomCenter() + " - zoomLevel:  "+ this.getZoomLevel());
        for(int y = 0; y < worldDimensions.getY(); y++){
            for(int x = 0; x < worldDimensions.getX(); x++){
                Point p = new Point(x, y);
                this.isInZooomedMandelbrotSet(p);
            }
        }
    }
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 176
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 76
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 102
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 176
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 176
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 202
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 176
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 202
public static class Mandelbrot {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        ////@Validated
        @ToString
        public static class View {
            @NotBlank @Getter @Setter private String title;
            @NotBlank @Getter @Setter private String subtitle;
            @NotBlank @Getter @Setter private String buttonsZoom;
            @NotBlank @Getter @Setter private String buttonsZoomOut;
            @NotBlank @Getter @Setter private String buttonsSwitch;
            @NotBlank @Getter @Setter private String buttonsZoomLabel;
            @NotBlank @Getter @Setter private String buttonsLabel;
        }

        ////@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
        }
    }

    ////@Validated
    @ToString
    public static class MandelbrotZoom {
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Koch Snowflake 20
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Sierpinski Triangle 20
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Turmite 20
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: WaTor 20
public class GaussianNumberPlane implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    public final static int YET_UNCOMPUTED = -1;
    private final static double complexWorldDimensionRealX = 3.2d;
    private final static double complexWorldDimensionImgY = 2.34d;
    private final static double complexCenterForMandelbrotRealX = -2.2f;
    private final static double complexCenterForMandelbrotImgY = -1.17f;
    private final static double complexCenterForJuliaRealX = -1.6d;
    private final static double complexCenterForJuliaImgY =  -1.17d;
    private final Point worldDimensions;
    public volatile int zoomLevel;
    private volatile int[][] lattice;
    private volatile ComplexNumber complexNumberForJuliaSetC;
    private volatile ComplexNumber complexWorldDimensions;
    private volatile ComplexNumber complexCenterForMandelbrot;
    private volatile ComplexNumber complexCenterForJulia;
    private volatile Deque<ComplexNumber> complexCenterForZoomedMandelbrot = new ArrayDeque<>();

    private volatile ComplexNumber zoomCenter;


    //public static Logger log = Logger.getLogger(GaussianNumberPlane.class.getName());

    public GaussianNumberPlane(KochSnowflakeModel model) {
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Julia 20
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Zoom 20
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/GaussianNumberPlane.java apps :: legacy :: Mandelbrot 20
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java Computer Kurzweil :: App 20
public class GaussianNumberPlane implements Serializable {

    private static final long serialVersionUID = 7526471155622776147L;

    private volatile int[][] lattice;

    private volatile ComplexNumber complexNumberForJuliaSetC;

    private final Point worldDimensions;

    public final static int YET_UNCOMPUTED = -1;

    private final static double complexWorldDimensionRealX = 3.2d;
    private final static double complexWorldDimensionImgY = 2.34d;
    private final static double complexCenterForMandelbrotRealX = -2.2f;
    private final static double complexCenterForMandelbrotImgY = -1.17f;
    private final static double complexCenterForJuliaRealX = -1.6d;
    private final static double complexCenterForJuliaImgY =  -1.17d;

    private volatile ComplexNumber complexWorldDimensions;
    private volatile ComplexNumber complexCenterForMandelbrot;
    private volatile ComplexNumber complexCenterForJulia;

    public volatile int zoomLevel;

    private volatile Deque<ComplexNumber> complexCenterForZoomedMandelbrot = new ArrayDeque<>();

    private volatile ComplexNumber zoomCenter;

    //public static Logger log = Logger.getLogger(GaussianNumberPlane.class.getName());

    public GaussianNumberPlane(Mandelbrot2JuliaModel model) {
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java apps :: insourcing :: Simulated Evolution 63
org/woehlke/computer/kurzweil/commons/widgets/SubTabImpl.java apps :: insourcing :: Simulated Evolution 51
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilContext.java apps :: legacy :: Simulated Evolution 67
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/SubTabImpl.java apps :: legacy :: Simulated Evolution 66
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java Computer Kurzweil :: App 66
org/woehlke/computer/kurzweil/commons/widgets/SubTabImpl.java Computer Kurzweil :: App 51
);
    }

    private CompoundBorder getDoubleBorder(){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(left,right,top,bottom),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/GaussianNumberPlane.java apps :: insourcing :: Mandelbrot :: Julia 124
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/GaussianNumberPlane.java Mandelbrot Zoom 132
return new ComplexNumber(realX,imgY);
    }

    /*
    public synchronized boolean isInZooomedMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForZoomedMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }
*/

    public synchronized boolean isInMandelbrotSet(Point turingPosition) {
        ComplexNumber position = this.getComplexNumberFromLatticeCoordsForMandelbrot(turingPosition);
        lattice[turingPosition.getX()][turingPosition.getY()] = position.computeMandelbrotSet();
        return position.isInMandelbrotSet();
    }

    public synchronized void fillTheOutsideWithColors(){
        for(int y=0;y<worldDimensions.getY();y++){
            for(int x=0;x<worldDimensions.getX();x++){
                if(lattice[x][y] == YET_UNCOMPUTED){
                    this.isInMandelbrotSet(new Point(x, y));
                }
            }
        }
    }
File Project Line
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 503
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 563
public static class Kochsnowflake {

        @Valid
        public View view = new View();

        @Valid
        public Control control = new Control();

        //@Validated
        @ToString
        @Getter
        @Setter
        public static class View {

            @NotBlank
            private String title;

            @NotBlank
            private String subtitle;

            @Valid
            public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            @Getter
            @Setter
            public static class Neighborhood {

                @NotBlank
                private String title;

                @NotBlank
                private String typeVonNeumann;

                @NotBlank
                private String typeMoore;

                @NotBlank
                private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        @Getter
        @Setter
        public static class Control {

            @NotNull
            private Integer threadSleepTime;

            @NotNull
            private Integer numberOfParticles;
        }
    }

    @ToString
    @Getter
    @Setter
    public static class Samegame {
File Project Line
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 684
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 803
public static class Tetris {

        @Valid
        public View view = new View();

        @Valid
        public Control control = new Control();

        //@Validated
        @Getter
        @Setter
        @ToString
        public static class View {

            @NotBlank
            private String title;

            @NotBlank
            private String subtitle;

            @Valid
            public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @Getter
            @Setter
            @ToString
            public static class Neighborhood {
                @NotBlank
                private String title;

                @NotBlank
                private String typeVonNeumann;

                @NotBlank
                private String typeMoore;

                @NotBlank
                private String typeWoehlke;
            }
        }

        //@Validated
        @Getter
        @Setter
        @ToString
        public static class Control {

            @NotNull
            private Integer threadSleepTime;

            @NotNull
            private Integer numberOfParticles;
        }
    }

    @Getter
    @Setter
    @ToString
    public static class Turmite {
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/model/ApplicationModel.java apps :: legacy :: Mandelbrot to Julia 30
org/woehlke/computer/kurzweil/mandelbrot/model/ApplicationModel.java apps :: legacy :: Mandelbrot 25
private volatile GaussianNumberPlane gaussianNumberPlane;
    private volatile MandelbrotTuringMachine mandelbrotTuringMachine;
    private volatile ApplicationStateMachine applicationStateMachine;

    private volatile Config config;
    private volatile ApplicationFrame frame;

    public ApplicationModel(Config config, ApplicationFrame frame) {
        this.config = config;
        this.frame = frame;
        this.gaussianNumberPlane = new GaussianNumberPlane(this);
        this.mandelbrotTuringMachine = new MandelbrotTuringMachine(this);
        this.applicationStateMachine = new ApplicationStateMachine();
    }

    public synchronized boolean click(Point c) {
        applicationStateMachine.click();
        boolean repaint = true;
        switch (applicationStateMachine.getApplicationState()) {
            case MANDELBROT:
                mandelbrotTuringMachine.start();
                repaint = false;
                break;
            case JULIA_SET:
                gaussianNumberPlane.computeTheJuliaSetFor(c);
                break;
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 396
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 272
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 298
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 396
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 589
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 396
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 396
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 272
@ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Samegame {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 427
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 304
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 330
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 427
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 654
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 427
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 427
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 304
@ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Sierpinskitriangle {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 458
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 336
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 362
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 458
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 719
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 458
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 458
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 336
@ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Tetris {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 489
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 368
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 394
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 489
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 784
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 489
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 489
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 368
@ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Turmite {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 520
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 400
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 426
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 520
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 849
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 520
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 520
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 400
@ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Wator {

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public Neighborhood neighborhood = new Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 556
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Julia 432
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Mandelbrot :: Zoom 458
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 556
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 914
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 556
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 556
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java Computer Kurzweil :: App 432
@ToString
            public static class Neighborhood {
                @NotBlank @Getter @Setter private String title;
                @NotBlank @Getter @Setter private String typeVonNeumann;
                @NotBlank @Getter @Setter private String typeMoore;
                @NotBlank @Getter @Setter private String typeWoehlke;
            }
        }

        //@Validated
        @ToString
        public static class Control {
            @NotNull  @Getter @Setter private Integer threadSleepTime;
            @NotNull  @Getter @Setter private Integer numberOfParticles;
        }
    }

    @ToString
    public static class Gameoflive{

        @Valid @Getter @Setter public View view = new View();
        @Valid @Getter @Setter public Control control = new Control();

        //@Validated
        @ToString
        public static class View {
            @Valid @Getter @Setter public ComputerKurzweilProperties.Wator.View.Neighborhood neighborhood = new Wator.View.Neighborhood();
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/zoom/config/ConfigProperties.java Mandelbrot Zoom 18
org/woehlke/computer/kurzweil/mandelbrot/config/ConfigProperties.java apps :: legacy :: Mandelbrot 14
public interface ConfigProperties {

    String TITLE = "Mandelbrot Set";
    String SUBTITLE = "Mandelbrot Set drawn by a Turing Machine";
    String COPYRIGHT = "(c) 2019 Thomas Woehlke";
    String WIDTH="640";
    String HEIGHT="468";

    String BUTTONS_LABEL = "Choose Mode";
    String BUTTONS_SWITCH = "Mandelbrot Set <-> Julia Set";
    String BUTTONS_ZOOM = "Zoom";
    String BUTTONS_ZOOMOUT = "Zoom out";

    String APP_PROPERTIES_FILENAME ="src" + separator
        +"main" + separator + "resources" + separator  + "application.properties";

    String KEY = "org.woehlke.computer.kurzweil.mandelbrot.config.";

    String KEY_TITLE = KEY + "title";
    String KEY_SUBTITLE = KEY + "subtitle";
    String KEY_COPYRIGHT = KEY + "copyright";
    String KEY_WIDTH = KEY + "width";
    String KEY_HEIGHT = KEY + "height";

    String KEY_BUTTONS_LABEL = KEY + "buttons.label";
    String KEY_BUTTONS_SWITCH = KEY + "buttons.switch";
    String KEY_BUTTONS_ZOOM = KEY + "buttons.zoom";
    String KEY_BUTTONS_ZOOMOUT = KEY + "buttons.zoomout";
}
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java apps :: insourcing :: Simulated Evolution 66
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java apps :: insourcing :: Simulated Evolution 77
org/woehlke/computer/kurzweil/commons/widgets/SubTabImpl.java apps :: insourcing :: Simulated Evolution 54
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilContext.java apps :: legacy :: Simulated Evolution 70
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilContext.java apps :: legacy :: Simulated Evolution 81
org/woehlke/computer/kurzweil/simulated/evolution/view/widgets/SubTabImpl.java apps :: legacy :: Simulated Evolution 69
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java Computer Kurzweil :: App 69
org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java Computer Kurzweil :: App 80
org/woehlke/computer/kurzweil/commons/widgets/SubTabImpl.java Computer Kurzweil :: App 54
private CompoundBorder getDoubleBorder(){
        int left = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int right = this.getProperties().getAllinone().getView().getBorderPaddingX();
        int top = this.getProperties().getAllinone().getView().getBorderPaddingY();
        int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY();
        return BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(left,right,top,bottom),
            BorderFactory.createEmptyBorder(left,right,top,bottom)
        );
    }
File Project Line
org/woehlke/computer/kurzweil/tabs/dla/control/ControllerThread.java apps :: insourcing :: Diffusion Limited Aggregation 23
org/woehlke/computer/kurzweil/dla/control/ControllerThread.java apps :: legacy :: Diffusion Limited Aggregation 24
private Particles particles;
    private WorldCanvas canvas;

    private Boolean goOn;

    public ControllerThread(WorldCanvas canvas, Particles particles) {
        goOn = Boolean.TRUE;
        this.canvas=canvas;
        this.particles=particles;
    }

    public void run() {
        boolean doIt;
        do {
            synchronized (goOn) {
                doIt = goOn.booleanValue();
            }
            particles.move();
            canvas.repaint();
            try { sleep(THREAD_SLEEP_TIME); }
            catch (InterruptedException e) { e.printStackTrace(); }
        }
        while (doIt);
    }

    public void exit() {
        synchronized (goOn) {
            goOn = Boolean.FALSE;
        }
    }


}
File Project Line
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Koch Snowflake 27
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Mandelbrot :: Julia 33
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Mandelbrot :: Zoom 33
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Sierpinski Triangle 27
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: Turmite 27
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java apps :: insourcing :: WaTor 27
org/woehlke/computer/kurzweil/mandelbrot/julia/model/fractal/ComplexNumber.java apps :: legacy :: Mandelbrot to Julia 34
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/fractal/ComplexNumber.java Mandelbrot Zoom 34
org/woehlke/computer/kurzweil/mandelbrot/model/fractal/ComplexNumber.java apps :: legacy :: Mandelbrot 33
org/woehlke/computer/kurzweil/commons/model/fractal/ComplexNumber.java Computer Kurzweil :: App 34
public ComplexNumber() {
        this.real = 0.0d;
        this.img = 0.0d;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public ComplexNumber(ComplexNumber complexNumber) {
        this.real = complexNumber.real;
        this.img = complexNumber.img;
        this.iterations=complexNumber.iterations;
        this.inMandelbrotSet=complexNumber.inMandelbrotSet;
        this.inJuliaSet=complexNumber.inJuliaSet;
    }

    public ComplexNumber(double real, double img) {
        this.real = real;
        this.img = img;
        this.iterations=0;
        this.inMandelbrotSet=false;
        this.inJuliaSet=false;
    }

    public double getReal() {
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/canvas/population/PopulationStatisticsElement.java apps :: insourcing :: Simulated Evolution 25
org/woehlke/computer/kurzweil/simulated/evolution/view/canvas/population/PopulationStatisticsElement.java apps :: legacy :: Simulated Evolution 31
org/woehlke/computer/kurzweil/tabs/simulatedevolution/views/population/PopulationStatisticsElement.java Computer Kurzweil :: App 24
public PopulationStatisticsElement(String label, LifeCycleStatus lifeCycleStatus) {
        this.label = new JLabel(label);
        this.lifeCycleStatus = lifeCycleStatus;
        this.statistics = new JTextField(defaultTextField,cols);
        this.add(this.label);
        this.add(this.statistics);
        statistics.setBackground(this.lifeCycleStatus.getColorBackground());
        statistics.setForeground(this.lifeCycleStatus.getColorForeground());
    }

    public void setText(int value){
        this.statistics.setText(""+value);
    }

    public void setText(long value){
        this.statistics.setText(""+value);
    }
}
File Project Line
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 684
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 803
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 862
public static class Tetris {

        @Valid
        public View view = new View();

        @Valid
        public Control control = new Control();

        //@Validated
        @Getter
        @Setter
        @ToString
        public static class View {

            @NotBlank
            private String title;

            @NotBlank
            private String subtitle;

            @Valid
            public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @Getter
            @Setter
            @ToString
            public static class Neighborhood {
                @NotBlank
                private String title;

                @NotBlank
                private String typeVonNeumann;

                @NotBlank
                private String typeMoore;

                @NotBlank
                private String typeWoehlke;
            }
        }

        //@Validated
        @Getter
        @Setter
        @ToString
        public static class Control {

            @NotNull
            private Integer threadSleepTime;

            @NotNull
            private Integer numberOfParticles;
        }
    }
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/SimulatedEvolutionController.java apps :: insourcing :: Simulated Evolution 27
org/woehlke/computer/kurzweil/simulated/evolution/control/SimulatedEvolutionController.java apps :: legacy :: Simulated Evolution 31
@Setter
    private SimulatedEvolutionModel simulatedEvolutionModel;

    /**
     * Canvas, where to paint in the GUI.
     */
    @Setter
    private SimulatedEvolutionCanvas canvas;

    /**
     * Time to Wait in ms.
     */
    private final int TIME_TO_WAIT = 100;

    /**
     * Control for Threading
     */
    private Boolean mySemaphore;

    public SimulatedEvolutionController() {
        mySemaphore = Boolean.TRUE;
    }

    public void run() {
        boolean doMyJob;
        do {
            synchronized (mySemaphore) {
                doMyJob = mySemaphore.booleanValue();
            }
            simulatedEvolutionModel.letLivePopulation();
            canvas.repaint();
            try {
                sleep(TIME_TO_WAIT);
            }
            catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        while (doMyJob);
    }

    public void exit() {
        synchronized (mySemaphore) {
            mySemaphore = Boolean.FALSE;
        }
    }
}
File Project Line
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Koch Snowflake 34
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Mandelbrot :: Julia 34
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Mandelbrot :: Zoom 34
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Sierpinski Triangle 34
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: Turmite 34
org/woehlke/computer/kurzweil/commons/model/turing/MandelbrotTuringPositions.java apps :: insourcing :: WaTor 34
org/woehlke/computer/kurzweil/mandelbrot/julia/model/turing/TuringPositions.java apps :: legacy :: Mandelbrot to Julia 37
org/woehlke/computer/kurzweil/mandelbrot/zoom/model/turing/TuringPositions.java Mandelbrot Zoom 37
org/woehlke/computer/kurzweil/mandelbrot/model/turing/TuringPositions.java apps :: legacy :: Mandelbrot 36
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/model/turing/TuringPositions.java Computer Kurzweil :: App 34
this.turingDirection = MandelbrotTuringDirection.LEFT;
    }

    public synchronized void markFirstSetPosition(){
        this.firstSetPosition = turingPosition;
        this.steps = 0;
    }

    public synchronized Point getTuringPosition() {
        return turingPosition;
    }

    public synchronized void goForward() {
        this.steps++;
        switch (this.turingDirection){
            case UP:
                this.turingPosition.moveUp();
                break;
            case RIGHT:
                this.turingPosition.moveRight();
                break;
            case DOWN:
                this.turingPosition.moveDown();
                break;
            case LEFT:
                this.turingPosition.moveLeft();
                break;
            default:
                break;
        }
    }

    public synchronized void turnRight() {
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/config/Config.java apps :: legacy :: Mandelbrot to Julia 28
org/woehlke/computer/kurzweil/mandelbrot/zoom/config/Config.java Mandelbrot Zoom 35
org/woehlke/computer/kurzweil/mandelbrot/config/Config.java apps :: legacy :: Mandelbrot 34
public Config() {
        String appPropertiesFile = (APP_PROPERTIES_FILENAME);
        Properties prop = new Properties();
        try (
            InputStream input = new FileInputStream(appPropertiesFile)) {
            prop.load(input);
            /*
            for( Object key : prop.keySet()){
                System.out.println(prop.get(key).toString());
            }
            */
            title = prop.getProperty(KEY_TITLE,TITLE);
            subtitle = prop.getProperty(KEY_SUBTITLE,SUBTITLE);
            copyright = prop.getProperty(KEY_COPYRIGHT,COPYRIGHT);
            String widthString = prop.getProperty(KEY_WIDTH,WIDTH);
            String heightString = prop.getProperty(KEY_HEIGHT,HEIGHT);
            width = Integer.parseInt(widthString);
            height = Integer.parseInt(heightString);
File Project Line
org/woehlke/computer/kurzweil/tabs/kochsnowflake/KochSnowflakeController.java apps :: insourcing :: Koch Snowflake 22
org/woehlke/computer/kurzweil/tabs/mandelbrot2julia/Mandelbrot2JuliaController.java apps :: insourcing :: Mandelbrot :: Julia 26
org/woehlke/computer/kurzweil/tabs/mandelbrotzoom/MandelbrotZoomController.java apps :: insourcing :: Mandelbrot :: Zoom 26
org/woehlke/computer/kurzweil/tabs/sierpinskitriangle/SierpinskiTriangleController.java apps :: insourcing :: Sierpinski Triangle 27
org/woehlke/computer/kurzweil/tabs/turmite/TurmiteController.java apps :: insourcing :: Turmite 25
org/woehlke/computer/kurzweil/tabs/wator/WatorController.java apps :: insourcing :: WaTor 25
public KochSnowflakeController(KochSnowflakeModel model, KochSnowflakeTab frame) {
        this.frame = frame;
        this.mandelbrotModel = model;
        goOn = Boolean.TRUE;
    }

    public void run() {
        boolean doIt;
        do {
            synchronized (goOn) {
                doIt = goOn.booleanValue();
            }
            if(this.mandelbrotModel.step()){
                frame.getCanvas().repaint();
            }
            try { sleep(THREAD_SLEEP_TIME); }
            catch (InterruptedException e) { }
        }
        while (doIt);
    }

    public void exit() {
        synchronized (goOn) {
            goOn = Boolean.FALSE;
        }
    }

}
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/julia/config/Config.java apps :: legacy :: Mandelbrot to Julia 69
org/woehlke/computer/kurzweil/mandelbrot/zoom/config/Config.java Mandelbrot Zoom 96
org/woehlke/computer/kurzweil/mandelbrot/config/Config.java apps :: legacy :: Mandelbrot 95
}

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Config)) return false;
        Config config = (Config) o;
        return getWidth() == config.getWidth() &&
            getHeight() == config.getHeight() &&
            Objects.equals(getTitle(), config.getTitle()) &&
            Objects.equals(getSubtitle(), config.getSubtitle()) &&
            Objects.equals(getCopyright(), config.getCopyright());
File Project Line
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Koch Snowflake 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Sierpinski Triangle 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Simulated Evolution 1014
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: Turmite 45
org/woehlke/computer/kurzweil/application/ComputerKurzweilProperties.java apps :: insourcing :: WaTor 45
public static ComputerKurzweilProperties propertiesFactory(File conf){
        log.info("propertiesFactory");
        log.info("propertiesFactory conf: "+conf.getAbsolutePath());
        ComputerKurzweilProperties properties;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            InputStream input = new FileInputStream(conf);
            properties = mapper.readValue(input, ComputerKurzweilProperties.class);
            log.info(properties.toString());
        } catch (Exception e) {
            e.printStackTrace();
            properties = new ComputerKurzweilProperties();
        }
        log.info("propertiesFactory done");
        return properties;
    }

    public static ComputerKurzweilProperties propertiesFactory(String conf, String jar){
File Project Line
org/woehlke/computer/kurzweil/tabs/simulatedevolution/model/LifeCycleStatus.java apps :: insourcing :: Simulated Evolution 24
org/woehlke/computer/kurzweil/simulated/evolution/model/cell/LifeCycleStatus.java apps :: legacy :: Simulated Evolution 28
@Getter
@ToString
public enum LifeCycleStatus {

    YOUNG(BLUE, WHITE),
    YOUNG_AND_FAT(YELLOW, BLACK),
    FULL_AGE(RED, BLACK),
    HUNGRY(LIGHT_GRAY, WHITE),
    OLD(DARK_GRAY, BLACK),
    DEAD(BLACK, BLACK),
    POPULATION(WHITE, BLACK);

    private Color color;
    private Color colorFont;

    LifeCycleStatus(Color color, Color colorFont){
        this.color=color;
        this.colorFont = colorFont;
    }

    public Color getColorForeground() {
        return colorFont;
    }
    public Color getColorBackground() {
        return color;
    }
}
File Project Line
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 371
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 503
org/woehlke/computer/kurzweil/simulated/evolution/config/ComputerKurzweilProperties.java apps :: legacy :: Simulated Evolution 563
public static class Cca {

        @Valid
        public View view = new View();

        @Valid
        public Control control = new Control();

        //@Validated
        @ToString
        @Getter
        @Setter
        public static class View {

            @NotBlank
            private String title;

            @NotBlank
            private String subtitle;

            @Valid
            public Neighborhood neighborhood = new Neighborhood();

            //@Validated
            @ToString
            @Getter
            @Setter
            public static class Neighborhood {

                @NotBlank
                private String title;

                @NotBlank
                private String typeVonNeumann;

                @NotBlank
                private String typeMoore;

                @NotBlank
                private String typeWoehlke;
            }
        }

        ////@Validated
        @ToString
        @Getter
        @Setter
        public static class Control {

            @NotNull
            private Integer threadSleepTime;
File Project Line
org/woehlke/computer/kurzweil/tabs/dla/model/Point.java apps :: insourcing :: Diffusion Limited Aggregation 28
org/woehlke/computer/kurzweil/tabs/simulatedevolution/model/WorldPoint.java apps :: insourcing :: Simulated Evolution 40
org/woehlke/computer/kurzweil/dla/model/Point.java apps :: legacy :: Diffusion Limited Aggregation 29
org/woehlke/computer/kurzweil/simulated/evolution/model/world/WorldPoint.java apps :: legacy :: Simulated Evolution 44
public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void killNagative() {
        if (y < 0) {
            y *= -1;
        }
        if (x < 0) {
            x *= -1;
        }
    }

    public void add(Point p) {
File Project Line
org/woehlke/computer/kurzweil/mandelbrot/zoom/view/ApplicationFrame.java Mandelbrot Zoom 49
org/woehlke/computer/kurzweil/mandelbrot/view/ApplicationFrame.java apps :: legacy :: Mandelbrot 31
private volatile ControllerThread controllerThread;
    private volatile ApplicationCanvas canvas;
    private volatile ApplicationModel applicationModel;

    private volatile Rectangle rectangleBounds;
    private volatile Dimension dimensionSize;

    public ApplicationFrame(Config config) {
        super(config.getTitle());
        this.applicationModel = new ApplicationModel(config,this);
        BoxLayout layout = new BoxLayout(rootPane, BoxLayout.PAGE_AXIS);
        this.canvas = new ApplicationCanvas(applicationModel);
        this.controllerThread = new ControllerThread(applicationModel, this);
        PanelButtons panelButtons = new PanelButtons(this.applicationModel);
        PanelSubtitle panelSubtitle = new PanelSubtitle(config.getSubtitle());