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.
|
java.util.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 java.util.Iterator<Ball> iterator()
iterator
in interface java.lang.Iterable<Ball>
public boolean add(Ball b)
b
- the Ball to be addedpublic boolean remove(Ball b)
b
- the Ball to be removedpublic double getVolume()
public int size()
public void clear()
public boolean contains(Ball b)
b
- the Ball to be checked for membership in this container