Seite 1 von 1

ex4: "matchCompleted" - why complete bindings?

Verfasst: 13. Dez 2011 04:12
von tgp
I do not understand the implementation of the matchCompleted(IVariableBinding<K,V>) method in competition.monitortemplates.FailSafeIterMonitorTemplate and competition.monitortemplates.HasNextMonitorTemplate. Why do we need to have "complete" bindings with all the variables of the template?

Currently, my SymbolBasedIndexing fails at that point (the RuntimeException is thrown), because if i find a match, i pass the matchCompleted method the binding of the processEvent method, which obviously does not always contain all variables. How should we add the right "missing" ones? Or is this a bug in the mathCompleted method?

Re: ex4: "matchCompleted" - why complete bindings?

Verfasst: 13. Dez 2011 09:25
von ericbodden
Hello.

If you only pass in the binding provided by the current event then this is not an optimal solution. Imagine for example the FailSafeIter property: in this case, the user could then never find out which collection was actually updated when an error situation arises.

The solution is shown on the lecture slides on symbol-based indexing: on those slides you will see that in addition to the current state number a monitor also contains references to the objects it holds on to. That way, when a monitor reaches a final/error state, the information about the other bindings can be accessed from that monitor.

Hope that helps.

Re: ex4: "matchCompleted" - why complete bindings?

Verfasst: 13. Dez 2011 15:17
von ericbodden
Please also see my other post on object sets vs. variable bindings...

Re: ex4: "matchCompleted" - why complete bindings?

Verfasst: 13. Dez 2011 17:37
von tgp
Thx, this and the other post helped alot.