Object:BigInt

Import List

    ADT:Storable
    IO
    Object
    Object
    Object:Boxed
    RT0
 
Class List
BigInt
Class Summary: BigInt [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---ADT:Storable.Object
                 |
                 +---Object:Boxed.Object
                      |
                      +--Object:BigInt.BigInt
Constructor Summary
New(STRING, LONGINT): BigInt

          
NewInt(LONGINT): BigInt

          
NewLatin1(ARRAY OF CHAR, LONGINT): BigInt

          
NewLatin1Region(ARRAY OF CHAR, LONGINT, LONGINT, LONGINT): BigInt

          Result is NIL if the string interval does not match the syntax for integer numbers.
Method Summary
Abs(): BigInt

          
Add(BigInt): BigInt

          
Cmp(Object): LONGINT

          
Copy(): BigInt

          
Div(BigInt): BigInt

          
DivMod(BigInt, VAR BigInt, VAR BigInt)

          
Equals(Object): BOOLEAN

          Indicates whether some other object is "equal to" this one.
Format(Digit): String8

          
HashCode(): Hash

          Returns a hash code value for the object.
Invert(): BigInt

          Bitwise complement.
IsZero(): BOOLEAN

          
LShift(LONGINT): BigInt

          
Load(Reader)

          Loads data of a from r.
Mod(BigInt): BigInt

          
Mul(BigInt): BigInt

          
Neg(): BigInt

          
NonZero(): BOOLEAN

          
RShift(LONGINT): BigInt

          
Sign(): LONGINT

          
Store(Writer)

          Stores data of a to w.
Sub(BigInt): BigInt

          
ToLongInt(): LONGINT

          
ToString(): String8

          Returns a string representation of the object.
Inherited Methods

From RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode

From ADT:Storable.Object:

          Load, Store

From Object:Boxed.Object:

          Cmp, ToString

 
Type Summary
[Digit] = INTEGER

          
[DigitArray] = POINTER TO ARRAY OF Digit

          
Variable Summary
one-: BigInt

          
zero-: BigInt

          

Class Detail: BigInt
Constructor Detail

New

PROCEDURE New(str: STRING; 
              inputBase: LONGINT): BigInt

NewInt

PROCEDURE NewInt(int: LONGINT): BigInt

NewLatin1

PROCEDURE NewLatin1(str: ARRAY OF CHAR; 
                    inputBase: LONGINT): BigInt

NewLatin1Region

PROCEDURE NewLatin1Region(str: ARRAY OF CHAR; 
                          start: LONGINT; 
                          end: LONGINT; 
                          inputBase: LONGINT): BigInt

Result is NIL if the string interval does not match the syntax for integer numbers.

Pre-condition: `start <= end'

Method Detail

Abs

PROCEDURE (a: BigInt) Abs(): BigInt

Add

PROCEDURE (a: BigInt) Add(b: BigInt): BigInt

Cmp

PROCEDURE (a: BigInt) Cmp(b: Object): LONGINT

Redefines: Cmp


Copy

PROCEDURE (a: BigInt) Copy(): BigInt

Div

PROCEDURE (v: BigInt) Div(w: BigInt): BigInt

DivMod

PROCEDURE (v: BigInt) DivMod(w: BigInt; 
                 VAR div: BigInt; 
                 VAR mod: BigInt)

Equals

PROCEDURE (a: BigInt) Equals(b: Object): BOOLEAN

Indicates whether some other object is "equal to" this one.

The Object.Equals method implements an equivalence relation:

The `Equals' method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values `x' and `y', this method returns TRUE if and only if `x' and `y' refer to the same object (`x=y' has the value TRUE).

[Description inherited from Equals]

Redefines: Equals, Equals, Equals


Format

PROCEDURE (a: BigInt) Format(outputBase: Digit): String8

HashCode

PROCEDURE (a: BigInt) HashCode(): Hash

Returns a hash code value for the object. This method is supported for the benefit of dictionaries such as those provided by ADT:Dictionary.

The general contract of Object.HashCode is:

As much as is reasonably practical, the Object.HashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required.)

[Description inherited from HashCode]

Redefines: HashCode, HashCode, HashCode


Invert

PROCEDURE (a: BigInt) Invert(): BigInt

Bitwise complement. The result equals `-(a+1)'.


IsZero

PROCEDURE (a: BigInt) IsZero(): BOOLEAN

LShift

PROCEDURE (a: BigInt) LShift(n: LONGINT): BigInt

Load

PROCEDURE (a: BigInt) Load(r: Reader)
  RAISES Error;

Loads data of a from r. Nested record pointers are loaded by calling the type-bound procecdure Reader.ReadObject. This procedure must be symmetric to Object.Store, or data internalization will break, causing undefined object state or program termination.

Note: When internalizing a file with alien objects, it is possible that the type-bound procedure Object.Load is invoked more than once for a single object. Except for the results of the last call, all duplicates are discarded. Because of this, all changes by this procedure to any program state that is not part of the object a are deprecated.

Pre-condition: This procedure is either activated by a super call, or from the procedure Reader.ReadObject.

[Description inherited from Load]

Redefines: Load, Load


Mod

PROCEDURE (v: BigInt) Mod(w: BigInt): BigInt

Mul

PROCEDURE (a: BigInt) Mul(b: BigInt): BigInt

Neg

PROCEDURE (a: BigInt) Neg(): BigInt

NonZero

PROCEDURE (a: BigInt) NonZero(): BOOLEAN

RShift

PROCEDURE (a: BigInt) RShift(n: LONGINT): BigInt

Sign

PROCEDURE (a: BigInt) Sign(): LONGINT

Store

PROCEDURE (a: BigInt) Store(w: Writer)
  RAISES Error;

Stores data of a to w. Nested record pointers are stored by calling the type-bound procedure Writer.WriteObject. The procedure is not allowed to make any changes to the global state of the program, except for calling the `Write' methods of the writer w. Any redefinition of this procedure must include a super call, preferably as the first statement of the procedure body.

Pre-condition: This procedure is either activated by a super call, or from the procedure Writer.WriteObject.

[Description inherited from Store]

Redefines: Store, Store


Sub

PROCEDURE (a: BigInt) Sub(b: BigInt): BigInt

ToLongInt

PROCEDURE (a: BigInt) ToLongInt(): LONGINT

ToString

PROCEDURE (a: BigInt) ToString(): String8

Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

[Description inherited from ToString]

Redefines: ToString, ToString, ToString

 
Type Detail

Digit

TYPE [Digit] = INTEGER

DigitArray

TYPE [DigitArray] = POINTER TO ARRAY OF Digit
Variable Detail

one

VAR one-: BigInt

zero

VAR zero-: BigInt