C# Class Spring.Util.NumberUtils

Various utility methods relating to numbers.

Mainly for internal use within the framework.

Show file Open project: spring-projects/spring-net Class Usage Examples

Public Methods

Method Description
Add ( object m, object n ) : object

Adds the specified numbers.

BitwiseAnd ( object m, object n ) : object

Bitwise ANDs (&) the specified integral values.

BitwiseNot ( object number ) : object

Returns the bitwise not (~) of the supplied number.

BitwiseOr ( object m, object n ) : object

Bitwise ORs (|) the specified integral values.

BitwiseXor ( object m, object n ) : object

Bitwise XORs (^) the specified integral values.

CanConvertToDecimal ( object number ) : bool

Determines whether the supplied number can be converted to an integer.

CanConvertToInteger ( object number ) : bool

Determines whether the supplied number can be converted to an integer.

CanConvertToNumber ( object number ) : bool

Determines whether the supplied number can be converted to a number.

CoerceTypes ( object &m, object &n ) : void

Coerces the types so they can be compared.

Divide ( object m, object n ) : object

Divides the specified numbers.

IsDecimal ( object number ) : bool

Determines whether the supplied number is a decimal number.

IsInteger ( object number ) : bool

Determines whether the supplied number is an integer.

IsNumber ( object number ) : bool

Determines whether the supplied number is of numeric type.

IsZero ( object number ) : bool

Is the supplied number equal to zero (0)?

Modulus ( object m, object n ) : object

Calculates remainder for the specified numbers.

Multiply ( object m, object n ) : object

Multiplies the specified numbers.

Negate ( object number ) : object

Negates the supplied number.

Power ( object m, object n ) : object

Raises first number to the power of the second one.

Subtract ( object m, object n ) : object

Subtracts the specified numbers.

Private Methods

Method Description
NumberUtils ( ) : System

Creates a new instance of the Spring.Util.NumberUtils class.

This is a utility class, and as such exposes no public constructors.

Method Details

Add() public static method

Adds the specified numbers.
public static Add ( object m, object n ) : object
m object The first number.
n object The second number.
return object

BitwiseAnd() public static method

Bitwise ANDs (&) the specified integral values.
/// If one of the supplied arguments is not a supported integral types. ///
public static BitwiseAnd ( object m, object n ) : object
m object The first number.
n object The second number.
return object

BitwiseNot() public static method

Returns the bitwise not (~) of the supplied number.
/// If the supplied is not a supported numeric type. ///
public static BitwiseNot ( object number ) : object
number object The number.
return object

BitwiseOr() public static method

Bitwise ORs (|) the specified integral values.
/// If one of the supplied arguments is not a supported integral types. ///
public static BitwiseOr ( object m, object n ) : object
m object The first number.
n object The second number.
return object

BitwiseXor() public static method

Bitwise XORs (^) the specified integral values.
/// If one of the supplied arguments is not a supported integral types. ///
public static BitwiseXor ( object m, object n ) : object
m object The first number.
n object The second number.
return object

CanConvertToDecimal() public static method

Determines whether the supplied number can be converted to an integer.
public static CanConvertToDecimal ( object number ) : bool
number object The object to check.
return bool

CanConvertToInteger() public static method

Determines whether the supplied number can be converted to an integer.
public static CanConvertToInteger ( object number ) : bool
number object The object to check.
return bool

CanConvertToNumber() public static method

Determines whether the supplied number can be converted to a number.
public static CanConvertToNumber ( object number ) : bool
number object The object to check.
return bool

CoerceTypes() public static method

Coerces the types so they can be compared.
public static CoerceTypes ( object &m, object &n ) : void
m object The right.
n object The left.
return void

Divide() public static method

Divides the specified numbers.
public static Divide ( object m, object n ) : object
m object The first number.
n object The second number.
return object

IsDecimal() public static method

Determines whether the supplied number is a decimal number.
public static IsDecimal ( object number ) : bool
number object The object to check.
return bool

IsInteger() public static method

Determines whether the supplied number is an integer.
public static IsInteger ( object number ) : bool
number object The object to check.
return bool

IsNumber() public static method

Determines whether the supplied number is of numeric type.
public static IsNumber ( object number ) : bool
number object The object to check.
return bool

IsZero() public static method

Is the supplied number equal to zero (0)?
public static IsZero ( object number ) : bool
number object The number to check.
return bool

Modulus() public static method

Calculates remainder for the specified numbers.
public static Modulus ( object m, object n ) : object
m object The first number (dividend).
n object The second number (divisor).
return object

Multiply() public static method

Multiplies the specified numbers.
public static Multiply ( object m, object n ) : object
m object The first number.
n object The second number.
return object

Negate() public static method

Negates the supplied number.
/// If the supplied is not a supported numeric type. ///
public static Negate ( object number ) : object
number object The number to negate.
return object

Power() public static method

Raises first number to the power of the second one.
public static Power ( object m, object n ) : object
m object The first number.
n object The second number.
return object

Subtract() public static method

Subtracts the specified numbers.
public static Subtract ( object m, object n ) : object
m object The first number.
n object The second number.
return object