|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--org.abora.white.xpp.basic.Heaper
|
+--org.abora.white.spaces.basic.Position
|
+--org.abora.white.tumbler.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.
| Field Summary | |
protected PrimIntegerArray |
myNumbers
|
protected IntegerValue |
myShift
|
protected static Sequence |
TheZero
|
| Constructor Summary | |
Sequence(IntegerValue shift,
PrimIntegerArray numbers)
|
|
Sequence(Rcvr receiver)
|
|
| Method Summary | |
int |
actualHashForEqual()
since we redefine equal, subclasses had better redefine actualHashForEqual |
XnRegion |
asRegion()
Essential. |
int |
comparePrefix(Sequence other,
IntegerValue n)
Compare my numbers up to and including index n with the corresponding numbers in the other Sequence. |
CoordinateSpace |
coordinateSpace()
Essential. |
IntegerValue |
count()
How many numbers in the sequence, not counting leading or trailing zeros |
Sequence |
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 |
IntegerValue |
firstIndex()
The smallest index with a non-zero number. |
IntegerValue |
integerAt(IntegerValue index)
The number at the given index in the Sequence. |
PrimIntegerArray |
integers()
Essential. |
boolean |
isEqual(Heaper other)
Return true if the two objects are equal. |
boolean |
isGE(Position other)
Whether this sequence is greater than or equal to the other sequence, using a lexical comparison of their corresponding numbers. |
boolean |
isZero()
Whether all the numbers in the sequence are zero |
IntegerValue |
lastIndex()
The largest index with a non-zero number. |
Sequence |
minus(Sequence other)
A sequence with the corresponding numbers subtracted from each other |
static Sequence |
numbers(PrimIntegerArray digits)
|
static Sequence |
one(IntegerValue a)
A single element Sequence |
Sequence |
plus(Sequence other)
A sequence with the corresponding numbers added to each other |
static void |
printArrayOn(java.io.PrintWriter oo,
PrimIntegerArray numbers)
Print a sequence of numbers separated by dots. |
void |
printOn(java.io.PrintWriter oo)
This should rarely be overridden. |
static void |
printOn(java.io.PrintWriter oo,
IntegerValue shift,
PrimIntegerArray numbers)
Print a sequence of numbers separated by dots. |
static void |
printZerosOn(java.io.PrintWriter oo,
IntegerValue shift)
Print a sequence of zeros separated by dots. |
Sequence |
rest()
The sequence consisting of all numbers in this one after but not including the first zero, or a null sequence if there are no zeros |
PrimIntegerArray |
secretNumbers()
The array itself, for internal use |
void |
sendSelfTo(Xmtr xmtr)
|
IntegerValue |
shift()
The amount by which the numbers are shifted. |
Sequence |
shift(IntegerValue offset)
Shift the numbers by some number of places. |
static Sequence |
string(java.lang.String string)
|
static Sequence |
three(IntegerValue a,
IntegerValue b,
IntegerValue c)
A three element Sequence |
static Sequence |
two(IntegerValue a,
IntegerValue b)
A two element Sequence |
static Sequence |
usingx(IntegerValue shift,
PrimIntegerArray numbers)
Don't need to make a copy of the array |
Sequence |
with(IntegerValue index,
IntegerValue number)
Change a single element of the sequence. |
Sequence |
withFirst(IntegerValue number)
A Sequence with all my numbers followed by the given one |
Sequence |
withLast(IntegerValue number)
A Sequence with all my numbers followed by the given one |
Sequence |
withRest(Sequence other)
A sequence containing all the numbers in this one, followed by the other one, separated by a single zero. |
static Sequence |
zero()
|
| Methods inherited from class org.abora.white.spaces.basic.Position |
info |
| Methods inherited from class org.abora.white.xpp.basic.Heaper |
destroy, destruct, equals, hashForEqual, printContentsOn, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected IntegerValue myShift
protected PrimIntegerArray myNumbers
protected static Sequence TheZero
| Constructor Detail |
public Sequence(IntegerValue shift,
PrimIntegerArray numbers)
public Sequence(Rcvr receiver)
| Method Detail |
public XnRegion asRegion()
Position
asRegion in class Positionpublic CoordinateSpace coordinateSpace()
Position
coordinateSpace in class Positionpublic IntegerValue count()
public IntegerValue firstIndex()
public IntegerValue integerAt(IntegerValue index)
public PrimIntegerArray integers()
public boolean isZero()
public IntegerValue lastIndex()
public IntegerValue shift()
public int comparePrefix(Sequence other,
IntegerValue n)
public int actualHashForEqual()
Position
actualHashForEqual in class Positionpublic boolean isEqual(Heaper other)
Heaper
isEqual in class Positionpublic boolean isGE(Position other)
public PrimIntegerArray secretNumbers()
public void printOn(java.io.PrintWriter oo)
Heaper
printOn in class Heaperpublic Sequence first()
public Sequence minus(Sequence other)
public Sequence plus(Sequence other)
public Sequence rest()
public Sequence shift(IntegerValue offset)
public Sequence with(IntegerValue index,
IntegerValue number)
public Sequence withFirst(IntegerValue number)
public Sequence withLast(IntegerValue number)
public Sequence withRest(Sequence other)
public void sendSelfTo(Xmtr xmtr)
sendSelfTo in class Heaperpublic static Sequence numbers(PrimIntegerArray digits)
public static Sequence one(IntegerValue a)
public static Sequence string(java.lang.String string)
public static Sequence three(IntegerValue a,
IntegerValue b,
IntegerValue c)
public static Sequence two(IntegerValue a,
IntegerValue b)
public static Sequence zero()
public static void printArrayOn(java.io.PrintWriter oo,
PrimIntegerArray numbers)
public static void printOn(java.io.PrintWriter oo,
IntegerValue shift,
PrimIntegerArray numbers)
public static void printZerosOn(java.io.PrintWriter oo,
IntegerValue shift)
public static Sequence usingx(IntegerValue shift,
PrimIntegerArray numbers)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||