com.gmscheduler.model
Class Schedule

java.lang.Object
  extended by com.gmscheduler.model.Schedule

public class Schedule
extends java.lang.Object

A Schedule objects represents a person and a list of their time frames.

Version:
1.3
Author:
Peter Deschere, Ashton Galya, Rebecca Beale, Jason Fillo
See Also:
Person, Timeframe

Constructor Summary
Schedule()
           
Schedule(Person owner)
           
Schedule(Person owner, java.util.LinkedList<Timeframe> schedule)
           
Schedule(Person owner, Timeframe schedule)
           
Schedule(Schedule u)
           
 
Method Summary
 void add(java.util.LinkedList<Timeframe> u)
          Adds one or more timeframes to the schedule
 void addTimeframe(Timeframe newtime)
          Adds one more timeframe to the schedule
 void difference(Schedule outschedule)
          Takes a schedule and removes the timeframes in the given schedule from this schedule
 java.lang.String getDescription()
          Gets the Description of the schedule
 java.lang.Long getId()
          Gets the database id of the schedule
 Person getPerson()
          Gets the owner of the schedule
 java.util.LinkedList getSchedule()
          Gets the timeframes of the schedule
 boolean isEmpty()
           
 void removeTimeframe(Timeframe t)
          Removes one timeframe from the schedule
 void setDescription(java.lang.String nd)
          Sets the description
 void setPerson(Person person)
          Sets the person
 void setSchedule(java.util.LinkedList<Timeframe> schedule)
          Sets the schedule from a linked list of timeframes
 java.lang.String toString()
           
 java.lang.String toStringMilitary()
           
 java.lang.String toStringSchedule()
          Gets a string of all the schedules delimited by " | "
 java.lang.String toStringScheduleMilitary()
          Gets a string of all the schedules delimited by " | "
 void updateTimeframeid()
          Calls the Timeframe setScheduleId to update the Timeframe's parent id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Schedule

public Schedule()

Schedule

public Schedule(Person owner)

Schedule

public Schedule(Person owner,
                java.util.LinkedList<Timeframe> schedule)

Schedule

public Schedule(Person owner,
                Timeframe schedule)

Schedule

public Schedule(Schedule u)
Method Detail

getDescription

public java.lang.String getDescription()
Gets the Description of the schedule

Returns:
the description of the schedule

setDescription

public void setDescription(java.lang.String nd)
Sets the description

Parameters:
nd - the description of the schedule

getId

public java.lang.Long getId()
Gets the database id of the schedule

Returns:
the id of the schedule in the database

getPerson

public Person getPerson()
Gets the owner of the schedule

Returns:
the Person who own's the schedule

getSchedule

public java.util.LinkedList getSchedule()
Gets the timeframes of the schedule

Returns:
a linked list of the schedule Timeframes

setPerson

public void setPerson(Person person)
Sets the person

Parameters:
owner - the Person who the schedule belongs to

setSchedule

public void setSchedule(java.util.LinkedList<Timeframe> schedule)
Sets the schedule from a linked list of timeframes

Parameters:
schedule - a linked list of Timeframes

toStringMilitary

public java.lang.String toStringMilitary()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringSchedule

public java.lang.String toStringSchedule()
Gets a string of all the schedules delimited by " | "

Returns:
a string concatination of all the schedules

toStringScheduleMilitary

public java.lang.String toStringScheduleMilitary()
Gets a string of all the schedules delimited by " | "

Returns:
a string concatination of all the schedules

updateTimeframeid

public void updateTimeframeid()
Calls the Timeframe setScheduleId to update the Timeframe's parent id. Must be called after the schedule is saved and before the Timeframe is saved.


addTimeframe

public void addTimeframe(Timeframe newtime)
Adds one more timeframe to the schedule

Parameters:
newtime - a new Timeframe to add to the schedule

removeTimeframe

public void removeTimeframe(Timeframe t)
Removes one timeframe from the schedule

Parameters:
t - a Timeframe to remove from the schedule

add

public void add(java.util.LinkedList<Timeframe> u)
Adds one or more timeframes to the schedule

Parameters:
u - a linked list of Timeframes to add to the schedule

difference

public void difference(Schedule outschedule)
Takes a schedule and removes the timeframes in the given schedule from this schedule

Parameters:
outschedule - a Schedule that contains busy times to remove from this schedule

isEmpty

public boolean isEmpty()