You are right for cases with failed match attempts, because the
backtracking will end with the first variable no longer being
instanciable and all domain slots unlocked. But just to clarify:
In unlock only the temporary domain of *other* domain slots (targets of
binary constraints) get reset *not* the temporary domain of the
variable
itself. Granted, all domain slots *not* being initialized by binary
constraints, still have temporaryDomain == null ;)
Still, resetting the temporary domain during clear() is neccessary for
succesful match attempts, because they end with all variables in a
valid
state. This is exactly what happend in the Comb example. The domain of
the NAC node was initialized by a binary constraint. After the NAC
matched (meaning a failed LHS match) the LHS backtracked and found
another match. Now the temporary domain of the NAC node was
incompatible
with the binary constraints of one of the other nodes.
Unlock() is an essential part of backtracking, keeping the state of all
domains consistent, clear() should reset the domain slot to its
original
state. Note that not simply creating a fresh domain slot was a design
decision based on performance, because you would have to recreate the
domainMap in ApplicationCondition for all graphs (lhs and acs).
In any case, clear() is behaving correctly, if the state after clear
corresponds to the state of a fresh DomainSlot(). If any logic in
clear() is completly redundant to unlock it can be removed (since
unlock
is called anyway by clear), but be *very* sure that is the case before
removal ;)
Cheers,
Enrico
On 12.06.2012 15:30, Christian Krause wrote:
Hi Enrico,
the DomainChange class is apparently used to store the old contents of
the temporaryDomain when it is changed (see ReferenceConstraint:52).
When unlocking a variable, this change is reverted again (see
DomainSlot:231). At this point, the temporaryDomain is reset to its
previous value. If the temporaryDomain is reset to its original values
at this point, why should it be also done in DomainSlot.clear() ?
Cheers,
Christian
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev