public class ModelHandler
extends java.lang.Object
Constructor and Description |
---|
ModelHandler(Model m) |
Modifier and Type | Method and Description |
---|---|
boolean |
addAssistantSkill(Assistant assistant,
Skill newSkill)
Returns if added
|
void |
addAssistantSkill(Assistant assistant,
java.lang.String newSkillName)
Adds a skill that the Assistant possesses to that Assistant.
|
void |
addAssistantsListener(ModelListener ml)
Put the supplied ModelListener in to the assistantsListener ArrayList
|
boolean |
addAssistantUnavailableTime(Assistant assistant,
TimeBlock time)
Adds a time that an assistant will not be able to work to the supplied assistant.
|
void |
addInstructorsListener(ModelListener ml)
Put the supplied ModelListener in to the instructorsListener ArrayList
|
Position |
addLAPosition(Section s)
Adds a new LA Position to the provided section
|
Assistant |
addNewAssistant()
Adds a new Assistant to the model by utilizing ModelEvent
|
Instructor |
addNewInstructor()
Adds a new Instructor to the model by utilizing ModelEvent
|
Section |
addNewSection()
Adds a new Section to the model
|
void |
addPositionsListener(ModelListener ml)
Put the supplied ModelListener in to the positionsListener ArrayList
|
void |
addSchedulesListener(ModelListener ml)
Put the supplied ModelListener in to the schedulesListener ArrayList
|
boolean |
addSectionSkill(Section section,
Skill newSkill)
Add a skill that is required of an Assistant to the Section
also checks to see if the skill is already present before adding it
|
void |
addSectionSkill(Section section,
java.lang.String newSkillName)
Add a skill that is required of an Assistant to the Section
|
void |
addSectionsListener(ModelListener ml)
Put the supplied ModelListener in to the sectionsListener ArrayList
|
void |
addSectionTime(Section section,
int day,
int start,
int end) |
void |
addSkill(Skill newSkill)
Adds the specified skill to the model.
|
void |
addSkillsListener(ModelListener ml)
Put the supplied ModelListener in to the skillsListener ArrayList
|
Position |
addTAPosition(Section s)
Adds a new TA position to the provided section.
|
void |
addTime(TimeBlock newTime)
Adds the specified time block to the model.
|
void |
addUnavailableTime(Assistant assistant,
TimeBlock time)
Adds a time that an assistant will not be able to work to the supplied assistant.
|
void |
finalizeSchedule(Schedule schedule)
Finalizes a schedule, ensuring that all other schedules are not
finalized.
|
java.util.ArrayList<Position> |
findProblemPositions()
Gets the positions that will potentially cause the Schedule from being completed.
|
java.lang.Object |
getModel()
Returns the model
|
void |
loadModel(Model newModel)
Loads the supplied model
|
Schedule |
pickNewSchedule()
Returns a new schedule by utilizing ModelEvent
|
void |
publishSchedule(Schedule schedule)
Publishes a schedule, ensuring that all other schedules are not
published.
|
void |
removeAllListeners()
Removes ALL of the ModelListeners from all of the ArrayLists
|
void |
removeAssistantSkill(Assistant assistant,
Skill selectedSkill)
Removes a skill from an Assistant
|
void |
removeAssistantUnavailableTime(Assistant assistant,
TimeBlock aTime)
Removes a timeblock that is unavailable from the Assistant
|
void |
removeLAPosition(Position position)
Removes a specific LA position from the model, updating references
|
void |
removeResource(java.lang.Object userObject)
Removes the supplied object from the model using ModelEvent
|
void |
removeSectionSkill(Section section,
Skill selectedSkill)
Removes a skill that is required of an Assistant from the Section.
|
void |
removeSectionTimeDay(Section section,
int day)
Remove any timeblocks with a certain day from a section
|
void |
removeTAPosition(Position position)
Removes a specific TA position from the model, updating references
|
void |
renameResource(java.lang.Object userObject,
java.lang.String name)
Renames the supplied object to the supplied name
|
void |
restoreAssistant(Assistant assistant,
Assistant assistantBackup)
Restores the supplied assistant to the to the matching stored assistant, reverting any changes.
|
void |
restoreInstructor(Instructor instructor,
Instructor instructorBackup)
Restores an Instructor's data to the data stored in the backup.
|
void |
restoreSchedule(Schedule schedule,
Schedule scheduleBackup)
Restores the schedule to the matching stored schedule, reverting any changes.
|
void |
restoreSection(Section section,
Section sectionBackup)
Restores a section from a backup
|
void |
setAssistantActive(Assistant assistant,
boolean selected)
Sets the Assistant to be either active or inactive
marking whether or not they are eligable for scheduling
|
void |
setAssistantLimit(Assistant assistant,
int value)
Sets the threshold of students in a section the Assistant can be assigned to
|
void |
setAssistantName(Assistant assistant,
java.lang.String text)
Changes the name of the Assistant to the one supplied.
|
void |
setAssistantUsername(Assistant assistant,
java.lang.String text)
Sets the Assistant's username to the one upplied.
|
void |
setInstructorName(Instructor instructor,
java.lang.String text)
Changes the name of the Instructor to the one supplied.
|
void |
setInstructorUsername(Instructor instructor,
java.lang.String text) |
void |
setModel(Model newModel)
Sets the current model to the one that was provided.
|
void |
setPositionRestriction(Position position,
Restriction restriction,
java.lang.Object data) |
boolean |
setResponse(Schedule schedule,
Position position,
Response response)
Changes a response to a position in a schedule.
|
void |
setScheduleName(Schedule schedule,
java.lang.String text)
Changes the name of the schedule to the one supplied.
|
void |
setSectionEnrolledMax(Section section,
java.lang.String text)
Set a sections enrolled maximum
|
void |
setSectionId(Section section,
java.lang.String text)
Sets a sections id
|
void |
setSectionInstructor(Section section,
Instructor selectedItem)
Sets a sections instructor
|
void |
setSectionLocation(Section section,
java.lang.String text)
Sets a sections location
|
void |
setSectionTime(Section section,
int start,
int end) |
void |
setSemester(java.lang.String selection)
Sets the semester as the current semester that will be interacted with
|
void |
unfinalizeSchedule(Schedule schedule)
Sets the flag in the system that says whether a Schedule is finalized to false.
|
void |
unpublishIfBad(Schedule schedule)
Unpublishes the schedule if it cannot be published
|
void |
unpublishSchedule(Schedule schedule)
Sets the flag that tells the system that the schedule will be published to false
|
public ModelHandler(Model m)
public Schedule pickNewSchedule()
public Assistant addNewAssistant()
public Section addNewSection()
public Position addTAPosition(Section s)
s
- public Position addLAPosition(Section s)
s
- public Instructor addNewInstructor()
public java.lang.Object getModel()
public void setModel(Model newModel)
newModel
- public void addSkill(Skill newSkill)
newSkill
- public void addTime(TimeBlock newTime)
newTime
- public void removeResource(java.lang.Object userObject)
userObject
- public void renameResource(java.lang.Object userObject, java.lang.String name)
userObject
- name
- public void restoreSchedule(Schedule schedule, Schedule scheduleBackup)
schedule
- scheduleBackup
- public void restoreAssistant(Assistant assistant, Assistant assistantBackup)
assistant
- assistantBackup
- public void addAssistantsListener(ModelListener ml)
ml
- public void addSectionsListener(ModelListener ml)
ml
- public void addPositionsListener(ModelListener ml)
ml
- public void addSchedulesListener(ModelListener ml)
ml
- public void addInstructorsListener(ModelListener ml)
ml
- public void addSkillsListener(ModelListener ml)
ml
- public void removeAllListeners()
public void loadModel(Model newModel)
newModel
- public void setSemester(java.lang.String selection)
selection
- public void publishSchedule(Schedule schedule)
schedule
- public void unpublishSchedule(Schedule schedule)
schedule
- public void finalizeSchedule(Schedule schedule)
schedule
- public void unpublishIfBad(Schedule schedule)
schedule
- public boolean setResponse(Schedule schedule, Position position, Response response)
schedule
- position
- response
- public void unfinalizeSchedule(Schedule schedule)
schedule
- public void addUnavailableTime(Assistant assistant, TimeBlock time)
assistant
- time
- public java.util.ArrayList<Position> findProblemPositions()
public void setScheduleName(Schedule schedule, java.lang.String text)
schedule
- text
- public void setAssistantName(Assistant assistant, java.lang.String text)
assistant
- text
- public void setInstructorName(Instructor instructor, java.lang.String text)
instructor
- text
- public void setAssistantUsername(Assistant assistant, java.lang.String text)
assistant
- text
- public void setAssistantLimit(Assistant assistant, int value)
assistant
- value
- public void setAssistantActive(Assistant assistant, boolean selected)
assistant
- selected
- public void removeAssistantUnavailableTime(Assistant assistant, TimeBlock aTime)
assistant
- aTime
- public boolean addAssistantUnavailableTime(Assistant assistant, TimeBlock time)
assistant
- time
- public void addAssistantSkill(Assistant assistant, java.lang.String newSkillName)
assistant
- newSkillName
- public boolean addAssistantSkill(Assistant assistant, Skill newSkill)
assistant
- newSkill
- public void removeAssistantSkill(Assistant assistant, Skill selectedSkill)
assistant
- selectedSkill
- public void removeSectionSkill(Section section, Skill selectedSkill)
section
- selectedSkill
- public void addSectionSkill(Section section, java.lang.String newSkillName)
section
- newSkillName
- public boolean addSectionSkill(Section section, Skill newSkill)
section
- newSkill
- public void restoreInstructor(Instructor instructor, Instructor instructorBackup)
instructor
- instructorBackup
- public void setInstructorUsername(Instructor instructor, java.lang.String text)
public void restoreSection(Section section, Section sectionBackup)
section
- sectionBackup
- public void removeTAPosition(Position position)
position
- public void removeLAPosition(Position position)
position
- public void setSectionId(Section section, java.lang.String text)
section
- text
- public void setSectionLocation(Section section, java.lang.String text)
section
- text
- public void setSectionInstructor(Section section, Instructor selectedItem)
section
- selectedItem
- public void setSectionEnrolledMax(Section section, java.lang.String text)
section
- text
- public void removeSectionTimeDay(Section section, int day)
section
- day
- public void addSectionTime(Section section, int day, int start, int end)
public void setSectionTime(Section section, int start, int end)
public void setPositionRestriction(Position position, Restriction restriction, java.lang.Object data)