001package jmri.jmrit.logixng;
002
003import java.util.List;
004import java.util.Map;
005
006import javax.annotation.Nonnull;
007
008import jmri.Category;
009
010/**
011 * Manager for DigitalBooleanActionBean
012 *
013 * @author Dave Duchamp       Copyright (C) 2007
014 * @author Daniel Bergqvist   Copyright (C) 2018
015 */
016public interface DigitalBooleanActionManager extends BaseManager<MaleDigitalBooleanActionSocket> {
017
018    /**
019     * Remember a NamedBean Object created outside the manager.
020     * This method creates a MaleDigitalBooleanAction for the action.
021     *
022     * @param action the bean
023     * @return the male socket for this action
024     * @throws IllegalArgumentException if the action has an invalid system name
025     */
026    MaleDigitalBooleanActionSocket registerAction(@Nonnull DigitalBooleanActionBean action)
027            throws IllegalArgumentException;
028
029    /**
030     * Create a new system name for an DigitalBooleanActionBean.
031     * @return a new system name
032     */
033    String getAutoSystemName();
034
035    FemaleDigitalBooleanActionSocket createFemaleSocket(
036            Base parent, FemaleSocketListener listener, String socketName);
037
038    /**
039     * Get a set of classes that implements the DigitalBooleanActionBean interface.
040     *
041     * @return a set of entries with category and class
042     */
043    Map<Category, List<Class<? extends Base>>> getActionClasses();
044
045    /*.*
046     * Add an DigitalBooleanActionBean.
047     *
048     * @param action the action to add
049     * @throws IllegalArgumentException if the action has an invalid system name
050     */
051//    void addAction(DigitalBooleanActionBean action)
052//            throws IllegalArgumentException;
053
054    /*.*
055     * Locate via user name, then system name if needed. Does not create a new
056     * one if nothing found
057     *
058     * @param name User name or system name to match
059     * @return null if no match found
060     */
061//    DigitalBooleanActionBean getAction(String name);
062
063//    DigitalBooleanActionBean getByUserName(String s);
064
065//    DigitalBooleanActionBean getBySystemName(String s);
066
067    /**
068     * {@inheritDoc}
069     *
070     * The sub system prefix for the DigitalActionManager is
071     * {@link #getSystemNamePrefix() } and "DA";
072     */
073    @Override
074    default String getSubSystemNamePrefix() {
075        return getSystemNamePrefix() + "DB";
076    }
077
078    /**
079     * Delete DigitalBooleanAction by removing it from the manager. The DigitalBooleanActionBean must first be
080     * deactivated so it stops processing.
081     *
082     * @param x the DigitalBooleanAction to delete
083     */
084    void deleteDigitalBooleanAction(MaleDigitalBooleanActionSocket x);
085
086}