Class RollingStockGroup<T extends RollingStock>
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.rollingstock.RollingStockGroup<T>
-
- Type Parameters:
T
- the type of RollingStock in this group
- All Implemented Interfaces:
PropertyChangeFirer
,PropertyChangeProvider
public abstract class RollingStockGroup<T extends RollingStock> extends PropertyChangeSupport
A group of rolling stock that is managed as one unit.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<T>
_group
protected T
_lead
protected java.lang.String
_name
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description RollingStockGroup(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T rs)
void
delete(T rs)
void
dispose()
int
getAdjustedWeightTons()
Get a group's adjusted weightjava.util.List<T>
getGroup()
T
getLead()
java.lang.String
getName()
int
getSize()
Gets the number of rolling stock in this groupint
getTotalLength()
boolean
isLead(T rs)
void
removeLead(T rs)
void
setLead(T rs)
Sets the lead for this group.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
-
_name
protected java.lang.String _name
-
_lead
protected T extends RollingStock _lead
-
_group
protected java.util.List<T extends RollingStock> _group
-
-
Constructor Detail
-
RollingStockGroup
public RollingStockGroup(java.lang.String name)
-
-
Method Detail
-
getName
public java.lang.String getName()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getTotalLength
public int getTotalLength()
-
getAdjustedWeightTons
public int getAdjustedWeightTons()
Get a group's adjusted weight- Returns:
- group's weight
-
getSize
public int getSize()
Gets the number of rolling stock in this group- Returns:
- number of elements in this group
-
setLead
public void setLead(T 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.
-
removeLead
public void removeLead(T rs)
-
dispose
public void dispose()
-
-