001    /* Copyright 2000, 2001, Compaq Computer Corporation */
002    
003    /* IF THIS IS A JAVA FILE, DO NOT EDIT IT!  
004    
005       Most Java files in this directory which are part of the Javafe AST
006       are automatically generated using the astgen comment (see
007       ESCTools/Javafe/astgen) from the input file 'hierarchy.h'.  If you
008       wish to modify AST classes or introduce new ones, modify
009       'hierarchy.j.'
010     */
011    
012    package escjava.ast;
013    
014    import java.util.Hashtable;
015    import java.util.Set;
016    import java.util.ArrayList;
017    
018    import javafe.ast.*;
019    import javafe.util.Assert;
020    import javafe.util.Location;
021    import escjava.ParsedRoutineSpecs;
022    
023    // Convention: unless otherwise noted, integer fields named "loc" refer
024    // to the location of the first character of the syntactic unit
025    
026    //# TagBase javafe.tc.TagConstants.LAST_TAG + 1
027    //# VisitorRoot javafe.ast.Visitor
028    
029    
030    public class SubSubGetsCmd extends AssignCmd
031    {
032      // denotes v[index][index] := rhs.  I expect that v will be "elems".
033      public /*@ non_null @*/ Expr index1;
034    
035      public /*@ non_null @*/ Expr index2;
036    
037    
038    
039    // Generated boilerplate constructors:
040    
041      /**
042       * Construct a raw SubSubGetsCmd whose class invariant(s) have not
043       * yet been established.  It is the caller's job to
044       * initialize the returned node's fields so that any
045       * class invariants hold.
046       */
047      //@ requires I_will_establish_invariants_afterwards;
048      protected SubSubGetsCmd() {}    //@ nowarn Invariant,NonNullInit;
049    
050    
051    // Generated boilerplate methods:
052    
053      public final int childCount() {
054         return 4;
055      }
056    
057      public final Object childAt(int index) {
058              /*throws IndexOutOfBoundsException*/
059         if (index < 0)
060            throw new IndexOutOfBoundsException("AST child index " + index);
061         int indexPre = index;
062    
063         int sz;
064    
065         if (index == 0) return this.v;
066         else index--;
067    
068         if (index == 0) return this.rhs;
069         else index--;
070    
071         if (index == 0) return this.index1;
072         else index--;
073    
074         if (index == 0) return this.index2;
075         else index--;
076    
077         throw new IndexOutOfBoundsException("AST child index " + indexPre);
078      }   //@ nowarn Exception;
079    
080      public final String toString() {
081         return "[SubSubGetsCmd"
082            + " v = " + this.v
083            + " rhs = " + this.rhs
084            + " index1 = " + this.index1
085            + " index2 = " + this.index2
086            + "]";
087      }
088    
089      public final int getTag() {
090         return TagConstants.SUBSUBGETSCMD;
091      }
092    
093      public final void accept(javafe.ast.Visitor v) { 
094        if (v instanceof Visitor) ((Visitor)v).visitSubSubGetsCmd(this);
095      }
096    
097      public final Object accept(javafe.ast.VisitorArgResult v, Object o) { 
098        if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitSubSubGetsCmd(this, o); else return null;
099      }
100    
101      public void check() {
102         super.check();
103         this.v.check();
104         this.rhs.check();
105         this.index1.check();
106         this.index2.check();
107      }
108    
109      //@ ensures \result != null;
110      public static SubSubGetsCmd make(/*@ non_null @*/ VariableAccess v, /*@ non_null @*/ Expr rhs, /*@ non_null @*/ Expr index1, /*@ non_null @*/ Expr index2) {
111         //@ set I_will_establish_invariants_afterwards = true;
112         SubSubGetsCmd result = new SubSubGetsCmd();
113         result.v = v;
114         result.rhs = rhs;
115         result.index1 = index1;
116         result.index2 = index2;
117         return result;
118      }
119    }