diff options
Diffstat (limited to 'Week15 Mandelbrot')
5 files changed, 60 insertions, 12 deletions
diff --git a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/DrawView.java b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/DrawView.java index 16500f5..4d73434 100644 --- a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/DrawView.java +++ b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/DrawView.java @@ -7,7 +7,6 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java index 184913d..106c967 100644 --- a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java +++ b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/FractalModel.java @@ -20,12 +20,12 @@ public class FractalModel extends Observable { end_y = 1; } - public int getMandelNumber(Fractal.Point p, int repetitions) { - return Fractal.mandelNumber(p, repetitions); + public int getMandelNumber(MandelbrotFractal.Point p, int repetitions) { + return MandelbrotFractal.mandelNumber(p, repetitions); } public int getMandelNumber(double x, double y, int repetitions) { - return Fractal.mandelNumber(x, y, repetitions); + return MandelbrotFractal.mandelNumber(x, y, repetitions); } public double getStartX() { diff --git a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotController.java b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotController.java index 9233cc8..adca194 100644 --- a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotController.java +++ b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotController.java @@ -8,10 +8,10 @@ package com.camilstaps.mandelbrot; * @author camilstaps */ public class MandelbrotController { + + private final MandelbrotFractal fractal; - private final Fractal fractal; - - public MandelbrotController(Fractal fractal) { + public MandelbrotController(MandelbrotFractal fractal) { this.fractal = fractal; } diff --git a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotFractal.java b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotFractal.java index 72c3d7a..e0c0520 100644 --- a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotFractal.java +++ b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotFractal.java @@ -1,5 +1,25 @@ /* - * Copyright (c) 2015 Camil Staps + * The MIT License (MIT) + * + * Copyright (c) 2015 Camil Staps <info@camilstaps.nl> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ package com.camilstaps.mandelbrot; @@ -7,11 +27,16 @@ import java.util.HashMap; import java.util.Map; /** - * - * @author camilstaps + * Class for calculating Mandelbrot numbers + * By remembering seen numbers, we can significantly decrease calculation time + * + * @author Camil Staps */ public class MandelbrotFractal { + /** + * Storage for previously calculated numbers + */ private static final Map<Point,Result> mandelNumbers = new HashMap<>(); public static int mandelNumber(double x, double y, int repetitions) { diff --git a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java index 163dca9..74ef8fc 100644 --- a/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java +++ b/Week15 Mandelbrot/src/com/camilstaps/mandelbrot/MandelbrotWindow.java @@ -1,5 +1,29 @@ /* +<<<<<<< HEAD + * The MIT License (MIT) + * + * Copyright (c) 2015 Camil Staps <info@camilstaps.nl> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. +======= * Copyright (c) 2015 Camil Staps +>>>>>>> 85751141b5705dba503b507ab34cc4ee734a9e6a */ package com.camilstaps.mandelbrot; @@ -7,8 +31,8 @@ import javax.swing.JButton; import javax.swing.JTextField; /** - * - * @author camilstaps + * Solutions to week 15 + * @author Camil Staps */ public class MandelbrotWindow { |