Class ScheduleManager

    • Method Detail

      • numEntries

        public int numEntries()
        Returns:
        Number of schedules
      • getScheduleByName

        public Schedule getScheduleByName​(java.lang.String name)
        Parameters:
        name - The string name for the schedule
        Returns:
        requested Schedule object or null if none exists
      • newSchedule

        public Schedule newSchedule​(java.lang.String name)
        Finds an existing schedule or creates a new schedule if needed requires schedule's name creates a unique id for this schedule
        Parameters:
        name - The string name for this schedule
        Returns:
        new schedule or existing schedule
      • register

        public void register​(Schedule schedule)
        Remember a NamedBean Object created outside the manager.
        Parameters:
        schedule - The Schedule to add.
      • deregister

        public void deregister​(Schedule schedule)
        Forget a NamedBean Object created outside the manager.
        Parameters:
        schedule - The Schedule to delete.
      • getSchedulesByIdList

        public java.util.List<SchedulegetSchedulesByIdList()
        Sort by schedule id number
        Returns:
        list of schedules ordered by id number
      • getComboBox

        public javax.swing.JComboBox<SchedulegetComboBox()
        Gets a JComboBox loaded with schedules.
        Returns:
        JComboBox with a list of schedules.
      • updateComboBox

        public void updateComboBox​(javax.swing.JComboBox<Schedule> box)
        Update a JComboBox with the latest schedules.
        Parameters:
        box - the JComboBox needing an update.
      • replaceType

        public void replaceType​(java.lang.String oldType,
                                java.lang.String newType)
        Replaces car type in all schedules.
        Parameters:
        oldType - car type to be replaced.
        newType - replacement car type.
      • replaceRoad

        public void replaceRoad​(java.lang.String oldRoad,
                                java.lang.String newRoad)
        Replaces car roads in all schedules.
        Parameters:
        oldRoad - car road to be replaced.
        newRoad - replacement car road.
      • replaceLoad

        public void replaceLoad​(java.lang.String type,
                                java.lang.String oldLoad,
                                java.lang.String newLoad)
        Replaces car loads in all schedules with specific car type.
        Parameters:
        type - car type.
        oldLoad - car load to be replaced.
        newLoad - replacement car load.
      • getSpursByScheduleComboBox

        public javax.swing.JComboBox<LocationTrackPairgetSpursByScheduleComboBox​(Schedule schedule)
        Gets a JComboBox with a list of spurs that use this schedule.
        Parameters:
        schedule - The schedule for this JComboBox.
        Returns:
        JComboBox with a list of spurs using schedule.
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent e)
        Check for car type and road name changes.
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • setDirtyAndFirePropertyChange

        protected void setDirtyAndFirePropertyChange​(java.lang.String p,
                                                     java.lang.Object old,
                                                     java.lang.Object n)