LocationSolver: draft the success cases for a location solution
This commit is contained in:
parent
66bbf146a6
commit
f8dd3a7030
3 changed files with 53 additions and 27 deletions
|
|
@ -361,6 +361,14 @@ namespace interact {
|
||||||
and res_.depth == this->uic_.size();
|
and res_.depth == this->uic_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** synonymous to #isCovered() */
|
||||||
|
bool
|
||||||
|
isCoveredTotally() const
|
||||||
|
{
|
||||||
|
return isCovered();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** determine if a mutation is possible to get the path (partially) covered.
|
/** determine if a mutation is possible to get the path (partially) covered.
|
||||||
* @remarks in order to be successful, a path resolution must interpolate any gaps in the
|
* @remarks in order to be successful, a path resolution must interpolate any gaps in the
|
||||||
* path spec _and_ reach a point behind / below the gap (wildcards), where an existing
|
* path spec _and_ reach a point behind / below the gap (wildcards), where an existing
|
||||||
|
|
|
||||||
|
|
@ -71,32 +71,21 @@ namespace interact {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LocationClause
|
struct LocationClause
|
||||||
: boost::noncopyable
|
: boost::noncopyable
|
||||||
{
|
{
|
||||||
UICoord pattern_;
|
UICoord pattern;
|
||||||
bool createParents_;
|
bool createParents;
|
||||||
|
|
||||||
public:
|
|
||||||
LocationClause (UICoord && locationPattern, bool createParents =false)
|
LocationClause (UICoord && locationPattern, bool allowCreate =false)
|
||||||
: pattern_{move (locationPattern)}
|
: pattern{move (locationPattern)}
|
||||||
, createParents_{createParents}
|
, createParents{allowCreate}
|
||||||
{ }
|
{ }
|
||||||
LocationClause (LocationClause && rr)
|
LocationClause (LocationClause && rr)
|
||||||
: pattern_{move (rr.pattern_)}
|
: pattern{move (rr.pattern)}
|
||||||
, createParents_{rr.createParents_}
|
, createParents{rr.createParents}
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
operator UICoord const&() const
|
|
||||||
{
|
|
||||||
return pattern_;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t
|
|
||||||
size() const
|
|
||||||
{
|
|
||||||
return pattern_.size();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -182,7 +171,7 @@ namespace interact {
|
||||||
* Solve for a location according to the given location rule.
|
* Solve for a location according to the given location rule.
|
||||||
* @param depth desired kind of UI element (and thus the depth in the UI topology tree)
|
* @param depth desired kind of UI element (and thus the depth in the UI topology tree)
|
||||||
* @param elementType designator of the specific element to be created at that level
|
* @param elementType designator of the specific element to be created at that level
|
||||||
* @return a explicit location, resolved against the current UI topology. May be empty
|
* @return an explicit location, resolved against the current UI topology. May be empty
|
||||||
* @remarks the returned path is either empty (no solution exists), or it is "partially covered"
|
* @remarks the returned path is either empty (no solution exists), or it is "partially covered"
|
||||||
* by the existing UI; here, the "covered" part are the already existing UI elements,
|
* by the existing UI; here, the "covered" part are the already existing UI elements,
|
||||||
* while the remaining, uncovered extension describes additional elements to be created.
|
* while the remaining, uncovered extension describes additional elements to be created.
|
||||||
|
|
@ -196,12 +185,26 @@ namespace interact {
|
||||||
{
|
{
|
||||||
for (auto& clause : rule)
|
for (auto& clause : rule)
|
||||||
{
|
{
|
||||||
if (clause.size() > depth+1) continue;
|
if (clause.pattern.size() > depth+1) continue;
|
||||||
UICoordResolver resolver{clause, getLocationQuery()};
|
UICoordResolver resolver{clause.pattern, getLocationQuery()};
|
||||||
resolver.coverPartially();
|
resolver.coverPartially();
|
||||||
if (not isnil (resolver))
|
if (clause.createParents)
|
||||||
return move (resolver);
|
{
|
||||||
//////////////////////////////TODO this is only the more relaxed "create" case
|
if (not isnil (resolver))
|
||||||
|
//////////////////////////////////////TODO ensure correct depth. Possibly append element itself
|
||||||
|
return move (resolver);
|
||||||
|
else
|
||||||
|
if (clause.pattern.isExplicit())
|
||||||
|
// allow creation of a totally new path
|
||||||
|
// as long as it is complete and explicitly given
|
||||||
|
return clause.pattern;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (not isnil (resolver) and resolver.isCoveredTotally())
|
||||||
|
//////////////////////////////////////TODO ensure correct depth. Possibly append element itself
|
||||||
|
return move (resolver);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9960,6 +9960,9 @@
|
||||||
<icon BUILTIN="flag-yellow"/>
|
<icon BUILTIN="flag-yellow"/>
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518055394000" ID="ID_1230502265" MODIFIED="1518055399228" TEXT="alles bis auf Komponente selber">
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518055394000" ID="ID_1230502265" MODIFIED="1518055399228" TEXT="alles bis auf Komponente selber">
|
||||||
<icon BUILTIN="flag-yellow"/>
|
<icon BUILTIN="flag-yellow"/>
|
||||||
|
<node CREATED="1518143878531" ID="ID_780612574" MODIFIED="1518143891082" TEXT="d.h. muß total covered sein">
|
||||||
|
<icon BUILTIN="idea"/>
|
||||||
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518055400412" ID="ID_1517580371" MODIFIED="1518055426432">
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518055400412" ID="ID_1517580371" MODIFIED="1518055426432">
|
||||||
<richcontent TYPE="NODE"><html>
|
<richcontent TYPE="NODE"><html>
|
||||||
|
|
@ -9981,7 +9984,7 @@
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518055442607" ID="ID_93235547" MODIFIED="1518055447159" TEXT="partielle coverage erlauben">
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518055442607" ID="ID_93235547" MODIFIED="1518055447159" TEXT="partielle coverage erlauben">
|
||||||
<icon BUILTIN="flag-yellow"/>
|
<icon BUILTIN="flag-yellow"/>
|
||||||
</node>
|
</node>
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518055453981" ID="ID_1927049673" MODIFIED="1518055539515" TEXT="Frage: totale Neuerzeugung unterstützen?">
|
<node COLOR="#338800" CREATED="1518055453981" ID="ID_1927049673" MODIFIED="1518145561724" TEXT="Frage: totale Neuerzeugung unterstützen?">
|
||||||
<richcontent TYPE="NOTE"><html>
|
<richcontent TYPE="NOTE"><html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
|
|
@ -9997,9 +10000,21 @@
|
||||||
</html>
|
</html>
|
||||||
</richcontent>
|
</richcontent>
|
||||||
<icon BUILTIN="help"/>
|
<icon BUILTIN="help"/>
|
||||||
|
<node CREATED="1518145517036" ID="ID_272248384" MODIFIED="1518145520391" TEXT="ja">
|
||||||
|
<icon BUILTIN="yes"/>
|
||||||
|
</node>
|
||||||
|
<node COLOR="#338800" CREATED="1518145521684" ID="ID_17194778" MODIFIED="1518145547345" TEXT="ungedeckter Pfad muß explizit sein">
|
||||||
|
<icon BUILTIN="button_ok"/>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
</node>
|
||||||
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518145595274" ID="ID_1539200142" MODIFIED="1518145607193" TEXT="in jedem Fall korrekte Länge sicherstellen">
|
||||||
|
<icon BUILTIN="flag-yellow"/>
|
||||||
|
</node>
|
||||||
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518145778249" ID="ID_462394658" MODIFIED="1518145795919" TEXT="Fälle geschickt zusammenfassen (duplikate Aktionen)">
|
||||||
|
<icon BUILTIN="flag-yellow"/>
|
||||||
|
</node>
|
||||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1517507082826" ID="ID_1177191870" MODIFIED="1517507092970" TEXT="Rückgabe per Value">
|
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1517507082826" ID="ID_1177191870" MODIFIED="1517507092970" TEXT="Rückgabe per Value">
|
||||||
<icon BUILTIN="flag-yellow"/>
|
<icon BUILTIN="flag-yellow"/>
|
||||||
</node>
|
</node>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue