|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hw2.BallContainer
public class BallContainer
This is a container can be used to contain Balls. A given Ball may only appear in a BallContainer once.
Constructor Summary | |
---|---|
BallContainer()
Constructor that creates a new ballcontainer. |
Method Summary | |
---|---|
boolean |
add(Ball b)
Adds a ball to the container. |
void |
clear()
Empties the container, i.e. |
boolean |
contains(Ball b)
This method returns true if this container contains the specified Ball. |
double |
getVolume()
Each Ball has a volume. |
Iterator<Ball> |
iterator()
Implements the Iterable interface for this container. |
boolean |
remove(Ball b)
Removes a ball from the container. |
int |
size()
Returns the number of Balls in this container. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BallContainer()
Method Detail |
---|
public Iterator<Ball> iterator()
iterator
in interface Iterable<Ball>
public boolean add(Ball b)
b
- Ball to be added.
public boolean remove(Ball b)
b
- Ball to be removed.
public double getVolume()
public int size()
public void clear()
public boolean contains(Ball b)
b
- Ball to be checked if its in container
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |