Class LocationManager

    • Method Detail

      • getLocationByName

        public Location getLocationByName​(java.lang.String name)
        Parameters:
        name - The string name of the Location to get.
        Returns:
        requested Location object or null if none exists
      • hasDivisions

        public boolean hasDivisions()
        Used to determine if a division name has been assigned to a location
        Returns:
        true if a location has a division name
      • hasWork

        public boolean hasWork()
      • hasReporters

        public boolean hasReporters()
        Used to determine if a reporter has been assigned to a location
        Returns:
        true if a location has a RFID reporter
      • getLocationByReporter

        public Location getLocationByReporter​(Reporter r)
        Request a location associated with a given reporter.
        Parameters:
        r - Reporter object associated with desired location.
        Returns:
        requested Location object or null if none exists
      • getTrackByReporter

        public Track getTrackByReporter​(Reporter r)
        Request a track associated with a given reporter.
        Parameters:
        r - Reporter object associated with desired location.
        Returns:
        requested Location object or null if none exists
      • newLocation

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

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

        public void deregister​(Location location)
        Forget a NamedBean Object created outside the manager.
        Parameters:
        location - The Location to delete.
      • getUniqueLocationsByNameList

        public java.util.List<LocationgetUniqueLocationsByNameList()
        Get unique locations list by location name.
        Returns:
        list of locations ordered by name. Locations with "similar" names to the primary location are not returned. Also checks and updates the primary location for any changes to the other "similar" locations.
      • getLocationsByIdList

        public java.util.List<LocationgetLocationsByIdList()
        Sort by location number, number can alpha numeric
        Returns:
        list of locations ordered by id numbers
      • getList

        public java.util.List<LocationgetList()
        Gets an unsorted list of all locations.
        Returns:
        All locations.
      • getTracks

        public java.util.List<TrackgetTracks​(java.lang.String type)
        Returns all tracks of type
        Parameters:
        type - Spur (Track.SPUR), Yard (Track.YARD), Interchange (Track.INTERCHANGE), Staging (Track.STAGING), or null (returns all track types)
        Returns:
        List of tracks
      • getTracksByMoves

        public java.util.List<TrackgetTracksByMoves​(java.lang.String type)
        Returns all tracks of type sorted by use. Alternate tracks are not included.
        Parameters:
        type - Spur (Track.SPUR), Yard (Track.YARD), Interchange (Track.INTERCHANGE), Staging (Track.STAGING), or null (returns all track types)
        Returns:
        List of tracks ordered by use
      • resetMoves

        public void resetMoves()
        Sets move count to 0 for all tracks
      • getComboBox

        public javax.swing.JComboBox<LocationgetComboBox()
        Returns a JComboBox with locations sorted alphabetically.
        Returns:
        locations for this railroad
      • updateComboBox

        public void updateComboBox​(javax.swing.JComboBox<Location> box)
        Updates JComboBox alphabetically with a list of locations.
        Parameters:
        box - The JComboBox to update.
      • replaceLoad

        public void replaceLoad​(java.lang.String type,
                                java.lang.String oldLoadName,
                                java.lang.String newLoadName)
        Replace all track car load names for a given type of car
        Parameters:
        type - type of car
        oldLoadName - load name to replace
        newLoadName - new load name
      • load

        public void load​(org.jdom2.Element root)
        Load the locations from a xml file.
        Parameters:
        root - xml file
      • store

        public void store​(org.jdom2.Element root)
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent e)
        There aren't any current property changes being monitored.
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • setDirtyAndFirePropertyChange

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