kernel.core.primitive-operation

Primitive operation, PO for short. Primitive operations create or update only one object in a feature model at a time. They are building blocks for more complex compound operations (kernel.core.compound-operation).

Primitive operations are also used to detect conflicts for competing operations (kernel.core.conflict-relation).

_apply

multimethod

Applies a given primitive operation to a feature model. Utilizes the feature model implementation.

assert-no-child-added

(assert-no-child-added ID)

Asserts that no competing operations add children to the targeted feature. Required to ensure the preconditions of kernel.core.compound-operation/remove-feature. This assertion operation has no actual execution effect on the feature model, it only affects the conflict detection.

create-constraint

(create-constraint)

Creates a new constraint.

create-feature

(create-feature)

Creates a new feature in the feature tree that is assumed to have the default values defined in kernel.core.feature-model. Newly created features are not part of the feature tree until explicitly inserted.

description

(description & value)

description?

(description? PO)

get-attribute

(get-attribute PO)

Returns the attribute of a feature that an update PO targets.

get-constraint-attribute

(get-constraint-attribute FM ID attribute)

Returns the current value of a targeted constraint attribute in a given feature model.

get-feature-attribute

(get-feature-attribute FM ID attribute)

Returns the current value of a targeted feature attribute in a given feature model.

get-ID

(get-ID PO)

Returns the identifier in the feature model that an update PO targets.

get-key

(get-key PO)

Returns the key of a metadata PO.

get-new-value

(get-new-value PO)

Returns the new value of a feature attribute that an update PO targets.

get-old-value

(get-old-value PO)

Returns the old value of a feature attribute that an update PO targets.

get-type

(get-type PO)

Returns the type of a primitive operation.

get-value

(get-value PO)

Returns the key of a metadata PO.

icon

(icon icon)

icon?

(icon? PO)

invert

multimethod

Generates an inverse for a primitive operation. An inverse nullifies the original operation’s execution effect. Inverting an inverse yields the original operation.

Create operations do not visibly affect the feature model, they only add an entry to the feature tree/constraint map. As such, inverting a create operation does not do anything and can be a nop.

Update operations are inverted by swapping their old and new values.

Assert operations are kept unchanged as discussed in kernel.core.compound-operation/remove-feature.

inverted

(inverted)

metadata

(metadata key & value)

Adds metadata, such as a human-readable description, to a compound operation. Has no execution effect and does not affect conflict detection. All of these are only used for UI purposes.

Currently supported keys: - :inverted signifies whether an operation has been inverted - :description is a human-readable description of a CO - :icon is an (Office UI Fabric) icon associated with this CO

nop

(nop)

An operation that does nothing. Is filtered out when building a compound operation. Useful for nullifying the effect of an operation when inverting it.

remove-nop

(remove-nop POs)

Removes all nop operations from a sequence of primitive operations.

update-constraint

(update-constraint ID attribute old-value new-value)

Updates a single attribute of a constraint. For conflict detection and undo/redo, it is also necessary to store an attribute’s old value for every update.

update-feature

(update-feature ID attribute old-value new-value)

Updates a single attribute of a feature. For conflict detection and undo/redo, it is also necessary to store an attribute’s old value for every update.