This file is indexed.

/usr/share/doc/libantelope-java/manual/bk03ch15.html is in libantelope-java-doc 3.5.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 15. Math</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03.html" title="Additional Ant Tasks"><link rel="prev" href="bk03ch14.html" title="Chapter 14. UID"><link rel="next" href="bk03ch16.html" title="Chapter 16. Hostname"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 15. Math</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch14.html">Prev</a> </td><th width="60%" align="center">Additional Ant Tasks</th><td width="20%" align="right"> <a accesskey="n" href="bk03ch16.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="math"></a>Chapter 15. Math</h1></div></div></div>
@style@
    <p>
The Math task provides support for all the basic mathematical operations
provided by the java.lang.Math and java.lang.StrictMath classed. It supports int, long, float and double data types. Nesting of operations is supported to allow computation of formulas like (6 + (7.25 * 3.9))/(2 * 3 * 3) or calculating the area of a circle given a radius (I'm sure this comes up often in builds controlled by Ant!).
</p><p>
In addition to the operations provided by the java.lang.Math and java.lang.StrictMath classes, the Math task provides several additional operations: "add", "subtract", "multiply", "divide", and "mod", which duplicate the basic Java mathematical operations "+", "-", "*", "/", and "%", respectively. In fact, either notation can be used, that is, the operation can be set to "add" or "+", depending only on which you feel is more convenient.
</p><p>
To use this task in your build files, include a task definition like this:
</p><p>
</p><pre class="programlisting">

    &lt;taskdef name="math" classname="ise.antelope.tasks.MathTask"/&gt;
   
</pre><p>
</p><p>
</p><div class="table"><a name="idm1641"></a><p class="title"><b>Table 15.1. Math Task Attributes</b></p><div class="table-contents"><table class="table" summary="Math Task Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>result</td><td>The name of the property to hold the result of the operation.</td><td>None</td><td>Yes</td></tr><tr><td>datatype</td><td>Sets the datatype of the calculation. Allowed values are
"int", "long", "float", or "double". Optional, if
used, will be applied to all numbers in this math operation.</td><td>double</td><td>No</td></tr><tr><td>strict</td><td>If true, use the methods in the java.lang.StrictMath class.</td><td>false</td><td>No</td></tr><tr><td>operation</td><td>If used, any nested Ops will be ignored. This is for convenience for simple calculations.</td><td>None</td><td>No</td></tr><tr><td>operand1</td><td>A number to use with the operation specified in the 'operation' attribute.</td><td>None</td><td>Depends on the specific operation.</td></tr><tr><td>operand2</td><td>A number to use with the operation specified in the 'operation' attribute.</td><td>None</td><td>Depends on the specific operation.</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
The 'result' property is reusable.
</p>

The Math task supports nested "Op" elements. An Op element represents single mathematical operation, such as "min" or "add".

<p>
</p><div class="table"><a name="idm1683"></a><p class="title"><b>Table 15.2. Op Attributes</b></p><div class="table-contents"><table class="table" summary="Op Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>op</td><td>Set the name of this operation. Allowed values are
one of the method names from java.lang.Math or java.lang.StrictMath, or one of "add", "subtract", "multiply", "divide", or "mod" (or "+", "-", "*", "/", or "%", respectively)</td><td>None</td><td>Yes</td></tr><tr><td>datatype</td><td>Sets the datatype of this calculation. Allowed values are
"int", "long", "float", or "double". Optional, default
is "double". If the parent Math task has a datatype set, this value will be ignored and the datatype specifed in the task will be used.</td><td>"int"</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
The Op element supports nested "Op" elements and nested "Num" elements. A Num represents a number. When an Op is nested in another Op, the nested Op is treated as a Num. The nested elements can be any combination of Op or Num as appropriate for the formula being calculated. Most of the operations provided by java.lang.Math and java.lang.StrictMath operate on one or two numbers. The "+", "-", "*", "/", and "%" operations can task any number of nested numbers.
</p><p>
</p><div class="table"><a name="idm1705"></a><p class="title"><b>Table 15.3. Num Attributes</b></p><div class="table-contents"><table class="table" summary="Num Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>value</td><td>Set the value for this number. Must be able to parse to the datatype set by the parent element or the default datatype set by the task. Two special numbers, pi and e, can be represented by PI and E respectively. ("PI" is the ratio of the diameter of a circle to its radius, "E" is Euler's e, the base for natural logrithms.)</td><td>None</td><td>Yes</td></tr><tr><td>datatype</td><td>Sets the datatype of this number. Allowed values are
"int", "long", "float", or "double". Optional, default
is "double". If the parent Math task has a datatype set, this value will be ignored and the datatype specifed in the task will be used.</td><td>double</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
Some examples:
</p><p>
</p><pre class="programlisting">

    &lt;var name="op1" value="12"/&gt;
    &lt;var name="op2" value="6"/&gt;
    &lt;var name="op" value="+"/&gt;

    &lt;!-- demo plus --&gt;
    &lt;math result="result" operand1="${op1}" operation="${op}" operand2="${op2}" datatype="int"/&gt;
    &lt;echo&gt;${op1} ${op} ${op2} = ${result}&lt;/echo&gt;
    &lt;assert name="result" value="18"/&gt;

    &lt;!-- demo reusing result --&gt;
    &lt;math result="result" operand1="${result}" operation="${op}" operand2="${op2}" datatype="int"/&gt;
    &lt;echo&gt;${op1} ${op} ${op2} = ${result}&lt;/echo&gt;
    &lt;assert name="result" value="24"/&gt;

    &lt;!-- demo minus --&gt;
    &lt;var name="op" value="-"/&gt;
    &lt;math result="result" operand1="${op1}" operation="${op}" operand2="${op2}" datatype="int"/&gt;
    &lt;echo&gt;${op1} ${op} ${op2} = ${result}&lt;/echo&gt;
    &lt;assert name="result" value="6"/&gt;

    &lt;!-- demo multiply --&gt;
    &lt;var name="op" value="*"/&gt;
    &lt;math result="result" operand1="${op1}" operation="${op}" operand2="${op2}" datatype="int"/&gt;
    &lt;echo&gt;${op1} ${op} ${op2} = ${result}&lt;/echo&gt;
    &lt;assert name="result" value="72"/&gt;

    &lt;!-- demo divide --&gt;
    &lt;var name="op" value="/"/&gt;
    &lt;math result="result" operand1="${op1}" operation="${op}" operand2="${op2}" datatype="int"/&gt;
    &lt;echo&gt;${op1} ${op} ${op2} = ${result}&lt;/echo&gt;
    &lt;assert name="result" value="2"/&gt;

    &lt;!-- demo modulo --&gt;
    &lt;var name="op" value="%"/&gt;
    &lt;math result="result" operand1="${op1}" operation="${op}" operand2="${op2}" datatype="int"/&gt;
    &lt;echo&gt;${op1} ${op} ${op2} = ${result}&lt;/echo&gt;
    &lt;assert name="result" value="0"/&gt;

    &lt;!-- demo calculating the area of a circle --&gt;
    &lt;!-- first, calculate the radius --&gt;
    &lt;math result="radius"&gt;  &lt;!-- defaults to double datatype --&gt;
        &lt;op type="*"&gt;
            &lt;num value="1"/&gt;
            &lt;num value="2"/&gt;
            &lt;num value="3"/&gt;
            &lt;num value="4"/&gt;
            &lt;num value="5"/&gt;
        &lt;/op&gt;
    &lt;/math&gt;
    &lt;echo&gt; 1 * 2 * 3 * 4 * 5 = ${radius}&lt;/echo&gt;

    &lt;!-- now calculate the area --&gt;
    &lt;math result="area" precision="float"&gt;
        &lt;op type="*"&gt;
            &lt;num value="PI"/&gt;
            &lt;op type="pow"&gt;
                &lt;num value="${radius}"/&gt;
                &lt;num value="2"/&gt;
            &lt;/op&gt;
        &lt;/op&gt;
    &lt;/math&gt;
    &lt;echo&gt;area = PI * radius ^ 2 = ${area}&lt;/echo&gt;

    &lt;!-- demo calculating a random number between 0 and 100 --&gt;
    &lt;math result="result"&gt;
        &lt;op op="rint"&gt;
            &lt;op op="*"&gt;
                &lt;num value="100"/&gt;
                &lt;op op="random"/&gt;
            &lt;/op&gt;
        &lt;/op&gt;
    &lt;/math&gt;
    &lt;echo&gt;a random number between 0 and 100: ${result}&lt;/echo&gt;

    &lt;!-- demo another multiplication --&gt;
    &lt;math result="result" operation="multiply" operand1="17" operand2="13"/&gt;
    &lt;echo&gt;${result}&lt;/echo&gt;

</pre><p>
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch14.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk03ch16.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 14. UID </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 16. Hostname</td></tr></table></div></body></html>