|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.colorado.collections.IntTreeBag
public class IntTreeBag
This class is a homework assignment;
An IntTreeBag is a collection of int numbers.
Integer.MAX_VALUE elements, countOccurrences,
and size are wrong.
IntArrayBag,
IntLinkedBag| Constructor Summary | |
|---|---|
IntTreeBag()
|
|
| Method Summary | |
|---|---|
void |
add(int element)
Insert a new element into this bag. |
void |
addAll(IntTreeBag addend)
Add the contents of another bag to this bag. |
java.lang.Object |
clone()
Generate a copy of this bag. |
int |
countOccurrences(int target)
Accessor method to count the number of occurrences of a particular element in this bag. |
int |
size()
Determine the number of elements in this bag. |
static IntTreeBag |
union(IntTreeBag b1,
IntTreeBag b2)
Create a new bag that contains all the elements from two other bags. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IntTreeBag()
| Method Detail |
|---|
public void add(int element)
element - the new element that is being inserted
java.lang.OutOfMemoryError - Indicates insufficient memory a new IntBTNode.public void addAll(IntTreeBag addend)
addend - a bag whose contents will be added to this bag
addend, is not null.
addend have been added to this bag.
java.lang.IllegalArgumentException - Indicates that addend is null.
java.lang.OutOfMemoryError - Indicates insufficient memory to increase the size of the bag.public java.lang.Object clone()
clone in class java.lang.Object- - none
IntTreeBag before it can be used.
java.lang.OutOfMemoryError - Indicates insufficient memory for creating the clone.public int countOccurrences(int target)
target - the element that needs to be counted
target occurs in this bagpublic int size()
- - none
public static IntTreeBag union(IntTreeBag b1,
IntTreeBag b2)
b1 - the first of two bagsb2 - the second of two bags
java.lang.IllegalArgumentException - Indicates that one of the arguments is null.
java.lang.OutOfMemoryError - Indicates insufficient memory for the new bag.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||