コード例 #1
0
ファイル: Partial.cs プロジェクト: Chernobushka/OOP
        public static void sort(Lab lab)
        {
            Base elem;

            for (int i = 0; i < lab.count - 1; i++)
            {
                for (int j = 0; j < lab.count - i - 1; j++)
                {
                    if (lab.elems[j].info.price < lab.elems[j + 1].info.price)
                    {
                        elem             = lab.elems[j];
                        lab.elems[j]     = lab.elems[j + 1];
                        lab.elems[j + 1] = elem;
                    }
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Chernobushka/OOP
        static void Main(string[] args)
        {
            Product product = new Product("123", "213", 100);
            Tech    tech    = new Tech("456", "789", "456789", 200);
            Tablet  tablet  = new Tablet();
            Lab     lab     = new Lab(10);

            tablet.info.price = 300;
            lab.Add(product);
            lab.Add(tech);
            lab.Add(tablet);
            lab.Add(new Scanner());
            lab.Add(new Printer());
            lab.Add(new Product());

            lab.show();
            controller.show(lab);
            controller.sort(lab);
            lab.show();
            lab.Del(tablet);
            lab.show();
        }
コード例 #3
0
ファイル: Color.cs プロジェクト: whj998013/sampleServer
        public Lab RGBToLab(RGB rgb)
        {
            Lab    lab = new Lab();
            double B   = gamma(rgb.B / 255.0f);
            double G   = gamma(rgb.G / 255.0f);
            double R   = gamma(rgb.R / 255.0f);
            double X   = 0.412453 * R + 0.357580 * G + 0.180423 * B;
            double Y   = 0.212671 * R + 0.715160 * G + 0.072169 * B;
            double Z   = 0.019334 * R + 0.119193 * G + 0.950227 * B;

            X /= 0.95047;
            Y /= 1.0;
            Z /= 1.08883;


            double FX = X > 0.008856f ? Math.Pow(X, 1.0f / 3.0f) : (7.787f * X + 0.137931f);
            double FY = Y > 0.008856f ? Math.Pow(Y, 1.0f / 3.0f) : (7.787f * Y + 0.137931f);
            double FZ = Z > 0.008856f ? Math.Pow(Z, 1.0f / 3.0f) : (7.787f * Z + 0.137931f);

            lab.L = Y > 0.008856f ? (116.0f * FY - 16.0f) : (903.3f * Y);
            lab.a = 500f * (FX - FY);
            lab.b = 200f * (FY - FZ);
            return(lab);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: Chernobushka/OOP
        static void Main(string[] args)
        {
            Product product = new Product("123", "213", 100);
            Tech    tech    = new Tech("456", "789", "456789", 200);
            Tablet  tablet  = new Tablet();
            Lab     lab     = new Lab(6);
            Scanner scanner = new Scanner("2223", "32131", "11123", "231", 22360);

            tablet.info.price = 300;
            IAnotherInterface[] arr = new IAnotherInterface[3];
            arr[0] = product;
            arr[1] = tech;
            arr[2] = tablet;

            try
            {
                Lab WrongLab = new Lab(100);
                WrongLab.Del(tablet);
                //arr[4].ToString();
                lab.Add(product);
                lab.Add(tech);
                lab.Add(tablet);
                lab.Add(new Scanner());
                lab.Add(new Printer());
                lab.Add(new Product());
                //lab.Add(new Product());


                lab.show();
                controller.show(lab);
                controller.sort(lab);
                lab.show();
                lab.Del(tablet);
                //lab.Del(scanner);
                lab.show();
            }
            catch (LabIsFull ex)
            {
                Console.WriteLine("LabIsFull Exception");
                Console.WriteLine(ex.Message);
            }
            catch (ElementDoesNotExist ex)
            {
                Console.WriteLine("ElementDoesNotExist Exception");
                Console.WriteLine(ex.Message);
            }
            catch (LabIsEmpty ex)
            {
                Console.WriteLine("LabIsEmpty Exception");
                Console.WriteLine(ex.Message);
            }
            catch (WrongSize ex)
            {
                Console.WriteLine("WrongSize Exception");
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Another Exception");
                Console.WriteLine(ex.Message);
            }
        }