Element layers

Applications commonly use Element instances only.

Element subclasses must define their counterparts. These inherit from ElementPure, ElementShadowed and ElementMutant.
  • they take part in mutation, creation and accessing Element objects
  • they cooperate and handshake with core classes
    • lifecycle steps of ElementMutant
    • create instances of any of these classes
  • most of the skeleton methods are in subclasses of ElementPure
  • static final seed instances are defined
ElementPure
  • retains list of mutations
    • modifications of its primitive fields and reference fields
    • mirrors of its components or outer ElementPures
  • doesn't keep list of applied mirrors
    • ElementPure doesn't know its previous identitites
  • is not stored in other ElementPure composites
    • that's what ElementShadowed is used for
ElementShadowed
  • wraps ElementPure and Shadows
  • keeps history of applied mirrors
  • referenced from container ElementPures
Element
  • wraps ElementShadowed and Context
  • applies list of mirrors of given Context to
    • its components
    • subcomponents through deeper Contexts
    • any parameters
  • when passed to a deeper Context
    • Element gets mirrored if applicable
    • all components get mirrored when evaluated
  • if passed to an upper Context
    • the most recent Context layer is unwound
    • the mirrors which don't apply anymore get canceled
      • objects are resolved back to their previous ElementShadowed identities
  • when associated with empty Shadows and empty Context, it becomes a top-level seed

Elements and their Context

Every Element wraps its Context which
  • has a list of ElementShadowed on which methods are currenly invoked
  • includes ElementShadowed of the actual Element which wraps the Context
    • this allows the Context to merge own mirrors of ElementShadowed with mirrors of upper Context
      • mirrors can be applied in one go, rather than applying own mirrors and upper mirrors separate
      • one stack of mirror map allows chain hashing by Area
  • follows the stack of this automatic variables
  • in case of direct or indirect recursive calls on the same Elements, the Context contains these Elements just once
When an Element is passed
  • up or down
  • between non-static method calls invoked on Element this object
then any Element argument of the called method and returned result must have their Context adjusted. This assures that in any Element method, this and all Element arguments are of the same Context.
SourceForge.net Logo Copyright (c) 2005, 2006, 2007 Peter Kehl