Example #1
0
 static void FilteringDataUsingOfType()
 {
     Console.WriteLine("***** LINQ Filtering Data using OfType *****");
     ArrayList myStuff = new ArrayList(); // non-generic holds objects
     myStuff.AddRange(new object[] {10, 400, 8, false, new Car(), "string data"});
     // now filter out the numeric data
     var myInts = myStuff.OfType<int>();
     foreach (var i in myInts) {
         Console.WriteLine("Int value: {0}", i);
     }
 }
Example #2
0
        static void SimpleFilterObject()
        {
            ArrayList list = new ArrayList {
                1, 2, "hello", 3.9, 'a', 5
            };

            //відфільтровує об'єкти по заданому типу, "перевертає" послідовність даних та терміново виконує запит
            int[] arr = list.OfType <int>().Reverse().ToArray();
            foreach (var x in arr)
            {
                Console.WriteLine(x);
            }
            //методи Sum(), Min(), Max(), Average()
            int res = (from x in arr
                       select x).Sum();

            Console.WriteLine("SUM={0}", res);
        }
Example #3
0
    // Start is called before the first frame update
    void Start()
    {
        var students = new List <Student>();

        students.Add(new Student(15, "AAA"));
        students.Add(new Student(10, "BBB"));
        students.Add(new Student(13, "CCC"));
        students.Add(new Student(12, "DDD"));

        ArrayList lists = new ArrayList()
        {
            1, 2, 3, "zz", "yy", "xx"
        };

        lists.OfType <int>()
        .ToList()
        .ForEach(_ => { print(_); });
    }
Example #4
0
        public void TestCollection()
        {
            var OnlyInt = arrayList.OfType <int>();

            bitArray.Not();
            sortedList.Add("bawid", "astoga");
            sortedList.Add("cagda", "bgaworska");
            sortedList.Add("auba", "cstoga");
            foreach (var t in sortedList)
            {
                Console.WriteLine(((DictionaryEntry)t).Key);
            }
            Console.WriteLine(bitArray.ToString());
            foreach (var i in OnlyInt)
            {
                Console.WriteLine(i);
            }
        }
Example #5
0
        static void QueryArrayList()
        {
            //famAnimals are famous animals
            ArrayList famAnimals = new ArrayList()
            {
                new Animal {
                    Name   = "Heidi",
                    Height = .8,
                    Weight = 18
                },

                new Animal
                {
                    Name   = "Shrek",
                    Height = 4,
                    Weight = 130
                },

                new Animal
                {
                    Name   = "Congo",
                    Height = 3.8,
                    Weight = 90
                }
            };

            // You have to convert the ArrayList into
            // an IEnumerable, an IEnumerable exposes an enumerator, which supports a simple iteration over a non-generic collection.
            var famAnimalEnum = famAnimals.OfType <Animal>();

            //smAnimals are small animals
            var smAnimals = from animal in famAnimalEnum
                            where animal.Weight <= 90
                            orderby animal.Name
                            select animal;

            foreach (var animal in smAnimals)
            {
                Console.WriteLine("{0} weighs {1}lbs",
                                  animal.Name, animal.Weight);
            }

            Console.WriteLine();
        }
Example #6
0
        static void OfTypeAsFilter()
        {
            Console.ForegroundColor = ConsoleColor.DarkCyan;
            Console.WriteLine("=> OfType as filter");

            ArrayList stuff = new ArrayList();

            stuff.AddRange(new object[] { 10, 400, 8, false, new Car(), "String data", 200 });
            Console.WriteLine($" {stuff.Count} items totally in the original arraylist");

            var ints = stuff.OfType <int>();

            Console.Write($" {ints.Count()} numerical data:");
            foreach (var i in ints)
            {
                Console.Write($" {i}");
            }
            Console.WriteLine();
        }
