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