rsvp.model
Class EventDB

java.lang.Object
  extended by rsvp.model.EventDB
All Implemented Interfaces:
java.io.Serializable, EventDBInterface

public class EventDB
extends java.lang.Object
implements java.io.Serializable, EventDBInterface

An EventDB models a collection of events. Events are identified by an integer event ID.

Author:
willb
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface rsvp.model.EventDBInterface
serialVersionUID
 
Constructor Summary
EventDB()
          Creates a new, empty EventDB.
 
Method Summary
 int addEmptyEvent()
          Creates a new, empty Event, adds it to this database, and returns its event ID.
 EventInterface getEvent(int id)
          Returns the event with a given ID.
 int getEventCount()
          Returns the event count for this database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventDB

public EventDB()
Creates a new, empty EventDB.

Method Detail

addEmptyEvent

public int addEmptyEvent()
Description copied from interface: EventDBInterface
Creates a new, empty Event, adds it to this database, and returns its event ID.

Specified by:
addEmptyEvent in interface EventDBInterface
Returns:
the event ID of the newly-added Event.

getEvent

public EventInterface getEvent(int id)
Description copied from interface: EventDBInterface
Returns the event with a given ID. Throws a BogusParameterException if id is an invalid event ID for this database.

Precondition: 0 <= id < this.getEventCount()

Specified by:
getEvent in interface EventDBInterface
Parameters:
id - an integer between 0 (inclusive) and this.getEventCount() (exclusive)
Returns:

getEventCount

public int getEventCount()
Description copied from interface: EventDBInterface
Returns the event count for this database. If this value is greater than one, then the maximum valid event ID is one less than it. (If this value is zero, there are no valid event IDs.)

Specified by:
getEventCount in interface EventDBInterface
Returns:
the event count.