001package jmri.jmrix.bachrus.speedmatcher.speedStepScale;
002
003import jmri.jmrix.bachrus.speedmatcher.SpeedMatcher;
004
005/**
006 * Factory for creating the correct type of Speed Step Scale speed matcher for
007 * the given SpeedMatcherConfig
008 *
009 * @author Todd Wegter Copyright (C) 2024
010 */
011public class SpeedStepScaleSpeedMatcherFactory {
012
013    /**
014     * Gets the correct Speed Step Scale Speed Matcher for the given speedTable
015     *
016     * @param speedTable SpeedStepScaleSpeedMatcherConfig.SpeedTable to use for
017     *                   speed matching
018     * @param config     SpeedStepScaleSpeedMatcherConfig for initializing the
019     *                   speed matcher
020     * @return the SpeedMatcher to use for speed matching
021     */
022    public static SpeedMatcher getSpeedMatcher(SpeedStepScaleSpeedMatcherConfig.SpeedTable speedTable, SpeedStepScaleSpeedMatcherConfig config) {
023
024        switch (speedTable) {
025            case ESU:
026                return new SpeedStepScaleESUTableSpeedMatcher(config);
027            default:
028                return new SpeedStepScaleSpeedTableSpeedMatcher(config);
029        }
030    }
031}