All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prolog.math.IntFraction

java.lang.Object
   |
   +----prolog.Term
           |
           +----prolog.math.Numeric
                   |
                   +----prolog.math.RatNum
                           |
                           +----prolog.math.IntFraction

public class IntFraction
extends RatNum
Maths package for Prolog. A stripped and modified version of the gnu.math library, which has the following copyright:

Copyright (c) 1997 Per M.A. Bothner. This is free software; for terms and warranty disclaimer see ./COPYING.

Implementation of exact rational numbers as fractions of IntNums.


Variable Index

 o den
 o num

Constructor Index

 o IntFraction(IntNum, IntNum)

Method Index

 o add(Numeric, int)
Return this + k * obj.
 o add_reversed(Numeric, int)
Calculate x + k & this.
 o compare(Numeric)
Return 1 if this>obj; 0 if this==obj; -1 if this<obj; -2 if either is NaN; -3 if not comparable (not equal).
 o compare_reversed(Numeric)
 o denominator()
 o div(Numeric)
 o div_reversed(Numeric)
 o doubleValue()
 o hashCode()
Every Numeric subclass must provide a hashCode method such that numbers that are equal return the same hash.
 o isNegative()
 o longValue()
 o mod(Numeric)
 o mul(Numeric)
 o mul_reversed(Numeric)
 o neg()
 o neg(IntFraction)
 o numerator()
 o sign()
 o toString(int)

Variables

 o num
 IntNum num
 o den
 IntNum den

Constructors

 o IntFraction
 IntFraction(IntNum num,
             IntNum den)

Methods

 o numerator
 public final IntNum numerator()
Overrides:
numerator in class RatNum
 o denominator
 public final IntNum denominator()
Overrides:
denominator in class RatNum
 o isNegative
 public final boolean isNegative()
Overrides:
isNegative in class Numeric
 o sign
 public final int sign()
Overrides:
sign in class Numeric
 o compare
 public final int compare(Numeric n)
Return 1 if this>obj; 0 if this==obj; -1 if this<obj; -2 if either is NaN; -3 if not comparable (not equal).

Overrides:
compare in class Numeric
 o compare_reversed
 public int compare_reversed(Numeric x)
Overrides:
compare_reversed in class Numeric
 o add
 public Numeric add(Numeric y,
                    int k)
Return this + k * obj.

Overrides:
add in class Numeric
 o add_reversed
 public Numeric add_reversed(Numeric x,
                             int k)
Calculate x + k & this.

Overrides:
add_reversed in class Numeric
 o mul
 public Numeric mul(Numeric y)
Overrides:
mul in class Numeric
 o mul_reversed
 public Numeric mul_reversed(Numeric x)
Overrides:
mul_reversed in class Numeric
 o div
 public Numeric div(Numeric y)
Overrides:
div in class Numeric
 o div_reversed
 public Numeric div_reversed(Numeric x)
Overrides:
div_reversed in class Numeric
 o mod
 public Numeric mod(Numeric y)
Overrides:
mod in class Numeric
 o neg
 public static IntFraction neg(IntFraction x)
 o neg
 public Numeric neg()
Overrides:
neg in class Numeric
 o longValue
 public long longValue()
Overrides:
longValue in class Numeric
 o doubleValue
 public double doubleValue()
Overrides:
doubleValue in class Numeric
 o toString
 public String toString(int radix)
Overrides:
toString in class Numeric
 o hashCode
 public int hashCode()
Every Numeric subclass must provide a hashCode method such that numbers that are equal return the same hash.

Overrides:
hashCode in class Numeric

All Packages  Class Hierarchy  This Package  Previous  Next  Index