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.Expression; import st.gravel.support.compiler.ast.Expression.Expression_Factory; import st.gravel.support.compiler.ast.TypeNode; 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 TypeCast extends Expression implements Cloneable { public static TypeCast_Factory factory = new TypeCast_Factory(); Expression _expression; TypeNode _type; public static class TypeCast_Factory extends Expression_Factory { public TypeCast basicNew() { TypeCast newInstance = new TypeCast(); newInstance.initialize(); return newInstance; } public TypeCast type_expression_(final TypeNode _aTypeVariableNode, final Expression _aVariableNode) { return this.basicNew().initializeType_expression_(_aTypeVariableNode, _aVariableNode); } } static public TypeCast _type_expression_(Object receiver, final TypeNode _aTypeVariableNode, final Expression _aVariableNode) { return factory.type_expression_(_aTypeVariableNode, _aVariableNode); } @Override public <X> X accept_(final NodeVisitor<X> _visitor) { return _visitor.visitTypeCast_(this); } @Override public TypeCast 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 TypeCast 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 TypeCast.this; } }); return this; } public TypeCast copy() { try { TypeCast _temp1 = (TypeCast) this.clone(); _temp1.postCopy(); return _temp1; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } } public Expression expression() { return _expression; } public TypeCast_Factory factory() { return factory; } public TypeCast initializeType_expression_(final TypeNode _aTypeVariableNode, final Expression _aVariableNode) { _type = _aTypeVariableNode; _expression = _aVariableNode; this.initialize(); return this; } @Override public TypeCast innerSourceOn_(final StringBuilder _aStream) { _aStream.append("({"); _type.sourceOn_(_aStream); _aStream.append("} "); _expression.innerSourceOn_(_aStream); _aStream.append(")"); return this; } @Override public TypeCast localVarNamesDo_(final st.gravel.support.jvm.Block1<Object, String> _aBlock) { return this; } @Override public TypeCast nodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) { _aBlock.value_(_type); _aBlock.value_(_expression); return this; } @Override public int precedence() { return 0; } @Override public TypeCast prettySourceOn_(final StringBuilder _aStream) { SourcePrinter.factory.on_(_aStream).visit_(this); return this; } @Override public TypeCast 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 TypeCast pvtSetSourcePosition_(final SourcePosition _aSourcePosition) { _sourcePosition = _aSourcePosition; return this; } @Override public TypeCast sourceOn_(final StringBuilder _aStream) { if (!this.needsBrackets()) { return TypeCast.this.innerSourceOn_(_aStream); } _aStream.append('('); this.innerSourceOn_(_aStream); _aStream.append(')'); return this; } public TypeNode type() { return _type; } @Override public TypeCast withAllNodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) { _aBlock.value_(this); this.allNodesDo_(_aBlock); return this; } @Override public TypeCast 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 TypeCast withSourcePosition_(final SourcePosition _aSourcePosition) { if (_sourcePosition == _aSourcePosition) { return TypeCast.this; } return this.copy().pvtSetSourcePosition_(_aSourcePosition); } }