diff options
Diffstat (limited to 'Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java')
-rw-r--r-- | Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java index 106c967..03a8908 100644 --- a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java +++ b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java @@ -44,23 +44,52 @@ public class FractalModel extends Observable { return end_y; } - public void setStartX(double x) { + public synchronized void setBorders(double start_x, double end_x, double start_y, double end_y) { + if (start_x == this.start_x && end_x == this.end_x && start_y == this.start_y && end_y == this.end_y) + return; + + this.start_x = start_x; + this.end_x = end_x; + this.start_y = start_y; + this.end_y = end_y; + + setChanged(); + notifyObservers(); + } + + public synchronized void setStartX(double x) { + if (start_x == x) + return; + start_x = x; + setChanged(); notifyObservers(); } - public void setStartY(double y) { + public synchronized void setStartY(double y) { + if (start_y == y) + return; + start_y = y; + setChanged(); notifyObservers(); } - public void setEndX(double x) { + public synchronized void setEndX(double x) { + if (end_x == x) + return; + end_x = x; + setChanged(); notifyObservers(); } - public void setEndY(double y) { + public synchronized void setEndY(double y) { + if (end_y == y) + return; + end_y = y; + setChanged(); notifyObservers(); } |