org.abora.white.collection.sets
Class SetAccumulator

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.collection.steppers.Accumulator
              |
              +--org.abora.white.collection.sets.SetAccumulator

public class SetAccumulator
extends Accumulator

A SetAccumulator accumulates a bunch of objects and then makes an ImmuSet containing all the accumulated objects. Several people have observed that a SetAccumulator doesn't buy you much because instead you could just store into a MuSet. While this is true (and is in fact how SetAccumulator is trivially implemented), my feeling is that if what a loop is doing is enumerating a bunch of elements from which a Set is to be formed, using a SetAccumulator in the loops says this more clearly to readers of the code.


Field Summary
protected  MuSet muSet
           
 
Constructor Summary
protected SetAccumulator()
           
protected SetAccumulator(Rcvr receiver)
           
protected SetAccumulator(ScruSet initialSet)
           
 
Method Summary
 Accumulator copy()
          Return a new Accumulator just like the current one, except that from now on they accumulate separately
static SetAccumulator make()
          Make a SetAccumulator which starts out with no elements accumulated
static SetAccumulator make(ScruSet initialSet)
          Make a new SetAccumulator in which all the current elements of initialSet are already accumulated.
 void sendSelfTo(Xmtr xmtr)
           
 void step(Heaper someObj)
          Accumulate a new object into the Accumulator
 Heaper value()
          Return the object that results from accumulating all those objects
 
Methods inherited from class org.abora.white.collection.steppers.Accumulator
actualHashForEqual, isEqual, ptrArray
 
Methods inherited from class org.abora.white.xpp.basic.Heaper
destroy, destruct, equals, hashForEqual, printContentsOn, printOn, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

muSet

protected MuSet muSet
Constructor Detail

SetAccumulator

protected SetAccumulator()

SetAccumulator

protected SetAccumulator(ScruSet initialSet)

SetAccumulator

protected SetAccumulator(Rcvr receiver)
Method Detail

make

public static SetAccumulator make()
Make a SetAccumulator which starts out with no elements accumulated


make

public static SetAccumulator make(ScruSet initialSet)
Make a new SetAccumulator in which all the current elements of initialSet are already accumulated. Future changes to initialSet have no effect on the accumulator.


step

public void step(Heaper someObj)
Description copied from class: Accumulator
Accumulate a new object into the Accumulator

Specified by:
step in class Accumulator

value

public Heaper value()
Description copied from class: Accumulator
Return the object that results from accumulating all those objects

Specified by:
value in class Accumulator

copy

public Accumulator copy()
Description copied from class: Accumulator
Return a new Accumulator just like the current one, except that from now on they accumulate separately

Specified by:
copy in class Accumulator

sendSelfTo

public void sendSelfTo(Xmtr xmtr)
Overrides:
sendSelfTo in class Heaper


Copyright © 2003 David G Jones. All Rights Reserved.
Original Udanax-Gold - Copyright © 1979-1999 Udanax.com. All rights reserved.