001 /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */ 002 package AST; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.*; 007 import beaver.*; 008 import java.util.ArrayList; 009 import java.util.zip.*; 010 import java.io.*; 011 import java.io.FileNotFoundException; 012 import java.util.Collection; 013 /** 014 * @production MultiplicativeExpr : {@link ArithmeticExpr}; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:153 017 */ 018 public abstract class MultiplicativeExpr extends ArithmeticExpr implements Cloneable { 019 /** 020 * @apilevel low-level 021 */ 022 public void flushCache() { 023 } 024 /** 025 * @apilevel internal 026 */ 027 public void flushCollectionCache() { 028 } 029 /** 030 * @apilevel internal 031 */ 032 @SuppressWarnings({"unchecked", "cast"}) 033 public MultiplicativeExpr clone() throws CloneNotSupportedException { 034 MultiplicativeExpr node = (MultiplicativeExpr)super.clone(); 035 node.type_computed = false; 036 node.type_value = null; 037 node.in$Circle(false); 038 node.is$Final(false); 039 return node; 040 } 041 /** 042 * @ast method 043 * @aspect TypeCheck 044 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeCheck.jrag:156 045 */ 046 public void typeCheck() { 047 if(!getLeftOperand().type().isNumericType()) 048 error(getLeftOperand().type().typeName() + " is not numeric"); 049 if(!getRightOperand().type().isNumericType()) 050 error(getRightOperand().type().typeName() + " is not numeric"); 051 } 052 /** 053 * @ast method 054 * 055 */ 056 public MultiplicativeExpr() { 057 super(); 058 059 060 } 061 /** 062 * Initializes the child array to the correct size. 063 * Initializes List and Opt nta children. 064 * @apilevel internal 065 * @ast method 066 * @ast method 067 * 068 */ 069 public void init$Children() { 070 children = new ASTNode[2]; 071 } 072 /** 073 * @ast method 074 * 075 */ 076 public MultiplicativeExpr(Expr p0, Expr p1) { 077 setChild(p0, 0); 078 setChild(p1, 1); 079 } 080 /** 081 * @apilevel low-level 082 * @ast method 083 * 084 */ 085 protected int numChildren() { 086 return 2; 087 } 088 /** 089 * @apilevel internal 090 * @ast method 091 * 092 */ 093 public boolean mayHaveRewrite() { 094 return false; 095 } 096 /** 097 * Replaces the LeftOperand child. 098 * @param node The new node to replace the LeftOperand child. 099 * @apilevel high-level 100 * @ast method 101 * 102 */ 103 public void setLeftOperand(Expr node) { 104 setChild(node, 0); 105 } 106 /** 107 * Retrieves the LeftOperand child. 108 * @return The current node used as the LeftOperand child. 109 * @apilevel high-level 110 * @ast method 111 * 112 */ 113 public Expr getLeftOperand() { 114 return (Expr)getChild(0); 115 } 116 /** 117 * Retrieves the LeftOperand child. 118 * <p><em>This method does not invoke AST transformations.</em></p> 119 * @return The current node used as the LeftOperand child. 120 * @apilevel low-level 121 * @ast method 122 * 123 */ 124 public Expr getLeftOperandNoTransform() { 125 return (Expr)getChildNoTransform(0); 126 } 127 /** 128 * Replaces the RightOperand child. 129 * @param node The new node to replace the RightOperand child. 130 * @apilevel high-level 131 * @ast method 132 * 133 */ 134 public void setRightOperand(Expr node) { 135 setChild(node, 1); 136 } 137 /** 138 * Retrieves the RightOperand child. 139 * @return The current node used as the RightOperand child. 140 * @apilevel high-level 141 * @ast method 142 * 143 */ 144 public Expr getRightOperand() { 145 return (Expr)getChild(1); 146 } 147 /** 148 * Retrieves the RightOperand child. 149 * <p><em>This method does not invoke AST transformations.</em></p> 150 * @return The current node used as the RightOperand child. 151 * @apilevel low-level 152 * @ast method 153 * 154 */ 155 public Expr getRightOperandNoTransform() { 156 return (Expr)getChildNoTransform(1); 157 } 158 /** 159 * @apilevel internal 160 */ 161 protected boolean type_computed = false; 162 /** 163 * @apilevel internal 164 */ 165 protected TypeDecl type_value; 166 /** 167 * @attribute syn 168 * @aspect TypeAnalysis 169 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:323 170 */ 171 @SuppressWarnings({"unchecked", "cast"}) 172 public TypeDecl type() { 173 if(type_computed) { 174 return type_value; 175 } 176 ASTNode$State state = state(); 177 int num = state.boundariesCrossed; 178 boolean isFinal = this.is$Final(); 179 type_value = type_compute(); 180 if(isFinal && num == state().boundariesCrossed){ type_computed = true; } 181 return type_value; 182 } 183 /** 184 * @apilevel internal 185 */ 186 private TypeDecl type_compute() { return getLeftOperand().type().binaryNumericPromotion(getRightOperand().type()); } 187 /** 188 * @apilevel internal 189 */ 190 public ASTNode rewriteTo() { 191 return super.rewriteTo(); 192 } 193 }