Class Schedule
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.locations.schedules.Schedule
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,PropertyChangeFirer,PropertyChangeProvider
public class Schedule extends PropertyChangeSupport implements java.beans.PropertyChangeListener
Represents a car delivery schedule for a location
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String_commentprotected java.lang.String_idprotected int_IdNumberprotected java.lang.String_nameprotected java.util.Hashtable<java.lang.String,ScheduleItem>_scheduleHashTableprotected int_sequenceNumstatic java.lang.StringDISPOSEstatic java.lang.StringLISTCHANGE_CHANGED_PROPERTYstatic java.lang.StringSCHEDULE_OKAY-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScheduleItemaddItem(java.lang.String type)Adds a car type to the end of this scheduleScheduleItemaddItem(java.lang.String carType, int sequence)Add a schedule item at a specific place (sequence) in the schedule Allowable sequence numbers are 0 to max size of schedule. 0 = start of list.booleancheckScheduleAttribute(java.lang.String attribute, java.lang.String carType, Car car)java.lang.StringcheckScheduleItem(ScheduleItem si, Car car, Track track)java.lang.StringcheckScheduleItemValid(ScheduleItem si, Track track)java.lang.StringcheckScheduleValid(Track track)Check to see if schedule is valid for the track.voiddeleteItem(ScheduleItem si)Delete a ScheduleItemvoiddispose()java.lang.StringgetComment()java.lang.StringgetId()ScheduleItemgetItemById(java.lang.String id)Get a ScheduleItem by idScheduleItemgetItemBySequenceId(int sequenceId)ScheduleItemgetItemByType(java.lang.String carType)Get item by car type (gets last schedule item with this type)java.util.List<ScheduleItem>getItemsBySequenceList()Get a list of ScheduleItems sorted by schedule orderjava.lang.StringgetName()intgetSize()booleanhasRandomItem()voidmoveItemDown(ScheduleItem si)Places a ScheduleItem later in the schedulevoidmoveItemUp(ScheduleItem si)Places a ScheduleItem earlier in the schedulevoidpropertyChange(java.beans.PropertyChangeEvent e)voidregister(ScheduleItem si)Remember a NamedBean Object created outside the manager.voidresetHitCounts()java.lang.StringsearchSchedule(Car car, Track track)voidsetComment(java.lang.String comment)protected voidsetDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)voidsetName(java.lang.String name)org.jdom2.Elementstore()Create an XML element to represent this Entry.java.lang.StringtoString()-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
_id
protected java.lang.String _id
-
_name
protected java.lang.String _name
-
_comment
protected java.lang.String _comment
-
_scheduleHashTable
protected java.util.Hashtable<java.lang.String,ScheduleItem> _scheduleHashTable
-
_IdNumber
protected int _IdNumber
-
_sequenceNum
protected int _sequenceNum
-
LISTCHANGE_CHANGED_PROPERTY
public static final java.lang.String LISTCHANGE_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
DISPOSE
public static final java.lang.String DISPOSE
- See Also:
- Constant Field Values
-
SCHEDULE_OKAY
public static final java.lang.String SCHEDULE_OKAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public java.lang.String getId()
-
setName
public void setName(java.lang.String name)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getName
public java.lang.String getName()
-
getSize
public int getSize()
-
setComment
public void setComment(java.lang.String comment)
-
getComment
public java.lang.String getComment()
-
dispose
public void dispose()
-
resetHitCounts
public void resetHitCounts()
-
hasRandomItem
public boolean hasRandomItem()
-
addItem
public ScheduleItem addItem(java.lang.String type)
Adds a car type to the end of this schedule- Parameters:
type- The string car type to add.- Returns:
- ScheduleItem created for the car type added
-
addItem
public ScheduleItem addItem(java.lang.String carType, int sequence)
Add a schedule item at a specific place (sequence) in the schedule Allowable sequence numbers are 0 to max size of schedule. 0 = start of list.- Parameters:
carType- The string car type name to add.sequence- Where in the schedule to add the item.- Returns:
- schedule item
-
register
public void register(ScheduleItem si)
Remember a NamedBean Object created outside the manager.- Parameters:
si- The schedule item to add.
-
deleteItem
public void deleteItem(ScheduleItem si)
Delete a ScheduleItem- Parameters:
si- The scheduleItem to delete.
-
getItemByType
public ScheduleItem getItemByType(java.lang.String carType)
Get item by car type (gets last schedule item with this type)- Parameters:
carType- The string car type to search for.- Returns:
- schedule item
-
getItemById
public ScheduleItem getItemById(java.lang.String id)
Get a ScheduleItem by id- Parameters:
id- The string id of the ScheduleItem.- Returns:
- schedule item
-
getItemsBySequenceList
public java.util.List<ScheduleItem> getItemsBySequenceList()
Get a list of ScheduleItems sorted by schedule order- Returns:
- list of ScheduleItems ordered by sequence
-
moveItemUp
public void moveItemUp(ScheduleItem si)
Places a ScheduleItem earlier in the schedule- Parameters:
si- The ScheduleItem to move.
-
moveItemDown
public void moveItemDown(ScheduleItem si)
Places a ScheduleItem later in the schedule- Parameters:
si- The ScheduleItem to move.
-
getItemBySequenceId
public ScheduleItem getItemBySequenceId(int sequenceId)
-
checkScheduleValid
public java.lang.String checkScheduleValid(Track track)
Check to see if schedule is valid for the track.- Parameters:
track- The track associated with this schedule- Returns:
- SCHEDULE_OKAY if schedule okay, otherwise an error message.
-
checkScheduleItemValid
public java.lang.String checkScheduleItemValid(ScheduleItem si, Track track)
-
searchSchedule
public java.lang.String searchSchedule(Car car, Track track)
-
checkScheduleItem
public java.lang.String checkScheduleItem(ScheduleItem si, Car car, Track track)
-
checkScheduleAttribute
public boolean checkScheduleAttribute(java.lang.String attribute, java.lang.String carType, Car car)
-
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-config.xml.- Returns:
- Contents in a JDOM Element
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
-