|[Acceleo] Collection whose elements are all different [message #895091]
||Wed, 11 July 2012 12:35
|| Tomas Balderas
Registered: July 2010
This question might be trivial for many. I found a solution, but didn't feel comfortable with it.
I want to validate that the names assigned to states in a state machine are different to each other. I wrote this query:
[query public validateStatesNames(aStateMachine: StateMachine): Boolean =
->collect(s: State | s.name)
->size() = aStateMachine.getNumberStates()
where getStates() returns a collection of instances of State in the receiving instance of StateMachine, and getNumberStates() returns the number of elements on this collection of states.
Do you know about an undocumented operation that performs the evaluation I need? Do you know about a more elegant solution?
Thank you very much.
Powered by FUDForum
. Page generated in 0.02449 seconds