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 StringExpressionManager extends BaseManager<MaleStringExpressionSocket> {
014
015    /**
016     * Remember a NamedBean Object created outside the manager.
017     * This method creates a MaleStringExpressionSocket 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    MaleStringExpressionSocket registerExpression(@Nonnull StringExpressionBean expression)
024            throws IllegalArgumentException;
025    
026    /**
027     * Create a new system name for an Expression.
028     * @return a new system name
029     */
030    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    FemaleStringExpressionSocket 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    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//    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//    Expression getExpression(String name);
066
067//    Expression getByUserName(String s);
068
069//    Expression getBySystemName(String s);
070
071    /**
072     * {@inheritDoc}
073     * 
074     * The sub system prefix for the StringExpressionManager is
075     * {@link #getSystemNamePrefix() } and "SE";
076     */
077    @Override
078    default String getSubSystemNamePrefix() {
079        return getSystemNamePrefix() + "SE";
080    }
081
082    /**
083     * Delete StringExpression by removing it from the manager. The Expression must
084     * first be deactivated so it stops processing.
085     *
086     * @param x the StringExpression to delete
087     */
088    void deleteStringExpression(MaleStringExpressionSocket x);
089
090}