示例#1
0
 public virtual void Set()
 {
     id = Global.id;
     Global.id++;
     if (seasonal != null)
     {
         seasonal.Set();
     }
 }
示例#2
0
        public RTree(ArrayList ranges, TimeSeries ts)
        {
            ArrayList R_j = (ArrayList)ranges[ranges.Count - 1];

            root = (Range)R_j[0];
            ArrayList R_i;

            for (int i = ranges.Count - 1; i >= 0; i--)
            {
                R_i = (ArrayList)ranges[i];
                foreach (Range r_i in R_i)
                {
                    TimeSeries ts_ = new TimeSeries(ts, r_i);
                    Model      m   = new Model(ts_);
                    m.Clean();
                    m.Set();
                    ModelTree t = m.construct();
                    t.range    = r_i;
                    t.children = null;
                    r_i.t      = t;
                }
            }

            for (int i = ranges.Count - 2; i >= 0; i--)
            {
                R_i = (ArrayList)ranges[i];
                R_j = (ArrayList)ranges[i + 1];

                foreach (Range r_i in R_i)
                {
                    foreach (Range r_j in R_j)
                    {
                        if (r_j.overlap(r_i))
                        {
                            r_j.children.Add(r_i);
                        }
                    }
                }
            }
            for (int i = ranges.Count - 2; i >= 0; i--)
            {
                R_i = (ArrayList)ranges[i];
                R_j = (ArrayList)ranges[i + 1];

                foreach (Range r_i in R_i)
                {
                    foreach (Range r_j in R_j)
                    {
                        if (r_j.overlap(r_i))
                        {
                            if (r_j.len > r_i.len)
                            {
                                if (r_i.t.error > 1)
                                {
                                    r_j.t.childs.Add(r_i.t);
                                    r_i.t.parent = r_j.t;
                                }
                            }
                        }
                    }
                }
            }
            //convert childs to children
            for (int i = ranges.Count - 1; i >= 0; i--)
            {
                R_i = (ArrayList)ranges[i];
                foreach (Range r_i in R_i)
                {
                    r_i.t.convertchildstochildren();
                }
            }
        }