|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--org.abora.gold.java.AboraHeaper
|
+--org.abora.gold.xpp.basic.Heaper
|
+--org.abora.gold.collection.tables.Pair
Sometimes you just want to pass around two things where the language only makes it
convenient to pass around one. I know that the proper object-oriented (or even
"structured") thing to do would be to create a type specific to the particular kind of
pair which is being used for a particular purpose. However, sometimes it just seems like
too much trouble. By using Pairs, we import the sins of Lisp. At least we don''t have
RPLACA and RPLACD. Unlike Lisp''s cons cell''s "car" and "cdr", we call our two parts the
"left" part and the "right" part. "pair(a,b)->left()" yields a and "pair(a,b)->right()"
yields b.
Give us feedback: Should Pairs be removed? Do you know of any justification for them
other than a bad simulation of "multiple-return-values" (as in Common Lisp, Forth,
Postscript)?
The Pair code is currently in a state of transition. Old code (which we have yet to fix)
uses Pairs with NULLs in their parts. Pairs will be changed to outlaw this usage.
"fetchLeft" and "fetchRight" exist to support this obsolete usage, but will be retired.
Don''t use them.
| Field Summary | |
protected Heaper |
leftPart
|
protected Heaper |
rightPart
|
| Fields inherited from class org.abora.gold.xpp.basic.Heaper |
AllBlasts, BecomeMap, GarbageCount, InGC, InitializedClasses, InitializingClasses, LastMemory, NextClientRequestNumber, NotOneElementSignal, PackageTable, PromiseNameTable, StringHashSBoxes |
| Fields inherited from class org.abora.gold.java.AboraHeaper |
ActiveClubs, CurrentAuthor, CurrentBertCanopyCache, CurrentBertCrum, CurrentChunk, CurrentGrandMap, CurrentKeyMaster, CurrentPacker, CurrentSensorCanopyCache, CurrentServer, CurrentSession, CurrentSessions, CurrentTrace, InitialEditClub, InitialOwner, InitialReadClub, InitialSponsor, InsideTransactionFlag |
| Constructor Summary | |
Pair(Heaper a)
create a new pair |
|
Pair(Heaper a,
Heaper b)
create a new pair |
|
Pair(Rcvr receiver)
|
|
| Method Summary | |
int |
actualHashForEqual()
|
Heaper |
fetchLeft()
Returns the left part which obsoletely may be NULL |
Heaper |
fetchRight()
Returns the right part which obsoletely may be NULL |
static void |
inspectPieces()
Return pieces to be used in a tree browser. |
boolean |
isEqual(Heaper other)
Return true if the two objects are equal. |
Heaper |
left()
Returns the left part. |
static Heaper |
make(Heaper left,
Heaper right)
Create a new pair. |
static Pair |
pairWithNulls(Heaper left,
Heaper right)
Create a new pair. |
void |
printOn(java.io.PrintWriter oo)
|
Pair |
reversed()
Returns a new pair which is the left-right reversal of me. pair(a,b)->reversed() is the same as pair(b,a). Only works on non-obsolete Pairs--those whose parts are non-NULL |
Heaper |
right()
Returns the right part. |
void |
sendSelfTo(Xmtr xmtr)
do nothing |
| Methods inherited from class org.abora.gold.java.AboraHeaper |
asOop, basicInspect, displayString, error, hack, halt, inspect, knownBug, mightNotImplement, REQUIRES, shouldImplement, shouldNotImplement, stubbleForSubclassResponsibility, thingToDo, willNotImplement |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Heaper leftPart
protected Heaper rightPart
| Constructor Detail |
public Pair(Heaper a,
Heaper b)
public Pair(Heaper a)
public Pair(Rcvr receiver)
| Method Detail |
public int actualHashForEqual()
actualHashForEqual in class Heaperpublic boolean isEqual(Heaper other)
Heaper
isEqual in class Heaperpublic Heaper left()
public Pair reversed()
public Heaper right()
public static void inspectPieces()
public void printOn(java.io.PrintWriter oo)
printOn in class Heaperpublic Heaper fetchLeft()
public Heaper fetchRight()
public void sendSelfTo(Xmtr xmtr)
Heaper
sendSelfTo in class Heaper
public static Heaper make(Heaper left,
Heaper right)
public static Pair pairWithNulls(Heaper left,
Heaper right)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||