ChainSearch: now use the improved TreeExplorer capabilities to address the shortcoming
...the solution built thus far was logically broken, since it retained the unfiltered
source sequence within the base layer. Thus it would backtrack into this unfiltered
sequence eventually.
The idea was to build a special treatment for attaching the first filter condition;
in fact the first one does not need to be added to the chain, but rather should be
planted directly into the base layer.
WIP: this is a solution draft, but does not work yet
- when attaching the base layer, the filter is pulled twice
- an overconstrained filter raises an Assertion failure
(instead of just transitioning into exhausted state)
This commit is contained in:
parent
5b84e0e823
commit
0eec4d3b5f
2 changed files with 68 additions and 31 deletions
|
|
@ -21,13 +21,17 @@
|
|||
*/
|
||||
|
||||
|
||||
/** @file iter-cursor.hpp
|
||||
** An iterator with the ability to switch direction.
|
||||
** This wrapper relies on the ability of typical STL container iterators
|
||||
** to work in both directions, similar to std::reverse_iterator.
|
||||
** Yet it is a single, self-contained element and in compliance to the
|
||||
** ["Lumiera Forward Iterator"](iter-adapter.hpp) concept. But it has
|
||||
** the additional ability to [switch the working direction](\ref IterCursor<IT>::switchDir).
|
||||
/** @file iter-chain-search.hpp
|
||||
** Evaluation mechanism to apply a sequence of conditions onto a linear search.
|
||||
** This search algorithm is implemented on top of a tree expanding (monadic) filter pipeline,
|
||||
** to allow for backtracking. The intention is not to combine the individual conditions, but
|
||||
** rather to apply them one by one. After finding a match for the first condition, we'll search
|
||||
** for the next condition _starting at the position of the previous match_. In the most general
|
||||
** case, this immediate progression down the search chain might be too greedy; it could be that
|
||||
** we don't find a match for the next condition, but if we backtrack and first search further
|
||||
** on the previous condition, continuing with the search from that further position might
|
||||
** then lead to a match. Basically we have to try all combinations of all possible local
|
||||
** matches, to find a solution to satisfy the whole chain of conditions.
|
||||
**
|
||||
** @see IterCursor_test
|
||||
** @see iter-adapter.hpp
|
||||
|
|
@ -130,8 +134,12 @@ namespace iter {
|
|||
using Filter = typename _Trait::Filter;
|
||||
using Step = typename _Trait::StepFunctor;
|
||||
|
||||
std::vector<Step> stepChain_;
|
||||
/** @internal access embedded filter sub-Pipeline */
|
||||
Filter& filter() { return *this; }
|
||||
|
||||
/** Storage for a sequence of filter configuration functors */
|
||||
std::vector<Step> stepChain_;
|
||||
|
||||
public:
|
||||
/** Build a chain-search mechanism based on the given source data sequence.
|
||||
* @remark iterators will be copied or moved as appropriate, while from a STL compliant
|
||||
|
|
@ -144,7 +152,10 @@ namespace iter {
|
|||
IterChainSearch (SEQ&& srcData)
|
||||
: _Base{_Trait::configurePipeline (forward<SEQ> (srcData)
|
||||
,[this](Filter const& curr){ return configureFilterChain(curr); })}
|
||||
{ }
|
||||
, stepChain_{}
|
||||
{ // mark initial pristine state
|
||||
_Base::disableFilter();
|
||||
}
|
||||
|
||||
// inherited default ctor and standard copy operations
|
||||
using _Base::_Base;
|
||||
|
|
@ -170,8 +181,14 @@ namespace iter {
|
|||
IterChainSearch&& >
|
||||
search (FUN&& configureSearchStep)
|
||||
{
|
||||
stepChain_.emplace_back (Step{forward<FUN> (configureSearchStep)});
|
||||
this->iterNext(); // establish invariant: expand to leaf and forward to first match
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -200,6 +217,7 @@ namespace iter {
|
|||
{
|
||||
//////////////////////////////////////////////////////TODO logically broken. We need also to get rid of the current expansions, while retaining the current position
|
||||
stepChain_.clear();
|
||||
_Base::disableFilter();
|
||||
return move(*this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30834,8 +30834,8 @@
|
|||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1535893707036" ID="ID_650057716" MODIFIED="1536516299632" TEXT="Aufgabe: Filter erweiterbar machen">
|
||||
<linktarget COLOR="#62909b" DESTINATION="ID_650057716" ENDARROW="Default" ENDINCLINATION="135;198;" ID="Arrow_ID_1700598512" SOURCE="ID_257876647" STARTARROW="None" STARTINCLINATION="-412;-19;"/>
|
||||
<node COLOR="#338800" CREATED="1535893707036" FOLDED="true" ID="ID_650057716" MODIFIED="1536533157472" TEXT="Aufgabe: Filter erweiterbar machen">
|
||||
<linktarget COLOR="#62909b" DESTINATION="ID_650057716" ENDARROW="Default" ENDINCLINATION="99;93;" ID="Arrow_ID_1700598512" SOURCE="ID_257876647" STARTARROW="None" STARTINCLINATION="-240;-19;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1535893718194" ID="ID_177803317" MODIFIED="1535893743691" TEXT="analog zum Filter in den Itertools"/>
|
||||
<node CREATED="1535893752174" ID="ID_27030007" MODIFIED="1535893777011" TEXT="ggfs diesen dort ablösen">
|
||||
|
|
@ -31135,7 +31135,7 @@
|
|||
</node>
|
||||
<node COLOR="#435e98" CREATED="1536409170928" ID="ID_1850744645" MODIFIED="1536515953937" TEXT="Design-Probleme">
|
||||
<icon BUILTIN="go"/>
|
||||
<node COLOR="#338800" CREATED="1535919506060" ID="ID_1587572708" MODIFIED="1536516302968" TEXT="heterogene Prädikat-Typen">
|
||||
<node COLOR="#338800" CREATED="1535919506060" FOLDED="true" ID="ID_1587572708" MODIFIED="1536533103811" TEXT="heterogene Prädikat-Typen">
|
||||
<linktarget COLOR="#616f95" DESTINATION="ID_1587572708" ENDARROW="Default" ENDINCLINATION="49;-142;" ID="Arrow_ID_346491515" SOURCE="ID_1859852045" STARTARROW="None" STARTINCLINATION="-143;0;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1535919549942" ID="ID_270773242" MODIFIED="1536409271272" TEXT="das zu Beginn verwendete Filter-Prädikat legt den Typ fest">
|
||||
|
|
@ -31201,7 +31201,7 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536514257510" ID="ID_1708992184" MODIFIED="1536514273317" TEXT="2.Lösung: type erasure auf dem Funktor">
|
||||
<node COLOR="#338800" CREATED="1536514257510" FOLDED="true" ID="ID_1708992184" MODIFIED="1536533099331" TEXT="2.Lösung: type erasure auf dem Funktor">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1536514274780" ID="ID_767166560" MODIFIED="1536514286353" TEXT="läuft auch auf doppelt wrappen hinaus">
|
||||
<icon BUILTIN="idea"/>
|
||||
|
|
@ -31211,7 +31211,7 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536409302285" ID="ID_913930564" MODIFIED="1536515894710" TEXT="extrem komplexe Typen">
|
||||
<node COLOR="#338800" CREATED="1536409302285" FOLDED="true" ID="ID_913930564" MODIFIED="1536533161341" TEXT="extrem komplexe Typen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1536409316172" ID="ID_1468538186" MODIFIED="1536409340127" TEXT="Call-Traces sind nahezu unlesbar">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
|
|
@ -31327,13 +31327,13 @@
|
|||
<node COLOR="#338800" CREATED="1536451240308" ID="ID_241157222" MODIFIED="1536451273762" TEXT="den SRC-Parameter optional machen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536451256034" ID="ID_645889218" MODIFIED="1536451285944" TEXT="FunTraits sind idempotent">
|
||||
<node COLOR="#338800" CREATED="1536451256034" FOLDED="true" ID="ID_645889218" MODIFIED="1536533082014" TEXT="FunTraits sind idempotent">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<icon BUILTIN="ksmiletris"/>
|
||||
<node CREATED="1536451303308" ID="ID_1343290323" MODIFIED="1536451313142" TEXT="man kann sie mit dem Funktor aufrufen -> Sig"/>
|
||||
<node CREATED="1536451313778" ID="ID_439029617" MODIFIED="1536451336475" TEXT="man kann sie mit Sig aufrufen -> Arg, Ret"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536451345998" ID="ID_1853688774" MODIFIED="1536453357128" TEXT="Funktor-Konstruktor-Funktion">
|
||||
<node COLOR="#338800" CREATED="1536451345998" FOLDED="true" ID="ID_1853688774" MODIFIED="1536533080566" TEXT="Funktor-Konstruktor-Funktion">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1536451365731" ID="ID_552359289" MODIFIED="1536451394878" TEXT="für Aufruf aus dem Konstruktor-Kontext">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
|
|
@ -31373,7 +31373,7 @@
|
|||
</node>
|
||||
<node COLOR="#338800" CREATED="1536453317787" ID="ID_975974776" MODIFIED="1536514227734" TEXT="integrieren in...">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1536453326978" ID="ID_1071395763" MODIFIED="1536453367022" TEXT="Transformer">
|
||||
<node COLOR="#338800" CREATED="1536453326978" FOLDED="true" ID="ID_1071395763" MODIFIED="1536533075831" TEXT="Transformer">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1536455906647" ID="ID_603515158" MODIFIED="1536455919470" TEXT="im Debugger beobachtet">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
@ -31507,7 +31507,7 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536453419141" ID="ID_564310637" MODIFIED="1536515837769" TEXT="vereinfachen">
|
||||
<node COLOR="#338800" CREATED="1536453419141" FOLDED="true" ID="ID_564310637" MODIFIED="1536533077535" TEXT="vereinfachen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1536515844176" ID="ID_1550470066" MODIFIED="1536515856523" TEXT="nested Functor fällt weg"/>
|
||||
<node CREATED="1536515857230" ID="ID_1234982362" MODIFIED="1536515868816" TEXT="zugehörige Builder fallen weg"/>
|
||||
|
|
@ -31570,8 +31570,8 @@
|
|||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1535893707036" ID="ID_257876647" MODIFIED="1536516299632" TEXT="Aufgabe: Filter erweiterbar machen">
|
||||
<arrowlink COLOR="#62909b" DESTINATION="ID_650057716" ENDARROW="Default" ENDINCLINATION="135;198;" ID="Arrow_ID_1700598512" STARTARROW="None" STARTINCLINATION="-412;-19;"/>
|
||||
<node COLOR="#338800" CREATED="1535893707036" ID="ID_257876647" MODIFIED="1536533157472" TEXT="Aufgabe: Filter erweiterbar machen">
|
||||
<arrowlink COLOR="#62909b" DESTINATION="ID_650057716" ENDARROW="Default" ENDINCLINATION="99;93;" ID="Arrow_ID_1700598512" STARTARROW="None" STARTINCLINATION="-240;-19;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1535899922873" ID="ID_1971708144" MODIFIED="1535937992260" TEXT="bestehende Aufrufe in EventMatch konsolidieren">
|
||||
|
|
@ -32093,26 +32093,45 @@
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536357878006" ID="ID_1225195123" MODIFIED="1536358257081" TEXT="Aufräumen und nachrüsten">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536357891412" ID="ID_942897075" MODIFIED="1536358349759" TEXT="den Basis-Layer eliminieren">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536357891412" ID="ID_942897075" MODIFIED="1536533200019" TEXT="den Basis-Layer eliminieren">
|
||||
<linktarget COLOR="#4471b4" DESTINATION="ID_942897075" ENDARROW="Default" ENDINCLINATION="37;-79;" ID="Arrow_ID_537236489" SOURCE="ID_1163131751" STARTARROW="None" STARTINCLINATION="30;44;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536357900635" ID="ID_646733499" MODIFIED="1536358247780" TEXT="brauche einen "leer"-Status im Filter">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1536357900635" ID="ID_646733499" MODIFIED="1536533192790" TEXT="brauche einen "leer"-Status im Filter">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1536367745114" ID="ID_945289619" MODIFIED="1536367753030" TEXT="explizit als bool-Flag">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536367754089" ID="ID_649387933" MODIFIED="1536516051923" TEXT="im Filter-Funktor verstecken">
|
||||
<node CREATED="1536367754089" ID="ID_649387933" MODIFIED="1536533189307" TEXT="im Filter-Funktor verstecken">
|
||||
<arrowlink COLOR="#67ac9b" DESTINATION="ID_109911994" ENDARROW="Default" ENDINCLINATION="1326;0;" ID="Arrow_ID_1556921295" STARTARROW="None" STARTINCLINATION="142;0;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536357917385" ID="ID_1615410357" MODIFIED="1536358250507" TEXT="wenn leer, dann direkt den Basis-Layer konfigurieren">
|
||||
<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>
|
||||
<node COLOR="#338800" CREATED="1536357952068" ID="ID_876149668" MODIFIED="1536539163737" TEXT="nur an die Kette anfügen, wenn nicht leer">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536539178616" HGAP="1" ID="ID_708494808" MODIFIED="1536539195867" TEXT="defekt" VSHIFT="20">
|
||||
<icon BUILTIN="broken-line"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536539306399" ID="ID_639133520" MODIFIED="1536539400436" TEXT="Basis-Layer wird zwei mal gepullt">
|
||||
<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>
|
||||
<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;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536357952068" ID="ID_876149668" MODIFIED="1536358251475" TEXT="nur an die Kette anfügen, wenn nicht leer">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</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"/>
|
||||
<node CREATED="1536357973769" ID="ID_33678789" MODIFIED="1536358316984" TEXT="brauche Unterstützung vom Expander">
|
||||
|
|
|
|||
Loading…
Reference in a new issue