[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZDiffMatrix class 4 // 5 // <05-Apr-2006 14:42:42> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 /*! \file ezdiffmatrix.php 30 eZDiffMatrix class 31 */ 32 33 /*! 34 \class eZDiffMatrix ezdiffmatrix.php 35 \ingroup eZDiff 36 \biref This class will store values concerned with diff data 37 38 The eZDiffMatrix class will avoid storing 0, which for a large matrix will save 39 memory. 40 */ 41 42 class eZDiffMatrix 43 { 44 45 /*! 46 Constructor 47 */ 48 function eZDiffMatrix( $rows = null, $cols = null) 49 { 50 if ( isset( $rows ) && is_numeric( $rows ) ) 51 $this->Rows = $rows; 52 53 if ( isset( $cols ) && is_numeric( $cols ) ) 54 $this->Cols = $cols; 55 } 56 57 /*! 58 \public 59 Sets the dimensions of the matrix 60 */ 61 function setSize( $nRows, $nCols ) 62 { 63 $this->Rows = $nRows; 64 $this->Cols = $nCols; 65 } 66 67 /*! 68 \public 69 This method will set (\a $row, \a $col) in the matrix to \a $value, if 70 it is not zero. 71 */ 72 function set( $row, $col, $value ) 73 { 74 if ( $value !== 0 ) 75 { 76 $pos = $row * $this->Cols + $col; 77 $pos = base_convert( $pos, 10, 36 ); 78 $this->Matrix["*$pos"] = $value; 79 } 80 } 81 82 /*! 83 \public 84 This method will return the value at position (\a $row, \a $col) 85 */ 86 function get( $row, $col ) 87 { 88 $pos = $row * $this->Cols + $col; 89 $pos = base_convert( $pos, 10, 36 ); 90 return isset( $this->Matrix["*$pos"] ) ? $this->Matrix["*$pos"] : 0; 91 } 92 93 ///\privatesection 94 /// Internal array, holding necessary values. 95 var $Matrix = array(); 96 97 /// Internal variable, width of the matrix. 98 var $Cols; 99 100 /// Internal variable, height of the matrix. 101 var $Rows; 102 } 103 104 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |