| Constructor and Description | 
|---|
| Box(double maxVolume)Constructor that creates a new box. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | add(Ball b)This method is used to add Ball objects to this box of
 finite volume. | 
| void | clear()Empties the box, i.e. | 
| boolean | contains(Ball b)This method returns true if this box contains
 the specified Ball. | 
| Iterator<Ball> | getBallsFromSmallest()This method returns an iterator that returns all the balls in
 this box in ascending size, i.e., return the smallest Ball
 first, followed by Balls of increasing size. | 
| double | getVolume()Each Ball has a volume. | 
| Iterator<Ball> | iterator()Implements the Iterable interface for this box. | 
| boolean | remove(Ball b)Removes a ball from the box. | 
| int | size()Returns the number of Balls in this box. | 
public Box(double maxVolume)
maxVolume - Total volume of balls that this box can contain.public boolean add(Ball b)
b - Ball to be added.public Iterator<Ball> getBallsFromSmallest()
public boolean remove(Ball b)
b - Ball to be removed.public double getVolume()
public int size()
public void clear()