-
Notifications
You must be signed in to change notification settings - Fork 103
Negating Conditions
Negating conditional is the formal name use to change any result provided by a Boolean Functions into his opposite. Each Boolean function returns (after performing some evaluation in his processing) true
or false
. Negating a boolean function will change its result, for example, true
to false
, and vice-versa.
The DSL supports the negation of Boolean expressions.
Using negation, the Boolean function will appear in the conditional method
as:
The symbol ! negates the Boolean expression.
line 1. CommandDSL cbuild = new CommandDSL("build(Base,1,Right)");
line 2. BooleanDSL bHaveUnits = new BooleanDSL("HaveUnitsinEnemyRange(Ranged)");
line 3. S5DSL s5Negation = new S5DSL(S5DSLEnum.NOT, bHaveUnits);
line 4. S2DSL S2If = new S2DSL(S5, new CDSL(cbuild));
S2If.translate()
--> print in Java console--> if(!HaveUnitsinEnemyRange(Ranged)) then(build(Base,1,Right))
ast_example.friendly_translate()
--> print in Java console-->
line 1. if not HaveUnitsinEnemyRange(Ranged):
line 2. ....build(Base,1,Right)
BuilderDSLTreeSingleton.formatedStructuredDSLTreePreOrderPrint((iNodeDSLTree) S2If);
--> print in Java console-->
line 1. S2 - if(!HaveUnitsinEnemyRange(Ranged))
line 2. │ └──C
line 3. │ │ └──c->build(Base,1,Right)