Example #1
0
  public void outAIntegerConstant(AIntegerConstant node) {
    String s = (String) mProductions.removeLast();

    StringBuffer buf = new StringBuffer();
    if (node.getMinus() != null) buf.append('-');
    buf.append(s);

    s = buf.toString();
    if (s.endsWith("L")) {
      mProductions.addLast(LongConstant.v(Long.parseLong(s.substring(0, s.length() - 1))));
    } else mProductions.addLast(IntConstant.v(Integer.parseInt(s)));
  }
Example #2
0
 /**
  * Report the counts collected by instrumentation (for now, at least, there is no need to
  * provide access to the individual values as numbers).
  *
  * @return a string listing the counts.
  */
 public String reportInstrumentation() {
   int setCount = 0;
   for (Iterator it = sizeToSets.values().iterator(); it.hasNext(); ) {
     List sizeList = (List) it.next();
     setCount += sizeList.size();
   }
   if (setCount != registeredSets) {
     throw new IllegalStateException(
         "ThrowableSet.reportInstrumentation() assertion failure: registeredSets != list count");
   }
   StringBuffer buf =
       new StringBuffer("registeredSets: ")
           .append(setCount)
           .append("\naddsOfRefType: ")
           .append(addsOfRefType)
           .append("\naddsOfAnySubType: ")
           .append(addsOfAnySubType)
           .append("\naddsOfSet: ")
           .append(addsOfSet)
           .append("\naddsInclusionFromMap: ")
           .append(addsInclusionFromMap)
           .append("\naddsInclusionFromMemo: ")
           .append(addsInclusionFromMemo)
           .append("\naddsInclusionFromSearch: ")
           .append(addsInclusionFromSearch)
           .append("\naddsInclusionInterrupted: ")
           .append(addsInclusionInterrupted)
           .append("\naddsExclusionWithoutSearch: ")
           .append(addsExclusionWithoutSearch)
           .append("\naddsExclusionWithSearch: ")
           .append(addsExclusionWithSearch)
           .append("\nremovesOfAnySubType: ")
           .append(removesOfAnySubType)
           .append("\nremovesFromMap: ")
           .append(removesFromMap)
           .append("\nremovesFromMemo: ")
           .append(removesFromMemo)
           .append("\nremovesFromSearch: ")
           .append(removesFromSearch)
           .append("\nregistrationCalls: ")
           .append(registrationCalls)
           .append("\ncatchableAsQueries: ")
           .append(catchableAsQueries)
           .append("\ncatchableAsFromMap: ")
           .append(catchableAsFromMap)
           .append("\ncatchableAsFromSearch: ")
           .append(catchableAsFromSearch)
           .append('\n');
   return buf.toString();
 }
Example #3
0
 /** Returns a string representation of this <code>ThrowableSet</code>. */
 public String toString() {
   StringBuffer buffer = new StringBuffer(this.toBriefString());
   buffer.append(":\n  ");
   for (Iterator i = exceptionsIncluded.iterator(); i.hasNext(); ) {
     buffer.append('+');
     Object o = i.next();
     buffer.append(o == null ? "null" : o.toString());
     // buffer.append(i.next().toString());
   }
   for (Iterator i = exceptionsExcluded.iterator(); i.hasNext(); ) {
     buffer.append('-');
     buffer.append(i.next().toString());
   }
   return buffer.toString();
 }
  public String toString() {
    StringBuffer buffer = new StringBuffer();

    buffer.append(Jimple.v().STATICINVOKE + " " + methodRef.getSignature() + "(");

    for (int i = 0; i < argBoxes.size(); i++) {
      if (i != 0) buffer.append(", ");

      buffer.append(getArg(i).toString());
    }

    buffer.append(")");

    return buffer.toString();
  }
Example #5
0
  public String toString() {
    Iterator it = iterator();
    StringBuffer buf = new StringBuffer();
    while (it.hasNext()) {
      JPegStmt u = (JPegStmt) it.next();
      buf.append("u is: " + u + "\n");
      List l = new ArrayList();
      l.addAll(getPredsOf(u));
      buf.append("preds: " + l + "\n");
      // buf.append(u.toString() + '\n');
      l = new ArrayList();
      l.addAll(getSuccsOf(u));
      buf.append("succs: " + l + "\n");
    }

    return buf.toString();
  }
