Class autofigure

Description

explodes an autofigure into many dao_figure_data objects.

Each dao_figure_data object returned by get() will have its expression field replaced with a solvable expression. That is the original autofigure expression but with variables replaced with data values corresponding to the figures period and year.

The dao_figure_data objects can be fed into the data_table.

Located in /plugins/Figures/autofigure.class.php (line 44)


	
			
Variable Summary
Method Summary
 object __construct (object dao_figure_var $dao_figure_var, array $variables)
 bool add (object $dao_figure_data)
 array get ()
 object get_autofigure ()
 array get_missing_variables ([bool $drop_empty_rows = false])
 array _matrix_get_row (mixed $row)
 string _matrix_make_period (object $dao_figure_data)
 string _matrix_strip_period (string $period)
Variables
object $_autofigure (line 52)

dao_figure_var object used to create this autofigure object

array $_map_periods = array() (line 90)

index map to access the 'period' rows

array $_map_time = array() (line 99)

map of timestamps by row This timestamp represents the date of the most recent variable per row.

array $_map_variables = array() (line 83)

index map to access the 'variables' columns

array $_matrix = array() (line 76)

matrix to match periods with variables

  1.             variables
  2.             _________________
  3.  periods   | ... |
  4.            |---|---|---|-----|
  5.       year |     |
  6.            |---|---|---|-----|
  7.       q1   |     |
  8.            |---|---|---|-----|
  9.       q2   |     |
  10.            |---|---|---|-----|
  11.       ...  |   |   |   |     |
the above example shows the matrix for an expression with three variables (a, b, c) and data for three periods (year, q1, q2). Data for q1 and q2 is incomplete (x). If these are filled in, the matrix would produce three dao_figure_data objects with solvable expression + data properties.

Methods
Constructor __construct (line 116)

create autofigure object from db record

$dao_figure_var must represent a record that is a autofigure, (where $dao_figure_var->is_autofigure() returns true).

$variables is a list (int indexed array) of variables that are contained in the $dao_figure_var->expression field. Some external parsing code must figure this out.

object __construct (object dao_figure_var $dao_figure_var, array $variables)
  • array $variables
  • object dao_figure_var $dao_figure_var
add (line 145)

add dao_figure_data object to fill the _matrix

Use this method to add regular figure_data objects that are *not* autofigures (where $dao_figure_data->is_autofigure() returns false). Returns true if $dao_figure_data was successfully added to the matrix and false if there was no empty spot for the given variable+period.

bool add (object $dao_figure_data)
  • object $dao_figure_data
get (line 226)

return autofigures as array of dao_figure_data objects

Each autofigure object will have its expression field set to the expression given at __construct() time. The 'expression_values' property will contain a name=>value associated array that should be used to solve the expression for that figure.

array get ()
get_autofigure (line 253)

returns $_autofigure object which was used to create this instance

  • access: public
object get_autofigure ()
get_missing_variables (line 200)

returns fields (period+variable) missing in the matrix

useful to organize more data, use add() to continue filling this object. Note that 'false' or '' is not considered as valid data in the matrix.

If $drop_empty_rows is true all rows with at least one empty column will be dropped from the matrix (empty elements are returned nontheless).

  • see: add_figure()
  • todo: return array of dao_figure_data objects with empty value field, as this is easier to deal with
  • access: public
array get_missing_variables ([bool $drop_empty_rows = false])
  • bool $drop_empty_rows
_matrix_get_row (line 262)

return $row from $_matrix with fields indexed by their name

  • access: protected
array _matrix_get_row (mixed $row)
  • mixed $row
_matrix_make_period (line 286)

return period string to build _matrix and corresponding maps

Note: a period string returned here is *not* equivalent to a period in the database or in dao_figure_data object. Its just used internally to blow the matrix big enough to hold everything we want to solve later.

string _matrix_make_period (object $dao_figure_data)
  • object $dao_figure_data
_matrix_strip_period (line 299)

reverse what _matrix_make_period() did This will strip the original period from the string created by _matrix_make_period(). The returned string is database compatible.

  • access: protected
string _matrix_strip_period (string $period)
  • string $period

Documentation generated on Sun, 22 Aug 2010 11:20:11 +0200 by phpDocumentor 1.4.3