How to implement Universal Binding

From WeizmannWiki
Revision as of 15:22, 25 February 2014 by Smadar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

At present S2A Compiler, which is the mechanism used for playing out LSC specification, does not support universal binding.

We demonstrate 2 alternatives for defining LSC with equivalent semantics to universal binding.
We want to specify the requirement: After event A occurred, for each instance of ClassB event B must occur.

Using concrete LSC

Define your specification using lifelines of type 'Universal Binding' as required. For example:

UniversalBindingViaConcretization.png

When playing out the specification, check the 'Concrete LSC' checkbox:

ConcreteLSC.png

As a result when play out starts, PlayGo transforms the specification into specification with no dynamic lifelines. Instead of each dynamic lifeline it creates multiple LSCs, each containing only static lifelines. PlayGo translates the dynamic lifelines into concrete/static lifelines, based on the objects, of the type defined by the lifeline, in the system model. For example:

ConcreteLSCSpec.png

Combining LSC with Java code

Define an LSC in which after event A occurs, a Java method that iterates all ClassB instances is triggered. The ClassB iterate method should iterate ClassB objects, and trigger a certain event D on each object.

UniversalBindingViaCode1.png

Here is an example for an 'iterate' method:

UniversalBindingViaCode3.png

Now define an LSC that monitors that event D and executes even B.
When event D is monitored, a new live copy is created for the concrete object allowing execution of event B and any other required behavior for this object.

UniversalBindingViaCode2.png


Similarly, one can implement the iterate method to trigger event B on a subset of ClassB objects, subject to a certain condition. This is equivalent to defining a lifeline of type Universal Binding having a binding expression.