001 // -*- mode: java -*-
002 /* Copyright 2000, 2001, Compaq Computer Corporation */
003
004 /* IF THIS IS A JAVA FILE, DO NOT EDIT IT!
005
006 Most Java files in this directory which are part of the Javafe AST
007 are automatically generated using the astgen comment (see
008 ESCTools/Javafe/astgen) from the input file 'hierarchy.h'. If you
009 wish to modify AST classes or introduce new ones, modify
010 'hierarchy.j.'
011 */
012
013 package javafe.ast;
014
015 import javafe.util.Assert;
016 import javafe.util.Location;
017 import javafe.util.ErrorSet;
018
019 // Convention: unless otherwise noted, integer fields named "loc" refer
020 // to the location of the first character of the syntactic unit
021
022
023 public class SingleTypeImportDecl extends ImportDecl
024 {
025 public /*@ non_null @*/ TypeName typeName;
026
027
028
029 // Generated boilerplate constructors:
030
031 //@ ensures this.loc == loc;
032 //@ ensures this.typeName == typeName;
033 protected SingleTypeImportDecl(int loc, /*@ non_null @*/ TypeName typeName) {
034 super(loc);
035 this.typeName = typeName;
036 }
037
038 // Generated boilerplate methods:
039
040 public final int childCount() {
041 return 1;
042 }
043
044 public final Object childAt(int index) {
045 /*throws IndexOutOfBoundsException*/
046 if (index < 0)
047 throw new IndexOutOfBoundsException("AST child index " + index);
048 int indexPre = index;
049
050 int sz;
051
052 if (index == 0) return this.typeName;
053 else index--;
054
055 throw new IndexOutOfBoundsException("AST child index " + indexPre);
056 } //@ nowarn Exception;
057
058 public final /*@non_null*/String toString() {
059 return "[SingleTypeImportDecl"
060 + " loc = " + this.loc
061 + " typeName = " + this.typeName
062 + "]";
063 }
064
065 public final int getTag() {
066 return TagConstants.SINGLETYPEIMPORTDECL;
067 }
068
069 public final void accept(Visitor v) { v.visitSingleTypeImportDecl(this); }
070
071 public final Object accept(VisitorArgResult v, Object o) {return v.visitSingleTypeImportDecl(this, o); }
072
073 public void check() {
074 super.check();
075 this.typeName.check();
076 }
077
078 //@ requires loc != javafe.util.Location.NULL;
079 //@ ensures \result != null;
080 public static SingleTypeImportDecl make(int loc, /*@ non_null @*/ TypeName typeName) {
081 SingleTypeImportDecl result = new SingleTypeImportDecl(loc, typeName);
082 return result;
083 }
084 }