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

soot.JastAddJ.NumericType 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 NumericType : {@link PrimitiveType};
 * @ast node
 * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/java.ast:53
 */
public abstract class NumericType extends PrimitiveType implements Cloneable {
  /**
   * @apilevel low-level
   */
  public void flushCache() {
    super.flushCache();
    unaryNumericPromotion_computed = false;
    unaryNumericPromotion_value = null;
    binaryNumericPromotion_TypeDecl_values = null;
  }
  /**
   * @apilevel internal
   */
  public void flushCollectionCache() {
    super.flushCollectionCache();
  }
  /**
   * @apilevel internal
   */
  @SuppressWarnings({"unchecked", "cast"})
  public NumericType clone() throws CloneNotSupportedException {
    NumericType node = (NumericType)super.clone();
    node.unaryNumericPromotion_computed = false;
    node.unaryNumericPromotion_value = null;
    node.binaryNumericPromotion_TypeDecl_values = null;
    node.in$Circle(false);
    node.is$Final(false);
    return node;
  }
  /**
   * @ast method 
   * @aspect AutoBoxingCodegen
   * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/Jimple1.5Backend/AutoBoxingCodegen.jrag:20
   */
  public soot.Value emitCastTo(Body b, soot.Value v, TypeDecl type, ASTNode location) {
    if(type.isUnknown()) throw new Error("Trying to cast to Unknown");
    if(type == this)
      return v;
    if((isLong() || this instanceof FloatingPointType) && type.isIntegralType()) {
      v = b.newCastExpr(
        asImmediate(b, v), typeInt().getSootType(), location);
      return typeInt().emitCastTo(b, v, type, location);
    }
    else if(type instanceof NumericType) {
      return b.newCastExpr(
        asImmediate(b, v),
        type.getSootType(),
        location
      );
    }
    else if(!type.isNumericType())
      return emitCastTo(b, v, boxed(), location);
    else
      return boxed().emitBoxingOperation(b, emitCastTo(b, v, type.unboxed(), location), location);
  }
  /**
   * @ast method 
   * 
   */
  public NumericType() {
    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 Opt(), 1);
    setChild(new List(), 2);
  }
  /**
   * @ast method 
   * 
   */
  public NumericType(Modifiers p0, String p1, Opt p2, List p3) {
    setChild(p0, 0);
    setID(p1);
    setChild(p2, 1);
    setChild(p3, 2);
  }
  /**
   * @ast method 
   * 
   */
  public NumericType(Modifiers p0, beaver.Symbol p1, Opt p2, List p3) {
    setChild(p0, 0);
    setID(p1);
    setChild(p2, 1);
    setChild(p3, 2);
  }
  /**
   * @apilevel low-level
   * @ast method 
   * 
   */
  protected int numChildren() {
    return 3;
  }
  /**
   * @apilevel internal
   * @ast method 
   * 
   */
  public boolean mayHaveRewrite() {
    return false;
  }
  /**
   * 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 lexeme ID. * @param value The new value for the lexeme ID. * @apilevel high-level * @ast method * */ public void setID(String value) { tokenString_ID = value; } /** * JastAdd-internal setter for lexeme ID using the Beaver parser. * @apilevel internal * @ast method * */ public void setID(beaver.Symbol symbol) { if(symbol.value != null && !(symbol.value instanceof String)) throw new UnsupportedOperationException("setID is only valid for String lexemes"); tokenString_ID = (String)symbol.value; IDstart = symbol.getStart(); IDend = symbol.getEnd(); } /** * Retrieves the value for the lexeme ID. * @return The value for the lexeme ID. * @apilevel high-level * @ast method * */ public String getID() { return tokenString_ID != null ? tokenString_ID : ""; } /** * Replaces the optional node for the SuperClassAccess child. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! * @param opt The new node to be used as the optional node for the SuperClassAccess child. * @apilevel low-level * @ast method * */ public void setSuperClassAccessOpt(Opt opt) { setChild(opt, 1); } /** * Check whether the optional SuperClassAccess child exists. * @return {@code true} if the optional SuperClassAccess child exists, {@code false} if it does not. * @apilevel high-level * @ast method * */ public boolean hasSuperClassAccess() { return getSuperClassAccessOpt().getNumChild() != 0; } /** * Retrieves the (optional) SuperClassAccess child. * @return The SuperClassAccess child, if it exists. Returns {@code null} otherwise. * @apilevel low-level * @ast method * */ @SuppressWarnings({"unchecked", "cast"}) public Access getSuperClassAccess() { return (Access)getSuperClassAccessOpt().getChild(0); } /** * Replaces the (optional) SuperClassAccess child. * @param node The new node to be used as the SuperClassAccess child. * @apilevel high-level * @ast method * */ public void setSuperClassAccess(Access node) { getSuperClassAccessOpt().setChild(node, 0); } /** * @apilevel low-level * @ast method * */ @SuppressWarnings({"unchecked", "cast"}) public Opt getSuperClassAccessOpt() { return (Opt)getChild(1); } /** * Retrieves the optional node for child SuperClassAccess. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! *

This method does not invoke AST transformations.

* @return The optional node for child SuperClassAccess. * @apilevel low-level * @ast method * */ @SuppressWarnings({"unchecked", "cast"}) public Opt getSuperClassAccessOptNoTransform() { return (Opt)getChildNoTransform(1); } /** * Replaces the BodyDecl list. * @param list The new list node to be used as the BodyDecl list. * @apilevel high-level * @ast method * */ public void setBodyDeclList(List list) { setChild(list, 2); } /** * Retrieves the number of children in the BodyDecl list. * @return Number of children in the BodyDecl list. * @apilevel high-level * @ast method * */ public int getNumBodyDecl() { return getBodyDeclList().getNumChild(); } /** * Retrieves the number of children in the BodyDecl list. * Calling this method will not trigger rewrites.. * @return Number of children in the BodyDecl list. * @apilevel low-level * @ast method * */ public int getNumBodyDeclNoTransform() { return getBodyDeclListNoTransform().getNumChildNoTransform(); } /** * Retrieves the element at index {@code i} in the BodyDecl list.. * @param i Index of the element to return. * @return The element at position {@code i} in the BodyDecl list. * @apilevel high-level * @ast method * */ @SuppressWarnings({"unchecked", "cast"}) public BodyDecl getBodyDecl(int i) { return (BodyDecl)getBodyDeclList().getChild(i); } /** * Append an element to the BodyDecl list. * @param node The element to append to the BodyDecl list. * @apilevel high-level * @ast method * */ public void addBodyDecl(BodyDecl node) { List list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); list.addChild(node); } /** * @apilevel low-level * @ast method * */ public void addBodyDeclNoTransform(BodyDecl node) { List list = getBodyDeclListNoTransform(); list.addChild(node); } /** * Replaces the BodyDecl 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 setBodyDecl(BodyDecl node, int i) { List list = getBodyDeclList(); list.setChild(node, i); } /** * Retrieves the BodyDecl list. * @return The node representing the BodyDecl list. * @apilevel high-level * @ast method * */ public List getBodyDecls() { return getBodyDeclList(); } /** * Retrieves the BodyDecl list. *

This method does not invoke AST transformations.

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

This method does not invoke AST transformations.

* @return The node representing the BodyDecl list. * @apilevel low-level * @ast method * */ @SuppressWarnings({"unchecked", "cast"}) public List getBodyDeclListNoTransform() { return (List)getChildNoTransform(2); } /** * @ast method * @aspect NumericPromotion * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:155 */ private TypeDecl refined_NumericPromotion_NumericType_binaryNumericPromotion_TypeDecl(TypeDecl type) { if(!type.isNumericType()) return unknownType(); return unaryNumericPromotion().instanceOf(type) ? type : unaryNumericPromotion(); } /** * @apilevel internal */ protected boolean unaryNumericPromotion_computed = false; /** * @apilevel internal */ protected TypeDecl unaryNumericPromotion_value; /** * @attribute syn * @aspect NumericPromotion * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:148 */ @SuppressWarnings({"unchecked", "cast"}) public TypeDecl unaryNumericPromotion() { if(unaryNumericPromotion_computed) { return unaryNumericPromotion_value; } ASTNode$State state = state(); int num = state.boundariesCrossed; boolean isFinal = this.is$Final(); unaryNumericPromotion_value = unaryNumericPromotion_compute(); if(isFinal && num == state().boundariesCrossed) unaryNumericPromotion_computed = true; return unaryNumericPromotion_value; } /** * @apilevel internal */ private TypeDecl unaryNumericPromotion_compute() { return this; } protected java.util.Map binaryNumericPromotion_TypeDecl_values; /** * @attribute syn * @aspect AutoBoxing * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/AutoBoxing.jrag:175 */ @SuppressWarnings({"unchecked", "cast"}) public TypeDecl binaryNumericPromotion(TypeDecl type) { Object _parameters = type; if(binaryNumericPromotion_TypeDecl_values == null) binaryNumericPromotion_TypeDecl_values = new java.util.HashMap(4); if(binaryNumericPromotion_TypeDecl_values.containsKey(_parameters)) { return (TypeDecl)binaryNumericPromotion_TypeDecl_values.get(_parameters); } ASTNode$State state = state(); int num = state.boundariesCrossed; boolean isFinal = this.is$Final(); TypeDecl binaryNumericPromotion_TypeDecl_value = binaryNumericPromotion_compute(type); if(isFinal && num == state().boundariesCrossed) binaryNumericPromotion_TypeDecl_values.put(_parameters, binaryNumericPromotion_TypeDecl_value); return binaryNumericPromotion_TypeDecl_value; } /** * @apilevel internal */ private TypeDecl binaryNumericPromotion_compute(TypeDecl type) { if(type.isReferenceType()) type = type.unboxed(); return refined_NumericPromotion_NumericType_binaryNumericPromotion_TypeDecl(type); } /** * @attribute syn * @aspect TypeAnalysis * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:173 */ public boolean isNumericType() { ASTNode$State state = state(); try { return true; } finally { } } /** * @apilevel internal */ public ASTNode rewriteTo() { return super.rewriteTo(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy