Fatorial Class Reference

List of all members.

Static Public Member Functions

static play ($n)


Detailed Description

Fatorial Example

Class of the math fatorial function to be used into the sequence diagram

Author:
Thiago Henrique Ramos da Mata <thiago.henrique.mata@gmail.com>

Definition at line 15 of file Fatorial.php.


Member Function Documentation

static play ( n  )  [static]

calc the fatorial of the value received

Assert:
( 0 ) == 1
Assert:
( 2 ) == 2
Assert:
( 4 ) == 24
Parameters:
integer $n
Returns:
integer

Definition at line 26 of file Fatorial.php.

00027     {
00028         if(  $n < 0 )
00029         {
00030             throw new Exception( "invalid factorial value" );
00031         }
00032 
00033        if ( $n == 0 )
00034         {
00035             return 1;
00036         }
00037         else
00038         {
00039             return $n * self::play( $n - 1 );
00040         }
00041      }


The documentation for this class was generated from the following file:

Generated on Thu Feb 3 03:55:03 2011 for CodeToDiagram by  doxygen 1.5.9