Graph's rootComponents shouldn't be returned out of graph root's Context - unless that's the purpose. They can be translated (mirrored) to different Elements within that graph. When they are passed outside Context of these mirrors, they get resolved to their originals.
Mirrored targets can't keep their mirrored identity outside the graph where they are mirrored. Otherwise
OLD - When a Mutation can't be referenced as an Element before it's fixed:
ElementShadowed and ElementPure graphs themselves can't be recursive. That's without considering any mirrors. ElementMutants can't create recurrent paths, because a result of mutation can't be referenced before it's fixed. See the reasons below.
Graph of Elements can be cyclic. That requires an ElementContainer which wraps the graph itself. The graph is a mutation of original graph, and it stores a reference to original graph. That's a backward reference. It doesn't involve recursion yet, because it links to old version of the graph and not to the new one. We enclose the graph in an ElementContainer wrapper, which mirrors the old net's root to its mutation. That makes the backward reference point to the new graph. Therefore the resultant net is recursive.
Recursive objects without graph's gate?
-- Mutation would need to be accessible as Element ( ElementPure with Shadows.EMPTY with Context ) before it is fixed
TODO Mutation's result-- how to assure that Element counterpart of unfixed Mutation won't be accessed (other than just stored) before it's fixed?
---- if such Element counterpart is stored in a different thread, then synchronization will need to be used
---- no need for synchronization:
------ 'unfixed' ElementPure will have original, values & mirrors set to null
------ once mutation is fixed, it uses java.reflect.Accessible to set these final null fields
------ it insures that unfixed ElementPure won't make any harm if used as 'fixed', but throws NullPointerException
------ therefore: if unfixed ElementPure is used in a different thread, it's application's responsibility to synchronized it; otherwise it might fail
- Context of unfixed ElementPure
---- MirrorsOwner chains would need to be updated
---- therefore unfixed ElementPure can't be used there
---- that's what ElementPure.fixed field will be for - to check whether the object is fixed
|Copyright (c) 2005, 2006, 2007 Peter Kehl|