Example #7
0
        private void Frm_Main_Load(object sender, EventArgs e)
        {
            ArrayList arrList = new ArrayList(); //创建动态数组

            arrList.Add(1);                      //添加动态数组元素
            arrList.Add(2);
            arrList.Add("A");
            arrList.Add(3);
            arrList.Add("b");
            //使用LINQ筛选动态数组中是string类型的元素
            var query = from item in arrList.OfType <string>()
                        select item;

            label1.Text = "是字符串类型的有:";//显示string类型的元素
            foreach (var item in query)
            {
                label1.Text += item + " , ";
            }
        }
Example #8
0
        ///<inheritdoc/>
        public string ToWords(long value)
        {
            if (value == 0)
            {
                return(_numbersDictionary.Zero);
            }

            ArrayList words = new ArrayList();

            if (value < 0)
            {
                words.Add(_numbersDictionary.Minus);
                value = Math.Abs(value);
            }

            words.AddRange(GetWordsBySplitNumberToTriplets(value, _numberSeparator));

            return(string.Join(_numberSeparator, words.OfType <string>()).Trim());
        }
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.Unicode;
            Console.InputEncoding  = Encoding.Unicode;
            ArrayList arrayList = new ArrayList();

            arrayList.Add(new Staff {
                id = 1, name = "Nam ", age = 24
            });
            arrayList.Add(new Staff {
                id = 2, name = "Kiên", age = 21
            });
            arrayList.Add(new Staff {
                id = 3, name = "Việt", age = 21
            });
            arrayList.Add(new Staff {
                id = 4, name = "Hằng", age = 21
            });
            arrayList.Add(new Staff {
                id = 5, name = "Tiến", age = 21
            });

            System.Console.WriteLine("Id   Tên       Tuổi");
            System.Console.WriteLine("---------------------------");
            foreach (Staff item in arrayList)
            {
                System.Console.WriteLine(item.id + "  | " + item.name + "   |   " + item.age);
            }

            // Lọc ra danh sách những người nhỏ hơn 24 tuổi và sắp xếp theo tên.
            System.Console.WriteLine("Lọc ra danh sách những người nhỏ hơn 24 tuổi và sắp xếp theo tên.");
            var nv = arrayList.OfType <Staff>();

            var loc = from nhanvien in nv
                      where nhanvien.age < 24
                      orderby nhanvien.name
                      select nhanvien;

            foreach (Staff item in loc)
            {
                System.Console.WriteLine("Id:{0}, Name: {1}, Age: {2}", item.id, item.name, item.age);
            }
        }
        private static void AccountVaultCleanup_OnCommand(CommandEventArgs e)
        {
            Mobile    from          = e.Mobile;
            int       numberremoved = 0;
            ArrayList vaultlist     = new ArrayList();

            foreach (AccountVault av in World.Items.Values.OfType <AccountVault>().Select(item => item as AccountVault))
            {
                vaultlist.Add(av);
            }

            foreach (AccountVault av in from item in vaultlist.OfType <AccountVault>() select item as AccountVault into av let list = av.Items where list.Count <= 0 select av)
            {
                av.Delete();
                numberremoved++;
            }

            from.SendMessage("{0} empty account vaults cleaned up.", numberremoved.ToString());
        }
Example #11
0
        private static void CastAndOfType()
        {
            ArrayList arr = new ArrayList();

            arr.Add(1);
            arr.Add("2");
            arr.Add(3);
            arr.Add("4");
            arr.Add(5);
            arr.Add("as");

            var casted = arr.OfType <int>();

            foreach (var item in casted)
            {
                Console.WriteLine($"reault is {item}");
            }
            Console.ReadLine();
        }
        public Usuario getUsuario(string nombreUsuario, string clave)
        {
            usuarioDAL usuarioDal = new usuarioDAL();
            Usuario    usuario    = usuarioDal.ConsultarUsuarios(nombreUsuario, clave);

            if (usuario != null)
            {
                Perfil    perfil    = new Perfil();
                PerfilDAL perfilDal = new PerfilDAL();

                perfil = perfilDal.ConsultarPerfil(int.Parse(usuario.Id));

                FuncionDAL funcionDAL = new FuncionDAL();
                ArrayList  funciones  = funcionDAL.ConsultarFunciones(int.Parse(perfil.Id));
                perfil.Funciones = funciones.OfType <Funcion>().ToList();
                usuario.Perfil   = perfil;
            }
            return(usuario);
        }
