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