https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114554

Revision: 114554
Author:   daniel
Date:     2012-03-28 13:09:54 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
mark _DiffOf_XXX etc for refactoring

Modified Paths:
--------------
    branches/Wikidata/phase3/includes/diff/DairikiDiff.php

Modified: branches/Wikidata/phase3/includes/diff/DairikiDiff.php
===================================================================
--- branches/Wikidata/phase3/includes/diff/DairikiDiff.php      2012-03-28 
13:09:21 UTC (rev 114553)
+++ branches/Wikidata/phase3/includes/diff/DairikiDiff.php      2012-03-28 
13:09:54 UTC (rev 114554)
@@ -15,7 +15,7 @@
  * @private
  * @ingroup DifferenceEngine
  */
-class _DiffOp {
+class _DiffOp { #FIXME: no longer private!
        var $type;
        var $orig;
        var $closing;
@@ -44,7 +44,7 @@
  * @private
  * @ingroup DifferenceEngine
  */
-class _DiffOp_Copy extends _DiffOp {
+class _DiffOp_Copy extends _DiffOp { #FIXME: no longer private!
        var $type = 'copy';
 
        function __construct( $orig, $closing = false ) {
@@ -68,7 +68,7 @@
  * @private
  * @ingroup DifferenceEngine
  */
-class _DiffOp_Delete extends _DiffOp {
+class _DiffOp_Delete extends _DiffOp { #FIXME: no longer private!
        var $type = 'delete';
 
        function __construct( $lines ) {
@@ -89,7 +89,7 @@
  * @private
  * @ingroup DifferenceEngine
  */
-class _DiffOp_Add extends _DiffOp {
+class _DiffOp_Add extends _DiffOp { #FIXME: no longer private!
        var $type = 'add';
 
        function __construct( $lines ) {
@@ -110,7 +110,7 @@
  * @private
  * @ingroup DifferenceEngine
  */
-class _DiffOp_Change extends _DiffOp {
+class _DiffOp_Change extends _DiffOp { #FIXME: no longer private!
        var $type = 'change';
 
        function __construct( $orig, $closing ) {
@@ -150,7 +150,7 @@
  * @private
  * @ingroup DifferenceEngine
  */
-class _DiffEngine {
+class _DiffEngine { #FIXME: no longer private!
 
        const MAX_XREF_LENGTH =  10000;
 
@@ -637,7 +637,7 @@
  * @private
  * @ingroup DifferenceEngine
  */
-class Diff {
+class Diff extends DiffResult {
        var $edits;
 
        /**
@@ -647,13 +647,36 @@
         * @param $from_lines array An array of strings.
         *                (Typically these are lines from a file.)
         * @param $to_lines array An array of strings.
+     * @param $eng _DiffEngine|null The diff engine to use.
         */
-       function __construct( $from_lines, $to_lines ) {
-               $eng = new _DiffEngine;
-               $this->edits = $eng->diff( $from_lines, $to_lines );
-               // $this->_check($from_lines, $to_lines);
+       function __construct( $from_lines, $to_lines, $eng = null  ) {
+               if ( !$eng ) $eng = new _DiffEngine();
+
+               $edits = $eng->diff( $from_lines, $to_lines );
+
+        parent::__construct( $edits );
+
+        //$this->_check( $from_lines, $to_lines );
        }
+}
 
+/**
+ * Class representing the result of 'diffin' two sequences of strings.
+ * @todo document
+ * @private
+ * @ingroup DifferenceEngine
+ */
+class DiffResult {
+
+    /**
+     * Constructor.
+     *
+     * @param $edits array An array of Edit.
+     */
+    function __construct( $edits  ) {
+        $this->edits = $edits;
+    }
+
        /**
         * Compute reversed Diff.
         *


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to