rsvp.model
Class Event

java.lang.Object
  extended by rsvp.model.Event
All Implemented Interfaces:
java.io.Serializable, EventInterface

public class Event
extends java.lang.Object
implements java.io.Serializable, EventInterface

An Event models a social gathering. An event has a name, an organizer (i.e. host or hostess), a date, a location, and a collection of responses. An event also has a passcode, which the organizer will use to identify herself if she wishes to change the event at some point in the future.

Author:
willb
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface rsvp.model.EventInterface
serialVersionUID
 
Constructor Summary
Event()
          Constructs a new event with an empty collection of responses and an empty passcode.
 
Method Summary
 void addResponse(Response response)
          Adds a response from a potential guest at this event.
 void delete()
          Deletes this event.
 SimpleDate getDate()
          Returns the date of this Event.
 java.lang.String getLocation()
          Returns the location of this Event.
 java.lang.String getName()
          Gets the name of this Event.
 EmailAddressInterface getOrganizer()
          Gets an EmailAddress object corresponding to the organizer/host of this event.
 java.lang.String getPasscode()
          Returns the organizer's passcode, which should be supplied by a View that wishes to change this event.
 ResponseInterface getResponse(int n)
          Returns the nth response provided for this Event.
 int getResponseCount()
          Returns the number of Responses guests have provided for this event.
 boolean isDeleted()
          Returns true if this event has been deleted.
 void setDate(SimpleDate date)
          Sets the date of this Event.
 void setLocation(java.lang.String location)
          Sets the location of this Event.
 void setName(java.lang.String name)
          Sets the name for this Event.
 void setOrganizer(EmailAddressInterface organizer)
          Sets the EmailAddress of the organizer for this event.
 void setPasscode(java.lang.String passcode)
          Changes the organizer's passcode for this Event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Event

public Event()
Constructs a new event with an empty collection of responses and an empty passcode.

Method Detail

getDate

public SimpleDate getDate()
Description copied from interface: EventInterface
Returns the date of this Event.

Specified by:
getDate in interface EventInterface
Returns:
the date of this Event.

setDate

public void setDate(SimpleDate date)
Description copied from interface: EventInterface
Sets the date of this Event.

Specified by:
setDate in interface EventInterface
Parameters:
date - the new Date for this Event.

getLocation

public java.lang.String getLocation()
Description copied from interface: EventInterface
Returns the location of this Event.

Specified by:
getLocation in interface EventInterface
Returns:
the location of this Event.

setLocation

public void setLocation(java.lang.String location)
Description copied from interface: EventInterface
Sets the location of this Event.

Specified by:
setLocation in interface EventInterface
Parameters:
location - a String representing the new location

getName

public java.lang.String getName()
Description copied from interface: EventInterface
Gets the name of this Event.

Specified by:
getName in interface EventInterface
Returns:
a String describing this Event.

setName

public void setName(java.lang.String name)
Description copied from interface: EventInterface
Sets the name for this Event.

Specified by:
setName in interface EventInterface
Parameters:
name - a String describing this Event.

getOrganizer

public EmailAddressInterface getOrganizer()
Description copied from interface: EventInterface
Gets an EmailAddress object corresponding to the organizer/host of this event.

Specified by:
getOrganizer in interface EventInterface
Returns:
the EmailAddress of the host

setOrganizer

public void setOrganizer(EmailAddressInterface organizer)
Description copied from interface: EventInterface
Sets the EmailAddress of the organizer for this event.

Specified by:
setOrganizer in interface EventInterface
Parameters:
organizer - the EmailAddress of the organizer

getPasscode

public java.lang.String getPasscode()
Description copied from interface: EventInterface
Returns the organizer's passcode, which should be supplied by a View that wishes to change this event.

Specified by:
getPasscode in interface EventInterface
Returns:
the passcode needed to change this Event.

setPasscode

public void setPasscode(java.lang.String passcode)
Description copied from interface: EventInterface
Changes the organizer's passcode for this Event.

Specified by:
setPasscode in interface EventInterface

addResponse

public void addResponse(Response response)
Description copied from interface: EventInterface
Adds a response from a potential guest at this event.

Specified by:
addResponse in interface EventInterface
Parameters:
response - a Response from a guest.

getResponseCount

public int getResponseCount()
Description copied from interface: EventInterface
Returns the number of Responses guests have provided for this event.

Specified by:
getResponseCount in interface EventInterface
Returns:
the number of responses for this event.

getResponse

public ResponseInterface getResponse(int n)
Description copied from interface: EventInterface

Returns the nth response provided for this Event. Throws a BogusParameterException if n is an invalid response index.

Precondition: 0 <= n < this.getReponseCount()

Specified by:
getResponse in interface EventInterface
Parameters:
n - an integer between 0 (inclusive) and this.getResponseCount() (exclusive)
Returns:
the nth response provided for this Event.

isDeleted

public boolean isDeleted()
Description copied from interface: EventInterface
Returns true if this event has been deleted. A deleted event should be ignored by the interface.

Specified by:
isDeleted in interface EventInterface
Returns:
true if this event has been deleted, and false otherwise.

delete

public void delete()
Description copied from interface: EventInterface
Deletes this event. The only effect this has is to change the value that this object's isDeleted() method will return.

Specified by:
delete in interface EventInterface