|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.jake.MysteryDataStructure<T>
public class MysteryDataStructure<T extends java.lang.Comparable<? super T>>
A mystery data structure that acts as a general-purpose container. The "underlying data structure" may be any one of:
Users cannot instantiate objects of this class directly. Instead, they should call the static method getMysteryDataStructure and specify their username, the index of the desired data structure (typically 0-4 inclusive), as well as a "prototype" object indicating what kind of generic container they wish to instantiate.
| Method Summary | ||
|---|---|---|
void |
add(T data)
Adds the specified object to the container. |
|
void |
clear()
Removes all elements from the collection. |
|
boolean |
contains(T data)
Returns whether the specified object is stored in the collection. |
|
static
|
getMysteryDataStructure(java.lang.String cs12UserID,
int dataStructureNum,
T sample)
Returns a MysteryDataStructure object of the specified index (0-4 for this assignment) for the specified user for the specified type. |
|
void |
remove(T data)
Removes the specified object from the container. |
|
int |
size()
Returns the number of data currently stored in the collection. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T extends java.lang.Comparable<? super T>> Collection12<T> getMysteryDataStructure(java.lang.String cs12UserID,
int dataStructureNum,
T sample)
cs12UserID - the CSE 12 user ID (e.g., cs12vzz) of the student.dataStructureNum - an index specifying which data structure (typically between 0 and 4) the user wishes to instantiate.sample - a "prototype" object specifying the kind of data the mystery data structure should store.public void add(T data)
Collection12
add in interface Collection12<T extends java.lang.Comparable<? super T>>data - the object to add to the collection.public void remove(T data)
Collection12
remove in interface Collection12<T extends java.lang.Comparable<? super T>>data - the object to remove from the collection.public boolean contains(T data)
Collection12
contains in interface Collection12<T extends java.lang.Comparable<? super T>>data - the object whose presence in the collection is being queried.
public void clear()
Collection12
clear in interface Collection12<T extends java.lang.Comparable<? super T>>public int size()
Collection12
size in interface Collection12<T extends java.lang.Comparable<? super T>>
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||