Example #13
0
        protected override void RealTestOutPut()
        {
            ArrayList al = new ArrayList {
                "First", "Second", "Third", 1, 2
            };

            //var list = al.Cast<string>();       //报错
            //foreach (var i in list)
            //{
            //    println(i);
            //}

            var list = al.OfType <string>();     //过滤掉非string类型

            foreach (var i in list)
            {
                println(i);
            }
        }
        public void CodeGenerationStartedTest()
        {
            // Arrange
            WebPageRazorHost   host     = new WebPageRazorHost("~/Foo/Baz.cshtml", @"C:\Foo\Baz.cshtml");
            RazorBuildProvider provider = CreateBuildProvider("foo @bar baz");

            provider.Host = host;

            // Expected original base dependencies
            var baseDependencies = new ArrayList();

            baseDependencies.Add("/Samples/Foo/Baz.cshtml");

            // Expected list of dependencies after GenerateCode is called
            var dependencies = new ArrayList();

            dependencies.Add(baseDependencies[0]);
            dependencies.Add("/Samples/Foo/Foo.cshtml");

            // Set up the event handler
            provider.CodeGenerationStartedInternal += (sender, e) =>
            {
                var bp = sender as RazorBuildProvider;
                bp.AddVirtualPathDependency("/Samples/Foo/Foo.cshtml");
            };

            // Set up the base dependency
            MockAssemblyBuilder builder = new MockAssemblyBuilder();

            typeof(BuildProvider).GetField("_virtualPath", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(provider, CreateVirtualPath("/Samples/Foo/Baz.cshtml"));

            // Test that VirtualPathDependencies returns the original dependency before GenerateCode is called
            Assert.True(baseDependencies.OfType <string>().SequenceEqual(provider.VirtualPathDependencies.OfType <string>()));

            // Act
            provider.GenerateCodeCore(builder);

            // Assert
            Assert.NotNull(provider.AssemblyBuilderInternal);
            Assert.Equal(builder, provider.AssemblyBuilderInternal);
            Assert.True(dependencies.OfType <string>().SequenceEqual(provider.VirtualPathDependencies.OfType <string>()));
            Assert.Equal("/Samples/Foo/Baz.cshtml", provider.VirtualPath);
        }
Example #15
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** LINQ over ArrayList *****");

            //  这是个非泛型的车集合
            ArrayList myCars = new ArrayList()
            {
                new Car {
                    PetName = "Henry", Color = "Silver", Speed = 100, Make = "BMW"
                },
                new Car {
                    PetName = "Daisy", Color = "Tan", Speed = 90, Make = "BMW"
                },
                new Car {
                    PetName = "Mary", Color = "Black", Speed = 55, Make = "VW"
                },
                new Car {
                    PetName = "Clunker", Color = "Rust", Speed = 5, Make = "Yugo"
                },
                new Car {
                    PetName = "Melvin", Color = "White", Speed = 43, Make = "Ford"
                }
            };

            //  把ArrayList转换成一个兼容与IEnumerable<T>的类型
            var myCarsEnum = myCars.OfType <Car>();

            //  建立兼容类型的查询表达式
            var fastCars = from c in myCarsEnum
                           where c.Speed > 55
                           select c;

            foreach (var car in fastCars)
            {
                Console.WriteLine("{0} is going too fast!", car.PetName);
            }
            Console.WriteLine();

            OfTypeAsFilter();

            Console.ReadLine();
        }
