public class BSTOrderedSet<E extends java.lang.Comparable<E>> extends java.lang.Object implements OrderedSet<E>
Constructor and Description |
---|
BSTOrderedSet()
Constructs an empty BSTOrderedSet
Preconditions: None Postcondition: An empty BSTOrdered (satisfying the above BSTOrderedSet Invariant) has been created. |
Modifier and Type | Method and Description |
---|---|
void |
add(E e,
cpsc331.collections.BSTOrderedSet.BSTNode x) |
boolean |
contains(E e)
Reports whether a given element belongs to this set.
|
void |
include(E e)
Adds an input element to this set, throwing an
ElementFoundException if this element already belongs
to it.
|
void |
remove(E e)
Removes an input element to this set, throwing a
NoSuchElementException if this element does not belong to it.
|
public BSTOrderedSet()
public boolean contains(E e)
Set
contains
in interface Set<E extends java.lang.Comparable<E>>
e
- the element to be searched forpublic void include(E e) throws ElementFoundException
Set
include
in interface Set<E extends java.lang.Comparable<E>>
e
- the element to be added to this setElementFoundException
- if this element is already in the set
public void add(E e, cpsc331.collections.BSTOrderedSet.BSTNode x) throws ElementFoundException
ElementFoundException
public void remove(E e) throws java.util.NoSuchElementException
Set
remove
in interface Set<E extends java.lang.Comparable<E>>
e
- the element to be removed from this setjava.util.NoSuchElementException
- if this element was not in this set