Exemple #1
0
        private void SimplifyPhase1(NvdlRule r, NvdlCompileContext ctx)
        {
            ctx.AddRuleContext(this, r);
            // 6.4.9
            ArrayList al = new ArrayList();

            foreach (NvdlAction a in r.Actions)
            {
                NvdlNoCancelAction nca =
                    a as NvdlNoCancelAction;
                if (nca != null)
                {
                    if (nca.ModeUsage != null)
                    {
                        SimplifyModeUsage(nca, ctx);
                    }
                    NvdlResultAction ra = nca as NvdlResultAction;
                    if (ra != null)
                    {
                        al.Add(new SimpleResultAction(ra, ctx));
                    }
                    else if (nca is NvdlValidate)
                    {
                        al.Add(new SimpleValidate(
                                   (NvdlValidate)nca, ctx));
                    }
                    else if (nca is NvdlAllow)
                    {
                        al.Add(new SimpleValidate(
                                   (NvdlAllow)nca, ctx));
                    }
                    else
                    {
                        al.Add(new SimpleValidate(
                                   (NvdlReject)nca, ctx));
                    }
                }
                else if (nca == null)
                {
                    ctx.CancelledRules.Add(this, this);
                }
            }
            actions = (SimpleAction [])al.ToArray(
                typeof(SimpleAction));
        }
Exemple #2
0
		private void SimplifyPhase1 (NvdlRule r, NvdlCompileContext ctx)
		{
			ctx.AddRuleContext (this, r);
			// 6.4.9
			ArrayList al = new ArrayList ();
			foreach (NvdlAction a in r.Actions) {
				NvdlNoCancelAction nca =
					a as NvdlNoCancelAction;
				if (nca != null) {
					if (nca.ModeUsage != null)
						SimplifyModeUsage (nca, ctx);
					NvdlResultAction ra = nca as NvdlResultAction;
					if (ra != null)
						al.Add (new SimpleResultAction (ra, ctx));
					else if (nca is NvdlValidate)
						al.Add (new SimpleValidate (
							(NvdlValidate) nca, ctx));
					else if (nca is NvdlAllow)
						al.Add (new SimpleValidate (
							(NvdlAllow) nca, ctx));
					else
						al.Add (new SimpleValidate (
							(NvdlReject) nca, ctx));
				}
				else if (nca == null)
					ctx.CancelledRules.Add (this, this);
			}
			actions = (SimpleAction []) al.ToArray (
				typeof (SimpleAction));
		}