| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (19) --> |
| <title>Numbers (Apache SIS 1.3 API)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="description" content="declaration: package: org.apache.sis.util, class: Numbers"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <meta name="keywords" content="org.apache.sis.util.Numbers class"> |
| <meta name="keywords" content="BIG_DECIMAL"> |
| <meta name="keywords" content="BIG_INTEGER"> |
| <meta name="keywords" content="FRACTION"> |
| <meta name="keywords" content="DOUBLE"> |
| <meta name="keywords" content="FLOAT"> |
| <meta name="keywords" content="LONG"> |
| <meta name="keywords" content="INTEGER"> |
| <meta name="keywords" content="SHORT"> |
| <meta name="keywords" content="BYTE"> |
| <meta name="keywords" content="CHARACTER"> |
| <meta name="keywords" content="BOOLEAN"> |
| <meta name="keywords" content="OTHER"> |
| <meta name="keywords" content="isFloat()"> |
| <meta name="keywords" content="isInteger()"> |
| <meta name="keywords" content="isNumber()"> |
| <meta name="keywords" content="isNaN()"> |
| <meta name="keywords" content="primitiveBitCount()"> |
| <meta name="keywords" content="primitiveToWrapper()"> |
| <meta name="keywords" content="wrapperToPrimitive()"> |
| <meta name="keywords" content="widestClass()"> |
| <meta name="keywords" content="narrowestClass()"> |
| <meta name="keywords" content="narrowestNumber()"> |
| <meta name="keywords" content="cast()"> |
| <meta name="keywords" content="wrap()"> |
| <meta name="keywords" content="valueOf()"> |
| <meta name="keywords" content="valueOfNil()"> |
| <meta name="keywords" content="getEnumConstant()"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../script-dir/jquery-3.6.0.min.js"></script> |
| <script type="text/javascript" src="../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var pathtoroot = "../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">Class</li> |
| <li><a href="class-use/Numbers.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html#class">Help</a></li> |
| </ul> |
| <ul class="sub-nav-list-small"> |
| <li> |
| <p>Summary:</p> |
| <ul> |
| <li>Nested</li> |
| <li><a href="#field-summary">Field</a></li> |
| <li>Constr</li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| </li> |
| <li> |
| <p>Detail:</p> |
| <ul> |
| <li><a href="#field-detail">Field</a></li> |
| <li>Constr</li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div id="navbar-sub-list"> |
| <ul class="sub-nav-list"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field-summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li><a href="#field-detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><a href="../../../../search.html">SEARCH</a> |
| <input type="text" id="search-input" disabled placeholder="Search"> |
| <input type="reset" id="reset-button" disabled value="reset"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.apache.sis.util</a></div> |
| <h1 title="Class Numbers" class="title">Class Numbers</h1> |
| </div> |
| <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> |
| <div class="inheritance"><a href="Static.html" title="class in org.apache.sis.util">Static</a> |
| <div class="inheritance">Numbers</div> |
| </div> |
| </div> |
| <section class="class-description" id="class-description"> |
| <hr> |
| <div class="type-signature"><span class="modifiers">public final class </span><span class="element-name type-name-label">Numbers</span> |
| <span class="extends-implements">extends <a href="Static.html" title="class in org.apache.sis.util">Static</a></span></div> |
| <div class="block">Static methods working with <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link"><code>Number</code></a> objects, and a few primitive types by extension.</div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>0.3</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../math/MathFunctions.html" title="class in org.apache.sis.math"><code>MathFunctions</code></a></li> |
| </ul> |
| </dd> |
| |
| <p><font size="-1">Defined in the <code>sis-utility</code> module</font></p> |
| </dl> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <li> |
| <section class="field-summary" id="field-summary"> |
| <h2>Field Summary</h2> |
| <div class="caption"><span>Fields</span></div> |
| <div class="summary-table three-column-summary"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Field</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color"><code>static final byte</code></div> |
| <div class="col-second even-row-color"><code><a href="#BIG_DECIMAL" class="member-name-link">BIG_DECIMAL</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Constant of value 0xb used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first odd-row-color"><code>static final byte</code></div> |
| <div class="col-second odd-row-color"><code><a href="#BIG_INTEGER" class="member-name-link">BIG_INTEGER</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Constant of value 0xa used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first even-row-color"><code>static final byte</code></div> |
| <div class="col-second even-row-color"><code><a href="#BOOLEAN" class="member-name-link">BOOLEAN</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Constant of value 0x1 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first odd-row-color"><code>static final byte</code></div> |
| <div class="col-second odd-row-color"><code><a href="#BYTE" class="member-name-link">BYTE</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Constant of value 0x3 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first even-row-color"><code>static final byte</code></div> |
| <div class="col-second even-row-color"><code><a href="#CHARACTER" class="member-name-link">CHARACTER</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Constant of value 0x2 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first odd-row-color"><code>static final byte</code></div> |
| <div class="col-second odd-row-color"><code><a href="#DOUBLE" class="member-name-link">DOUBLE</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Constant of value 0x9 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first even-row-color"><code>static final byte</code></div> |
| <div class="col-second even-row-color"><code><a href="#FLOAT" class="member-name-link">FLOAT</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Constant of value 0x8 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first odd-row-color"><code>static final byte</code></div> |
| <div class="col-second odd-row-color"><code><a href="#FRACTION" class="member-name-link">FRACTION</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Constant of value 0x7 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first even-row-color"><code>static final byte</code></div> |
| <div class="col-second even-row-color"><code><a href="#INTEGER" class="member-name-link">INTEGER</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Constant of value 0x5 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first odd-row-color"><code>static final byte</code></div> |
| <div class="col-second odd-row-color"><code><a href="#LONG" class="member-name-link">LONG</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Constant of value 0x6 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first even-row-color"><code>static final byte</code></div> |
| <div class="col-second even-row-color"><code><a href="#OTHER" class="member-name-link">OTHER</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Constant of value 0x0 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| <div class="col-first odd-row-color"><code>static final byte</code></div> |
| <div class="col-second odd-row-color"><code><a href="#SHORT" class="member-name-link">SHORT</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Constant of value 0x4 used in <code>switch</code> statements or as index in arrays.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <N extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>><br>N</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#cast(java.lang.Number,java.lang.Class)" class="member-name-link">cast</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> number, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Casts a number to the specified type.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#getEnumConstant(java.lang.Class)" class="member-name-link">getEnumConstant</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns a numeric constant for the given type.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#isFloat(java.lang.Class)" class="member-name-link">isFloat</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given <code>type</code> is a floating point type.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#isInteger(java.lang.Class)" class="member-name-link">isInteger</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given <code>type</code> is an integer type.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#isNaN(java.lang.Number)" class="member-name-link">isNaN</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> value)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given number is null or NaN.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#isNumber(java.lang.Class)" class="member-name-link">isNumber</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if the given <code>type</code> is a floating point or an integer type.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#narrowestClass(java.lang.Class,java.lang.Class)" class="member-name-link">narrowestClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>> c1, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>> c2)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the narrowest of the given types.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#narrowestClass(java.lang.Number)" class="member-name-link">narrowestClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> value)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the smallest class capable to hold the specified value.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#narrowestClass(java.lang.Number,java.lang.Number)" class="member-name-link">narrowestClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> n1, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> n2)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the narrowest type of two numbers.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#narrowestNumber(java.lang.Number)" class="member-name-link">narrowestNumber</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> value)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the given number wrapped in the smallest class capable to hold the specified value.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#narrowestNumber(java.lang.String)" class="member-name-link">narrowestNumber</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> value)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the smallest number capable to hold the specified value.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#primitiveBitCount(java.lang.Class)" class="member-name-link">primitiveBitCount</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the number of bits used by primitive of the specified type.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <N> <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#primitiveToWrapper(java.lang.Class)" class="member-name-link">primitiveToWrapper</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Changes a primitive class to its wrapper (for example <code>int</code> to <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>).</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <T> T</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#valueOf(java.lang.String,java.lang.Class)" class="member-name-link">valueOf</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> value, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><T> type)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Converts the specified string into a value object.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <T> T</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#valueOfNil(java.lang.Class)" class="member-name-link">valueOfNil</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><T> type)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns a <code>NaN</code>, zero, empty or <code>null</code> value of the given type.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#widestClass(java.lang.Class,java.lang.Class)" class="member-name-link">widestClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>> c1, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>> c2)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the widest of the given types.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#widestClass(java.lang.Number,java.lang.Number)" class="member-name-link">widestClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> n1, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> n2)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the widest type of two numbers.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <N extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>><br>N</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#wrap(double,java.lang.Class)" class="member-name-link">wrap</a><wbr>(double value, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Wraps the given floating-point value in a <code>Number</code> of the specified class.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <N extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>><br>N</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#wrap(long,java.lang.Class)" class="member-name-link">wrap</a><wbr>(long value, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Wraps the given integer value in a <code>Number</code> of the specified class.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <N> <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#wrapperToPrimitive(java.lang.Class)" class="member-name-link">wrapperToPrimitive</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Changes a wrapper class to its primitive (for example <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a> to <code>int</code>).</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-Object">Methods inherited from class <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <li> |
| <section class="field-details" id="field-detail"> |
| <h2>Field Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="BIG_DECIMAL"> |
| <h3>BIG_DECIMAL</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">BIG_DECIMAL</span></div> |
| <div class="block">Constant of value 0xb used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.BIG_DECIMAL">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="BIG_INTEGER"> |
| <h3>BIG_INTEGER</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">BIG_INTEGER</span></div> |
| <div class="block">Constant of value 0xa used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.BIG_INTEGER">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="FRACTION"> |
| <h3>FRACTION</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">FRACTION</span></div> |
| <div class="block">Constant of value 0x7 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.FRACTION">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="DOUBLE"> |
| <h3>DOUBLE</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">DOUBLE</span></div> |
| <div class="block">Constant of value 0x9 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.DOUBLE">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="FLOAT"> |
| <h3>FLOAT</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">FLOAT</span></div> |
| <div class="block">Constant of value 0x8 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.FLOAT">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="LONG"> |
| <h3>LONG</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">LONG</span></div> |
| <div class="block">Constant of value 0x6 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.LONG">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="INTEGER"> |
| <h3>INTEGER</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">INTEGER</span></div> |
| <div class="block">Constant of value 0x5 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.INTEGER">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="SHORT"> |
| <h3>SHORT</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">SHORT</span></div> |
| <div class="block">Constant of value 0x4 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.SHORT">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="BYTE"> |
| <h3>BYTE</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">BYTE</span></div> |
| <div class="block">Constant of value 0x3 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.BYTE">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="CHARACTER"> |
| <h3>CHARACTER</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">CHARACTER</span></div> |
| <div class="block">Constant of value 0x2 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.CHARACTER">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="BOOLEAN"> |
| <h3>BOOLEAN</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">BOOLEAN</span></div> |
| <div class="block">Constant of value 0x1 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.BOOLEAN">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="OTHER"> |
| <h3>OTHER</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">byte</span> <span class="element-name">OTHER</span></div> |
| <div class="block">Constant of value 0x0 used in <code>switch</code> statements or as index in arrays. |
| This enumeration provides the following guarantees (some Apache SIS codes rely on them): |
| |
| <ul> |
| <li><code>OTHER</code> value is 0.</li> |
| <li>Primitive types are enumerated in this exact order |
| (from lower value to higher value, but not necessarily as consecutive values): |
| <code>BYTE</code>, <code>SHORT</code>, <code>INTEGER</code>, <code>LONG</code>, <code>FLOAT</code>, <code>DOUBLE</code>.</li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/package-summary.html" class="external-link"><code>java.math</code></a> types of greater capacity than primitive types (<code>BIG_DECIMAL</code> |
| and <code>BIG_INTEGER</code>) have higher enumeration values.</li> |
| <li><a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is considered as a kind of floating point value.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../constant-values.html#org.apache.sis.util.Numbers.OTHER">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="isFloat(java.lang.Class)"> |
| <h3>isFloat</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">isFloat</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</span></div> |
| <div class="block">Returns <code>true</code> if the given <code>type</code> is a floating point type. The floating point types |
| are <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <code>float</code>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, <code>double</code> and <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a>. |
| <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a> is also considered as a kind of floating point values.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>type</code> - the primitive type or wrapper class to test (can be <code>null</code>).</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if <code>type</code> is one of the known types capable to represent floating point numbers.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="#isInteger(java.lang.Class)"><code>isInteger(Class)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="isInteger(java.lang.Class)"> |
| <h3>isInteger</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">isInteger</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</span></div> |
| <div class="block">Returns <code>true</code> if the given <code>type</code> is an integer type. The integer types are |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, <code>byte</code>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <code>short</code>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <code>int</code>, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, <code>long</code> and <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>type</code> - the primitive type or wrapper class to test (can be <code>null</code>).</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if <code>type</code> is an integer type.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="#isFloat(java.lang.Class)"><code>isFloat(Class)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="isNumber(java.lang.Class)"> |
| <h3>isNumber</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">isNumber</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</span></div> |
| <div class="block">Returns <code>true</code> if the given <code>type</code> is a floating point or an integer type. |
| This method returns <code>true</code> if either <a href="#isFloat(java.lang.Class)"><code>isFloat(Class)</code></a> or <a href="#isInteger(java.lang.Class)"><code>isInteger(Class)</code></a> |
| returns <code>true</code> for the given argument, or if the type is assignable to <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link"><code>Number</code></a>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>type</code> - the primitive type or wrapper class to test (can be <code>null</code>).</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if <code>type</code> is a <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link"><code>Number</code></a> or a primitive floating point or integer type.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="#isFloat(java.lang.Class)"><code>isFloat(Class)</code></a></li> |
| <li><a href="#isInteger(java.lang.Class)"><code>isInteger(Class)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="isNaN(java.lang.Number)"> |
| <h3>isNaN</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name">isNaN</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> value)</span></div> |
| <div class="block">Returns <code>true</code> if the given number is null or NaN. |
| Current implementation recognizes <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a> and <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a> types.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>value</code> - the number to test (may be <code>null</code>).</dd> |
| <dt>Returns:</dt> |
| <dd><code>true</code> if the given number is null or NaN.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html#isNaN()" title="class or interface in java.lang" class="external-link"><code>Float.isNaN()</code></a></li> |
| <li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html#isNaN()" title="class or interface in java.lang" class="external-link"><code>Double.isNaN()</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="primitiveBitCount(java.lang.Class)"> |
| <h3>primitiveBitCount</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name">primitiveBitCount</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div> |
| <div class="block">Returns the number of bits used by primitive of the specified type. |
| The given type must be a primitive type or its wrapper class.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>type</code> - the primitive type (can be <code>null</code>).</dd> |
| <dt>Returns:</dt> |
| <dd>the number of bits, or 0 if <code>type</code> is null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if the given type is not one of the types supported by this <code>Numbers</code> class.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="primitiveToWrapper(java.lang.Class)"> |
| <h3>primitiveToWrapper</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="type-parameters"><N></span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N></span> <span class="element-name">primitiveToWrapper</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</span></div> |
| <div class="block">Changes a primitive class to its wrapper (for example <code>int</code> to <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>). |
| If the specified class is not a primitive type, then it is returned unchanged.</div> |
| <dl class="notes"> |
| <dt>Type Parameters:</dt> |
| <dd><code>N</code> - the primitive and wrapper type (both have the same parametric declaration).</dd> |
| <dt>Parameters:</dt> |
| <dd><code>type</code> - the primitive type (can be <code>null</code>).</dd> |
| <dt>Returns:</dt> |
| <dd>the type as a wrapper.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="#wrapperToPrimitive(java.lang.Class)"><code>wrapperToPrimitive(Class)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="wrapperToPrimitive(java.lang.Class)"> |
| <h3>wrapperToPrimitive</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="type-parameters"><N></span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N></span> <span class="element-name">wrapperToPrimitive</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</span></div> |
| <div class="block">Changes a wrapper class to its primitive (for example <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a> to <code>int</code>). |
| If the specified class is not a wrapper type, then it is returned unchanged.</div> |
| <dl class="notes"> |
| <dt>Type Parameters:</dt> |
| <dd><code>N</code> - the primitive and wrapper type (both have the same parametric declaration).</dd> |
| <dt>Parameters:</dt> |
| <dd><code>type</code> - the wrapper type (can be <code>null</code>).</dd> |
| <dt>Returns:</dt> |
| <dd>the type as a primitive.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="#primitiveToWrapper(java.lang.Class)"><code>primitiveToWrapper(Class)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="widestClass(java.lang.Number,java.lang.Number)"> |
| <h3>widestClass</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></span> <span class="element-name">widestClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> n1, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> n2)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div> |
| <div class="block">Returns the widest type of two numbers. Numbers <code>n1</code> and <code>n2</code> can be instance of |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, |
| <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a> or <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a> types. |
| |
| <p>If one of the given argument is null, then this method returns the class of the non-null argument. |
| If both arguments are null, then this method returns <code>null</code>.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>n1</code> - the first number, or <code>null</code>.</dd> |
| <dd><code>n2</code> - the second number, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the widest type of the given numbers, or <code>null</code> if both <code>n1</code> and <code>n2</code> are null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if a number is not an instance of a supported type.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list-long"> |
| <li><a href="#widestClass(java.lang.Number,java.lang.Number)"><code>widestClass(Number, Number)</code></a></li> |
| <li><a href="#narrowestClass(java.lang.Number,java.lang.Number)"><code>narrowestClass(Number, Number)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="widestClass(java.lang.Class,java.lang.Class)"> |
| <h3>widestClass</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></span> <span class="element-name">widestClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>> c1, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>> c2)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div> |
| <div class="block">Returns the widest of the given types. Classes <code>c1</code> and <code>c2</code> can be |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, |
| <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a> or <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a> types. |
| |
| <p>If one of the given argument is null, then this method returns the non-null argument. |
| If both arguments are null, then this method returns <code>null</code>.</p> |
| |
| <div class="note"><b>Example:</b> |
| in the following code, <code>type</code> is set to <code>Long.class</code>: |
| |
| <blockquote><pre>Class<?> type = <b>widestClass</b>(Short.<font color="green">class</font>, Long.<font color="green">class</font>);</pre></blockquote> |
| </div></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>c1</code> - the first number type, or <code>null</code>.</dd> |
| <dd><code>c2</code> - the second number type, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the widest of the given types, or <code>null</code> if both <code>c1</code> and <code>c2</code> are null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if one of the given types is not supported by this <code>Numbers</code> class.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list-long"> |
| <li><a href="#widestClass(java.lang.Class,java.lang.Class)"><code>widestClass(Class, Class)</code></a></li> |
| <li><a href="#narrowestClass(java.lang.Number,java.lang.Number)"><code>narrowestClass(Number, Number)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="narrowestClass(java.lang.Number,java.lang.Number)"> |
| <h3>narrowestClass</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></span> <span class="element-name">narrowestClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> n1, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> n2)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div> |
| <div class="block">Returns the narrowest type of two numbers. Numbers <code>n1</code> and <code>n2</code> can be instance of |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, |
| <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a> or <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a> types.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>n1</code> - the first number, or <code>null</code>.</dd> |
| <dd><code>n2</code> - the second number, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the narrowest type of the given numbers, or <code>null</code> if both <code>n1</code> and <code>n2</code> are null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if a number is not an instance of a supported type.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list-long"> |
| <li><a href="#narrowestClass(java.lang.Class,java.lang.Class)"><code>narrowestClass(Class, Class)</code></a></li> |
| <li><a href="#widestClass(java.lang.Class,java.lang.Class)"><code>widestClass(Class, Class)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="narrowestClass(java.lang.Class,java.lang.Class)"> |
| <h3>narrowestClass</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></span> <span class="element-name">narrowestClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>> c1, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>> c2)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div> |
| <div class="block">Returns the narrowest of the given types. Classes <code>c1</code> and <code>c2</code> can be |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, |
| <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a> or <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a> types. |
| |
| <p>If one of the given argument is null, then this method returns the non-null argument. |
| If both arguments are null, then this method returns <code>null</code>.</p> |
| |
| <div class="note"><b>Example:</b> |
| in the following code, <code>type</code> is set to <code>Short.class</code>: |
| |
| <blockquote><pre>Class<?> type = <b>widestClass</b>(Short.<font color="green">class</font>, Long.<font color="green">class</font>);</pre></blockquote> |
| </div></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>c1</code> - the first number type, or <code>null</code>.</dd> |
| <dd><code>c2</code> - the second number type, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the narrowest of the given types, or <code>null</code> if both <code>c1</code> and <code>c2</code> are null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if one of the given types is not supported by this <code>Numbers</code> class.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list-long"> |
| <li><a href="#narrowestClass(java.lang.Number,java.lang.Number)"><code>narrowestClass(Number, Number)</code></a></li> |
| <li><a href="#widestClass(java.lang.Class,java.lang.Class)"><code>widestClass(Class, Class)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="narrowestClass(java.lang.Number)"> |
| <h3>narrowestClass</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><? extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></span> <span class="element-name">narrowestClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> value)</span></div> |
| <div class="block">Returns the smallest class capable to hold the specified value. |
| This method applies the following choices, in that order: |
| |
| <ul> |
| <li>If the given value is <code>null</code>, then this method returns <code>null</code>.</li> |
| <li>Otherwise if the given value cannot be casted from <code>double</code> to another type |
| without precision lost, return <code>Double.class</code>.</li> |
| <li>Otherwise if the given value cannot be casted from <code>float</code> to another type |
| without precision lost, return <code>Float.class</code>.</li> |
| <li>Otherwise if the given value is between <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html#MIN_VALUE" title="class or interface in java.lang" class="external-link">0x80</a> and |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html#MAX_VALUE" title="class or interface in java.lang" class="external-link">0x7f</a>, then this method returns <code>Byte.class</code>;</li> |
| <li>Otherwise if the given value is between <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html#MIN_VALUE" title="class or interface in java.lang" class="external-link">-32768</a> and |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html#MAX_VALUE" title="class or interface in java.lang" class="external-link">32767</a>, then this method returns <code>Short.class</code>;</li> |
| <li>Otherwise if the given value is between <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html#MIN_VALUE" title="class or interface in java.lang" class="external-link">-2147483648</a> and |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html#MAX_VALUE" title="class or interface in java.lang" class="external-link">2147483647</a>, then this method returns <code>Integer.class</code>;</li> |
| <li>Otherwise this method returns <code>Long.class</code>;</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>value</code> - the value to be wrapped in a finer (if possible) <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link"><code>Number</code></a>.</dd> |
| <dt>Returns:</dt> |
| <dd>the narrowest type capable to hold the given value.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="#narrowestNumber(java.lang.Number)"><code>narrowestNumber(Number)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="narrowestNumber(java.lang.Number)"> |
| <h3>narrowestNumber</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a></span> <span class="element-name">narrowestNumber</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> value)</span></div> |
| <div class="block">Returns the given number wrapped in the smallest class capable to hold the specified value. |
| This method is equivalent to the following code, in a slightly more efficient way: |
| |
| <blockquote><pre><font color="green">return</font> <b>cast</b>(value, <b>narrowestClass</b>(value));</pre></blockquote></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>value</code> - the value to be wrapped in a finer (if possible) <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link"><code>Number</code></a>.</dd> |
| <dt>Returns:</dt> |
| <dd>the narrowest type capable to hold the given value.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list-long"> |
| <li><a href="#narrowestClass(java.lang.Number)"><code>narrowestClass(Number)</code></a></li> |
| <li><a href="#cast(java.lang.Number,java.lang.Class)"><code>cast(Number, Class)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="narrowestNumber(java.lang.String)"> |
| <h3>narrowestNumber</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a></span> <span class="element-name">narrowestNumber</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> value)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></span></div> |
| <div class="block">Returns the smallest number capable to hold the specified value.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>value</code> - the value to be wrapped in a <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link"><code>Number</code></a>.</dd> |
| <dt>Returns:</dt> |
| <dd>the narrowest type capable to hold the given value.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></code> - if the given value cannot be parsed as a number.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="#narrowestNumber(java.lang.Number)"><code>narrowestNumber(Number)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="cast(java.lang.Number,java.lang.Class)"> |
| <h3>cast</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="type-parameters"><N extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></span> <span class="return-type">N</span> <span class="element-name">cast</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a> number, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div> |
| <div class="block">Casts a number to the specified type. The target type can be one of <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, |
| <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a> or <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a>. |
| This method makes the following choice: |
| |
| <ul> |
| <li>If the given value is <code>null</code> or an instance of the given type, then it is returned unchanged.</li> |
| <li>Otherwise if the given type is <code>Double.class</code>, then this method returns |
| <code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html#valueOf(double)" title="class or interface in java.lang" class="external-link">Double.valueOf</a>(number.doubleValue())</code>;</li> |
| <li>Otherwise if the given type is <code>Float.class</code>, then this method returns |
| <code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html#valueOf(float)" title="class or interface in java.lang" class="external-link">Float.valueOf</a>(number.floatValue())</code>;</li> |
| <li>And likewise for all remaining known types.</li> |
| </ul> |
| |
| This method does not verify if the given type is wide enough for the given value, |
| because the type has typically been calculated by <a href="#widestClass(java.lang.Class,java.lang.Class)"><code>widestClass(Class, Class)</code></a> |
| or <a href="#narrowestClass(java.lang.Number)"><code>narrowestClass(Number)</code></a>. If nevertheless the given type is not wide enough, |
| then the behavior depends on the implementation of the corresponding |
| <code>Number.fooValue()</code> method - typically, the value is just rounded or truncated.</div> |
| <dl class="notes"> |
| <dt>Type Parameters:</dt> |
| <dd><code>N</code> - the class to cast to.</dd> |
| <dt>Parameters:</dt> |
| <dd><code>number</code> - the number to cast, or <code>null</code>.</dd> |
| <dd><code>type</code> - the destination type.</dd> |
| <dt>Returns:</dt> |
| <dd>the number casted to the given type, or <code>null</code> if the given value was null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if the given type is not supported by this <code>Numbers</code> class, |
| or the number cannot be converted to the specified type (e.g. <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>Double.NaN</code></a> cannot |
| be converted to <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a>).</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="wrap(double,java.lang.Class)"> |
| <h3>wrap</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="type-parameters"><N extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></span> <span class="return-type">N</span> <span class="element-name">wrap</span><wbr><span class="parameters">(double value, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div> |
| <div class="block">Wraps the given floating-point value in a <code>Number</code> of the specified class. |
| The given type shall be one of <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a> and <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a> classes. |
| Furthermore, the given value shall be convertible to the given class without precision lost, |
| otherwise an <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link"><code>IllegalArgumentException</code></a> will be thrown.</div> |
| <dl class="notes"> |
| <dt>Type Parameters:</dt> |
| <dd><code>N</code> - the wrapper class.</dd> |
| <dt>Parameters:</dt> |
| <dd><code>value</code> - the value to wrap.</dd> |
| <dd><code>type</code> - the desired wrapper class.</dd> |
| <dt>Returns:</dt> |
| <dd>the value wrapped in an object of the given class.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if the given type is not supported by this <code>Numbers</code> class, |
| or if the given value cannot be wrapped in an instance of the given class without precision lost.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="wrap(long,java.lang.Class)"> |
| <h3>wrap</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="type-parameters"><N extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link">Number</a>></span> <span class="return-type">N</span> <span class="element-name">wrap</span><wbr><span class="parameters">(long value, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><N> type)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></span></div> |
| <div class="block">Wraps the given integer value in a <code>Number</code> of the specified class. |
| The given type shall be one of <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a> and <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a> classes. |
| Furthermore, the given value shall be convertible to the given class without precision lost, |
| otherwise an <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link"><code>IllegalArgumentException</code></a> will be thrown.</div> |
| <dl class="notes"> |
| <dt>Type Parameters:</dt> |
| <dd><code>N</code> - the wrapper class.</dd> |
| <dt>Parameters:</dt> |
| <dd><code>value</code> - the value to wrap.</dd> |
| <dd><code>type</code> - the desired wrapper class.</dd> |
| <dt>Returns:</dt> |
| <dd>the value wrapped in an object of the given class.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if the given type is not supported by this <code>Numbers</code> class, |
| or if the given value cannot be wrapped in an instance of the given class without precision lost.</dd> |
| <dt>Since:</dt> |
| <dd>0.8</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="valueOf(java.lang.String,java.lang.Class)"> |
| <h3>valueOf</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="type-parameters"><T></span> <span class="return-type">T</span> <span class="element-name">valueOf</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> value, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><T> type)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a>, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></span></div> |
| <div class="block">Converts the specified string into a value object. |
| The value object can be an instance of <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigDecimal.html" title="class or interface in java.math" class="external-link"><code>BigDecimal</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/math/BigInteger.html" title="class or interface in java.math" class="external-link"><code>BigInteger</code></a>, <a href="../math/Fraction.html" title="class in org.apache.sis.math"><code>Fraction</code></a>, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link"><code>Double</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html" title="class or interface in java.lang" class="external-link"><code>Float</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Long.html" title="class or interface in java.lang" class="external-link"><code>Long</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Integer.html" title="class or interface in java.lang" class="external-link"><code>Integer</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Short.html" title="class or interface in java.lang" class="external-link"><code>Short</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Byte.html" title="class or interface in java.lang" class="external-link"><code>Byte</code></a>, |
| <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link"><code>Boolean</code></a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Character.html" title="class or interface in java.lang" class="external-link"><code>Character</code></a> or <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link"><code>String</code></a> according the specified type. |
| This method makes the following choice: |
| |
| <ul> |
| <li>If the given type is <code>Double.class</code>, then this method returns |
| <code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html#valueOf(java.lang.String)" title="class or interface in java.lang" class="external-link">Double.valueOf</a>(value)</code>;</li> |
| <li>If the given type is <code>Float.class</code>, then this method returns |
| <code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html#valueOf(java.lang.String)" title="class or interface in java.lang" class="external-link">Float.valueOf</a>(value)</code>;</li> |
| <li>And likewise for all remaining known types.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>Type Parameters:</dt> |
| <dd><code>T</code> - the requested type.</dd> |
| <dt>Parameters:</dt> |
| <dd><code>value</code> - the value to parse.</dd> |
| <dd><code>type</code> - the requested type.</dd> |
| <dt>Returns:</dt> |
| <dd>the value object, or <code>null</code> if <code>value</code> was null.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if <code>type</code> is not a recognized type.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/NumberFormatException.html" title="class or interface in java.lang" class="external-link">NumberFormatException</a></code> - if <code>type</code> is a subclass of <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Number.html" title="class or interface in java.lang" class="external-link"><code>Number</code></a> |
| and the string value is not parsable as a number of the specified type.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="valueOfNil(java.lang.Class)"> |
| <h3>valueOfNil</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="type-parameters"><T></span> <span class="return-type">T</span> <span class="element-name">valueOfNil</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><T> type)</span></div> |
| <div class="block">Returns a <code>NaN</code>, zero, empty or <code>null</code> value of the given type. This method |
| tries to return the closest value that can be interpreted as <cite>"none"</cite>, which |
| is usually not the same than <cite>"zero"</cite>. More specifically: |
| |
| <ul> |
| <li>If the given type is a floating point <strong>primitive</strong> type (<code>float</code> |
| or <code>double</code>), then this method returns <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Float.html#NaN" title="class or interface in java.lang" class="external-link"><code>Float.NaN</code></a> or <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Double.html#NaN" title="class or interface in java.lang" class="external-link"><code>Double.NaN</code></a> |
| depending on the given type.</li> |
| |
| <li>If the given type is an integer <strong>primitive</strong> type or the character type |
| (<code>long</code>, <code>int</code>, <code>short</code>, <code>byte</code> or <code>char</code>), then this |
| method returns the zero value of the given type.</li> |
| |
| <li>If the given type is the <code>boolean</code> <strong>primitive</strong> type, then this |
| method returns <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Boolean.html#FALSE" title="class or interface in java.lang" class="external-link"><code>Boolean.FALSE</code></a>.</li> |
| |
| <li>If the given type is an array or a collection, then this method returns an empty |
| array or collection. The given type is honored on a <cite>best effort</cite> basis.</li> |
| |
| <li>For all other cases, including the wrapper classes of primitive types, this method |
| returns <code>null</code>.</li> |
| </ul> |
| |
| Despite being defined in the <code>Numbers</code> class, the scope of this method has been |
| extended to array and collection types because those objects can also be seen as |
| mathematical concepts.</div> |
| <dl class="notes"> |
| <dt>Type Parameters:</dt> |
| <dd><code>T</code> - the compile-time type of the requested object.</dd> |
| <dt>Parameters:</dt> |
| <dd><code>type</code> - the type of the object for which to get a nil value.</dd> |
| <dt>Returns:</dt> |
| <dd>an object of the given type which represents a nil value, or <code>null</code>.</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../xml/NilObject.html" title="interface in org.apache.sis.xml"><code>NilObject</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="getEnumConstant(java.lang.Class)"> |
| <h3>getEnumConstant</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">byte</span> <span class="element-name">getEnumConstant</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a><?> type)</span></div> |
| <div class="block">Returns a numeric constant for the given type. |
| The constants are <a href="#BIG_DECIMAL"><code>BIG_DECIMAL</code></a>, <a href="#BIG_INTEGER"><code>BIG_INTEGER</code></a>, <a href="#FRACTION"><code>FRACTION</code></a>, |
| <a href="#DOUBLE"><code>DOUBLE</code></a>, <a href="#FLOAT"><code>FLOAT</code></a>, <a href="#LONG"><code>LONG</code></a>, <a href="#INTEGER"><code>INTEGER</code></a>, |
| <a href="#SHORT"><code>SHORT</code></a>, <a href="#BYTE"><code>BYTE</code></a>, <a href="#CHARACTER"><code>CHARACTER</code></a>, <a href="#BOOLEAN"><code>BOOLEAN</code></a>, or <a href="#OTHER"><code>OTHER</code></a> |
| constants for the given type. This is a commodity for usage in <code>switch</code> statements.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>type</code> - a type (usually either a primitive type or its wrapper), or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the constant for the given type, or <a href="#OTHER"><code>OTHER</code></a> if unknown.</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| <footer role="contentinfo"> |
| <hr> |
| <p class="legal-copy"><small>Copyright © 2010–2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </div> |
| </div> |
| </body> |
| </html> |