Class Schedule

java.lang.Object
  extended by Schedule

public class Schedule
extends java.lang.Object

A Schedule consists of a title and a collection of Event objects.

A Schedule object is mutable. That is, its attributes can be changed.


Constructor Summary
Schedule(java.lang.String title, int maxSize)
          Explicit Value Constructor
 
Method Summary
 void add(Event e)
           Add an Event object to this Schedule (of there is space).
 Event[] getEvents()
          Get all of the Event objects in this Schedule, some of which may be null (i.e., the array is of length maxSize)
 java.lang.String getTitle()
          Get the title of this Schedule
 int size()
          Get the current size of this Schedule (i.e., the number of Event objects that are currently in this Schedule)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Schedule

public Schedule(java.lang.String title,
                int maxSize)
Explicit Value Constructor

Parameters:
title - The title of this Schedule
maxSize - The largest possible number of Event objects
Method Detail

add

public void add(Event e)

Add an Event object to this Schedule (of there is space). If there is no space, this method does nothing.

Note that a Schedule can contain events that overlap. That is, suppose this Schedule has an Event from 9:00-10:00, this method will allow you to add an Event that has an Event from 9:30-10:30. This increases the flexibility of this class. Hence, an application that does not support overlapping events must check before calling the add() method.

Parameters:
e - The Event to add

getEvents

public Event[] getEvents()
Get all of the Event objects in this Schedule, some of which may be null (i.e., the array is of length maxSize)

Returns:
The Event objects

getTitle

public java.lang.String getTitle()
Get the title of this Schedule

Returns:
The title

size

public int size()
Get the current size of this Schedule (i.e., the number of Event objects that are currently in this Schedule)

Returns:
The size


James Madison University, Department of Computer Science