0

I've recently started working with Acceleo and it's really hard to me.

Nevertheless I've encountered a problem:

All variables are 'final', but I'd like to count how many times occurred specific statement. Let's say: how many times I have 'if'.

I've found some idea to add new items to collection, but I don't really know how to do it.

Please: understand I'm total newbie in acceleo, so please: any easy solution?

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61

1 Answers1

0

You'd have to use java services to keep track of state such as counters.

Could you share the reason why you need to count statements? Because as Acceleo is a text generator it sounds odd to have this requirement, and maybe it's because you're doing something wrong.

So I wouldn't recommend to use java services without knowing more about why you want to count statements.

Laurent
  • 186
  • 2
  • Having lots of experience generating code its not at all unusual to want to count stuff -- you may want to define an array to hold pointers, you may want to assign numbers to an enumeration, you might just want to do something different on the first occurrence, you may want to generate different code if there is only one widget, etc. etc. – James Anderson Jun 26 '15 at 08:36