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