Class TrainSchedule
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.trains.schedules.TrainSchedule
-
- All Implemented Interfaces:
PropertyChangeFirer
,PropertyChangeProvider
public class TrainSchedule extends PropertyChangeSupport
Represents a schedule for trains. For example, can be a day of the week. Useful when determining which trains to build and run.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_comment
protected java.lang.String
_id
protected java.lang.String
_name
protected java.util.List<java.lang.String>
_trainIds
static java.lang.String
ANY
static java.lang.String
NAME_CHANGED_PROPERTY
static java.lang.String
NONE
static java.lang.String
SCHEDULE_CHANGED_PROPERTY
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description TrainSchedule(java.lang.String id, java.lang.String name)
TrainSchedule(org.jdom2.Element e)
Construct this Entry from XML.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTrainId(java.lang.String id)
Adds the train id for a train that needs to be builtboolean
containsTrainId(java.lang.String id)
Used to determine if train is to be built using this schedulejava.lang.String
getComment()
java.lang.String
getId()
java.lang.String
getName()
void
propertyChange(java.beans.PropertyChangeEvent e)
void
removeTrainId(java.lang.String id)
Removes the train id for a train that needs to be builtvoid
setComment(java.lang.String comment)
protected void
setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
void
setName(java.lang.String name)
org.jdom2.Element
store()
Create an XML element to represent this Entry.java.lang.String
toString()
-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
NONE
public static final java.lang.String NONE
- See Also:
- Constant Field Values
-
ANY
public static final java.lang.String ANY
- See Also:
- Constant Field Values
-
NAME_CHANGED_PROPERTY
public static final java.lang.String NAME_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
SCHEDULE_CHANGED_PROPERTY
public static final java.lang.String SCHEDULE_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
_id
protected java.lang.String _id
-
_name
protected java.lang.String _name
-
_comment
protected java.lang.String _comment
-
_trainIds
protected java.util.List<java.lang.String> _trainIds
-
-
Constructor Detail
-
TrainSchedule
public TrainSchedule(java.lang.String id, java.lang.String name)
-
TrainSchedule
public TrainSchedule(org.jdom2.Element e)
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-trains.xml- Parameters:
e
- Consist XML element
-
-
Method Detail
-
getId
public java.lang.String getId()
-
setName
public void setName(java.lang.String name)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getName
public java.lang.String getName()
-
setComment
public void setComment(java.lang.String comment)
-
getComment
public java.lang.String getComment()
-
addTrainId
public void addTrainId(java.lang.String id)
Adds the train id for a train that needs to be built- Parameters:
id
- The train id
-
removeTrainId
public void removeTrainId(java.lang.String id)
Removes the train id for a train that needs to be built- Parameters:
id
- The train id
-
containsTrainId
public boolean containsTrainId(java.lang.String id)
Used to determine if train is to be built using this schedule- Parameters:
id
- the id of the train to be tested- Returns:
- true if this train's build enable should be set
-
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)
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
-