示例#1
0
        //Из объекта
        public Moment(DataType dataType, object ob, int nd = 0, ErrorCalc error = null)
        {
            DataType = dataType;
            Nd       = nd;
            Error    = error;
            switch (dataType)
            {
            case DataType.Real:
                Real = Convert.ToDouble(ob);
                break;

            case DataType.Boolean:
                Boolean = Convert.ToBoolean(ob);
                break;

            case DataType.Integer:
                Integer = Convert.ToInt32(ob);
                break;

            case DataType.String:
                String = Convert.ToString(ob);
                break;

            case DataType.Time:
                Date = Convert.ToDateTime(ob);
                break;
            }
        }
示例#2
0
 public Moment(DateTime date, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.Time;
     Date     = date;
     Error    = error;
     Nd       = nd;
 }
示例#3
0
 public Moment(DataType dataType, DateTime time, ErrorCalc error = null, int nd = 0)
 {
     DataType = dataType;
     Time     = time;
     Error    = error;
     Nd       = nd;
 }
示例#4
0
 public Moment(int integer, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.Integer;
     Integer  = integer;
     Error    = error;
     Nd       = nd;
 }
示例#5
0
 public Moment(double real, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.Real;
     Real     = real;
     Error    = error;
     Nd       = nd;
 }
示例#6
0
 public Moment(bool boolean, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.Boolean;
     Boolean  = boolean;
     Error    = error;
     Nd       = nd;
 }
示例#7
0
        //Из строкового значения
        public Moment(DataType dataType, string s, int nd = 0, ErrorCalc error = null)
        {
            DataType = dataType;
            Nd       = nd;
            Error    = error;
            switch (dataType)
            {
            case DataType.String:
                String = s;
                break;

            case DataType.Real:
                Real = s.ToDouble();
                if (Double.IsNaN(Real))
                {
                    Real = 0;
                }
                break;

            case DataType.Time:
                DateTime t;
                Date = DateTime.TryParse(s, out t) ? t : Different.MinDate;
                break;

            case DataType.Integer:
                int i;
                Integer = Int32.TryParse(s, out i) ? i : 0;
                break;

            case DataType.Boolean:
                Boolean = s == "1";
                break;
            }
        }
示例#8
0
 public Moment(string s, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.String;
     String   = s;
     Error    = error;
     Nd       = nd;
 }
示例#9
0
 public Moment(DateTime time, bool boolean, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.Boolean;
     Time     = time;
     Nd       = nd;
     Error    = error;
     Boolean  = boolean;
 }
示例#10
0
 public Moment(DateTime time, string s, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.String;
     Time     = time;
     String   = s;
     Error    = error;
     Nd       = nd;
 }
示例#11
0
 public Moment(DateTime time, double real, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.Real;
     Time     = time;
     Real     = real;
     Error    = error;
     Nd       = nd;
 }
示例#12
0
 public Moment(DateTime time, int integer, ErrorCalc error = null, int nd = 0)
 {
     DataType = DataType.Integer;
     Time     = time;
     Integer  = integer;
     Error    = error;
     Nd       = nd;
 }
示例#13
0
 public Segment(DateTime begin, DateTime end, double pos, int nd = 0, ErrorCalc err = null)
     : base(begin, end)
 {
     Pos = pos;
     if (pos == -1)
     {
         IsResultTime = false;
         ResultTime   = Begin;
     }
     else
     {
         IsResultTime = true;
         ResultTime   = Begin.AddSeconds(end.Subtract(Begin).TotalSeconds *pos);
     }
     Nd    = nd;
     Error = err;
 }
示例#14
0
        //Из действительного значения
        public Moment(DataType dataType, double d, int nd = 0, ErrorCalc error = null)
        {
            DataType = dataType;
            Nd       = nd;
            Error    = error;
            switch (dataType)
            {
            case DataType.String:
                String = d.ToString();
                break;

            case DataType.Real:
                Real = d;
                break;

            case DataType.Integer:
                Integer = Convert.ToInt32(d);
                break;

            case DataType.Boolean:
                Boolean = d > 0;
                break;
            }
        }
示例#15
0
 public Moment(DataType dataType, object ob, DateTime time, int nd = 0, ErrorCalc error = null)
     : this(dataType, ob, nd, error)
 {
     Time = time;
 }
示例#16
0
 public Moment(DataType dataType = DataType.Value, ErrorCalc error = null, int nd = 0)
 {
     DataType = dataType;
     Error    = error;
     Nd       = nd;
 }
示例#17
0
 public Moment(DataType dataType, double d, DateTime time, int nd = 0, ErrorCalc error = null)
     : this(dataType, d, nd, error)
 {
     Time = time;
 }
示例#18
0
 public Moment(DataType dataType, string s, DateTime time, int nd = 0, ErrorCalc error = null)
     : this(dataType, s, nd, error)
 {
     Time = time;
 }