001 /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.3 */ 002 package AST; 003 004 import java.util.*; 005 /** 006 * @ast node 007 * @production Opt : {@link ASTNode}; 008 009 */ 010 public class Opt<T extends ASTNode> extends ASTNode<T> implements Cloneable { 011 /** 012 * @apilevel internal 013 */ 014 public Opt<T> clone() throws CloneNotSupportedException { 015 Opt node = (Opt) super.clone(); 016 return node; 017 } 018 /** 019 * @apilevel internal 020 */ 021 public Opt<T> copy() { 022 try { 023 Opt node = (Opt) clone(); 024 node.parent = null; 025 if(children != null) { 026 node.children = (ASTNode[]) children.clone(); 027 } 028 return node; 029 } catch (CloneNotSupportedException e) { 030 throw new Error("Error: clone not supported for " + getClass().getName()); 031 } 032 } 033 /** 034 * Create a deep copy of the AST subtree at this node. 035 * The copy is dangling, i.e. has no parent. 036 * @return dangling copy of the subtree at this node 037 * @apilevel low-level 038 */ 039 public Opt<T> fullCopy() { 040 Opt tree = (Opt) copy(); 041 if (children != null) { 042 for (int i = 0; i < children.length; ++i) { 043 ASTNode child = (ASTNode) children[i]; 044 if(child != null) { 045 child = child.fullCopy(); 046 tree.setChild(child, i); 047 } 048 } 049 } 050 return tree; 051 } 052 /** 053 */ 054 public Opt() { 055 super(); 056 } 057 /** 058 * Initializes the child array to the correct size. 059 * Initializes List and Opt nta children. 060 * @apilevel internal 061 * @ast method 062 */ 063 public void init$Children() { 064 } 065 /** 066 */ 067 public Opt(T opt) { 068 setChild(opt, 0); 069 } 070 /** 071 * @apilevel low-level 072 */ 073 public void flushCache() { 074 super.flushCache(); 075 } 076 /** 077 * @apilevel internal 078 */ 079 public void flushCollectionCache() { 080 super.flushCollectionCache(); 081 } 082 }