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); } } } }
public override void Process(opis message) { opis ms = SpecLocalRunAll(); var srs = ms[source]; message.CopyArr(new opis()); if (ms.isHere(car, false)) { message.Wrap(srs.listCou > 0 ? srs[0] : new opis()); } if (ms.isHere(cdr, false)) { message.CopyArr(srs); message.RemoveArrElem(0); } }
public override void Process(opis message) { if (message.PartitionKind == name) { message.PartitionKind += "_done"; } string nm = message.body; int idx = sharedVal.getPartitionIdx(nm); opis tmp = idx != -1 ? sharedVal[idx].W() : new opis();// SharedContextRoles.GetRole(nm, sharedVal); if (modelSpec.getPartitionIdx("W") != -1) { message.Wrap(tmp); } else { message.body = tmp.body; message.CopyArr(tmp); } }
public static opis GetHierarchyStub(opis contextp) { opis loc = contextp; opis rez = new opis("context"); rez.Vset(context.ID, contextp.V(context.ID)); opis high = rez[context.Higher]; while (loc[context.Higher].isInitlze) { loc = loc.W(context.Higher); opis t = new opis(); t.PartitionName = loc.V(context.ID); t.Vset(context.ID, loc.V(context.ID)); high.Wrap(t); high = t[context.Higher]; } return(rez); }
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); } } } }
//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()); } } }
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); } } }
public void build(opis bp, opis holder, opis valContainer, bool funcSymbIgnore, bool onlyBody) { bool donotrecurce = !modelSpec.isHere(recurce_all) && bp.PartitionKind == "buildTreeVal_sdc_i"; string bp_body = bp.body; // if (bp.body.StartsWith("$")) if (bp_body.Length > 0 && bp_body[0] == '$') { bp.body = valContainer[bp.body.Replace("$", "")].body; } else { if (!onlyBody && (bp_body.Length > 0 && bp_body[0] == '&')) //bp_body.StartsWith("&")) { if (bp_body.StartsWith("&b")) { bp.body = valContainer.body; } else if (bp_body.StartsWith("&p")) { bp.body = valContainer.PartitionName; } else if (bp_body.StartsWith("&k")) { bp.body = valContainer.PartitionKind; } } } if (!onlyBody) { if (bp.PartitionName.Length > 0 && bp.PartitionName[0] == '$') { bp.PartitionName = valContainer[bp.PartitionName.Replace("$", "")].body; } if (bp.PartitionName.Length > 0 && bp.PartitionName[0] == '&') { if (bp.PartitionName.StartsWith("&b")) { bp.PartitionName = valContainer.body; } else if (bp.PartitionName.StartsWith("&p")) { bp.PartitionName = valContainer.PartitionName; } } if (!string.IsNullOrEmpty(bp.PartitionKind)) { if (bp.PartitionKind.StartsWith("$")) { bp.PartitionKind = valContainer[bp.PartitionKind.Replace("$", "")].body; } else if (bp.PartitionKind == "&b") { bp.PartitionKind = valContainer.body; } else if (bp.PartitionKind == "&p") { bp.PartitionKind = valContainer.PartitionName; } } if (!funcSymbIgnore && bp_body.Length > 0) { switch (bp_body[0]) { case '*': donotrecurce = true; if (bp_body.Length > 1) { bp.CopyArr(valContainer[bp_body.Replace("*", "")].W()); } else { bp.CopyArr(valContainer); } bp.body = ""; break; case '+': donotrecurce = true; if (bp_body.Length > 1) { bp.AddArrRange(valContainer[bp_body.Replace("+", "")].W()); } else { bp.AddArrRange(valContainer); } bp.body = ""; break; case '@': donotrecurce = true; if (bp_body.Length > 1) { bp.Wrap(valContainer[bp_body.Replace("@", "")].W()); } else { bp.Wrap(valContainer.W()); } break; case '%': bp.body = "random body " + rnd.Next().ToString() + rnd.Next().ToString(); break; } } // # in PartitionName means that whole tree must be assigned // if (bp.PartitionName.StartsWith("#")) if (bp.PartitionName.Length > 0 && bp.PartitionName[0] == '#') { donotrecurce = true; opis branchVal = valContainer[bp.PartitionName.Replace("#", "")].W(); if (!modelSpec.isHere(do_not_duplicate_branch) || bp.PartitionName.StartsWith("##")) { branchVal = branchVal.DuplicateA(); bp.PartitionName = branchVal.PartitionName; bp.body = branchVal.body; if (string.IsNullOrEmpty(bp.PartitionKind)) { bp.PartitionKind = branchVal.PartitionKind; } bp.CopyArr(branchVal); } else { if (holder != null) { if (modelSpec.isHere(if_not_duplicate_only_Copy_array)) { bp.PartitionName = branchVal.PartitionName; bp.body = branchVal.body; if (string.IsNullOrEmpty(bp.PartitionKind)) { bp.PartitionKind = branchVal.PartitionKind; } bp.CopyArr(branchVal); } else { bp.PartitionName = branchVal.PartitionName; holder[bp.PartitionName] = branchVal; if (!string.IsNullOrEmpty(bp.PartitionKind)) { branchVal.PartitionKind = bp.PartitionKind; } } } } } bp.body = bp.body?.Replace("{star}", "*"); } if (!donotrecurce) { for (int i = 0; i < bp.listCou; i++) { build(bp[i], bp, valContainer, funcSymbIgnore, onlyBody); } } }
public override void Process(opis message) { opis locOpis = modelSpec; long integerVal = 0; string oper = modelSpec.V(operation); string opSpec = locOpis.V(operationSpec); long lv = 0; #region what to process opis val = locOpis[value].Duplicate(); bool unwr = !locOpis.OptionActive(do_not_value_Unwrap); if (unwr) { val = val.W(); } if (!locOpis.OptionActive(do_not_exec_value)) { // obsolete functionality, remove if use fresh context if (string.IsNullOrEmpty(val.PartitionKind) && val.listCou > 0) { instanse.ExecActionModelsList(val); } instanse.ExecActionModel(val, val); } modelSpec = locOpis; if (unwr) { val = val.W(); } if (modelSpec.isHere(clear_func, false)) { val.PartitionKind = ""; for (int i = 0; i < val.listCou; i++) { val[i].PartitionKind = ""; } } opis processThis = message; opis templ = modelSpec.getPartitionNotInitOrigName(partition)?.Duplicate(); if (templ != null) { if (templ.PartitionKind != "template") { instanse.ExecActionModel(templ, templ); } else if (templ.listCou > 0) { instanse.ExecActionModelsList(templ); } if (templ.listCou > 0) { processThis = opis.GetLevelByTemplate(templ[0], processThis, true); } } #endregion switch (oper) { case "rename": opis ft = locOpis[operationSpec].Duplicate(); instanse.ExecActionModel(ft, ft); processThis.PartitionName = ft.body; break; case "setmodel": opis pv = locOpis[value].Duplicate(); instanse.ExecActionModel(pv, pv); processThis.PartitionKind = pv.body; break; case "conc ower": for (int i = 0; i < val.listCou; i++) { processThis[val[i].PartitionName] = val[i]; } break; case "conc stay": processThis.AddArrMissing(val); break; case "dec": lv = StrUtils.LongFromString(processThis.body); integerVal = StrUtils.LongFromString(val.body); processThis.body = (lv - integerVal > 0 ? lv - integerVal : 0).ToString(); break; case "inc": lv = StrUtils.LongFromString(processThis.body); integerVal = StrUtils.LongFromString(val.body); processThis.body = (lv + (integerVal > 0 ? integerVal : 1)).ToString(); break; case "add_arr_i": integerVal = opSpec == "all" ? 1 : (opSpec == "new" ? 2 : 0); for (int i = 0; i < val.listCou; i++) { if (integerVal == 1) { processThis.AddArr(val[i]); } else { if (processThis.getPartitionIdx(val[i].PartitionName) == -1) { processThis.AddArr(val[i]); } else if (!(integerVal == 2)) { if (processThis[val[i].PartitionName].body != val[i].body || processThis[val[i].PartitionName].listCou != val[i].listCou) { processThis.AddArr(val[i]); } } } } break; case "add_arr": if (!(opSpec == "uniq")) { processThis.AddArr(val); } else { if (processThis.getPartitionIdx(val.PartitionName) == -1 || processThis[val.PartitionName].body != val.body || processThis[val.PartitionName].listCou != val.listCou) { processThis.AddArr(val); } } break; case "set": if (opSpec == "w") { processThis.Wrap(val.W()); } else { processThis.body = val.body; processThis.CopyArr(val); } break; case "set b": processThis.body = val.body; break; } }