diff options
Diffstat (limited to 'doc/org/unitConverter/unit/UnitDatabase.html')
-rw-r--r-- | doc/org/unitConverter/unit/UnitDatabase.html | 789 |
1 files changed, 789 insertions, 0 deletions
diff --git a/doc/org/unitConverter/unit/UnitDatabase.html b/doc/org/unitConverter/unit/UnitDatabase.html new file mode 100644 index 0000000..d62f73a --- /dev/null +++ b/doc/org/unitConverter/unit/UnitDatabase.html @@ -0,0 +1,789 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- NewPage --> +<html lang="en"> +<head> +<!-- Generated by javadoc (1.8.0_232) on Tue Dec 24 16:10:16 EST 2019 --> +<title>UnitDatabase</title> +<meta name="date" content="2019-12-24"> +<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> +<script type="text/javascript" src="../../../script.js"></script> +</head> +<body> +<script type="text/javascript"><!-- + try { + if (location.href.indexOf('is-external=true') == -1) { + parent.document.title="UnitDatabase"; + } + } + catch(err) { + } +//--> +var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10}; +var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; +var altColor = "altColor"; +var rowColor = "rowColor"; +var tableTab = "tableTab"; +var activeTableTab = "activeTableTab"; +</script> +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<!-- ========= START OF TOP NAVBAR ======= --> +<div class="topNav"><a name="navbar.top"> +<!-- --> +</a> +<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> +<a name="navbar.top.firstrow"> +<!-- --> +</a> +<ul class="navList" title="Navigation"> +<li><a href="../../../overview-summary.html">Overview</a></li> +<li><a href="package-summary.html">Package</a></li> +<li class="navBarCell1Rev">Class</li> +<li><a href="class-use/UnitDatabase.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-files/index-1.html">Index</a></li> +<li><a href="../../../help-doc.html">Help</a></li> +</ul> +</div> +<div class="subNav"> +<ul class="navList"> +<li><a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit"><span class="typeNameLink">Prev Class</span></a></li> +<li><a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit"><span class="typeNameLink">Next Class</span></a></li> +</ul> +<ul class="navList"> +<li><a href="../../../index.html?org/unitConverter/unit/UnitDatabase.html" target="_top">Frames</a></li> +<li><a href="UnitDatabase.html" target="_top">No Frames</a></li> +</ul> +<ul class="navList" id="allclasses_navbar_top"> +<li><a href="../../../allclasses-noframe.html">All Classes</a></li> +</ul> +<div> +<script type="text/javascript"><!-- + allClassesLink = document.getElementById("allclasses_navbar_top"); + if(window==top) { + allClassesLink.style.display = "block"; + } + else { + allClassesLink.style.display = "none"; + } + //--> +</script> +</div> +<div> +<ul class="subNavList"> +<li>Summary: </li> +<li>Nested | </li> +<li>Field | </li> +<li><a href="#constructor.summary">Constr</a> | </li> +<li><a href="#method.summary">Method</a></li> +</ul> +<ul class="subNavList"> +<li>Detail: </li> +<li>Field | </li> +<li><a href="#constructor.detail">Constr</a> | </li> +<li><a href="#method.detail">Method</a></li> +</ul> +</div> +<a name="skip.navbar.top"> +<!-- --> +</a></div> +<!-- ========= END OF TOP NAVBAR ========= --> +<!-- ======== START OF CLASS DATA ======== --> +<div class="header"> +<div class="subTitle">org.unitConverter.unit</div> +<h2 title="Class UnitDatabase" class="title">Class UnitDatabase</h2> +</div> +<div class="contentContainer"> +<ul class="inheritance"> +<li>java.lang.Object</li> +<li> +<ul class="inheritance"> +<li>org.unitConverter.unit.UnitDatabase</li> +</ul> +</li> +</ul> +<div class="description"> +<ul class="blockList"> +<li class="blockList"> +<hr> +<br> +<pre>public final class <span class="typeNameLabel">UnitDatabase</span> +extends java.lang.Object</pre> +<div class="block">A database of units, prefixes and dimensions, and their names.</div> +<dl> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-07, v0.1.0</dd> +<dt><span class="simpleTagLabel">Author:</span></dt> +<dd>Adrien Hopkins</dd> +</dl> +</li> +</ul> +</div> +<div class="summary"> +<ul class="blockList"> +<li class="blockList"> +<!-- ======== CONSTRUCTOR SUMMARY ======== --> +<ul class="blockList"> +<li class="blockList"><a name="constructor.summary"> +<!-- --> +</a> +<h3>Constructor Summary</h3> +<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> +<caption><span>Constructors</span><span class="tabEnd"> </span></caption> +<tr> +<th class="colOne" scope="col">Constructor and Description</th> +</tr> +<tr class="altColor"> +<td class="colOne"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#UnitDatabase--">UnitDatabase</a></span>()</code> +<div class="block">Creates the <code>UnitsDatabase</code>.</div> +</td> +</tr> +</table> +</li> +</ul> +<!-- ========== METHOD SUMMARY =========== --> +<ul class="blockList"> +<li class="blockList"><a name="method.summary"> +<!-- --> +</a> +<h3>Method Summary</h3> +<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> +<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> +<tr> +<th class="colFirst" scope="col">Modifier and Type</th> +<th class="colLast" scope="col">Method and Description</th> +</tr> +<tr id="i0" class="altColor"> +<td class="colFirst"><code>void</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#addDimension-java.lang.String-org.unitConverter.math.ObjectProduct-">addDimension</a></span>(java.lang.String name, + <a href="../../../org/unitConverter/math/ObjectProduct.html" title="class in org.unitConverter.math">ObjectProduct</a><<a href="../../../org/unitConverter/unit/BaseDimension.html" title="class in org.unitConverter.unit">BaseDimension</a>> dimension)</code> +<div class="block">Adds a unit dimension to the database.</div> +</td> +</tr> +<tr id="i1" class="rowColor"> +<td class="colFirst"><code>void</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#addPrefix-java.lang.String-org.unitConverter.unit.UnitPrefix-">addPrefix</a></span>(java.lang.String name, + <a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit">UnitPrefix</a> prefix)</code> +<div class="block">Adds a unit prefix to the database.</div> +</td> +</tr> +<tr id="i2" class="altColor"> +<td class="colFirst"><code>void</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#addUnit-java.lang.String-org.unitConverter.unit.Unit-">addUnit</a></span>(java.lang.String name, + <a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a> unit)</code> +<div class="block">Adds a unit to the database.</div> +</td> +</tr> +<tr id="i3" class="rowColor"> +<td class="colFirst"><code>boolean</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#containsDimensionName-java.lang.String-">containsDimensionName</a></span>(java.lang.String name)</code> +<div class="block">Tests if the database has a unit dimension with this name.</div> +</td> +</tr> +<tr id="i4" class="altColor"> +<td class="colFirst"><code>boolean</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#containsPrefixName-java.lang.String-">containsPrefixName</a></span>(java.lang.String name)</code> +<div class="block">Tests if the database has a unit prefix with this name.</div> +</td> +</tr> +<tr id="i5" class="rowColor"> +<td class="colFirst"><code>boolean</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#containsUnitName-java.lang.String-">containsUnitName</a></span>(java.lang.String name)</code> +<div class="block">Tests if the database has a unit with this name, taking prefixes into consideration</div> +</td> +</tr> +<tr id="i6" class="altColor"> +<td class="colFirst"><code>java.util.Map<java.lang.String,<a href="../../../org/unitConverter/math/ObjectProduct.html" title="class in org.unitConverter.math">ObjectProduct</a><<a href="../../../org/unitConverter/unit/BaseDimension.html" title="class in org.unitConverter.unit">BaseDimension</a>>></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#dimensionMap--">dimensionMap</a></span>()</code> </td> +</tr> +<tr id="i7" class="rowColor"> +<td class="colFirst"><code><a href="../../../org/unitConverter/math/ObjectProduct.html" title="class in org.unitConverter.math">ObjectProduct</a><<a href="../../../org/unitConverter/unit/BaseDimension.html" title="class in org.unitConverter.unit">BaseDimension</a>></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#getDimension-java.lang.String-">getDimension</a></span>(java.lang.String name)</code> +<div class="block">Gets a unit dimension from the database using its name.</div> +</td> +</tr> +<tr id="i8" class="altColor"> +<td class="colFirst"><code><a href="../../../org/unitConverter/math/ObjectProduct.html" title="class in org.unitConverter.math">ObjectProduct</a><<a href="../../../org/unitConverter/unit/BaseDimension.html" title="class in org.unitConverter.unit">BaseDimension</a>></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#getDimensionFromExpression-java.lang.String-">getDimensionFromExpression</a></span>(java.lang.String expression)</code> +<div class="block">Uses the database's data to parse an expression into a unit dimension</div> +</td> +</tr> +<tr id="i9" class="rowColor"> +<td class="colFirst"><code><a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit">UnitPrefix</a></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#getPrefix-java.lang.String-">getPrefix</a></span>(java.lang.String name)</code> +<div class="block">Gets a unit prefix from the database from its name</div> +</td> +</tr> +<tr id="i10" class="altColor"> +<td class="colFirst"><code><a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit">UnitPrefix</a></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#getPrefixFromExpression-java.lang.String-">getPrefixFromExpression</a></span>(java.lang.String expression)</code> +<div class="block">Gets a unit prefix from a prefix expression</div> +</td> +</tr> +<tr id="i11" class="rowColor"> +<td class="colFirst"><code><a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#getUnit-java.lang.String-">getUnit</a></span>(java.lang.String name)</code> +<div class="block">Gets a unit from the database from its name, looking for prefixes.</div> +</td> +</tr> +<tr id="i12" class="altColor"> +<td class="colFirst"><code><a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#getUnitFromExpression-java.lang.String-">getUnitFromExpression</a></span>(java.lang.String expression)</code> +<div class="block">Uses the database's unit data to parse an expression into a unit</div> +</td> +</tr> +<tr id="i13" class="rowColor"> +<td class="colFirst"><code>void</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#loadDimensionFile-java.io.File-">loadDimensionFile</a></span>(java.io.File file)</code> +<div class="block">Adds all dimensions from a file, using data from the database to parse them.</div> +</td> +</tr> +<tr id="i14" class="altColor"> +<td class="colFirst"><code>void</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#loadUnitsFile-java.io.File-">loadUnitsFile</a></span>(java.io.File file)</code> +<div class="block">Adds all units from a file, using data from the database to parse them.</div> +</td> +</tr> +<tr id="i15" class="rowColor"> +<td class="colFirst"><code>java.util.Map<java.lang.String,<a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit">UnitPrefix</a>></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#prefixMap--">prefixMap</a></span>()</code> </td> +</tr> +<tr id="i16" class="altColor"> +<td class="colFirst"><code>java.lang.String</code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#toString--">toString</a></span>()</code> </td> +</tr> +<tr id="i17" class="rowColor"> +<td class="colFirst"><code>java.util.Map<java.lang.String,<a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a>></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#unitMap--">unitMap</a></span>()</code> +<div class="block">Returns a map mapping unit names to units, including units with prefixes.</div> +</td> +</tr> +<tr id="i18" class="altColor"> +<td class="colFirst"><code>java.util.Map<java.lang.String,<a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a>></code></td> +<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/unitConverter/unit/UnitDatabase.html#unitMapPrefixless--">unitMapPrefixless</a></span>()</code> </td> +</tr> +</table> +<ul class="blockList"> +<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> +<!-- --> +</a> +<h3>Methods inherited from class java.lang.Object</h3> +<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li> +</ul> +</li> +</ul> +</li> +</ul> +</div> +<div class="details"> +<ul class="blockList"> +<li class="blockList"> +<!-- ========= CONSTRUCTOR DETAIL ======== --> +<ul class="blockList"> +<li class="blockList"><a name="constructor.detail"> +<!-- --> +</a> +<h3>Constructor Detail</h3> +<a name="UnitDatabase--"> +<!-- --> +</a> +<ul class="blockListLast"> +<li class="blockList"> +<h4>UnitDatabase</h4> +<pre>public UnitDatabase()</pre> +<div class="block">Creates the <code>UnitsDatabase</code>.</div> +<dl> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-10, v0.1.0</dd> +</dl> +</li> +</ul> +</li> +</ul> +<!-- ============ METHOD DETAIL ========== --> +<ul class="blockList"> +<li class="blockList"><a name="method.detail"> +<!-- --> +</a> +<h3>Method Detail</h3> +<a name="addDimension-java.lang.String-org.unitConverter.math.ObjectProduct-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>addDimension</h4> +<pre>public void addDimension(java.lang.String name, + <a href="../../../org/unitConverter/math/ObjectProduct.html" title="class in org.unitConverter.math">ObjectProduct</a><<a href="../../../org/unitConverter/unit/BaseDimension.html" title="class in org.unitConverter.unit">BaseDimension</a>> dimension)</pre> +<div class="block">Adds a unit dimension to the database.</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - dimension's name</dd> +<dd><code>dimension</code> - dimension to add</dd> +<dt><span class="throwsLabel">Throws:</span></dt> +<dd><code>java.lang.NullPointerException</code> - if name or dimension is null</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-03-14, v0.2.0</dd> +</dl> +</li> +</ul> +<a name="addPrefix-java.lang.String-org.unitConverter.unit.UnitPrefix-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>addPrefix</h4> +<pre>public void addPrefix(java.lang.String name, + <a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit">UnitPrefix</a> prefix)</pre> +<div class="block">Adds a unit prefix to the database.</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - prefix's name</dd> +<dd><code>prefix</code> - prefix to add</dd> +<dt><span class="throwsLabel">Throws:</span></dt> +<dd><code>java.lang.NullPointerException</code> - if name or prefix is null</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-14, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="addUnit-java.lang.String-org.unitConverter.unit.Unit-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>addUnit</h4> +<pre>public void addUnit(java.lang.String name, + <a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a> unit)</pre> +<div class="block">Adds a unit to the database.</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - unit's name</dd> +<dd><code>unit</code> - unit to add</dd> +<dt><span class="throwsLabel">Throws:</span></dt> +<dd><code>java.lang.NullPointerException</code> - if unit is null</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-10, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="containsDimensionName-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>containsDimensionName</h4> +<pre>public boolean containsDimensionName(java.lang.String name)</pre> +<div class="block">Tests if the database has a unit dimension with this name.</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - name to test</dd> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>if database contains name</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-03-14, v0.2.0</dd> +</dl> +</li> +</ul> +<a name="containsPrefixName-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>containsPrefixName</h4> +<pre>public boolean containsPrefixName(java.lang.String name)</pre> +<div class="block">Tests if the database has a unit prefix with this name.</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - name to test</dd> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>if database contains name</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-13, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="containsUnitName-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>containsUnitName</h4> +<pre>public boolean containsUnitName(java.lang.String name)</pre> +<div class="block">Tests if the database has a unit with this name, taking prefixes into consideration</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - name to test</dd> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>if database contains name</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-13, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="dimensionMap--"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>dimensionMap</h4> +<pre>public java.util.Map<java.lang.String,<a href="../../../org/unitConverter/math/ObjectProduct.html" title="class in org.unitConverter.math">ObjectProduct</a><<a href="../../../org/unitConverter/unit/BaseDimension.html" title="class in org.unitConverter.unit">BaseDimension</a>>> dimensionMap()</pre> +<dl> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>a map mapping dimension names to dimensions</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-04-13, v0.2.0</dd> +</dl> +</li> +</ul> +<a name="getDimension-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>getDimension</h4> +<pre>public <a href="../../../org/unitConverter/math/ObjectProduct.html" title="class in org.unitConverter.math">ObjectProduct</a><<a href="../../../org/unitConverter/unit/BaseDimension.html" title="class in org.unitConverter.unit">BaseDimension</a>> getDimension(java.lang.String name)</pre> +<div class="block">Gets a unit dimension from the database using its name. + + <p> + This method accepts exponents, like "L^3" + </p></div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - dimension's name</dd> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>dimension</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-03-14, v0.2.0</dd> +</dl> +</li> +</ul> +<a name="getDimensionFromExpression-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>getDimensionFromExpression</h4> +<pre>public <a href="../../../org/unitConverter/math/ObjectProduct.html" title="class in org.unitConverter.math">ObjectProduct</a><<a href="../../../org/unitConverter/unit/BaseDimension.html" title="class in org.unitConverter.unit">BaseDimension</a>> getDimensionFromExpression(java.lang.String expression)</pre> +<div class="block">Uses the database's data to parse an expression into a unit dimension + <p> + The expression is a series of any of the following: + <ul> + <li>The name of a unit dimension, which multiplies or divides the result based on preceding operators</li> + <li>The operators '*' and '/', which multiply and divide (note that just putting two unit dimensions next to each + other is equivalent to multiplication)</li> + <li>The operator '^' which exponentiates. Exponents must be integers.</li> + </ul></div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>expression</code> - expression to parse</dd> +<dt><span class="throwsLabel">Throws:</span></dt> +<dd><code>java.lang.IllegalArgumentException</code> - if the expression cannot be parsed</dd> +<dd><code>java.lang.NullPointerException</code> - if expression is null</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-04-13, v0.2.0</dd> +</dl> +</li> +</ul> +<a name="getPrefix-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>getPrefix</h4> +<pre>public <a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit">UnitPrefix</a> getPrefix(java.lang.String name)</pre> +<div class="block">Gets a unit prefix from the database from its name</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - prefix's name</dd> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>prefix</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-10, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="getPrefixFromExpression-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>getPrefixFromExpression</h4> +<pre>public <a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit">UnitPrefix</a> getPrefixFromExpression(java.lang.String expression)</pre> +<div class="block">Gets a unit prefix from a prefix expression + <p> + Currently, prefix expressions are much simpler than unit expressions: They are either a number or the name of + another prefix + </p></div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>expression</code> - expression to input</dd> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>prefix</dd> +<dt><span class="throwsLabel">Throws:</span></dt> +<dd><code>java.lang.IllegalArgumentException</code> - if expression cannot be parsed</dd> +<dd><code>java.lang.NullPointerException</code> - if any argument is null</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-14, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="getUnit-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>getUnit</h4> +<pre>public <a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a> getUnit(java.lang.String name)</pre> +<div class="block">Gets a unit from the database from its name, looking for prefixes.</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>name</code> - unit's name</dd> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>unit</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-10, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="getUnitFromExpression-java.lang.String-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>getUnitFromExpression</h4> +<pre>public <a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a> getUnitFromExpression(java.lang.String expression)</pre> +<div class="block">Uses the database's unit data to parse an expression into a unit + <p> + The expression is a series of any of the following: + <ul> + <li>The name of a unit, which multiplies or divides the result based on preceding operators</li> + <li>The operators '*' and '/', which multiply and divide (note that just putting two units or values next to each + other is equivalent to multiplication)</li> + <li>The operator '^' which exponentiates. Exponents must be integers.</li> + <li>A number which is multiplied or divided</li> + </ul> + This method only works with linear units.</div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>expression</code> - expression to parse</dd> +<dt><span class="throwsLabel">Throws:</span></dt> +<dd><code>java.lang.IllegalArgumentException</code> - if the expression cannot be parsed</dd> +<dd><code>java.lang.NullPointerException</code> - if expression is null</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-07, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="loadDimensionFile-java.io.File-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>loadDimensionFile</h4> +<pre>public void loadDimensionFile(java.io.File file)</pre> +<div class="block">Adds all dimensions from a file, using data from the database to parse them. + <p> + Each line in the file should consist of a name and an expression (parsed by getDimensionFromExpression) separated + by any number of tab characters. + <p> + <p> + Allowed exceptions: + <ul> + <li>Anything after a '#' character is considered a comment and ignored.</li> + <li>Blank lines are also ignored</li> + <li>If an expression consists of a single exclamation point, instead of parsing it, this method will search the + database for an existing unit. If no unit is found, an IllegalArgumentException is thrown. This is used to define + initial units and ensure that the database contains them.</li> + </ul></div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>file</code> - file to read</dd> +<dt><span class="throwsLabel">Throws:</span></dt> +<dd><code>java.lang.IllegalArgumentException</code> - if the file cannot be parsed, found or read</dd> +<dd><code>java.lang.NullPointerException</code> - if file is null</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-13, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="loadUnitsFile-java.io.File-"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>loadUnitsFile</h4> +<pre>public void loadUnitsFile(java.io.File file)</pre> +<div class="block">Adds all units from a file, using data from the database to parse them. + <p> + Each line in the file should consist of a name and an expression (parsed by getUnitFromExpression) separated by + any number of tab characters. + <p> + <p> + Allowed exceptions: + <ul> + <li>Anything after a '#' character is considered a comment and ignored.</li> + <li>Blank lines are also ignored</li> + <li>If an expression consists of a single exclamation point, instead of parsing it, this method will search the + database for an existing unit. If no unit is found, an IllegalArgumentException is thrown. This is used to define + initial units and ensure that the database contains them.</li> + </ul></div> +<dl> +<dt><span class="paramLabel">Parameters:</span></dt> +<dd><code>file</code> - file to read</dd> +<dt><span class="throwsLabel">Throws:</span></dt> +<dd><code>java.lang.IllegalArgumentException</code> - if the file cannot be parsed, found or read</dd> +<dd><code>java.lang.NullPointerException</code> - if file is null</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-01-13, v0.1.0</dd> +</dl> +</li> +</ul> +<a name="prefixMap--"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>prefixMap</h4> +<pre>public java.util.Map<java.lang.String,<a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit">UnitPrefix</a>> prefixMap()</pre> +<dl> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>a map mapping prefix names to prefixes</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-04-13, v0.2.0</dd> +</dl> +</li> +</ul> +<a name="toString--"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>toString</h4> +<pre>public java.lang.String toString()</pre> +<dl> +<dt><span class="overrideSpecifyLabel">Overrides:</span></dt> +<dd><code>toString</code> in class <code>java.lang.Object</code></dd> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>a string stating the number of units, prefixes and dimensions in the database</dd> +</dl> +</li> +</ul> +<a name="unitMap--"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>unitMap</h4> +<pre>public java.util.Map<java.lang.String,<a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a>> unitMap()</pre> +<div class="block">Returns a map mapping unit names to units, including units with prefixes. + <p> + The returned map is infinite in size if there is at least one unit and at least one prefix. If it is infinite, + some operations that only work with finite collections, like converting name/entry sets to arrays, will throw an + <code>IllegalStateException</code>. + </p> + <p> + Specifically, the operations that will throw an IllegalStateException if the map is infinite in size are: + <ul> + <li><code>unitMap.entrySet().toArray()</code> (either overloading)</li> + <li><code>unitMap.keySet().toArray()</code> (either overloading)</li> + </ul> + </p> + <p> + Because of ambiguities between prefixes (i.e. kilokilo = mega), the map's <code>containsValue</code> and <code>values()</code> methods currently ignore prefixes. + </p></div> +<dl> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>a map mapping unit names to units, including prefixed names</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-04-13, v0.2.0</dd> +</dl> +</li> +</ul> +<a name="unitMapPrefixless--"> +<!-- --> +</a> +<ul class="blockListLast"> +<li class="blockList"> +<h4>unitMapPrefixless</h4> +<pre>public java.util.Map<java.lang.String,<a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit">Unit</a>> unitMapPrefixless()</pre> +<dl> +<dt><span class="returnLabel">Returns:</span></dt> +<dd>a map mapping unit names to units, ignoring prefixes</dd> +<dt><span class="simpleTagLabel">Since:</span></dt> +<dd>2019-04-13, v0.2.0</dd> +</dl> +</li> +</ul> +</li> +</ul> +</li> +</ul> +</div> +</div> +<!-- ========= END OF CLASS DATA ========= --> +<!-- ======= START OF BOTTOM NAVBAR ====== --> +<div class="bottomNav"><a name="navbar.bottom"> +<!-- --> +</a> +<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> +<a name="navbar.bottom.firstrow"> +<!-- --> +</a> +<ul class="navList" title="Navigation"> +<li><a href="../../../overview-summary.html">Overview</a></li> +<li><a href="package-summary.html">Package</a></li> +<li class="navBarCell1Rev">Class</li> +<li><a href="class-use/UnitDatabase.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-files/index-1.html">Index</a></li> +<li><a href="../../../help-doc.html">Help</a></li> +</ul> +</div> +<div class="subNav"> +<ul class="navList"> +<li><a href="../../../org/unitConverter/unit/Unit.html" title="class in org.unitConverter.unit"><span class="typeNameLink">Prev Class</span></a></li> +<li><a href="../../../org/unitConverter/unit/UnitPrefix.html" title="class in org.unitConverter.unit"><span class="typeNameLink">Next Class</span></a></li> +</ul> +<ul class="navList"> +<li><a href="../../../index.html?org/unitConverter/unit/UnitDatabase.html" target="_top">Frames</a></li> +<li><a href="UnitDatabase.html" target="_top">No Frames</a></li> +</ul> +<ul class="navList" id="allclasses_navbar_bottom"> +<li><a href="../../../allclasses-noframe.html">All Classes</a></li> +</ul> +<div> +<script type="text/javascript"><!-- + allClassesLink = document.getElementById("allclasses_navbar_bottom"); + if(window==top) { + allClassesLink.style.display = "block"; + } + else { + allClassesLink.style.display = "none"; + } + //--> +</script> +</div> +<div> +<ul class="subNavList"> +<li>Summary: </li> +<li>Nested | </li> +<li>Field | </li> +<li><a href="#constructor.summary">Constr</a> | </li> +<li><a href="#method.summary">Method</a></li> +</ul> +<ul class="subNavList"> +<li>Detail: </li> +<li>Field | </li> +<li><a href="#constructor.detail">Constr</a> | </li> +<li><a href="#method.detail">Method</a></li> +</ul> +</div> +<a name="skip.navbar.bottom"> +<!-- --> +</a></div> +<!-- ======== END OF BOTTOM NAVBAR ======= --> +</body> +</html> |