From 36f4393bcc9e55afa2334baa33e603ce839741a1 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Thu, 1 May 2014 13:05:27 +0100 Subject: Did more commenting, implemented reflection and statistics --- .../parameters/monitors/BooleanMonitor.java | 44 +++++++++++++++++++++ .../backend/parameters/monitors/DoubleMonitor.java | 45 ++++++++++++++++++++++ .../parameters/monitors/IntegerMonitor.java | 44 +++++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 src/jcgp/backend/parameters/monitors/BooleanMonitor.java create mode 100644 src/jcgp/backend/parameters/monitors/DoubleMonitor.java create mode 100644 src/jcgp/backend/parameters/monitors/IntegerMonitor.java (limited to 'src/jcgp/backend/parameters/monitors') diff --git a/src/jcgp/backend/parameters/monitors/BooleanMonitor.java b/src/jcgp/backend/parameters/monitors/BooleanMonitor.java new file mode 100644 index 0000000..c7ccaf0 --- /dev/null +++ b/src/jcgp/backend/parameters/monitors/BooleanMonitor.java @@ -0,0 +1,44 @@ +package jcgp.backend.parameters.monitors; + +import jcgp.backend.parameters.BooleanParameter; + +/** + * This is a special type of {@code BooleanParameter} which + * cannot be modified in the GUI (if the GUI is in use). + * + * @author Eduardo Pedroni + * + */ +public class BooleanMonitor extends BooleanParameter { + + /** + * Creates a new instance of this class, assuming the monitor + * is not critical. + * + * @param value the initial value for this monitor. + * @param name the name of this monitor, for GUI display. + */ + public BooleanMonitor(boolean value, String name) { + super(value, name, true, false); + } + + /** + * Creates a new instance of this class. + * + * @param value the initial value for this monitor. + * @param name the name of this monitor, for GUI display. + * @param critical true if the monitor is critical. + */ + public BooleanMonitor(boolean value, String name, boolean critical) { + super(value, name, true, critical); + } + + @Override + public void validate(Boolean newValue) { + /* + * Blank by default. + * Instances should override this as necessary. + * + */ + } +} diff --git a/src/jcgp/backend/parameters/monitors/DoubleMonitor.java b/src/jcgp/backend/parameters/monitors/DoubleMonitor.java new file mode 100644 index 0000000..36b0e22 --- /dev/null +++ b/src/jcgp/backend/parameters/monitors/DoubleMonitor.java @@ -0,0 +1,45 @@ +package jcgp.backend.parameters.monitors; + +import jcgp.backend.parameters.DoubleParameter; + +/** + * This is a special type of {@code DoubleParameter} which + * cannot be modified in the GUI (if the GUI is in use). + * + * @author Eduardo Pedroni + * + */ +public class DoubleMonitor extends DoubleParameter { + + /** + * Creates a new instance of this class, assuming the monitor + * is not critical. + * + * @param value the initial value for this monitor. + * @param name the name of this monitor, for GUI display. + */ + public DoubleMonitor(double value, String name) { + super(value, name, true, false); + } + + /** + * Creates a new instance of this class. + * + * @param value the initial value for this monitor. + * @param name the name of this monitor, for GUI display. + * @param critical true if the monitor is critical. + */ + public DoubleMonitor(double value, String name, boolean critical) { + super(value, name, true, critical); + } + + @Override + public void validate(Number newValue) { + /* + * Blank by default. + * Instances should override this as necessary. + * + */ + } + +} diff --git a/src/jcgp/backend/parameters/monitors/IntegerMonitor.java b/src/jcgp/backend/parameters/monitors/IntegerMonitor.java new file mode 100644 index 0000000..5c1a83e --- /dev/null +++ b/src/jcgp/backend/parameters/monitors/IntegerMonitor.java @@ -0,0 +1,44 @@ +package jcgp.backend.parameters.monitors; + +import jcgp.backend.parameters.IntegerParameter; + +/** + * This is a special type of {@code IntegerParameter} which + * cannot be modified in the GUI (if the GUI is in use). + * + * @author Eduardo Pedroni + * + */ +public class IntegerMonitor extends IntegerParameter { + + /** + * Creates a new instance of this class, assuming the monitor + * is not critical. + * + * @param value the initial value for this monitor. + * @param name the name of this monitor, for GUI display. + */ + public IntegerMonitor(int value, String name) { + super(value, name, true, false); + } + + /** + * Creates a new instance of this class. + * + * @param value the initial value for this monitor. + * @param name the name of this monitor, for GUI display. + * @param critical true if the monitor is critical. + */ + public IntegerMonitor(int value, String name, boolean critical) { + super(value, name, true, critical); + } + + @Override + public void validate(Number newValue) { + /* + * Blank by default. + * Instances should override this as necessary. + * + */ + } +} -- cgit v1.2.3