| <!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.6.0_22) on Mon Nov 29 23:49:19 PST 2010 --> |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <TITLE> |
| MathUtils (Apache Velocity 1.7 API) |
| </TITLE> |
| |
| <META NAME="date" CONTENT="2010-11-29"> |
| |
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> |
| |
| <SCRIPT type="text/javascript"> |
| function windowTitle() |
| { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="MathUtils (Apache Velocity 1.7 API)"; |
| } |
| } |
| </SCRIPT> |
| <NOSCRIPT> |
| </NOSCRIPT> |
| |
| </HEAD> |
| |
| <BODY BGCOLOR="white" onload="windowTitle();"> |
| <HR> |
| |
| |
| <!-- ========= 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="class-use/MathUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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/runtime/parser/node/MapSetExecutor.html" title="class in org.apache.velocity.runtime.parser.node"><B>PREV CLASS</B></A> |
| <A HREF="../../../../../../org/apache/velocity/runtime/parser/node/Node.html" title="interface in org.apache.velocity.runtime.parser.node"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../../../index.html?org/apache/velocity/runtime/parser/node/MathUtils.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="MathUtils.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 | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: <A HREF="#field_detail">FIELD</A> | <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.runtime.parser.node</FONT> |
| <BR> |
| Class MathUtils</H2> |
| <PRE> |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> |
| <IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.velocity.runtime.parser.node.MathUtils</B> |
| </PRE> |
| <HR> |
| <DL> |
| <DT><PRE>public abstract class <B>MathUtils</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL> |
| </PRE> |
| |
| <P> |
| Utility-class for all arithmetic-operations.<br><br> |
| |
| All operations (+ - / *) return a Number which type is the type of the bigger argument.<br> |
| Example:<br> |
| <code>add ( new Integer(10), new Integer(1))</code> will return an <code>Integer</code>-Object with the value 11<br> |
| <code>add ( new Long(10), new Integer(1))</code> will return an <code>Long</code>-Object with the value 11<br> |
| <code>add ( new Integer(10), new Float(1))</code> will return an <code>Float</code>-Object with the value 11<br><br> |
| |
| Overflow checking:<br> |
| For integral values (byte, short, int) there is an implicit overflow correction (the next "bigger" |
| type will be returned). For example, if you call <code>add (new Integer (Integer.MAX_VALUE), 1)</code> a |
| <code>Long</code>-object will be returned with the correct value of <code>Integer.MAX_VALUE+1</code>.<br> |
| In addition to that the methods <code>multiply</code>,<code>add</code> and <code>substract</code> implement overflow |
| checks for <code>long</code>-values. That means that if an overflow occurs while working with long values a BigInteger |
| will be returned.<br> |
| For all other operations and types (such as Float and Double) there is no overflow checking. |
| <P> |
| |
| <P> |
| <DL> |
| <DT><B>Since:</B></DT> |
| <DD>1.5</DD> |
| <DT><B>Author:</B></DT> |
| <DD><a href="mailto:pero@antaramusic.de">Peter Romianowski</a></DD> |
| </DL> |
| <HR> |
| |
| <P> |
| <!-- =========== FIELD SUMMARY =========== --> |
| |
| <A NAME="field_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>Field Summary</B></FONT></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected static int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#BASE_BIGDECIMAL">BASE_BIGDECIMAL</A></B></CODE> |
| |
| <BR> |
| </TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected static int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#BASE_BIGINTEGER">BASE_BIGINTEGER</A></B></CODE> |
| |
| <BR> |
| </TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected static int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#BASE_DOUBLE">BASE_DOUBLE</A></B></CODE> |
| |
| <BR> |
| </TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected static int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#BASE_FLOAT">BASE_FLOAT</A></B></CODE> |
| |
| <BR> |
| </TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected static int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#BASE_LONG">BASE_LONG</A></B></CODE> |
| |
| <BR> |
| The constants are used to determine in which context we have to calculate.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#DECIMAL_ZERO">DECIMAL_ZERO</A></B></CODE> |
| |
| <BR> |
| A BigDecimal representing the number 0</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#ints">ints</A></B></CODE> |
| |
| <BR> |
| The <code>Class</code>-object is key, the maximum-value is the value</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>protected static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#typesBySize">typesBySize</A></B></CODE> |
| |
| <BR> |
| The "size" of the number-types - ascending.</TD> |
| </TR> |
| </TABLE> |
| |
| <!-- ======== 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/runtime/parser/node/MathUtils.html#MathUtils()">MathUtils</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>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#add(java.lang.Number, java.lang.Number)">add</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</CODE> |
| |
| <BR> |
| Add two numbers and return the correct value / type.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#compare(java.lang.Number, java.lang.Number)">compare</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</CODE> |
| |
| <BR> |
| Compare two numbers.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#divide(java.lang.Number, java.lang.Number)">divide</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</CODE> |
| |
| <BR> |
| Divide two numbers.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#isInteger(java.lang.Number)">isInteger</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> n)</CODE> |
| |
| <BR> |
| Test, whether the given object is an integer value |
| (Byte, Short, Integer, Long, BigInteger)</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#isZero(java.lang.Number)">isZero</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> n)</CODE> |
| |
| <BR> |
| Compare the given Number to 0.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#modulo(java.lang.Number, java.lang.Number)">modulo</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</CODE> |
| |
| <BR> |
| Modulo two numbers.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#multiply(java.lang.Number, java.lang.Number)">multiply</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</CODE> |
| |
| <BR> |
| Multiply two numbers and return the correct value / type.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#subtract(java.lang.Number, java.lang.Number)">subtract</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</CODE> |
| |
| <BR> |
| Subtract two numbers and return the correct value / type.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#toBigDecimal(java.lang.Number)">toBigDecimal</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> n)</CODE> |
| |
| <BR> |
| Convert the given Number to a BigDecimal</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#toBigInteger(java.lang.Number)">toBigInteger</A></B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> n)</CODE> |
| |
| <BR> |
| Convert the given Number to a BigInteger</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../../org/apache/velocity/runtime/parser/node/MathUtils.html#wrapPrimitive(long, java.lang.Class)">wrapPrimitive</A></B>(long value, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> type)</CODE> |
| |
| <BR> |
| Wrap the given primitive into the given class if the value is in the |
| range of the destination type.</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.<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> |
| </TR> |
| </TABLE> |
| |
| <P> |
| |
| <!-- ============ FIELD DETAIL =========== --> |
| |
| <A NAME="field_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>Field Detail</B></FONT></TH> |
| </TR> |
| </TABLE> |
| |
| <A NAME="DECIMAL_ZERO"><!-- --></A><H3> |
| DECIMAL_ZERO</H3> |
| <PRE> |
| protected static final <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</A> <B>DECIMAL_ZERO</B></PRE> |
| <DL> |
| <DD>A BigDecimal representing the number 0 |
| <P> |
| <DL> |
| </DL> |
| </DL> |
| <HR> |
| |
| <A NAME="BASE_LONG"><!-- --></A><H3> |
| BASE_LONG</H3> |
| <PRE> |
| protected static final int <B>BASE_LONG</B></PRE> |
| <DL> |
| <DD>The constants are used to determine in which context we have to calculate. |
| <P> |
| <DL> |
| <DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.apache.velocity.runtime.parser.node.MathUtils.BASE_LONG">Constant Field Values</A></DL> |
| </DL> |
| <HR> |
| |
| <A NAME="BASE_FLOAT"><!-- --></A><H3> |
| BASE_FLOAT</H3> |
| <PRE> |
| protected static final int <B>BASE_FLOAT</B></PRE> |
| <DL> |
| <DL> |
| <DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.apache.velocity.runtime.parser.node.MathUtils.BASE_FLOAT">Constant Field Values</A></DL> |
| </DL> |
| <HR> |
| |
| <A NAME="BASE_DOUBLE"><!-- --></A><H3> |
| BASE_DOUBLE</H3> |
| <PRE> |
| protected static final int <B>BASE_DOUBLE</B></PRE> |
| <DL> |
| <DL> |
| <DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.apache.velocity.runtime.parser.node.MathUtils.BASE_DOUBLE">Constant Field Values</A></DL> |
| </DL> |
| <HR> |
| |
| <A NAME="BASE_BIGINTEGER"><!-- --></A><H3> |
| BASE_BIGINTEGER</H3> |
| <PRE> |
| protected static final int <B>BASE_BIGINTEGER</B></PRE> |
| <DL> |
| <DL> |
| <DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.apache.velocity.runtime.parser.node.MathUtils.BASE_BIGINTEGER">Constant Field Values</A></DL> |
| </DL> |
| <HR> |
| |
| <A NAME="BASE_BIGDECIMAL"><!-- --></A><H3> |
| BASE_BIGDECIMAL</H3> |
| <PRE> |
| protected static final int <B>BASE_BIGDECIMAL</B></PRE> |
| <DL> |
| <DL> |
| <DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.apache.velocity.runtime.parser.node.MathUtils.BASE_BIGDECIMAL">Constant Field Values</A></DL> |
| </DL> |
| <HR> |
| |
| <A NAME="ints"><!-- --></A><H3> |
| ints</H3> |
| <PRE> |
| protected static final <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A> <B>ints</B></PRE> |
| <DL> |
| <DD>The <code>Class</code>-object is key, the maximum-value is the value |
| <P> |
| <DL> |
| </DL> |
| </DL> |
| <HR> |
| |
| <A NAME="typesBySize"><!-- --></A><H3> |
| typesBySize</H3> |
| <PRE> |
| protected static final <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A> <B>typesBySize</B></PRE> |
| <DL> |
| <DD>The "size" of the number-types - ascending. |
| <P> |
| <DL> |
| </DL> |
| </DL> |
| |
| <!-- ========= 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="MathUtils()"><!-- --></A><H3> |
| MathUtils</H3> |
| <PRE> |
| public <B>MathUtils</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="toBigDecimal(java.lang.Number)"><!-- --></A><H3> |
| toBigDecimal</H3> |
| <PRE> |
| public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</A> <B>toBigDecimal</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> n)</PRE> |
| <DL> |
| <DD>Convert the given Number to a BigDecimal |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>n</CODE> - |
| <DT><B>Returns:</B><DD>The number as BigDecimal</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="toBigInteger(java.lang.Number)"><!-- --></A><H3> |
| toBigInteger</H3> |
| <PRE> |
| public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</A> <B>toBigInteger</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> n)</PRE> |
| <DL> |
| <DD>Convert the given Number to a BigInteger |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>n</CODE> - |
| <DT><B>Returns:</B><DD>The number as BigInteger</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isZero(java.lang.Number)"><!-- --></A><H3> |
| isZero</H3> |
| <PRE> |
| public static boolean <B>isZero</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> n)</PRE> |
| <DL> |
| <DD>Compare the given Number to 0. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>n</CODE> - |
| <DT><B>Returns:</B><DD>True if number is 0.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isInteger(java.lang.Number)"><!-- --></A><H3> |
| isInteger</H3> |
| <PRE> |
| public static boolean <B>isInteger</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> n)</PRE> |
| <DL> |
| <DD>Test, whether the given object is an integer value |
| (Byte, Short, Integer, Long, BigInteger) |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>n</CODE> - |
| <DT><B>Returns:</B><DD>True if n is an integer.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="wrapPrimitive(long, java.lang.Class)"><!-- --></A><H3> |
| wrapPrimitive</H3> |
| <PRE> |
| public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> <B>wrapPrimitive</B>(long value, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A> type)</PRE> |
| <DL> |
| <DD>Wrap the given primitive into the given class if the value is in the |
| range of the destination type. If not the next bigger type will be chosen. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>value</CODE> - <DD><CODE>type</CODE> - |
| <DT><B>Returns:</B><DD>Number object representing the primitive.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="add(java.lang.Number, java.lang.Number)"><!-- --></A><H3> |
| add</H3> |
| <PRE> |
| public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> <B>add</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</PRE> |
| <DL> |
| <DD>Add two numbers and return the correct value / type. |
| Overflow detection is done for integer values (byte, short, int, long) only! |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>op1</CODE> - <DD><CODE>op2</CODE> - |
| <DT><B>Returns:</B><DD>Addition result.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="subtract(java.lang.Number, java.lang.Number)"><!-- --></A><H3> |
| subtract</H3> |
| <PRE> |
| public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> <B>subtract</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</PRE> |
| <DL> |
| <DD>Subtract two numbers and return the correct value / type. |
| Overflow detection is done for integer values (byte, short, int, long) only! |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>op1</CODE> - <DD><CODE>op2</CODE> - |
| <DT><B>Returns:</B><DD>Subtraction result.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="multiply(java.lang.Number, java.lang.Number)"><!-- --></A><H3> |
| multiply</H3> |
| <PRE> |
| public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> <B>multiply</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</PRE> |
| <DL> |
| <DD>Multiply two numbers and return the correct value / type. |
| Overflow detection is done for integer values (byte, short, int, long) only! |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>op1</CODE> - <DD><CODE>op2</CODE> - |
| <DT><B>Returns:</B><DD>Multiplication result.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="divide(java.lang.Number, java.lang.Number)"><!-- --></A><H3> |
| divide</H3> |
| <PRE> |
| public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> <B>divide</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</PRE> |
| <DL> |
| <DD>Divide two numbers. The result will be returned as Integer-type if and only if |
| both sides of the division operator are Integer-types. Otherwise a Float, Double, |
| or BigDecimal will be returned. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>op1</CODE> - <DD><CODE>op2</CODE> - |
| <DT><B>Returns:</B><DD>Division result.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="modulo(java.lang.Number, java.lang.Number)"><!-- --></A><H3> |
| modulo</H3> |
| <PRE> |
| public static <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> <B>modulo</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2) |
| throws <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang">ArithmeticException</A></PRE> |
| <DL> |
| <DD>Modulo two numbers. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>op1</CODE> - <DD><CODE>op2</CODE> - |
| <DT><B>Returns:</B><DD>Modulo result. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang">ArithmeticException</A></CODE> - If at least one parameter is a BigDecimal</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="compare(java.lang.Number, java.lang.Number)"><!-- --></A><H3> |
| compare</H3> |
| <PRE> |
| public static int <B>compare</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op1, |
| <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> op2)</PRE> |
| <DL> |
| <DD>Compare two numbers. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>op1</CODE> - <DD><CODE>op2</CODE> - |
| <DT><B>Returns:</B><DD>1 if n1 > n2, -1 if n1 < n2 and 0 if equal.</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="class-use/MathUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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/runtime/parser/node/MapSetExecutor.html" title="class in org.apache.velocity.runtime.parser.node"><B>PREV CLASS</B></A> |
| <A HREF="../../../../../../org/apache/velocity/runtime/parser/node/Node.html" title="interface in org.apache.velocity.runtime.parser.node"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../../../index.html?org/apache/velocity/runtime/parser/node/MathUtils.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="MathUtils.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 | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: <A HREF="#field_detail">FIELD</A> | <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 © 2000-2010 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. |
| </BODY> |
| </HTML> |