All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class set.Set

java.lang.Object
   |
   +----set.Set

public class Set
extends Object
implements Element
The class Set implements set operations on linearly ordered elements. This implementation of sets assumes elements are immutable. Note that a set may be an element of a set or a component of an element of a set.

The elements of a set are stored in a sorted list. An alternative might use hash tables instead of lists, but hash tables were thought to use too much space.

Declaring this class final seems to expose a compiler error when using the -O switch. Code running as an applet in the appletviewer produce

    java.lang.IllegalAccessError: set.Set.t

See Also:
Element

Constructor Index

 o Set()

Method Index

 o adjoin(Element)
Adjoin an element to a set.
 o but_first()
The set minus its first element.
 o card()
Set Cardinality.
 o empty()
Is this the empty set?
 o first()
Pick an element from the set.
 o intersect(Set)
Set intersection.
 o less(Element)
Is this element less than some other element?
 o member(Element)
Is an element a member of this set?
 o proper_subset(Set)
Is this set a proper subset of another set?
 o remove(Element)
Remove an element from a set.
 o same(Element)
Is this element equal to some other element?
 o set_difference(Set)
Set difference.
 o union(Set)
Set union.

Constructors

 o Set
 public Set()

Methods

 o empty
 public boolean empty()
Is this the empty set?

Returns:
true if this is the empty set
 o adjoin
 public Set adjoin(Element e)
Adjoin an element to a set.

Parameters:
e - the element to add
Returns:
the new set
 o remove
 public Set remove(Element e)
Remove an element from a set.

Parameters:
e - the element to remove
Returns:
the new set
 o member
 public boolean member(Element e)
Is an element a member of this set?

Parameters:
e - the element
Returns:
true if element is in the set
 o proper_subset
 public boolean proper_subset(Set s)
Is this set a proper subset of another set?

Parameters:
s - the other set
Returns:
true if this set is a proper subset of the other
 o union
 public Set union(Set s)
Set union.

Parameters:
s - the other set
Returns:
the union of this set and the other
 o intersect
 public Set intersect(Set s)
Set intersection.

Parameters:
s - the other set
Returns:
the intersection of this set and the other
 o set_difference
 public Set set_difference(Set s)
Set difference.

Parameters:
s - the other set
Returns:
the set difference of this set and the other
 o first
 public Element first()
Pick an element from the set.

Returns:
some element
 o but_first
 public Set but_first()
The set minus its first element.

Returns:
the set with the first element removed
 o card
 public int card()
Set Cardinality.

Returns:
the number of elments that are in the set
 o same
 public boolean same(Element e)
Is this element equal to some other element?

See Also:
same
 o less
 public boolean less(Element e)
Is this element less than some other element?

See Also:
less

All Packages  Class Hierarchy  This Package  Previous  Next  Index