From 2a87a80e333249dc112ec152df71cf2f90538689 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 4 Jan 2018 03:56:41 +0100 Subject: [PATCH] Navigator: implement interpolation of missing anchor prefix --- src/gui/interact/ui-coord-resolver.cpp | 15 +++- wiki/thinkPad.ichthyo.mm | 112 +++++++++++++++---------- 2 files changed, 83 insertions(+), 44 deletions(-) diff --git a/src/gui/interact/ui-coord-resolver.cpp b/src/gui/interact/ui-coord-resolver.cpp index 111852ce5..55caea76a 100644 --- a/src/gui/interact/ui-coord-resolver.cpp +++ b/src/gui/interact/ui-coord-resolver.cpp @@ -112,9 +112,19 @@ namespace interact { bool UICoordResolver::pathResolution() { + // Helper to detect a wildcard match + auto wildMatch = [&](Literal patt, Literal curr, size_t depth) + { + return patt == Symbol::ANY + or patt == Symbol::EMPTY + or (isAnchored() and curr == res_.anchor and depth == UIC_WINDOW); + }; // transitive argument: assuming res_.anchor was computed for + // the same coordinate pattern used here for patch resolution + // algorithm state size_t maxDepth = 0; PathManipulator coverage; size_t coordDepth = this->uic_.size(); + auto searchAlgo = query_.getChildren (uic_, 0) .expandOnIteration() .filter ([&](auto& iter) @@ -125,7 +135,7 @@ namespace interact { Literal patt = uic_[depth]; // pick search pattern component at that depth Literal curr = *iter; // iterator points at current tree position (ID) if (patt == curr or // if either direct match - patt == Symbol::ANY) // or wildcard match + wildMatch(patt,curr,depth)) // or wildcard match { coverage.setAt (depth,curr); // record match rsp. interpolate wildcard into output iter.expandChildren(); // next iteration will match one level down into the tree @@ -143,7 +153,8 @@ namespace interact { { return coverage.retrieveResult(); }); - // we know for sure now if coverage is possible + // is (partial) coverage possible? + // search computes definitive answer! res_.isResolved = true; // perform the matching diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 4ebd2373b..447892482 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -8356,8 +8356,8 @@ - - + + @@ -8415,8 +8415,8 @@ - - + + @@ -8462,23 +8462,47 @@ - - - - + + + + - - + + - - + + - - + + + + + + +

+ ...insofern wir nur eine (partielle) Lösung signalisieren, +

+

+ wenn wir einen direkten Match erziehlen. +

+

+ Ein wildcard-Match führt nur dazu, daß wir zu den Kindern absteigen, +

+

+ aber zählt erst mal für sich nicht als Lösung +

+ + +
+
+ + + + @@ -8566,8 +8590,8 @@ - - + + @@ -8589,57 +8613,61 @@ - - + + + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - + + + - + + - + @@ -8657,17 +8685,17 @@ - - + + - + - + - + @@ -8682,9 +8710,9 @@ - + - +