Class RollingStock

    • Constructor Detail

      • RollingStock

        public RollingStock​(java.lang.String road,
                            java.lang.String number)
      • RollingStock

        public RollingStock​(Element e)
        Construct this Entry from XML.
        Parameters:
        e - RollingStock XML element
    • Method Detail

      • createId

        public static java.lang.String createId​(java.lang.String road,
                                                java.lang.String number)
      • 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
      • setNumber

        public void setNumber​(java.lang.String number)
        Set the rolling stock identification or road number
        Parameters:
        number - The rolling stock road number.
      • getNumber

        public java.lang.String getNumber()
      • setRoadName

        public void setRoadName​(java.lang.String road)
      • toString

        public java.lang.String toString()
        For combobox and identification
        Overrides:
        toString in class java.lang.Object
      • setTypeName

        public void setTypeName​(java.lang.String type)
        Sets the type of rolling stock. "Boxcar" for example is a type of car.
        Parameters:
        type - The type of rolling stock.
      • setLength

        public void setLength​(java.lang.String length)
        Sets the body length of the rolling stock. For example, a 40' boxcar would be entered as 40 feet. Coupler length is added by the program when determining if a car could fit on a track.
        Parameters:
        length - the body length in feet or meters
        See Also:
        getTotalLength()
      • getLength

        public java.lang.String getLength()
        gets the body length of the rolling stock
        Returns:
        length in feet or meters
        See Also:
        getTotalLength()
      • getTotalLength

        public int getTotalLength()
        Returns the length of the rolling stock including the couplers
        Returns:
        total length of the rolling stock in feet or meters
      • setColor

        public void setColor​(java.lang.String color)
      • getColor

        public java.lang.String getColor()
      • setWeight

        public void setWeight​(java.lang.String weight)
        Parameters:
        weight - rolling stock weight in ounces.
      • getWeight

        public java.lang.String getWeight()
      • setWeightTons

        public void setWeightTons​(java.lang.String weight)
        Sets the full scale weight in tons.
        Parameters:
        weight - full scale rolling stock weight in tons.
      • setBuilt

        public void setBuilt​(java.lang.String built)
        Set the date that the rolling stock was built. Use 4 digits for the year, or the format MM-YY where MM is the two digit month, and YY is the last two years if the rolling stock was built in the 1900s. Use MM-YYYY for units build after 1999.
        Parameters:
        built - The string built date.
      • getBuilt

        public java.lang.String getBuilt()
      • getStatus

        public java.lang.String getStatus()
        Returns:
        location unknown symbol, out of service symbol, or none if car okay
      • getLocationName

        public java.lang.String getLocationName()
        Get rolling stock's location name
        Returns:
        empty string if rolling stock isn't on layout
      • getLocationId

        public java.lang.String getLocationId()
        Get rolling stock's location id
        Returns:
        empty string if rolling stock isn't on the layout
      • setTrack

        public void setTrack​(Track track)
        Set the rolling stock's location and track. Doesn't do any checking and does not fire a property change. Used exclusively by the Router code. Use setLocation(Location, Track) instead.
        Parameters:
        track - to place the rolling stock on.
      • getTrackName

        public java.lang.String getTrackName()
        Get rolling stock's track name
        Returns:
        empty string if rolling stock isn't on a track
      • getTrackId

        public java.lang.String getTrackId()
        Get rolling stock's track id
        Returns:
        empty string if rolling stock isn't on a track
      • setLocation

        public java.lang.String setLocation​(Location location,
                                            Track track)
        Sets rolling stock location on the layout
        Parameters:
        location - The Location.
        track - (yard, spur, staging, or interchange track)
        Returns:
        "okay" if successful, "type" if the rolling stock's type isn't acceptable, "road" if rolling stock road isn't acceptable, or "length" if the rolling stock length didn't fit.
      • setLocation

        public java.lang.String setLocation​(Location location,
                                            Track track,
                                            boolean force)
        Sets rolling stock location on the layout
        Parameters:
        location - The Location.
        track - (yard, spur, staging, or interchange track)
        force - when true place rolling stock ignore track length, type, and road
        Returns:
        "okay" if successful, "type" if the rolling stock's type isn't acceptable, "road" if rolling stock road isn't acceptable, or "length" if the rolling stock length didn't fit.
      • testLocation

        public java.lang.String testLocation​(Location location,
                                             Track track)
        Used to confirm that a track is associated with a location, and that rolling stock can be placed on track.
        Parameters:
        location - The location
        track - The track, can be null
        Returns:
        OKAY if track exists at location and rolling stock can be placed on track, ERROR_TRACK if track isn't at location, other if rolling stock can't be placed on track.
      • setDestination

        public java.lang.String setDestination​(Location destination,
                                               Track track)
        Sets rolling stock destination on the layout
        Parameters:
        destination - The Location.
        track - (yard, spur, staging, or interchange track)
        Returns:
        "okay" if successful, "type" if the rolling stock's type isn't acceptable, or "length" if the rolling stock length didn't fit.
      • setDestination

        public java.lang.String setDestination​(Location destination,
                                               Track track,
                                               boolean force)
        Sets rolling stock destination on the layout
        Parameters:
        destination - The Location.
        track - (yard, spur, staging, or interchange track)
        force - when true ignore track length, type, and road when setting destination
        Returns:
        "okay" if successful, "type" if the rolling stock's type isn't acceptable, or "length" if the rolling stock length didn't fit.
      • checkDestination

        public java.lang.String checkDestination​(Location destination,
                                                 Track track)
        Used to check destination track to see if it will accept rolling stock
        Parameters:
        destination - The Location.
        track - The Track at destination.
        Returns:
        status OKAY, TYPE, ROAD, LENGTH, ERROR_TRACK
      • setDestination

        public void setDestination​(Location destination)
        Sets rolling stock destination without reserving destination track space or drop count. Does not fire a property change. Used by car router to test destinations. Use setDestination(Location, Track) instead.
        Parameters:
        destination - for the rolling stock
      • setDestinationTrack

        public void setDestinationTrack​(Track track)
        Sets rolling stock destination track without reserving destination track space or drop count. Used by car router to test destinations. Does not fire a property change. Use setDestination(Location, Track) instead.
        Parameters:
        track - The Track for set out at destination.
      • setLastLocationId

        public void setLastLocationId​(java.lang.String id)
        Used to block cars from staging
        Parameters:
        id - The location id from where the car came from before going into staging.
      • setLastTrackId

        public void setLastTrackId​(java.lang.String id)
      • setMoves

        public void setMoves​(int moves)
      • setTrain

        public void setTrain​(Train train)
        Sets the train that will service this rolling stock.
        Parameters:
        train - The Train.
      • setRouteLocation

        public void setRouteLocation​(RouteLocation routeLocation)
        Sets the location where the rolling stock will be picked up by the train.
        Parameters:
        routeLocation - the pick up location for this rolling stock.
      • getLastRouteId

        public java.lang.String getLastRouteId()
        Used to determine which train delivered a car to an interchange track.
        Returns:
        the route id of the last train delivering this car.
      • setLastRouteId

        public void setLastRouteId​(java.lang.String id)
        Sets the id of the route that was used to set out the rolling stock. Used to determine if the rolling stock can be pick ups from an interchange track.
        Parameters:
        id - The route id.
      • getValue

        public java.lang.String getValue()
      • setValue

        public void setValue​(java.lang.String value)
        Sets the value (cost, price) for this rolling stock. Currently has nothing to do with operations. But nice to have.
        Parameters:
        value - a string representing what this item is worth.
      • getRfid

        public java.lang.String getRfid()
      • setRfid

        public void setRfid​(java.lang.String id)
        Sets the RFID for this rolling stock.
        Parameters:
        id - 12 character RFID string.
      • setIdTag

        public void setIdTag​(IdTag tag)
        Sets the id tag for this rolling stock. The id tag isn't saved, between session but the tag label is saved as _rfid.
        Parameters:
        tag - the id tag
      • getWhenLastSeenDate

        public java.lang.String getWhenLastSeenDate()
        Provides the last date when this rolling stock was moved, or was reset from a built train, as a string.
        Returns:
        date
      • getLastDate

        public java.lang.String getLastDate()
        Provides the last date when this rolling stock was moved
        Returns:
        String MM/dd/yyyy HH:mm:ss
      • setLastDate

        public void setLastDate​(java.util.Date date)
        Sets the last date when this rolling stock was moved
        Parameters:
        date - The Date when this rolling stock was last moved.
      • getLastMoveDate

        public java.util.Date getLastMoveDate()
        Provides the last date when this rolling stock was moved
        Returns:
        date
      • setBlocking

        public void setBlocking​(int number)
      • setRouteDestination

        public void setRouteDestination​(RouteLocation routeDestination)
        Set where in a train's route this rolling stock will be set out.
        Parameters:
        routeDestination - the location where the rolling stock is to leave the train.
      • setOwnerName

        public void setOwnerName​(java.lang.String owner)
      • setLocationUnknown

        public void setLocationUnknown​(boolean unknown)
        Set the rolling stock location as unknown.
        Parameters:
        unknown - when true, the rolling stock location is unknown.
      • isLocationUnknown

        public boolean isLocationUnknown()
        Returns:
        true when car's location is unknown
      • setOutOfService

        public void setOutOfService​(boolean outOfService)
        Sets the rolling stock service state. When true, rolling stock is out of service. Normal state is false, the rolling stock is in service and available.
        Parameters:
        outOfService - when true, out of service
      • isOutOfService

        public boolean isOutOfService()
        Returns:
        true when rolling stock is out of service
      • setSelected

        public void setSelected​(boolean selected)
      • isSelected

        public boolean isSelected()
        Returns:
        true when rolling stock is selected
      • setComment

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

        public java.lang.String getComment()
      • reset

        public void reset()
      • dispose

        public void dispose()
        Remove rolling stock. Releases all listeners.
      • store

        protected Element store​(Element e)
        Add XML elements to represent this Entry.
        Parameters:
        e - Element for car or engine store.
        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)