OverlaySingleEdge

Represents a single edge in an overlay graph structure, linking nodes with specific properties.

Parameters

thisRef

The current node that the edge originates from or is associated with.

of

The optional target node of the edge.

mirrorProperty

The property representing a mutable collection of mirrored overlay edges.

outgoing

A flag indicating whether the edge is outgoing (default is true).

Constructors

Link copied to clipboard
constructor(thisRef: Node, of: Node?, mirrorProperty: KProperty<MutableCollection<OverlayEdge>>, outgoing: Boolean = true)

Initializes the OverlaySingleEdge instance with the provided parameters.

Properties

Link copied to clipboard

This computed property returns the common type in a Collection of Type objects. For example, if two types A and B both derive from the interface C`` then C` would be returned.

Link copied to clipboard
Link copied to clipboard
open override var init: (Node, Node) -> OverlayEdge
Link copied to clipboard
Link copied to clipboard
open override var onAdd: (OverlayEdge) -> Unit?
Link copied to clipboard
var onChanged: (old: OverlayEdge?, new: OverlayEdge?) -> Unit?
Link copied to clipboard
open override var onRemove: (OverlayEdge) -> Unit?
Link copied to clipboard
open override var outgoing: Boolean
Link copied to clipboard
open override val size: Int
Link copied to clipboard
open override var thisRef: Node

Functions

Link copied to clipboard
open fun add(target: Node, init: (Node, Node) -> OverlayEdge = this.init, builder: OverlayEdge.() -> Unit? = null): Boolean

Creates a new edge with the target node and an optional builder to include edge properties. If outgoing is true, the edge is created from thisRef ->target, otherwise from target to thisRef.

open override fun add(element: OverlayEdge): Boolean
Link copied to clipboard
open fun addAll(targets: Collection<Node>, builder: OverlayEdge.() -> Unit? = null): Boolean
open override fun addAll(elements: Collection<OverlayEdge>): Boolean
Link copied to clipboard
fun <T : Node> Collection<T>?.byNameOrNull(lookup: String, modifier: SearchModifier): T?

This function returns the first node that matches the name on the supplied list of nodes.

Link copied to clipboard
open override fun clear()
Link copied to clipboard
open fun contains(target: Node): Boolean
open operator override fun contains(element: OverlayEdge): Boolean
Link copied to clipboard
open override fun containsAll(elements: Collection<OverlayEdge>): Boolean
Link copied to clipboard
open fun <NodeType : Node, PropertyEdgeType : Edge<NodeType>> createEdge(target: NodeType, init: (Node, NodeType) -> PropertyEdgeType, outgoing: Boolean = true, builder: PropertyEdgeType.() -> Unit? = null): PropertyEdgeType
Link copied to clipboard
operator fun <T : Node> Collection<T>?.get(predicate: (T) -> Boolean, modifier: SearchModifier = SearchModifier.NONE): T?

A shortcut to call firstOrNull using the [] syntax.

operator fun <T : Node> Collection<T>?.get(lookup: String, modifier: SearchModifier = SearchModifier.NONE): T?

A shortcut to call byNameOrNull using the [] syntax.

Link copied to clipboard
open fun handleOnAdd(edge: OverlayEdge)

This function will be executed after the edge was added to the container. This can be used to propagate the edge to other properties or register additional handlers, e.g. a TypeObserver.

Link copied to clipboard
open fun handleOnRemove(edge: OverlayEdge)

This function will be executed after an edge was removed from the container. This can be used to unregister additional handlers, e.g. a TypeObserver.

Link copied to clipboard
operator fun <T : Node> Collection<T>.invoke(predicate: (T) -> Boolean): List<T>

A shortcut invoke filter on a list of nodes.

operator fun <T : Node> Collection<T>.invoke(lookup: String): List<T>

A shortcut to filter a list of nodes by their name.

Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
open operator override fun iterator(): MutableIterator<OverlayEdge>
Link copied to clipboard
open operator fun plusAssign(end: Node)
Link copied to clipboard
open fun remove(target: Node): Boolean

Removes all edges with the target node. The target is considered to be either the Edge.end or Edge.start depending on outgoing.

open override fun remove(element: OverlayEdge): Boolean
Link copied to clipboard
open override fun removeAll(elements: Collection<OverlayEdge>): Boolean
Link copied to clipboard
open fun resetTo(nodes: Collection<Node>)

Clears the collection and adds the nodes.

fun resetTo(node: Node)
Link copied to clipboard
open override fun retainAll(elements: Collection<OverlayEdge>): Boolean
Link copied to clipboard
Link copied to clipboard
open override fun toNodeCollection(predicate: (OverlayEdge) -> Boolean?): Collection<Node>

Converts this collection of edges into a collection of nodes for easier access to the "target" nodes.

Link copied to clipboard

Returns an UnwrappedEdgeCollection magic container which holds a structure that provides easy access to the "target" nodes without edge information, but is mutable and in-sync with this collection.