001    package edu.rice.cs.javalanglevels.tree;
002    
003    import edu.rice.cs.javalanglevels.SourceInfo;
004    
005    /**
006     * Class ComplexSuperConstructorInvocation, a component of the JExpressionIF composite hierarchy.
007     * Note: null is not allowed as a value for any field.
008     * @version  Generated automatically by ASTGen at Sun Mar 04 23:01:27 CST 2012
009     */
010    public class ComplexSuperConstructorInvocation extends SuperConstructorInvocation {
011      private final Expression _enclosing;
012    
013      /**
014       * Constructs a ComplexSuperConstructorInvocation.
015       * @throws java.lang.IllegalArgumentException  If any parameter to the constructor is null.
016       */
017      public ComplexSuperConstructorInvocation(SourceInfo in_sourceInfo, Expression in_enclosing, ParenthesizedExpressionList in_arguments) {
018        super(in_sourceInfo, in_arguments);
019    
020        if (in_enclosing == null) {
021          throw new java.lang.IllegalArgumentException("Parameter 'enclosing' to the ComplexSuperConstructorInvocation constructor was null. This class may not have null field values.");
022        }
023        _enclosing = in_enclosing;
024      }
025    
026      final public Expression getEnclosing() { return _enclosing; }
027    
028      public <RetType> RetType visit(JExpressionIFVisitor<RetType> visitor) { return visitor.forComplexSuperConstructorInvocation(this); }
029      public void visit(JExpressionIFVisitor_void visitor) { visitor.forComplexSuperConstructorInvocation(this); }
030    
031      /**
032       * Implementation of toString that uses
033       * {@link #output} to generated nicely tabbed tree.
034       */
035      public java.lang.String toString() {
036        java.io.StringWriter w = new java.io.StringWriter();
037        output(w);
038        return w.toString();
039      }
040    
041      /**
042       * Prints this object out as a nicely tabbed tree.
043       */
044      public void output(java.io.Writer writer) {
045        outputHelp(new TabPrintWriter(writer, 2));
046      }
047    
048      public void outputHelp(TabPrintWriter writer) {
049        writer.print("ComplexSuperConstructorInvocation" + ":");
050        writer.indent();
051    
052        writer.startLine("");
053        writer.print("sourceInfo = ");
054        SourceInfo temp_sourceInfo = getSourceInfo();
055        if (temp_sourceInfo == null) {
056          writer.print("null");
057        } else {
058          writer.print(temp_sourceInfo);
059        }
060    
061        writer.startLine("");
062        writer.print("enclosing = ");
063        Expression temp_enclosing = getEnclosing();
064        if (temp_enclosing == null) {
065          writer.print("null");
066        } else {
067          temp_enclosing.outputHelp(writer);
068        }
069    
070        writer.startLine("");
071        writer.print("arguments = ");
072        ParenthesizedExpressionList temp_arguments = getArguments();
073        if (temp_arguments == null) {
074          writer.print("null");
075        } else {
076          temp_arguments.outputHelp(writer);
077        }
078        writer.unindent();
079      }
080    
081      /**
082       * Implementation of equals that is based on the values
083       * of the fields of the object. Thus, two objects 
084       * created with identical parameters will be equal.
085       */
086      public boolean equals(java.lang.Object obj) {
087        if (obj == null) return false;
088        if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
089          return false;
090        } else {
091          ComplexSuperConstructorInvocation casted = (ComplexSuperConstructorInvocation) obj;
092          if (! (getEnclosing().equals(casted.getEnclosing()))) return false;
093          if (! (getArguments().equals(casted.getArguments()))) return false;
094          return true;
095        }
096      }
097    
098      /**
099       * Implementation of hashCode that is consistent with
100       * equals. The value of the hashCode is formed by
101       * XORing the hashcode of the class object with
102       * the hashcodes of all the fields of the object.
103       */
104      protected int generateHashCode() {
105        int code = getClass().hashCode();
106        code ^= 0;
107        code ^= getEnclosing().hashCode();
108        code ^= getArguments().hashCode();
109        return code;
110      }
111    }