Commit 10d42ee0 authored by Nico Mack's avatar Nico Mack

Added SectorDisplay corona

Implemented VariableScript script class
parent 108b9a45
......@@ -40,6 +40,11 @@ public class BooleanVariable extends Variable<Boolean> {
*/
private static final Logger LOGGER = LoggerFactory.getLogger(BooleanVariable.class.getSimpleName());
public BooleanVariable(String name) {
super(EquationSystemBundle.LOGIC_TYPE, name);
this.value = Boolean.FALSE;
}
public BooleanVariable(String name, boolean value) {
super(EquationSystemBundle.LOGIC_TYPE, name, "boolean"); //$NON-NLS-1$
......
......@@ -73,6 +73,13 @@ public class NumericalVariable extends Variable<Double> {
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
public NumericalVariable(String name) {
super(EquationSystemBundle.NUMERIC_TYPE, name);
this.value = Double.valueOf(0);
initToDefaults();
}
// ---------------------------------------------------------------------------
/**
* Constructor resorting to the super constructor to initialise the name and unit and locally
......@@ -90,7 +97,16 @@ public class NumericalVariable extends Variable<Double> {
public NumericalVariable(String name, String unit, Double value) {
super(EquationSystemBundle.NUMERIC_TYPE, name, unit);
this.value = (value != null) ? value : Double.valueOf(0);
initToDefaults();
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Primitives *
// ***************************************************************************
// ---------------------------------------------------------------------------
private void initToDefaults() {
format = new DecimalFormat();
format.setDecimalSeparatorAlwaysShown(false);
format.setMaximumFractionDigits(0);
......@@ -110,10 +126,6 @@ public class NumericalVariable extends Variable<Double> {
roundingFactor = 1;
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Primitives *
// ***************************************************************************
// ---------------------------------------------------------------------------
/**
* determines the value range from the specified minimum and maximum value bounds.
......
......@@ -14,8 +14,8 @@
package lu.list.itis.dkd.tui.cps.variable;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.cps.utility.ExecutorScope;
import lu.list.itis.dkd.tui.cps.utility.EquationSystemBundle;
import lu.list.itis.dkd.tui.cps.utility.ExecutorScope;
import lu.list.itis.dkd.tui.utility.Point;
import org.slf4j.Logger;
......@@ -36,11 +36,24 @@ public class SpatialVariable extends Variable<Point> {
private static final Pattern SPATIAL_STRING_PATTERN = Pattern.compile("([0-9]+\\.?[0-9]*)\\s*,\\s*([0-9]+\\.?[0-9]*)(\\s*,\\s*([0-9]+\\.?[0-9]*))?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public SpatialVariable(String name) {
super(EquationSystemBundle.SPATIAL_TYPE, name);
}
// ---------------------------------------------------------------------------
/**
* @param type
* @param name
* @param unit
*/
// ---------------------------------------------------------------------------
public SpatialVariable(String name, String unit, Point value) {
super(EquationSystemBundle.SPATIAL_TYPE, name, unit);
this.value = value;
......
......@@ -42,6 +42,18 @@ public class TextVariable extends Variable<String> {
private static final Logger logger = LoggerFactory.getLogger(TextVariable.class.getSimpleName());
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public TextVariable(String name) {
super(EquationSystemBundle.TEXT_TYPE, name);
this.value = EquationSystemBundle.EMPTY_STRING;
}
// ---------------------------------------------------------------------------
/**
* Constructor resorting to the super constructor to initialise the name and unit and locally
* initialising the numerical value.
......@@ -53,6 +65,8 @@ public class TextVariable extends Variable<String> {
* @param value
* The value held by the variable.
*/
// ---------------------------------------------------------------------------
public TextVariable(String name, String value) {
super(EquationSystemBundle.TEXT_TYPE, name, EquationSystemBundle.EMPTY_STRING);
this.value = (value != null) ? value : EquationSystemBundle.EMPTY_STRING;
......
......@@ -36,7 +36,9 @@ import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
......@@ -58,10 +60,8 @@ public abstract class Variable<V> implements Cloneable {
protected String displayName;
/** The unit the variable is given in. */
protected String unit;
/** An alternative source to get value of variable from */
// protected String equate;
/** The listeners to notify when the variable changes value. */
protected Vector<InputChangeListener> listeners;
protected List<InputChangeListener> listeners;
protected V value;
......@@ -73,6 +73,20 @@ public abstract class Variable<V> implements Cloneable {
private static final Logger LOGGER = LoggerFactory.getLogger(Variable.class.getSimpleName());
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public Variable(String type, String name) {
this.type = type;
this.name = name;
this.unit = NO_UNIT;
listeners = new ArrayList<>();
}
// ---------------------------------------------------------------------------
/**
* Constructor initialising the name and unit fields.
*
......@@ -81,13 +95,20 @@ public abstract class Variable<V> implements Cloneable {
* @param unit
* The unit the variable is given in.
*/
// ---------------------------------------------------------------------------
public Variable(String type, String name, String unit) {
this.type = type;
this.name = name;
this.unit = unit;
listeners = new Vector<>();
listeners = new ArrayList<>();
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
/**
* Simple getter method for unit.
*
......
......@@ -45,6 +45,12 @@ public class VectorVariable<B> extends Variable<List<B>> implements List<B> {
// ***************************************************************************
// ---------------------------------------------------------------------------
public VectorVariable(String name) {
super(EquationSystemBundle.VECTOR_TYPE, name);
}
// ---------------------------------------------------------------------------
public VectorVariable(String name, String unit) {
super(EquationSystemBundle.VECTOR_TYPE, name, unit);
value = new ArrayList<B>();
......
/**
* Copyright Luxembourg Institute of Science and Technology, 2018. All rights reserved. If you wish
* to use this code for any purpose, please contact the author(s).
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package lu.list.itis.dkd.tui.scripting;
import lu.list.itis.dkd.tui.cps.InputChangeListener;
import lu.list.itis.dkd.tui.cps.InputEvent;
import lu.list.itis.dkd.tui.cps.system.Declaration;
import lu.list.itis.dkd.tui.cps.system.Equation;
import lu.list.itis.dkd.tui.cps.system.Mapping;
import lu.list.itis.dkd.tui.cps.system.VariableBased;
import lu.list.itis.dkd.tui.cps.system.executor.JavascriptExecutor;
import lu.list.itis.dkd.tui.cps.variable.BooleanVariable;
import lu.list.itis.dkd.tui.cps.variable.NumericalVariable;
import lu.list.itis.dkd.tui.cps.variable.TextVariable;
import lu.list.itis.dkd.tui.cps.variable.Variable;
import lu.list.itis.dkd.tui.event.conditional.ScriptableCondition;
import lu.list.itis.dkd.tui.scripting.builder.BaseVariableScriptBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
/**
* @author mack
* @since [major].[minor]
* @version [major].[minor].[micro]
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public class VariableScript extends Script implements VariableBased, InputChangeListener {
private Equation equation;
private HashMap<String, Variable<?>> parameters;
private Variable<?> result;
// ***************************************************************************
// * Constants *
// ***************************************************************************
private static final String RESULT = "Result"; //$NON-NLS-1$
private static final Logger LOGGER = LoggerFactory.getLogger(VariableScript.class.getName());
private static Map<Class<?>, Class<?>> FIELD_VARIABLE_LOOKUP = new HashMap<>();
static {
FIELD_VARIABLE_LOOKUP.put(float.class, NumericalVariable.class);
FIELD_VARIABLE_LOOKUP.put(double.class, NumericalVariable.class);
FIELD_VARIABLE_LOOKUP.put(int.class, NumericalVariable.class);
FIELD_VARIABLE_LOOKUP.put(boolean.class, NumericalVariable.class);
FIELD_VARIABLE_LOOKUP.put(Float.class, NumericalVariable.class);
FIELD_VARIABLE_LOOKUP.put(Double.class, NumericalVariable.class);
FIELD_VARIABLE_LOOKUP.put(Integer.class, NumericalVariable.class);
FIELD_VARIABLE_LOOKUP.put(Boolean.class, BooleanVariable.class);
FIELD_VARIABLE_LOOKUP.put(String.class, TextVariable.class);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public VariableScript(BaseVariableScriptBuilder<?> builder) {
super(builder);
this.property = builder.property;
this.parameters = builder.parameters;
this.expression = builder.expression;
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Primitives(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
private void setupEquation(String expression) {
LinkedHashSet<Declaration> inputs = new LinkedHashSet<>();
LinkedHashSet<Declaration> outputs = new LinkedHashSet<>();
for (Variable<?> parameter : parameters.values()) {
inputs.add(new Declaration(parameter));
}
outputs.add(new Declaration(result));
this.equation = new Equation(ScriptableCondition.class.getName(), new Mapping(inputs, outputs), expression);
JavascriptExecutor executor = new JavascriptExecutor();
executor.setVerbosity(false);
this.equation.setExecutor(executor);
}
// ---------------------------------------------------------------------------
private Variable<?> instantiateVariableForField(Field field) {
Class<?> variableClass = FIELD_VARIABLE_LOOKUP.get(field.getType());
Variable<?> variable = null;
try {
variable = (Variable<?>) variableClass
.getConstructor(String.class)
.newInstance(RESULT);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
LOGGER.error("Failed to instantiate variable for field {} of type {}!", field.getName(), field.getType(), e); //$NON-NLS-1$
}
return variable;
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
@Override
public void setScriptableInstance(Scriptable newInstance) {
super.setScriptableInstance(newInstance);
if (this.field != null) {
this.result = this.instantiateVariableForField(field);
}
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public List<Variable<?>> connectWithSystemVariables(Map<String, Variable<?>> systemVariables) {
List<Variable<?>> connected = new ArrayList<>();
if (systemVariables != null) {
for (String identifier : parameters.keySet()) {
if (systemVariables.containsKey(identifier)) {
Variable<?> variable = systemVariables.get(identifier);
this.parameters.put(identifier, variable);
connected.add(variable);
variable.addListener(this);
}
}
}
this.setupEquation(expression);
return connected;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public List<Variable<?>> getDeclaredVariables() {
return new ArrayList<>(parameters.values());
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public void inputChanged(InputEvent input) {
this.equation.evaluate();
this.setProperty(this.result.getValue());
}
// ---------------------------------------------------------------------------
}
/**
* Copyright Luxembourg Institute of Science and Technology, 2018. All rights reserved. If you wish
* to use this code for any purpose, please contact the author(s).
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package lu.list.itis.dkd.tui.scripting.builder;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapCallback;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapContext;
import lu.list.itis.dkd.tui.bootstrapping.BootstrappingUtils;
import lu.list.itis.dkd.tui.cps.utility.EquationSystemBundle;
import lu.list.itis.dkd.tui.cps.variable.NumericalVariable;
import lu.list.itis.dkd.tui.cps.variable.Variable;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.scripting.VariableScript;
import lu.list.itis.dkd.tui.utility.Externalization;
import org.jdom2.Element;
import org.python.google.common.base.Strings;
import java.util.HashMap;
/**
* @author Nico Mack [nico.mack@list.lu]
* @since 1.5
* @version 1.5.0
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public abstract class BaseVariableScriptBuilder<B extends BaseVariableScriptBuilder<B>> extends BaseScriptBuilder<B> {
public HashMap<String, Variable<?>> parameters;
// ***************************************************************************
// * Constants *
// ***************************************************************************
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
/**
* @param rootElement
* @throws BuildException
*/
// ---------------------------------------------------------------------------
public BaseVariableScriptBuilder(Element rootElement) throws BuildException {
super(rootElement);
this.buildFromBootstrap(rootElement, null, null);
}
// ---------------------------------------------------------------------------
/**
* @param rootElement
* @throws BuildException
*/
// ---------------------------------------------------------------------------
public BaseVariableScriptBuilder(Element rootElement, BootstrapContext context, BootstrapCallback callback) throws BuildException {
super(rootElement, context, callback);
this.buildFromBootstrap(rootElement, context, callback);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Primitives *
// ***************************************************************************
// ---------------------------------------------------------------------------
private void buildFromBootstrap(@Nullable Element rootElement, BootstrapContext context, BootstrapCallback callback) throws BuildException {
parameters = new HashMap<>();
for (Element parameterNode : rootElement.getChild(EquationSystemBundle.PARAMETERS_ELEMENT).getChildren(EquationSystemBundle.PARAMETER_ELEMENT)) {
String identifier = BootstrappingUtils.getAttributeAsString(parameterNode, EquationSystemBundle.NAME_ATTRIBUTE, BootstrappingUtils.OPTIONAL, null);
if (Strings.isNullOrEmpty(identifier)) {
identifier = BootstrappingUtils.getContentAsString(parameterNode, null, BootstrappingUtils.MANDATORY, null, context);
}
double initial = BootstrappingUtils.getAttributeAsDouble(parameterNode, EquationSystemBundle.INITIAL_ATTRIBUTE, BootstrappingUtils.OPTIONAL, 0d);
parameters.put(identifier, new NumericalVariable(identifier, Externalization.EMPTY_STRING, initial));
}
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
public abstract VariableScript build();
}
/**
* Copyright Luxembourg Institute of Science and Technology, 2018. All rights reserved. If you wish
* to use this code for any purpose, please contact the author(s).
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package lu.list.itis.dkd.tui.scripting.builder;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapCallback;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapContext;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.scripting.VariableScript;
import org.jdom2.Element;
/**
* @author mack
* @since [major].[minor]
* @version [major].[minor].[micro]
*/
public class VariableScriptBuilder extends BaseVariableScriptBuilder<VariableScriptBuilder> {
/**
* Constructor initializing all fields from an {@link Element} containing as child elements all the
* information on fields to initialize.
*
* @param rootElement
* The element harbouring, on child nodes, the necessary information to initialize all fields
* of the builder.
* @throws BuildException
* Thrown when any of the fields fail to populate due to an error in reading information
* from the XML file.
*/
public VariableScriptBuilder(Element rootElement) throws BuildException {
super(rootElement);
}
/**
* Constructor initializing all fields from an {@link Element} containing as child elements all the
* information on fields to initialize.
*
* @param rootElement
* The element harbouring, on child nodes, the necessary information to initialize all fields
* of the builder.
* @throws BuildException
* Thrown when any of the fields fail to populate due to an error in reading information
* from the XML file.
*/
public VariableScriptBuilder(Element rootElement, BootstrapContext context, BootstrapCallback callback) throws BuildException {
super(rootElement, context, callback);
}
/** {@inheritDoc} */
@Override
public VariableScript build() {
// TODO Auto-generated method stub
return new VariableScript(this);
}
}
package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.tui.utility.AngleUtils;
import lu.list.itis.dkd.tui.utility.ColorPair;
import lu.list.itis.dkd.tui.utility.Leader;
import lu.list.itis.dkd.tui.utility.ValueRange;
......@@ -183,7 +184,7 @@ public class ArcRangeGraph extends ValueRangeCorona {
// TULIP follows the clockwise TUIO convention, we need to convert both startAngle and
// extend.
startAngle = (THREE_SIXTY - startAngle);
startAngle = (AngleUtils.THREE_SIXTY - startAngle);
arcSpan = -arcSpan;
Shape sector = new Arc2D.Double(-outerRadius, -outerRadius, diameter, diameter, startAngle, arcSpan, Arc2D.PIE);
......
......@@ -188,7 +188,7 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
// TULIP follows the clockwise TUIO convention, we need to convert both startAngle and
// extend.
angle = (THREE_SIXTY - angle);
angle = (AngleUtils.THREE_SIXTY - angle);
diameter = 2 * innerRadius;
inner = new Area(new Ellipse2D.Double(-innerRadius, -innerRadius, diameter, diameter));
......
package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.tui.content.InformationReceiver;
import lu.list.itis.dkd.tui.cps.system.VariableBased;
import lu.list.itis.dkd.tui.cps.variable.NumericalVariable;
import lu.list.itis.dkd.tui.cps.variable.Variable;
import lu.list.itis.dkd.tui.scripting.Script;
import lu.list.itis.dkd.tui.scripting.VariableScript;
import lu.list.itis.dkd.tui.widget.corona.builder.BaseSectorDisplayBuilder;
import org.python.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author nmack
* @date 08 May 2015
*
* <br>
* $Log: Sector.java,v $
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public class SectorDisplay extends Sector implements InformationReceiver<Object>, VariableBased {
protected NumericalVariable variable;
// ***************************************************************************
// * Constants *
// ***************************************************************************
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
/**
* @param builder
*/
// ---------------------------------------------------------------------------
public SectorDisplay(BaseSectorDisplayBuilder<?> builder) {
super(builder);
this.variable = builder.variable;
this.setInformation(this.variable.getValue());
}
// ---------------------------------------------------------------------------
/**
* Copy constructor to clone corona.
*
* @param original
* specifies the original corona to create an exact copy from.
*/
// ---------------------------------------------------------------------------
public SectorDisplay(SectorDisplay original) {
super(original);
this.variable = (original.variable != null) ? original.variable.clone() : null;
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Primitives *
// ***************************************************************************
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
public NumericalVariable getVariable() {
return this.variable;
}
// ---------------------------------------------------------------------------
public void setVariable(NumericalVariable variable) {
this.variable = variable;
}
// ---------------------------------------------------------------------------
@Override
public void setInformation(Object information) {
if (information != null) {
this.variable.setValue(this.variable.valueFromString(information.toString()));
this.renderLabel(this.variable.toString(false));
}
}
// ---------------------------------------------------------------------------
@Override
public SectorDisplay clone() {
return new SectorDisplay(this);
}