コード例 #1
0
ファイル: ProcessScript.cs プロジェクト: alasdairhurst/nginn
        public object EvaluateFlowInputCondition(Flow fl)
        {
            string key = string.Format("Flow_{0}_{1}", fl.From.Id, fl.To.Id);

            return ExecuteScript(key, delegate()
            {
                return fl.InputCondition;
            });
        }
コード例 #2
0
 public object EvaluateFlowInputCondition(Flow fl)
 {
     throw new NotImplementedException();
 }
コード例 #3
0
 /// <summary>
 /// Check flow input condition
 /// </summary>
 /// <param name="fl"></param>
 /// <returns></returns>
 private bool EvaluateFlowInputCondition(Flow fl)
 {
     if (fl.InputCondition == null || fl.InputCondition.Length == 0) return true; //empty condition is true
     IProcessScript ctx = CreateProcessScriptContext();
     object v = ctx.EvaluateFlowInputCondition(fl);
     return Convert.ToBoolean(v);
 }
コード例 #4
0
ファイル: Place.cs プロジェクト: alasdairhurst/nginn
 private static int CompareFlowOrder(Flow f1, Flow f2)
 {
     if (f1.EvalOrder < 0) return 1;
     if (f2.EvalOrder < 0) return -1;
     if (f1.EvalOrder < f2.EvalOrder)
         return -1;
     else if (f1.EvalOrder > f2.EvalOrder)
         return 1;
     else
         return 0;
 }
コード例 #5
0
ファイル: Place.cs プロジェクト: alasdairhurst/nginn
 internal void AddFlowOut(Flow f)
 {
     if (f.From != this) throw new Exception("Invalid flow source");
     if (f.To == null) throw new Exception("Missing flow target");
     Flow tm;
     if (_flowsOut.TryGetValue(f.To.Id, out tm))
     {
         if (tm != f) throw new Exception("Flow already defined to " + f.To.Id);
     }
     else
     {
         _flowsOut[f.To.Id] = f;
     }
 }
コード例 #6
0
 /// <summary>
 /// Check flow input condition
 /// </summary>
 /// <param name="fl"></param>
 /// <returns></returns>
 private bool EvaluateFlowInputCondition(Flow fl)
 {
     if (fl.InputCondition == null || fl.InputCondition.Length == 0) return true; //empty condition is true
     IScriptContext ctx = CreateProcessScriptContext();
     string expr = fl.InputCondition.Trim();
     if (!expr.EndsWith(";")) expr += ";";
     log.Debug("Evaluating flow {0} input condition: {1}", fl.ToString(), expr);
     object res = Script.RunCode(expr, ctx);
     log.Debug("Result: {0}", res);
     return Convert.ToBoolean(res);
 }