Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TULIP-CPS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NUI
TULIP-CPS
Commits
48800409
Commit
48800409
authored
May 05, 2017
by
Nico Mack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed minor issue with locking of nested equation. Fixed logging output
of SQLExecutor
parent
8dfaee8c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
76 additions
and
13 deletions
+76
-13
CPS/pom.xml
CPS/pom.xml
+2
-2
CPS/src/lu/list/itis/dkd/tui/cps/system/Equation.java
CPS/src/lu/list/itis/dkd/tui/cps/system/Equation.java
+5
-1
CPS/src/lu/list/itis/dkd/tui/cps/system/EquationSystemBuilder.java
...u/list/itis/dkd/tui/cps/system/EquationSystemBuilder.java
+2
-0
CPS/src/lu/list/itis/dkd/tui/cps/system/LinearEquationSystem.java
...lu/list/itis/dkd/tui/cps/system/LinearEquationSystem.java
+8
-2
CPS/src/lu/list/itis/dkd/tui/cps/system/System.java
CPS/src/lu/list/itis/dkd/tui/cps/system/System.java
+18
-5
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/Executor.java
...rc/lu/list/itis/dkd/tui/cps/system/executor/Executor.java
+2
-0
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/JavascriptExecutor.java
.../itis/dkd/tui/cps/system/executor/JavascriptExecutor.java
+10
-0
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/OctaveExecutor.java
...list/itis/dkd/tui/cps/system/executor/OctaveExecutor.java
+6
-0
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/PythonExecutor.java
...list/itis/dkd/tui/cps/system/executor/PythonExecutor.java
+6
-0
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/SqlExecutor.java
...lu/list/itis/dkd/tui/cps/system/executor/SqlExecutor.java
+17
-3
No files found.
CPS/pom.xml
View file @
48800409
...
...
@@ -99,8 +99,8 @@
<repository>
<id>
Kenai
</id>
<name>
Kenai
</name>
<url>
https://svn.kenai.com/svn/javaoctave~maven-
repository
</url>
</repository>
<url>
file:///Users/mack/.m2/
repository
</url>
</repository>
</repositories>
...
...
CPS/src/lu/list/itis/dkd/tui/cps/system/Equation.java
View file @
48800409
...
...
@@ -93,11 +93,15 @@ public class Equation {
this
.
isolated
=
isolateIt
;
}
public
boolean
isIsolated
()
{
return
this
.
isolated
;
}
/**
* Method called to evaluate the script of the equation with the variables provided by the
* mapping.
*/
public
void
evaluate
()
{
public
synchronized
void
evaluate
()
{
LinkedHashSet
<
Variable
<?>>
dependentVariables
;
String
evaluationErrors
;
...
...
CPS/src/lu/list/itis/dkd/tui/cps/system/EquationSystemBuilder.java
View file @
48800409
...
...
@@ -636,6 +636,8 @@ public class EquationSystemBuilder {
}
}
logger
.
info
(
"Locking of nested Equations is {} for equation {}"
,
(
lockToNesting
)
?
"Enabled"
:
"Disabled"
,
equationName
);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
for
(
String
identifier
:
equationResults
.
get
(
equationName
))
{
if
(
dependentVariables
.
containsKey
(
identifier
))
{
equationOutputs
.
add
(
dependentVariables
.
get
(
identifier
));
...
...
CPS/src/lu/list/itis/dkd/tui/cps/system/LinearEquationSystem.java
View file @
48800409
...
...
@@ -98,8 +98,8 @@ public class LinearEquationSystem extends System {
for
(
Equation
equation
:
equations
.
values
())
{
if
(
equation
.
catersTo
(
input
.
getSource
()))
{
if
(
LOGGER
.
is
Trace
Enabled
())
{
LOGGER
.
trace
(
"Equation {} triggered by variable {}..."
,
equation
.
toString
(),
input
.
getSource
().
getName
());
//$NON-NLS-1$
if
(
LOGGER
.
is
Info
Enabled
())
{
LOGGER
.
info
(
"Equation {} triggered by variable {}..."
,
equation
.
toString
(),
input
.
getSource
().
getName
());
//$NON-NLS-1$
}
equation
.
evaluate
();
}
...
...
@@ -122,4 +122,10 @@ public class LinearEquationSystem extends System {
public
ConcurrentHashMap
<
Mapping
,
Equation
>
getEquations
()
{
return
equations
;
}
@Override
public
String
toString
()
{
return
this
.
equations
.
toString
();
}
}
\ No newline at end of file
CPS/src/lu/list/itis/dkd/tui/cps/system/System.java
View file @
48800409
...
...
@@ -25,6 +25,9 @@ import lu.list.itis.dkd.tui.cps.InputChangeListener;
import
lu.list.itis.dkd.tui.cps.InputDriver
;
import
lu.list.itis.dkd.tui.cps.InputEvent
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.Vector
;
/**
...
...
@@ -40,6 +43,8 @@ public abstract class System implements InputDriver, InputChangeListener {
protected
Vector
<
System
>
nestedSystems
;
protected
boolean
lockSystemForNesting
=
true
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
System
.
class
.
getSimpleName
());
/**
* Constructor.
*/
...
...
@@ -54,7 +59,12 @@ public abstract class System implements InputDriver, InputChangeListener {
* The {@link System} instance to add.
*/
public
void
nestSystem
(
System
system
)
{
nestedSystems
.
add
(
system
);
if
(!
nestedSystems
.
contains
(
system
))
{
nestedSystems
.
add
(
system
);
}
else
{
logger
.
trace
(
"System {} is already known as a nested system!"
,
system
);
//$NON-NLS-1$
}
}
/**
...
...
@@ -66,11 +76,14 @@ public abstract class System implements InputDriver, InputChangeListener {
*/
@Override
public
synchronized
void
inputChanged
(
InputEvent
input
)
{
saveState
();
for
(
System
nestedSystem
:
nestedSystems
)
{
if
(
nestedSystem
!=
null
)
nestedSystem
.
saveState
();
if
(
lockSystemForNesting
)
{
saveState
();
for
(
System
nestedSystem
:
nestedSystems
)
{
if
(
nestedSystem
!=
null
)
nestedSystem
.
saveState
();
}
}
for
(
System
nestedSystem
:
nestedSystems
)
{
...
...
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/Executor.java
View file @
48800409
...
...
@@ -32,6 +32,8 @@ abstract public class Executor {
executionErrors
.
reset
();
}
abstract
public
void
resetContext
();
@SuppressWarnings
(
"unused"
)
public
void
resolve
(
List
<
Import
>
imports
)
{
LOGGER
.
warn
(
"Imports not supported by Executor!"
);
//$NON-NLS-1$
...
...
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/JavascriptExecutor.java
View file @
48800409
...
...
@@ -7,6 +7,8 @@ import org.slf4j.LoggerFactory;
import
java.util.Properties
;
import
javax.script.Bindings
;
import
javax.script.ScriptContext
;
import
javax.script.ScriptEngine
;
import
javax.script.ScriptEngineManager
;
import
javax.script.ScriptException
;
...
...
@@ -61,4 +63,12 @@ public class JavascriptExecutor extends Executor {
}
return
variable
;
}
/** {@inheritDoc} */
@Override
public
void
resetContext
()
{
Bindings
context
=
engine
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
);
context
.
clear
();
engine
.
setBindings
(
context
,
ScriptContext
.
ENGINE_SCOPE
);
}
}
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/OctaveExecutor.java
View file @
48800409
...
...
@@ -74,4 +74,10 @@ public class OctaveExecutor extends Executor {
return
variable
;
}
/** {@inheritDoc} */
@Override
public
void
resetContext
()
{
// TODO figure out a way to clear engine context
}
}
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/PythonExecutor.java
View file @
48800409
...
...
@@ -163,4 +163,10 @@ public class PythonExecutor extends Executor {
}
return
variable
;
}
/** {@inheritDoc} */
@Override
public
void
resetContext
()
{
// TODO figure out a way to clear engine context
}
}
CPS/src/lu/list/itis/dkd/tui/cps/system/executor/SqlExecutor.java
View file @
48800409
...
...
@@ -432,6 +432,11 @@ public class SqlExecutor extends Executor {
Object
value
=
values
[
index
];
vector
.
add
(
value
);
}
if
(
LOGGER
.
isInfoEnabled
())
{
LOGGER
.
info
(
"Result <- {} = {}"
,
variable
.
getName
(),
variable
.
getValue
());
//$NON-NLS-1$
}
variable
.
suspendListenerNotification
(
false
);
vector
.
notifyInputChangeListeners
();
}
else
{
...
...
@@ -441,16 +446,25 @@ public class SqlExecutor extends Executor {
// Column value is a scalar
if
(
columnValues
.
size
()
>
0
)
{
Object
[]
values
=
columnValues
.
get
(
0
);
if
(
LOGGER
.
isInfoEnabled
())
{
LOGGER
.
info
(
"Result <- {} = {}"
,
variable
.
getName
(),
values
[
index
]);
//$NON-NLS-1$
}
variable
.
setValueFromObject
(
values
[
index
]);
}
else
{
LOGGER
.
info
(
"Query returned no results!"
);
//$NON-NLS-1$
}
}
}
if
(
LOGGER
.
isInfoEnabled
())
{
LOGGER
.
info
(
"Result <- {} = {}"
,
variable
.
getName
(),
variable
.
getValue
());
//$NON-NLS-1$
}
return
variable
;
}
/** {@inheritDoc} */
@Override
public
void
resetContext
()
{
// TODO Auto-generated method stub
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment