001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005package jmri.jmrix.bachrus;
006
007/**
008 * Useful stuff for speed conversion
009 *
010 * @author Andrew Crosland Copyright (C) 2010
011 */
012public class Speed {
013    
014    public enum Unit {
015        MPH, KPH
016    }
017
018    static final float MPH_KPH_FACTOR = 1.609344F;
019    static final float MPH_TO_KPH = MPH_KPH_FACTOR;
020    static final float KPH_TO_MPH = 1 / MPH_KPH_FACTOR;
021
022    public static float mphToKph(float m) {
023        return m * MPH_TO_KPH;
024    }
025
026    public static float kphToMph(float k) {
027        return k * KPH_TO_MPH;
028    }
029}