[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/template/components/data/ -> math_filter.inc.php (summary)

(no description)

File Size: 1037 lines (29 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

math_rpn:: (46 methods):
  _raiseerror()
  getoperators()
  addoperator()
  calculate()
  getinputarray()
  getrpnarray()
  gettimer()
  _keyexists()
  _isnan()
  _isinfinite()
  _stringtoarray()
  _testinput()
  _stackadd()
  _stackdelete()
  _priority()
  _stackpriority()
  _stackempty()
  _outputadd()
  _arraytorpn()
  _nextoperator()
  _refresh()
  _sum()
  _difference()
  _multiplication()
  _division()
  _root()
  _power()
  _sin()
  _cos()
  _tan()
  _asin()
  _acos()
  _atan()
  _sqrt()
  _exp()
  _log()
  _ln()
  _const_pi()
  _const_e()
  _e()
  _factorial()
  _abs()
  _mod()
  _div()
  _rpntovalue()
  _getmicrotime()

Defines 46 functions

  math_filter()

Class: math_rpn  - X-Ref

Math::Rpn

Purpose:

Change Expression To RPN (Reverse Polish Notation), Calculate RPN Expression

Example:

$expression = "(2^3)+sin(30)-(!4)+(3/4)";

$rpn = new RpnConverter(false);
echo $rpn->getValue($expression);

Example page:

http://www.maciek.maribex.wizja.net.pl/rpn/

2004-06-11 Jason E. Sweat < jsweat_php AT yahoo DOT com >
Modifications for use by WACT:
1) elimination of PEAR.php include requirement
this was done buy switching the _raiseError method
to trigger a WACT error instead
2) in several location, undefined indexes were referenced
this was handled using the error suppression operator
3) corrected error when parsing invalid expressions

_raiseerror($error)   X-Ref
Return a WACT error

access: private
return: object WACT error

getoperators()   X-Ref
Return a operator's array

access: public
return: array Array with operator's name, priority, arguments, function's name and syntax

addoperator($operator, $function_name, $priority = 3, $no_of_arg = 0, $text = '')   X-Ref
Add new operator

access: public
param: string $operator New operator
param: string $function Function name
param: integer $priority New operator's priority
param: integer $no_of_arg Number of function's arguments
param: string $text New operator's description

calculate($input = '', $angle = 'rad', $is_rpn = false)   X-Ref
Calculate the $input expression

access: public
param: mixed $input Infix expression string or RPN expression array
param: string $angle Angle's unit - 'rad' or 'deg'
param: boolean $is_rpn True if $input is RPN expression or false if $input is infix expression
return: mixed Value of $input expression or a PEAR error

getinputarray()   X-Ref
Return a input array

access: public
return: array Input array

getrpnarray()   X-Ref
Return a RPN array

access: public
return: array RPN array

gettimer()   X-Ref
Return a counting time in second

access: public
return: float Counting time in seconds

_keyexists($key,$array,$type)   X-Ref
Check that $key is a key of $array (conformity to php<4.1.0)

access: private
param: string $key
param: array $array
param: integer $type 0 - return true if $key is $array's key, 1 - return true if $key is $array's key and there isn't any occurrence of $key in another $array's key
return: boolean true when $key is a key of $array, or false

_isnan($value)   X-Ref
Check that $value is nan (conformity to php<4.2.0)

access: private
param: float $value checking value
return: boolean true when $value is nan, or false

_isinfinite($value)   X-Ref
Check that $value is infinite (conformity to php<4.2.0)

access: private
param: float $value checking value
return: boolean true when $value is infinite, or false

_stringtoarray()   X-Ref
Change input expression into array

access: private
return: array Input expression changed into array

_testinput()   X-Ref
Check input array and return correct array or a PEAR Error

access: private
return: object Null or a PEAR Error

_stackadd($value)   X-Ref
Add value to the end of stack

access: private
param: string $value Value to add into stack

_stackdelete()   X-Ref
Delete and return value from the end of stack

access: private
return: string Value deleted from stack

_priority($value)   X-Ref
Return priority of value

access: private
param: string $value Value to get priority
return: integer Priority

_stackpriority()   X-Ref
Return priority of value from the end of stack

access: private
return: integer Priority of operator from stack's top

_stackempty()   X-Ref
Return true whene the stack is empty

access: private
return: boolean Stack is empty (true) or not (false)

_outputadd($value)   X-Ref
Add value into output array

access: private
param: string $value Value to add into output array

_arraytorpn()   X-Ref
Change input array into RPN array

access: private
return: array Array with RPN expression

_nextoperator($array)   X-Ref
Return position of the first operator in array

access: private
param: array $array Temporary array
return: integer Position of the first operator

_refresh($temp, $pos, $arg, $result)   X-Ref
Delete from array operator [posision $pos] and its argument and insert new value

access: private
param: array $temp Temporary array
param: integer $pos Position of the last operator
param: integer $arg Number of last operator's arguments
param: float $result Last operation result
return: array New temporary array

_sum($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_difference($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_multiplication($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_division($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_root($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_power($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_sin($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_cos($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_tan($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_asin($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_acos($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_atan($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_sqrt($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_exp($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_log($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_ln($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_const_pi($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_const_e($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_e($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_factorial($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_abs($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_mod($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_div($temp, $pos)   X-Ref
Math function

access: private
param: array $temp Temporary array
param: integer $pos Position of operator
return: float Function's relult

_rpntovalue()   X-Ref
Calculate RPN Expression and return value

access: private
return: float Result of input expression

_getmicrotime()   X-Ref
Return a time in second

access: private
return: float Current time in seconds

Functions
Functions that are not part of a class:

math_filter($value, $exp, $file, $line)   X-Ref

package: WACT_FILTER



Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5