jmri.jmrit.operations.locations
Class Schedule

java.lang.Object
  extended by jmri.jmrit.operations.locations.Schedule
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class Schedule
extends Object
implements PropertyChangeListener

Represents a car delivery schedule for a location

Author:
Daniel Boudreau Copyright (C) 2009, 2011

Field Summary
protected  String _comment
           
protected  String _id
           
protected  int _IdNumber
           
protected  String _name
           
protected  Hashtable<String,ScheduleItem> _scheduleHashTable
           
protected  int _sequenceNum
           
static String DISPOSE
           
static String LISTCHANGE_CHANGED_PROPERTY
           
 
Constructor Summary
Schedule(Element e)
          Construct this Entry from XML.
Schedule(String id, String name)
           
 
Method Summary
 ScheduleItem addItem(String type)
          Adds a car type to the end of this schedule
 ScheduleItem addItem(String item, int sequence)
          Add a schedule item at a specific place (sequence) in the schedule Allowable sequence numbers are 0 to max size of schedule;
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void deleteItem(ScheduleItem si)
          Delete a ScheduleItem
 void dispose()
           
protected  void firePropertyChange(String p, Object old, Object n)
           
 String getComment()
           
 String getId()
           
 ScheduleItem getItemById(String id)
          Get a ScheduleItem by id
 ScheduleItem getItemByType(String type)
          Get item by car type (gets last schedule item with this type)
 List<String> getItemsBySequenceList()
          Get a list of ScheduleItem ids sorted by schedule order
 String getName()
           
 int getSize()
           
 void moveItemDown(ScheduleItem si)
          Moves a ScheduleItem later in the schedule by incrementing the sequenceId for the ScheduleItem
 void moveItemUp(ScheduleItem si)
          Moves a ScheduleItem earlier in the schedule by decrementing the sequenceId for the ScheduleItem
 void propertyChange(PropertyChangeEvent e)
           
 void register(ScheduleItem si)
          Remember a NamedBean Object created outside the manager.
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void setComment(String comment)
           
 void setName(String name)
           
 Element store()
          Create an XML element to represent this Entry.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_id

protected String _id

_name

protected String _name

_comment

protected String _comment

_scheduleHashTable

protected Hashtable<String,ScheduleItem> _scheduleHashTable

_IdNumber

protected int _IdNumber

_sequenceNum

protected int _sequenceNum

LISTCHANGE_CHANGED_PROPERTY

public static final String LISTCHANGE_CHANGED_PROPERTY
See Also:
Constant Field Values

DISPOSE

public static final String DISPOSE
See Also:
Constant Field Values
Constructor Detail

Schedule

public Schedule(String id,
                String name)

Schedule

public Schedule(Element e)
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-config.xml

Parameters:
e - Consist XML element
Method Detail

getId

public String getId()

setName

public void setName(String name)

toString

public String toString()
Overrides:
toString in class Object

getName

public String getName()

getSize

public int getSize()

setComment

public void setComment(String comment)

getComment

public String getComment()

dispose

public void dispose()

addItem

public ScheduleItem addItem(String type)
Adds a car type to the end of this schedule

Parameters:
type -
Returns:
ScheduleItem created for the car type added

addItem

public ScheduleItem addItem(String item,
                            int sequence)
Add a schedule item at a specific place (sequence) in the schedule Allowable sequence numbers are 0 to max size of schedule;

Parameters:
item -
sequence -
Returns:
schedule item

register

public void register(ScheduleItem si)
Remember a NamedBean Object created outside the manager.


deleteItem

public void deleteItem(ScheduleItem si)
Delete a ScheduleItem

Parameters:
si -

getItemByType

public ScheduleItem getItemByType(String type)
Get item by car type (gets last schedule item with this type)

Parameters:
type -
Returns:
schedule item

getItemById

public ScheduleItem getItemById(String id)
Get a ScheduleItem by id

Parameters:
id -
Returns:
schedule item

getItemsBySequenceList

public List<String> getItemsBySequenceList()
Get a list of ScheduleItem ids sorted by schedule order

Returns:
list of ScheduleItem ids ordered by sequence

moveItemUp

public void moveItemUp(ScheduleItem si)
Moves a ScheduleItem earlier in the schedule by decrementing the sequenceId for the ScheduleItem

Parameters:
si -

moveItemDown

public void moveItemDown(ScheduleItem si)
Moves a ScheduleItem later in the schedule by incrementing the sequenceId for the ScheduleItem

Parameters:
si -

store

public 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(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)

firePropertyChange

protected void firePropertyChange(String p,
                                  Object old,
                                  Object n)


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads