diff --git a/src/lib/diff/diff-language.hpp b/src/lib/diff/diff-language.hpp index 9d170f2cb..482279747 100644 --- a/src/lib/diff/diff-language.hpp +++ b/src/lib/diff/diff-language.hpp @@ -273,24 +273,24 @@ namespace diff{ * The usage pattern is as follows * #. construct a DiffApplicator instance, wrapping the target data * #. feed the diff (sequence of diff verbs) to the #consume function - * #. the wrapped target sequence has been altered, to conform to the given diff + * #. the wrapped target data has been altered, to conform to the given diff * @note a suitable DiffApplicationStrategy will be picked, based on the type * of the concrete target sequence given at construction. (Effectively * this means you need a suitable DiffApplicationStrategy specialisation, * e.g. for a target sequence within a vector) */ - template + template class DiffApplicator : boost::noncopyable { - using Interpreter = DiffApplicationStrategy; + using Interpreter = DiffApplicationStrategy; Interpreter target_; public: explicit - DiffApplicator(SEQ& targetSeq) - : target_(targetSeq) + DiffApplicator(TAR& targetStructure) + : target_(targetStructure) { } template diff --git a/src/lib/diff/tree-diff-mutator-binding.hpp b/src/lib/diff/tree-diff-mutator-binding.hpp index 77d1b8a5d..294ecb914 100644 --- a/src/lib/diff/tree-diff-mutator-binding.hpp +++ b/src/lib/diff/tree-diff-mutator-binding.hpp @@ -65,6 +65,7 @@ #include "lib/diff/tree-diff.hpp" +#include "lib/diff/tree-mutator.hpp" #include "lib/diff/gen-node.hpp" #include "lib/format-string.hpp" #include "lib/util.hpp" @@ -82,7 +83,6 @@ namespace diff{ using std::swap; -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 /** * Interpreter for the tree-diff-language to work on arbitrary, undiclosed * local data structures. The key point to note is that this local data is @@ -95,9 +95,10 @@ namespace diff{ * @see DiffVirtualisedApplication_test demonstration of usage */ template<> - class DiffApplicationStrategy + class DiffApplicationStrategy : public TreeDiffInterpreter { +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 using Mutator = Rec::Mutator; using Content = Rec::ContentMutator; using Iter = Content::Iter; @@ -249,7 +250,7 @@ namespace diff{ else out().appendChild (move(*pos)); } - +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 /* == Implementation of the list diff application primitives == */ @@ -257,50 +258,39 @@ namespace diff{ virtual void ins (GenNode const& n) override { - if (n.isNamed()) - if (n.isTypeID()) - out().setType (n.data.get()); - else - out().appendAttrib(n); //////////////TICKET #969 dto. - else - { - out().appendChild(n); - if (src().currIsAttrib()) - src().jumpToChildScope(); - } + inject (n); } virtual void del (GenNode const& n) override { __expect_in_target(n, "remove"); - ++src(); + next_src(); } virtual void pick (GenNode const& n) override { __expect_in_target(n, "pick"); - move_into_new_sequence (srcPos()); - ++src(); + accept_src(); + next_src(); } virtual void skip (GenNode const& n) override { __expect_further_elements (n); - ++src(); + next_src(); } // assume the actual content has been moved away by a previous find() virtual void find (GenNode const& n) override { __expect_further_elements (n); - Iter found = find_in_current_scope(n); - __expect_found (n, found); - move_into_new_sequence (found); - } // consume and leave waste, expected to be cleaned-up by skip() later - + // consume and leave waste, expected to be cleaned-up by skip() later + if (not find_and_accept(n)); + __fail_not_found (n); + } /* == Implementation of the tree diff application primitives == */ @@ -311,38 +301,15 @@ namespace diff{ virtual void after (GenNode const& n) override { - if (n.matches(Ref::ATTRIBS)) - while (not endOfData() and srcPos()->isNamed()) - { - move_into_new_sequence (srcPos()); - ++src(); - } - else - if (n.matches(Ref::END)) - while (not endOfData()) - { - move_into_new_sequence (srcPos()); - ++src(); - } - else - while (not (endOfData() or srcPos()->matches(n))) - { - move_into_new_sequence (srcPos()); - ++src(); - } - - __expect_successful_location(n); - - if (not endOfData() and srcPos()->matches(n)) - ++src(); // get /after/ an explicitly given position + if (not accept_until(n)) + __fail_not_found (n); } /** assignement of changed value in one step */ virtual void set (GenNode const& n) override { - GenNode const& elm = find_child (n.idi); - unConst(elm).data = n.data; + locate_and_assign (n); } /** open nested scope to apply diff to child object */ @@ -370,6 +337,7 @@ namespace diff{ public: +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 explicit DiffApplicationStrategy(Rec::Mutator& mutableTargetRecord) : scopes_() @@ -383,8 +351,8 @@ namespace diff{ REQUIRE (1 == scopes_.size()); scopes_.top().init(); } - }; #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 + }; }} // namespace lib::diff diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 68478f3da..3f9435059 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -585,7 +585,7 @@ - + @@ -699,20 +699,79 @@ + + + + + + + + + + + + + - - + + + + + + + +

+ eindeutig überlegen +

+
    +
  • + faktorisiert sauber +
  • +
  • + Zustand delegiert auf die jeweilige Kinder-Sammlung +
  • +
  • + diese wird damit auch zum generischen Element +
  • +
+ + +
+ - + + + + + + +

+ schlechter.... +

+
    +
  • + sammelt viel technische Komplexität auf top-level +
  • +
  • + wir müssen eine meta-Repräsentation aufbauen +
  • +
  • + wir müssen Adapter zentral generieren, anstatt uns vom Installieren von Closures treiben zu lassen +
  • +
+ + +
+ @@ -724,6 +783,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ move into target +

+ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Mutator enthält die Bindung auf die konkreten Daten +

+ + +
+
+ + + + + + + +

+ stellt sich u.U erst während der Verarbeitung heraus: +

+

+ bei "offenen Datenstrukturen" entscheided jeder Typ selber, +

+

+ welchen Mutator er erzeugt +

+ + +
+
+ + + + + + + + + + + + +

+ aber: Aufrufprinzip +

+ + +
+ + + + + + + +

+ Verb muß den +

+

+ Diff bekommen +

+ + +
+
+ + + + + + + + + + + + + +

+ und delegiert iterativ +

+

+ an die Verben +

+ + +
+
+ + + + + + + + + + + + + + + +