Commit 5b840786 authored by Nico Mack's avatar Nico Mack

Minor bug fixes

parent 1a18dbcf
......@@ -135,11 +135,11 @@ public class NumericalVariable extends Variable<Double> {
* specifies the lower value bound.
* @param upperValue
* specifies the upper value bound.
* @return the value range determined as the difference between the true upper bound and the true
* lower bound. This means that in case maxValue would be inferior to minValue, minValue and
* maxValue will be swapped. In case one of the specified values is still set to ±
* Double.MAX_VALUE the returned value will be Double.MAX_VALUE since the range can't be
* determined.
* @return the value range determined as the difference between the true upper bound and the
* true lower bound. This means that in case maxValue would be inferior to minValue,
* minValue and maxValue will be swapped. In case one of the specified values is still
* set to ± Double.MAX_VALUE the returned value will be Double.MAX_VALUE since the range
* can't be determined.
*/
// ---------------------------------------------------------------------------
......@@ -220,8 +220,8 @@ public class NumericalVariable extends Variable<Double> {
* specifies whether or not to display the capped value, i.e. the constrained value being
* minValue <= x <= maxValue, or the raw Value. Specify <code>true</code> to display the
* capped value or <code>false</code> for the raw value
* @return a string showing the name of the variable, its value (either capped or not) and its unit
* if defined.
* @return a string showing the name of the variable, its value (either capped or not) and its
* unit if defined.
*/
// ---------------------------------------------------------------------------
......@@ -283,7 +283,8 @@ public class NumericalVariable extends Variable<Double> {
@Override
public void setValue(Double newValue) {
double val = (newValue != null) ? roundToPrecision(newValue) + 0.0d : 0d; // Avoid -0.0 values
double val = (newValue != null) ? roundToPrecision(newValue) + 0.0d : 0d; // Avoid -0.0
// values
this.normalizedValue = this.normalizeValue(val);
// this.modified = ((newValue != null) && (!isEqual(newValue, this.value, this.epsilon)));
......@@ -433,12 +434,27 @@ public class NumericalVariable extends Variable<Double> {
// ---------------------------------------------------------------------------
/**
* Returns the constrained value of this variable. The constrained value is guaranteed to be in the
* range MIN <= x <= MAX, rounded to the nearest value as determined by the property number of
* decimals.
*
* @return the constrained value, i.e MIN <= x <= MAX rounded to the precision determined the number
* of decimals property.
* @param value
*/
// ---------------------------------------------------------------------------
public void setNormalizedValue(double value) {
double normalized = Math.max(value, 0d);
normalized = Math.min(normalized, 1d);
this.setValue(this.minValue + normalized * this.valueRange);
this.normalizedValue = normalized;
}
// ---------------------------------------------------------------------------
/**
* Returns the constrained value of this variable. The constrained value is guaranteed to be in
* the range MIN <= x <= MAX, rounded to the nearest value as determined by the property number
* of decimals.
*
* @return the constrained value, i.e MIN <= x <= MAX rounded to the precision determined the
* number of decimals property.
* @see #setNumberOfDecimals
*/
// ---------------------------------------------------------------------------
......
......@@ -104,8 +104,6 @@ public class ValueCorona extends SelectableCorona implements InformationReceiver
Preconditions.checkArgument(systemVariables != null, "Set of variables can't be null!"); //$NON-NLS-1$
assert systemVariables != null;
Variable<?> systemVariable;
NumericalVariable numerical;
......@@ -120,6 +118,11 @@ public class ValueCorona extends SelectableCorona implements InformationReceiver
}
}
List<VariableBased> handlers = this.getHandlers(VariableBased.class);
for (VariableBased handler : handlers) {
connected.addAll(handler.connectWithSystemVariables(systemVariables));
}
if ((this.scripts != null) && !this.scripts.isEmpty()) {
for (Script script : this.scripts) {
if (script instanceof VariableScript) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment