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 OnDemandImportDecl extends ImportDecl
024    {
025      public /*@ non_null @*/ Name pkgName;
026    
027    
028    
029    // Generated boilerplate constructors:
030    
031      //@ ensures this.loc == loc;
032      //@ ensures this.pkgName == pkgName;
033      protected OnDemandImportDecl(int loc, /*@ non_null @*/ Name pkgName) {
034         super(loc);
035         this.pkgName = pkgName;
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.pkgName;
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 "[OnDemandImportDecl"
060            + " loc = " + this.loc
061            + " pkgName = " + this.pkgName
062            + "]";
063      }
064    
065      public final int getTag() {
066         return TagConstants.ONDEMANDIMPORTDECL;
067      }
068    
069      public final void accept(Visitor v) { v.visitOnDemandImportDecl(this); }
070    
071      public final Object accept(VisitorArgResult v, Object o) {return v.visitOnDemandImportDecl(this, o); }
072    
073      public void check() {
074         super.check();
075         this.pkgName.check();
076      }
077    
078      //@ requires loc != javafe.util.Location.NULL;
079      //@ ensures \result != null;
080      public static OnDemandImportDecl make(int loc, /*@ non_null @*/ Name pkgName) {
081         OnDemandImportDecl result = new OnDemandImportDecl(loc, pkgName);
082         return result;
083      }
084    }