Packagejp.nium.utils
Classpublic final class MathUtil

MathUtil クラスは、算術演算のためのユーティリティクラスです。 The MathUtil class is an utility class for arithmetic operation.



Public Methods
 MethodDefined by
  
cycle(number:Number, cycle:Number):Number
[static] 数値を指定された周期内に収めて返します。 Returns the value of number put in the specified cycle.
MathUtil
  
even(number:Number):Boolean
[static] 数値が偶数かどうかを返します。 Returns if the value is even number.
MathUtil
  
percent(numerator:Number, denominator:Number):Number
[static] 分母が 0 の場合に 0 となるパーセント値を返します。 Returns the percent value (return 0 if the denominator is 0).
MathUtil
  
range(number:Number, min:Number, max:Number):Number
[static] 範囲内に適合する値を返します。 Returns the value suited within the range.
MathUtil
Method detail
cycle()method
public static function cycle(number:Number, cycle:Number):Number

数値を指定された周期内に収めて返します。 Returns the value of number put in the specified cycle.

Parameters
number:Number周期内に収めたい数値です。 The value which want to put in the cycle.
 
cycle:Number周期となる数値です。 The cycle value.

Returns
Number変換後の数値です。 The translated value.

Example
   

even()method 
public static function even(number:Number):Boolean

数値が偶数かどうかを返します。 Returns if the value is even number.

Parameters
number:Numberテストしたい数値です。 The number to test.

Returns
Boolean偶数であれば true を、奇数であれば false を返します。 Returns true if the value is even number, otherwise return false.

Example
   

percent()method 
public static function percent(numerator:Number, denominator:Number):Number

分母が 0 の場合に 0 となるパーセント値を返します。 Returns the percent value (return 0 if the denominator is 0).

Parameters
numerator:Number分子となる数値です。 The numerator value.
 
denominator:Number分母となる数値です。 The denominator value.

Returns
Number変換後の数値です。 The translated value.

Example
   

range()method 
public static function range(number:Number, min:Number, max:Number):Number

範囲内に適合する値を返します。 Returns the value suited within the range.

Parameters
number:Number範囲内に適合させたい数値です。 The number which wanted to suit within the range.
 
min:Number範囲の最小値となる数値です。 The mininum value of the range.
 
max:Number範囲の最大値となる数値です。 The maximum value of the range.

Returns
Number変換後の数値です。 The translated value.

Example