Source for file CompactedTuple.php
Documentation is available at CompactedTuple.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> |
// +----------------------------------------------------------------------+
// $Id: CompactedTuple.php 304045 2010-10-05 00:16:53Z clockwerx $
class Math_CompactedTuple {
function Math_CompactedTuple ($arg)
$this->data = $this->_genCompactedArray ($arg);
$this->data = $this->_genCompacterArray ($arg->getData ());
$msg = "Incorrect parameter for Math_CompactedTuple constructor. ".
"Expecting an unidimensional array or a Math_Tuple object,".
return count($this->_genUnCompactedArray ($this->data));
function getCompactedSize () {
return count($this->data);
function getCompactedData () {
return $this->_genUnCompactedArray ($this->data);
function addElement ($value) {
function delElement ($value) {
if ($this->data[$value] == 0 )
unset ($this->data[$value]);
return PEAR ::raiseError ("value does not exist in compacted tuple");
function hasElement ($value) {
function _genCompactedArray ($arr) {
function _genUnCompactedArray ($arr) {
foreach ($arr as $val=> $count)
for($i=0; $i < $count; $i++ )
Documentation generated on Mon, 11 Mar 2019 15:39:22 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|