001package jmri;
002
003import java.util.Set;
004
005/**
006 * Interface for CabSignal Manager objects, which provide access to the existing
007 * CabSignals and allows for creation and destruction.
008 *
009 * <hr>
010 * This file is part of JMRI.
011 * <p>
012 * JMRI is free software; you can redistribute it and/or modify it under the
013 * terms of version 2 of the GNU General Public License as published by the Free
014 * Software Foundation. See the "COPYING" file for a copy of this license.
015 * <p>
016 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY
017 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
018 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
019 *
020 * @author Paul Bender Copyright (C) 2019
021 */
022public interface CabSignalManager {
023
024    /**
025     * Find a CabSignal with the given address, and return it. If the CabSignal
026     * doesn't exit, create it.
027     *
028     * @param address the cab signal for the address
029     * @return an existing or new cab signal
030     */
031    CabSignal getCabSignal(LocoAddress address);
032
033    /**
034     * Remove an old CabSignal.
035     *
036     * @param address the address associated with the cab signal
037     */
038    void delCabSignal(LocoAddress address);
039
040    /**
041     * Get a list of known cab signal addresses.
042     *
043     * @return list of cab signal addresses
044     */
045    Set<LocoAddress> getCabSignalList();
046
047    /**
048     * Get an array of known cab signals.
049     *
050     * @return array of cab signals
051     */
052    CabSignal[] getCabSignalArray();
053
054    /**
055     * Register a CabSignalListListener object with this CabSignalManager
056     *
057     * @param listener a CabSignal List Listener object.
058     */
059    void addCabSignalListListener(CabSignalListListener listener);
060
061    /**
062     * Remove a CabSignalListListener object with this CabSignalManager
063     *
064     * @param listener a CabSignal List Listener object.
065     */
066    void removeCabSignalListListener(CabSignalListListener listener);
067
068    /**
069     * Notify the registered CabSignalListListener objects that the CabSignalList
070     * has changed.
071     */
072    void notifyCabSignalListChanged();
073
074}