From 10f21f77f829b754e946cd4a1708ec900f4a95ec Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 12 Sep 2018 04:17:49 +0200 Subject: [PATCH] ChainSearch: resolve the problems and get basic functionality to work with the augmented TreeExplorer, we're now able to get rid of the spurious base layer, and we're able to discard the filter and continue with the unfiltered sequence starting from current position. --- src/lib/iter-chain-search.hpp | 6 ++-- tests/library/iter-chain-search-test.cpp | 15 +++++++-- wiki/thinkPad.ichthyo.mm | 39 +++++++++++++----------- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/lib/iter-chain-search.hpp b/src/lib/iter-chain-search.hpp index 1d7c19596..b1eec1949 100644 --- a/src/lib/iter-chain-search.hpp +++ b/src/lib/iter-chain-search.hpp @@ -213,14 +213,14 @@ namespace iter { /** drop all search condition frames. * @remark the filter chain becomes empty, - * passing through the unaltered - * source sequence + * passing through the reset of the + * source sequence unaltered */ IterChainSearch&& clearFilter() { - //////////////////////////////////////////////////////TODO logically broken. We need also to get rid of the current expansions, while retaining the current position stepChain_.clear(); + _Base::rootCurrent(); _Base::disableFilter(); return move(*this); } diff --git a/tests/library/iter-chain-search-test.cpp b/tests/library/iter-chain-search-test.cpp index 98ede36de..e1688776f 100644 --- a/tests/library/iter-chain-search-test.cpp +++ b/tests/library/iter-chain-search-test.cpp @@ -132,7 +132,12 @@ namespace test{ - /** @test verify the + /** @test verify consecutive application of several functors on the underlying filter. + * In the general case, each step in the chain is a function working on a copy of the + * current filter state. Since each such step configures its own copy of the complete + * pipeline, it may reconfigure this filter pipeline in arbitrary ways. After exhausting + * the last layer, the evaluation returns to the previous layer, but immediately re-applies + * the configuration step on the then next element. */ void chainedIteration () @@ -141,7 +146,13 @@ namespace test{ - /** @test verify the + /** @test verify a complex search with backtracking. + * This becomes relevant when a given search condition can be "too greedy" for the + * complete chain to succeed. Most notably this is the case when the search is fundamentally + * reconfigured in some steps, e.g. by switching the search orientation. To demonstrate this, + * we use a "gear switching" iterator, which allows us to reverse the direction and to search + * backwards from the current position. We configure the second condition in the chain such + * that it can not succeed when starting from the first match on the first condition */ void backtracking () diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 4ae9bf45f..ea5dc9102 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -31132,7 +31132,7 @@ - + @@ -31686,8 +31686,8 @@ - - + + @@ -32001,12 +32001,12 @@ - - - + + + - - + + @@ -32019,8 +32019,8 @@ - - + + @@ -32030,7 +32030,7 @@ - + @@ -32045,7 +32045,10 @@ - + + + + @@ -32105,7 +32108,7 @@ - + @@ -32140,15 +32143,15 @@ - + - - + + @@ -32200,8 +32203,8 @@ - - + +