Class InputCompositeUtil
Locates composites within a map's raw binding array.
Inherited Members
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public static class InputCompositeUtil
Remarks
A composite is a head binding whose path names a composite type rather than a control, immediately followed by its parts. Nothing links them: there is no parent identifier and no part count, so the grouping exists only as adjacency in the array. Any edit that moves a binding between a head and its parts silently breaks the composite, which is why structural editing needs a single place that answers where one starts and ends.
Raw array order, not an action-filtered view. The existing walks elsewhere in the module operate on the bindings of one action, where adjacency holds trivially because nothing else is in the list. Editing happens against the map's real array, where a part can be separated from its head by a binding belonging to another action entirely. That case is malformed, but it is representable, and an editor has to handle it rather than assume it away.
Methods
FindCompositeHeadIndex(IReadOnlyList<InputBindingNode>, int)
Finds the head governing a composite part.
Declaration
public static int FindCompositeHeadIndex(IReadOnlyList<InputBindingNode> bindings, int partIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<InputBindingNode> | bindings | The map's bindings, in raw document order. |
| int | partIndex | Position of the part. |
Returns
| Type | Description |
|---|---|
| int | The head's position, or |
Remarks
Walks back over contiguous parts only. A gap means the part is detached from any head, which is malformed, and this reports that rather than attaching it to whatever composite happens to lie further back. That is a deliberate difference from the conflict engine's walk, which is looser on purpose so its two feeds agree with each other; a structural editor cannot afford the same looseness, because it would move a binding into a composite it never belonged to.
TryGetCompositeExtent(IReadOnlyList<InputBindingNode>, int, out int)
Finds the extent of the composite headed at a position.
Declaration
public static bool TryGetCompositeExtent(IReadOnlyList<InputBindingNode> bindings, int headIndex, out int count)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<InputBindingNode> | bindings | The map's bindings, in raw document order. |
| int | headIndex | Position of the composite head. |
| int | count | Receives how many bindings the composite spans, including the head. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
The extent includes the head, so a head with two parts reports a count of three. A head with no parts reports a count of one, which is a malformed composite worth reporting rather than hiding: it binds nothing.
TryGetContainingExtent(IReadOnlyList<InputBindingNode>, int, out int, out int)
Finds the extent containing a position, whether it names a head or one of its parts.
Declaration
public static bool TryGetContainingExtent(IReadOnlyList<InputBindingNode> bindings, int index, out int start, out int count)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<InputBindingNode> | bindings | The map's bindings, in raw document order. |
| int | index | Any position within a composite. |
| int | start | Receives the head's position. |
| int | count | Receives how many bindings the composite spans. |
Returns
| Type | Description |
|---|---|
| bool |
|
WouldSplitComposite(IReadOnlyList<InputBindingNode>, int)
Reports whether a position lies strictly inside a composite, rather than at its head or outside one entirely.
Declaration
public static bool WouldSplitComposite(IReadOnlyList<InputBindingNode> bindings, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<InputBindingNode> | bindings | The map's bindings, in raw document order. |
| int | index | The insertion position to test. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
The test a move or a paste needs: dropping a binding between a head and its parts splits the composite, and there is no representation for that.