RelationshipBody
- class RelationshipBody
Container for relationship bodies. Works similarly to
ChildrenNodesexcept relationships are not needed and all elements are taken ownership off.TODO: add insert and replace methods.
Members defined in
RelationshipBody(7 members)
Append an owned related element. Returns newly constructed related element.
Append an owned annotation to an annotating element. Returns a pair of newly constructed (annotation, annotating element).
Removes and releases all elements in this container. Afterwards,
lenis 0.
Extracts a related element at the specified index from the model tree and returns it.
Extracts a related element from the model tree.
Removes a related element at the specified index from the model tree and returns it.
Removes a related element from the model tree. Returns
Trueif the element was removed, otherwiseFalse.Members inherited from
ContainerView(11 members)
Methods
- append(element: type[syside.TElement]) syside.TElement
Append an owned related element. Returns newly constructed related element.
- append(element: syside.TElement) syside.TElement
Append an owned existing related element. Returns the same related element.
- append_annotation(element: type[syside.RelationshipBody.append_annotation.M]) tuple[syside.Annotation, syside.RelationshipBody.append_annotation.M]
Append an owned annotation to an annotating element. Returns a pair of newly constructed (annotation, annotating element).
- append_annotation(element: syside.RelationshipBody.append_annotation.M) tuple[syside.Annotation, syside.RelationshipBody.append_annotation.M]
Append an owned annotation to an existing annotating element. Returns a pair of (annotation, annotating element) where only the annotation is newly constructed.
- clear() None
Removes and releases all elements in this container. Afterwards,
lenis 0.
- extract(index: int = -1) syside.Element
Extracts a related element at the specified index from the model tree and returns it.
Note that it is up to the user to ensure that the returned orphan element is not leaked.
Raises
IndexErrorif index is out of bounds.
- extract_element(arg: syside.RelationshipBody.extract_element.T, /) syside.RelationshipBody.extract_element.T
Extracts a related element from the model tree.
Note that it is up to the user to ensure that the returned orphan element is not leaked.
Raises
ValueErrorif there is no such element.
- pop(index: int = -1) syside.Element
Removes a related element at the specified index from the model tree and returns it.
- remove_element(arg: syside.Element, /) bool
Removes a related element from the model tree. Returns
Trueif the element was removed, otherwiseFalse.