## Class PiFraction

    java.lang.Object
      PiFraction

     class PiFraction

extends Object

This class introduces fractions of π. The only actual difference between a `Fraction` and a `PiFraction` is their ouput formatting. Also, `PiFraction` is only used for outputting.

Since:
  2014-04-01
Version:
  1.0
Author:
  Pavel Sikora <pavelsikora@mail.muni.cz>

Field Summary
`(package private) long` `d` denominator
`(package private) long` `n` numerator

Constructor Summary
`PiFraction(long nn)` Constructs a fraction from an integer.
`PiFraction(long nn, long dd)` Constructs a fraction from its numerator and denominator.

Method Summary
`(package private) boolean` `isEqual(PiFraction c)` Checks if this `PiFraction` is equal to another `PiFraction`.
`(package private) long` `toDegrees()` Converts the angle from rads to degrees.
`(package private) String` `toTeX()` Prints this PiFraction formatted as TeX code.
`(package private) String` `toText()` Prints this PiFraction formatted as text.

Methods inherited from class
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### d

    long d

  denominator

### n

    long n

  numerator

Constructor Detail

### PiFraction

    PiFraction(long nn)

  Constructs a fraction from an integer.

  Parameters:
    `nn` - the integer (constructs fraction nn/1)

### PiFraction

    PiFraction(long nn,
               long dd)

  Constructs a fraction from its numerator and denominator.

  Parameters:
    `nn` - nominator
    `dd` - denominator
  Throws:
    `IllegalArgumentException` - Throws an exception if the denominator would be zero.

Method Detail

### isEqual

    boolean isEqual(PiFraction c)

  Checks if this `PiFraction` is equal to another `PiFraction`.

  Parameters:
    `c` - comparand
  Returns:
    true if this `PiFraction` is equal to the comparand, false otherwise

### toDegrees

    long toDegrees()

  Converts the angle from rads to degrees.

  Returns:
    magnitude in degrees of the angle given by this `PiFraction`

### toTeX

    String toTeX()

  Prints this PiFraction formatted as TeX code.

  Returns:
    TeX code for this SRF; for example, -2π/3 yields `-\frac{2\pi}{3}`

### toText

    String toText()

  Prints this PiFraction formatted as text.

  Returns:
    plain text description of this SRF; for example, -2π/3 yields `-2*pi/3`