<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<!--NewPage--> | |
<HTML> | |
<HEAD> | |
<!-- Generated by javadoc (build 1.5.0_02) on Mon Feb 05 10:30:42 PST 2007 --> | |
<TITLE> | |
MathTool (VelocityTools 1.3 Documentation) | |
</TITLE> | |
<META NAME="keywords" CONTENT="org.apache.velocity.tools.generic.MathTool class"> | |
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> | |
<SCRIPT type="text/javascript"> | |
function windowTitle() | |
{ | |
parent.document.title="MathTool (VelocityTools 1.3 Documentation)"; | |
} | |
</SCRIPT> | |
<NOSCRIPT> | |
</NOSCRIPT> | |
</HEAD> | |
<BODY BGCOLOR="white" onload="windowTitle();"> | |
<!-- ========= START OF TOP NAVBAR ======= --> | |
<A NAME="navbar_top"><!-- --></A> | |
<A HREF="#skip-navbar_top" title="Skip navigation links"></A> | |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> | |
<TR> | |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> | |
<A NAME="navbar_top_firstrow"><!-- --></A> | |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> | |
<TR ALIGN="center" VALIGN="top"> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> | |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> | |
</TR> | |
</TABLE> | |
</TD> | |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> | |
</EM> | |
</TD> | |
</TR> | |
<TR> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../../org/apache/velocity/tools/generic/ListTool.html" title="class in org.apache.velocity.tools.generic"><B>PREV CLASS</B></A> | |
<A HREF="../../../../../org/apache/velocity/tools/generic/NumberTool.html" title="class in org.apache.velocity.tools.generic"><B>NEXT CLASS</B></A></FONT></TD> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../../index.html?org/apache/velocity/tools/generic/MathTool.html" target="_top"><B>FRAMES</B></A> | |
<A HREF="MathTool.html" target="_top"><B>NO FRAMES</B></A> | |
<SCRIPT type="text/javascript"> | |
<!-- | |
if(window==top) { | |
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); | |
} | |
//--> | |
</SCRIPT> | |
<NOSCRIPT> | |
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> | |
</NOSCRIPT> | |
</FONT></TD> | |
</TR> | |
<TR> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> | |
</TR> | |
</TABLE> | |
<A NAME="skip-navbar_top"></A> | |
<!-- ========= END OF TOP NAVBAR ========= --> | |
<HR> | |
<!-- ======== START OF CLASS DATA ======== --> | |
<H2> | |
<FONT SIZE="-1"> | |
org.apache.velocity.tools.generic</FONT> | |
<BR> | |
Class MathTool</H2> | |
<PRE> | |
java.lang.Object | |
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.velocity.tools.generic.MathTool</B> | |
</PRE> | |
<HR> | |
<DL> | |
<DT><PRE>public class <B>MathTool</B><DT>extends java.lang.Object</DL> | |
</PRE> | |
<P> | |
<p>Tool for performing math in Velocity.</p> | |
<p>Some things should be noted here:</p> | |
<ul> | |
<li>This class does not have methods that take | |
primitives. This is simply because Velocity | |
wraps all primitives for us automagically.</li> | |
<li>No null pointer, number format, or divide by zero | |
exceptions are thrown here. This is because such exceptions | |
thrown in template halt rendering. It should be sufficient | |
debugging feedback that Velocity will render the reference | |
literally. (e.g. $math.div(1, 0) renders as '$math.div(1, 0)')</li> | |
</ul> | |
<p><pre> | |
Example toolbox.xml config (if you want to use this with VelocityView): | |
<tool> | |
<key>math</key> | |
<scope>application</scope> | |
<class>org.apache.velocity.tools.generic.MathTool</class> | |
</tool> | |
</pre></p> | |
<P> | |
<P> | |
<DL> | |
<DT><B>Version:</B></DT> | |
<DD>$Revision: 479724 $ $Date: 2006-11-27 10:49:37 -0800 (Mon, 27 Nov 2006) $</DD> | |
<DT><B>Author:</B></DT> | |
<DD>Nathan Bubna, Leon Messerschmidt</DD> | |
</DL> | |
<HR> | |
<P> | |
<!-- ======== CONSTRUCTOR SUMMARY ======== --> | |
<A NAME="constructor_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Constructor Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#MathTool()">MathTool</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
</TABLE> | |
| |
<!-- ========== METHOD SUMMARY =========== --> | |
<A NAME="method_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Method Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#abs(java.lang.Object)">abs</A></B>(java.lang.Object num)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#add(java.lang.Object, java.lang.Object)">add</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#ceil(java.lang.Object)">ceil</A></B>(java.lang.Object num)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#div(java.lang.Object, java.lang.Object)">div</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#floor(java.lang.Object)">floor</A></B>(java.lang.Object num)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getAverage(java.util.Collection)">getAverage</A></B>(java.util.Collection collection)</CODE> | |
<BR> | |
Get the average of the values</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getAverage(java.util.Collection, java.lang.String)">getAverage</A></B>(java.util.Collection collection, | |
java.lang.String field)</CODE> | |
<BR> | |
Get the average of the values from a list</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getAverage(double[])">getAverage</A></B>(double[] values)</CODE> | |
<BR> | |
Get the average of the values in an array of double values</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getAverage(long[])">getAverage</A></B>(long[] values)</CODE> | |
<BR> | |
Get the average of the values in an array of long values</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getAverage(java.lang.Object[])">getAverage</A></B>(java.lang.Object[] array)</CODE> | |
<BR> | |
Get the average of the values</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getAverage(java.lang.Object[], java.lang.String)">getAverage</A></B>(java.lang.Object[] array, | |
java.lang.String field)</CODE> | |
<BR> | |
Get the sum of the values from a list</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Double</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getRandom()">getRandom</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getTotal(java.util.Collection)">getTotal</A></B>(java.util.Collection collection)</CODE> | |
<BR> | |
Get the sum of the values</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getTotal(java.util.Collection, java.lang.String)">getTotal</A></B>(java.util.Collection collection, | |
java.lang.String field)</CODE> | |
<BR> | |
Get the sum of the values from a list</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getTotal(double[])">getTotal</A></B>(double[] values)</CODE> | |
<BR> | |
Get the sum of the values</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getTotal(long[])">getTotal</A></B>(long[] values)</CODE> | |
<BR> | |
Get the sum of the values</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getTotal(java.lang.Object[])">getTotal</A></B>(java.lang.Object[] array)</CODE> | |
<BR> | |
Get the sum of the values</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#getTotal(java.lang.Object[], java.lang.String)">getTotal</A></B>(java.lang.Object[] array, | |
java.lang.String field)</CODE> | |
<BR> | |
Get the sum of the values from a list</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#idiv(java.lang.Object, java.lang.Object)">idiv</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
Does integer division on the int values of the specified numbers.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>protected java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#matchType(java.lang.Number, double)">matchType</A></B>(java.lang.Number in, | |
double out)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>protected java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#matchType(java.lang.Number, java.lang.Number, double)">matchType</A></B>(java.lang.Number in1, | |
java.lang.Number in2, | |
double out)</CODE> | |
<BR> | |
Takes the original argument(s) and returns the resulting value as | |
an instance of the best matching type (Integer, Long, or Double).</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#max(java.lang.Object, java.lang.Object)">max</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#min(java.lang.Object, java.lang.Object)">min</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#mod(java.lang.Object, java.lang.Object)">mod</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
Does integer modulus on the int values of the specified numbers.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#mul(java.lang.Object, java.lang.Object)">mul</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>protected java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#parseNumber(java.lang.String)">parseNumber</A></B>(java.lang.String value)</CODE> | |
<BR> | |
Converts an object into a <CODE>Number</CODE> (if it can) | |
This is used as the base for all numeric parsing methods.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#pow(java.lang.Object, java.lang.Object)">pow</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#random(java.lang.Object, java.lang.Object)">random</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
This returns a random <CODE>Number</CODE> within the | |
specified range.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#round(java.lang.Object)">round</A></B>(java.lang.Object num)</CODE> | |
<BR> | |
Rounds a number to the nearest whole Integer</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Double</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#roundTo(java.lang.Object, java.lang.Object)">roundTo</A></B>(java.lang.Object decimals, | |
java.lang.Object num)</CODE> | |
<BR> | |
Rounds a number to the specified number of decimal places.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#sub(java.lang.Object, java.lang.Object)">sub</A></B>(java.lang.Object num1, | |
java.lang.Object num2)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Double</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toDouble(java.lang.Object)">toDouble</A></B>(java.lang.Object num)</CODE> | |
<BR> | |
Converts an object with a numeric value into a Double | |
Valid formats are <CODE>Number</CODE> or a <CODE>String</CODE> | |
representation of a number</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toInteger(java.lang.Object)">toInteger</A></B>(java.lang.Object num)</CODE> | |
<BR> | |
Converts an object with a numeric value into an Integer | |
Valid formats are <CODE>Number</CODE> or a <CODE>String</CODE> | |
representation of a number</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)">toNumber</A></B>(java.lang.Object num)</CODE> | |
<BR> | |
Converts an object with a numeric value into a Number | |
Valid formats are <CODE>Number</CODE> or a <CODE>String</CODE> | |
representation of a number.</TD> | |
</TR> | |
</TABLE> | |
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> | |
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> | |
</TR> | |
</TABLE> | |
| |
<P> | |
<!-- ========= CONSTRUCTOR DETAIL ======== --> | |
<A NAME="constructor_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Constructor Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="MathTool()"><!-- --></A><H3> | |
MathTool</H3> | |
<PRE> | |
public <B>MathTool</B>()</PRE> | |
<DL> | |
</DL> | |
<!-- ============ METHOD DETAIL ========== --> | |
<A NAME="method_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Method Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="add(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
add</H3> | |
<PRE> | |
public java.lang.Number <B>add</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the sum of the numbers or | |
<code>null</code> if they're invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)"><CODE>toNumber(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="sub(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
sub</H3> | |
<PRE> | |
public java.lang.Number <B>sub</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the difference of the numbers or | |
<code>null</code> if they're invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)"><CODE>toNumber(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="mul(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
mul</H3> | |
<PRE> | |
public java.lang.Number <B>mul</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the product of the numbers or | |
<code>null</code> if they're invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)"><CODE>toNumber(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="div(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
div</H3> | |
<PRE> | |
public java.lang.Number <B>div</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the quotient of the numbers or | |
<code>null</code> if they're invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)"><CODE>toNumber(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="pow(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
pow</H3> | |
<PRE> | |
public java.lang.Number <B>pow</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the first number raised to the power of the | |
second or <code>null</code> if they're invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)"><CODE>toNumber(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="idiv(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
idiv</H3> | |
<PRE> | |
public java.lang.Integer <B>idiv</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD>Does integer division on the int values of the specified numbers. | |
<p>So, $math.idiv('5.1',3) will return '1', | |
and $math.idiv(6,'3.9') will return '2'.</p> | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the result of performing integer division | |
on the operands.<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toInteger(java.lang.Object)"><CODE>toInteger(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="mod(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
mod</H3> | |
<PRE> | |
public java.lang.Integer <B>mod</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD>Does integer modulus on the int values of the specified numbers. | |
<p>So, $math.mod('5.1',3) will return '2', | |
and $math.mod(6,'3.9') will return '0'.</p> | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the result of performing integer modulus | |
on the operands.<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toInteger(java.lang.Object)"><CODE>toInteger(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="max(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
max</H3> | |
<PRE> | |
public java.lang.Number <B>max</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the largest of the numbers or | |
<code>null</code> if they're invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)"><CODE>toNumber(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="min(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
min</H3> | |
<PRE> | |
public java.lang.Number <B>min</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>the smallest of the numbers or | |
<code>null</code> if they're invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)"><CODE>toNumber(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="abs(java.lang.Object)"><!-- --></A><H3> | |
abs</H3> | |
<PRE> | |
public java.lang.Number <B>abs</B>(java.lang.Object num)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the number | |
<DT><B>Returns:</B><DD>the absolute value of the number or | |
<code>null</code> if it's invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toDouble(java.lang.Object)"><CODE>toDouble(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="ceil(java.lang.Object)"><!-- --></A><H3> | |
ceil</H3> | |
<PRE> | |
public java.lang.Integer <B>ceil</B>(java.lang.Object num)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the number | |
<DT><B>Returns:</B><DD>the smallest integer that is not | |
less than the given number</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="floor(java.lang.Object)"><!-- --></A><H3> | |
floor</H3> | |
<PRE> | |
public java.lang.Integer <B>floor</B>(java.lang.Object num)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the number | |
<DT><B>Returns:</B><DD>the integer portion of the number</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="round(java.lang.Object)"><!-- --></A><H3> | |
round</H3> | |
<PRE> | |
public java.lang.Integer <B>round</B>(java.lang.Object num)</PRE> | |
<DL> | |
<DD>Rounds a number to the nearest whole Integer | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the number to round | |
<DT><B>Returns:</B><DD>the number rounded to the nearest whole Integer | |
or <code>null</code> if it's invalid<DT><B>See Also:</B><DD><CODE>Math.rint(double)</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="roundTo(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
roundTo</H3> | |
<PRE> | |
public java.lang.Double <B>roundTo</B>(java.lang.Object decimals, | |
java.lang.Object num)</PRE> | |
<DL> | |
<DD>Rounds a number to the specified number of decimal places. | |
This is particulary useful for simple display formatting. | |
If you want to round an number to the nearest integer, it | |
is better to use <A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#round(java.lang.Object)"><CODE>round(java.lang.Object)</CODE></A>, as that will return | |
an <CODE>Integer</CODE> rather than a <CODE>Double</CODE>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>decimals</CODE> - the number of decimal places<DD><CODE>num</CODE> - the number to round | |
<DT><B>Returns:</B><DD>the value rounded to the specified number of | |
decimal places or <code>null</code> if it's invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#toNumber(java.lang.Object)"><CODE>toNumber(java.lang.Object)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getRandom()"><!-- --></A><H3> | |
getRandom</H3> | |
<PRE> | |
public java.lang.Double <B>getRandom</B>()</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>a pseudo-random <CODE>Double</CODE> greater | |
than or equal to 0.0 and less than 1.0<DT><B>See Also:</B><DD><CODE>Math.random()</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="random(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
random</H3> | |
<PRE> | |
public java.lang.Number <B>random</B>(java.lang.Object num1, | |
java.lang.Object num2)</PRE> | |
<DL> | |
<DD>This returns a random <CODE>Number</CODE> within the | |
specified range. The returned value will be | |
greater than or equal to the first number | |
and less than the second number. If both arguments | |
are whole numbers then the returned number will | |
also be, otherwise a <CODE>Double</CODE> will | |
be returned. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num1</CODE> - the first number<DD><CODE>num2</CODE> - the second number | |
<DT><B>Returns:</B><DD>a pseudo-random <CODE>Number</CODE> greater than | |
or equal to the first number and less than | |
the second<DT><B>See Also:</B><DD><CODE>Math.random()</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toInteger(java.lang.Object)"><!-- --></A><H3> | |
toInteger</H3> | |
<PRE> | |
public java.lang.Integer <B>toInteger</B>(java.lang.Object num)</PRE> | |
<DL> | |
<DD>Converts an object with a numeric value into an Integer | |
Valid formats are <CODE>Number</CODE> or a <CODE>String</CODE> | |
representation of a number | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the number to be converted | |
<DT><B>Returns:</B><DD>a <CODE>Integer</CODE> representation of the number | |
or <code>null</code> if it's invalid</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toDouble(java.lang.Object)"><!-- --></A><H3> | |
toDouble</H3> | |
<PRE> | |
public java.lang.Double <B>toDouble</B>(java.lang.Object num)</PRE> | |
<DL> | |
<DD>Converts an object with a numeric value into a Double | |
Valid formats are <CODE>Number</CODE> or a <CODE>String</CODE> | |
representation of a number | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the number to be converted | |
<DT><B>Returns:</B><DD>a <CODE>Double</CODE> representation of the number | |
or <code>null</code> if it's invalid</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toNumber(java.lang.Object)"><!-- --></A><H3> | |
toNumber</H3> | |
<PRE> | |
public java.lang.Number <B>toNumber</B>(java.lang.Object num)</PRE> | |
<DL> | |
<DD>Converts an object with a numeric value into a Number | |
Valid formats are <CODE>Number</CODE> or a <CODE>String</CODE> | |
representation of a number. Note that this does not | |
handle localized number formats. Use the <A HREF="../../../../../org/apache/velocity/tools/generic/NumberTool.html" title="class in org.apache.velocity.tools.generic"><CODE>NumberTool</CODE></A> | |
to handle such conversions. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the number to be converted | |
<DT><B>Returns:</B><DD>a <CODE>Number</CODE> representation of the number | |
or <code>null</code> if it's invalid</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="matchType(java.lang.Number, double)"><!-- --></A><H3> | |
matchType</H3> | |
<PRE> | |
protected java.lang.Number <B>matchType</B>(java.lang.Number in, | |
double out)</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/MathTool.html#matchType(java.lang.Number, java.lang.Number, double)"><CODE>matchType(Number,Number,double)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="matchType(java.lang.Number, java.lang.Number, double)"><!-- --></A><H3> | |
matchType</H3> | |
<PRE> | |
protected java.lang.Number <B>matchType</B>(java.lang.Number in1, | |
java.lang.Number in2, | |
double out)</PRE> | |
<DL> | |
<DD>Takes the original argument(s) and returns the resulting value as | |
an instance of the best matching type (Integer, Long, or Double). | |
If either an argument or the result is not an integer (i.e. has no | |
decimal when rendered) the result will be returned as a Double. | |
If not and the result is < -2147483648 or > 2147483647, then a | |
Long will be returned. Otherwise, an Integer will be returned. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="parseNumber(java.lang.String)"><!-- --></A><H3> | |
parseNumber</H3> | |
<PRE> | |
protected java.lang.Number <B>parseNumber</B>(java.lang.String value) | |
throws java.lang.NumberFormatException</PRE> | |
<DL> | |
<DD>Converts an object into a <CODE>Number</CODE> (if it can) | |
This is used as the base for all numeric parsing methods. So, | |
sub-classes can override to allow for customized number parsing. | |
(e.g. for i18n, fractions, compound numbers, bigger numbers, etc.) | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the string to be parsed | |
<DT><B>Returns:</B><DD>the value as a <CODE>Number</CODE> | |
<DT><B>Throws:</B> | |
<DD><CODE>java.lang.NumberFormatException</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getTotal(java.util.Collection, java.lang.String)"><!-- --></A><H3> | |
getTotal</H3> | |
<PRE> | |
public java.lang.Number <B>getTotal</B>(java.util.Collection collection, | |
java.lang.String field)</PRE> | |
<DL> | |
<DD>Get the sum of the values from a list | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>collection</CODE> - A collection containing Java beans<DD><CODE>field</CODE> - A Java Bean field for the objects in <i>collection</i> that | |
will return a number. | |
<DT><B>Returns:</B><DD>The sum of the values in <i>collection</i>.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getAverage(java.util.Collection, java.lang.String)"><!-- --></A><H3> | |
getAverage</H3> | |
<PRE> | |
public java.lang.Number <B>getAverage</B>(java.util.Collection collection, | |
java.lang.String field)</PRE> | |
<DL> | |
<DD>Get the average of the values from a list | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>collection</CODE> - A collection containing Java beans<DD><CODE>field</CODE> - A Java Bean field for the objects in <i>collection</i> that | |
will return a number. | |
<DT><B>Returns:</B><DD>The average of the values in <i>collection</i>.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getTotal(java.lang.Object[], java.lang.String)"><!-- --></A><H3> | |
getTotal</H3> | |
<PRE> | |
public java.lang.Number <B>getTotal</B>(java.lang.Object[] array, | |
java.lang.String field)</PRE> | |
<DL> | |
<DD>Get the sum of the values from a list | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>array</CODE> - An array containing Java beans<DD><CODE>field</CODE> - A Java Bean field for the objects in <i>array</i> that | |
will return a number. | |
<DT><B>Returns:</B><DD>The sum of the values in <i>array</i>.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getAverage(java.lang.Object[], java.lang.String)"><!-- --></A><H3> | |
getAverage</H3> | |
<PRE> | |
public java.lang.Number <B>getAverage</B>(java.lang.Object[] array, | |
java.lang.String field)</PRE> | |
<DL> | |
<DD>Get the sum of the values from a list | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>array</CODE> - A collection containing Java beans<DD><CODE>field</CODE> - A Java Bean field for the objects in <i>array</i> that | |
will return a number. | |
<DT><B>Returns:</B><DD>The sum of the values in <i>array</i>.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getTotal(java.util.Collection)"><!-- --></A><H3> | |
getTotal</H3> | |
<PRE> | |
public java.lang.Number <B>getTotal</B>(java.util.Collection collection)</PRE> | |
<DL> | |
<DD>Get the sum of the values | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>collection</CODE> - A collection containing numeric values | |
<DT><B>Returns:</B><DD>The sum of the values in <i>collection</i>.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getAverage(java.util.Collection)"><!-- --></A><H3> | |
getAverage</H3> | |
<PRE> | |
public java.lang.Number <B>getAverage</B>(java.util.Collection collection)</PRE> | |
<DL> | |
<DD>Get the average of the values | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>collection</CODE> - A collection containing number values | |
<DT><B>Returns:</B><DD>The average of the values in <i>collection</i>.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getTotal(java.lang.Object[])"><!-- --></A><H3> | |
getTotal</H3> | |
<PRE> | |
public java.lang.Number <B>getTotal</B>(java.lang.Object[] array)</PRE> | |
<DL> | |
<DD>Get the sum of the values | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>array</CODE> - An array containing number values | |
<DT><B>Returns:</B><DD>The sum of the values in <i>array</i>.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getAverage(java.lang.Object[])"><!-- --></A><H3> | |
getAverage</H3> | |
<PRE> | |
public java.lang.Number <B>getAverage</B>(java.lang.Object[] array)</PRE> | |
<DL> | |
<DD>Get the average of the values | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>array</CODE> - An array containing number values | |
<DT><B>Returns:</B><DD>The sum of the values in <i>array</i>.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getTotal(double[])"><!-- --></A><H3> | |
getTotal</H3> | |
<PRE> | |
public java.lang.Number <B>getTotal</B>(double[] values)</PRE> | |
<DL> | |
<DD>Get the sum of the values | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>values</CODE> - The list of double values to add up. | |
<DT><B>Returns:</B><DD>The sum of the arrays</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getAverage(double[])"><!-- --></A><H3> | |
getAverage</H3> | |
<PRE> | |
public java.lang.Number <B>getAverage</B>(double[] values)</PRE> | |
<DL> | |
<DD>Get the average of the values in an array of double values | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>values</CODE> - The list of double values | |
<DT><B>Returns:</B><DD>The average of the array of values</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getTotal(long[])"><!-- --></A><H3> | |
getTotal</H3> | |
<PRE> | |
public java.lang.Number <B>getTotal</B>(long[] values)</PRE> | |
<DL> | |
<DD>Get the sum of the values | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>values</CODE> - The list of long values to add up. | |
<DT><B>Returns:</B><DD>The sum of the arrays</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getAverage(long[])"><!-- --></A><H3> | |
getAverage</H3> | |
<PRE> | |
public java.lang.Number <B>getAverage</B>(long[] values)</PRE> | |
<DL> | |
<DD>Get the average of the values in an array of long values | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>values</CODE> - The list of long values | |
<DT><B>Returns:</B><DD>The average of the array of values</DL> | |
</DD> | |
</DL> | |
<!-- ========= END OF CLASS DATA ========= --> | |
<HR> | |
<!-- ======= START OF BOTTOM NAVBAR ====== --> | |
<A NAME="navbar_bottom"><!-- --></A> | |
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> | |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> | |
<TR> | |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> | |
<A NAME="navbar_bottom_firstrow"><!-- --></A> | |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> | |
<TR ALIGN="center" VALIGN="top"> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> | |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> | |
</TR> | |
</TABLE> | |
</TD> | |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> | |
</EM> | |
</TD> | |
</TR> | |
<TR> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../../org/apache/velocity/tools/generic/ListTool.html" title="class in org.apache.velocity.tools.generic"><B>PREV CLASS</B></A> | |
<A HREF="../../../../../org/apache/velocity/tools/generic/NumberTool.html" title="class in org.apache.velocity.tools.generic"><B>NEXT CLASS</B></A></FONT></TD> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../../index.html?org/apache/velocity/tools/generic/MathTool.html" target="_top"><B>FRAMES</B></A> | |
<A HREF="MathTool.html" target="_top"><B>NO FRAMES</B></A> | |
<SCRIPT type="text/javascript"> | |
<!-- | |
if(window==top) { | |
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); | |
} | |
//--> | |
</SCRIPT> | |
<NOSCRIPT> | |
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> | |
</NOSCRIPT> | |
</FONT></TD> | |
</TR> | |
<TR> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> | |
</TR> | |
</TABLE> | |
<A NAME="skip-navbar_bottom"></A> | |
<!-- ======== END OF BOTTOM NAVBAR ======= --> | |
<HR> | |
Copyright (c) 2003-2007 Apache Software Foundation | |
</BODY> | |
</HTML> |