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