606 lines
22 KiB
HTML
606 lines
22 KiB
HTML
|
<!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 (version 1.7.0_25) on Fri Sep 20 13:54:02 EEST 2013 -->
|
||
|
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
|
||
|
<title>Lfraction</title>
|
||
|
<meta name="date" content="2013-09-20">
|
||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||
|
</head>
|
||
|
<body>
|
||
|
<script type="text/javascript"><!--
|
||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||
|
parent.document.title="Lfraction";
|
||
|
}
|
||
|
//-->
|
||
|
</script>
|
||
|
<noscript>
|
||
|
<div>JavaScript is disabled on your browser.</div>
|
||
|
</noscript>
|
||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||
|
<div class="topNav"><a name="navbar_top">
|
||
|
<!-- -->
|
||
|
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="navList" title="Navigation">
|
||
|
<li><a href="package-summary.html">Package</a></li>
|
||
|
<li class="navBarCell1Rev">Class</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">
|
||
|
<li>Prev Class</li>
|
||
|
<li>Next Class</li>
|
||
|
</ul>
|
||
|
<ul class="navList">
|
||
|
<li><a href="index.html?Lfraction.html" target="_top">Frames</a></li>
|
||
|
<li><a href="Lfraction.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">
|
||
|
<h2 title="Class Lfraction" class="title">Class Lfraction</h2>
|
||
|
</div>
|
||
|
<div class="contentContainer">
|
||
|
<ul class="inheritance">
|
||
|
<li>java.lang.Object</li>
|
||
|
<li>
|
||
|
<ul class="inheritance">
|
||
|
<li>Lfraction</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<div class="description">
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<dl>
|
||
|
<dt>All Implemented Interfaces:</dt>
|
||
|
<dd>java.lang.Comparable<<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a>></dd>
|
||
|
</dl>
|
||
|
<hr>
|
||
|
<br>
|
||
|
<pre>public class <span class="strong">Lfraction</span>
|
||
|
extends java.lang.Object
|
||
|
implements java.lang.Comparable<<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a>></pre>
|
||
|
<div class="block">This class presents fractions of form n/d where n and d are long integer
|
||
|
numbers. Basic operations and arithmetics for fractions are provided.</div>
|
||
|
</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="overviewSummary" 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><strong><a href="Lfraction.html#Lfraction(long, long)">Lfraction</a></strong>(long a,
|
||
|
long b)</code>
|
||
|
<div class="block">Constructor.</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="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
||
|
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
|
||
|
<tr>
|
||
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
||
|
<th class="colLast" scope="col">Method and Description</th>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code>java.lang.Object</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#clone()">clone</a></strong>()</code>
|
||
|
<div class="block">Clone of the fraction.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code>int</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#compareTo(Lfraction)">compareTo</a></strong>(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</code>
|
||
|
<div class="block">Comparision of fractions.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code><a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#divideBy(Lfraction)">divideBy</a></strong>(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</code>
|
||
|
<div class="block">Quotient of fractions.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code>boolean</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#equals(java.lang.Object)">equals</a></strong>(java.lang.Object m)</code>
|
||
|
<div class="block">Equality test.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code><a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#fractionPart()">fractionPart</a></strong>()</code>
|
||
|
<div class="block">Extract fraction part of the (improper) fraction
|
||
|
(a proper fraction without the integer part).</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code>long</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#getDenominator()">getDenominator</a></strong>()</code>
|
||
|
<div class="block">Public method to access the denominator field.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code>long</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#getNumerator()">getNumerator</a></strong>()</code>
|
||
|
<div class="block">Public method to access the numerator field.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code>int</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#hashCode()">hashCode</a></strong>()</code>
|
||
|
<div class="block">Hashcode has to be equal for equal fractions.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code>long</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#integerPart()">integerPart</a></strong>()</code>
|
||
|
<div class="block">Integer part of the (improper) fraction.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code><a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#inverse()">inverse</a></strong>()</code>
|
||
|
<div class="block">Inverse of the fraction.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code>static void</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#main(java.lang.String[])">main</a></strong>(java.lang.String[] param)</code>
|
||
|
<div class="block">Main method.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code><a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#minus(Lfraction)">minus</a></strong>(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</code>
|
||
|
<div class="block">Difference of fractions.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code><a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#opposite()">opposite</a></strong>()</code>
|
||
|
<div class="block">Opposite of the fraction.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code><a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#plus(Lfraction)">plus</a></strong>(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</code>
|
||
|
<div class="block">Sum of fractions.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code><a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#times(Lfraction)">times</a></strong>(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</code>
|
||
|
<div class="block">Multiplication of fractions.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code>double</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#toDouble()">toDouble</a></strong>()</code>
|
||
|
<div class="block">Approximate value of the fraction.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code>static <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#toLfraction(double, long)">toLfraction</a></strong>(double f,
|
||
|
long d)</code>
|
||
|
<div class="block">Double value f presented as a fraction with denominator d > 0.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colFirst"><code>java.lang.String</code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#toString()">toString</a></strong>()</code>
|
||
|
<div class="block">Conversion to string.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code>static <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a></code></td>
|
||
|
<td class="colLast"><code><strong><a href="Lfraction.html#valueOf(java.lang.String)">valueOf</a></strong>(java.lang.String s)</code>
|
||
|
<div class="block">Conversion from string to the fraction.</div>
|
||
|
</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>finalize, getClass, 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="Lfraction(long, long)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockListLast">
|
||
|
<li class="blockList">
|
||
|
<h4>Lfraction</h4>
|
||
|
<pre>public Lfraction(long a,
|
||
|
long b)</pre>
|
||
|
<div class="block">Constructor.</div>
|
||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>a</code> - numerator</dd><dd><code>b</code> - denominator > 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="main(java.lang.String[])">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>main</h4>
|
||
|
<pre>public static void main(java.lang.String[] param)</pre>
|
||
|
<div class="block">Main method. Different tests.</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="getNumerator()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>getNumerator</h4>
|
||
|
<pre>public long getNumerator()</pre>
|
||
|
<div class="block">Public method to access the numerator field.</div>
|
||
|
<dl><dt><span class="strong">Returns:</span></dt><dd>numerator</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="getDenominator()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>getDenominator</h4>
|
||
|
<pre>public long getDenominator()</pre>
|
||
|
<div class="block">Public method to access the denominator field.</div>
|
||
|
<dl><dt><span class="strong">Returns:</span></dt><dd>denominator</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="toString()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>toString</h4>
|
||
|
<pre>public java.lang.String toString()</pre>
|
||
|
<div class="block">Conversion to string.</div>
|
||
|
<dl>
|
||
|
<dt><strong>Overrides:</strong></dt>
|
||
|
<dd><code>toString</code> in class <code>java.lang.Object</code></dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>string representation of the fraction</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="equals(java.lang.Object)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>equals</h4>
|
||
|
<pre>public boolean equals(java.lang.Object m)</pre>
|
||
|
<div class="block">Equality test.</div>
|
||
|
<dl>
|
||
|
<dt><strong>Overrides:</strong></dt>
|
||
|
<dd><code>equals</code> in class <code>java.lang.Object</code></dd>
|
||
|
<dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - second fraction</dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>true if fractions this and m are equal</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="hashCode()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>hashCode</h4>
|
||
|
<pre>public int hashCode()</pre>
|
||
|
<div class="block">Hashcode has to be equal for equal fractions.</div>
|
||
|
<dl>
|
||
|
<dt><strong>Overrides:</strong></dt>
|
||
|
<dd><code>hashCode</code> in class <code>java.lang.Object</code></dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>hashcode</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="plus(Lfraction)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>plus</h4>
|
||
|
<pre>public <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> plus(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</pre>
|
||
|
<div class="block">Sum of fractions.</div>
|
||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - second addend</dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>this+m</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="times(Lfraction)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>times</h4>
|
||
|
<pre>public <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> times(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</pre>
|
||
|
<div class="block">Multiplication of fractions.</div>
|
||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - second factor</dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>this*m</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="inverse()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>inverse</h4>
|
||
|
<pre>public <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> inverse()</pre>
|
||
|
<div class="block">Inverse of the fraction. n/d becomes d/n.</div>
|
||
|
<dl><dt><span class="strong">Returns:</span></dt><dd>inverse of this fraction: 1/this</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="opposite()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>opposite</h4>
|
||
|
<pre>public <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> opposite()</pre>
|
||
|
<div class="block">Opposite of the fraction. n/d becomes -n/d.</div>
|
||
|
<dl><dt><span class="strong">Returns:</span></dt><dd>opposite of this fraction: -this</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="minus(Lfraction)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>minus</h4>
|
||
|
<pre>public <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> minus(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</pre>
|
||
|
<div class="block">Difference of fractions.</div>
|
||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - subtrahend</dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>this-m</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="divideBy(Lfraction)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>divideBy</h4>
|
||
|
<pre>public <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> divideBy(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</pre>
|
||
|
<div class="block">Quotient of fractions.</div>
|
||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - divisor</dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>this/m</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="compareTo(Lfraction)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>compareTo</h4>
|
||
|
<pre>public int compareTo(<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> m)</pre>
|
||
|
<div class="block">Comparision of fractions.</div>
|
||
|
<dl>
|
||
|
<dt><strong>Specified by:</strong></dt>
|
||
|
<dd><code>compareTo</code> in interface <code>java.lang.Comparable<<a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a>></code></dd>
|
||
|
<dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - second fraction</dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>-1 if this < m; 0 if this==m; 1 if this > m</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="clone()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>clone</h4>
|
||
|
<pre>public java.lang.Object clone()
|
||
|
throws java.lang.CloneNotSupportedException</pre>
|
||
|
<div class="block">Clone of the fraction.</div>
|
||
|
<dl>
|
||
|
<dt><strong>Overrides:</strong></dt>
|
||
|
<dd><code>clone</code> in class <code>java.lang.Object</code></dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>new fraction equal to this</dd>
|
||
|
<dt><span class="strong">Throws:</span></dt>
|
||
|
<dd><code>java.lang.CloneNotSupportedException</code></dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="integerPart()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>integerPart</h4>
|
||
|
<pre>public long integerPart()</pre>
|
||
|
<div class="block">Integer part of the (improper) fraction.</div>
|
||
|
<dl><dt><span class="strong">Returns:</span></dt><dd>integer part of this fraction</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="fractionPart()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>fractionPart</h4>
|
||
|
<pre>public <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> fractionPart()</pre>
|
||
|
<div class="block">Extract fraction part of the (improper) fraction
|
||
|
(a proper fraction without the integer part).</div>
|
||
|
<dl><dt><span class="strong">Returns:</span></dt><dd>fraction part of this fraction</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="toDouble()">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>toDouble</h4>
|
||
|
<pre>public double toDouble()</pre>
|
||
|
<div class="block">Approximate value of the fraction.</div>
|
||
|
<dl><dt><span class="strong">Returns:</span></dt><dd>numeric value of this fraction</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="toLfraction(double, long)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>toLfraction</h4>
|
||
|
<pre>public static <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> toLfraction(double f,
|
||
|
long d)</pre>
|
||
|
<div class="block">Double value f presented as a fraction with denominator d > 0.</div>
|
||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>f</code> - real number</dd><dd><code>d</code> - positive denominator for the result</dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>f as an approximate fraction of form n/d</dd></dl>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<a name="valueOf(java.lang.String)">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockListLast">
|
||
|
<li class="blockList">
|
||
|
<h4>valueOf</h4>
|
||
|
<pre>public static <a href="Lfraction.html" title="class in <Unnamed>">Lfraction</a> valueOf(java.lang.String s)</pre>
|
||
|
<div class="block">Conversion from string to the fraction. Accepts strings of form
|
||
|
that is defined by the toString method.</div>
|
||
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>s</code> - string form (as produced by toString) of the fraction</dd>
|
||
|
<dt><span class="strong">Returns:</span></dt><dd>fraction represented by s</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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="navList" title="Navigation">
|
||
|
<li><a href="package-summary.html">Package</a></li>
|
||
|
<li class="navBarCell1Rev">Class</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">
|
||
|
<li>Prev Class</li>
|
||
|
<li>Next Class</li>
|
||
|
</ul>
|
||
|
<ul class="navList">
|
||
|
<li><a href="index.html?Lfraction.html" target="_top">Frames</a></li>
|
||
|
<li><a href="Lfraction.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>
|