package st.gravel.support.compiler.ast;
/*
This file is automatically generated from typed smalltalk source. Do not edit by hand.
(C) AG5.com
*/
import java.math.BigInteger;
import st.gravel.support.jvm.NonLocalReturn;
import st.gravel.support.compiler.ast.IntermediateNode;
import st.gravel.support.compiler.ast.IntermediateNode.IntermediateNode_Factory;
import st.gravel.support.compiler.ast.Expression;
import st.gravel.support.compiler.ast.SequenceNode;
import st.gravel.support.compiler.ast.NodeVisitor;
import st.gravel.support.compiler.ast.Node;
import st.gravel.support.compiler.ast.SourcePrinter;
import st.gravel.support.compiler.ast.SourcePosition;
public class ToDoNode extends IntermediateNode implements Cloneable {
public static ToDoNode_Factory factory = new ToDoNode_Factory();
String _counterName;
SequenceNode _doSequence;
Expression _start;
Expression _step;
Expression _stop;
public static class ToDoNode_Factory extends IntermediateNode_Factory {
public ToDoNode basicNew() {
ToDoNode newInstance = new ToDoNode();
newInstance.initialize();
return newInstance;
}
public ToDoNode start_stop_step_counterName_doSequence_(final Expression _startNode, final Expression _stopNode, final Expression _stepNode, final String _aString, final SequenceNode _aSequenceNode) {
return ((ToDoNode) this.basicNew().initializeStart_stop_step_counterName_doSequence_(_startNode, _stopNode, _stepNode, _aString, _aSequenceNode));
}
}
static public ToDoNode _start_stop_step_counterName_doSequence_(Object receiver, final Expression _startNode, final Expression _stopNode, final Expression _stepNode, final String _aString, final SequenceNode _aSequenceNode) {
return factory.start_stop_step_counterName_doSequence_(_startNode, _stopNode, _stepNode, _aString, _aSequenceNode);
}
@Override
public <X> X accept_(final NodeVisitor<X> _visitor) {
return _visitor.visitToDoNode_(this);
}
@Override
public ToDoNode allNodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) {
this.nodesDo_(new st.gravel.support.jvm.Block1<Object, Node>() {
@Override
public Object value_(final Node _each) {
return _each.withAllNodesDo_(_aBlock);
}
});
return this;
}
@Override
public ToDoNode allNodesDo_pruneWhere_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock, final st.gravel.support.jvm.Block1<Boolean, Node> _pruneBlock) {
this.nodesDo_(new st.gravel.support.jvm.Block1<Object, Node>() {
@Override
public Object value_(final Node _each) {
if (!_pruneBlock.value_(_each)) {
return _each.withAllNodesDo_pruneWhere_(_aBlock, _pruneBlock);
}
return ToDoNode.this;
}
});
return this;
}
public ToDoNode copy() {
try {
ToDoNode _temp1 = (ToDoNode) this.clone();
_temp1.postCopy();
return _temp1;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
public String counterName() {
return _counterName;
}
public SequenceNode doSequence() {
return _doSequence;
}
public ToDoNode_Factory factory() {
return factory;
}
public ToDoNode initializeStart_stop_step_counterName_doSequence_(final Expression _anIntegerLiteralNode, final Expression _aVariableNode, final Expression _anObject1, final String _anObject, final SequenceNode _aSequenceNode) {
_start = _anIntegerLiteralNode;
_stop = _aVariableNode;
_step = _anObject1;
_counterName = _anObject;
_doSequence = _aSequenceNode;
this.initialize();
return this;
}
@Override
public ToDoNode innerSourceOn_(final StringBuilder _aStream) {
_aStream.append("{");
_start.sourceOn_(_aStream);
_aStream.append(" to: ");
_stop.sourceOn_(_aStream);
_aStream.append(" by: ");
_step.sourceOn_(_aStream);
_aStream.append(" do: [:");
_aStream.append(_counterName);
_aStream.append(" | ");
_doSequence.sourceOn_(_aStream);
_aStream.append("]}");
return this;
}
@Override
public ToDoNode localVarNamesDo_(final st.gravel.support.jvm.Block1<Object, String> _aBlock) {
_aBlock.value_(_counterName);
return this;
}
@Override
public ToDoNode nodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) {
_aBlock.value_(_start);
_aBlock.value_(_stop);
_aBlock.value_(_step);
_aBlock.value_(_doSequence);
return this;
}
@Override
public ToDoNode prettySourceOn_(final StringBuilder _aStream) {
SourcePrinter.factory.on_(_aStream).visit_(this);
return this;
}
@Override
public ToDoNode printOn_(final StringBuilder _aStream) {
final String _title;
_title = this.factory().toString();
_aStream.append(st.gravel.support.jvm.CharacterExtensions.isVowel(_title.charAt(0)) ? "an " : "a ");
_aStream.append(_title);
_aStream.append('[');
this.sourceOn_(_aStream);
_aStream.append(']');
return this;
}
@Override
public ToDoNode pvtSetSourcePosition_(final SourcePosition _aSourcePosition) {
_sourcePosition = _aSourcePosition;
return this;
}
@Override
public boolean referencesVariable_(final String _aString) {
return st.gravel.support.jvm.StringExtensions.equals_(_counterName, _aString);
}
@Override
public ToDoNode sourceOn_(final StringBuilder _aStream) {
_aStream.append(st.gravel.core.Symbol.value(this.getClass().getSimpleName()));
_aStream.append(' ');
this.innerSourceOn_(_aStream);
return this;
}
public Expression start() {
return _start;
}
public Expression step() {
return _step;
}
public Expression stop() {
return _stop;
}
@Override
public Expression unoptimized() {
return null;
}
@Override
public ToDoNode withAllNodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) {
_aBlock.value_(this);
this.allNodesDo_(_aBlock);
return this;
}
@Override
public ToDoNode withAllNodesDo_pruneWhere_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock, final st.gravel.support.jvm.Block1<Boolean, Node> _pruneBlock) {
_aBlock.value_(this);
this.allNodesDo_pruneWhere_(_aBlock, _pruneBlock);
return this;
}
@Override
public ToDoNode withSourcePosition_(final SourcePosition _aSourcePosition) {
if (_sourcePosition == _aSourcePosition) {
return ToDoNode.this;
}
return this.copy().pvtSetSourcePosition_(_aSourcePosition);
}
}