org.abora.white.collection.sets
Class MuSet

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.collection.sets.ScruSet
              |
              +--org.abora.white.collection.sets.MuSet
Direct Known Subclasses:
HashSet

public abstract class MuSet
extends ScruSet

MuSets are a changable collection of elements. Added to the ScruSet protocol are messages for performing these changes. The "introduce/store/wipe/remove" suite is defined by analogy with similar methods in MuTable. See both ScruSet and MuTable.


Constructor Summary
protected MuSet()
           
protected MuSet(Rcvr rcvr)
           
 
Method Summary
 int actualHashForEqual()
          Defined by subclasses to produce the value returned by hashForEqual.
 ImmuSet asImmuSet()
          Return an immu snapshot of my current state.
 MuSet asMuSet()
          Return a Mu whose initial state is the same as my current state, but which will now deviate independently of me.
abstract  ScruSet copy()
          A new one whose initial state is my current state, but that doesn't track changes.
abstract  IntegerValue count()
          How many elements are currently in the set.
static MuSet fromStepper(Stepper stepper)
           
abstract  boolean hasMember(Heaper someone)
          Is someone a member of the set now?
protected abstract  Stepper immuStepper()
           
abstract  void introduce(Heaper anElement)
          Add anElement to my members, but only if it isn't already a member.
abstract  boolean isEmpty()
          Return true if this set does not currently have any elements.
 boolean isEqual(Heaper other)
          Return true if the two objects are equal.
static MuSet make()
           
static MuSet make(Heaper item)
           
static MuSet make(IntegerValue someSize)
          someSize is a non-semantic hint about how big the set might get.
abstract  void remove(Heaper anElement)
          Remove anElement from my members.
 void restrictTo(ScruSet other)
          Sort of intersect.
abstract  Stepper stepper()
          Returns a stepper which will enumerate all the elements of the set in some unspecified order
abstract  void store(Heaper anElement)
          Add anElement to my set of members.
 void storeAll(ScruSet other)
          Sort of union.
abstract  void wipe(Heaper anElement)
          make anElement no longer be one of my members.
 void wipeAll(ScruSet other)
          Sort of minus.
 
Methods inherited from class org.abora.white.collection.sets.ScruSet
asArray, contentsEqual, contentsHash, intersects, isSubsetOf, printOn, printOnWithSimpleSyntax, printOnWithSyntax, theOne
 
Methods inherited from class org.abora.white.xpp.basic.Heaper
destroy, destruct, equals, hashForEqual, printContentsOn, sendSelfTo, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MuSet

protected MuSet()

MuSet

protected MuSet(Rcvr rcvr)
Method Detail

fromStepper

public static MuSet fromStepper(Stepper stepper)

make

public static MuSet make()

make

public static MuSet make(Heaper item)

make

public static MuSet make(IntegerValue someSize)
someSize is a non-semantic hint about how big the set might get.


hasMember

public abstract boolean hasMember(Heaper someone)
Description copied from class: ScruSet
Is someone a member of the set now?

Specified by:
hasMember in class ScruSet

isEmpty

public abstract boolean isEmpty()
Description copied from class: ScruSet
Return true if this set does not currently have any elements.

Specified by:
isEmpty in class ScruSet
Returns:
true if this set does not currently have any elements.

restrictTo

public void restrictTo(ScruSet other)
Sort of intersect. Wipe from myself all elements that I don't have in common with other. Turn myself into the intersection of my current self and other.


storeAll

public void storeAll(ScruSet other)
Sort of union. Store into myself all elements from other. Turn myself into the union of my current self and other.


wipeAll

public void wipeAll(ScruSet other)
Sort of minus. Wipe from myself all elements from other. Turn myself into my current self minus other.


introduce

public abstract void introduce(Heaper anElement)
Add anElement to my members, but only if it isn't already a member. If it is already a member, BLAST


remove

public abstract void remove(Heaper anElement)
Remove anElement from my members. If it isn't currently a member, then BLAST


store

public abstract void store(Heaper anElement)
Add anElement to my set of members. No semantic effect if anElement is already a member.


wipe

public abstract void wipe(Heaper anElement)
make anElement no longer be one of my members. No semantic effect if it already isn't a member.


copy

public abstract ScruSet copy()
Description copied from class: ScruSet
A new one whose initial state is my current state, but that doesn't track changes. Note that there is no implication that these can be 'destroy'ed separately, because (for example) an ImmuSet just returns itself

Specified by:
copy in class ScruSet

asImmuSet

public ImmuSet asImmuSet()
Description copied from class: ScruSet
Return an immu snapshot of my current state. Should probably be done with a Converter rather than with a message (for the reasons listed in the Converter class comment). In terms of the Stamp/Bert analogy mentioned in the class comment, asImmuSet is like asking for the current Stamp.

Specified by:
asImmuSet in class ScruSet

asMuSet

public MuSet asMuSet()
Description copied from class: ScruSet
Return a Mu whose initial state is the same as my current state, but which will now deviate independently of me. In terms of the Stamp/Bert analogy mentioned in the class comment, asMuSet is like asking for a new Bert starting on the current Stamp.

Specified by:
asMuSet in class ScruSet

count

public abstract IntegerValue count()
Description copied from class: ScruSet
How many elements are currently in the set. Being a set, if the same element is put into the set twice, it is only in the set once. 'Same' above is according to 'isEqual'.

Specified by:
count in class ScruSet

stepper

public abstract Stepper stepper()
Description copied from class: ScruSet
Returns a stepper which will enumerate all the elements of the set in some unspecified order

Specified by:
stepper in class ScruSet

immuStepper

protected abstract Stepper immuStepper()

actualHashForEqual

public int actualHashForEqual()
Description copied from class: Heaper
Defined by subclasses to produce the value returned by hashForEqual.

Overrides:
actualHashForEqual in class ScruSet

isEqual

public boolean isEqual(Heaper other)
Description copied from class: Heaper
Return true if the two objects are equal.

Specified by:
isEqual in class ScruSet


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