net.sf.antcontrib.property
Class Math
java.lang.Object
|
+--net.sf.antcontrib.property.Math
- public class Math
- extends java.lang.Object
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.
Developed for use with Antelope, migrated to ant-contrib Oct 2003.
- Version:
- $Revision: 1.2 $
- Author:
- Dale Anson, danson@germane-software.com
Constructor Summary |
Math()
|
Math(boolean strict)
|
Method Summary |
static 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)
|
java.lang.Number |
calculate(java.lang.String op,
java.lang.String[] operands)
Do a mathematical calculation. |
java.lang.Number |
calculate(java.lang.String op,
java.lang.String type,
java.lang.String[] operands)
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)
|
boolean |
isStrict()
|
static void |
main(java.lang.String[] args)
|
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 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)
|
void |
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Math
public Math()
Math
public Math(boolean strict)
setStrict
public void setStrict(boolean strict)
isStrict
public boolean isStrict()
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
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
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
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
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
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
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
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
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
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)
calculate
public java.lang.Number calculate(java.lang.String op,
java.lang.String[] operands)
- 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 perform
calculate
public java.lang.Number calculate(java.lang.String op,
java.lang.String type,
java.lang.String[] operands)
- 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 operands
main
public static void main(java.lang.String[] args)