Skip to content

Negating Conditions

Rubens de Oliveira Moraes Filho edited this page Apr 29, 2021 · 12 revisions

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:

IF (!<boolean>)

The symbol ! negates the Boolean expression.


In code (how to create one)

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));

By translate method

S2If.translate() --> print in Java console--> if(!HaveUnitsinEnemyRange(Ranged)) then(build(Base,1,Right))

By friendly translate method

ast_example.friendly_translate() --> print in Java console-->
line 1. if not HaveUnitsinEnemyRange(Ranged):
line 2. ....build(Base,1,Right)

By formated Structured DSL Tree Pre-Order Print method

BuilderDSLTreeSingleton.formatedStructuredDSLTreePreOrderPrint((iNodeDSLTree) S2If); --> print in Java console--> line 1. S2 - if(!HaveUnitsinEnemyRange(Ranged))
line 2. │ └──C
line 3. │ │ └──c->build(Base,1,Right)

Clone this wiki locally