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 escjava.ast;
014
015 import java.util.Hashtable;
016 import java.util.Set;
017 import java.util.ArrayList;
018
019 import javafe.ast.*;
020 import javafe.util.Assert;
021 import javafe.util.Location;
022 import escjava.ParsedRoutineSpecs;
023
024 // Convention: unless otherwise noted, integer fields named "loc" refer
025 // to the location of the first character of the syntactic unit
026
027 //# TagBase javafe.tc.TagConstants.LAST_TAG + 1
028 //# VisitorRoot javafe.ast.Visitor
029
030
031 public class SubSubGetsCmd extends AssignCmd
032 {
033 // denotes v[index][index] := rhs. I expect that v will be "elems".
034 public /*@ non_null @*/ Expr index1;
035
036 public /*@ non_null @*/ Expr index2;
037
038
039
040 // Generated boilerplate constructors:
041
042 //@ ensures this.v == v;
043 //@ ensures this.rhs == rhs;
044 //@ ensures this.index1 == index1;
045 //@ ensures this.index2 == index2;
046 protected SubSubGetsCmd(/*@ non_null @*/ VariableAccess v, /*@ non_null @*/ Expr rhs, /*@ non_null @*/ Expr index1, /*@ non_null @*/ Expr index2) {
047 super(v, rhs);
048 this.index1 = index1;
049 this.index2 = index2;
050 }
051
052 // Generated boilerplate methods:
053
054 public final int childCount() {
055 return 4;
056 }
057
058 public final Object childAt(int index) {
059 /*throws IndexOutOfBoundsException*/
060 if (index < 0)
061 throw new IndexOutOfBoundsException("AST child index " + index);
062 int indexPre = index;
063
064 int sz;
065
066 if (index == 0) return this.v;
067 else index--;
068
069 if (index == 0) return this.rhs;
070 else index--;
071
072 if (index == 0) return this.index1;
073 else index--;
074
075 if (index == 0) return this.index2;
076 else index--;
077
078 throw new IndexOutOfBoundsException("AST child index " + indexPre);
079 } //@ nowarn Exception;
080
081 public final /*@non_null*/String toString() {
082 return "[SubSubGetsCmd"
083 + " v = " + this.v
084 + " rhs = " + this.rhs
085 + " index1 = " + this.index1
086 + " index2 = " + this.index2
087 + "]";
088 }
089
090 public final int getTag() {
091 return TagConstants.SUBSUBGETSCMD;
092 }
093
094 public final void accept(javafe.ast.Visitor v) {
095 if (v instanceof Visitor) ((Visitor)v).visitSubSubGetsCmd(this);
096 }
097
098 public final Object accept(javafe.ast.VisitorArgResult v, Object o) {
099 if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitSubSubGetsCmd(this, o); else return null;
100 }
101
102 public void check() {
103 super.check();
104 this.v.check();
105 this.rhs.check();
106 this.index1.check();
107 this.index2.check();
108 }
109
110 //@ ensures \result != null;
111 public static SubSubGetsCmd make(/*@ non_null @*/ VariableAccess v, /*@ non_null @*/ Expr rhs, /*@ non_null @*/ Expr index1, /*@ non_null @*/ Expr index2) {
112 SubSubGetsCmd result = new SubSubGetsCmd(v, rhs, index1, index2);
113 return result;
114 }
115 }