Constructor and Description |
---|
BallContainer()
Constructor that creates a new ballcontainer.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public BallContainer()
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