Example #16
0
        static void Main(string[] args)
        {
            ArrayList nhanvien = new ArrayList()
            {
                new Staff {
                    ID = 1, Name = "Nam", Age = 24
                },
                new Staff {
                    ID = 2, Name = "Kien", Age = 21
                },
                new Staff {
                    ID = 3, Name = "Viet", Age = 21
                },
                new Staff {
                    ID = 4, Name = "Hang", Age = 23
                },
                new Staff {
                    ID = 5, Name = "Tien", Age = 24
                }
            };



            var newArrayList = nhanvien.OfType <Staff>();
            var Search       = from name in newArrayList
                               where (name.Age < 24)
                               select name;
            var sapxep = from name in newArrayList
                         orderby name.Name
                         select name;

            Console.WriteLine("Danh sach nguoi co tuoi nho hon 24:");
            foreach (var item in Search)
            {
                Console.WriteLine("ID :" + item.ID + " Name : " + item.Name + " Age : " + item.Age);
            }
            Console.WriteLine("Sap xep theo ten :");
            foreach (var item in sapxep)
            {
                Console.WriteLine("ID :" + item.ID + " Name : " + item.Name + " Age : " + item.Age);
            }
        }
        static void QueryArrayList()
        {
            ArrayList famAnimals = new ArrayList()
            {
                new Animal {
                    Name   = "Heidi",
                    Height = .8,
                    Weight = 18
                },

                new Animal
                {
                    Name   = "Shrek",
                    Height = 4,
                    Weight = 130
                },

                new Animal
                {
                    Name   = "Congo",
                    Height = 3.8,
                    Weight = 90
                }
            };

            // You have to convert the ArrayList into
            // an IEnumerable
            var famAnimalEnum = famAnimals.OfType <Animal>();

            var smAnimals = from animal in famAnimalEnum
                            where animal.Weight <= 90
                            orderby animal.Name
                            select animal;

            foreach (var animal in smAnimals)
            {
                Console.WriteLine("{0} weighs {1}lbs",
                                  animal.Name, animal.Weight);
            }

            Console.WriteLine();
        }
    /// <summary>
    /// 将 System.Collections.IEnumerable 的元素强制转换为指定的类型
    /// </summary>
    public static void Cast()
    {
        // 首先创建一个以前版本的集合
        ArrayList arraylist = new ArrayList();

        // 原本希望在这里初始化,但是这个初始化功能不支持以前的版本
        arraylist.Add("111");
        arraylist.Add("222333");
        arraylist.Add("333333333");
        arraylist.Add("xxxxxxxxx");

        // 数据类型不一直的时候 Cast会抛出异常OfType 则会返回一个空序列
        // IEnumerable<int> lists = arraylist.Cast<int>();
        IEnumerable <int> lists = arraylist.OfType <int>();

        foreach (int list in lists)
        {
            Console.WriteLine(list);
        }
    }
        protected override void OnTick()
        {
            Console.WriteLine("Cleaning Empty Account Vaults.");

            int       numberremoved = 0;
            ArrayList vaultlist     = new ArrayList();

            foreach (AccountVault av in World.Items.Values.OfType <AccountVault>().Select(item => item as AccountVault))
            {
                vaultlist.Add(av);
            }

            foreach (AccountVault av in from item in vaultlist.OfType <AccountVault>() select item as AccountVault into av let list = av.Items where list.Count <= 0 select av)
            {
                av.Delete();
                numberremoved++;
            }

            Console.WriteLine("{0} empty account vaults cleaned up.", numberremoved);
        }
