| [Acceleo] Collection whose elements are all different [message #895091] |
Wed, 11 July 2012 12:35  |
 |
Tomas Balderas Messages: 46 Registered: July 2010 |
Member |
|
|
Hello
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 =
aStateMachine.getStates()
->collect(s: State | s.name)
->asSet()
->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.
/TB
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02449 seconds