Example #6
0
  /**
   * Utility method which prints the abbreviations of the elements in a passed {@link Set} of
   * exception types.
   *
   * @param s The exceptions to print.
   * @param connector The character to insert between exceptions.
   * @return An abbreviated representation of the exceptions.
   */
  private String toAbbreviatedString(Set s, char connector) {
    final String JAVA_LANG = "java.lang.";
    final int JAVA_LANG_LENGTH = JAVA_LANG.length();
    final String EXCEPTION = "Exception";
    final int EXCEPTION_LENGTH = EXCEPTION.length();

    Collection vmErrorThrowables = ThrowableSet.Manager.v().VM_ERRORS.exceptionsIncluded;
    boolean containsAllVmErrors = s.containsAll(vmErrorThrowables);
    StringBuffer buf = new StringBuffer();

    if (containsAllVmErrors) {
      buf.append(connector);
      buf.append("vmErrors");
    }

    for (Iterator it = sortedThrowableIterator(s); it.hasNext(); ) {
      RefLikeType reflikeType = (RefLikeType) it.next();
      RefType baseType = null;
      if (reflikeType instanceof RefType) {
        baseType = (RefType) reflikeType;
        if (vmErrorThrowables.contains(baseType) && containsAllVmErrors) {
          continue; // Already accounted for vmErrors.
        } else {
          buf.append(connector);
        }
      } else if (reflikeType instanceof AnySubType) {
        buf.append(connector);
        buf.append('(');
        baseType = ((AnySubType) reflikeType).getBase();
      }
      String typeName = baseType.toString();
      if (typeName.startsWith(JAVA_LANG)) {
        typeName = typeName.substring(JAVA_LANG_LENGTH);
      }
      if (typeName.length() > EXCEPTION_LENGTH && typeName.endsWith(EXCEPTION)) {
        typeName = typeName.substring(0, typeName.length() - EXCEPTION_LENGTH);
      }
      buf.append(typeName);
      if (reflikeType instanceof AnySubType) {
        buf.append(')');
      }
    }
    return buf.toString();
  }
Example #7
0
  public String toString() {
    StringBuffer b = new StringBuffer();

    b.append(label_toString());

    b.append("switch (");
    b.append(get_Key());
    b.append(")");
    b.append(NEWLINE);

    b.append("{");
    b.append(NEWLINE);

    Iterator<Object> it = indexList.iterator();
    while (it.hasNext()) {

      Object index = it.next();

      b.append(TAB);

      if (index instanceof String) b.append("default");
      else {
        b.append("case ");
        b.append(((Integer) index).toString());
      }

      b.append(":");
      b.append(NEWLINE);

      List<Object> subBody = index2BodyList.get(index);

      if (subBody != null) {
        b.append(body_toString(subBody));

        if (it.hasNext()) b.append(NEWLINE);
      }
    }

    b.append("}");
    b.append(NEWLINE);

    return b.toString();
  }
Example #8
0
  /* ('#' (('-'? 'Infinity') | 'NaN') ('f' | 'F')? ) ; */
  public void outAFloatConstant(AFloatConstant node) {
    String s = (String) mProductions.removeLast();

    boolean isDouble = true;
    float value = 0;
    double dvalue = 0;

    if (s.endsWith("f") || s.endsWith("F")) isDouble = false;

    if (s.charAt(0) == '#') {
      if (s.charAt(1) == '-') {
        if (isDouble) dvalue = Double.NEGATIVE_INFINITY;
        else value = Float.NEGATIVE_INFINITY;
      } else if (s.charAt(1) == 'I') {
        if (isDouble) dvalue = Double.POSITIVE_INFINITY;
        else value = Float.POSITIVE_INFINITY;
      } else {
        if (isDouble) dvalue = Double.NaN;
        else value = Float.NaN;
      }
    } else {
      StringBuffer buf = new StringBuffer();
      if (node.getMinus() != null) buf.append('-');
      buf.append(s);
      s = buf.toString();

      if (isDouble) dvalue = Double.parseDouble(s);
      else value = Float.parseFloat(s);
    }

    Object res;
    if (isDouble) res = DoubleConstant.v(dvalue);
    else res = FloatConstant.v(value);

    mProductions.addLast(res);
  }