Skip to content

Commit

Permalink
[Issue #128, #289] Introduce the slotting algorithm in a *declarative…
Browse files Browse the repository at this point in the history
…* way.
  • Loading branch information
hayatoito committed Aug 6, 2015
1 parent ac451d5 commit a01b441
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions spec/shadow/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,54 @@ <h3>Distribution Algorithms</h3>

<p>If any condition which affects the <a>distribution result</a> changes, the <a>distribution result</a> <strong>must</strong> be updated before any use of the <a>distribution result</a>.</p>

<p>
The <dfn>slottings algorithm</dfn> <strong>must</strong> be used to determine an assigned slot for a node and <strong>must</strong> be <a lt="processing equivalence">equivalent</a> to processing the following steps:
</p>

<div class="algorithm">
<dl>
<dt>Input</dt>
<dd><var>NODE</var>, a node</dd>
<dt>Output</dt>
<dd>(nullable) <var>SLOT</var>, a <var>slot</var> to where <var>NODE</var> is assigned.</dd>
</dl>

<ol>
<li>
If the parent node of <var>NODE</var> is a <a>shadow host</a>:
<ol>
<li>Let <var>TREE</var> be the <a>shadow tree</a> that the parent node of <var>NODE</var> <a>hosts</a></li>
<li>Let <var>NAME</var> be the <a>slot name</a> of <var>NODE</var></li>
<li>
If <var>NAME</var> is missing:
<ol>
<li>
Let <var>SLOT</var> be the <a>default slot</a> for <var>TREE</var>.
If there is no default slot for <var>TREE</var>, let <var>SLOT</var> be null.
</li>
</ol>
</li>
<li>
Otherwise:
<ol>
<li>
Let <var>SLOT</var> be a slot that participates in <var>TREE</var> and has <a lt="slot-name">name</a> attribute equal to <var>NAME</var>.
If there is no such slot, let <var>SLOT</var> be null.
If there are more than one such slots, let <var>SLOT</var> be the most <a>preceding</a> one in <var>TREE</var>.
</li>
</ol>
</li>
</ol>
</li>
<li>
Otherwise:
<ol>
<li>Let <var>SLOT</var> be null</li>
</ol>
</li>
</ol>
</div>

<p>
The <dfn>get distributed nodes algorithm</dfn> <strong>must</strong> be used to determine the <a>distributed nodes</a> for a <a>slot</a> and <strong>must</strong> be <a lt="processing equivalence">equivalent</a> to processing the following steps:
</p>
Expand All @@ -454,10 +502,10 @@ <h3>Distribution Algorithms</h3>

<ol>
<li>
For each node <var>NODE</var> that is assigned to <var>SLOT</var>:
For each node <var>NODE</var> that is assigned to <var>SLOT</var>, in order from the most <a>preceding</a> one to the most <a>following</a> one:
<ol>
<li>
If NODE is a <a>slot</a>:
If <var>NODE</var> is a <a>slot</a>:
<ol>
<li>Let <var>SUB-LIST</var> be the result of (recursively) running the <a>get distributed nodes algorithm</a> with <var>NODE</var> as input</li>
<li>Append all nodes in <var>SUB-LIST</var> to <var>DISTRIBUTED-NODES</var></li>
Expand Down

0 comments on commit a01b441

Please sign in to comment.