Пример #1
0
        public void SetValue(double value, VelocityTypes type)
        {
            switch (type)
            {
            case VelocityTypes.MetersPerHour:
                _value = value * 0.0002778;
                break;

            case VelocityTypes.MetersPerSecond:
                _value = value;
                break;

            case VelocityTypes.FeetPerSecond:
                _value = value * 0.3048;
                break;

            case VelocityTypes.KilometersPerSecond:
                _value = value * 1000;
                break;

            case VelocityTypes.KilometersPerHour:
                _value = value * 0.2777778;
                break;

            case VelocityTypes.Mach:
                _value = value * 343;
                break;

            case VelocityTypes.MilesPerHour:
                _value = value * 0.44704;
                break;
            }
        }
 public static string BuildClassification(VelocityTypes velocityType)
 {
     return(string.Format(
                CultureInfo.InvariantCulture,
                UnitOfMeasurementFactory.ClassificationTemplate,
                MeasurementTypes.Velocity.ToString(),
                velocityType.ToString()));
 }
    public UnitOfMeasurement CreateVelocityUnitOfMeasurement(VelocityTypes velocityType, string name, double value)
    {
        string classification = BuildClassification(velocityType);

        return(this.factory.Create(classification, name, value));
    }
Пример #4
0
 public Velocity(double value, VelocityTypes type)
 {
     SetValue(value, type);
 }