All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prolog.math.IntNum

java.lang.Object
   |
   +----prolog.Term
           |
           +----prolog.math.Numeric
                   |
                   +----prolog.math.IntNum

public class IntNum
extends Numeric
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.

A class for infinite-precision integers.


Variable Index

 o ival
 o maxFixNum
 o minFixNum
We pre-allocate integers in the range minFixNum..maxFixNum.
 o numFixNum
 o smallFixNums

Constructor Index

 o IntNum()
 o IntNum(int)
Create a new (non-shared) IntNum, and initialize to an int.

Method Index

 o ()
 o add(IntNum)
 o add(Numeric)
Return this + k * obj.
 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 div(Numeric)
 o doubleValue()
 o equals(Object)
 o hashCode()
Every Numeric subclass must provide a hashCode method such that numbers that are equal return the same hash.
 o intValue()
 o isNegative()
Return the IntNum for -1.
 o longValue()
 o make(int)
Return a (possibly-shared) IntNum with a given int value.
 o mod(Numeric)
 o mul(Numeric)
 o neg()
 o normalise_copy(Variable[], int, Vector)
Copy a Term, instantiating variables from the array.
 o one()
 o sign()
 o sub(IntNum)
 o sub(Numeric)
 o toInt(int)
 o toString(int)
 o typify(TypeDictionary, boolean)
Generate the type tree that describes this Term.

Variables

 o ival
 public int ival
 o minFixNum
 static final int minFixNum
We pre-allocate integers in the range minFixNum..maxFixNum.

 o maxFixNum
 static final int maxFixNum
 o numFixNum
 static final int numFixNum
 o smallFixNums
 static final IntNum smallFixNums[]

Constructors

 o IntNum
 public IntNum()
 o IntNum
 public IntNum(int value)
Create a new (non-shared) IntNum, and initialize to an int.

Parameters:
value - the initial value

Methods

 o normalise_copy
 public Term normalise_copy(Variable vars[],
                            int next_new_var,
                            Vector new_vars)
Copy a Term, instantiating variables from the array.

Overrides:
normalise_copy in class Term
 o typify
 public void typify(TypeDictionary types,
                    boolean map)
Generate the type tree that describes this Term.

Overrides:
typify in class Term
 o
 static void ()
 o make
 public static IntNum make(int value)
Return a (possibly-shared) IntNum with a given int value.

 o add
 public Numeric add(Numeric y)
Return this + k * obj.

Overrides:
add in class Numeric
 o add
 public IntNum add(IntNum y)
 o sub
 public Numeric sub(Numeric y)
Overrides:
sub in class Numeric
 o sub
 public IntNum sub(IntNum y)
 o mul
 public Numeric mul(Numeric y)
Overrides:
mul in class Numeric
 o div
 public Numeric div(Numeric y)
Overrides:
div in class Numeric
 o mod
 public Numeric mod(Numeric y)
Overrides:
mod in class Numeric
 o neg
 public Numeric neg()
Overrides:
neg in class Numeric
 o one
 public static final IntNum one()
 o isNegative
 public final boolean isNegative()
Return the IntNum for -1.

Overrides:
isNegative in class Numeric
 o sign
 public int sign()
 o compare
 public 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 toInt
 public Numeric toInt(int rounding_mode)
Overrides:
toInt in class Numeric
 o toString
 public String toString(int radix)
Overrides:
toString in class Numeric
 o intValue
 public int intValue()
Overrides:
intValue in class Numeric
 o longValue
 public long longValue()
Overrides:
longValue 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
 o equals
 public boolean equals(Object obj)
Overrides:
equals in class Numeric
 o doubleValue
 public double doubleValue()
Overrides:
doubleValue in class Numeric

All Packages  Class Hierarchy  This Package  Previous  Next  Index