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 DigitalExpressionBean
012 *
013 * @author Dave Duchamp       Copyright (C) 2007
014 * @author Daniel Bergqvist   Copyright (C) 2018
015 */
016public interface DigitalExpressionManager extends BaseManager<MaleDigitalExpressionSocket> {
017
018    /**
019     * Remember a NamedBean Object created outside the manager.
020     * This method creates a MaleActionSocket for the action.
021     *
022     * @param expression the bean
023     * @return the male socket for this expression
024     * @throws IllegalArgumentException if the expression has an invalid system name
025     */
026    MaleDigitalExpressionSocket registerExpression(@Nonnull DigitalExpressionBean expression)
027            throws IllegalArgumentException;
028
029    /**
030     * Create a new system name for an DigitalExpressionBean.
031     * @return a new system name
032     */
033    String getAutoSystemName();
034
035    FemaleDigitalExpressionSocket createFemaleSocket(
036            Base parent, FemaleSocketListener listener, String socketName);
037/*
038    FemaleDigitalExpressionSocket createFemaleExpressionSocket(
039            Base parent,
040            FemaleSocketListener listener,
041            String socketName,
042            MaleDigitalExpressionSocket maleSocket);
043*/
044    /**
045     * Get a set of classes that implements the DigitalAction interface.
046     *
047     * @return a set of entries with category and class
048     */
049    Map<Category, List<Class<? extends Base>>> getExpressionClasses();
050
051    /*.*
052     * Add an DigitalExpressionBean.
053     *
054     * @param expression the expression to add
055     * @throws IllegalArgumentException if the expression has an invalid system name
056     */
057//    void addExpression(DigitalExpressionBean expression)
058//            throws IllegalArgumentException;
059
060    /*.*
061     * Locate via user name, then system name if needed. Does not create a new
062     * one if nothing found
063     *
064     * @param name User name or system name to match
065     * @return null if no match found
066     */
067//    DigitalExpressionBean getExpression(String name);
068
069//    DigitalExpressionBean getByUserName(String s);
070
071//    DigitalExpressionBean getBySystemName(String s);
072
073    /**
074     * {@inheritDoc}
075     *
076     * The sub system prefix for the DigitalExpressionManager is
077     * {@link #getSystemNamePrefix() } and "DE";
078     */
079    @Override
080    default String getSubSystemNamePrefix() {
081        return getSystemNamePrefix() + "DE";
082    }
083
084    /**
085     * Delete DigitalExpression by removing it from the manager. The Expression must
086     * first be deactivated so it stops processing.
087     *
088     * @param x the DigitalExpression to delete
089     */
090    void deleteDigitalExpression(MaleDigitalExpressionSocket x);
091
092}