flip logic of emptySrc -> hasSrc
..as concluded from the preceding analysis. NOTE this entails a semantical change, since this predicate is now only meant to be indicative, not conclusive remarks: the actual implementation of the diff application process as bound via the TreeMutator remains yet to be written...
This commit is contained in:
parent
f72e50bd3c
commit
b47b4c3f94
7 changed files with 64 additions and 30 deletions
|
|
@ -402,10 +402,10 @@ namespace diff{
|
|||
}
|
||||
|
||||
virtual bool
|
||||
emptySrc () override
|
||||
hasSrc () override
|
||||
{
|
||||
return !pos_
|
||||
and PAR::emptySrc();
|
||||
return pos_
|
||||
or PAR::hasSrc();
|
||||
}
|
||||
|
||||
/** ensure the next recorded source element
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ namespace diff{
|
|||
Mutator& out() { return scopes_.top().target; }
|
||||
Content& src() { return scopes_.top().content; }
|
||||
Iter& srcPos() { return scopes_.top().content.pos; }
|
||||
bool endOfData() { return srcPos() == src().end(); }
|
||||
bool endOfData() { return srcPos() == src().end(); } /////TODO split into an actual scope end check and an non-null check
|
||||
Rec& alteredRec() { return out(); }
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -225,9 +225,9 @@
|
|||
}
|
||||
|
||||
virtual bool
|
||||
emptySrc () override
|
||||
hasSrc () override
|
||||
{
|
||||
return !pos_;
|
||||
return pos_;
|
||||
}
|
||||
|
||||
/** ensure the next recorded source element
|
||||
|
|
|
|||
|
|
@ -201,9 +201,9 @@ namespace diff{
|
|||
/* ==== operation API ==== */
|
||||
|
||||
virtual bool
|
||||
emptySrc ()
|
||||
hasSrc ()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
// do nothing by default
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ namespace test{
|
|||
.attachDummy (target);
|
||||
|
||||
CHECK (isnil (target));
|
||||
CHECK (mutator.emptySrc());
|
||||
CHECK (not mutator.hasSrc());
|
||||
|
||||
mutator.injectNew (ATTRIB1);
|
||||
CHECK (!isnil (target));
|
||||
|
|
@ -159,7 +159,7 @@ namespace test{
|
|||
.before("attachMutator"));
|
||||
|
||||
CHECK (isnil (target)); // the "visible" new content is still void
|
||||
CHECK (not mutator2.emptySrc()); // content was moved into hidden "src" buffer
|
||||
CHECK (mutator2.hasSrc()); // content was moved into hidden "src" buffer
|
||||
CHECK (target.showSrcBuffer() == "α = 1, γ = 3.45, γ = 3.45, b, b, 78:56:34.012");
|
||||
|
||||
CHECK (mutator2.matchSrc (ATTRIB1)); // current head element of src "matches" the given spec
|
||||
|
|
@ -173,32 +173,32 @@ namespace test{
|
|||
CHECK (mutator2.acceptSrc (ATTRIB1)); // now pick and accept this src element // acceptSrc
|
||||
CHECK (target.showContent() == "γ = 3.45, α = 1");
|
||||
|
||||
CHECK (not mutator2.emptySrc()); // next we have to clean up waste
|
||||
CHECK (mutator2.hasSrc()); // next we have to clean up waste
|
||||
mutator2.skipSrc(); // left behind by the findSrc() operation // skipSrc
|
||||
CHECK (target.showContent() == "γ = 3.45, α = 1");
|
||||
|
||||
mutator2.injectNew (ATTRIB2); // injectNew
|
||||
CHECK (not mutator2.emptySrc());
|
||||
CHECK (mutator2.hasSrc());
|
||||
CHECK (mutator2.matchSrc (ATTRIB3));
|
||||
CHECK (mutator2.acceptSrc (ATTRIB3)); // acceptSrc
|
||||
CHECK (target.showContent() == "γ = 3.45, α = 1, β = 2, γ = 3.45");
|
||||
|
||||
// now proceeding with the children.
|
||||
// NOTE: the TestWireTap / TestMutationTarget does not enforce the attribute / children distinction!
|
||||
CHECK (not mutator2.emptySrc());
|
||||
CHECK (mutator2.hasSrc());
|
||||
CHECK (mutator2.matchSrc (CHILD_B)); // first child waiting in src is CHILD_B
|
||||
mutator2.skipSrc(); // ...which will be skipped (and thus discarded) // skipSrc
|
||||
mutator2.injectNew (SUB_NODE); // inject a new nested sub-structure here // injectNew
|
||||
CHECK (mutator2.matchSrc (CHILD_B)); // yet another B-child is waiting
|
||||
CHECK (not mutator2.findSrc (CHILD_A)); // unsuccessful find operation won't do anything
|
||||
CHECK (not mutator2.emptySrc());
|
||||
CHECK (mutator2.hasSrc());
|
||||
CHECK (mutator2.matchSrc (CHILD_B)); // child B still waiting, unaffected
|
||||
CHECK (not mutator2.acceptSrc (CHILD_T)); // refusing to accept/pick a non matching element
|
||||
CHECK (mutator2.matchSrc (CHILD_B)); // child B still patiently waiting, unaffected
|
||||
CHECK (mutator2.acceptSrc (CHILD_B)); // acceptSrc
|
||||
CHECK (mutator2.matchSrc (CHILD_T));
|
||||
CHECK (mutator2.acceptSrc (CHILD_T)); // acceptSrc
|
||||
CHECK (mutator2.emptySrc()); // source contents exhausted
|
||||
CHECK (not mutator2.hasSrc()); // source contents exhausted
|
||||
CHECK (not mutator2.acceptSrc (CHILD_T));
|
||||
CHECK (target.verify("attachMutator")
|
||||
.beforeEvent("injectNew","78:56:34.012")
|
||||
|
|
@ -249,7 +249,7 @@ namespace test{
|
|||
TreeMutator::MutatorBuffer placementHandle(subMutatorBuffer);
|
||||
|
||||
CHECK (mutator3.mutateChild (SUB_NODE, placementHandle));
|
||||
CHECK (subMutatorBuffer->emptySrc()); // ...this is all we can do here
|
||||
CHECK (not subMutatorBuffer->hasSrc()); // ...this is all we can do here
|
||||
// the real implementation would instead find a suitable
|
||||
// sub-mutator within this buffer and recurse into that.
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ namespace test{
|
|||
// --- first round: populate the collection ---
|
||||
|
||||
CHECK (isnil (target));
|
||||
CHECK (mutator1.emptySrc());
|
||||
CHECK (not mutator1.hasSrc());
|
||||
|
||||
mutator1.injectNew (ATTRIB1);
|
||||
CHECK (!isnil (target));
|
||||
|
|
@ -412,14 +412,14 @@ namespace test{
|
|||
mutator2.injectNew (SUB_NODE); // inject a nested sub-structure (implementation defined) // injectNew
|
||||
CHECK (mutator2.matchSrc (CHILD_B)); // yet another B-child is waiting
|
||||
CHECK (not mutator2.findSrc (CHILD_A)); // unsuccessful find operation won't do anything
|
||||
CHECK (not mutator2.emptySrc());
|
||||
CHECK (mutator2.hasSrc());
|
||||
CHECK (mutator2.matchSrc (CHILD_B)); // child B still waiting, unaffected
|
||||
CHECK (not mutator2.acceptSrc (CHILD_T)); // refusing to accept/pick a non matching element
|
||||
CHECK (mutator2.matchSrc (CHILD_B)); // child B still patiently waiting, unaffected
|
||||
CHECK (mutator2.acceptSrc (CHILD_B)); // acceptSrc
|
||||
CHECK (mutator2.matchSrc (CHILD_T));
|
||||
CHECK (mutator2.acceptSrc (CHILD_T)); // acceptSrc
|
||||
CHECK (mutator2.emptySrc()); // source contents exhausted
|
||||
CHECK (not mutator2.hasSrc()); // source contents exhausted
|
||||
CHECK (not mutator2.acceptSrc (CHILD_T)); // ...anything beyond is NOP
|
||||
|
||||
// verify reordered shape
|
||||
|
|
@ -516,7 +516,7 @@ namespace test{
|
|||
CHECK (mutator3.mutateChild (SUB_NODE, placementHandle));
|
||||
|
||||
CHECK (isnil (subScopes[SUB_NODE.idi])); // ...this is where the nested mutator is expected to work on
|
||||
CHECK (subMutatorBuffer->emptySrc());
|
||||
CHECK (not subMutatorBuffer->hasSrc());
|
||||
|
||||
// now use the Mutator *interface* to talk to the nested mutator...
|
||||
// This code might be confusing, because in fact we're playing two roles here!
|
||||
|
|
|
|||
|
|
@ -8214,7 +8214,7 @@ On receiving the terms of this "diff language", it is possible to gene
|
|||
i.e. a ''unified diff'' or the ''predicate notation'' used above to describe the list diffing algorithm, just by accumulating changes.
|
||||
</pre>
|
||||
</div>
|
||||
<div title="TreeMutator" creator="Ichthyostega" modifier="Ichthyostega" created="201503292115" modified="201605241828" tags="Model Concepts GuiPattern design draft" changecount="80">
|
||||
<div title="TreeMutator" creator="Ichthyostega" modifier="Ichthyostega" created="201503292115" modified="201605241907" tags="Model Concepts GuiPattern design draft" changecount="81">
|
||||
<pre>The TreeMutator is an intermediary to translate a generic structure pattern into heterogeneous local invocation sequences.
|
||||
within the [[diff framework|TreeDiffModel]], this is a crucial joint, since here the abstract, generic, ~DOM-like ExternalTreeDescription meeds opaque, local and undisclosed data structures.
|
||||
|
||||
|
|
@ -8275,8 +8275,8 @@ the building blocks, from which such a diff application can be combined, are emb
|
|||
:''none'' given. If diff application fails, data is possibly partially transformed, partially in the old state buffer. Thus data is //corrupted.//
|
||||
;old sequence position
|
||||
:during diff application, the old state sequence is traversed once. There is an implicit position.
|
||||
;operation {{{emptySrc}}}
|
||||
:determine if the old state sequence is empty, i.e. there are no further elements waiting from the old state sequence
|
||||
;operation {{{hasSrc}}}
|
||||
:determine if there are further elements waiting from the old state sequence (to be either picked in the new sequence or discarded)
|
||||
;operation {{{skipSrc}}}
|
||||
:skip the next element in the old state sequence, effectively dropping it into obsolescence
|
||||
;operation {{{injectNew}}}
|
||||
|
|
|
|||
|
|
@ -609,7 +609,7 @@
|
|||
<node CREATED="1455669331448" ID="ID_1852578403" MODIFIED="1455669333036" TEXT="für find"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#ad014c" CREATED="1455669200945" FOLDED="true" HGAP="85" ID="ID_880765624" MODIFIED="1461880936015" TEXT="Design-Fragen" VSHIFT="-14">
|
||||
<node COLOR="#ad014c" CREATED="1455669200945" HGAP="85" ID="ID_880765624" MODIFIED="1464117168136" TEXT="Design-Fragen" VSHIFT="-14">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#4e1527" CREATED="1458408700205" ID="ID_685778920" MODIFIED="1458409890048" TEXT="Grundansatz">
|
||||
|
|
@ -972,9 +972,9 @@
|
|||
</html></richcontent>
|
||||
<cloud COLOR="#fce9c0"/>
|
||||
<font NAME="SansSerif" SIZE="16"/>
|
||||
<node CREATED="1455927425726" ID="ID_1776437339" MODIFIED="1461946503410" TEXT="emptySrc">
|
||||
<node CREATED="1455927425726" ID="ID_1776437339" MODIFIED="1464117059267" TEXT="hasSrc">
|
||||
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
|
||||
<node CREATED="1455928216420" ID="ID_662720483" MODIFIED="1461946588807" TEXT="no further src elements available"/>
|
||||
<node CREATED="1455928216420" ID="ID_662720483" MODIFIED="1464117064570" TEXT="further src elements available"/>
|
||||
</node>
|
||||
<node CREATED="1455927425726" ID="ID_1759686725" MODIFIED="1457120215833" TEXT="skipSrc">
|
||||
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
|
||||
|
|
@ -3140,9 +3140,30 @@
|
|||
</p>
|
||||
</body>
|
||||
</html></richcontent>
|
||||
<node CREATED="1455927425726" ID="ID_1774195026" MODIFIED="1461946503410" TEXT="emptySrc">
|
||||
<node CREATED="1455927425726" ID="ID_1774195026" MODIFIED="1464116919014" TEXT="hasSrc">
|
||||
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
|
||||
<node CREATED="1455928216420" ID="ID_259184763" MODIFIED="1461964761834" TEXT="all known fields where mentioned in diff"/>
|
||||
<node CREATED="1455928216420" ID="ID_259184763" MODIFIED="1464116966043" TEXT="can not sensibly be implemented">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
<node CREATED="1464116995888" ID="ID_892348638" MODIFIED="1464117033135" TEXT="always returns true">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node CREATED="1464116967676" ID="ID_1396378266" MODIFIED="1464117025435">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
rationale: object fields are hard wired,
|
||||
</p>
|
||||
<p>
|
||||
thus always available
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1455927425726" ID="ID_950488526" MODIFIED="1457120215833" TEXT="skipSrc">
|
||||
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
|
||||
|
|
@ -3387,9 +3408,22 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1458176048564" ID="ID_1811113811" MODIFIED="1461888530348" TEXT="Variationen"/>
|
||||
<node CREATED="1458176048564" HGAP="-11" ID="ID_1811113811" MODIFIED="1464117584510" TEXT="Variationen" VSHIFT="4">
|
||||
<node CREATED="1464117242535" ID="ID_1487426510" MODIFIED="1464117249074" TEXT="Binden auf eine klassische struct">
|
||||
<node CREATED="1464117391859" ID="ID_1783492476" MODIFIED="1464117396430" TEXT="Setter weisen einfach zu"/>
|
||||
<node CREATED="1464117397026" ID="ID_1635700062" MODIFIED="1464117404773" TEXT="bereits die Neuanlage muß alles populieren"/>
|
||||
</node>
|
||||
<node CREATED="1458178113697" HGAP="26" ID="ID_38103760" MODIFIED="1461882659663" TEXT="Design-Schlußfolgerungen" VSHIFT="-7">
|
||||
<node CREATED="1464117250262" ID="ID_1846973342" MODIFIED="1464117275374" TEXT="Binden auf ein Objekt mit Initialisierungs-Semantik">
|
||||
<node CREATED="1464117412896" ID="ID_1405299167" MODIFIED="1464117450662" TEXT="Erzeugungs-Diff muß mit den Anforderungen des Konstruktors harmonieren"/>
|
||||
<node CREATED="1464117487974" ID="ID_1923901911" MODIFIED="1464117499776" TEXT="Rückkehr zum Default wird nicht unterstützt / abgebildet"/>
|
||||
</node>
|
||||
<node CREATED="1464117317517" ID="ID_1395959611" MODIFIED="1464117326335" TEXT="Binden auf "konzeptionelle" Properties">
|
||||
<node CREATED="1464117513722" ID="ID_101207705" MODIFIED="1464117537611" TEXT="der "Key" ist nur eine ID, um speziellen Zugriffsmechanismus auszulösen"/>
|
||||
<node CREATED="1464117553885" ID="ID_1617675711" MODIFIED="1464117567271" TEXT="u.U ist man überhaupt nur an sub-Mutation interessiert"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1458178113697" HGAP="39" ID="ID_38103760" MODIFIED="1464117607939" TEXT="Design-Schlußfolgerungen" VSHIFT="42">
|
||||
<node CREATED="1463687362843" HGAP="116" ID="ID_775516687" MODIFIED="1463687372655" TEXT="Eingrenzung" VSHIFT="-28">
|
||||
<node CREATED="1463687373889" ID="ID_155516876" MODIFIED="1463687400026" TEXT="Art von Attributen">
|
||||
<node CREATED="1463687402462" ID="ID_1119981147" MODIFIED="1464114029013" TEXT="Objekt-Feld">
|
||||
|
|
|
|||
Loading…
Reference in a new issue