Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Owned PCG Operations

Collapse

The operation modifies place expansions and set of place capabilities such that becomes a leaf in the forest corresponding to . Stated more formally it modifies to ensure that contains an expansion containing , and is not the base of any expansion in . Capabilities in are updated to account for the removal of expansions from .

collapse returns the set of Owned PCG Actions corresponding to the removed expansions.

This logic is very similar to the collapse defined on the (combined) PCG defined here. This is used in contexts where the Borrow PCG is not available (such as the join on owned PCGs).

We should investigate making a common operation.

The algorithm is implemented as follows:

  1. Let be the subset of place expansions in such that for each in , the base place is a prefix of .
  2. Let be an ordered list of the expansions in sorted in order of descending length of the projections of their base place
  3. Let be the list of operations to return
  4. For each in
    1. Let be the capabilities of in
    2. Let be the minimum common capabiility of .
    3. Let be the base of
    4. Remove capabilities to the places in from
    5. Assign capability to in
    6. Remove from
    7. Add to
  5. return