core
[ class tree: core ] [ index: core ] [ all elements ]

Class: Numbers

Source Location: /core/Numbers.class.php

Class Overview

ABSTObject
   |
   --Numbers

Static methods to handle numeric values.


Author(s):

Version:

  • 0.1.96

Copyright:

  • Copyright (c) 2003 Daniel Plücken <daniel@debakel.net>

    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License.

    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Methods


Inherited Methods

Class: ABSTObject

ABSTObject::printComplexData()
Prints out the more complex data by the given array.
ABSTObject::printPrimitiveData()
Prints out the primitive data by the given arrays.
ABSTObject::printStructure()
Prints out the Structure of this Object.
ABSTObject::same()
Checks whether the passed object reference points to this object.
ABSTObject::sameReferences()
Compares two references whether they points to the same object

Class Details

[line 50]
Static methods to handle numeric values.



Tags:

author:  Daniel Plücken <daniel@debakel.net>
version:  0.1.96
copyright:  

Copyright (c) 2003 Daniel Plücken <daniel@debakel.net>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

license:  GNU Lesser General Public License


[ Top ]


Class Methods


static method getIntervalRoundingOf [line 99]

static number getIntervalRoundingOf( number $value, number $rangeEnd, number $portions)

Apportions a range of numbers between zero and $rangeEnd in $portions commensurate chunks. Then the closest computed value to $value will be returned.

Example: Numbers::getIntervalRoundingOf( 42, 60, 4 ); Is the same like:

  1.  if$value <= || $value 52 )
  2.    return 0;
  3.  else
  4.  if$value <= 22 && $value )
  5.    return 15;
  6.  else
  7.  if$value <= 37 && $value 22 )
  8.    return 30;
  9.  else
  10.  if$value <= 52 && $value 37 )
  11.    return 45;

In the upper example the function will return 45.




Tags:

author:  Daniel Plücken <daniel@debakel.net>
version:  1.0
since:  0.1.1
access:  public


Parameters:

number   $value   The value to round to the nearest chunk of the range.
number   $rangeEnd   The end of the range. The range begins at zero. For example if you want to round in the range of 6 to 9, then set the $rangeEnd to 3 and add 6 after the rounding.
number   $portions   How many chunks should create in the range for rounding base.

[ Top ]

static method hex2int [line 189]

static integer hex2int( string $string)

Returns the decimal value of a given hexadecimal value.



Tags:

author:  Daniel Plücken <daniel@debakel.net>
version:  1.0
since:  1.6
access:  public


Parameters:

string   $string  

[ Top ]

static method random [line 141]

static number random( integer $including_from, integer $including_to)

Returns a random number in the range between $including_from and $including_to. Sets automatically a new random set by microtime for real random.



Tags:

author:  Daniel Plücken <daniel@debakel.net>
version:  1.0
since:  0.1.5
access:  public


Parameters:

integer   $including_from  
integer   $including_to  

[ Top ]

static method translateDoubleVal [line 164]

static double translateDoubleVal( string $str_number, [string $str_decimal_separator = "."], [string $str_thousand_separator = ","])

Returns a double from a given string. Translates a number from other language formates.



Tags:

author:  Daniel Plücken <daniel@debakel.net>
version:  1.0
since:  0.1.95
access:  public


Parameters:

string   $str_number  
string   $str_decimal_separator  
string   $str_thousand_separator  

[ Top ]

constructor Numbers [line 54]

Numbers Numbers( )



[ Top ]


Documentation generated on Thu, 05 Jun 2008 19:14:35 +0200 by phpDocumentor 1.4.1