ChainSearch: allow for overconstrained search
...which just turns the pipeline into exhausted state, instead of raising an Assertion failure The point is, expandChildren() does not guard itself, since it _requires_ an non-empty iterator as precondition. Thus, any function downstream, which invokes expandChildren(), has to check and guard this call apropriately. In the concrete case at hand we just stop adding further constraints when the pipeline is already in exhausted state
This commit is contained in:
parent
0eec4d3b5f
commit
2ca3e95e9e
3 changed files with 24 additions and 15 deletions
|
|
@ -181,14 +181,17 @@ namespace iter {
|
|||
IterChainSearch&& >
|
||||
search (FUN&& configureSearchStep)
|
||||
{
|
||||
Step nextStep{forward<FUN> (configureSearchStep)};
|
||||
|
||||
if (_Base::isDisabled())
|
||||
this-> filter() = move (nextStep (*this)); // immediately apply first step
|
||||
else //
|
||||
stepChain_.emplace_back (move (nextStep)); // append all further steps into the chain...
|
||||
// then establish invariant:
|
||||
this->iterNext(); // expand to leaf and forward to first match
|
||||
if (not this->empty())
|
||||
{
|
||||
Step nextStep{forward<FUN> (configureSearchStep)};
|
||||
|
||||
if (_Base::isDisabled())
|
||||
this-> filter() = move (nextStep (*this)); // immediately apply first step
|
||||
else //
|
||||
stepChain_.emplace_back (move (nextStep)); // append all further steps into the chain...
|
||||
// then establish invariant:
|
||||
this->iterNext(); // expand to leaf and forward to first match
|
||||
}
|
||||
return move(*this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ namespace lib {
|
|||
COR & _core() { return static_cast<COR&> (*this); }
|
||||
COR const& _core() const { return static_cast<COR const&> (*this); }
|
||||
|
||||
protected:
|
||||
void
|
||||
__throw_if_empty() const
|
||||
{
|
||||
|
|
@ -754,6 +755,7 @@ namespace lib {
|
|||
void
|
||||
iterNext()
|
||||
{
|
||||
SRC::__throw_if_empty();
|
||||
SRC::expandChildren();
|
||||
}
|
||||
};
|
||||
|
|
@ -786,6 +788,7 @@ namespace lib {
|
|||
{
|
||||
if (shallExpand_)
|
||||
{
|
||||
SRC::__throw_if_empty();
|
||||
SRC::expandChildren();
|
||||
shallExpand_ = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32106,8 +32106,6 @@
|
|||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1536539140421" ID="ID_1097764973" MODIFIED="1536539198310" TEXT="1.Lösungsansatz">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node COLOR="#338800" CREATED="1536357917385" ID="ID_1615410357" MODIFIED="1536539160556" TEXT="wenn leer, dann direkt den Basis-Layer konfigurieren">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
|
|
@ -32120,17 +32118,22 @@
|
|||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1536539323716" ID="ID_1627599615" MODIFIED="1536539353260" TEXT="einmal beim direkten Rekonfigurieren"/>
|
||||
<node CREATED="1536539357408" ID="ID_834480997" MODIFIED="1536539373834" TEXT="dann nochmal generisch"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536541001266" ID="ID_1480503625" MODIFIED="1536541008706" TEXT="in else-Zweig ziehen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536539386764" ID="ID_487266350" MODIFIED="1536539429112" TEXT="erschöpfter Iter bricht ab">
|
||||
<arrowlink COLOR="#c5789c" DESTINATION="ID_1288939799" ENDARROW="Default" ENDINCLINATION="137;-5;" ID="Arrow_ID_1528021143" STARTARROW="None" STARTINCLINATION="-146;47;"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536539386764" ID="ID_487266350" MODIFIED="1536631289616" TEXT="erschöpfter Iter bricht ab">
|
||||
<arrowlink COLOR="#c5789c" DESTINATION="ID_1288939799" ENDARROW="Default" ENDINCLINATION="99;3;" ID="Arrow_ID_1528021143" STARTARROW="None" STARTINCLINATION="-35;27;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536539286897" ID="ID_1288939799" MODIFIED="1536631289616" TEXT="overconstrained triggert Assertion">
|
||||
<linktarget COLOR="#c5789c" DESTINATION="ID_1288939799" ENDARROW="Default" ENDINCLINATION="99;3;" ID="Arrow_ID_1528021143" SOURCE="ID_487266350" STARTARROW="None" STARTINCLINATION="-35;27;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1536631251921" HGAP="51" ID="ID_588077559" MODIFIED="1536631280009" TEXT="sollte stattdessen leer werden" VSHIFT="23">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536539286897" ID="ID_1288939799" MODIFIED="1536539421685" TEXT="overconstrained triggert Assertion">
|
||||
<linktarget COLOR="#c5789c" DESTINATION="ID_1288939799" ENDARROW="Default" ENDINCLINATION="137;-5;" ID="Arrow_ID_1528021143" SOURCE="ID_487266350" STARTARROW="None" STARTINCLINATION="-146;47;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536357967826" ID="ID_634133289" MODIFIED="1536358245365" TEXT="clearFilter()">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue