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
2b7a81bd
Commit
2b7a81bd
authored
Oct 09, 2017
by
Nico Mack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adaptations required by Messaging System in tulip-iot
parent
119f65ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
10 deletions
+29
-10
CPS/src/lu/list/itis/dkd/tui/cps/system/Mapping.java
CPS/src/lu/list/itis/dkd/tui/cps/system/Mapping.java
+18
-8
CPS/src/lu/list/itis/dkd/tui/utility/Interpolator.java
CPS/src/lu/list/itis/dkd/tui/utility/Interpolator.java
+11
-2
No files found.
CPS/src/lu/list/itis/dkd/tui/cps/system/Mapping.java
View file @
2b7a81bd
...
...
@@ -78,17 +78,25 @@ public class Mapping {
String
separator
=
""
;
//$NON-NLS-1$
StringBuilder
renderer
=
new
StringBuilder
();
for
(
Variable
<?>
variable
:
independentVariables
)
{
renderer
.
append
(
separator
).
append
(
variable
.
getName
());
separator
=
", "
;
//$NON-NLS-1$
if
(
independentVariables
!=
null
)
{
for
(
Variable
<?>
variable
:
independentVariables
)
{
renderer
.
append
(
separator
).
append
(
variable
.
getName
());
separator
=
", "
;
//$NON-NLS-1$
}
}
else
{
renderer
.
append
(
"n/a"
);
//$NON-NLS-1$
}
renderer
.
append
(
" => "
);
//$NON-NLS-1$
separator
=
""
;
//$NON-NLS-1$
for
(
Variable
<?>
variable
:
dependentVariables
)
{
renderer
.
append
(
separator
).
append
(
variable
.
getName
());
separator
=
", "
;
//$NON-NLS-1$
if
(
dependentVariables
!=
null
)
{
for
(
Variable
<?>
variable
:
dependentVariables
)
{
renderer
.
append
(
separator
).
append
(
variable
.
getName
());
separator
=
", "
;
//$NON-NLS-1$
}
}
else
{
renderer
.
append
(
"n/a"
);
//$NON-NLS-1$
}
return
renderer
.
toString
();
...
...
@@ -154,8 +162,10 @@ public class Mapping {
clonedIndependentVariables
.
add
(
variable
.
clone
());
}
LinkedHashSet
<
Variable
<?>>
clonedDependentVariables
=
new
LinkedHashSet
<>();
for
(
Variable
<?>
variable
:
dependentVariables
)
{
clonedDependentVariables
.
add
(
variable
.
clone
());
if
(
dependentVariables
!=
null
)
{
for
(
Variable
<?>
variable
:
dependentVariables
)
{
clonedDependentVariables
.
add
(
variable
.
clone
());
}
}
return
new
Mapping
(
clonedIndependentVariables
,
clonedDependentVariables
);
...
...
CPS/src/lu/list/itis/dkd/tui/utility/Interpolator.java
View file @
2b7a81bd
...
...
@@ -33,7 +33,9 @@ public class Interpolator {
// * Constants *
// ***************************************************************************
private
static
final
Pattern
VARIABLE_PATTERN
=
Pattern
.
compile
(
"\\$\\{([a-z0-9\\-_]+)(\\.(%[bhscxegat\\+\\.0-9]+))?\\}"
,
Pattern
.
CASE_INSENSITIVE
);
//$NON-NLS-1$
private
static
final
Pattern
VARIABLE_PATTERN
=
Pattern
.
compile
(
"\\$\\{([a-z0-9\\-_]+)(\\.(%[bhscxoegat\\+\\.0-9]+))?\\}"
,
Pattern
.
CASE_INSENSITIVE
);
//$NON-NLS-1$
private
static
final
Pattern
INTEGER_FORMAT
=
Pattern
.
compile
(
"\\%(\\d*(\\.\\d+)?)([xod])"
,
Pattern
.
CASE_INSENSITIVE
);
//$NON-NLS-1$
// ---------------------------------------------------------------------------
// ***************************************************************************
...
...
@@ -67,7 +69,14 @@ public class Interpolator {
if
((
variable
!=
null
)
&&
(!
variable
.
isEmpty
()))
{
if
(
parameters
.
containsKey
(
variable
))
{
if
(!
format
.
isEmpty
())
{
interpolated
.
append
(
String
.
format
(
format
,
parameters
.
get
(
variable
)));
if
(
INTEGER_FORMAT
.
matcher
(
format
).
matches
())
{
Object
value
=
parameters
.
get
(
variable
);
if
(
value
instanceof
Number
)
{
interpolated
.
append
(
String
.
format
(
format
,
((
Number
)
value
).
intValue
()));
}
}
else
{
interpolated
.
append
(
String
.
format
(
format
,
parameters
.
get
(
variable
)));
}
}
else
{
interpolated
.
append
(
parameters
.
get
(
variable
));
}
...
...
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