Thank you Yvan.
I have a subsidiary question (maybe 2), but a really interesting one.
let me show you what i have tried to set up.
I am trying to do an iteration of a variable. Maybe this needs its own post, but here goes:
m:let iteration = 0
m: iteration = iteration +1
m: iteration
m: iteration.add(1)
m: iteration
The previous lines of code would return:
- Nothing
- false
- 0
- 1
- 0
A) I understand that (x=y) is only used to verify expressions. Same for (x==y). Furthermore, x.add(y) will not increment the x let variable…
- Is there a way to Change the value of our “let” variable ? The same way as we would do i a classical programming langage. (var=var+1, var++… )
or maybe save the result in a new “unassigned” let variable?
(Someone had asked a similar question I think here : [M2Doc] Variable declaration with ‘let’ is final? - Capella - Eclipse Capella Forum (mbse-capella.org))
- Or a add the value at the end of some sequence. It is possible to create a let empty sequence and append values to it by the way?
Or maybe:
3) Is it possible to acquire the “index” of the current iteration in the for loop? Something like this:
{m:for var|expression} {m:let i=var.FORINDEX} {m:if i.mod(2)=0} The current iteration is pair {m:endif} {m:endlet} {m:endfor}
B) I found the “add” function in the git documentation,
public Integer add(Integer a, Integer b) {
return Integer.valueOf(a.intValue() + b.intValue());
}
/**
* Performs the substraction of the specified arguments.
*
* @param a
* the first operand
* @param b
* the second operand
* @return the substraction of the arguments.
*/
However to use it in the M2DOC template and in the M2DOC interpreter, i had to convert what seemed to me to be a double parameters function (add(Integer a, Integer b)) into one paremeter function (add(integer a)).
4) How does this work? Is there some method to know in order to be able to exploit all the functions mentioned in the git documentation?
Or maybe that’s related to Acceleo VS AQL somehow?
Anyway, all of this is really interesting, thanks a lot.