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:149 027 * @production ArithmeticExpr : {@link Binary}; 028 029 */ 030 public abstract class ArithmeticExpr extends Binary implements Cloneable { 031 /** 032 * @declaredat ASTNode:1 033 */ 034 public ArithmeticExpr() { 035 super(); 036 } 037 /** 038 * Initializes the child array to the correct size. 039 * Initializes List and Opt nta children. 040 * @apilevel internal 041 * @ast method 042 * @declaredat ASTNode:10 043 */ 044 public void init$Children() { 045 children = new ASTNode[2]; 046 } 047 /** 048 * @declaredat ASTNode:13 049 */ 050 public ArithmeticExpr(Expr p0, Expr p1) { 051 setChild(p0, 0); 052 setChild(p1, 1); 053 } 054 /** 055 * @apilevel low-level 056 * @declaredat ASTNode:20 057 */ 058 protected int numChildren() { 059 return 2; 060 } 061 /** 062 * @apilevel internal 063 * @declaredat ASTNode:26 064 */ 065 public boolean mayHaveRewrite() { 066 return false; 067 } 068 /** 069 * @apilevel internal 070 * @declaredat ASTNode:32 071 */ 072 public void flushAttrCache() { 073 super.flushAttrCache(); 074 } 075 /** 076 * @apilevel internal 077 * @declaredat ASTNode:38 078 */ 079 public void flushCollectionCache() { 080 super.flushCollectionCache(); 081 } 082 /** 083 * @apilevel internal 084 * @declaredat ASTNode:44 085 */ 086 public void flushRewriteCache() { 087 super.flushRewriteCache(); 088 } 089 /** 090 * @apilevel internal 091 * @declaredat ASTNode:50 092 */ 093 public ArithmeticExpr clone() throws CloneNotSupportedException { 094 ArithmeticExpr node = (ArithmeticExpr) super.clone(); 095 return node; 096 } 097 /** 098 * Create a deep copy of the AST subtree at this node. 099 * The copy is dangling, i.e. has no parent. 100 * @return dangling copy of the subtree at this node 101 * @apilevel low-level 102 * @deprecated Please use treeCopy or treeCopyNoTransform instead 103 * @declaredat ASTNode:61 104 */ 105 @Deprecated 106 public abstract ArithmeticExpr fullCopy(); 107 /** 108 * Create a deep copy of the AST subtree at this node. 109 * The copy is dangling, i.e. has no parent. 110 * @return dangling copy of the subtree at this node 111 * @apilevel low-level 112 * @declaredat ASTNode:69 113 */ 114 public abstract ArithmeticExpr treeCopyNoTransform(); 115 /** 116 * Create a deep copy of the AST subtree at this node. 117 * The subtree of this node is traversed to trigger rewrites before copy. 118 * The copy is dangling, i.e. has no parent. 119 * @return dangling copy of the subtree at this node 120 * @apilevel low-level 121 * @declaredat ASTNode:77 122 */ 123 public abstract ArithmeticExpr treeCopy(); 124 /** 125 * Replaces the LeftOperand child. 126 * @param node The new node to replace the LeftOperand child. 127 * @apilevel high-level 128 */ 129 public void setLeftOperand(Expr node) { 130 setChild(node, 0); 131 } 132 /** 133 * Retrieves the LeftOperand child. 134 * @return The current node used as the LeftOperand child. 135 * @apilevel high-level 136 */ 137 @ASTNodeAnnotation.Child(name="LeftOperand") 138 public Expr getLeftOperand() { 139 return (Expr) getChild(0); 140 } 141 /** 142 * Retrieves the LeftOperand child. 143 * <p><em>This method does not invoke AST transformations.</em></p> 144 * @return The current node used as the LeftOperand child. 145 * @apilevel low-level 146 */ 147 public Expr getLeftOperandNoTransform() { 148 return (Expr) getChildNoTransform(0); 149 } 150 /** 151 * Replaces the RightOperand child. 152 * @param node The new node to replace the RightOperand child. 153 * @apilevel high-level 154 */ 155 public void setRightOperand(Expr node) { 156 setChild(node, 1); 157 } 158 /** 159 * Retrieves the RightOperand child. 160 * @return The current node used as the RightOperand child. 161 * @apilevel high-level 162 */ 163 @ASTNodeAnnotation.Child(name="RightOperand") 164 public Expr getRightOperand() { 165 return (Expr) getChild(1); 166 } 167 /** 168 * Retrieves the RightOperand child. 169 * <p><em>This method does not invoke AST transformations.</em></p> 170 * @return The current node used as the RightOperand child. 171 * @apilevel low-level 172 */ 173 public Expr getRightOperandNoTransform() { 174 return (Expr) getChildNoTransform(1); 175 } 176 /** 177 * @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:30 178 * @apilevel internal 179 */ 180 public TypeDecl Define_targetType(ASTNode caller, ASTNode child) { 181 if (caller == getRightOperandNoTransform()) { 182 // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:71 183 { 184 if (!getLeftOperand().isPolyExpression() && !getRightOperand().isPolyExpression()) { 185 return type(); 186 } else { 187 return targetType(); 188 } 189 } 190 } 191 else if (caller == getLeftOperandNoTransform()) { 192 // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:63 193 { 194 if (!getLeftOperand().isPolyExpression() && !getRightOperand().isPolyExpression()) { 195 return type(); 196 } else { 197 return targetType(); 198 } 199 } 200 } 201 else { 202 return getParent().Define_targetType(this, caller); 203 } 204 } 205 protected boolean canDefine_targetType(ASTNode caller, ASTNode child) { 206 return true; 207 } 208 /** 209 * @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:200 210 * @apilevel internal 211 */ 212 public boolean Define_numericContext(ASTNode caller, ASTNode child) { 213 if (caller == getLeftOperandNoTransform()) { 214 // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:244 215 return true; 216 } 217 else if (caller == getRightOperandNoTransform()) { 218 // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:243 219 return true; 220 } 221 else { 222 return super.Define_numericContext(caller, child); 223 } 224 } 225 protected boolean canDefine_numericContext(ASTNode caller, ASTNode child) { 226 return true; 227 } 228 /** 229 * @apilevel internal 230 */ 231 public ASTNode rewriteTo() { 232 return super.rewriteTo(); 233 } 234 }