private void btnDraw_Click(object sender, EventArgs e) { int x = 50, y = 100; var graphics = splitContainer1.Panel2.CreateGraphics(); var oprb = gbOperations.Controls.OfType <RadioButton>() .FirstOrDefault(n => n.Checked); BaseVisitor visitor = Activator.CreateInstance(oprb.Tag as Type, graphics) as BaseVisitor; foreach (Type type in listBoxElements.Items) { Rectangle rect = new Rectangle(x, y, 100, 100); var element = Activator.CreateInstance(type, rect); if (element is RectangleElement) { visitor.Visit(element as RectangleElement); } else if (element is EllipseElement) { visitor.Visit(element as EllipseElement); } else if (element is StarElement) { visitor.Visit(element as StarElement); } x += 150; } }
/// <inheritdoc /> public CoreVisitor(BaseVisitor visitor, bool isNewWriter = false, ConditionType conditionType = ConditionType.Where) : base(visitor, isNewWriter) { this.visitor = visitor ?? throw new ArgumentNullException(nameof(visitor)); hasVisitor = true; switch (conditionType) { case ConditionType.And: whereSwitch = new WhereSwitch(writer.And, writer.And); break; case ConditionType.Having: whereSwitch = new WhereSwitch(writer.Having, writer.And); break; case ConditionType.Where: default: whereSwitch = new WhereSwitch(writer.Where, writer.And); break; } }
/// <inheritdoc /> public SetExistsVisitor(BaseVisitor visitor) : base(visitor) { }
/// <inheritdoc /> public SetContainsVisitor(BaseVisitor visitor) : base(visitor, false) { this.visitor = visitor; }
/// <inheritdoc /> public SelectVisitor(BaseVisitor visitor, bool isNewWriter = true) : base(visitor, isNewWriter) { orderBySwitch = new OrderBySwitch(writer.OrderBy, writer.Delimiter); }
public abstract void Accept(BaseVisitor visitor);
public override void Accept(BaseVisitor visitor) { visitor.Visit(this); }
private QueryVisitor(BaseVisitor baseVisitor) : base(baseVisitor) { }
public override void Visit(BaseVisitor visitor) { }
public override void Visit(BaseVisitor visitor) => visitor.VisitRealNumNode(this);
public override void Visit(BaseVisitor visitor) => visitor.VisitIndexAccessExpressionNode(this);
public override void Visit(BaseVisitor visitor) => visitor.VisitBinaryExpressionNode(this);
public override void Visit(BaseVisitor visitor) => visitor.VisitCallFunctionNode(this);
public override void Visit(BaseVisitor visitor) => visitor.VisitCallProcedureNode(this);
/// <inheritdoc /> public GroupByLinqVisitor(BaseVisitor visitor) : base(visitor, false, ConditionType.And) { }
/// <inheritdoc /> public WhereVisitor(BaseVisitor visitor) : base(visitor, false) { this.visitor = visitor; }
public override void Visit(BaseVisitor visitor) => visitor.VisitDefineTupleNode(this);
/// <inheritdoc /> public override SelectVisitor CreateInstance(BaseVisitor baseVisitor) => new QueryVisitor(baseVisitor);
public override void Visit(BaseVisitor visitor) => visitor.VisitTupleVarNode(this);
public override void Visit(BaseVisitor visitor) => visitor.VisitAssignTupleNode(this);
public override void Visit(BaseVisitor visitor) => visitor.VisitForNode(this);
public InsertSelectVisitor(BaseVisitor visitor, List <string> insertFields) : base(visitor) { this.insertFields = insertFields; }
public override void Visit(BaseVisitor visitor) => visitor.VisitStringNode(this);
public abstract void Visit(BaseVisitor visitor);
public override void Visit(BaseVisitor visitor) => visitor.VisitComplexIDNode(this);
/// <inheritdoc /> public LinqAnyVisitor(BaseVisitor visitor) : base(visitor) { }
public InterpreterNodeTraverser(BaseVisitor visitor = null) { this.visitor = visitor ?? new defaultVisitor(); }
/// <inheritdoc /> public NestedAnyVisitor(BaseVisitor visitor) : base(visitor, false) { }
/// <inheritdoc /> public NestedContainsVisitor(BaseVisitor visitor) : base(visitor, false) { }