Planet resource produciton calculations and planet resources updates implemented and tested

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2011-06-19 15:53:50 +02:00
commit 282eb43a31
6 changed files with 207 additions and 22 deletions

View file

@ -81,4 +81,50 @@ class Math
{
return self::getSingleton()->render($a);
}
public static function isNegative($a)
{
return (bool) (self::getSingleton()->comp($a, 0) < 0);
}
public static function isPositive($a)
{
return (bool) (self::getSingleton()->comp($a, 0) > 0);
}
public static function isNegativeOrZero($a)
{
return (bool) (self::getSingleton()->comp($a, 0) <= 0);
}
public static function isPositiveOrZero($a)
{
return (bool) (self::getSingleton()->comp($a, 0) >= 0);
}
public static function isZero($a)
{
return (bool) (self::getSingleton()->comp($a, 0) == 0);
}
public static function isNotZero($a)
{
return (bool) (self::getSingleton()->comp($a, 0) != 0);
}
public static function min($a, $b)
{
if (self::getSingleton()->comp($a, $b) > 0) {
return $b;
}
return $a;
}
public static function max($a, $b)
{
if (self::getSingleton()->comp($a, $b) < 0) {
return $b;
}
return $a;
}
}