예제 #1
0
        public void Visit(OrOperator node)
        {
            VisitBinary(node);

            ITerminalWrapper leftWrapper  = ReferenceTables.GetValue(node.Left);
            ITerminalWrapper rightWrapper = ReferenceTables.GetValue(node.Right);

            ReferenceTables.SetValue(node, ((dynamic)leftWrapper) | ((dynamic)rightWrapper));
        }
예제 #2
0
        public void Visit(Expression node)
        {
            //if expression is literal
            if (node.Child == null)
            {
                throw new Exception("Expression should have one and only one child");
            }

            node.Child.Accept(this);

            ReferenceTables.SetValue(node, ReferenceTables.GetValue(node.Child));
        }
예제 #3
0
        public void Visit(ControlUnit node)
        {
            node.Expression.Accept(this);

            YesnoWrapper conditionstate = (YesnoWrapper)ReferenceTables.GetValue(node.Expression);

            if (node.ConditionTrueBlock != null && conditionstate.Value.HasValue && conditionstate.Value.Value)
            {
                node.ConditionTrueBlock.Accept(this);
            }

            if (node.ConditionFalseBlock != null && conditionstate.Value.HasValue && !conditionstate.Value.Value)
            {
                node.ConditionFalseBlock.Accept(this);
            }
        }
예제 #4
0
        public void Visit(QuestionUnit node)
        {
            WidgetBase unitWrapper = _widgetFactory.GetWidget(node, ReferenceTables.GetValue(node.Identifier));

            unitWrapper.Visibility = _parentExpressionDidNotEvaluate ? Visibility.Collapsed : Visibility.Visible;

            int index = _elementsToDisplay.ToList().FindIndex(elem => elem.Unit.Identifier == unitWrapper.Unit.Identifier);

            if (index < 0)
            {
                INotifyPropertyChanged nodeValue = node.Value as INotifyPropertyChanged;
                if (nodeValue != null)
                {
                    nodeValue.PropertyChanged += (sender, args) => _rebuildMethod();
                }

                _elementsToDisplay.Add(unitWrapper);
            }
            else
            {
                _elementsToDisplay[index].Visibility = unitWrapper.Visibility;
            }
        }