jmri.jmrit.operations.rollingstock
Class RollingStockGroup

java.lang.Object
  extended by jmri.jmrit.operations.rollingstock.RollingStockGroup
Direct Known Subclasses:
Consist, Kernel

public class RollingStockGroup
extends Object

A group of rolling stock that is managed as one unit.

Author:
Daniel Boudreau Copyright (C) 2010

Field Summary
protected  List<RollingStock> _group
           
protected  RollingStock _lead
           
protected  String _name
           
 
Constructor Summary
RollingStockGroup(String name)
           
 
Method Summary
 void add(RollingStock rs)
           
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void delete(RollingStock rs)
           
 void dispose()
           
protected  void firePropertyChange(String p, Object old, Object n)
           
 int getAdjustedWeightTons()
          Get a group's adjusted weight
 List<RollingStock> getGroup()
           
 int getLength()
           
 String getName()
           
 int getSize()
          Gets the number of rolling stock in this group
 boolean isLead(RollingStock rs)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void setLead(RollingStock rs)
          Sets the lead for this group.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

protected String _name

_lead

protected RollingStock _lead

_group

protected List<RollingStock> _group
Constructor Detail

RollingStockGroup

public RollingStockGroup(String name)
Method Detail

getName

public String getName()

toString

public String toString()
Overrides:
toString in class Object

add

public void add(RollingStock rs)

delete

public void delete(RollingStock rs)

getGroup

public List<RollingStock> getGroup()

getLength

public int getLength()

getAdjustedWeightTons

public int getAdjustedWeightTons()
Get a group's adjusted weight

Returns:
group's weight

isLead

public boolean isLead(RollingStock rs)

getSize

public int getSize()
Gets the number of rolling stock in this group

Returns:
number of elements in this group

setLead

public void setLead(RollingStock rs)
Sets the lead for this group. RollingStock must be part of the group. The rolling stock that make up this group will have the attributes of the lead. However, the length attribute is the sum of all unit lengths plus the coupler lengths.

Parameters:
rs - lead for this group.

dispose

public void dispose()

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