Package ise.antelope.tasks
Class MathTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
ise.antelope.tasks.MathTask
- All Implemented Interfaces:
Cloneable
public class MathTask
extends org.apache.tools.ant.Task
Provides basic math functions. Simple calculations can be done via attributes
only, more complex formulas can be set up via nested Ops.
-
Field Summary
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConfiguredOp
(Op op) Add a nested operation.void
execute()
void
setDatatype
(String type) Sets the datatype of this calculation.void
setOperand1
(String op) Set an operand as an attribute.void
setOperand2
(String op) Set an operand as an attribute.void
setOperation
(String op) Set an operation as an attribute.void
Sets the name of the property to store the result in.void
setStrict
(boolean b) Use the StrictMath library.Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Constructor Details
-
MathTask
public MathTask()
-
-
Method Details
-
setResult
Sets the name of the property to store the result in. This is stored in a user property, so is reusable.- Parameters:
name
- the name of a property to set for a result.
-
setDatatype
Sets the datatype of this calculation. Allowed values are "int", "long", "float", or "double". Optional, if used, will be applied to all numbers in this math operation. -
setOperand1
Set an operand as an attribute. This is for convenience, if used, it overrides any nested Ops. Must parse to a number.- Throws:
org.apache.tools.ant.BuildException
-
setOperand2
Set an operand as an attribute. This is for convenience, if used, it overrides any nested Ops. Must parse to a number.- Throws:
org.apache.tools.ant.BuildException
-
setOperation
Set an operation as an attribute. This is for convenience, if used, it overrides any nested Ops.- Parameters:
op
- any operation allowed by Op.
-
addConfiguredOp
Add a nested operation. Only one operation is allowed at a time.- Parameters:
op
- the operation to add.
-
setStrict
public void setStrict(boolean b) Use the StrictMath library. -
execute
public void execute()- Overrides:
execute
in classorg.apache.tools.ant.Task
-