Index - All Packages - All Categories - All Classes

Class Sequence

Represents an infinite sequence of integers (of which only a finite number can be non-zero). They are lexically ordered, and there is a "decimal point" between the numbers at -1 and 0.

Implementation note:
The array should have no zeros at either end, and noone else should have a pointer to it.

Package: Udanax-Gold
All Superclasses: Object Heaper Position
Protocols: Object
Categories: Xanadu-tumbler

Class Methods

infostProtocol



Overrides: Position class

initTimeNonInherited


linkTimeNonInherited


numbers: digits


one: a

A single element Sequence

printArrayOn: oo with: numbers

Print a sequence of numbers separated by dots. Deal with strings specially.

printOn: oo with: shift with: numbers


printZerosOn: oo with: shift


string: string


three: a with: b with: c

A three element Sequence

two: a with: b

A two element Sequence

usingx: shift with: numbers

Don't need to make a copy of the array

zero



Instance Methods

actualHashForEqual



Overrides: Position

asRegion



Overrides: Position

comparePrefix: other with: n

Compare my numbers up to and including index n with the corresponding numbers in the other Sequence. Return -1, 0 or 1 depending on whether they are <, =, or > the other.

coordinateSpace



Overrides: Position

count

How many numbers in the sequence, not counting leading or trailing zeros

create: shift with: numbers


createRcvr: receiver


first

The sequence consisting of all numbers in this one up to but not including the first zero, or the entire thing if there are no zeros

firstIndex

The smallest index with a non-zero number. Blasts if it is all zeros.

integerAt: index

The number at the given index in the Sequence. Returns zeros beyond either end of the array.

integers

Essential. The numbers in this Sequence. This is a copy of the array, so you may modify it.
Note that two Sequences which are isEqual, may actually have arrays of numbers which have different specs. Also, the array will not have any zeros at the beginning or end.

isEmpty

Whether there are no non-zero numbers in the Sequence

isEqual: other



Overrides: Position

isGE: other

Whether this sequence is greater than or equal to the other sequence, using a lexical comparison of their corresponding numbers.

Overrides: Position

isZero

Whether all the numbers in the sequence are zero

lastIndex

The largest index with a non-zero number. Blasts if it is all zeros.

minus: other

A sequence with the corresponding numbers subtracted from each other

numberAt: index


numbers


plus: other

A sequence with the corresponding numbers added to each other

printOn: oo



Overrides: Object

rest

The sequence consisting of all numbers in this one after but not including the first zero, or a nil sequence if there are no zeros

secretNumbers

The array itself, for internal use

sendSelfTo: xmtr


shift

The amount by which the numbers are shifted. Positive means less significant, negative means more significant. This is contrary to the usual arithmetic notions, but it is the right thing for arrays.

shift: offset

Shift the numbers by some number of places. Positive shifts make it less significant, negative shifts make it more significant.

with: index with: number

Change a single element of the sequence.

withFirst: number

A Sequence with all my numbers followed by the given one

withLast: number

A Sequence with all my numbers followed by the given one

withRest: other

A sequence containing all the numbers in this one, followed by the other one, separated by a single zero.


Index - All Packages - All Categories - All Classes