Package jmri.jmrit.operations.locations
Class Pool
- java.lang.Object
-
- jmri.beans.UnboundBean
-
- jmri.beans.Bean
-
- jmri.jmrit.operations.locations.Pool
-
- All Implemented Interfaces:
BeanInterface
,PropertyChangeFirer
,PropertyChangeProvider
public class Pool extends Bean
Represents a pool of tracks that share their length.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_id
protected java.lang.String
_name
protected java.util.List<Track>
_tracks
static java.lang.String
DISPOSE
static java.lang.String
LISTCHANGE_CHANGED_PROPERTY
-
Fields inherited from class jmri.beans.Bean
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description Pool(java.lang.String id, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Track track)
Adds a track to this poolvoid
dispose()
java.lang.String
getId()
int
getMaxLengthTrack(Track track)
java.lang.String
getName()
int
getSize()
The number of tracks in this pool.int
getTotalLengthTracks()
java.util.List<Track>
getTracks()
void
remove(Track track)
Removes a track from this poolboolean
requestTrackLength(Track track, int length)
Request track length from one of the other tracks in this pool.void
setName(java.lang.String name)
java.lang.String
toString()
-
Methods inherited from class jmri.beans.Bean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setProperty
-
-
-
-
Field Detail
-
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
-
_id
protected java.lang.String _id
-
_name
protected java.lang.String _name
-
-
Constructor Detail
-
Pool
public Pool(java.lang.String id, java.lang.String name)
-
-
Method Detail
-
getId
public java.lang.String getId()
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String name)
-
getSize
public int getSize()
The number of tracks in this pool.- Returns:
- the number of tracks in this pool.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
dispose
public void dispose()
-
remove
public void remove(Track track)
Removes a track from this pool- Parameters:
track
- to be removed.
-
getTotalLengthTracks
public int getTotalLengthTracks()
-
getMaxLengthTrack
public int getMaxLengthTrack(Track track)
-
requestTrackLength
public boolean requestTrackLength(Track track, int length)
Request track length from one of the other tracks in this pool. Other tracks in the same pool may have their length shortened or lengthened by this operation.- Parameters:
track
- the track requesting additional lengthlength
- the length of rolling stock- Returns:
- true if successful
-
-