net.imglib2.util

## Class Fraction

• ```public class Fraction
extends Object```
Implements the concept of fractions
Author:
Stephan Preibisch
• ### Constructor Summary

Constructors
Constructor and Description
`Fraction()`
Instantiate a `Fraction` with a value of 1
```Fraction(long numerator, long denominator)```
Creates a new fraction with the respective values
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Fraction` `clone()`
`void` `div(Fraction fraction)`
`long` `getDenominator()`
`long` `getNumerator()`
`double` `getRatio()`
`void` `invert()`
Inverts this fraction by exchanging numerator and denominator
`void` `mul(Fraction fraction)`
`long` `mulCeil(long value)`
Multiply the value with this fraction.
• ### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### Fraction

```public Fraction(long numerator,
long denominator)```
Creates a new fraction with the respective values
Parameters:
`numerator` - (above fraction bar)
`denominator` - (below fraction bar)
• #### Fraction

`public Fraction()`
Instantiate a `Fraction` with a value of 1
• ### Method Detail

• #### getNumerator

`public long getNumerator()`
Returns:
- the numerator (above the fraction bar)
• #### getDenominator

`public long getDenominator()`
Returns:
- the denominator (below the fraction bar)
• #### getRatio

`public double getRatio()`
Returns:
- an estimate of the ratio in double, i.e. numerator/denominator
• #### invert

`public void invert()`
Inverts this fraction by exchanging numerator and denominator
• #### mul

`public void mul(Fraction fraction)`
• #### div

`public void div(Fraction fraction)`
• #### mulCeil

`public long mulCeil(long value)`
Multiply the value with this fraction. Return the ceiled value (e.g. 10.2 = 11) if the result is a fraction.
Parameters:
`value` -
Returns:
• #### clone

`public Fraction clone()`
Overrides:
`clone` in class `Object`