scalax.collection.constrained.constraints
Creates a new constraint of the type ConstraintBinaryOp
with pre- and post-check methods
each of which returning true
if both this
' and that
's corresponding
pre- and post-checks return true
.
Creates a new constraint of the type ConstraintBinaryOp
with pre- and post-check methods
each of which returning true
if both this
' and that
's corresponding
pre- and post-checks return true
.
Consolidates all inner nodes of the arguments by adding the edge ends
of passedEdges
to passedNodes
.
Consolidates all inner nodes of the arguments by adding the edge ends
of passedEdges
to passedNodes
.
Consolidates all outer nodes of the arguments by adding the edge ends
of passedEdges
to passedNodes
.
Consolidates all outer nodes of the arguments by adding the edge ends
of passedEdges
to passedNodes
.
Checks within any preSubtract
whether the neighborhood of the elements
to be subtracted remains connected after the subtraction thus preventing
a full traversal of the graph.
Checks within any preSubtract
whether the neighborhood of the elements
to be subtracted remains connected after the subtraction thus preventing
a full traversal of the graph.
nodes in the neighborhood of the nodes/edges to be subtracted.
nodes to be subtracted.
edges to be subtracted.
true
if all nodes in include
are connected.
This handler is called whenever an addition violates the constraints.
This handler is called whenever an addition violates the constraints. The provided default implementation is empty.
the nodes passed to preAdd
.
the edges passed to preAdd
.
must be true if the handler has been overridden but it doesn't throw an exception.
This handler is called whenever a subtraction violates the constraints.
This handler is called whenever a subtraction violates the constraints. The provided default implementation is empty.
the nodes passed to preSubtract
.
the edges passed to preSubtract
.
must be true if the handler has been overridden but it doesn't throw an exception.
Check the whole newGraph
.
Check the whole newGraph
.
the after-addition would-be graph waiting for commit.
nodes passed to the running add operation except those coming from node/edge input streams.
edges passed to the running add operation except those coming from edge input streams.
This post-check must return whether newGraph
should be committed or the subtraction
is to be rolled back.
This post-check must return whether newGraph
should be committed or the subtraction
is to be rolled back.
Use self
to access the associated graph.
For immutable graphs, self
maintains the state before the
addition but for mutable graphs, it is already mutated to the required state.
the after-subtraction would-be graph waiting for commit.
Complete
if elems
build a connected graph and at least one node of elems
is already contained; otherwise Abort
.
Complete
if elems
build a connected graph and at least one node of elems
is already contained; otherwise Abort
.
nodes and/or edges to be added possibly containing duplicates.
The results of the pre-check containing the follow-up activity
and possible any intermediate computation results to be used during the
post-check. To add computation results PreCheckResult
must be extended.
Complete
if edge
itself or at least one end of edge
is already contained;
otherwise Abort
.
Complete
if edge
itself or at least one end of edge
is already contained;
otherwise Abort
.
to be added.
The results of the pre-check containing the follow-up activity
and possible any intermediate computation results to be used during the
post-check. To add computation results PreCheckResult
must be extended.
Complete
if node
is contained even though no addition will be performed;
otherwise Abort
because node
would become isolated.
Complete
if node
is contained even though no addition will be performed;
otherwise Abort
because node
would become isolated.
to be added
The results of the pre-check containing the follow-up activity
and possible any intermediate computation results to be used during the
post-check. To add computation results PreCheckResult
must be extended.
Skips this pre-check to rely on the post-check postAdd
except for trivial cases.
Skips this pre-check to rely on the post-check postAdd
except for trivial cases.
the outer nodes the graph is to be populated with; nodes
being edge ends may but need not be contained in nodes
.
the outer edges the graph is to be populated with.
The results of the pre-check containing the follow-up activity
and possible any intermediate computation results to be used during the
post-check. To add computation results PreCheckResult
must be extended.
This pre-check must return Abort
if the subtraction of nodes
and/or edges
is to be canceled, PostCheck
if postSubtract
is to be called to decide or
Complete
if nodes
and/or edges
are allowed to be subtracted.
This pre-check must return Abort
if the subtraction of nodes
and/or edges
is to be canceled, PostCheck
if postSubtract
is to be called to decide or
Complete
if nodes
and/or edges
are allowed to be subtracted.
It is typically triggered by the --
operation.
The default implementation element-wise calls preSubtract(node, simple)
or
preSubtract(edge, simple)
, respectively.
As for most cases this won't be satisfactory a domain-specific implementation
should be provided.
Use self
to access the associated graph.
the inner nodes to be subtracted not necessarily including the ends of edges to be subtracted. Call allNodes to get the complete set of nodes to be subtracted.
the inner edges to be subtracted.
true
for standard (edge-only by -
),
false
for ripple (by -!
) removal.
The results of the pre-check containing the follow-up activity
and possible any intermediate computation results to be used during the
post-check. To add computation results PreCheckResult
must be extended.
This pre-check must return Abort
if the subtraction of edge
is to be canceled,
PostCheck
if postSubtract
is to be called to decide or
Complete
if the the edge
is allowed to be subtracted.
This pre-check must return Abort
if the subtraction of edge
is to be canceled,
PostCheck
if postSubtract
is to be called to decide or
Complete
if the the edge
is allowed to be subtracted.
This pre-check may be omitted by letting it always return postCheck
and overriding the corresponding post-check commit*
method.
Use self
to access the associated graph.
the inner edge to be subtracted.
true
for standard (edge-only by -
),
false
for ripple (by -!
) removal.
The results of the pre-check containing the follow-up activity
and possible any intermediate computation results to be used during the
post-check. To add computation results PreCheckResult
must be extended.
This pre-check must return Abort
if the subtraction of node
is to be canceled,
PostCheck
if postSubtract
is to be called to decide or
Complete
if the the node
is allowed to be subtracted.
This pre-check must return Abort
if the subtraction of node
is to be canceled,
PostCheck
if postSubtract
is to be called to decide or
Complete
if the the node
is allowed to be subtracted.
This pre-check may be omitted by letting it always return postCheck
and overriding the corresponding post-check commit*
method.
Use self
to access the associated graph.
the inner to be subtracted.
true
for standard (ripple by -
), false
for gentle (by -?
) removal.
The results of the pre-check containing the follow-up activity
and possible any intermediate computation results to be used during the
post-check. To add computation results PreCheckResult
must be extended.
When extending Constraint
, self
will denote the attached constrained graph.
When extending Constraint
, self
will denote the attached constrained graph.
The factory methods of the companion object scalax.collection.constrained.Graph
initialize self
to the correct graph instance.
When extending Constrained
, self
will denote this
graph.
Creates a new constraint of the type ConstraintBinaryOp
with pre- and post-check methods
each of which returning true
if either this
' or other
's corresponding
pre- and post-checks returns true
.
Creates a new constraint of the type ConstraintBinaryOp
with pre- and post-check methods
each of which returning true
if either this
' or other
's corresponding
pre- and post-checks returns true
.
(connected: OuterNode[Connected[N, E]]).toString()
Ensures that the underlying
Graph
is connected if it is undirected or weakly connected if it is directed.