blob: f318ea6cad93b35cbc4af576d23f61f53cb15733 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.4) on Fri Sep 20 12:10:30 CEST 2019 -->
<title>Fraction (Apache SIS 1.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2019-09-20">
<meta name="keywords" content="org.apache.sis.math.Fraction class">
<meta name="keywords" content="numerator">
<meta name="keywords" content="denominator">
<meta name="keywords" content="valueOf()">
<meta name="keywords" content="unique()">
<meta name="keywords" content="simplify()">
<meta name="keywords" content="negate()">
<meta name="keywords" content="add()">
<meta name="keywords" content="subtract()">
<meta name="keywords" content="multiply()">
<meta name="keywords" content="divide()">
<meta name="keywords" content="round()">
<meta name="keywords" content="floor()">
<meta name="keywords" content="ceil()">
<meta name="keywords" content="doubleValue()">
<meta name="keywords" content="floatValue()">
<meta name="keywords" content="longValue()">
<meta name="keywords" content="intValue()">
<meta name="keywords" content="shortValue()">
<meta name="keywords" content="byteValue()">
<meta name="keywords" content="signum()">
<meta name="keywords" content="compareTo()">
<meta name="keywords" content="equals()">
<meta name="keywords" content="hashCode()">
<meta name="keywords" content="toString()">
<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="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Fraction (Apache SIS 1.0 API)";
}
}
catch(err) {
}
//-->
var data = {"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,"i19":10,"i20":10,"i21":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../";
var useModuleDirectories = false;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Fraction.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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.math</a></div>
<h2 title="Class Fraction" class="title">Class Fraction</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></li>
<li>
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number</a></li>
<li>
<ul class="inheritance">
<li>Fraction</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a></code>, <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Comparable</a>&lt;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&gt;</code></dd>
</dl>
<hr>
<pre>public final class <span class="typeNameLabel">Fraction</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number</a>
implements <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Comparable</a>&lt;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&gt;, <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a></pre>
<div class="block">A value class for rational numbers. <code>Fraction</code> objects are represented by a <a href="#numerator">numerator</a> and
a <a href="#denominator">denominator</a> stored at 32 bits integers. Fractions can be <a href="#simplify()">simplified</a>.
All <code>Fraction</code> instances are immutable and thus inherently thread-safe.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>0.8</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../serialized-form.html#org.apache.sis.math.Fraction">Serialized Form</a></dd>
<p><font size="-1">Defined in the <code>sis-utility</code> module</font></p>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#denominator">denominator</a></span></code></th>
<td class="colLast">
<div class="block">The <var>b</var> term in the <var>a</var>/<var>b</var> fraction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#numerator">numerator</a></span></code></th>
<td class="colLast">
<div class="block">The <var>a</var> term in the <var>a</var>/<var>b</var> fraction.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(int,int)">Fraction</a></span>&#8203;(int&nbsp;numerator,
int&nbsp;denominator)</code></th>
<td class="colLast">
<div class="block">Creates a new fraction.</div>
</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.String)">Fraction</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;s)</code></th>
<td class="colLast">
<div class="block">Creates a new fraction from the given text.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#add(org.apache.sis.math.Fraction)">add</a></span>&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</code></th>
<td class="colLast">
<div class="block">Returns the simplified result of adding the given fraction to this fraction.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>byte</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#byteValue()">byteValue</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns this fraction rounded toward zero, if the result can be represented as a signed byte.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ceil()">ceil</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns this fraction rounded toward positive infinity.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#compareTo(org.apache.sis.math.Fraction)">compareTo</a></span>&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</code></th>
<td class="colLast">
<div class="block">Compares this fraction with the given one for order.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#divide(org.apache.sis.math.Fraction)">divide</a></span>&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</code></th>
<td class="colLast">
<div class="block">Returns the simplified result of dividing this fraction by the given fraction.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>double</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#doubleValue()">doubleValue</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the fraction as a double-precision floating point number.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#equals(java.lang.Object)">equals</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;other)</code></th>
<td class="colLast">
<div class="block">Compares this fraction with the given object for equality.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>float</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#floatValue()">floatValue</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the fraction as a single-precision floating point number.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#floor()">floor</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns this fraction rounded toward negative infinity.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hashCode()">hashCode</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns a hash code value for this fraction.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#intValue()">intValue</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns this fraction rounded toward zero.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#longValue()">longValue</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns this fraction rounded toward zero.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code><a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#multiply(org.apache.sis.math.Fraction)">multiply</a></span>&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</code></th>
<td class="colLast">
<div class="block">Returns the simplified result of multiplying the given fraction with this fraction.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code><a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#negate()">negate</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the negative value of this fraction.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#round()">round</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns this fraction rounded toward nearest integer.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>short</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#shortValue()">shortValue</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns this fraction rounded toward zero, if the result can be represented as a short integer.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#signum()">signum</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the sign of this fraction.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code><a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#simplify()">simplify</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns a fraction equivalent to <code>this</code> but represented by the smallest possible numerator
and denominator values.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code><a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#subtract(org.apache.sis.math.Fraction)">subtract</a></span>&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</code></th>
<td class="colLast">
<div class="block">Returns the simplified result of subtracting the given fraction from this fraction.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns a string representation of this fraction.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code><a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#unique()">unique</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns a unique fraction instance equals to <code>this</code>.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>static <a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#valueOf(double)">valueOf</a></span>&#8203;(double&nbsp;value)</code></th>
<td class="colLast">
<div class="block">Converts the given IEEE 754 double-precision value to a fraction.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">get­Class</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notify­All</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="numerator">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>numerator</h4>
<pre>public final&nbsp;int numerator</pre>
<div class="block">The <var>a</var> term in the <var>a</var>/<var>b</var> fraction.
Can be positive, negative or zero.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#doubleValue()"><code>double­Value()</code></a></dd>
</dl>
</li>
</ul>
<a id="denominator">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>denominator</h4>
<pre>public final&nbsp;int denominator</pre>
<div class="block">The <var>b</var> term in the <var>a</var>/<var>b</var> fraction.
Can be positive, negative or zero. If zero, then the fraction <a href="#doubleValue()">floating point</a>
value will be positive infinity, negative infinity or NaN depending on the <a href="#numerator">numerator</a> value.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#doubleValue()"><code>double­Value()</code></a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;(int,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Fraction</h4>
<pre>public&nbsp;Fraction&#8203;(int&nbsp;numerator,
int&nbsp;denominator)</pre>
<div class="block">Creates a new fraction. This constructor stores the fraction exactly as specified; it does not simplify it.
The fraction can be simplified after construction by a call to <a href="#simplify()"><code>simplify()</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>numerator</code> - the <var>a</var> term in the <var>a</var>/<var>b</var> fraction.</dd>
<dd><code>denominator</code> - the <var>b</var> term in the <var>a</var>/<var>b</var> fraction.</dd>
</dl>
</li>
</ul>
<a id="&lt;init&gt;(java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Fraction</h4>
<pre>public&nbsp;Fraction&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;s)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NumberFormatException.html?is-external=true" title="class or interface in java.lang" class="externalLink">NumberFormatException</a></pre>
<div class="block">Creates a new fraction from the given text. This constructor is the converse of <a href="#toString()"><code>to­String()</code></a> method.
It can parse single numbers like "3", fractions like "2/3", Unicode characters like "⅔" and infinity symbols
"∞" and "−∞". The given text shall not contain spaces.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>s</code> - the text to parse.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NumberFormatException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number­Format­Exception</a></code> - if the given text can not be parsed.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="valueOf(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>valueOf</h4>
<pre class="methodSignature">public static&nbsp;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;valueOf&#8203;(double&nbsp;value)</pre>
<div class="block">Converts the given IEEE 754 double-precision value to a fraction. If successful, this method returns a fraction
such as <a href="#doubleValue()"><code>double­Value()</code></a> is equal to the given value in the sense of <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink"><code>Double​.equals(Object)</code></a>:
infinities, positive and negative zeros are preserved, but various NaN values are collapsed to a single NaN value.
<div class="note"><b>Design note:</b>
this method does not return approximated values because it is difficult to choose which fraction is best.
For example choosing an approximated fraction for π value is quite arbitrary, and searching the fraction
closer than any other fraction representable by this class is computationally expansive.
Even with common fractions, the algorithm currently implemented in this class can detect that 1.6666666666666667
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">is equal to</a> 5⁄3 but can not detect easily that 1.66666666666666 (same number
with two decimal digits dropped) is close to 5⁄3.</div>
This method accepts only values between <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html?is-external=true#MIN_VALUE" title="class or interface in java.lang" class="externalLink">-2147483648</a> and <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html?is-external=true#MAX_VALUE" title="class or interface in java.lang" class="externalLink">2147483647</a> inclusive,
i.e. values in the range of 32-bits integers. If the given value has fraction digits, then the validity range
will be smaller depending on the <a href="#denominator">denominator</a> required for representing that value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value</code> - the double-precision value to convert to a fraction.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a fraction such as <a href="#doubleValue()"><code>double­Value()</code></a> is equals to the given value.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Illegal­Argument­Exception</a></code> - if the given value can not be converted to a fraction.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
</dl>
</li>
</ul>
<a id="unique()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>unique</h4>
<pre class="methodSignature">public&nbsp;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;unique()</pre>
<div class="block">Returns a unique fraction instance equals to <code>this</code>.
If this method has been invoked previously on another <code>Fraction</code> with the same value than <code>this</code>,
then that previous instance is returned (provided that it has not yet been garbage collected). Otherwise this
method adds this fraction to the pool of fractions that may be returned in next <code>unique()</code> invocations,
then returns <code>this</code>.
<p>This method is useful for saving memory when a potentially large amount of <code>Fraction</code> instances will
be kept for a long time and many instances are likely to have the same values.
It is usually not worth to invoke this method for short-lived instances.</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a unique instance of a fraction equals to <code>this</code>.</dd>
</dl>
</li>
</ul>
<a id="simplify()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>simplify</h4>
<pre class="methodSignature">public&nbsp;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;simplify()</pre>
<div class="block">Returns a fraction equivalent to <code>this</code> but represented by the smallest possible numerator
and denominator values. If this fraction can not be simplified, then this method returns <code>this</code>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the simplest fraction equivalent to this fraction.</dd>
</dl>
</li>
</ul>
<a id="negate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>negate</h4>
<pre class="methodSignature">public&nbsp;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;negate()</pre>
<div class="block">Returns the negative value of this fraction.
This method does not simplify the fraction.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the result of <code>-this</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Arithmetic­Exception</a></code> - if the result overflows.</dd>
</dl>
</li>
</ul>
<a id="add(org.apache.sis.math.Fraction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre class="methodSignature">public&nbsp;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;add&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</pre>
<div class="block">Returns the simplified result of adding the given fraction to this fraction.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the fraction to add to this fraction.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the simplified result of <code>this</code> + <code>other</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Arithmetic­Exception</a></code> - if the result overflows.</dd>
</dl>
</li>
</ul>
<a id="subtract(org.apache.sis.math.Fraction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>subtract</h4>
<pre class="methodSignature">public&nbsp;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;subtract&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</pre>
<div class="block">Returns the simplified result of subtracting the given fraction from this fraction.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the fraction to subtract from this fraction.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the simplified result of <code>this</code> - <code>other</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Arithmetic­Exception</a></code> - if the result overflows.</dd>
</dl>
</li>
</ul>
<a id="multiply(org.apache.sis.math.Fraction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>multiply</h4>
<pre class="methodSignature">public&nbsp;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;multiply&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</pre>
<div class="block">Returns the simplified result of multiplying the given fraction with this fraction.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the fraction to multiply with this fraction.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the simplified result of <code>this</code> × <code>other</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Arithmetic­Exception</a></code> - if the result overflows.</dd>
</dl>
</li>
</ul>
<a id="divide(org.apache.sis.math.Fraction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>divide</h4>
<pre class="methodSignature">public&nbsp;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;divide&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</pre>
<div class="block">Returns the simplified result of dividing this fraction by the given fraction.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the fraction by which to divide this fraction.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the simplified result of <code>this</code><code>other</code>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Arithmetic­Exception</a></code> - if the result overflows.</dd>
</dl>
</li>
</ul>
<a id="round()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>round</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;round()</pre>
<div class="block">Returns this fraction rounded toward nearest integer. If the result is located
at equal distance from the two nearest integers, then rounds to the even one.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><a href="#numerator"><code>numerator</code></a> / <a href="#denominator"><code>denominator</code></a> rounded toward nearest integer.</dd>
</dl>
</li>
</ul>
<a id="floor()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>floor</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;floor()</pre>
<div class="block">Returns this fraction rounded toward negative infinity.
This is different from the default operation on primitive types, which rounds toward zero.
<p><b>Tip:</b> if the numerator and the denominator are both positive or both negative,
then the result is positive and identical to <code>numerator / denominator</code>.</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><a href="#numerator"><code>numerator</code></a> / <a href="#denominator"><code>denominator</code></a> rounded toward negative infinity.</dd>
</dl>
</li>
</ul>
<a id="ceil()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ceil</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;ceil()</pre>
<div class="block">Returns this fraction rounded toward positive infinity.
This is different from the default operation on primitive types, which rounds toward zero.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><a href="#numerator"><code>numerator</code></a> / <a href="#denominator"><code>denominator</code></a> rounded toward positive infinity.</dd>
</dl>
</li>
</ul>
<a id="doubleValue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>doubleValue</h4>
<pre class="methodSignature">public&nbsp;double&nbsp;doubleValue()</pre>
<div class="block">Returns the fraction as a double-precision floating point number.
Special cases:
<ul>
<li>If the <a href="#numerator">numerator</a> and the <a href="#denominator">denominator</a> are both 0,
then this method returns <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true#NaN" title="class or interface in java.lang" class="externalLink"><code>Double​.Na­N</code></a>.</li>
<li>If only the <a href="#denominator">denominator</a> is zero, then this method returns
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true#POSITIVE_INFINITY" title="class or interface in java.lang" class="externalLink">positive infinity</a> or
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true#NEGATIVE_INFINITY" title="class or interface in java.lang" class="externalLink">negative infinity</a> accordingly the <a href="#numerator">numerator</a> sign.</li>
</ul></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true#doubleValue()" title="class or interface in java.lang" class="externalLink">double­Value</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this fraction as a floating point number.</dd>
</dl>
</li>
</ul>
<a id="floatValue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>floatValue</h4>
<pre class="methodSignature">public&nbsp;float&nbsp;floatValue()</pre>
<div class="block">Returns the fraction as a single-precision floating point number.
Special cases:
<ul>
<li>If the <a href="#numerator">numerator</a> and the <a href="#denominator">denominator</a> are both 0,
then this method returns <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Float.html?is-external=true#NaN" title="class or interface in java.lang" class="externalLink"><code>Float​.Na­N</code></a>.</li>
<li>If only the <a href="#denominator">denominator</a> is zero, then this method returns
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Float.html?is-external=true#POSITIVE_INFINITY" title="class or interface in java.lang" class="externalLink">positive infinity</a> or
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Float.html?is-external=true#NEGATIVE_INFINITY" title="class or interface in java.lang" class="externalLink">negative infinity</a> accordingly the <a href="#numerator">numerator</a> sign.</li>
</ul></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true#floatValue()" title="class or interface in java.lang" class="externalLink">float­Value</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this fraction as a floating point number.</dd>
</dl>
</li>
</ul>
<a id="longValue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>longValue</h4>
<pre class="methodSignature">public&nbsp;long&nbsp;longValue()</pre>
<div class="block">Returns this fraction rounded toward zero.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true#longValue()" title="class or interface in java.lang" class="externalLink">long­Value</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this fraction rounded toward zero.</dd>
</dl>
</li>
</ul>
<a id="intValue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>intValue</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;intValue()</pre>
<div class="block">Returns this fraction rounded toward zero.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true#intValue()" title="class or interface in java.lang" class="externalLink">int­Value</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><a href="#numerator"><code>numerator</code></a> / <a href="#denominator"><code>denominator</code></a> rounded toward zero.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#round()"><code>round()</code></a>,
<a href="#floor()"><code>floor()</code></a>,
<a href="#ceil()"><code>ceil()</code></a></dd>
</dl>
</li>
</ul>
<a id="shortValue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>shortValue</h4>
<pre class="methodSignature">public&nbsp;short&nbsp;shortValue()</pre>
<div class="block">Returns this fraction rounded toward zero, if the result can be represented as a short integer.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true#shortValue()" title="class or interface in java.lang" class="externalLink">short­Value</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this fraction rounded toward zero.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Arithmetic­Exception</a></code> - if the result can not be represented as a short integer.</dd>
</dl>
</li>
</ul>
<a id="byteValue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>byteValue</h4>
<pre class="methodSignature">public&nbsp;byte&nbsp;byteValue()</pre>
<div class="block">Returns this fraction rounded toward zero, if the result can be represented as a signed byte.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true#byteValue()" title="class or interface in java.lang" class="externalLink">byte­Value</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink">Number</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this fraction rounded toward zero.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ArithmeticException.html?is-external=true" title="class or interface in java.lang" class="externalLink">Arithmetic­Exception</a></code> - if the result can not be represented as a signed byte.</dd>
</dl>
</li>
</ul>
<a id="signum()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>signum</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;signum()</pre>
<div class="block">Returns the sign of this fraction. The return value is -1 if this fraction is negative;
0 if the numerator is zero; and 1 if this fraction is positive.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the sign of this fraction.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html?is-external=true#signum(int)" title="class or interface in java.lang" class="externalLink"><code>Integer​.signum(int)</code></a></dd>
</dl>
</li>
</ul>
<a id="compareTo(org.apache.sis.math.Fraction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>compareTo</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;compareTo&#8203;(<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&nbsp;other)</pre>
<div class="block">Compares this fraction with the given one for order.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true#compareTo(T)" title="class or interface in java.lang" class="externalLink">compare­To</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Comparable</a>&lt;<a href="Fraction.html" title="class in org.apache.sis.math">Fraction</a>&gt;</code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the fraction to compare to this fraction for ordering.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a negative number if this fraction is smaller than the given fraction,
a positive number if greater, or 0 if equals.</dd>
</dl>
</li>
</ul>
<a id="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;equals&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;other)</pre>
<div class="block">Compares this fraction with the given object for equality. This method returns <code>true</code> only if
the two objects are fractions with same <a href="#numerator">numerator</a> and <a href="#denominator">denominator</a> values.
Fractions with different values are not considered equal even if the two fraction are equivalent.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>other</code> - the object to compare with this fraction for equality.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the given object is an other fraction with the same numerator and denominator values.</dd>
</dl>
</li>
</ul>
<a id="hashCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;hashCode()</pre>
<div class="block">Returns a hash code value for this fraction.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hash­Code</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></dd>
</dl>
</li>
</ul>
<a id="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;toString()</pre>
<div class="block">Returns a string representation of this fraction.
This method returns Unicode symbol if possible.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">to­String</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a string representation of this fraction.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Fraction.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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses.html">All&nbsp;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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 2010&#x2013;2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>