Skip to content

Commit

Permalink
Issue #48 Split Mandelbrot-Tab into Mandelbrot-Julia and Mandelbrot-Zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaswoehlke committed Oct 11, 2020
1 parent ec6edfa commit b0dfd0f
Show file tree
Hide file tree
Showing 27 changed files with 153 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.woehlke.computer.kurzweil.application.ComputerKurzweilProperties;
import org.woehlke.computer.kurzweil.commons.model.fractal.GaussianNumberPlane;
import org.woehlke.computer.kurzweil.commons.model.turing.Point;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.state.TabStateMachine;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.MandelbrotZoomTabStateMachine;
import org.woehlke.computer.kurzweil.commons.model.turing.MandelbrotTuringMachine;

/**
Expand All @@ -21,7 +21,7 @@ public class MandelbrotZoomModel {

private volatile GaussianNumberPlane gaussianNumberPlane;
private volatile MandelbrotTuringMachine mandelbrotTuringMachine;
private volatile TabStateMachine applicationStateMachine;
private volatile MandelbrotZoomTabStateMachine applicationStateMachine;

private volatile ComputerKurzweilProperties properties;
private volatile MandelbrotZoomTab frame;
Expand All @@ -31,7 +31,7 @@ public MandelbrotZoomModel(ComputerKurzweilProperties properties, MandelbrotZoom
this.frame = frame;
this.gaussianNumberPlane = new GaussianNumberPlane(this);
this.mandelbrotTuringMachine = new MandelbrotTuringMachine(this);
this.applicationStateMachine = new TabStateMachine();
this.applicationStateMachine = new MandelbrotZoomTabStateMachine();
}

public synchronized boolean click(Point c) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom;

import org.woehlke.computer.kurzweil.application.ComputerKurzweilProperties;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.PanelButtons;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.PanelCopyright;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.PanelSubtitle;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui.PanelButtons;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui.PanelCopyright;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui.PanelSubtitle;
import org.woehlke.computer.kurzweil.commons.model.turing.Point;

import javax.accessibility.Accessible;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.state;
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model;

/**
* Mandelbrot Set drawn by a Turing Machine.
Expand All @@ -9,7 +9,7 @@
*
* Created by tw on 23.08.15.
*/
public enum TabState {
public enum MandelbrotZoomTabState {
MANDELBROT,
JULIA_SET,
MANDELBROT_ZOOM,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.state;
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model;

import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.state.TabState.*;
import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.state.TabState.JULIA_SET_ZOOM;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.MandelbrotZoomTabState;

import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.MandelbrotZoomTabState.*;
import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.MandelbrotZoomTabState.JULIA_SET_ZOOM;

/**
* Mandelbrot Set drawn by a Turing Machine.
Expand All @@ -12,16 +14,16 @@
*
* Created by tw on 16.12.2019.
*/
public class TabStateMachine {
public class MandelbrotZoomTabStateMachine {

private volatile TabState applicationState;
private volatile MandelbrotZoomTabState applicationState;

public TabStateMachine() {
this.applicationState = TabState.MANDELBROT;
public MandelbrotZoomTabStateMachine() {
this.applicationState = MandelbrotZoomTabState.MANDELBROT;
}

public void click(){
TabState nextApplicationState = null;
MandelbrotZoomTabState nextApplicationState = null;
switch (applicationState){
case MANDELBROT:
nextApplicationState = JULIA_SET;
Expand All @@ -40,7 +42,7 @@ public void click(){
}

public void setModeSwitch() {
TabState nextApplicationState = this.applicationState;
MandelbrotZoomTabState nextApplicationState = this.applicationState;
switch (applicationState){
case MANDELBROT:
case JULIA_SET:
Expand All @@ -56,7 +58,7 @@ public void setModeSwitch() {
}

public void setModeZoom() {
TabState nextApplicationState = this.applicationState;
MandelbrotZoomTabState nextApplicationState = this.applicationState;
switch (applicationState){
case MANDELBROT:
nextApplicationState = MANDELBROT_ZOOM;
Expand All @@ -71,11 +73,11 @@ public void setModeZoom() {
this.setApplicationState(nextApplicationState);
}

public TabState getApplicationState() {
public MandelbrotZoomTabState getApplicationState() {
return applicationState;
}

public void setApplicationState(TabState applicationState) {
public void setApplicationState(MandelbrotZoomTabState applicationState) {
this.applicationState = applicationState;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui;

import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.MandelbrotZoomModel;

Expand All @@ -7,8 +7,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.RradioButtons.RADIO_BUTTONS_SWITCH;
import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.RradioButtons.RADIO_BUTTONS_ZOOM;
import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui.RradioButtons.RADIO_BUTTONS_SWITCH;
import static org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui.RradioButtons.RADIO_BUTTONS_ZOOM;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui;

import javax.swing.*;
import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui;

import javax.swing.*;
import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.ui;

/**
* Mandelbrot Set drawn by a Turing Machine.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.woehlke.computer.kurzweil;

import org.woehlke.computer.kurzweil.application.ComputerKurzweilProperties;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.MandelbrotTab;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.Mandelbrot2JuliaTab;

import java.io.File;
import java.net.URL;
Expand All @@ -20,7 +20,7 @@ private Mandelbrot2JuliaApplication() {
URL fileUrl = getClass().getResource(configFileName);
File configFile = new File(fileUrl.getFile());
ComputerKurzweilProperties properties = ComputerKurzweilProperties.propertiesFactory(configFile);
MandelbrotTab frame = new MandelbrotTab(properties);
Mandelbrot2JuliaTab frame = new Mandelbrot2JuliaTab(properties);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.woehlke.computer.kurzweil.commons.model.fractal;

import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.MandelbrotModel;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.turing.Point;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.Mandelbrot2JuliaModel;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.model.turing.Point;

import java.util.ArrayDeque;
import java.util.Deque;
Expand Down Expand Up @@ -45,7 +45,7 @@ public class GaussianNumberPlane {

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

public GaussianNumberPlane(MandelbrotModel model) {
public GaussianNumberPlane(Mandelbrot2JuliaModel model) {
this.worldDimensions = model.getWorldDimensions();
this.lattice = new int[worldDimensions.getWidth()][worldDimensions.getHeight()];
this.complexWorldDimensions = new ComplexNumber(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* Date: 05.02.2006
* Time: 00:51:51
*/
public class MandelbrotCanvas extends JComponent {
public class Mandelbrot2JuliaCanvas extends JComponent {

private volatile MandelbrotModel app;
private volatile Mandelbrot2JuliaModel app;
private volatile Dimension preferredSize;

public MandelbrotCanvas(MandelbrotModel app) {
public Mandelbrot2JuliaCanvas(Mandelbrot2JuliaModel app) {
this.app = app;
int width = this.app.getWorldDimensions().getWidth();
int height = this.app.getWorldDimensions().getHeight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
* Date: 05.02.2006
* Time: 00:36:20
*/
public class MandelbrotController extends Thread implements Runnable {
public class Mandelbrot2JuliaController extends Thread implements Runnable {

private volatile MandelbrotModel mandelbrotModel;
private volatile MandelbrotTab frame;
private volatile Mandelbrot2JuliaModel mandelbrotModel;
private volatile Mandelbrot2JuliaTab frame;

private final int THREAD_SLEEP_TIME = 1;

private volatile Boolean goOn;

public MandelbrotController(MandelbrotModel model, MandelbrotTab frame) {
public Mandelbrot2JuliaController(Mandelbrot2JuliaModel model, Mandelbrot2JuliaTab frame) {
this.frame = frame;
this.mandelbrotModel = model;
goOn = Boolean.TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import lombok.Getter;
import org.woehlke.computer.kurzweil.application.ComputerKurzweilProperties;
import org.woehlke.computer.kurzweil.commons.model.fractal.GaussianNumberPlane;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.turing.Point;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.state.ApplicationStateMachine;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.turing.MandelbrotTuringMachine;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.model.turing.Point;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.model.Mandelbrot2JuliaStateMachine;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.model.turing.Mandelbrot2JuliaTuringMachine;

/**
* Mandelbrot Set drawn by a Turing Machine.
Expand All @@ -17,21 +17,21 @@
* Created by tw on 16.12.2019.
*/
@Getter
public class MandelbrotModel {
public class Mandelbrot2JuliaModel {

private volatile GaussianNumberPlane gaussianNumberPlane;
private volatile MandelbrotTuringMachine mandelbrotTuringMachine;
private volatile ApplicationStateMachine applicationStateMachine;
private volatile Mandelbrot2JuliaTuringMachine mandelbrotTuringMachine;
private volatile Mandelbrot2JuliaStateMachine applicationStateMachine;

private volatile ComputerKurzweilProperties properties;
private volatile MandelbrotTab frame;
private volatile Mandelbrot2JuliaTab frame;

public MandelbrotModel(ComputerKurzweilProperties properties, MandelbrotTab frame) {
public Mandelbrot2JuliaModel(ComputerKurzweilProperties properties, Mandelbrot2JuliaTab frame) {
this.properties = properties;
this.frame = frame;
this.gaussianNumberPlane = new GaussianNumberPlane(this);
this.mandelbrotTuringMachine = new MandelbrotTuringMachine(this);
this.applicationStateMachine = new ApplicationStateMachine();
this.mandelbrotTuringMachine = new Mandelbrot2JuliaTuringMachine(this);
this.applicationStateMachine = new Mandelbrot2JuliaStateMachine();
}

public synchronized boolean click(Point c) {
Expand Down Expand Up @@ -80,7 +80,7 @@ public GaussianNumberPlane getGaussianNumberPlane() {
return gaussianNumberPlane;
}

public MandelbrotTab getFrame() {
public Mandelbrot2JuliaTab getFrame() {
return frame;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrot2julia;

import org.woehlke.computer.kurzweil.application.ComputerKurzweilProperties;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.PanelCopyright;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas.PanelSubtitle;
import org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.turing.Point;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.canvas.PanelCopyright;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.canvas.PanelSubtitle;
import org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.model.turing.Point;

import javax.accessibility.Accessible;
import javax.swing.*;
Expand All @@ -19,25 +19,25 @@
* Date: 04.02.2006
* Time: 18:47:46
*/
public class MandelbrotTab extends JFrame implements ImageObserver,
public class Mandelbrot2JuliaTab extends JFrame implements ImageObserver,
MenuContainer,
Serializable,
Accessible,
WindowListener,
MouseListener {

private volatile MandelbrotController mandelbrotController;
private volatile MandelbrotCanvas canvas;
private volatile MandelbrotModel mandelbrotModel;
private volatile Mandelbrot2JuliaController mandelbrotController;
private volatile Mandelbrot2JuliaCanvas canvas;
private volatile Mandelbrot2JuliaModel mandelbrotModel;
private volatile Rectangle rectangleBounds;
private volatile Dimension dimensionSize;

public MandelbrotTab(ComputerKurzweilProperties properties) {
public Mandelbrot2JuliaTab(ComputerKurzweilProperties properties) {
super(properties.getMandelbrot().getView().getTitle());
this.mandelbrotModel = new MandelbrotModel(properties,this);
this.mandelbrotModel = new Mandelbrot2JuliaModel(properties,this);
BoxLayout layout = new BoxLayout(rootPane, BoxLayout.PAGE_AXIS);
this.canvas = new MandelbrotCanvas(mandelbrotModel);
this.mandelbrotController = new MandelbrotController(mandelbrotModel, this);
this.canvas = new Mandelbrot2JuliaCanvas(mandelbrotModel);
this.mandelbrotController = new Mandelbrot2JuliaController(mandelbrotModel, this);
PanelSubtitle panelSubtitle = new PanelSubtitle(properties.getMandelbrot().getView().getSubtitle());
PanelCopyright panelCopyright = new PanelCopyright(properties.getAllinone().getView().getCopyright());
JSeparator separator = new JSeparator();
Expand Down Expand Up @@ -138,7 +138,7 @@ public void setModeZoom() {
canvas.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
*/
public MandelbrotCanvas getCanvas() {
public Mandelbrot2JuliaCanvas getCanvas() {
return canvas;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
package org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.canvas;

import javax.swing.*;
import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
package org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.canvas;

import javax.swing.*;
import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.canvas;
package org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.canvas;

/**
* Mandelbrot Set drawn by a Turing Machine.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.woehlke.computer.kurzweil.tabs.mandelbrotzoom.model.state;
package org.woehlke.computer.kurzweil.tabs.mandelbrot2julia.model;

/**
* Mandelbrot Set drawn by a Turing Machine.
Expand All @@ -9,7 +9,7 @@
*
* Created by tw on 23.08.15.
*/
public enum ApplicationState {
public enum Mandelbrot2JuliaState {
MANDELBROT,
JULIA_SET
}
Loading

0 comments on commit b0dfd0f

Please sign in to comment.