예제 #1
0
파일: VMif.cs 프로젝트: raket124/thesis
        public VMif(MyIf root, VMfunction parent) : base(root, parent)
        {
            this.CommandOpen = new DelegateCommand(() => new IfWindow()
            {
                DataContext = this
            }.ShowDialog());

            this.Condition = new VMcondition(this.Root.Condition, this);
        }
예제 #2
0
        private static string Convert(MyIf input, Function f, ref int i)
        {
            var conditionList = new Dictionary <string, string>();

            foreach (var c in input.Condition.Conditions)
            {
                conditionList.Add(c.Alias, string.Format("{0} {1} {2}", ConvertOutput(c.LHS.Output), new VMconditionBaseCompare(c.Comparison).Value, ConvertOutput(c.RHS.Output)));
            }

            if (conditionList.Count == 1)
            {
                return(string.Format("{0}if({1}){{", Indent(i++), conditionList.First().Value));
            }

            var groupList = new Dictionary <string, string>();

            foreach (var g in input.Condition.Groups)
            {
                var content = conditionList[g.Conditions[0]] + " ";

                for (int j = 0; j < g.Connectors.Count; j++)
                {
                    content += new VMconditionGroupCompare(g.Connectors[j]).Value + " ";
                    content += conditionList[g.Conditions[j + 1]] + " ";
                }

                conditionList.Add(g.Alias, content);
            }

            var output = groupList[input.Condition.Value.Conditions[0]];

            for (int j = 0; j < input.Condition.Value.Connectors.Count; j++)
            {
                output += new VMconditionGroupCompare(input.Condition.Value.Connectors[j]).Value + " ";
                output += groupList[input.Condition.Value.Conditions[j + 1]] + " ";
            }

            return(string.Format("{0}if({1}){{", Indent(i++), output));
        }
예제 #3
0
 public MyIfError() : base()
 {
     this.myIf    = new MyIf();
     this.myError = new MyError();
 }