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