Example #20
0
        ArrayList CtrlSpaceForAttributeValue(string fileContent, XamlExpressionContext context)
        {
            ArrayList attributes = CtrlSpaceForAttributeName(fileContent, context);

            if (attributes != null)
            {
                foreach (IProperty p in attributes.OfType <IProperty>())
                {
                    if (p.Name == context.AttributeName && p.ReturnType != null)
                    {
                        IClass c = p.ReturnType.GetUnderlyingClass();
                        if (c != null && c.ClassType == ClassType.Enum)
                        {
                            return(EnumCompletion(c));
                        }
                    }
                }
            }
            return(null);
        }
        static void QueryArrayList()
        {
            ArrayList arrayAnimals = new ArrayList()
            {
                new Animal
                {
                    Nome   = "Heidi",
                    Altura = .9,
                    Peso   = 18
                },

                new Animal
                {
                    Nome   = "Shrek",
                    Altura = .3,
                    Peso   = 14
                },

                new Animal
                {
                    Nome   = "Congo",
                    Peso   = 3.2,
                    Altura = 1.2
                }
            };

            //convert the array list para IEnumberable
            var animalsEnum = arrayAnimals.OfType <Animal>();

            var animais = from animal in animalsEnum
                          where animal.Altura <= 1
                          orderby animal.Nome descending
                          select animal;

            foreach (var animal in animais)
            {
                Console.WriteLine($"Nome do animal {animal.Nome} e o peso {animal.Peso}");
            }

            Console.WriteLine();
        }
        //creating Query ArayyList

        static void QueryArrayList()
        {
            ArrayList famAnimals = new ArrayList()
            {
                new Animal
                {
                    Name   = "Heidi",
                    Height = .8,
                    Weight = 18
                },

                new Animal
                {
                    Name   = "Shrek",
                    Height = 4,
                    Weight = 130
                },

                new Animal
                {
                    Name   = "Godzilla",
                    Height = 25,
                    Weight = 1000000
                }
            };

            //convert ArrayList to Ienumerable
            var famAnimalEnum = famAnimals.OfType <Animal>();

            var smAnimals = from animal in famAnimalEnum
                            where animal.Weight <= 90
                            orderby animal.Name
                            select animal;

            foreach (var animal in smAnimals)
            {
                Console.WriteLine("{0} wighs {1}lbs",
                                  animal.Name, animal.Weight);
            }
            Console.WriteLine();
        }//end of querry ArrayList
Example #23
0
        // Complete the closestNumbers function below.
        static int[] closestNumbers(int[] arr)
        {
            int temp = 0;
            int diff = 0;

            for (int x = 0; x < arr.Length; x++) // sorting through array
            {
                for (int y = 0; y < arr.Length - 1; y++)
                {
                    if (arr[y] > arr[y + 1])
                    {
                        temp       = arr[y + 1];
                        arr[y + 1] = arr[y];
                        arr[y]     = temp;
                    }
                }
            }

            Dictionary <int[], int> arr1 = new Dictionary <int[], int>(); // using dictionary for computation

            for (int i = 0; i < arr.Length - 1; i++)                      // looping over dictionary to find all the differences possible
            {
                diff = arr[i + 1] - arr[i];
                int[] tempArray = { arr[i], arr[i + 1] };
                arr1.Add(tempArray, diff);
            }
            var min = arr1.Min(x => x.Value); // taking min difference

            ArrayList finalre = new ArrayList();
            var       arrayF  = arr1.Where(x => x.Value == min).ToList(); // converting to list

            foreach (var item in arrayF)                                  //looping over arrayF
            {
                foreach (var k in item.Key)
                {
                    finalre.Add(k);
                }
            }

            return(finalre.OfType <int>().ToArray()); //returning as int array
        }
Example #24
0
        static void Main(string[] args)
        {
            ArrayList list = new ArrayList();

            for (int i = 1; i < 4; i++)
            {
                list.Add(i);
            }

            list.Add("4");
            list.Add("ABC");

            IEnumerable <int> result = list.OfType <int>();

            foreach (int i in result)
            {
                Console.WriteLine(i);
            }

            Console.ReadKey();
        }
