001package jmri.jmrit.logixng.expressions;
002
003import java.util.AbstractMap;
004import java.util.HashSet;
005import java.util.Map;
006import java.util.Set;
007
008import jmri.Category;
009import jmri.jmrit.logixng.LogixNG_Category;
010
011import org.openide.util.lookup.ServiceProvider;
012
013import jmri.jmrit.logixng.DigitalExpressionFactory;
014import jmri.jmrit.logixng.DigitalExpressionBean;
015
016/**
017 * The factory for DigitalExpressionBean classes.
018 */
019@ServiceProvider(service = DigitalExpressionFactory.class)
020public class DigitalFactory implements DigitalExpressionFactory {
021
022    @Override
023    public Set<Map.Entry<Category, Class<? extends DigitalExpressionBean>>> getExpressionClasses() {
024        Set<Map.Entry<Category, Class<? extends DigitalExpressionBean>>> expressionClasses =
025                new HashSet<>(      // Set.of() returns an immutable set
026                        Set.of(new AbstractMap.SimpleEntry<>(LogixNG_Category.COMMON, And.class),
027                                new AbstractMap.SimpleEntry<>(LogixNG_Category.COMMON, Antecedent.class),
028                                new AbstractMap.SimpleEntry<>(LogixNG_Category.FLOW_CONTROL, DigitalCallModule.class),
029                                new AbstractMap.SimpleEntry<>(LogixNG_Category.OTHER, ConnectionName.class),
030                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionAudio.class),
031                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionBlock.class),
032                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionClock.class),
033                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionConditional.class),
034                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionDispatcher.class),
035                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionEntryExit.class),
036                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionLight.class),
037                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionLocalVariable.class),
038                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionMemory.class),
039                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionOBlock.class),
040                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionPower.class),
041                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionReference.class),
042                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionReporter.class),
043                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionScript.class),
044                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionSection.class),
045                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionSensor.class),
046                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionSensorEdge.class),
047                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionSignalHead.class),
048                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionSignalMast.class),
049                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionTransit.class),
050                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionTurnout.class),
051                                new AbstractMap.SimpleEntry<>(LogixNG_Category.ITEM, ExpressionWarrant.class),
052                                new AbstractMap.SimpleEntry<>(LogixNG_Category.OTHER, False.class),
053                                new AbstractMap.SimpleEntry<>(LogixNG_Category.OTHER, FileAsFlag.class),
054                                new AbstractMap.SimpleEntry<>(LogixNG_Category.COMMON, DigitalFormula.class),
055                                new AbstractMap.SimpleEntry<>(LogixNG_Category.OTHER, Hold.class),
056                                new AbstractMap.SimpleEntry<>(LogixNG_Category.OTHER, LastResultOfDigitalExpression.class),
057                                new AbstractMap.SimpleEntry<>(LogixNG_Category.OTHER, LogData.class),
058                                new AbstractMap.SimpleEntry<>(LogixNG_Category.COMMON, Not.class),
059                                new AbstractMap.SimpleEntry<>(LogixNG_Category.COMMON, Or.class),
060                                new AbstractMap.SimpleEntry<>(LogixNG_Category.COMMON, Timer.class),
061                                new AbstractMap.SimpleEntry<>(LogixNG_Category.OTHER, TriggerOnce.class),
062                                new AbstractMap.SimpleEntry<>(LogixNG_Category.OTHER, True.class)
063                        ));
064
065        if (jmri.util.SystemType.isLinux()) {
066            expressionClasses.add(new AbstractMap.SimpleEntry<>(LogixNG_Category.LINUX, ExpressionLinuxLinePower.class));
067        }
068
069        return expressionClasses;
070    }
071
072}