Exemple #1
0
        public void buildCool(opis template, opis partition)
        {
            for (int i = 0; i < template.listCou; i++)
            {
                opis srch = new opis();
                srch.body          = getChemaVal(template[i].body, "?");
                srch.PartitionName = getChemaVal(template[i].PartitionName, "?");
                srch.PartitionKind = getChemaVal(template[i].PartitionKind, "?");

                opis found = new opis();

                partition.FindTreePartitions(srch, "", found, false);

                if (found.listCou > 0)
                {
                }

                string pn = template[i].PartitionName.Replace("$", "").Replace("#", "");
                if (template[i].PartitionName == "^")
                {
                    pn = partition.body;
                }
                if (template[i].PartitionName == "@")
                {
                    pn = partition.body;
                }

                if (partition.getPartitionIdx(pn) != -1)
                {
                    // якщо потрібно додати значення PartitionName в контейнер
                    // перед PartitionName ставить $ а в PartitionKind вказати імя по котрому буде доступне значення
                    if (template[i].PartitionName.StartsWith("$"))
                    {
                        //roleObject[template[i].PartitionKind].body = pn;
                        //if (string.IsNullOrEmpty(template[i].body))
                        //{
                        roleObject.Vset(pn, partition.V(pn));
                        //}
                    }

                    // все дерево копіюється
                    if (template[i].PartitionName.StartsWith("#"))
                    {
                        if (modelSpec.isHere(do_not_duplicate_branch))
                        {
                            roleObject[pn].Wrap(partition[pn].W());
                        }
                        else
                        {
                            roleObject[pn] = partition[pn].Duplicate();
                        }
                    }

                    if (template[i].body.StartsWith("$"))
                    {
                        roleObject[template[i].body.Replace("$", "")].body = partition[pn].body;
                    }


                    if (template[i].listCou > 0)
                    {
                        buildCool(template[i], partition[pn]);
                    }
                }
            }
        }
Exemple #2
0
        public void buildCool(opis template, opis partition)
        {
            for (int i = 0; i < template.listCou; i++)
            {
                opis tt   = template[i];
                opis srch = new opis();

                srch.body          = getChemaVal(tt.body, "?", "");
                srch.PartitionName = getChemaVal(tt.PartitionName, "?", "");
                srch.PartitionKind = getChemaVal(tt.PartitionKind, "?", "");

                opis found = new opis();

                partition.FindTreePartitions(srch, "", found, false);

                if (found.listCou > 0)
                {
                    opis fop = found[0][0];

                    // = operate duplicated object
                    if (tt.PartitionName.Contains("="))
                    {
                        fop = fop.Duplicate();
                    }

                    // ^ operate unwrapped object
                    if (tt.PartitionName.Contains("^"))
                    {
                        fop = fop.W();
                    }

                    // * fill array
                    if (tt.PartitionName.Contains("*"))
                    {
                        string apn = getChemaVal(tt.PartitionName, "*", srch.PartitionName);
                        opis   itm = new opis();
                        itm.PartitionName = apn;
                        itm.CopyArr(fop);
                        roleObject.AddArr(itm);
                    }

                    // @ wrap partition
                    if (tt.PartitionName.Contains("@"))
                    {
                        string apn = getChemaVal(tt.PartitionName, "@", srch.PartitionName);
                        opis   itm = new opis();
                        itm.PartitionName = apn;
                        itm.Wrap(fop);
                        roleObject.AddArr(itm);
                    }

                    // # put as is
                    if (tt.PartitionName.Contains("#"))
                    {
                        roleObject.AddArr(fop);
                    }

                    // $ put body value as (usable in body )
                    if (tt.body.Contains("$"))
                    {
                        string apn = getChemaVal(tt.body, "$", srch.PartitionName);
                        opis   itm = new opis();
                        itm.PartitionName = apn;
                        itm.body          = fop.body;
                        roleObject.AddArr(itm);
                    }

                    //recurce
                    if (tt.listCou > 0)
                    {
                        buildCool(tt, fop);
                    }
                }
            }
        }