Example #25
0
        public IActionResult LinqOfType1()
        {
            ArrayList obj = new ArrayList();

            obj.Add("Iran");
            obj.Add("USA");
            obj.Add(1);
            obj.Add(true);
            obj.Add(55.6);
            obj.Add("UK");
            obj.Add("India");

            //1 Linq Method
            IEnumerable <string> result = obj.OfType <string>();

            //2 Linq Query
            //IEnumerable result = from x in obj.OfType<int>()
            //                     select x;

            return(View(result));
        }
        static void OfTypeAsFilter()
        {
            // Extract the ints from the ArrayList.
            ArrayList myStuff = new ArrayList();

            myStuff.AddRange(new object[] {
                10, 400, 8, false, new Car(), "string data"
            });

            // only pull out the integers from the ArrayList

            var myInts = myStuff.OfType <int>();

            Console.WriteLine("Pulling out integers from ArrayList of mixed types");

            // Prints out 10, 400, and 8.
            foreach (int i in myInts)
            {
                Console.WriteLine("Int value: {0}", i);
            }
        }
Example #27
0
    private void OfTypeQuery()
    {       ///构建数据源
        ArrayList ints = new ArrayList();

        for (int i = 0; i < 100; i++)
        {
            ints.Add(i.ToString());
        }
        ///使用OfType()转换数据类型
        var values = from i in ints.OfType <string>()
                     where i.IndexOf("0") > -1
                     select i;

        ///显示查询结果
        Response.Write("OfType操作的结果:");
        foreach (var v in values)
        {
            Response.Write(v + ",");
        }
        Response.Write("<br />");
    }
Example #28
0
        public static void ArrayListEnum()
        {
            ArrayList stuff = new ArrayList();

            stuff.Add(DateTime.Now);
            stuff.Add(DateTime.Now);
            stuff.Add(1);
            stuff.Add(DateTime.Now);

            // lazy exception
            var expr = from item in stuff.Cast <DateTime>()
                       select item;

            expr = from item in stuff.OfType <DateTime>()
                   select item;

            foreach (DateTime item in expr)
            {
                Console.WriteLine(item);
            }
        }
Example #29
0
        static void QuerryArrayList()
        {
            ArrayList famAnimals = new ArrayList()
            {
                new Animal("Heidi", .8, 18),
                new Animal("Shrek", 4, 130),
                new Animal("COngo", 3.8, 90)
            };

            var famAnimalEnum = famAnimals.OfType <Animal>();

            var smAnimals = from animal in famAnimalEnum
                            where animal.Weight <= 90
                            orderby animal.Name
                            select animal;

            foreach (var sn in smAnimals)
            {
                Console.WriteLine("{0}   {1}   {2}", sn.Name, sn.Weight, sn.Height);
            }
        }
Example #30
0
        public static void PrintOftype()
        {
            var arr = new object[5];

            arr[0] = new StringBuilder();
            arr[1] = "string";
            arr[2] = "integer";
            arr[3] = new int[1];
            arr[4] = new double[3];

            var arrayList = new ArrayList {
                new StringBuilder(), "string1", "string2", new int[1], 1, 2, 3.1
            };

            var ofTypeArr = arrayList.OfType <double>();

            foreach (var i in ofTypeArr)
            {
                Console.WriteLine("{0:0.0}", i);
            }
        }
Example #31
0
        static void QueryArrayList()
        {
            ArrayList famAnimals = new ArrayList()
            {
                new Animal
                {
                    Name   = "Heidi",
                    Height = .8,
                    Weight = 18
                },

                new Animal
                {
                    Name   = "Shrek",
                    Height = 4,
                    Weight = 130
                },

                new Animal
                {
                    Name   = "Congo",
                    Height = 3.8,
                    Weight = 90
                },
            };

            // Must convert arraylist to enumerable before query
            var famAnimalEnum = famAnimals.OfType <Animal>();
            var smAnimals     = from animal in famAnimalEnum
                                where animal.Weight <= 90
                                orderby animal.Name
                                select animal;

            foreach (var animal in smAnimals)
            {
                Console.WriteLine(animal);
            }

            Console.WriteLine();
        }
