Package ise.antelope.tasks
Class Math
java.lang.Object
ise.antelope.tasks.Math
Provides access to java.lang.Math and java.lang.StrictMath for Ant. Provides
add, subtract, multiply, divide and mod methods as well as access to all methods
java.lang.Math and java.lang.StrictMath via reflection.
Copyright 2003, Dale Anson, all rights reserved
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double
add
(double[] a) static double
add
(double a, double b) static float
add
(float[] a) static float
add
(float a, float b) static int
add
(int[] a) static int
add
(int a, int b) static long
add
(long[] a) static long
add
(long a, long b) static BigDecimal
add
(BigDecimal a, BigDecimal b) static BigInteger
add
(BigInteger[] a) static BigInteger
add
(BigInteger a, BigInteger b) static int
and
(int a, int b) static BigInteger
and
(BigInteger a, BigInteger b) Do a mathematical calculation.Do a mathematical calculation.static double
divide
(double[] a) static double
divide
(double a, double b) static float
divide
(float[] a) static float
divide
(float a, float b) static int
divide
(int[] a) static int
divide
(int a, int b) static long
divide
(long[] a) static long
divide
(long a, long b) static BigDecimal
divide
(BigDecimal[] a) static BigDecimal
divide
(BigDecimal a, BigDecimal b) static BigInteger
divide
(BigInteger[] a) static BigInteger
divide
(BigInteger a, BigInteger b) static boolean
equal
(double x, double y) static boolean
equal
(int x, int y) static boolean
equal
(long x, long y) static boolean
equal
(BigDecimal x, BigDecimal y) static boolean
equal
(BigInteger x, BigInteger y) static int
factorial
(double x) static int
factorial
(float x) static int
factorial
(int x) static BigInteger
static boolean
greaterThan
(double x, double y) static boolean
greaterThan
(int x, int y) static boolean
greaterThan
(long x, long y) static boolean
greaterThan
(BigDecimal x, BigDecimal y) static boolean
greaterThan
(BigInteger x, BigInteger y) boolean
isStrict()
static boolean
lessThan
(double x, double y) static boolean
lessThan
(int x, int y) static boolean
lessThan
(long x, long y) static boolean
lessThan
(BigDecimal x, BigDecimal y) static boolean
lessThan
(BigInteger x, BigInteger y) static BigDecimal
max
(BigDecimal a, BigDecimal b) static BigInteger
max
(BigInteger a, BigInteger b) static BigDecimal
min
(BigDecimal a, BigDecimal b) static BigInteger
min
(BigInteger a, BigInteger b) static double
mod
(double[] a) static double
mod
(double a, double b) static float
mod
(float[] a) static float
mod
(float a, float b) static int
mod
(int[] a) static int
mod
(int a, int b) static long
mod
(long[] a) static long
mod
(long a, long b) static BigInteger
mod
(BigInteger[] a) static BigInteger
mod
(BigInteger a, BigInteger b) static double
multiply
(double[] a) static double
multiply
(double a, double b) static float
multiply
(float[] a) static float
multiply
(float a, float b) static int
multiply
(int[] a) static int
multiply
(int a, int b) static long
multiply
(long[] a) static long
multiply
(long a, long b) static BigDecimal
multiply
(BigDecimal[] a) static BigDecimal
multiply
(BigDecimal a, BigDecimal b) static BigInteger
multiply
(BigInteger[] a) static BigInteger
multiply
(BigInteger a, BigInteger b) static int
not
(int a) static BigInteger
not
(BigInteger a) static boolean
notEqual
(double x, double y) static boolean
notEqual
(int x, int y) static boolean
notEqual
(long x, long y) static boolean
notEqual
(BigDecimal x, BigDecimal y) static boolean
notEqual
(BigInteger x, BigInteger y) static int
or
(int a, int b) static BigInteger
or
(BigInteger a, BigInteger b) static BigDecimal
pow
(BigDecimal y, BigDecimal x) y raised to the x powerstatic BigInteger
pow
(BigInteger y, BigInteger x) y raised to the x powervoid
setStrict
(boolean strict) static double
subtract
(double[] a) static double
subtract
(double a, double b) static float
subtract
(float[] a) static float
subtract
(float a, float b) static int
subtract
(int[] a) static int
subtract
(int a, int b) static long
subtract
(long[] a) static long
subtract
(long a, long b) static BigDecimal
subtract
(BigDecimal[] a) static BigDecimal
subtract
(BigDecimal a, BigDecimal b) static BigInteger
subtract
(BigInteger[] a) static BigInteger
subtract
(BigInteger a, BigInteger b) static int
xor
(int a, int b) static BigInteger
xor
(BigInteger a, BigInteger b)
-
Field Details
-
BIGDECIMAL_TYPE
-
BIGINT_TYPE
-
-
Constructor Details
-
Math
public Math() -
Math
public Math(boolean strict)
-
-
Method Details
-
setStrict
public void setStrict(boolean strict) -
isStrict
public boolean isStrict() -
add
-
add
-
and
-
and
public static int and(int a, int b) -
or
-
or
public static int or(int a, int b) -
not
-
not
public static int not(int a) -
xor
-
xor
public static int xor(int a, int b) -
add
public static double add(double a, double b) -
add
public static float add(float a, float b) -
add
public static long add(long a, long b) -
add
public static int add(int a, int b) -
add
-
add
public static double add(double[] a) -
add
public static float add(float[] a) -
add
public static long add(long[] a) -
add
public static int add(int[] a) -
subtract
-
subtract
-
subtract
public static double subtract(double a, double b) -
subtract
public static float subtract(float a, float b) -
subtract
public static long subtract(long a, long b) -
subtract
public static int subtract(int a, int b) -
subtract
-
subtract
-
subtract
public static double subtract(double[] a) -
subtract
public static float subtract(float[] a) -
subtract
public static long subtract(long[] a) -
subtract
public static int subtract(int[] a) -
multiply
-
multiply
-
multiply
public static double multiply(double a, double b) -
multiply
public static float multiply(float a, float b) -
multiply
public static long multiply(long a, long b) -
multiply
public static int multiply(int a, int b) -
multiply
-
multiply
-
multiply
public static double multiply(double[] a) -
multiply
public static float multiply(float[] a) -
multiply
public static long multiply(long[] a) -
multiply
public static int multiply(int[] a) -
divide
-
divide
-
divide
public static double divide(double a, double b) -
divide
public static float divide(float a, float b) -
divide
public static long divide(long a, long b) -
divide
public static int divide(int a, int b) -
divide
-
divide
-
divide
public static double divide(double[] a) -
divide
public static float divide(float[] a) -
divide
public static long divide(long[] a) -
divide
public static int divide(int[] a) -
mod
-
mod
public static double mod(double a, double b) -
mod
public static float mod(float a, float b) -
mod
public static long mod(long a, long b) -
mod
public static int mod(int a, int b) -
mod
-
mod
public static double mod(double[] a) -
mod
public static float mod(float[] a) -
mod
public static long mod(long[] a) -
mod
public static int mod(int[] a) -
greaterThan
public static boolean greaterThan(int x, int y) -
greaterThan
public static boolean greaterThan(long x, long y) -
greaterThan
public static boolean greaterThan(double x, double y) -
greaterThan
-
greaterThan
-
lessThan
public static boolean lessThan(int x, int y) -
lessThan
public static boolean lessThan(long x, long y) -
lessThan
public static boolean lessThan(double x, double y) -
lessThan
-
lessThan
-
equal
public static boolean equal(int x, int y) -
equal
public static boolean equal(long x, long y) -
equal
public static boolean equal(double x, double y) -
equal
-
equal
-
notEqual
public static boolean notEqual(int x, int y) -
notEqual
public static boolean notEqual(long x, long y) -
notEqual
public static boolean notEqual(double x, double y) -
notEqual
-
notEqual
-
factorial
-
factorial
public static int factorial(double x) -
factorial
public static int factorial(float x) -
factorial
public static int factorial(int x) -
min
-
min
-
max
-
max
-
pow
y raised to the x power -
pow
y raised to the x power -
calculate
Do a mathematical calculation. The allowed operations are all operations supported by java.lang.Math and this class. Assumes data type is "double".- Parameters:
op
- the name of a mathematical operation to performoperands
- the operands for the operation, these strings must parse to numbers.
-
calculate
Do a mathematical calculation. The allowed operations are all operations supported by java.lang.Math.- Parameters:
op
- the name of a mathematical operation to performtype
- the data type of the operandsoperands
- the operands for the operation- Returns:
- the result of the calculation. For boolean operations, returns 1 for true, 0 for false;
-