|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Container
A container can hold any collection of Objects.
Method Summary | |
---|---|
void |
add(java.lang.Object obj)
Adds obj at the default location. |
java.lang.Object |
clone()
Return a copy of the container that points to the same objects as in the original container. |
boolean |
contains(java.lang.Object obj)
Determines whether an element is in the container. |
java.util.Enumeration<java.lang.Object> |
elements()
Returns an enumerator over the whole container. |
boolean |
equals(java.lang.Object container)
Check for equality of contents of two containers. |
boolean |
isEmpty()
Check if the container is empty. |
boolean |
isFull()
Check if the container is full. |
java.lang.Object |
remove()
Remove the first element based on a standard enumeration of the container contents. |
void |
removeAll()
Empty the container. |
int |
size()
Returns the number of elements in the container. |
java.lang.String |
toString()
Return a string representation of the contents of the container. |
Method Detail |
---|
boolean contains(java.lang.Object obj)
Requires: True Ensures: contains(obj) => result = true not contains(obj) => result = false
java.util.Enumeration<java.lang.Object> elements()
boolean isEmpty()
Requires: True Ensures: result = (size = 0)
boolean isFull()
Requires: True Ensures: result = (size = capacity)
int size()
Requires: True Ensures: result = size
void add(java.lang.Object obj)
obj
at the default location.
Requires: size < capacity Ensures: contains(obj) = true size = old size + 1
ContainerFullException
- if container already contains capacity
elements for finite size containers.void removeAll()
Requires: True Ensures: size = 0
java.lang.Object remove()
Requires: size > 0 Ensures: size = old size -1
ContainerEmptyException
- if removing from an empty container.java.lang.Object clone()
Requires: True Ensures: result = copy of container
java.lang.String toString()
Requires: True Ensures: result = string representation of contents
toString
in class java.lang.Object
boolean equals(java.lang.Object container)
Requires: True Ensures: result = true => container contents are equal result = false => container contents are not equal
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |