Example #1
0
        public override void Process(opis message)
        {
            if (modelSpec.getPartitionIdx(LoadContext) != -1)
            {
                int  idx = SharedContextRoles.GetRole(SharedContextRoles.ProcessIndex, sharedVal).intVal;
                opis currentContextItem = new opis();

                if (contexts.listCou > idx)
                {
                    currentContextItem = contexts[idx];
                }
                else
                {
                    currentContextItem.PartitionName = "currentContextItem";
                    currentContextItem.body          = "ERR: index is out of range";
                }


                SharedContextRoles.SetRole(currentContextItem, "currentContext", sharedVal);
            }

            if (modelSpec.getPartitionIdx(GetCount) != -1)
            {
                message.intVal = contexts.listCou;
            }

            if (modelSpec.isHere(GetAllArray))
            {
                message.AddArr(contexts);
            }
        }
Example #2
0
        public override void Process(opis message)
        {
            opis locSeq   = modelSpec[sequence].Duplicate();
            opis locModel = modelSpec;

            message = message.PartitionKind == "wrapper" ? message.W() : message;


            opis srs = message;

            if (locModel[source].isInitlze || !string.IsNullOrEmpty(locModel[source].PartitionKind))
            {
                srs = locModel[source].Duplicate();
                instanse.ExecActionModel(srs, srs);
            }

            opis idx = new opis();

            SharedContextRoles.SetRole(idx, SharedContextRoles.ProcessIndex, sharedVal);

            string rl = SharedContextRoles.procItem;

            if (locModel[role].isInitlze)
            {
                rl = locModel[role].body;
            }

            bool backward = locModel.OptionActive(move_backward);
            bool procItm  = locModel.OptionActive(models_process_item);

            for (int i = 0; i < srs.listCou; i++)
            {
                int pos = i;
                if (backward)
                {
                    pos = srs.listCou - i - 1;
                }

                if (procItm)
                {
                    instanse.ExecActionResponceModelsList(locSeq.Duplicate(), srs[pos].W());
                }
                else
                {
                    SharedContextRoles.GetRole(SharedContextRoles.ProcessIndex, sharedVal).intVal = pos;
                    SharedContextRoles.SetRole(srs[pos].W(), rl, sharedVal);

                    instanse.ExecActionModelsList(locSeq.Duplicate());
                }

                // повертаємо інстанс в поточний контекст
                instanse.Handle(o); //на випадок коли інстанс може отримувати повідомлення
                // чи відповіді в процесі виконання попереднього циклу
                // отримавши повідомлення змінюється поточний контекст інстанса
                // і через це наступний цикл не має доступу до SDC - виникає збій
            }
        }
Example #3
0
        public override void Process(opis message)
        {
            opis surc = message;
            opis svc  = sharedVal;

            opis iter = SharedContextRoles.GetRole(modelSpec[Iterator].body, svc);

            if (iter.PartitionKind == "null" || !iter.isInitlze ||
                (modelSpec.isHere(reinit_iterator) &&
                 iter[source].listCou == iter["pos"].intVal &&
                 iter["pos"].intVal > 0))
            {
                opis ex = modelSpec.Duplicate();
                instanse.ExecActionModelsList(ex);

                if (ex.isHere(source))
                {
                    surc = ex[source];
                }

                iter             = new opis("iterator");
                iter[source]     = surc;
                iter["pos"].body = "0";

                SharedContextRoles.SetRole(iter, modelSpec[Iterator].body, svc);
            }

            if (modelSpec.isHere(loop) && iter[source].listCou == iter["pos"].intVal)
            {
                iter["pos"].body = "0";
            }


            opis itm = null;

            if (iter[source].listCou > iter["pos"].intVal)
            {
                itm = iter[source][iter["pos"].intVal];
                iter["pos"].intVal++;
                SharedContextRoles.SetRole(itm, modelSpec.V(role), svc);
            }
            else
            {
                SharedContextRoles.SetRole(new opis(), modelSpec.V(role), svc);
            }


            if (itm != null)
            {
                instanse.ExecActionResponceModelsList(modelSpec[responce][ConditionResponceModel.yess], itm);
            }
            else
            {
                instanse.ExecActionResponceModelsList(modelSpec[responce][ConditionResponceModel.no], new opis());
            }
        }
Example #4
0
        public override void Process(opis message)
        {
            roleObject = new opis("valuesContainer");
            opis locModSp = modelSpec.Duplicate();
            opis locShVal = sharedVal;

            instanse.ExecActionModelsList(locModSp);

            string rolename = locModSp[containerRole].isInitlze? locModSp.V(containerRole) : "valuesContainer";

            if (SharedContextRoles.GetRole(rolename, locShVal).PartitionKind != "null" &&
                locModSp.getPartitionIdx(appendContainer) != -1)
            {
                roleObject = SharedContextRoles.GetRole(rolename, locShVal);
            }

            SharedContextRoles.SetRole(roleObject, rolename, locShVal);

            opis srs = message;

            if (locModSp.getPartitionIdx(source) != -1)
            {
                srs = locModSp[source];
                //instanse.ExecActionModel(srs, srs);
            }

            srs = srs.W();

            opis bp = locModSp[blueprint];

            if (!locModSp.isHere(do_not_add_metadata))
            {
                roleObject.Vset("list_cou", srs.listCou.ToString());
                roleObject.Vset("name", srs.PartitionName);
                roleObject.Vset("val", srs.body);
            }
            //logopis.WrapByName(srs.Duplicate(), "srs_debug");

            modelSpec = locModSp;

            if (modelSpec.isHere(new_template_type))
            {
                buildCool(bp, srs);
            }
            else
            {
                build(bp, srs);
            }

            //logopis["srs"].Wrap( srs);
            //logopis.WrapByName(roleObject, "roleObject");
        }
Example #5
0
        public override void Process(opis message)
        {
            opis source = o;

            if (modelSpec[sdc_Role].isInitlze)
            {
                source = SharedContextRoles.GetRole(modelSpec[sdc_Role].body, sharedVal);
            }
            if (source != null)
            {
                opis t = contex.GetHierarchyStub(source);
                message.body = t.body;
                message.CopyArr(t);
            }
        }
        public override void Process(opis message)
        {
            if (message.PartitionKind == name)
            {
                message.PartitionKind += "_done";
            }

            if (message.listCou > 0 && message.getPartitionIdx(Wrap) == -1)
            {
                string name = message[0].PartitionName;
                opis   tmp  = SharedContextRoles.GetRole(name, sharedVal);

                message.body = tmp.body;
                message.CopyArr(tmp);

                if (modelSpec.getPartitionIdx(Wrap) != -1)
                {
                    message.Wrap(tmp);
                }
                else
                {
                    message.body = tmp.body;
                    message.CopyArr(tmp);
                }
            }
            else
            {
                string name = message.body;
                if (!string.IsNullOrEmpty(name))
                {
                    opis tmp = SharedContextRoles.GetRole(name, sharedVal);

                    if (modelSpec.getPartitionIdx(Wrap) != -1)
                    {
                        message.Wrap(tmp);
                    }
                    else
                    {
                        message.body = tmp.body;
                        message.CopyArr(tmp);
                    }
                }
            }
        }
Example #7
0
        //TODO: find out why filler (in log it is comon bug) return arbitrary values
        //TODO: find out why decode text _ modify its source value

        public override void Process(opis message)
        {
            opis source = null;

            opis currSpec = modelSpec;

            int pnIdx = modelSpec.getPartitionIdx(sdc_item);

            if (pnIdx != -1)
            {
                opis svc = sharedVal;
                opis p   = modelSpec[pnIdx].Duplicate();
                instanse.ExecActionModel(p, p);

                int pos = svc.getPartitionIdx(p.body);
                source = pos != -1 ? svc[pos] : null;

                if (source == null && currSpec.OptionActive(create))
                {
                    source = svc[p.body];
                }
            }
            else

            if (modelSpec.isHere(sdc_Role))
            {
                opis p = modelSpec[sdc_Role].Duplicate();
                instanse.ExecActionModel(p, p);

                source = SharedContextRoles.GetRole(p.body, sharedVal);
                if (source.PartitionKind == "null" && currSpec[create].isInitlze)
                {
                    source = new opis();
                    SharedContextRoles.SetRole(source, p.body, sharedVal);
                }

                if (source.PartitionKind == "null")
                {
                    source = null;
                }
            }
            else

            if (modelSpec.getPartitionIdx(thisins_data) != -1)
            {
                source = thisins;
            }
            else
            if (modelSpec.getPartitionIdx(spec_data) != -1)
            {
                source = spec;
            }

            modelSpec = currSpec;

            if (source != null)
            {
                opis rez = source;

                opis templ = modelSpec.getPartitionNotInitOrigName(template)?.Duplicate();
                if (templ != null)
                {
                    instanse.ExecActionModel(templ, templ);

                    if (templ.listCou > 0)
                    {
                        rez = GetLevelCheck(templ[0], source.W(), modelSpec.OptionActive(templateUnwrap));
                    }
                }


                modelSpec = currSpec;

                if (rez != null)
                {
                    // in case modelSpec and message referencing the same data
                    opis procSpec = modelSpec.getPartitionNotInitOrigName(process)?.Duplicate();

                    rez = rez.W();

                    if (currSpec.OptionActive(duplicate))
                    {
                        rez = rez.Duplicate();
                    }

                    if (!currSpec.OptionActive(do_not_modify))
                    {
                        if (currSpec.OptionActive(do_wrap))
                        {
                            message.CopyArr(new opis());
                            message.Wrap(rez.W());
                        }
                        else
                        {
                            message.body = rez.body;
                            message.CopyArr(rez);
                        }

                        if (message.PartitionKind == name)
                        {
                            message.PartitionKind += "_done";
                        }
                    }

                    if (procSpec != null)
                    {
                        instanse.ExecActionResponceModelsList(procSpec, rez);
                    }
                }
                else if (!currSpec.OptionActive(do_not_modify))
                {
                    message.body = "";
                    message.CopyArr(new opis());
                }
            }
            else
            {
                if (message.PartitionName == "value")
                {
                    message.CopyArr(new opis());
                }
            }
        }
Example #8
0
        public override void Process(opis message)
        {
            opis bp     = modelSpec[blueprint].Duplicate();
            var  locmod = modelSpec;

            instanse.ExecActionModel(bp, bp);
            modelSpec = locmod;

            opis vk = sharedVal;

            if (bp.listCou > 0)
            {
                if (modelSpec.isHere(values_container, false))
                {
                    opis t = null;
                    if (modelSpec[values_container].isInitlze ||
                        !string.IsNullOrEmpty(modelSpec[values_container].PartitionKind))
                    {
                        t = modelSpec[values_container].Duplicate();

                        locmod = modelSpec;
                        instanse.ExecActionModel(t, t);
                        modelSpec = locmod;
                    }
                    else
                    {
                        t = SharedContextRoles.GetRole("valuesContainer", sharedVal);
                    }

                    vk = t.W();
                }

                build(bp, null, vk, modelSpec.isHere(func_symbols_ignore, false), modelSpec.isHere(only_body_template_optimization, false));


                if (bp.listCou == 1)
                {
                    if (locmod.isHere(putWholeResult, false))
                    {
                        message.PartitionKind = "";
                        message.CopyArr(bp);
                        return;
                    }

                    if (message.PartitionName == "value")
                    {
                        if (modelSpec.isHere(only_value_body))
                        {
                            message.CopyArr(new opis());
                            message.body = bp[0].body;
                        }
                        else
                        {
                            message.Wrap(bp[0]);
                        }
                    }
                    else
                    {
                        message.body          = bp[0].body;
                        message.PartitionName = string.IsNullOrEmpty(bp[0].PartitionName) ? message.PartitionName : bp[0].PartitionName;
                        message.PartitionKind = bp[0].PartitionKind;
                        if (modelSpec.isHere(only_value_body, false))
                        {
                            message.CopyArr(new opis());
                        }
                        else
                        {
                            message.CopyArr(bp[0]);
                        }
                    }
                }
                else
                {
                    message.PartitionKind = "";
                    message.CopyArr(bp);
                }
            }
        }