示例#1
0
        public static void Calculate(Segm segm, int kategorija, bool isSummer)
        {
            RegularityRow row = RegularityData.First(
                rw => rw.Kategorija == kategorija &&
                rw.Sunkus == segm.RailIsHeavy &&
                rw.DefektMin <= segm.Defektingumas &&
                rw.DefektMax > segm.Defektingumas);

            segm.Regularity = isSummer ? row.Vasara : row.Ziema;
        }
示例#2
0
        private Segm joinSegms(List <Segm> segms)
        {
            if (segms.Count == 0)
            {
                return(null);
            }
            Segm result = segms[0];

            for (int i = 0; i < segms.Count; i++)
            {
                result = result.Join(segms[i]);
            }
            return(result);
        }
示例#3
0
        public Segm Join(Segm another)
        {
            const string NAMESEP = " / ";
            Segm         prod    = new Segm(this.Ind, this.Name + NAMESEP + another.Name, this.Length + another.Length, this.RailIsHeavy && another.RailIsHeavy);

            for (int i = 0; i < 3; i++)
            {
                prod.Periods[i].setDangers(
                    this.Periods[i].D3 + another.Periods[i].D3,
                    this.Periods[i].D2 + another.Periods[i].D2,
                    this.Periods[i].D1 + another.Periods[i].D1,
                    this.Periods[i].DP + another.Periods[i].DP,
                    this.Periods[i].ID + another.Periods[i].ID,
                    this.Periods[i].L + another.Periods[i].L);
            }
            return(prod);
        }
示例#4
0
        public void LoadData()
        {
            fetchData();

            // sukuriamos grupės
            foreach (SegmentData segm in SegmentFetcher.AllSegments)
            {
                if (Data.FindIndex(gr => gr.Name == segm.GroupName) == -1)
                {
                    Group gr = new Group(segm.GroupName, segm.Kategorija, isSummer);
                    Data.Add(gr);
                }
            }

            // į grupes sudedami segmentai
            foreach (SegmentData sd in SegmentFetcher.AllSegments)
            {
                // randama grupė
                Group group = Data.Find(gr => gr.Name == sd.GroupName);

                // sukuriamas segmentas
                Segm segm = new Segm(sd.Ind, sd.Name, sd.Ilgis, sd.YraSunkus);

                // į segmento periodus sudedami defektai
                foreach (DefectData dd in sd.Defektai)
                {
                    if (dd.In20d)
                    {
                        distribute(dd.Danger, segm.Periods[0]);
                    }
                    if (dd.In3m)
                    {
                        distribute(dd.Danger, segm.Periods[1]);
                    }
                    if (dd.In6m)
                    {
                        distribute(dd.Danger, segm.Periods[2]);
                    }
                }

                // segmentas įdedamas į grupę
                group.Segms.Add(segm);
            }
        }