Class Location

    • Constructor Detail

      • Location

        public Location​(java.lang.String id,
                        java.lang.String name)
      • Location

        public Location​(org.jdom2.Element e)
        Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-locations.dtd
        Parameters:
        e - Consist XML element
    • Method Detail

      • getId

        public java.lang.String getId()
        Description copied from interface: Identifiable
        Get the identity of the object.
        Specified by:
        getId in interface Identifiable
        Returns:
        the identity
      • setName

        public void setName​(java.lang.String name)
        Sets the location's name.
        Parameters:
        name - The string name for this location.
      • toString

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

        public java.lang.String getName()
      • copyLocation

        public void copyLocation​(Location newLocation)
        Makes a copy of this location.
        Parameters:
        newLocation - the location to copy to
      • copyTracksLocation

        public void copyTracksLocation​(Location location)
        Copies all of the tracks at this location. If there's a track already at the copy to location with the same name, the track is skipped.
        Parameters:
        location - the location to copy the tracks to.
      • setLength

        public void setLength​(int length)
        Set total length of all tracks for this location
        Parameters:
        length - The integer sum of all tracks at this location.
      • getLength

        public int getLength()
        Returns:
        total length of all tracks for this location
      • getUsedLength

        public int getUsedLength()
        Returns:
        The length of the track that is occupied by cars and engines
      • isStaging

        public boolean isStaging()
        Used to determine if location is setup for staging
        Returns:
        true if location is setup as staging
      • hasSpurs

        public boolean hasSpurs()
        Returns:
        True if location has spurs
      • hasInterchanges

        public boolean hasInterchanges()
        Returns:
        True if location has classification/interchange tracks
      • hasYards

        public boolean hasYards()
        Returns:
        True if location has yard tracks
      • hasTrackType

        public boolean hasTrackType​(java.lang.String trackType)
        Parameters:
        trackType - The track type to check.
        Returns:
        True if location has the track type specified Track.INTERCHANGE Track.YARD Track.SPUR Track.Staging
      • changeTrackType

        public void changeTrackType​(java.lang.String type)
        Change all tracks at this location to type
        Parameters:
        type - Track.INTERCHANGE Track.YARD Track.SPUR Track.Staging
      • setTrainDirections

        public void setTrainDirections​(int direction)
        Sets the train directions that this location can service. EAST means that an Eastbound train can service the location.
        Parameters:
        direction - Any combination of EAST WEST NORTH SOUTH
      • getTrainDirections

        public int getTrainDirections()
        Gets the train directions that this location can service. EAST means that an Eastbound train can service the location.
        Returns:
        Any combination of EAST WEST NORTH SOUTH
      • setNumberRS

        public void setNumberRS​(int number)
        Sets the quantity of rolling stock for this location
        Parameters:
        number - An integer representing the quantity of rolling stock at this location.
      • getNumberRS

        public int getNumberRS()
        Gets the number of cars and engines at this location
        Returns:
        number of cars at this location
      • getNumberCars

        public int getNumberCars()
        Returns:
        The number of cars at this location
      • getNumberEngines

        public int getNumberEngines()
        Returns:
        The number of engines at this location
      • setSwitchListEnabled

        public void setSwitchListEnabled​(boolean switchList)
        When true, a switchlist is desired for this location. Used for preview and printing a manifest for a single location
        Parameters:
        switchList - When true, switch lists are enabled for this location.
      • isSwitchListEnabled

        public boolean isSwitchListEnabled()
        Used to determine if switch list is needed for this location
        Returns:
        true if switch list needed
      • setStatus

        public void setStatus​(java.lang.String status)
        Sets the print status for this location's switch list
        Parameters:
        status - UNKNOWN PRINTED MODIFIED UPDATED CSV_GENERATED
      • getStatus

        public java.lang.String getStatus()
        The print status for this location's switch list
        Returns:
        UNKNOWN PRINTED MODIFIED UPDATED CSV_GENERATED
      • setSwitchListState

        public void setSwitchListState​(int state)
        Parameters:
        state - Location.SW_CREATE Location.SW_PRINTED Location.SW_APPEND
      • getSwitchListState

        public int getSwitchListState()
        Returns the state of the switch list for this location.
        Returns:
        Location.SW_CREATE, Location.SW_PRINTED or Location.SW_APPEND
      • setTrainIconEast

        public void setTrainIconEast​(java.awt.Point point)
        Sets the train icon coordinates for an eastbound train arriving at this location.
        Parameters:
        point - The XY coordinates on the panel.
      • setTrainIconRangeX

        public void setTrainIconRangeX​(int x)
        Sets the X range for detecting the manual movement of a train icon.
        Parameters:
        x - the +/- range for detection
      • getTrainIconRangeX

        public int getTrainIconRangeX()
        Used to determine the sensitivity when a user is manually moving a train icon on a panel.
        Returns:
        the x +/- range for a train icon
      • setTrainIconRangeY

        public void setTrainIconRangeY​(int y)
        Sets the Y range for detecting the manual movement of a train icon.
        Parameters:
        y - the +/- range for detection
      • getTrainIconRangeY

        public int getTrainIconRangeY()
        Used to determine the sensitivity when a user is manually moving a train icon on a panel.
        Returns:
        the y +/- range for a train icon
      • addRS

        public void addRS​(RollingStock rs)
        Adds rolling stock to a specific location.
        Parameters:
        rs - The RollingStock to add.
      • addPickupRS

        public void addPickupRS()
        Increments the number of cars and or engines that will be picked up by a train at this location.
      • deletePickupRS

        public void deletePickupRS()
        Decrements the number of cars and or engines that will be picked up by a train at this location.
      • addDropRS

        public void addDropRS()
        Increments the number of cars and or engines that will be dropped off by trains at this location.
      • deleteDropRS

        public void deleteDropRS()
        Decrements the number of cars and or engines that will be dropped off by trains at this location.
      • getPickupRS

        public int getPickupRS()
        Returns:
        the number of cars and engines that are scheduled for pick up at this location.
      • getDropRS

        public int getDropRS()
        Returns:
        the number of cars and engines that are scheduled for drop at this location.
      • getDivision

        public Division getDivision()
        Gets the division for this location
        Returns:
        the division for this location
      • setComment

        public void setComment​(java.lang.String comment)
      • getComment

        public java.lang.String getComment()
        Gets the comment text without color attributes
        Returns:
        the comment text
      • getCommentWithColor

        public java.lang.String getCommentWithColor()
        Gets the comment text with optional color attributes
        Returns:
        text with optional color attributes
      • getSwitchListComment

        public java.lang.String getSwitchListComment()
        Gets the switch list comment text without color attributes
        Returns:
        the comment text
      • getSwitchListCommentWithColor

        public java.lang.String getSwitchListCommentWithColor()
        Gets the switch list comment text with optional color attributes
        Returns:
        text with optional color attributes
      • addTypeName

        public void addTypeName​(java.lang.String type)
        Adds the specific type of rolling stock to the will service list
        Parameters:
        type - of rolling stock that location will service
      • deleteTypeName

        public void deleteTypeName​(java.lang.String type)
      • acceptsTypeName

        public boolean acceptsTypeName​(java.lang.String type)
      • addTrack

        public Track addTrack​(java.lang.String name,
                              java.lang.String type)
        Adds a track to this location. Valid track types are spurs, yards, staging and interchange tracks.
        Parameters:
        name - of track
        type - of track, Track.INTERCHANGE, Track.SPUR, Track.STAGING, Track.YARD
        Returns:
        Track
      • register

        public void register​(Track track)
        Remember a NamedBean Object created outside the manager.
        Parameters:
        track - The Track to be loaded at this location.
      • getTrackByName

        public Track getTrackByName​(java.lang.String name,
                                    java.lang.String type)
        Get track at this location by name and type. Track type can be null.
        Parameters:
        name - track's name
        type - track type
        Returns:
        track at location
      • getTrackIdsByIdList

        public java.util.List<java.lang.String> getTrackIdsByIdList()
        Gets a list of track ids ordered by id for this location.
        Returns:
        list of track ids for this location
      • getTracksByIdList

        public java.util.List<TrackgetTracksByIdList()
        Gets a sorted by id list of tracks for this location.
        Returns:
        Sorted list of tracks by id for this location.
      • getTracksList

        public java.util.List<TrackgetTracksList()
        Gets a unsorted list of the tracks at this location.
        Returns:
        tracks at this location.
      • getTracksByNameList

        public java.util.List<TrackgetTracksByNameList​(java.lang.String type)
        Sorted list by track name. Returns a list of tracks of a given track type. If type is null returns all tracks for the location.
        Parameters:
        type - track type: Track.YARD, Track.SPUR, Track.INTERCHANGE, Track.STAGING
        Returns:
        list of tracks ordered by name for this location
      • getTracksByMoves

        public java.util.List<TrackgetTracksByMoves​(java.lang.String type)
        Sorted list by track moves. Returns a list of a given track type. If type is null, all tracks for the location are returned. Tracks with schedules are placed at the start of the list. Tracks that are alternates are removed.
        Parameters:
        type - track type: Track.YARD, Track.SPUR, Track.INTERCHANGE, Track.STAGING
        Returns:
        list of tracks at this location ordered by moves
      • getTracksByBlockingOrderList

        public java.util.List<TrackgetTracksByBlockingOrderList​(java.lang.String type)
        Sorted list by track blocking order. Returns a list of a given track type. If type is null, all tracks for the location are returned.
        Parameters:
        type - track type: Track.YARD, Track.SPUR, Track.INTERCHANGE, Track.STAGING
        Returns:
        list of tracks at this location ordered by blocking order
      • resetMoves

        public void resetMoves()
        Reset the move count for all tracks at this location
      • updateComboBox

        public void updateComboBox​(javax.swing.JComboBox<Track> box)
        Updates a JComboBox with all of the track locations for this location.
        Parameters:
        box - JComboBox to be updated.
      • updateComboBox

        public void updateComboBox​(javax.swing.JComboBox<Track> box,
                                   RollingStock rs,
                                   boolean filter,
                                   boolean isDestination)
        Updates a JComboBox with tracks that can service the rolling stock.
        Parameters:
        box - JComboBox to be updated.
        rs - Rolling Stock to be serviced
        filter - When true, remove tracks not able to service rs.
        isDestination - When true, the tracks are destinations for the rs.
      • addPool

        public Pool addPool​(java.lang.String name)
        Adds a track pool for this location. A track pool is a set of tracks where the length of the tracks is shared between all of them.
        Parameters:
        name - the name of the Pool to create
        Returns:
        Pool
      • getPoolsByNameList

        public java.util.List<PoolgetPoolsByNameList()
        Gets a list of Pools for this location.
        Returns:
        A list of Pools
      • hasServiceRestrictions

        public boolean hasServiceRestrictions()
        True if this location has a track with pick up or set out restrictions.
        Returns:
        True if there are restrictions at this location.
      • hasPools

        public boolean hasPools()
        Used to determine if there are Pools at this location.
        Returns:
        True if there are Pools at this location
      • hasPlannedPickups

        public boolean hasPlannedPickups()
        Used to determine if there are any planned pickups at this location.
        Returns:
        True if there are planned pickups
      • hasLoadRestrictions

        public boolean hasLoadRestrictions()
        Used to determine if there are any load restrictions at this location.
        Returns:
        True if there are load restrictions
      • hasShipLoadRestrictions

        public boolean hasShipLoadRestrictions()
        Used to determine if there are any load ship restrictions at this location.
        Returns:
        True if there are load ship restrictions
      • hasRoadRestrictions

        public boolean hasRoadRestrictions()
        Used to determine if there are any road restrictions at this location.
        Returns:
        True if there are road restrictions
      • hasDestinationRestrictions

        public boolean hasDestinationRestrictions()
        Used to determine if there are any track destination restrictions at this location.
        Returns:
        True if there are destination restrictions
      • hasWork

        public boolean hasWork()
      • store

        public org.jdom2.Element store()
        Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-locations.dtd.
        Returns:
        Contents in a JDOM Element
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent e)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • setDirtyAndFirePropertyChange

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