MathTask (Ant Contrib)
Keywords: net.sf.antcontrib.property.MathTask,MathTask class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.antcontrib.property
Class MathTask

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.Task
                  |
                  +--net.sf.antcontrib.property.MathTask

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.

Developed for use with Antelope, migrated to ant-contrib Oct 2003.

Version:
  $Revision: 1.2 $
Author:
  Dale Anson, danson@germane-software.com

Field Summary

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`MathTask()`

Method Summary
`void` | `addConfiguredOp(Op op)` Add a nested operation.
`void` | `execute()`
`void` | `setDatatype(java.lang.String type)` Sets the datatype of this calculation.
`void` | `setOperand1(java.lang.String op)` Set an operand as an attribute.
`void` | `setOperand2(java.lang.String op)` Set an operand as an attribute.
`void` | `setOperation(java.lang.String op)` Set an operation as an attribute.
`void` | `setResult(java.lang.String name)` 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
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MathTask

    public MathTask()

Method Detail

### setResult

    public void setResult(java.lang.String name)

  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

    public void setDatatype(java.lang.String type)

  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

    public void setOperand1(java.lang.String op)
                     throws org.apache.tools.ant.BuildException

  Set an operand as an attribute. This is for convenience, if used, it overrides any nested Ops. Must parse to a number.

    `org.apache.tools.ant.BuildException`

### setOperand2

    public void setOperand2(java.lang.String op)
                     throws org.apache.tools.ant.BuildException

  Set an operand as an attribute. This is for convenience, if used, it overrides any nested Ops. Must parse to a number.

    `org.apache.tools.ant.BuildException`

### setOperation

    public void setOperation(java.lang.String op)

  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

    public void addConfiguredOp(Op op)

  Add a nested operation. Only one operation is allowed at a time.

### setStrict

    public void setStrict(boolean b)

  Use the StrictMath library.

### execute

    public void execute()

  Overrides:
    `execute` in class `org.apache.tools.ant.Task`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD