edu.colorado.collections
Class IntBalancedSet

java.lang.Object
  extended by edu.colorado.collections.IntBalancedSet
All Implemented Interfaces:
java.lang.Cloneable

public class IntBalancedSet
extends java.lang.Object
implements java.lang.Cloneable

This class is a homework assignment; An IntBalancedSet is a set of int numbers, stored in a B-tree.

Outline of Java Source Code for this class:
http://www.cs.colorado.edu/~main/edu/colorado/collections/IntTreeBag.java
Note:
This file contains mostly blank implementations ("stubs") because this is a Programming Project for my students.

See Also:
IntArrayBag, IntLinkedBag, IntTreeBag

Constructor Summary
IntBalancedSet()
          Initialize an empty set.
 
Method Summary
 void add(int element)
          Add a new element to this set.
 java.lang.Object clone()
          Generate a copy of this set.
 boolean contains(int target)
          Accessor method to determine whether a particular element is in this set.
 void print(int indent)
           
 boolean remove(int target)
          Remove a specified element from this set.
 void transferLeft(int i)
           
 void transferRight(int i)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntBalancedSet

public IntBalancedSet()
Initialize an empty set.

Parameters:
- - none
Postcondition:
This set is empty.
Throws:
java.lang.OutOfMemoryError - Indicates insufficient memory for adding a new element.
Method Detail

add

public void add(int element)
Add a new element to this set.

Parameters:
element - the new element that is being added
Postcondition:
If the element was already in this set, then there is no change. Otherwise, the element has been added to this set.
Throws:
java.lang.OutOfMemoryError - Indicates insufficient memory for adding a new element.

clone

public java.lang.Object clone()
Generate a copy of this set.

Overrides:
clone in class java.lang.Object
Parameters:
- - none
Returns:
The return value is a copy of this set. Subsequent changes to the copy will not affect the original, nor vice versa. Note that the return value must be type cast to an IntBalancedSet before it can be used.
Throws:
java.lang.OutOfMemoryError - Indicates insufficient memory for creating the clone.

contains

public boolean contains(int target)
Accessor method to determine whether a particular element is in this set.

Parameters:
target - an element that may or may not be in this set
Returns:
true if this set contains target; otherwise false

remove

public boolean remove(int target)
Remove a specified element from this set.

Parameters:
target - the element to remove from this set
Postcondition:
if target was found in this set, then it has been removed and the method returns true. Otherwise this set remains unchanged and the method returns false.

print

public void print(int indent)

transferLeft

public void transferLeft(int i)

transferRight

public void transferRight(int i)