001    /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.13-12-g880e696 */
002    package org.extendj.ast;
003    
004    import java.util.HashSet;
005    import java.io.File;
006    import java.util.Set;
007    import java.util.Collections;
008    import java.util.Collection;
009    import java.util.ArrayList;
010    import beaver.*;
011    import java.util.*;
012    import java.io.ByteArrayOutputStream;
013    import java.io.PrintStream;
014    import java.lang.reflect.InvocationTargetException;
015    import java.lang.reflect.Method;
016    import org.jastadd.util.*;
017    import java.util.zip.*;
018    import java.io.*;
019    import org.jastadd.util.PrettyPrintable;
020    import org.jastadd.util.PrettyPrinter;
021    import java.io.FileNotFoundException;
022    import java.io.BufferedInputStream;
023    import java.io.DataInputStream;
024    /**
025     * @ast node
026     * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:150
027     * @production MultiplicativeExpr : {@link ArithmeticExpr};
028    
029     */
030    public abstract class MultiplicativeExpr extends ArithmeticExpr implements Cloneable {
031      /**
032       * @aspect TypeCheck
033       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:184
034       */
035      public void typeCheck() {
036        if (!getLeftOperand().type().isNumericType()) {
037          errorf("%s is not numeric", getLeftOperand().type().typeName());
038        }
039        if (!getRightOperand().type().isNumericType()) {
040          errorf("%s is not numeric", getRightOperand().type().typeName());
041        }
042      }
043      /**
044       * @declaredat ASTNode:1
045       */
046      public MultiplicativeExpr() {
047        super();
048      }
049      /**
050       * Initializes the child array to the correct size.
051       * Initializes List and Opt nta children.
052       * @apilevel internal
053       * @ast method
054       * @declaredat ASTNode:10
055       */
056      public void init$Children() {
057        children = new ASTNode[2];
058      }
059      /**
060       * @declaredat ASTNode:13
061       */
062      public MultiplicativeExpr(Expr p0, Expr p1) {
063        setChild(p0, 0);
064        setChild(p1, 1);
065      }
066      /**
067       * @apilevel low-level
068       * @declaredat ASTNode:20
069       */
070      protected int numChildren() {
071        return 2;
072      }
073      /**
074       * @apilevel internal
075       * @declaredat ASTNode:26
076       */
077      public boolean mayHaveRewrite() {
078        return false;
079      }
080      /**
081       * @apilevel internal
082       * @declaredat ASTNode:32
083       */
084      public void flushAttrCache() {
085        super.flushAttrCache();
086        type_reset();
087      }
088      /**
089       * @apilevel internal
090       * @declaredat ASTNode:39
091       */
092      public void flushCollectionCache() {
093        super.flushCollectionCache();
094      }
095      /**
096       * @apilevel internal
097       * @declaredat ASTNode:45
098       */
099      public void flushRewriteCache() {
100        super.flushRewriteCache();
101      }
102      /**
103       * @apilevel internal
104       * @declaredat ASTNode:51
105       */
106      public MultiplicativeExpr clone() throws CloneNotSupportedException {
107        MultiplicativeExpr node = (MultiplicativeExpr) super.clone();
108        return node;
109      }
110      /**
111       * Create a deep copy of the AST subtree at this node.
112       * The copy is dangling, i.e. has no parent.
113       * @return dangling copy of the subtree at this node
114       * @apilevel low-level
115       * @deprecated Please use treeCopy or treeCopyNoTransform instead
116       * @declaredat ASTNode:62
117       */
118      @Deprecated
119      public abstract MultiplicativeExpr fullCopy();
120      /**
121       * Create a deep copy of the AST subtree at this node.
122       * The copy is dangling, i.e. has no parent.
123       * @return dangling copy of the subtree at this node
124       * @apilevel low-level
125       * @declaredat ASTNode:70
126       */
127      public abstract MultiplicativeExpr treeCopyNoTransform();
128      /**
129       * Create a deep copy of the AST subtree at this node.
130       * The subtree of this node is traversed to trigger rewrites before copy.
131       * The copy is dangling, i.e. has no parent.
132       * @return dangling copy of the subtree at this node
133       * @apilevel low-level
134       * @declaredat ASTNode:78
135       */
136      public abstract MultiplicativeExpr treeCopy();
137      /**
138       * Replaces the LeftOperand child.
139       * @param node The new node to replace the LeftOperand child.
140       * @apilevel high-level
141       */
142      public void setLeftOperand(Expr node) {
143        setChild(node, 0);
144      }
145      /**
146       * Retrieves the LeftOperand child.
147       * @return The current node used as the LeftOperand child.
148       * @apilevel high-level
149       */
150      @ASTNodeAnnotation.Child(name="LeftOperand")
151      public Expr getLeftOperand() {
152        return (Expr) getChild(0);
153      }
154      /**
155       * Retrieves the LeftOperand child.
156       * <p><em>This method does not invoke AST transformations.</em></p>
157       * @return The current node used as the LeftOperand child.
158       * @apilevel low-level
159       */
160      public Expr getLeftOperandNoTransform() {
161        return (Expr) getChildNoTransform(0);
162      }
163      /**
164       * Replaces the RightOperand child.
165       * @param node The new node to replace the RightOperand child.
166       * @apilevel high-level
167       */
168      public void setRightOperand(Expr node) {
169        setChild(node, 1);
170      }
171      /**
172       * Retrieves the RightOperand child.
173       * @return The current node used as the RightOperand child.
174       * @apilevel high-level
175       */
176      @ASTNodeAnnotation.Child(name="RightOperand")
177      public Expr getRightOperand() {
178        return (Expr) getChild(1);
179      }
180      /**
181       * Retrieves the RightOperand child.
182       * <p><em>This method does not invoke AST transformations.</em></p>
183       * @return The current node used as the RightOperand child.
184       * @apilevel low-level
185       */
186      public Expr getRightOperandNoTransform() {
187        return (Expr) getChildNoTransform(1);
188      }
189      /**
190       * @apilevel internal
191       */
192      protected boolean type_computed = false;
193      /**
194       * @apilevel internal
195       */
196      protected TypeDecl type_value;
197      /**
198       * @apilevel internal
199       */
200      private void type_reset() {
201        type_computed = false;
202        type_value = null;
203      }
204      /**
205       * @attribute syn
206       * @aspect TypeAnalysis
207       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:302
208       */
209      @ASTNodeAnnotation.Attribute
210      public TypeDecl type() {
211        ASTNode$State state = state();
212        if (type_computed) {
213          return type_value;
214        }
215        boolean intermediate = state.INTERMEDIATE_VALUE;
216        state.INTERMEDIATE_VALUE = false;
217        int num = state.boundariesCrossed;
218        boolean isFinal = this.is$Final();
219        type_value = getLeftOperand().type().binaryNumericPromotion(getRightOperand().type());
220        if (isFinal && num == state().boundariesCrossed) {
221          type_computed = true;
222        } else {
223        }
224        state.INTERMEDIATE_VALUE |= intermediate;
225    
226        return type_value;
227      }
228      /**
229       * @apilevel internal
230       */
231      public ASTNode rewriteTo() {
232        return super.rewriteTo();
233      }
234    }