Ejemplo n.º 1
0
        public static void TestMethod4()
        {
            int Count = 5;

            Segment[] ratings = new Segment[Count];
            List<Segment> list = new List<Segment>()
                {
                    new Segment(2, 5),
                    new Segment(-1, 9),
                };

            SetRating r = new SetRating(list);
            Segment s = SetRating.Intersection(r);
            ratings[0] = s;

            list = new List<Segment>()
                {
                    new Segment(12, 14),
                    new Segment(12, 15),
                    new Segment(12, 14),
                };

            r = new SetRating(list);
            s = SetRating.Intersection(r);
            ratings[1] = s;

            list = new List<Segment>()
                {
                    new Segment(1, 2),
                    new Segment(2, 3),
                };

            r = new SetRating(list);
            s = SetRating.Intersection(r);
            ratings[2] = s;

            list = new List<Segment>()
                {
                    new Segment(2, 9),
                    new Segment(6, 13),
                };

            r = new SetRating(list);
            s = SetRating.Intersection(r);
            ratings[3] = s;

            list = new List<Segment>()
                {
                    new Segment(2, 29),
                };

            r = new SetRating(list);
            s = SetRating.Intersection(r);
            ratings[4] = s;

            SetRating.Output(SetRating.GetMatrixOfPartialOrder(ref ratings));

            Console.WriteLine("_________________________");
        }
Ejemplo n.º 2
0
        public static void TestMethod()
        {
            int Count = 3;
            Segment[] ratings = new Segment[Count];

            List<Segment> list = new List<Segment>()
                {
                    new Segment(0.0001, 0.0002),
                    new Segment(0.00011, 0.00021),
                    new Segment(0.000111, 0.000211),
                    new Segment(0.0001111, 0.0002111)
                };

            SetRating r = new SetRating(list);
            Segment s = SetRating.Intersection(r);
            ratings[0] = s;

            list = new List<Segment>()
                {
                    new Segment(0.001, 0.01),
                    new Segment(0.0011, 0.011),
                    new Segment(0.00111, 0.0111),
                    new Segment(0.001111, 0.01111),
                };

            r = new SetRating(list);
            s = SetRating.Intersection(r);
            ratings[1] = s;

            list = new List<Segment>()
                {
                    new Segment(0.1, 1),
                    new Segment(0.11, 1.1),
                    new Segment(0.111, 1.11),
                    new Segment(0.1111, 1.111),
                };

            r = new SetRating(list);
            s = SetRating.Intersection(r);
            ratings[2] = s;

            SetRating.Output(SetRating.GetMatrixOfPartialOrder(ref ratings));

            Console.WriteLine("_________________________");
        }
Ejemplo n.º 3
0
        public static void TestMethod1()
        {
            int Count = 3;
            Segment[] ratings = new Segment[Count];

            List<Segment> list = new List<Segment>()
                {
                    new Segment(5, 10),
                    new Segment(7, 9),
                    new Segment(7.0001, 8.5),
                };

            SetRating r = new SetRating(list);
            Segment s = SetRating.Intersection(r);
            ratings[0] = s;

            list = new List<Segment>()
                {
                    new Segment(0.003, 14),
                    new Segment(0.01, 10),
                    new Segment(5, 15),
                    new Segment(4, 20),
                };

            r = new SetRating(list);
            s = SetRating.Intersection(r);
            ratings[1] = s;

            list = new List<Segment>()
                {
                    new Segment(2, 12),
                    new Segment(3, 4),
                };

            r = new SetRating(list);
            s = SetRating.Intersection(r);
            ratings[2] = s;

            SetRating.Output(SetRating.GetMatrixOfPartialOrder(ref ratings));

            Console.WriteLine("_________________________");
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Пересечение оценок точки
 /// </summary>
 /// <param name="ratings"> точка с набором оценок </param>
 /// <returns> точка с оценкой </returns>
 public static Segment Intersection(SetRating ratings)
 {
     if (ratings.ratings == null)
         return null;
     Segment intersection = ratings.ratings[0];
     for (int i = 1; i < ratings.ratings.Count; i++)
     {
         //intersection.begin = maximum();
         if (intersection.begin < ratings.ratings[i].begin)
             intersection.begin = ratings.ratings[i].begin;
         if (intersection.end > ratings.ratings[i].end)
             intersection.end = ratings.ratings[i].end;
     }
     return intersection;
 }