From bd83b176f508492a46cc4f76998721c30a22d291 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 15 Apr 2018 21:40:31 +0200 Subject: [PATCH] exo6: add arguments and comments the filling variable method. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- exo6/Variable.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/exo6/Variable.java b/exo6/Variable.java index 807ec8d..6a85fbb 100644 --- a/exo6/Variable.java +++ b/exo6/Variable.java @@ -7,12 +7,18 @@ class Variable extends Terme { Variable() { v = new TreeMap(); - fill(); + fill(-5.0, 5.0, 0.25); } - private void fill() { + /** + * Fill the variable with a discret set of double values + * @param start starting double value + * @param end ending double value + * @param step looping step + */ + private void fill(double start, double end, double step) { int i = 0; - for (double d = -5.0; d <= 5.0; d = d + 0.25) { + for (double d = start; d <= end; d = d + step) { v.put(i, d); i++; } -- 2.34.1