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    static final int MPH = 0;
015    static final int KPH = 1;
016
017    static final float MPH_KPH_FACTOR = 1.609344F;
018    static final float MPH_TO_KPH = MPH_KPH_FACTOR;
019    static final float KPH_TO_MPH = 1 / MPH_KPH_FACTOR;
020
021    public static float mphToKph(float m) {
022        return m * MPH_TO_KPH;
023    }
024
025    public static float kphToMph(float k) {
026        return k * KPH_TO_MPH;
027    }
028}