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)); }
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)); }
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); } }
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; } }