diff options
author | Camil Staps | 2015-06-05 15:57:28 +0200 |
---|---|---|
committer | Camil Staps | 2015-06-05 15:57:28 +0200 |
commit | 614c03cc1b8eb508d6ed3c698dfa3bc3a6936ca9 (patch) | |
tree | 81e34734c883868426f90a8f110d51b2c9b7bee6 /Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java | |
parent | Option for multiple (4) or single swingworker(s) (diff) |
Cleanup; javadoc
Diffstat (limited to 'Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java')
-rw-r--r-- | Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java index dd09100..4c2499d 100644 --- a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java +++ b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java @@ -26,28 +26,34 @@ package com.camilstaps.mandelbrot; import java.util.Observable; /** - * - * @author camilstaps + * The FractalModel holds the bounds of the shown fractal + * @author Camil Staps */ public class FractalModel extends Observable { - private double start_x, start_y, end_x, end_y; + private double start_x = -1, end_x = 1, start_y = -1, end_y = 1; - public FractalModel() { - start_x = -1; - end_x = 1; - start_y = -1; - end_y = 1; + /** + * Get the Mandelbrot number for a specific point up to some maximum + * @param x the x coordinate of the point + * @param y the y coordinate of the point + * @param repetitions the maximum + * @return the mandelbrot number + */ + public int getMandelNumber(double x, double y, int repetitions) { + return MandelbrotFractal.mandelNumber(x, y, repetitions); } + /** + * Get the Mandelbrot number for a specific point up to some maximum + * @param p the point + * @param repetitions the maximum + * @return the mandelbrot number + */ public int getMandelNumber(MandelbrotFractal.Point p, int repetitions) { return MandelbrotFractal.mandelNumber(p, repetitions); } - public int getMandelNumber(double x, double y, int repetitions) { - return MandelbrotFractal.mandelNumber(x, y, repetitions); - } - public double getStartX() { return start_x; } @@ -64,7 +70,14 @@ public class FractalModel extends Observable { return end_y; } - public synchronized void setBorders(double start_x, double end_x, double start_y, double end_y) { + /** + * Set all bounds together + * @param start_x + * @param end_x + * @param start_y + * @param end_y + */ + public synchronized void setBounds(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; |