Class Course
java.lang.Object
|
+--Course
- public class Course
- extends java.lang.Object
Hold unique ID and set of prerequisites for each course.
|
Constructor Summary |
Course(java.lang.String id)
Create a course object with a unique ID |
|
Method Summary |
void |
addPrerequisite(java.lang.String id)
Add a prerequisite to the prerequiste set for this course |
java.lang.String |
getID()
|
int |
getNumPreReqs()
|
static void |
main(java.lang.String[] args)
Test driver |
java.util.Iterator |
prereqIter()
|
java.lang.String |
toString()
Convert the course to a String |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Course
public Course(java.lang.String id)
- Create a course object with a unique ID
addPrerequisite
public void addPrerequisite(java.lang.String id)
- Add a prerequisite to the prerequiste set for this course
getNumPreReqs
public int getNumPreReqs()
- Returns:
- the number of prerequisites for the course
prereqIter
public java.util.Iterator prereqIter()
- Returns:
- an iterator for the set of prerequisites
getID
public java.lang.String getID()
- Returns:
- the unique ID for this course
toString
public java.lang.String toString()
- Convert the course to a String
- Overrides:
- toString in class java.lang.Object
main
public static void main(java.lang.String[] args)
- Test driver