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 ModifiesGroupPragma extends ModifierPragma
032 {
033 public int tag;
034
035 public /*@ non_null @*/ CondExprModifierPragmaVec items;
036
037 public /*@ non_null @*/ Expr precondition;
038
039 public int clauseLoc;
040
041
042 //@ public represents startLoc <- clauseLoc;
043 public /*@ pure @*/ int getStartLoc() { return clauseLoc; }
044
045 static public ModifiesGroupPragma make(int tag, int loc) {
046 ModifiesGroupPragma t = new ModifiesGroupPragma(
047 tag,
048 CondExprModifierPragmaVec.make(),
049 null,
050 loc);
051 return t;
052 }
053
054 public void addElement(CondExprModifierPragma e) {
055 items.addElement(e);
056 }
057
058 public ModifiesGroupPragma append(ModifiesGroupPragma m) {
059 items.append(m.items);
060 return this;
061 }
062
063 public ModifiesGroupPragma append(CondExprModifierPragmaVec ev) {
064 items.append(ev);
065 return this;
066 }
067
068
069 // Generated boilerplate constructors:
070
071 //@ ensures this.tag == tag;
072 //@ ensures this.items == items;
073 //@ ensures this.precondition == precondition;
074 //@ ensures this.clauseLoc == clauseLoc;
075 protected ModifiesGroupPragma(int tag, /*@ non_null @*/ CondExprModifierPragmaVec items, /*@ non_null @*/ Expr precondition, int clauseLoc) {
076 this.tag = tag;
077 this.items = items;
078 this.precondition = precondition;
079 this.clauseLoc = clauseLoc;
080 }
081
082 // Generated boilerplate methods:
083
084 public final int childCount() {
085 int sz = 0;
086 if (this.items != null) sz += this.items.size();
087 return sz + 1;
088 }
089
090 public final Object childAt(int index) {
091 /*throws IndexOutOfBoundsException*/
092 if (index < 0)
093 throw new IndexOutOfBoundsException("AST child index " + index);
094 int indexPre = index;
095
096 int sz;
097
098 sz = (this.items == null ? 0 : this.items.size());
099 if (0 <= index && index < sz)
100 return this.items.elementAt(index);
101 else index -= sz;
102
103 if (index == 0) return this.precondition;
104 else index--;
105
106 throw new IndexOutOfBoundsException("AST child index " + indexPre);
107 } //@ nowarn Exception;
108
109 public final /*@non_null*/String toString() {
110 return "[ModifiesGroupPragma"
111 + " tag = " + this.tag
112 + " items = " + this.items
113 + " precondition = " + this.precondition
114 + " clauseLoc = " + this.clauseLoc
115 + "]";
116 }
117
118 public final int getTag() {
119 return TagConstants.MODIFIESGROUPPRAGMA;
120 }
121
122 public final void accept(javafe.ast.Visitor v) {
123 if (v instanceof Visitor) ((Visitor)v).visitModifiesGroupPragma(this);
124 }
125
126 public final Object accept(javafe.ast.VisitorArgResult v, Object o) {
127 if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitModifiesGroupPragma(this, o); else return null;
128 }
129
130 public void check() {
131 for(int i = 0; i < this.items.size(); i++)
132 this.items.elementAt(i).check();
133 this.precondition.check();
134 }
135
136 //@ ensures \result != null;
137 public static ModifiesGroupPragma make(int tag, /*@ non_null @*/ CondExprModifierPragmaVec items, /*@ non_null @*/ Expr precondition, int clauseLoc) {
138 ModifiesGroupPragma result = new ModifiesGroupPragma(tag, items, precondition, clauseLoc);
139 return result;
140 }
141 }