Class Memo


  • public class Memo
    extends Object
    Stores a plan in a form that's efficient to mutate locally (i.e. without having to do full ancestor tree rewrites due to plan nodes being immutable).

    Each node in a plan is placed in a group, and it's children are replaced with symbolic references to the corresponding groups.

    For example, a plan like:

        A -> B -> C -> D
               \> E -> F
     
    would be stored as:
     root: G0
    
     G0 : { A -> G1 }
     G1 : { B -> [G2, G3] }
     G2 : { C -> G4 }
     G3 : { E -> G5 }
     G4 : { D }
     G5 : { F }
     
    Groups are reference-counted, and groups that become unreachable from the root due to mutations in a subtree get garbage-collected.