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.TypeNode; import st.gravel.support.compiler.ast.TypeNode.TypeNode_Factory; 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 GenericTypeVariableNode extends TypeNode implements Cloneable { public static GenericTypeVariableNode_Factory factory = new GenericTypeVariableNode_Factory(); TypeNode[] _arguments; TypeNode _root; public static class GenericTypeVariableNode_Factory extends TypeNode_Factory { public GenericTypeVariableNode basicNew() { GenericTypeVariableNode newInstance = new GenericTypeVariableNode(); newInstance.initialize(); return newInstance; } public GenericTypeVariableNode root_arguments_(final TypeNode _aTypeVariableNode, final TypeNode[] _anArray) { return ((GenericTypeVariableNode) this.basicNew().initializeRoot_arguments_(_aTypeVariableNode, _anArray)); } } static public GenericTypeVariableNode _root_arguments_(Object receiver, final TypeNode _aTypeVariableNode, final TypeNode[] _anArray) { return factory.root_arguments_(_aTypeVariableNode, _anArray); } @Override public <X> X accept_(final NodeVisitor<X> _visitor) { return _visitor.visitGenericTypeVariableNode_(this); } @Override public GenericTypeVariableNode 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 GenericTypeVariableNode 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 GenericTypeVariableNode.this; } }); return this; } public TypeNode argument() { return _arguments[0]; } public TypeNode[] arguments() { return _arguments; } public GenericTypeVariableNode copy() { try { GenericTypeVariableNode _temp1 = (GenericTypeVariableNode) this.clone(); _temp1.postCopy(); return _temp1; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } } @Override public boolean equals(final Object _anObject) { if (!super.equals(_anObject)) { return false; } if (this._root == null) { if (!(((GenericTypeVariableNode) _anObject)._root == null)) { return false; } } else { if (!st.gravel.support.jvm.ObjectExtensions.equals_(this._root, ((GenericTypeVariableNode) _anObject)._root)) { return false; } } if (this._arguments == null) { if (!(((GenericTypeVariableNode) _anObject)._arguments == null)) { return false; } } else { if (!st.gravel.support.jvm.ArrayExtensions.equals_(this._arguments, ((GenericTypeVariableNode) _anObject)._arguments)) { return false; } } return true; } public GenericTypeVariableNode_Factory factory() { return factory; } @Override public int hashCode() { return ((super.hashCode() ^ (_root == null ? 0 : _root.hashCode())) ^ java.util.Arrays.hashCode(_arguments)); } public GenericTypeVariableNode initializeRoot_arguments_(final TypeNode _aTypeVariableNode, final TypeNode[] _anArray) { _root = _aTypeVariableNode; _arguments = _anArray; this.initialize(); return this; } @Override public GenericTypeVariableNode innerSourceOn_(final StringBuilder _aStream) { _root.sourceOn_(_aStream); _aStream.append('['); boolean _temp1 = true; for (final TypeNode _arg : _arguments) { if (_temp1) { _temp1 = false; } else { _aStream.append(", "); } _arg.sourceOn_(_aStream); } _aStream.append(']'); return this; } @Override public boolean isGenericTypeVariableNode() { return true; } @Override public GenericTypeVariableNode localVarNamesDo_(final st.gravel.support.jvm.Block1<Object, String> _aBlock) { return this; } @Override public GenericTypeVariableNode prettySourceOn_(final StringBuilder _aStream) { SourcePrinter.factory.on_(_aStream).visit_(this); return this; } @Override public GenericTypeVariableNode 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 GenericTypeVariableNode pvtSetSourcePosition_(final SourcePosition _aSourcePosition) { _sourcePosition = _aSourcePosition; return this; } @Override public boolean referencesSelfOrInstanceType() { return _root.referencesSelfOrInstanceType() || st.gravel.support.jvm.ArrayExtensions.anySatisfy_(_arguments, new st.gravel.support.jvm.Predicate1<TypeNode>() { @Override public boolean value_(final TypeNode _type) { return _type.referencesSelfOrInstanceType(); } }); } public TypeNode root() { return _root; } @Override public GenericTypeVariableNode sourceOn_(final StringBuilder _aStream) { this.innerSourceOn_(_aStream); return this; } @Override public GenericTypeVariableNode typeDefsDo_(final st.gravel.support.jvm.Block1<Object, TypeNode> _aBlock) { _root.typeDefsDo_(_aBlock); for (final TypeNode _each : _arguments) { _each.typeDefsDo_(_aBlock); } return this; } @Override public GenericTypeVariableNode withAllNodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) { _aBlock.value_(this); this.allNodesDo_(_aBlock); return this; } @Override public GenericTypeVariableNode 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 GenericTypeVariableNode withSourcePosition_(final SourcePosition _aSourcePosition) { if (_sourcePosition == _aSourcePosition) { return GenericTypeVariableNode.this; } return this.copy().pvtSetSourcePosition_(_aSourcePosition); } }