Clover coverage report - Java Language Levels Test Coverage (javalanglevels-20120305-r5436)
Coverage timestamp: Sun Mar 4 2012 22:02:46 CST
file stats: LOC: 169   Methods: 11
NCLOC: 125   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SourceFile.java 33.3% 62% 72.7% 53.3%
coverage coverage
 1    package edu.rice.cs.javalanglevels.tree;
 2   
 3    import edu.rice.cs.javalanglevels.SourceInfo;
 4   
 5    /**
 6    * Class SourceFile, a component of the JExpressionIF composite hierarchy.
 7    * Note: null is not allowed as a value for any field.
 8    * @version Generated automatically by ASTGen at Sun Mar 04 22:01:28 CST 2012
 9    */
 10    public class SourceFile extends JExpression {
 11    private final PackageStatement[] _packageStatements;
 12    private final ImportStatement[] _importStatements;
 13    private final TypeDefBase[] _types;
 14   
 15    /**
 16    * Constructs a SourceFile.
 17    * @throws java.lang.IllegalArgumentException If any parameter to the constructor is null.
 18    */
 19  141 public SourceFile(SourceInfo in_sourceInfo, PackageStatement[] in_packageStatements, ImportStatement[] in_importStatements, TypeDefBase[] in_types) {
 20  141 super(in_sourceInfo);
 21   
 22  141 if (in_packageStatements == null) {
 23  0 throw new java.lang.IllegalArgumentException("Parameter 'packageStatements' to the SourceFile constructor was null. This class may not have null field values.");
 24    }
 25  141 _packageStatements = in_packageStatements;
 26   
 27  141 if (in_importStatements == null) {
 28  0 throw new java.lang.IllegalArgumentException("Parameter 'importStatements' to the SourceFile constructor was null. This class may not have null field values.");
 29    }
 30  141 _importStatements = in_importStatements;
 31   
 32  141 if (in_types == null) {
 33  0 throw new java.lang.IllegalArgumentException("Parameter 'types' to the SourceFile constructor was null. This class may not have null field values.");
 34    }
 35  141 _types = in_types;
 36    }
 37   
 38  335 final public PackageStatement[] getPackageStatements() { return _packageStatements; }
 39  361 final public ImportStatement[] getImportStatements() { return _importStatements; }
 40  1385 final public TypeDefBase[] getTypes() { return _types; }
 41   
 42  277 public <RetType> RetType visit(JExpressionIFVisitor<RetType> visitor) { return visitor.forSourceFile(this); }
 43  0 public void visit(JExpressionIFVisitor_void visitor) { visitor.forSourceFile(this); }
 44   
 45    /**
 46    * Implementation of toString that uses
 47    * {@link #output} to generated nicely tabbed tree.
 48    */
 49  8 public java.lang.String toString() {
 50  8 java.io.StringWriter w = new java.io.StringWriter();
 51  8 output(w);
 52  8 return w.toString();
 53    }
 54   
 55    /**
 56    * Prints this object out as a nicely tabbed tree.
 57    */
 58  8 public void output(java.io.Writer writer) {
 59  8 outputHelp(new TabPrintWriter(writer, 2));
 60    }
 61   
 62  8 public void outputHelp(TabPrintWriter writer) {
 63  8 writer.print("SourceFile" + ":");
 64  8 writer.indent();
 65   
 66  8 writer.startLine("");
 67  8 writer.print("sourceInfo = ");
 68  8 SourceInfo temp_sourceInfo = getSourceInfo();
 69  8 if (temp_sourceInfo == null) {
 70  0 writer.print("null");
 71    } else {
 72  8 writer.print(temp_sourceInfo);
 73    }
 74   
 75  8 writer.startLine("");
 76  8 writer.print("packageStatements = ");
 77  8 writer.print("{");
 78  8 writer.indent();
 79  8 for (int i = 0; i < getPackageStatements().length; i++) {
 80  2 PackageStatement temp_packageStatements = getPackageStatements()[i];
 81  2 writer.startLine("#" + i + ": ");
 82  2 if (temp_packageStatements == null) {
 83  0 writer.print("null");
 84    } else {
 85  2 temp_packageStatements.outputHelp(writer);
 86    }
 87    }
 88  8 writer.unindent();
 89  8 if (getPackageStatements().length > 0) {
 90  2 writer.startLine("");
 91    }
 92  8 writer.print("}");
 93   
 94  8 writer.startLine("");
 95  8 writer.print("importStatements = ");
 96  8 writer.print("{");
 97  8 writer.indent();
 98  8 for (int i = 0; i < getImportStatements().length; i++) {
 99  10 ImportStatement temp_importStatements = getImportStatements()[i];
 100  10 writer.startLine("#" + i + ": ");
 101  10 if (temp_importStatements == null) {
 102  0 writer.print("null");
 103    } else {
 104  10 temp_importStatements.outputHelp(writer);
 105    }
 106    }
 107  8 writer.unindent();
 108  8 if (getImportStatements().length > 0) {
 109  6 writer.startLine("");
 110    }
 111  8 writer.print("}");
 112   
 113  8 writer.startLine("");
 114  8 writer.print("types = ");
 115  8 writer.print("{");
 116  8 writer.indent();
 117  8 for (int i = 0; i < getTypes().length; i++) {
 118  16 TypeDefBase temp_types = getTypes()[i];
 119  16 writer.startLine("#" + i + ": ");
 120  16 if (temp_types == null) {
 121  0 writer.print("null");
 122    } else {
 123  16 temp_types.outputHelp(writer);
 124    }
 125    }
 126  8 writer.unindent();
 127  8 if (getTypes().length > 0) {
 128  8 writer.startLine("");
 129    }
 130  8 writer.print("}");
 131  8 writer.unindent();
 132    }
 133   
 134    /**
 135    * Implementation of equals that is based on the values
 136    * of the fields of the object. Thus, two objects
 137    * created with identical parameters will be equal.
 138    */
 139  0 public boolean equals(java.lang.Object obj) {
 140  0 if (obj == null) return false;
 141  0 if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
 142  0 return false;
 143    } else {
 144  0 SourceFile casted = (SourceFile) obj;
 145  0 if (this.getPackageStatements().length != casted.getPackageStatements().length) return false;
 146  0 for (int i = 0; i < getPackageStatements().length; i++) if (! getPackageStatements()[i].equals(casted.getPackageStatements()[i])) return false;
 147  0 if (this.getImportStatements().length != casted.getImportStatements().length) return false;
 148  0 for (int i = 0; i < getImportStatements().length; i++) if (! getImportStatements()[i].equals(casted.getImportStatements()[i])) return false;
 149  0 if (this.getTypes().length != casted.getTypes().length) return false;
 150  0 for (int i = 0; i < getTypes().length; i++) if (! getTypes()[i].equals(casted.getTypes()[i])) return false;
 151  0 return true;
 152    }
 153    }
 154   
 155    /**
 156    * Implementation of hashCode that is consistent with
 157    * equals. The value of the hashCode is formed by
 158    * XORing the hashcode of the class object with
 159    * the hashcodes of all the fields of the object.
 160    */
 161  0 protected int generateHashCode() {
 162  0 int code = getClass().hashCode();
 163  0 code ^= 0;
 164  0 for (int i = 0; i < getPackageStatements().length; i++) code ^= getPackageStatements()[i].hashCode();
 165  0 for (int i = 0; i < getImportStatements().length; i++) code ^= getImportStatements()[i].hashCode();
 166  0 for (int i = 0; i < getTypes().length; i++) code ^= getTypes()[i].hashCode();
 167  0 return code;
 168    }
 169    }