ariba.util.core
Class ArithmeticUtil

java.lang.Object
  extended by ariba.util.core.ArithmeticUtil

public abstract class ArithmeticUtil
extends java.lang.Object


Constructor Summary
ArithmeticUtil()
           
 
Method Summary
static java.lang.Number add(java.lang.Number first, java.lang.Number second)
          Adds first to second and returns the result.
static int compare(java.lang.Number first, java.lang.Number second)
          Compares first to second and returns the result.
static java.lang.Number divide(java.lang.Number first, java.lang.Number second)
          Divides first by second and returns the result.
static java.lang.Number evaluate(java.lang.Number first, Arithmetic.Operation operation, java.lang.Number second)
          Evaluates first to second with respect to the specified operation and returns the result.
static Arithmetic getArithmetic(java.lang.Number first, java.lang.Number second)
          Returns the instance of Arithmetic corresponding to evaluating a simple arithmetic expression containing first and second.
static boolean isInteger(java.lang.Number number)
          Returns true if number is one of the integer types and false otherwise.
static java.lang.Number multiply(java.lang.Number first, java.lang.Number second)
          Multiplies first by second and returns the result.
static java.lang.Number subtract(java.lang.Number first, java.lang.Number second)
          Subtracts second from first and returns the result.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArithmeticUtil

public ArithmeticUtil()
Method Detail

getArithmetic

public static Arithmetic getArithmetic(java.lang.Number first,
                                       java.lang.Number second)
Returns the instance of Arithmetic corresponding to evaluating a simple arithmetic expression containing first and second.

Parameters:
first - the first Number; may not be null
second - the second Number; may not be null
Returns:
the Arithmetic instance; is not null

isInteger

public static boolean isInteger(java.lang.Number number)
Returns true if number is one of the integer types and false otherwise.


evaluate

public static java.lang.Number evaluate(java.lang.Number first,
                                        Arithmetic.Operation operation,
                                        java.lang.Number second)
Evaluates first to second with respect to the specified operation and returns the result.

The value operation must be one of: OpAdd, OpSubtract, OpMultiply, OpDivide.

Parameters:
first - the first number; may not be null
operation - the arithmetic operation
second - the second number; may not be null

add

public static java.lang.Number add(java.lang.Number first,
                                   java.lang.Number second)
Adds first to second and returns the result.

Parameters:
first - the first number; may not be null
second - the second number; may not be null

subtract

public static java.lang.Number subtract(java.lang.Number first,
                                        java.lang.Number second)
Subtracts second from first and returns the result.

Parameters:
first - the first number; may not be null
second - the second number; may not be null

multiply

public static java.lang.Number multiply(java.lang.Number first,
                                        java.lang.Number second)
Multiplies first by second and returns the result.

Parameters:
first - the first number; may not be null
second - the second number; may not be null

divide

public static java.lang.Number divide(java.lang.Number first,
                                      java.lang.Number second)
Divides first by second and returns the result.

Parameters:
first - the first number; may not be null
second - the second number; may not be null

compare

public static int compare(java.lang.Number first,
                          java.lang.Number second)
Compares first to second and returns the result.

Parameters:
first - the first number; may not be null
second - the second number; may not be null


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.