Package jmri.managers
Class AbstractCabSignalManager
- java.lang.Object
-
- jmri.managers.AbstractCabSignalManager
-
- All Implemented Interfaces:
CabSignalManager,Disposable
- Direct Known Subclasses:
CbusCabSignalManager,DefaultCabSignalManager,LnCabSignalManager
public abstract class AbstractCabSignalManager extends java.lang.Object implements CabSignalManager, Disposable
Abstract implementation of theCabSignalManagerinterface.
This file is part of JMRI.JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
Constructor Summary
Constructors Constructor Description AbstractCabSignalManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddCabSignalListListener(CabSignalListListener listener)Register a CabSignalListListener object with this CabSignalManagerprotected abstract CabSignalcreateCabSignal(LocoAddress address)Create a new cab signal with the given address.voiddelCabSignal(LocoAddress address)Remove an old CabSignal.voiddispose()Called when disposing of a disposable.CabSignalgetCabSignal(LocoAddress address)Find a CabSignal with the given address, and return it.CabSignal[]getCabSignalArray()Get an array of known cab signals.java.util.Set<LocoAddress>getCabSignalList()Get a list of known cab signal addresses.voidnotifyCabSignalListChanged()Notify the registered CabSignalListListener objects that the CabSignalList has changed.voidremoveCabSignalListListener(CabSignalListListener listener)Remove a CabSignalListListener object with this CabSignalManager
-
-
-
Constructor Detail
-
AbstractCabSignalManager
public AbstractCabSignalManager()
-
-
Method Detail
-
getCabSignal
public CabSignal getCabSignal(LocoAddress address)
Find a CabSignal with the given address, and return it. If the CabSignal doesn't exit, create it.- Specified by:
getCabSignalin interfaceCabSignalManager- Parameters:
address- the cab signal for the address- Returns:
- an existing or new cab signal
-
createCabSignal
protected abstract CabSignal createCabSignal(LocoAddress address)
Create a new cab signal with the given address.- Parameters:
address- the address the cab signal is for- Returns:
- a new cab signal
-
delCabSignal
public void delCabSignal(LocoAddress address)
Remove an old CabSignal.- Specified by:
delCabSignalin interfaceCabSignalManager- Parameters:
address- the address associated with the cab signal
-
getCabSignalList
public java.util.Set<LocoAddress> getCabSignalList()
Get a list of known cab signal addresses.- Specified by:
getCabSignalListin interfaceCabSignalManager- Returns:
- list of cab signal addresses
-
getCabSignalArray
public CabSignal[] getCabSignalArray()
Get an array of known cab signals.- Specified by:
getCabSignalArrayin interfaceCabSignalManager- Returns:
- array of cab signals
-
addCabSignalListListener
public void addCabSignalListListener(CabSignalListListener listener)
Register a CabSignalListListener object with this CabSignalManager- Specified by:
addCabSignalListListenerin interfaceCabSignalManager- Parameters:
listener- a CabSignal List Listener object.
-
removeCabSignalListListener
public void removeCabSignalListListener(CabSignalListListener listener)
Remove a CabSignalListListener object with this CabSignalManager- Specified by:
removeCabSignalListListenerin interfaceCabSignalManager- Parameters:
listener- a CabSignal List Listener object.
-
notifyCabSignalListChanged
public void notifyCabSignalListChanged()
Notify the registered CabSignalListListener objects that the CabSignalList has changed.- Specified by:
notifyCabSignalListChangedin interfaceCabSignalManager
-
dispose
public void dispose()
Description copied from interface:DisposableCalled when disposing of a disposable.Note there are no assurances this method will not be called multiple times against a single instance of this Disposable. It is the responsibility of this Disposable to protect itself and the application from ensuring that calling this method multiple times has no unwanted side effects.
- Specified by:
disposein interfaceDisposable
-
-