All Downloads are FREE. Search and download functionalities are using the official Maven repository.

soot.JastAddJ.FieldDecl Maven / Gradle / Ivy

/* This file was generated with JastAdd2 (http://jastadd.org) version R20130212 (r1031) */
package soot.JastAddJ;

import java.util.HashSet;
import java.io.File;
import java.util.*;
import beaver.*;
import java.util.ArrayList;
import java.util.zip.*;
import java.io.*;
import java.io.FileNotFoundException;
import java.util.Collection;
import soot.*;
import soot.util.*;
import soot.jimple.*;
import soot.coffi.ClassFile;
import soot.coffi.method_info;
import soot.coffi.CONSTANT_Utf8_info;
import soot.tagkit.SourceFileTag;
import soot.coffi.CoffiMethodSource;
/**
 * @production FieldDecl : {@link MemberDecl} ::= {@link Modifiers} TypeAccess:{@link Access} {@link VariableDecl}*;
 * @ast node
 * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/java.ast:79
 */
public class FieldDecl extends MemberDecl implements Cloneable {
  /**
   * @apilevel low-level
   */
  public void flushCache() {
    super.flushCache();
  }
  /**
   * @apilevel internal
   */
  public void flushCollectionCache() {
    super.flushCollectionCache();
  }
  /**
   * @apilevel internal
   */
  @SuppressWarnings({"unchecked", "cast"})
  public FieldDecl clone() throws CloneNotSupportedException {
    FieldDecl node = (FieldDecl)super.clone();
    node.in$Circle(false);
    node.is$Final(false);
    return node;
  }
  /**
   * @apilevel internal
   */
  @SuppressWarnings({"unchecked", "cast"})
  public FieldDecl copy() {
    try {
      FieldDecl node = (FieldDecl) clone();
      node.parent = null;
      if(children != null)
        node.children = (ASTNode[]) children.clone();
      return node;
    } catch (CloneNotSupportedException e) {
      throw new Error("Error: clone not supported for " +
        getClass().getName());
    }
  }
  /**
   * Create a deep copy of the AST subtree at this node.
   * The copy is dangling, i.e. has no parent.
   * @return dangling copy of the subtree at this node
   * @apilevel low-level
   */
  @SuppressWarnings({"unchecked", "cast"})
  public FieldDecl fullCopy() {
    FieldDecl tree = (FieldDecl) copy();
    if (children != null) {
      for (int i = 0; i < children.length; ++i) {
        ASTNode child = (ASTNode) children[i];
        if(child != null) {
          child = child.fullCopy();
          tree.setChild(child, i);
        }
      }
    }
    return tree;
  }
  /**
   * @ast method 
   * 
   */
  public FieldDecl() {
    super();


  }
  /**
   * Initializes the child array to the correct size.
   * Initializes List and Opt nta children.
   * @apilevel internal
   * @ast method
   * @ast method 
   * 
   */
  public void init$Children() {
    children = new ASTNode[3];
    setChild(new List(), 2);
  }
  /**
   * @ast method 
   * 
   */
  public FieldDecl(Modifiers p0, Access p1, List p2) {
    setChild(p0, 0);
    setChild(p1, 1);
    setChild(p2, 2);
  }
  /**
   * @apilevel low-level
   * @ast method 
   * 
   */
  protected int numChildren() {
    return 3;
  }
  /**
   * @apilevel internal
   * @ast method 
   * 
   */
  public boolean mayHaveRewrite() {
    return true;
  }
  /**
   * Replaces the Modifiers child.
   * @param node The new node to replace the Modifiers child.
   * @apilevel high-level
   * @ast method 
   * 
   */
  public void setModifiers(Modifiers node) {
    setChild(node, 0);
  }
  /**
   * Retrieves the Modifiers child.
   * @return The current node used as the Modifiers child.
   * @apilevel high-level
   * @ast method 
   * 
   */
  public Modifiers getModifiers() {
    return (Modifiers)getChild(0);
  }
  /**
   * Retrieves the Modifiers child.
   * 

This method does not invoke AST transformations.

* @return The current node used as the Modifiers child. * @apilevel low-level * @ast method * */ public Modifiers getModifiersNoTransform() { return (Modifiers)getChildNoTransform(0); } /** * Replaces the TypeAccess child. * @param node The new node to replace the TypeAccess child. * @apilevel high-level * @ast method * */ public void setTypeAccess(Access node) { setChild(node, 1); } /** * Retrieves the TypeAccess child. * @return The current node used as the TypeAccess child. * @apilevel high-level * @ast method * */ public Access getTypeAccess() { return (Access)getChild(1); } /** * Retrieves the TypeAccess child. *

This method does not invoke AST transformations.

* @return The current node used as the TypeAccess child. * @apilevel low-level * @ast method * */ public Access getTypeAccessNoTransform() { return (Access)getChildNoTransform(1); } /** * Replaces the VariableDecl list. * @param list The new list node to be used as the VariableDecl list. * @apilevel high-level * @ast method * */ public void setVariableDeclList(List list) { setChild(list, 2); } /** * Retrieves the number of children in the VariableDecl list. * @return Number of children in the VariableDecl list. * @apilevel high-level * @ast method * */ public int getNumVariableDecl() { return getVariableDeclList().getNumChild(); } /** * Retrieves the number of children in the VariableDecl list. * Calling this method will not trigger rewrites.. * @return Number of children in the VariableDecl list. * @apilevel low-level * @ast method * */ public int getNumVariableDeclNoTransform() { return getVariableDeclListNoTransform().getNumChildNoTransform(); } /** * Retrieves the element at index {@code i} in the VariableDecl list.. * @param i Index of the element to return. * @return The element at position {@code i} in the VariableDecl list. * @apilevel high-level * @ast method * */ @SuppressWarnings({"unchecked", "cast"}) public VariableDecl getVariableDecl(int i) { return (VariableDecl)getVariableDeclList().getChild(i); } /** * Append an element to the VariableDecl list. * @param node The element to append to the VariableDecl list. * @apilevel high-level * @ast method * */ public void addVariableDecl(VariableDecl node) { List list = (parent == null || state == null) ? getVariableDeclListNoTransform() : getVariableDeclList(); list.addChild(node); } /** * @apilevel low-level * @ast method * */ public void addVariableDeclNoTransform(VariableDecl node) { List list = getVariableDeclListNoTransform(); list.addChild(node); } /** * Replaces the VariableDecl list element at index {@code i} with the new node {@code node}. * @param node The new node to replace the old list element. * @param i The list index of the node to be replaced. * @apilevel high-level * @ast method * */ public void setVariableDecl(VariableDecl node, int i) { List list = getVariableDeclList(); list.setChild(node, i); } /** * Retrieves the VariableDecl list. * @return The node representing the VariableDecl list. * @apilevel high-level * @ast method * */ public List getVariableDecls() { return getVariableDeclList(); } /** * Retrieves the VariableDecl list. *

This method does not invoke AST transformations.

* @return The node representing the VariableDecl list. * @apilevel low-level * @ast method * */ public List getVariableDeclsNoTransform() { return getVariableDeclListNoTransform(); } /** * Retrieves the VariableDecl list. * @return The node representing the VariableDecl list. * @apilevel high-level * @ast method * */ @SuppressWarnings({"unchecked", "cast"}) public List getVariableDeclList() { List list = (List)getChild(2); list.getNumChild(); return list; } /** * Retrieves the VariableDecl list. *

This method does not invoke AST transformations.

* @return The node representing the VariableDecl list. * @apilevel low-level * @ast method * */ @SuppressWarnings({"unchecked", "cast"}) public List getVariableDeclListNoTransform() { return (List)getChildNoTransform(2); } /** * @attribute syn * @aspect Modifiers * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/Modifiers.jrag:243 */ public boolean isStatic() { ASTNode$State state = state(); try { return getModifiers().isStatic(); } finally { } } /** * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/SyntacticClassification.jrag:77 * @apilevel internal */ public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) { if(caller == getTypeAccessNoTransform()) { return NameType.TYPE_NAME; } else { return getParent().Define_NameType_nameType(this, caller); } } /** * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:257 * @apilevel internal */ public TypeDecl Define_TypeDecl_declType(ASTNode caller, ASTNode child) { if(caller == getVariableDeclListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return null; } else { return getParent().Define_TypeDecl_declType(this, caller); } } /** * @apilevel internal */ public ASTNode rewriteTo() { // Declared in /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/VariableDeclaration.jrag at line 101 if(getNumVariableDecl() == 1) { state().duringVariableDeclarationTransformation++; ASTNode result = rewriteRule0(); state().duringVariableDeclarationTransformation--; return result; } // Declared in /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/VariableDeclaration.jrag at line 112 if(getParent().getParent() instanceof TypeDecl && ((TypeDecl)getParent().getParent()).getBodyDeclListNoTransform() == getParent() && getNumVariableDecl() > 1) { state().duringVariableDeclarationTransformation++; List list = (List)getParent(); int i = list.getIndexOfChild(this); List newList = rewriteTypeDecl_getBodyDecl(); for(int j = 1; j < newList.getNumChildNoTransform(); j++) list.insertChild(newList.getChildNoTransform(j), ++i); state().duringVariableDeclarationTransformation--; return newList.getChildNoTransform(0); } return super.rewriteTo(); } /** * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/VariableDeclaration.jrag:101 * @apilevel internal */ private FieldDeclaration rewriteRule0() { { FieldDeclaration decl = getVariableDecl(0).createFieldDeclarationFrom(getModifiers(), getTypeAccess()); decl.setStart(start); // copy location information decl.setEnd(end); // copy location information return decl; } } /** * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/VariableDeclaration.jrag:112 * @apilevel internal */ private List rewriteTypeDecl_getBodyDecl() { { List varList = new List(); for(int j = 0; j < getNumVariableDecl(); j++) { FieldDeclaration f = getVariableDecl(j).createFieldDeclarationFrom( (Modifiers)getModifiers().fullCopy(), (Access)getTypeAccess().fullCopy() ); if(j == 0) f.setStart(start); else { f.getModifiersNoTransform().clearLocations(); f.getTypeAccessNoTransform().clearLocations(); } f.setFieldDecl(this); varList.add(f); } return varList; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy