[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmt] Re: OAW xpt and counters

Thanks ... but not quite i "fixed" it to do what i was looking for by doing the below ... i am sure its a sin of some kind ... but it really shorted my code down ....

Cheers,
Jim

«CreateCounter("ProcEntry_ContainerCounter")»	
«FOREACH ... AS a»
	«CounterIncrement("ProcEntry_ContainerCounter")»
«ENDFOREACH»

«IF IsCounterGreaterThan("ProcEntry_ContainerCounter","0")=="true" »
...
...

Karsten Thoms wrote:
Jim,

I suppose you are searching for the select function. Either you only iterate over the list of elements meeting that condition or you do your initialization seperately.

int count=0;
«FOREACH getSomeListOfElements.select(e|condition-with-e)»
   count +=1;
«ENDFOREACH»

objects * myarray = new objects()[«getSomeListOfElements.select(e|condition-with-e).size»]

~Karsten

Jim schrieb:
Hello ... I am porting a code generator to OAW from XSLT ...

Is there a way i can store the number of times something meeting some foreach condition ?

I kinda wanna do something like this below half baked pseudo code:

int count = 0;
«FOREACH //get some list ...
   //satisfy some condition
   count +=1;
«ENDFOREACH»


Reason being ... is that i need to create an array of objects:

objects * myarray = new objects()[/*num of special objects in model*/]

Cheers,

Jim