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 SubExpr : {@link AdditiveExpr};
015     * @ast node
016     * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:159
017     */
018    public class SubExpr extends AdditiveExpr 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 SubExpr clone() throws CloneNotSupportedException {
034        SubExpr node = (SubExpr)super.clone();
035        node.in$Circle(false);
036        node.is$Final(false);
037        return node;
038      }
039    /**
040     * @apilevel internal
041     */
042      @SuppressWarnings({"unchecked", "cast"})
043    public SubExpr copy() {
044      
045      try {
046        SubExpr node = (SubExpr) clone();
047        node.parent = null;
048        if(children != null)
049          node.children = (ASTNode[]) children.clone();
050        
051        return node;
052      } catch (CloneNotSupportedException e) {
053        throw new Error("Error: clone not supported for " + getClass().getName());
054      }
055      
056    }/**
057     * Create a deep copy of the AST subtree at this node.
058     * The copy is dangling, i.e. has no parent.
059     * @return dangling copy of the subtree at this node
060     * @apilevel low-level
061     */
062      @SuppressWarnings({"unchecked", "cast"})
063    public SubExpr fullCopy() {
064      
065      SubExpr tree = (SubExpr) copy();
066      if (children != null) {
067        for (int i = 0; i < children.length; ++i) {
068          
069          ASTNode child = (ASTNode) children[i];
070          if(child != null) {
071            child = child.fullCopy();
072            tree.setChild(child, i);
073          }
074        }
075      }
076      return tree;
077      
078    }  /**
079       * @ast method 
080       * @aspect CodeGenerationBinaryOperations
081       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:1025
082       */
083      void emitOperation(CodeGeneration gen) { type().sub(gen); }
084      /**
085       * @ast method 
086       * 
087       */
088      public SubExpr() {
089        super();
090    
091    
092      }
093      /**
094       * Initializes the child array to the correct size.
095       * Initializes List and Opt nta children.
096       * @apilevel internal
097       * @ast method
098       * @ast method 
099       * 
100       */
101      public void init$Children() {
102        children = new ASTNode[2];
103      }
104      /**
105       * @ast method 
106       * 
107       */
108      public SubExpr(Expr p0, Expr p1) {
109        setChild(p0, 0);
110        setChild(p1, 1);
111      }
112      /**
113       * @apilevel low-level
114       * @ast method 
115       * 
116       */
117      protected int numChildren() {
118        return 2;
119      }
120      /**
121       * @apilevel internal
122       * @ast method 
123       * 
124       */
125      public boolean mayHaveRewrite() {
126        return false;
127      }
128      /**
129       * Replaces the LeftOperand child.
130       * @param node The new node to replace the LeftOperand child.
131       * @apilevel high-level
132       * @ast method 
133       * 
134       */
135      public void setLeftOperand(Expr node) {
136        setChild(node, 0);
137      }
138      /**
139       * Retrieves the LeftOperand child.
140       * @return The current node used as the LeftOperand child.
141       * @apilevel high-level
142       * @ast method 
143       * 
144       */
145      public Expr getLeftOperand() {
146        return (Expr)getChild(0);
147      }
148      /**
149       * Retrieves the LeftOperand child.
150       * <p><em>This method does not invoke AST transformations.</em></p>
151       * @return The current node used as the LeftOperand child.
152       * @apilevel low-level
153       * @ast method 
154       * 
155       */
156      public Expr getLeftOperandNoTransform() {
157        return (Expr)getChildNoTransform(0);
158      }
159      /**
160       * Replaces the RightOperand child.
161       * @param node The new node to replace the RightOperand child.
162       * @apilevel high-level
163       * @ast method 
164       * 
165       */
166      public void setRightOperand(Expr node) {
167        setChild(node, 1);
168      }
169      /**
170       * Retrieves the RightOperand child.
171       * @return The current node used as the RightOperand child.
172       * @apilevel high-level
173       * @ast method 
174       * 
175       */
176      public Expr getRightOperand() {
177        return (Expr)getChild(1);
178      }
179      /**
180       * Retrieves the RightOperand child.
181       * <p><em>This method does not invoke AST transformations.</em></p>
182       * @return The current node used as the RightOperand child.
183       * @apilevel low-level
184       * @ast method 
185       * 
186       */
187      public Expr getRightOperandNoTransform() {
188        return (Expr)getChildNoTransform(1);
189      }
190      /**
191       * @attribute syn
192       * @aspect ConstantExpression
193       * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:91
194       */
195      public Constant constant() {
196        ASTNode$State state = state();
197        try {  return type().sub(getLeftOperand().constant(), getRightOperand().constant());  }
198        finally {
199        }
200      }
201      /**
202       * @attribute syn
203       * @aspect PrettyPrint
204       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:400
205       */
206      public String printOp() {
207        ASTNode$State state = state();
208        try {  return " - ";  }
209        finally {
210        }
211      }
212      /**
213       * @apilevel internal
214       */
215      public ASTNode rewriteTo() {
216        return super.rewriteTo();
217      }
218    }