Package jmri.implementation
Class AbstractConsistManager
- java.lang.Object
-
- jmri.implementation.AbstractConsistManager
-
- All Implemented Interfaces:
ConsistManager
- Direct Known Subclasses:
DccConsistManager,EasyDccConsistManager,InternalConsistManager,LocoNetConsistManager,MqttConsistManager,NceConsistManager,NmraConsistManager,XNetConsistManager
public abstract class AbstractConsistManager extends java.lang.Object implements ConsistManager
An Abstract Consist Manager on top of which system specific consist managers can be built.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.ConsistManager
ConsistManager.EnableListener
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<LocoAddress,Consist>consistTable
-
Constructor Summary
Constructors Constructor Description AbstractConsistManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ConsistaddConsist(LocoAddress address)Add a new Consist with the given address.voidaddConsistListListener(ConsistListListener l)Register a ConsistListListener object with this ConsistManagerjava.lang.StringdecodeErrorCode(int errorCode)Translate Error Codes relieved by a consistListener into StringsvoiddelConsist(LocoAddress address)Remove an old Consist.ConsistgetConsist(LocoAddress address)Find a Consist with this consist address, and return it.java.util.ArrayList<LocoAddress>getConsistList()Return the list of consists we know about.voidnotifyConsistListChanged()Notify the registered ConsistListListener objects that the ConsistList has changed.voidremoveConsistListListener(ConsistListListener l)Remove a ConsistListListener object with this ConsistManagervoidrequestUpdateFromLayout()Request an update from the layout, loading Consists from the command station.protected booleanshouldRequestUpdateFromLayout()Allow a request for consist updates from the layout.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.ConsistManager
canBeDisabled, csConsistNeedsSeperateAddress, isCommandStationConsistPossible, isEnabled, registerEnableListener, unregisterEnableListener
-
-
-
-
Field Detail
-
consistTable
protected java.util.HashMap<LocoAddress,Consist> consistTable
-
-
Constructor Detail
-
AbstractConsistManager
public AbstractConsistManager()
-
-
Method Detail
-
getConsist
public Consist getConsist(LocoAddress address)
Find a Consist with this consist address, and return it.- Specified by:
getConsistin interfaceConsistManager- Parameters:
address- the consist address- Returns:
- an existing or new consist
-
addConsist
protected abstract Consist addConsist(LocoAddress address)
Add a new Consist with the given address.- Parameters:
address- consist address- Returns:
- a consist at address; this will be the existing consist if a consist is already known to exist at address
-
delConsist
public void delConsist(LocoAddress address)
Description copied from interface:ConsistManagerRemove an old Consist.- Specified by:
delConsistin interfaceConsistManager- Parameters:
address- the consist address
-
getConsistList
public java.util.ArrayList<LocoAddress> getConsistList()
Return the list of consists we know about.- Specified by:
getConsistListin interfaceConsistManager- Returns:
- list of addresses
-
decodeErrorCode
public java.lang.String decodeErrorCode(int errorCode)
Description copied from interface:ConsistManagerTranslate Error Codes relieved by a consistListener into Strings- Specified by:
decodeErrorCodein interfaceConsistManager- Parameters:
errorCode- the code- Returns:
- the description
-
requestUpdateFromLayout
public void requestUpdateFromLayout()
Description copied from interface:ConsistManagerRequest an update from the layout, loading Consists from the command station.- Specified by:
requestUpdateFromLayoutin interfaceConsistManager
-
shouldRequestUpdateFromLayout
protected boolean shouldRequestUpdateFromLayout()
Allow a request for consist updates from the layout. If not overridden by a concrete subclass, this method always returns true.- Returns:
- true if the request can be made, false if not
-
addConsistListListener
public void addConsistListListener(ConsistListListener l)
Description copied from interface:ConsistManagerRegister a ConsistListListener object with this ConsistManager- Specified by:
addConsistListListenerin interfaceConsistManager- Parameters:
l- a Consist List Listener object.
-
removeConsistListListener
public void removeConsistListListener(ConsistListListener l)
Description copied from interface:ConsistManagerRemove a ConsistListListener object with this ConsistManager- Specified by:
removeConsistListListenerin interfaceConsistManager- Parameters:
l- a Consist List Listener object.
-
notifyConsistListChanged
public void notifyConsistListChanged()
Description copied from interface:ConsistManagerNotify the registered ConsistListListener objects that the ConsistList has changed.- Specified by:
notifyConsistListChangedin interfaceConsistManager
-
-