Example #32
0
    private void setHueCircleColors()
    {
        CPUBuffers.Get.IngredientGroupsColor.Clear();
        CPUBuffers.Get.IngredientGroupsLerpFactors.Clear();
        CPUBuffers.Get.IngredientGroupsColorValues.Clear();
        CPUBuffers.Get.IngredientGroupsColorRanges.Clear();
        CPUBuffers.Get.ProteinIngredientsRandomValues.Clear();
        CPUBuffers.Get.ProteinIngredientsChainColors.Clear();
        CPUBuffers.Get.IngredientsColors.Clear();

        int[] numMembersIngredientGroups = new int[SceneManager.Get.IngredientGroups.Count];
        ArrayList numMembersIngredients = new ArrayList();
        for (int i = 0; i< SceneManager.Get.IngredientGroups.Count; i++)
        {
            numMembersIngredientGroups[i] = SceneManager.Get.IngredientGroups[i].Ingredients.Count;
            for (int j = 0; j< SceneManager.Get.IngredientGroups[i].Ingredients.Count; j++)
            {
                numMembersIngredients.Add(SceneManager.Get.IngredientGroups[i].Ingredients[j].nbChains);
            }
        }
        float[] anglefractions;
        float[] angleCentroids;
        float[] ingredientsAnglefractions;
        float[] ingredientsAngleCentroids;
        float startangle = 0;
        float endangle = 360;
        
        getFractionsAndCentroid(numMembersIngredientGroups, startangle, endangle, out anglefractions, out angleCentroids);
        getFractionsAndCentroid(numMembersIngredients.OfType<int>().ToArray(), startangle, endangle, out ingredientsAnglefractions, out ingredientsAngleCentroids);
        
        for (int i = 0; i< SceneManager.Get.IngredientGroups.Count; i++)
        {
            Debug.Log("anglecentroid i " + i + " " + angleCentroids[i]);
            Debug.Log("anglefractions i "+ i + " " + anglefractions[i]);
            CPUBuffers.Get.IngredientGroupsColor.Add(new Color(angleCentroids[i]/360f, 60f/100f,70f/100f));
            var group = SceneManager.Get.IngredientGroups[i];
            var offsetInc = 1.0f / group.Ingredients.Count;
            for (int j = 0; j<group.Ingredients.Count; j++)
            {
                Debug.Log("j loop i " + i);
                Debug.Log("loop anglecentroid i " + i + " " + angleCentroids[i]);
                CPUBuffers.Get.IngredientsColors.Add(new Vector4(angleCentroids[i] + anglefractions[i] * (j * offsetInc - 0.5f),60, 70));
                CPUBuffers.Get.IngredientGroupsLerpFactors.Add(0);
                CPUBuffers.Get.IngredientGroupsColorValues.Add(new Vector4(angleCentroids[i], 60, 90));// 15 + Random.value * 85));
                CPUBuffers.Get.IngredientGroupsColorRanges.Add(new Vector4(anglefractions[i], 0, 0));
                CPUBuffers.Get.ProteinIngredientsRandomValues.Add(new Vector4(j * offsetInc, 0, 0));

                
                var ingredient = group.Ingredients[j];
                var chainOffset = 1.0f / ingredient.nbChains;
                for (int k = 0; k< ingredient.nbChains; k++)
                {
                    float currentHue = ingredientsAngleCentroids[j] + (k * chainOffset - 0.5f)*ingredientsAnglefractions[j];
                    float currentChroma = 60f;
                    float currentLuminance = 60f;
                    CPUBuffers.Get.ProteinIngredientsChainColors.Add(new Vector4(Random.value * 360, currentChroma, 50 + Random.value * 20));

                }

            }
        }



        

    }