summaryrefslogtreecommitdiff
path: root/inc/DifferenceEngine.php
diff options
context:
space:
mode:
authorPiyush Mishra <me@piyushmishra.com>2011-03-23 09:43:38 +0530
committerPiyush Mishra <me@piyushmishra.com>2011-03-23 09:43:38 +0530
commit988c134016f0557947bd6811e22086919f98fa8e (patch)
tree07b2c7050f9692d83fb65248607dfab98ae4ff9d /inc/DifferenceEngine.php
parentee1214abb2c14cf0f86ff6d9a5b49536c6b01e18 (diff)
downloadrpg-988c134016f0557947bd6811e22086919f98fa8e.tar.gz
rpg-988c134016f0557947bd6811e22086919f98fa8e.tar.bz2
Done with DifferenceEngine.php
Diffstat (limited to 'inc/DifferenceEngine.php')
-rw-r--r--inc/DifferenceEngine.php99
1 files changed, 89 insertions, 10 deletions
diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php
index 906a17b2d..5473bf7e0 100644
--- a/inc/DifferenceEngine.php
+++ b/inc/DifferenceEngine.php
@@ -29,8 +29,14 @@ class _DiffOp {
class _DiffOp_Copy extends _DiffOp {
var $type = 'copy';
-
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function _DiffOp_Copy($orig, $closing = false) {
+ $this->__construct($orig, $closing);
+ }
+
+ function __construct($orig, $closing = false) {
if (!is_array($closing))
$closing = $orig;
$this->orig = $orig;
@@ -44,8 +50,14 @@ class _DiffOp_Copy extends _DiffOp {
class _DiffOp_Delete extends _DiffOp {
var $type = 'delete';
-
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function _DiffOp_Delete($lines) {
+ $this->__construct($lines);
+ }
+
+ function __construct($lines) {
$this->orig = $lines;
$this->closing = false;
}
@@ -57,8 +69,14 @@ class _DiffOp_Delete extends _DiffOp {
class _DiffOp_Add extends _DiffOp {
var $type = 'add';
-
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function _DiffOp_Add($lines) {
+ $this->__construct($lines);
+ }
+
+ function __construct($lines) {
$this->closing = $lines;
$this->orig = false;
}
@@ -70,8 +88,14 @@ class _DiffOp_Add extends _DiffOp {
class _DiffOp_Change extends _DiffOp {
var $type = 'change';
-
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function _DiffOp_Change($orig, $closing) {
+ $this->__construct($orig, $closing);
+ }
+
+ function __construct($orig, $closing) {
$this->orig = $orig;
$this->closing = $closing;
}
@@ -490,6 +514,13 @@ class _DiffEngine {
class Diff {
var $edits;
+
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
+ function Diff($from_lines, $to_lines) {
+ $this->__construct($from_lines, $to_lines);
+ }
/**
* Constructor.
@@ -499,7 +530,7 @@ class Diff {
* (Typically these are lines from a file.)
* @param $to_lines array An array of strings.
*/
- function Diff($from_lines, $to_lines) {
+ function __construct($from_lines, $to_lines) {
$eng = new _DiffEngine;
$this->edits = $eng->diff($from_lines, $to_lines);
//$this->_check($from_lines, $to_lines);
@@ -623,6 +654,13 @@ class Diff {
*/
class MappedDiff extends Diff {
/**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
+ function MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) {
+ $this->__construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines);
+ }
+
+ /**
* Constructor.
*
* Computes diff between sequences of strings.
@@ -645,12 +683,12 @@ class MappedDiff extends Diff {
* @param $mapped_to_lines array This array should
* have the same number of elements as $to_lines.
*/
- function MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) {
+ function __construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) {
assert(count($from_lines) == count($mapped_from_lines));
assert(count($to_lines) == count($mapped_to_lines));
- $this->Diff($mapped_from_lines, $mapped_to_lines);
+ parent::__construct($mapped_from_lines, $mapped_to_lines);
$xi = $yi = 0;
$ecnt = count($this->edits);
@@ -827,7 +865,14 @@ class DiffFormatter {
define('NBSP', "\xC2\xA0"); // utf-8 non-breaking space.
class _HWLDF_WordAccumulator {
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function _HWLDF_WordAccumulator() {
+ $this->__construct();
+ }
+
+ function __construct() {
$this->_lines = array();
$this->_line = '';
$this->_group = '';
@@ -882,11 +927,18 @@ class _HWLDF_WordAccumulator {
class WordLevelDiff extends MappedDiff {
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function WordLevelDiff($orig_lines, $closing_lines) {
+ $this->__construct($orig_lines, $closing_lines);
+ }
+
+ function __construct($orig_lines, $closing_lines) {
list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
- $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped);
+ parent::__construct($orig_words, $closing_words, $orig_stripped, $closing_stripped);
}
function _split($lines) {
@@ -924,11 +976,18 @@ class WordLevelDiff extends MappedDiff {
class InlineWordLevelDiff extends MappedDiff {
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function InlineWordLevelDiff($orig_lines, $closing_lines) {
+ $this->__construct($orig_lines, $closing_lines);
+ }
+
+ function __construct($orig_lines, $closing_lines) {
list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
- $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped);
+ parent::__construct($orig_words, $closing_words, $orig_stripped, $closing_stripped);
}
function _split($lines) {
@@ -965,7 +1024,14 @@ class InlineWordLevelDiff extends MappedDiff {
*/
class UnifiedDiffFormatter extends DiffFormatter {
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function UnifiedDiffFormatter($context_lines = 4) {
+ $this->__construct($context_lines);
+ }
+
+ function __construct($context_lines = 4) {
$this->leading_context_lines = $context_lines;
$this->trailing_context_lines = $context_lines;
}
@@ -996,7 +1062,14 @@ class UnifiedDiffFormatter extends DiffFormatter {
*/
class TableDiffFormatter extends DiffFormatter {
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function TableDiffFormatter() {
+ $this->__construct();
+ }
+
+ function __construct() {
$this->leading_context_lines = 2;
$this->trailing_context_lines = 2;
}
@@ -1088,8 +1161,14 @@ class TableDiffFormatter extends DiffFormatter {
*/
class InlineDiffFormatter extends DiffFormatter {
var $colspan = 4;
-
+ /**
+ * DONOT USE THIS. Its just to make sure nothing breaks because of the name change.
+ */
function InlineDiffFormatter() {
+ $this->__construct();
+ }
+
+ function __construct() {
$this->leading_context_lines = 2;
$this->trailing_context_lines = 2;
}