Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mbe-tools
TTool
Commits
2f06ddeb
Commit
2f06ddeb
authored
3 years ago
by
Ludovic Apvrille
Browse files
Options
Downloads
Patches
Plain Diff
Resolving bug on expressiontest
parent
12b8a7ba
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/avatartranslator/AvatarBlock.java
+11
-6
11 additions, 6 deletions
src/main/java/avatartranslator/AvatarBlock.java
ttool/src/test/java/avatartranslator/AvatarExpressionTest.java
+3
-3
3 additions, 3 deletions
.../src/test/java/avatartranslator/AvatarExpressionTest.java
with
14 additions
and
9 deletions
src/main/java/avatartranslator/AvatarBlock.java
+
11
−
6
View file @
2f06ddeb
...
...
@@ -793,10 +793,12 @@ public class AvatarBlock extends AvatarElement implements AvatarStateMachineOwne
public
void
removeConstantAttributes
()
{
AvatarTransition
at
;
if
(
constants
==
null
)
{
List
<
AvatarAttribute
>
newAttributes
=
new
LinkedList
<
AvatarAttribute
>();
constants
=
new
LinkedList
<
AvatarAttribute
>();
if
((
constants
==
null
)
||
(
constants
.
size
()
==
0
))
{
List
<
AvatarAttribute
>
newAttributes
=
new
LinkedList
<>();
constants
=
new
LinkedList
<>();
for
(
AvatarAttribute
attr
:
attributes
)
{
boolean
toKeep
=
false
;
...
...
@@ -804,13 +806,12 @@ public class AvatarBlock extends AvatarElement implements AvatarStateMachineOwne
if
(
attr
.
isTimer
())
{
toKeep
=
true
;
}
for
(
AvatarStateMachineElement
elt
:
asm
.
getListOfElements
())
{
if
(
elt
instanceof
AvatarTransition
)
{
at
=
(
AvatarTransition
)
elt
;
for
(
AvatarAction
aa
:
at
.
getActions
())
{
if
(
aa
instanceof
AvatarActionAssignment
)
{
if
(((
AvatarActionAssignment
)
aa
).
leftHand
.
getName
().
compareTo
(
attr
.
name
)
==
0
)
{
...
...
@@ -833,6 +834,10 @@ public class AvatarBlock extends AvatarElement implements AvatarStateMachineOwne
if
(((
AvatarRandom
)
elt
).
getVariable
().
compareTo
(
attr
.
name
)
==
0
)
{
toKeep
=
true
;
}
}
else
if
(
elt
instanceof
AvatarQueryOnSignal
)
{
if
(((
AvatarQueryOnSignal
)
elt
).
getAttribute
().
getName
().
compareTo
(
attr
.
name
)
==
0
)
{
toKeep
=
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
ttool/src/test/java/avatartranslator/AvatarExpressionTest.java
+
3
−
3
View file @
2f06ddeb
...
...
@@ -286,16 +286,16 @@ public class AvatarExpressionTest {
e1
=
new
AvatarExpressionSolver
(
"block1.x + block2.y"
);
assertTrue
(
e1
.
buildExpression
(
as
));
e2
=
new
AvatarExpressionSolver
(
"-block1.x / block1.y - 15 * block2.z + 1 == -46"
);
assert
Fals
e
(
e2
.
buildExpression
(
as
));
assert
Tru
e
(
e2
.
buildExpression
(
as
));
e3
=
new
AvatarExpressionSolver
(
"not(-block2.x / block2.z - not(block1.x + block2.y) * -2 + -(1) <= -(-4 + 7))"
);
assertFalse
(
e3
.
buildExpression
(
as
));
e4
=
new
AvatarExpressionSolver
(
"block1.x + block2.w"
);
assertTrue
(
e4
.
buildExpression
(
as
));
assertTrue
(
e1
.
getResult
(
ss
)
==
17
);
//
assertTrue(e2.getResult(ss) == 1);
assertTrue
(
e2
.
getResult
(
ss
)
==
1
);
assertTrue
(
e3
.
getResult
(
ss
)
==
0
);
//
assertTrue(e4.getResult(ss) == -2);
assertTrue
(
e4
.
getResult
(
ss
)
==
-
2
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment