update v1.0.4
This commit is contained in:
		| @@ -12,21 +12,15 @@ namespace SebastianBergmann\Diff\LCS; | ||||
|  | ||||
| /** | ||||
|  * Interface for implementations of longest common subsequence calculation. | ||||
|  * | ||||
|  * @package    Diff | ||||
|  * @author     Sebastian Bergmann <sebastian@phpunit.de> | ||||
|  * @author     Kore Nordmann <mail@kore-nordmann.de> | ||||
|  * @copyright  Sebastian Bergmann <sebastian@phpunit.de> | ||||
|  * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License | ||||
|  * @link       http://www.github.com/sebastianbergmann/diff | ||||
|  */ | ||||
| interface LongestCommonSubsequence | ||||
| { | ||||
|     /** | ||||
|      * Calculates the longest common subsequence of two arrays. | ||||
|      * | ||||
|      * @param  array $from | ||||
|      * @param  array $to | ||||
|      * @param array $from | ||||
|      * @param array $to | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function calculate(array $from, array $to); | ||||
|   | ||||
| @@ -12,21 +12,15 @@ namespace SebastianBergmann\Diff\LCS; | ||||
|  | ||||
| /** | ||||
|  * Memory-efficient implementation of longest common subsequence calculation. | ||||
|  * | ||||
|  * @package    Diff | ||||
|  * @author     Sebastian Bergmann <sebastian@phpunit.de> | ||||
|  * @author     Denes Lados <lados.denes@gmail.com> | ||||
|  * @copyright  Sebastian Bergmann <sebastian@phpunit.de> | ||||
|  * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License | ||||
|  * @link       http://www.github.com/sebastianbergmann/diff | ||||
|  */ | ||||
| class MemoryEfficientImplementation implements LongestCommonSubsequence | ||||
| { | ||||
|     /** | ||||
|      * Calculates the longest common subsequence of two arrays. | ||||
|      * | ||||
|      * @param  array $from | ||||
|      * @param  array $to | ||||
|      * @param array $from | ||||
|      * @param array $to | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function calculate(array $from, array $to) | ||||
| @@ -73,6 +67,7 @@ class MemoryEfficientImplementation implements LongestCommonSubsequence | ||||
|     /** | ||||
|      * @param array $from | ||||
|      * @param array $to | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     private function length(array $from, array $to) | ||||
|   | ||||
| @@ -12,21 +12,15 @@ namespace SebastianBergmann\Diff\LCS; | ||||
|  | ||||
| /** | ||||
|  * Time-efficient implementation of longest common subsequence calculation. | ||||
|  * | ||||
|  * @package    Diff | ||||
|  * @author     Sebastian Bergmann <sebastian@phpunit.de> | ||||
|  * @author     Kore Nordmann <mail@kore-nordmann.de> | ||||
|  * @copyright  Sebastian Bergmann <sebastian@phpunit.de> | ||||
|  * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License | ||||
|  * @link       http://www.github.com/sebastianbergmann/diff | ||||
|  */ | ||||
| class TimeEfficientImplementation implements LongestCommonSubsequence | ||||
| { | ||||
|     /** | ||||
|      * Calculates the longest common subsequence of two arrays. | ||||
|      * | ||||
|      * @param  array $from | ||||
|      * @param  array $to | ||||
|      * @param array $from | ||||
|      * @param array $to | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function calculate(array $from, array $to) | ||||
| @@ -47,7 +41,7 @@ class TimeEfficientImplementation implements LongestCommonSubsequence | ||||
|  | ||||
|         for ($i = 1; $i <= $fromLength; ++$i) { | ||||
|             for ($j = 1; $j <= $toLength; ++$j) { | ||||
|                 $o = ($j * $width) + $i; | ||||
|                 $o          = ($j * $width) + $i; | ||||
|                 $matrix[$o] = max( | ||||
|                     $matrix[$o - 1], | ||||
|                     $matrix[$o - $width], | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sujitprasad
					sujitprasad