public string generate(string nidHttpResFunc) { var returnNode = new NRFunctionNode(); var switchNode = new NRSwitchNode(NRSwitchNode.PropertyType.GLOBAL, property: "currStep", checkall: false); var i = 0; var behavior = _activity.Behavior; foreach (var stepTiming in behavior.StepTimings) { var nidStep = generateStepFlow(stepTiming, returnNode.Id); var rule = new NRSwitchRule(NRSwitchRule.OperatorType.EQ, (i + 1).ToString(), NRSwitchRule.ValueType.Num); switchNode.AddRule(rule); switchNode.Wire(nidStep, i); ++i; } returnNode.Wire(nidHttpResFunc); returnNode.WriteTo(_writer); switchNode.WriteTo(_writer); return(switchNode.Id); }
private string generateSwitchActivityFlow(IEnumerable <string> nidsActivity, string nidHttpRes) { var switchNode = new NRSwitchNode(NRSwitchNode.PropertyType.GLOBAL, property: "currActivity", checkall: false); var i = 0; NRSwitchRule rule; foreach (var nid in nidsActivity) { rule = new NRSwitchRule(NRSwitchRule.OperatorType.EQ, (i + 1).ToString(), NRSwitchRule.ValueType.Num); switchNode.AddRule(rule); switchNode.Wire(nid, i); ++i; } var nidEndOfTask = generateHttpResFuncNode(nidHttpRes, i, 1, true); rule = new NRSwitchRule(NRSwitchRule.OperatorType.EQ, (i + 1).ToString(), NRSwitchRule.ValueType.Num); switchNode.AddRule(rule); switchNode.Wire(nidEndOfTask, i); switchNode.WriteTo(_writer); return(switchNode.Id); }