Dear users, Please note that, from Monday, August 16, 2019, RSA keys shorter than 2048bit will no longer be accepted for security reasons. Please update your keys as needed before this date. If you need assistance with regard to this process, please contact sia@list.lu

Thank you for your understanding.

...
 
Commits (131)
*.metadata
*.classpath
CPS/target
\ No newline at end of file
CPS/target
/.DS_Store
......@@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
......@@ -15,9 +20,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.fusesource.ide.project.RiderProjectBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.fusesource.ide.project.RiderProjectNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/${PROJECT_DIR_NAME}/python</path>
</pydev_pathproperty>
</pydev_project>
......@@ -15,9 +15,11 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=lu.tudor.ssi.kiss.dbc.annotatio
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=lu.tudor.ssi.kiss.dbc.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=lu.tudor.ssi.kiss.dbc.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
......@@ -26,6 +28,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
......
ABOVE_ELEMENT=above
BELOW_ELEMENT=below
BLINK_ON_OUT_OF_RANGE_NODE=blinkOnOutOfRange
CAPPED_DISPLAY_NODE=cappedDisplay
COLOUR_SCALE_NODE=colourScale
DECIMALS_ATTRIBUTE=decimals
FACE_IS_TOUCHABLE_NODE=faceIsTouchable
ITEMS_VARIABLE_NODE=itemsVariable
HTML_TEMPLATE_NODE=htmlTemplate
LABEL_NODE=label
LABEL_ANGLE_NODE=labelAngle
LABEL_TRANSLATION_NODE=labelTranslation
LOWER_BOUND_RADIUS_NODE=lowerBoundRadius
LOWER_BOUND_VARIABLE_NODE=lowerBoundVariable
LOWER_STOP_ANGLE_NODE=lowerStopAngle
MAPPING_NODE=mapping
MAPPINGS_NODE=mappings
MAINTAIN_ASPECT_RATIO_NODE=maintainAspectRatio
MAXIMUM_VALUE_NODE=maximumValue
MINIMUM_VALUE_NODE=minimumValue
MODIFY_VALUE_ON_ROTATION_NODE=modifyValueOnRotation
MODIFY_VALUE_ON_TRANSLATION_NODE=modifyValueOnTranslation
MULTITURN_NODE=multiTurn
POSITIONS_NODE=positions
RANGE_SEPARATOR_ATTRIBUTE=rangeSeparator
REFERENCE_NODE=reference
RELATIVE_NODE=relative
SCALES_NODE=scales
SELECTED_ITEMS_VARIABLE_NODE=selectedItemsVariable
SELECTED_RADIUS_NODE=selectedRadius
STEP_SIZE_NODE=stepSize
STRETCH_TO_FIT_NODE=stretchToFit
TRACK_ROTATION_CONTINUOUSLY_NODE=trackRotationContinuously
TRACK_TRANSLATION_CONTINUOUSLY_NODE=trackTranslationContinuously
UPPER_BOUND_RADIUS_NODE=upperBoundRadius
UPPER_BOUND_VARIABLE_NODE=upperBoundVariable
UPPER_STOP_ANGLE_NODE=upperStopAngle
VARIABLE_NODE=variable
VARIABLES_NODE=variables
VERBOSE_NODE=verbose
\ No newline at end of file
ON_POSITION_CHANGED=positionChanged
\ No newline at end of file
EXECUTOR_CLASS=executor.class
NUMERIC_VARIABLE_CLASS=numeric.variable.class
LOGIC_VARIABLE_CLASS=logic.variable.class
TEXT_VARIABLE_CLASS=text.variable.class
SPATIAL_VARIABLE_CLASS=spatial.variable.class
VECTOR_VARIABLE_CLASS=vector.variable.class
MAP_VARIABLE_CLASS=map.variable.class
EXECUTOR_NAMESPACE=lu.list.itis.dkd.tui.cps.system.executor
NAMESPACE_SEPARATOR=.
EXECUTOR_POSTFIX=Executor
EQUATIONS_ELEMENT=equations
EQUATION_ELEMENT=equation
MODE_ATTRIBUTE=mode
INVOKE_ELEMENT=invoke
INDEX_ATTRIBUTE=index
FORMAT_ATTRIBUTE=format
FIELD_ATTRIBUTE=field
KEY_ATTRIBUTE=key
VALUE_ATTRIBUTE=value
INVOKE_ELEMENT=invoke
INVOKING_ATTRIBUTE=invoking
EPSILON_ATTRIBUTE=epsilon
EXECUTOR_ATTRIBUTE=executor
NAME_ATTRIBUTE=name
OUTPUTS_ELEMENT=outputs
OUTPUT_ELEMENT=output
PARAMETER_ELEMENT=parameter
DISPLAY_NAME_ATTRIBUTE=displayName
TYPE_ATTRIBUTE=type
INITIAL_ATTRIBUTE=initial
MINIMUM_ATTRIBUTE=minimum
......@@ -17,6 +36,7 @@ SCALE_ATTRIBUTE=scale
DECIMALS_ATTRIBUTE=decimals
PARAMETERS_ELEMENT=parameters
PERIODIC_ATTRIBUTE=periodic
PRIORITY_ATTRIBUTE=priority
RESULT_ELEMENT=result
EQUATE_ATTRIBUTE=equate
RESULTS_ELEMENT=results
......@@ -25,4 +45,5 @@ IMPORT_ELEMENT=import
FUNCTION_ATTRIBUTE=function
FROM_ATTRIBUTE=from
SYSTEM_ELEMENT=system
UNIT_ATTRIBUTE=unit
\ No newline at end of file
UNIT_ATTRIBUTE=unit
TYPE_NODE=type
\ No newline at end of file
......@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>lu.list.itis.dkd.tui</groupId>
<artifactId>tulip-cps</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<name>TULIP Complex Problem Solving</name>
<licenses>
......@@ -30,6 +30,43 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
<timestampPropertyName>build.date</timestampPropertyName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestEntries>
<implementation-version>${project.version}</implementation-version>
<implementation-build>${buildNumber}</implementation-build>
<build-date>${build.date}</build-date>
</manifestEntries>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
......@@ -39,15 +76,10 @@
<artifactId>dbc-annotation</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>lu.list.itis.dkd.tui</groupId>
<artifactId>tulip</artifactId>
<version>2.4.0</version>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>maven2.dk.ange</groupId>
......@@ -67,12 +99,12 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8</version>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8</version>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
......@@ -80,16 +112,80 @@
<version>2.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.26</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.26</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.github.lucarosellini.rJava</groupId>
<artifactId>JRI</artifactId>
<version>0.9-7</version>
</dependency>
<dependency>
<groupId>com.github.lucarosellini.rJava</groupId>
<artifactId>REngine</artifactId>
<version>0.9-7</version>
</dependency>
<dependency>
<groupId>com.github.lucarosellini.rJava</groupId>
<artifactId>JRIEngine</artifactId>
<version>0.9-7</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Kenai</id>
<name>Kenai</name>
<url>https://svn.kenai.com/svn/javaoctave~maven-repository</url>
</repository>
</repositories>
<repository>
<id>LIST</id>
<name>Artifacts</name>
<url>https://artefacts.list.lu/libs-release-local</url>
</repository>
</repositories>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
<reportSets>
<reportSet>
<reports>
<report>dependencies</report>
<report>license</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<scm>
<url>scm:git:https://git.list.lu/nui/TULIP-CPS.git</url>
<connection>scm:git:https://git.list.lu/nui/TULIP-CPS.git</connection>
</scm>
</project>
\ No newline at end of file
/Spatial$py.class
/Text$py.class
/Map$py.class
/Vector$py.class
'''
Created on Jan 5, 2018
@author: mack
'''
def ManipulateMap (M):
A = M
A["intField"]+=10
A["doubleField"]*=2
A["booleanField"] = not A["booleanField"]
A["stringField"] += " had a very big fall"
A["listField"].append(17)
A["listField"].append(19)
A["listField"].append(23)
'''print A["intField"]
print A["doubleField"]
print A["booleanField"]
print A["stringField"]
print A["listField"]'''
return A
'''
Created on Aug 16, 2017
@author: mack
'''
def AddPoints (A, B):
C = {}
C['x'] = A['x'] + B['x']
C['y'] = A['y'] + B['y']
C['a'] = A['a'] + B['a']
return C
\ No newline at end of file
'''
Created on Jan 2, 2018
@author: mack
'''
def ConcatText (A, B):
C = A + B
return C
\ No newline at end of file
'''
Created on Jan 8, 2018
@author: mack
'''
def ManipulateVector (V):
R = V
R[3] = 2
return R
\ No newline at end of file
/**
* 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;
/**
* @author mack
* @since [major].[minor]
* @version [major].[minor].[micro]
*/
public class TulipCps extends TulipCore {
}
/**
* Copyright Luxembourg Institute of Science and Technology, 2017. 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.bootstrapping;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.utility.Externalization;
import lu.list.itis.dkd.tui.utility.Templating;
import lu.list.itis.dkd.tui.widget.BaseWidget;
import com.google.common.base.Strings;
import com.jgoodies.common.base.Preconditions;
import org.jdom2.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author Nico Mack [nico.mack@list.lu]
* @since 1.5
* @version 1.5.0
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public class BundleBasedCallback implements BootstrapCallback {
private Integer widgetId;
private boolean repeating;
private Map<String, BootstrapCallback> bundleCallbacks;
private BootstrapCallback callback;
private BootstrapCallback defaultCallback;
// ***************************************************************************
// * Constants *
// ***************************************************************************
private static final Logger LOGGER = LoggerFactory.getLogger(BundleBasedCallback.class.getName());
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public BundleBasedCallback(Integer widgetId, Map<String, BootstrapCallback> callbacks) throws BuildException {
this.widgetId = widgetId;
this.bundleCallbacks = new ConcurrentHashMap<>();
this.bundleCallbacks.putAll(callbacks);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
public List<BaseWidget> buildWidgets(Element template, BootstrapContext context) throws BuildException {
Preconditions.checkArgument(context != null, "Context MUST not be null!"); //$NON-NLS-1$
assert context != null;
List<BaseWidget> widgets = null;
context.setProperty(Templating.HANDLE_ID_PROPERTY, widgetId);
for (Entry<String, BootstrapCallback> callbackEntry : this.bundleCallbacks.entrySet()) {
context.setProperty(callbackEntry.getKey(), callbackEntry.getValue());
}
widgets = TangibleObjectBootstrapper.buildWidgetFromTemplate(template, context, this);
return widgets;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext initialize(Element node, BootstrapContext context) {
try {
this.callback = null;
repeating = BootstrappingUtils.getAttributeAsBoolean(node, Externalization.REPEAT_ATTRIBUTE, BootstrappingUtils.OPTIONAL, false);
String callbackAttribute = BootstrappingUtils.getAttributeAsString(node, Externalization.CALLBACK_ATTRIBUTE, BootstrappingUtils.OPTIONAL, null);
if (repeating) {
if (!Strings.isNullOrEmpty(callbackAttribute)) {
if (context.hasProperty(callbackAttribute)) {
this.callback = (BootstrapCallback) context.getProperty(callbackAttribute);
} else {
LOGGER.error("Required callback {} was not found in available callbacks!", callbackAttribute); //$NON-NLS-1$
}
}
}
} catch (BuildException exception) {
LOGGER.error("An error occured while trying to retrieve {} attribute!", Externalization.CALLBACK_ATTRIBUTE, exception); //$NON-NLS-1$
}
if (this.callback != null) {
context = this.callback.initialize(node, context);
}
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext preInstantiation(Element node, BootstrapContext context) {
return (this.callback != null) ? this.callback.preInstantiation(node, context) : context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext postInstantiation(Element node, BootstrapContext context) {
return (this.callback != null) ? this.callback.postInstantiation(node, context) : context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext next(BootstrapContext context) {
return (this.callback != null) ? this.callback.next(context) : context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext reset(BootstrapContext context) {
return (this.callback != null) ? this.callback.reset(context) : context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext finalize(BootstrapContext context) {
if (this.callback != null) {
context = this.callback.finalize(context);
this.callback = null;
}
return context;
}
}
/**
* Copyright Luxembourg Institute of Science and Technology, 2017. 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.bootstrapping;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.utility.Externalization;
import lu.list.itis.dkd.tui.utility.Templating;
import lu.list.itis.dkd.tui.widget.BaseWidget;
import com.jgoodies.common.base.Preconditions;
import org.jdom2.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* @author Nico Mack [nico.mack@list.lu]
* @since 1.5
* @version 1.5.0
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public class StackedCallback implements BootstrapCallback {
private Integer widgetId;
private boolean repeating;
private List<BootstrapCallback> stackedCallbacks;
private Iterator<BootstrapCallback> callbackIterator;
private BootstrapCallback callback;
// ***************************************************************************
// * Constants *
// ***************************************************************************
private static final Logger LOGGER = LoggerFactory.getLogger(StackedCallback.class.getName());
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public StackedCallback(Integer widgetId, List<BootstrapCallback> callbacks) throws BuildException {
this.widgetId = widgetId;
this.stackedCallbacks = new ArrayList<>();
this.stackedCallbacks.addAll(callbacks);
this.callbackIterator = this.stackedCallbacks.iterator();
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
public List<BaseWidget> buildWidgets(Element template, BootstrapContext context) throws BuildException {
Preconditions.checkArgument(context != null, "Context MUST not be null!"); //$NON-NLS-1$
assert context != null;
List<BaseWidget> widgets = null;
context.setProperty(Templating.HANDLE_ID_PROPERTY, widgetId);
widgets = TangibleObjectBootstrapper.buildWidgetFromTemplate(template, context, this);
return widgets;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext initialize(Element node, BootstrapContext context) {
try {
this.callback = null;
repeating = BootstrappingUtils.getAttributeAsBoolean(node, Externalization.REPEAT_ATTRIBUTE, BootstrappingUtils.OPTIONAL, false);
if (repeating) {
if (this.callbackIterator.hasNext()) {
this.callback = this.callbackIterator.next();
} else {
LOGGER.error("Ran out of callbacks!"); //$NON-NLS-1$
}
}
} catch (BuildException exception) {
LOGGER.error("An error occured while trying to retrieve {} attribute!", Externalization.CALLBACK_ATTRIBUTE, exception); //$NON-NLS-1$
}
if (this.callback != null) {
context = this.callback.initialize(node, context);
}
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext preInstantiation(Element node, BootstrapContext context) {
return (this.callback != null) ? this.callback.preInstantiation(node, context) : context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext postInstantiation(Element node, BootstrapContext context) {
return (this.callback != null) ? this.callback.postInstantiation(node, context) : context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext next(BootstrapContext context) {
return (this.callback != null) ? this.callback.next(context) : context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public BootstrapContext reset(BootstrapContext context) {
return (this.callback != null) ? this.callback.reset(context) : context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext finalize(BootstrapContext context) {
if (this.callback != null) {
context = this.callback.finalize(context);
this.callback = null;
}
return context;
}
}
/**
* Copyright Luxembourg Institute of Science and Technology, 2017. 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.bootstrapping;
import lu.list.itis.dkd.tui.cps.InputChangeListener;
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.exception.BuildException;
import lu.list.itis.dkd.tui.utility.ColorFactory;
import lu.list.itis.dkd.tui.utility.Templating;
import lu.list.itis.dkd.tui.widget.BaseWidget;
import org.jdom2.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Color;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* @author mack
* @since [major].[minor]
* @version [major].[minor].[micro]
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public class VariableBasedCallback implements BootstrapCallback {
private List<Variable<?>> variables;
private Iterator<Variable<?>> variableIterator;
private Variable<?> variable;
private List<Color> variableColours;
private Integer index;
private Integer widgetId;
// ***************************************************************************
// * Constants *
// ***************************************************************************
private static final Logger LOGGER = LoggerFactory.getLogger(VariableBasedCallback.class.getName());
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public VariableBasedCallback(Integer widgetId, List<Variable<?>> variables) {
this.widgetId = widgetId;
this.variables = variables;
this.variableColours = ColorFactory.makeRainbowColours(variables.size());
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
public List<BaseWidget> buildWidgets(Element template, BootstrapContext context, BootstrapCallback callback) throws BuildException {
List<BaseWidget> widgets = null;
Map<String, Variable<?>> systemVariables = new HashMap<>();
this.initialize(null, context);
for (Variable<?> systemVariable : variables) {
systemVariables.put(systemVariable.getName(), systemVariable);
}
widgets = TangibleObjectBootstrapper.buildWidgetFromTemplate(template, context, this);
for (BaseWidget widget : widgets) {
List<Variable<?>> connected;
if (widget.getClass().isAssignableFrom(VariableBased.class)) {
VariableBased display = (VariableBased) widget;
connected = display.connectWithSystemVariables(systemVariables);
if (widget.getClass().isAssignableFrom(InputChangeListener.class)) {
InputChangeListener listener = (InputChangeListener) widget;
for (Variable<?> connectedVariable : connected)
connectedVariable.addListener(listener);
}
}
}
return widgets;
}
// ---------------------------------------------------------------------------
@Override
public BootstrapContext initialize(Element node, BootstrapContext context) {
index = 0;
context.setProperty(Templating.HANDLE_ID_PROPERTY, widgetId);
context.setProperty(Templating.NUMBER_OF_VARIABLES_PROPERTY, variables.size());
variableIterator = variables.iterator();
if (variableIterator.hasNext()) {
this.variable = variableIterator.next();
} else {
LOGGER.warn("Encountered a Widget without any variables. Won't build Widget! ID of offending Widget is {}", widgetId); //$NON-NLS-1$
}
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext preInstantiation(Element node, BootstrapContext context) {
context.setProperty(Templating.VARIABLE_NAME_PROPERTY, variable.getName());
context.setProperty(Templating.VARIABLE_DISPLAY_NAME_PROPERTY, variable.getDisplayName());
context.setProperty(Templating.VARIABLE_UNIT_PROPERTY, variable.getUnit());
context.setProperty(Templating.VARIABLE_VALUE_PROPERTY, variable.getValue());
if (variable instanceof NumericalVariable) {
NumericalVariable numerical = (NumericalVariable) variable;
context.setProperty(Templating.VARIABLE_MINVALUE_PROPERTY, numerical.getMinValue());
context.setProperty(Templating.VARIABLE_MAXVALUE_PROPERTY, numerical.getMaxValue());
context.setProperty(Templating.VARIABLE_SCALE_PROPERTY, numerical.getScale());
}
Color colour = variableColours.get(index);
context.setProperty(Templating.VARIABLE_COLOUR_PROPERTY, colour.getRGB());
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext postInstantiation(Element node, BootstrapContext context) {
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext next(BootstrapContext context) {
if (variableIterator.hasNext()) {
this.variable = variableIterator.next();
this.index++;
}
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext reset(BootstrapContext context) {
this.index = 0;
variableIterator = variables.iterator();
if (variableIterator.hasNext()) {
this.variable = variableIterator.next();
}
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext finalize(BootstrapContext context) {
return reset(context);
}
}
/**
* Copyright Luxembourg Institute of Science and Technology, 2017. 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.bootstrapping;
import lu.list.itis.dkd.tui.cps.utility.EquationSystemBundle;
import lu.list.itis.dkd.tui.cps.variable.BooleanVariable;
import lu.list.itis.dkd.tui.cps.variable.MapVariable;
import lu.list.itis.dkd.tui.cps.variable.NumericalVariable;
import lu.list.itis.dkd.tui.cps.variable.SpatialVariable;
import lu.list.itis.dkd.tui.cps.variable.TextVariable;
import lu.list.itis.dkd.tui.cps.variable.Variable;
import lu.list.itis.dkd.tui.cps.variable.VectorVariable;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.utility.CoordinateState;
import lu.list.itis.dkd.tui.utility.Point;
import org.jdom2.Element;
/**
* @author mack
* @since [major].[minor]
* @version [major].[minor].[micro]
*/
public class VariableBootstrapper {
public static Variable<?> buildVariableFromElement(Element variableNode, BootstrapContext context, BootstrapCallback callback) throws BuildException {
Variable<?> variable = null;
if (variableNode == null)
return null;
String name = BootstrappingUtils.getContentAsString(variableNode, EquationSystemBundle.NAME_ATTRIBUTE, BootstrappingUtils.MANDATORY, null, context);
String type = BootstrappingUtils.getContentAsString(variableNode, EquationSystemBundle.TYPE_NODE, BootstrappingUtils.MANDATORY, null, context);
switch (type) {
case EquationSystemBundle.NUMERIC_TYPE:
String unit = BootstrappingUtils.getContentAsString(variableNode, EquationSystemBundle.UNIT_ATTRIBUTE, BootstrappingUtils.OPTIONAL, EquationSystemBundle.EMPTY_STRING, context);
double minValue = BootstrappingUtils.getContentAsDouble(variableNode, EquationSystemBundle.MINIMUM_ATTRIBUTE, BootstrappingUtils.OPTIONAL, -Double.MAX_VALUE, context);
double maxValue = BootstrappingUtils.getContentAsDouble(variableNode, EquationSystemBundle.MAXIMUM_ATTRIBUTE, BootstrappingUtils.OPTIONAL, Double.MAX_VALUE, context);
double initialValue = BootstrappingUtils.getContentAsDouble(variableNode, EquationSystemBundle.INITIAL_ATTRIBUTE, BootstrappingUtils.OPTIONAL, Double.NaN, context);
double scale = BootstrappingUtils.getContentAsDouble(variableNode, EquationSystemBundle.SCALE_ATTRIBUTE, BootstrappingUtils.OPTIONAL, 1.0, context);
double numericValue = BootstrappingUtils.getContentAsDouble(variableNode, EquationSystemBundle.INITIAL_ATTRIBUTE, BootstrappingUtils.OPTIONAL, 0.0, context);
int decimals = BootstrappingUtils.getContentAsInteger(variableNode, EquationSystemBundle.DECIMALS_ATTRIBUTE, BootstrappingUtils.OPTIONAL, -1, context);
NumericalVariable numerical = new NumericalVariable(name, unit, numericValue);
numerical.setMinValue(minValue);
numerical.setMaxValue(maxValue);
numerical.setInitialValue(initialValue);
numerical.setScale(scale);
if (decimals >= 0) {
numerical.setNumberOfDecimals(decimals);
}
variable = numerical;
break;
case EquationSystemBundle.MAP_TYPE:
MapVariable<?, ?> mapVariable = new MapVariable<>(name);
variable = mapVariable;
break;
case EquationSystemBundle.VECTOR_TYPE:
unit = BootstrappingUtils.getContentAsString(variableNode, EquationSystemBundle.UNIT_ATTRIBUTE, BootstrappingUtils.OPTIONAL, EquationSystemBundle.EMPTY_STRING, context);
VectorVariable<?> vectorVariable = new VectorVariable<>(name, unit);
variable = vectorVariable;
break;
case EquationSystemBundle.LOGIC_TYPE:
boolean booleanValue = BootstrappingUtils.getContentAsBoolean(variableNode, EquationSystemBundle.INITIAL_ATTRIBUTE, BootstrappingUtils.OPTIONAL, false, context);
BooleanVariable booleanVariable = new BooleanVariable(name, booleanValue);
variable = booleanVariable;
break;
case EquationSystemBundle.TEXT_TYPE:
String textValue = BootstrappingUtils.getContentAsString(variableNode, EquationSystemBundle.INITIAL_ATTRIBUTE, BootstrappingUtils.OPTIONAL, EquationSystemBundle.EMPTY_STRING, context);
TextVariable textVariable = new TextVariable(name, textValue);
variable = textVariable;
break;
case EquationSystemBundle.SPATIAL_TYPE:
SpatialVariable spatialVariable = new SpatialVariable(name);
Point initialPosition;
Element initialNode = variableNode.getChild(EquationSystemBundle.INITIAL_ATTRIBUTE);
if (initialNode != null) {
initialPosition = new Point(initialNode, context, callback);
} else {
CoordinateState state = CoordinateStateBootstrapper.getCoordinateState(variableNode, new Point(), context, callback);
initialPosition = new Point(state.getClass());
}
spatialVariable.setValue(initialPosition);
variable = spatialVariable;
break;
default:
throw new BuildException("Don't know how to build a Variable of type " + type); //$NON-NLS-1$
}
return variable;
}
}
/**
* Copyright Luxembourg Institute of Science and Technology, 2017. 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.bootstrapping;
import lu.list.itis.dkd.tui.cps.InputChangeListener;
import lu.list.itis.dkd.tui.cps.system.VariableBased;
import lu.list.itis.dkd.tui.cps.variable.Variable;
import lu.list.itis.dkd.tui.cps.variable.VectorVariable;
import lu.list.itis.dkd.tui.exception.BuildException;
import lu.list.itis.dkd.tui.utility.ColorFactory;
import lu.list.itis.dkd.tui.utility.Templating;
import lu.list.itis.dkd.tui.widget.BaseWidget;
import org.jdom2.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Color;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Nico Mack [nico.mack@list.lu]
* @since 1.5
* @version 1.5.0
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public class VectorBasedCallback implements BootstrapCallback {
private Integer widgetId;
private List<VectorVariable<?>> variables;
private List<Color> indexColours;
private Integer index;
private Integer size;
// ***************************************************************************
// * Constants *
// ***************************************************************************
private static final Logger LOGGER = LoggerFactory.getLogger(VectorBasedCallback.class.getName());
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public VectorBasedCallback(Integer widgetId, List<VectorVariable<?>> variables) {
size = -1;
this.widgetId = widgetId;
this.variables = variables;
for (VectorVariable<?> variable : variables) {
if (size < 0)
size = variable.size();
if (variable.size() != size) {
LOGGER.error("Size of vector {} is {} and differs from size of other vectors which is {}!", variable.getName(), variable.size(), size); //$NON-NLS-1$
}
}
this.indexColours = ColorFactory.makeRainbowColours(size);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
public List<BaseWidget> buildWidgets(Element template, BootstrapContext context, BootstrapCallback callback) throws BuildException {
List<BaseWidget> widgets = null;
Map<String, Variable<?>> systemVariables = new HashMap<>();
/*
* index = 0; context.setProperty(Templating.HANDLE_ID_PROPERTY, widgetId);
* context.setProperty(Templating.SIZE_OF_VECTORS_PROPERTY, size);
*/
this.initialize(null, context);
for (Variable<?> systemVariable : variables) {
systemVariables.put(systemVariable.getName(), systemVariable);
}
if (size > 0) {
widgets = TangibleObjectBootstrapper.buildWidgetFromTemplate(template, context, this);
for (BaseWidget widget : widgets) {
List<Variable<?>> connected;
if (widget.getClass().isAssignableFrom(VariableBased.class)) {
VariableBased display = (VariableBased) widget;
connected = display.connectWithSystemVariables(systemVariables);
if (widget.getClass().isAssignableFrom(InputChangeListener.class)) {
InputChangeListener listener = (InputChangeListener) widget;
for (Variable<?> connectedVariable : connected)
connectedVariable.addListener(listener);
}
}
}
} else {
LOGGER.warn("Encountered a Widget without any variables. Won't build Widget! ID of offending Widget is {}", widgetId); //$NON-NLS-1$
}
return widgets;
}
// ---------------------------------------------------------------------------
@Override
public BootstrapContext initialize(Element node, BootstrapContext context) {
index = 0;
context.setProperty(Templating.HANDLE_ID_PROPERTY, widgetId);
context.setProperty(Templating.SIZE_OF_VECTORS_PROPERTY, size);
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext preInstantiation(Element node, BootstrapContext context) {
for (VectorVariable<?> variable : variables) {
context.setProperty(variable.getName(), variable.get(index));
}
Color colour = indexColours.get(index);
context.setProperty(Templating.INDEX_COLOUR_PROPERTY, colour.getRGB());
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext postInstantiation(Element node, BootstrapContext context) {
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext next(BootstrapContext context) {
if (index < size) {
this.index++;
}
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext reset(BootstrapContext context) {
this.index = 0;
return context;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public BootstrapContext finalize(BootstrapContext context) {
return reset(context);
}
}
......@@ -23,7 +23,9 @@ package lu.list.itis.dkd.tui.cps;
import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.tui.cps.variable.Variable;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.List;
/**
* Class implementing an event holding all necessary information to change {@link Variable}
......@@ -36,40 +38,54 @@ import java.util.EventObject;
@NonNullByDefault
public class InputEvent extends EventObject {
private static final long serialVersionUID = 2884355501325896122L;
/** The turn index the event was triggered at. */
private long tick;
private static final int FIRST_ITEM = 0;
/**
* Constructor initialising the source and all other fields.
* Constructor initialising the source field and setting the tick field to -1.
*
* @param source
* The source of the event.
* @param tick
* The turn index the event was triggered at.
*/
public InputEvent(Variable source, long tick) {
public InputEvent(Variable<?> source) {
super(source);
this.tick = tick;
List<Variable<?>> sources = new ArrayList<>();
sources.add(source);
this.source = sources;
}
/**
* Constructor initialising the source field and setting the tick field to -1.
*
* @param source
* The source of the event.
*/
public InputEvent(Variable source) {
super(source);
this.tick = -1;
public InputEvent(List<Variable<?>> sources) {
super(sources);
if ((sources == null) || sources.isEmpty())
throw new IllegalArgumentException("Invalid (NULL) or empty sources specified!"); //$NON-NLS-1$
}
/**
* Simple getter method for tick.
*
* @return The value of tick.
*/
public long getTick() {
return tick;
@SuppressWarnings("unchecked")
public List<Variable<?>> getSources() {
return (List<Variable<?>>) this.source;
}
@Override
public Variable<?> getSource() {
return getSources().get(FIRST_ITEM);
}
public boolean originatedFrom(Variable<?> variable) {
return getSources().contains(variable);
}
public boolean originatedFrom(List<Variable<?>> variables) {
if ((variables == null) || variables.isEmpty())
return false;
boolean originatedFrom = false;
List<Variable<?>> sources = this.getSources();
for (Variable<?> variable : variables) {
originatedFrom |= sources.contains(variable);
}
return originatedFrom;
}
}
\ No newline at end of file
......@@ -22,10 +22,13 @@ package lu.list.itis.dkd.tui.cps;
import lu.list.itis.dkd.dbc.annotation.NonNullByDefault;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.cps.system.Declaration;
import lu.list.itis.dkd.tui.cps.system.System;
import lu.list.itis.dkd.tui.cps.variable.Variable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
/**
......@@ -41,9 +44,9 @@ public class Phenomenon {
/** The clock which may dictate the sampling rate and advancement of the phenomenon. */
private Clock clock;
/** The independent variables characterising the system. */
private ConcurrentHashMap<String, Variable> independentVariables;
private ConcurrentHashMap<String, Declaration> independentVariables;
/** The variables depending on the system and its inputs. */
private ConcurrentHashMap<String, Variable> dependentVariables;
private ConcurrentHashMap<String, Declaration> dependentVariables;
/** The system computing dependent variables from input independent variables. */
private lu.list.itis.dkd.tui.cps.system.System system;
/** Field indicating whether the observation is to be driven by a clock. */
......@@ -59,11 +62,11 @@ public class Phenomenon {
* @param system
* The system computing dependent variables from input independent variables.
* @param clockDriven
* Indication whether the observation of the phenomenon is to be driven by the ticking of