public class Symphony
extends java.lang.Object
Constructor and Description |
---|
Symphony()
This constructs a new empty Symphony.
|
Symphony(Symphony symphony)
This copy constructor creates a new Symphony
which is initialised with copies of the musicians
in the provided parameter symphony (this is
a "Deep" copy).
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Musician musician)
This function adds a musician to the symphony;
duplicates are not allowed.
|
Musician |
find(java.lang.String name)
This function finds a musician in the symphony.
|
java.util.Iterator<Musician> |
getIterator()
This function returns an iterator that one can use
to access the musician objects in this symphony.
|
static void |
main(java.lang.String[] args)
Some code to test our class.
|
boolean |
remove(java.lang.String name)
This function removes a musician from the symphony.
|
int |
size()
This function returns the number of musicians
currently in this symphony.
|
public Symphony()
public Symphony(Symphony symphony)
symphony
- a symphony to make a copy of.public boolean add(Musician musician)
musician
- A musician to add to the symphony.public Musician find(java.lang.String name)
name
- The name of the musician to search for in
the symphony.public boolean remove(java.lang.String name)
public int size()
public java.util.Iterator<Musician> getIterator()
public static void main(java.lang.String[] args)