示例#1
0
 public Time ConvertFromSI(Time x)
 {
     Time newValue = new Time(1);
     newValue.timeType = x.timeType;
     newValue.value = x.value / ConvertTimeToSI(newValue);
     return newValue;
 }
示例#2
0
 public new string GiveValueInSI()
 {
     Time x = new Time(value);
     x.timeType = timeType;
     Converter conv = new Converter();
     string message = conv.ConvertToSI(x).value + " s";
     return message;
 }
示例#3
0
 public static Time operator /(Speed v, Acceleration a)
 {
     Time t = new Time(0);
     t.timeType = v.timeType;
     Converter converter = new Converter();
     t.value = converter.ConvertToSI(v).value / converter.ConvertToSI(a).value;
     return converter.ConvertFromSI(t);
 }
示例#4
0
 public static Time operator /(Distance s, Speed v)
 {
     Time t = new Time(0);
     t.timeType = v.timeType;
     Converter converter = new Converter();
     t.value = converter.ConvertToSI(s).value / converter.ConvertToSI(v).value;
     return converter.ConvertFromSI(t);
 }
示例#5
0
 public double ConvertTimeToSI(Time x)
 {
     double value = x.value;
     switch (x.timeType)
     {
         case ("h"): value = x.value * 3600; break;
         case ("min"): value = x.value * 60; break;
         case ("ms"): value = x.value / 100; break;
     }
     return value;
 }
示例#6
0
        public Acceleration ConvertFromSI(Acceleration x)
        {
            Acceleration newValue = new Acceleration(0);
            newValue.distanceType = x.distanceType;
            newValue.timeType = x.timeType;

            Speed v = new Speed(x.value);
            v = ConvertFromSI(v);

            Time t = new Time(1);
            t.timeType = x.timeType;
            t = ConvertFromSI(t);
            newValue.value = v.value / t.value;

            return newValue;
        }
示例#7
0
        public Speed ConvertFromSI(Speed x)
        {
            Speed newValue = new Speed(0);
            newValue.distanceType = x.distanceType;
            newValue.timeType = x.timeType;

            Distance s = new Distance(x.value);
            s.distanceType = x.distanceType;
            s = ConvertFromSI(s);

            Time t = new Time(1);
            t.timeType = x.timeType;
            t = ConvertFromSI(t);

            newValue.value = s.value / t.value;
            return newValue;
        }
示例#8
0
 public static Time operator -(Time t1, Time t2)
 {
     Time t3 = new Time(0);
     t3.value = t1.value - t2.value;
     return t3;
 }
示例#9
0
 public Time ConvertToSI(Time x)
 {
     Time newValue = new Time(0);
     newValue.timeType = "s";
     newValue.value = ConvertTimeToSI(x);
     return newValue;
 }
示例#10
0
        public Acceleration ConvertToSI(Acceleration x)
        {
            Acceleration newValue = new Acceleration(0);
            newValue.distanceType = "m";
            newValue.timeType = "s";

            Speed v=new Speed(x.value);
            v=ConvertToSI(v);
            Time t = new Time(1);
            t.timeType = x.timeType;
            newValue.value = v.value / ConvertTimeToSI(t);

            return newValue;
        }
示例#11
0
        public Speed ConvertToSI(Speed x)
        {
            Speed newValue = new Speed(0);
            newValue.distanceType = "m";
            newValue.timeType = "s";

            Distance s = new Distance(x.value);
            newValue.value = ConvertDistanceToSI(s);

            Time t = new Time(1);
            t.timeType = x.timeType;

            newValue.value = newValue.value / ConvertTimeToSI(t);
            return newValue;
        }