Beispiel #1
0
  private void executeQuery(SOQLQuery q, ObjectVisitor visitor) throws SOQLException {
    InstanceKlass kls = null;
    if (q.className != null) {
      kls = SystemDictionaryHelper.findInstanceKlass(q.className);
      if (kls == null) {
        throw new SOQLException(q.className + " is not found!");
      }
    }

    StringBuffer buf = new StringBuffer();
    buf.append("function result(");
    if (q.identifier != null) {
      buf.append(q.identifier);
    }
    buf.append(") { return ");
    buf.append(q.selectExpr.replace('\n', ' '));
    buf.append("; }");

    String selectCode = buf.toString();
    debugPrint(selectCode);
    String whereCode = null;
    if (q.whereExpr != null) {
      buf = new StringBuffer();
      buf.append("function filter(");
      buf.append(q.identifier);
      buf.append(") { return ");
      buf.append(q.whereExpr.replace('\n', ' '));
      buf.append("; }");
      whereCode = buf.toString();
      debugPrint(whereCode);
    } else {
      whereCode = "filter = null;";
    }

    beginQuery();
    // compile select expression and where condition
    evalString(selectCode, "", 1);
    evalString(whereCode, "", 1);

    // iterate thru heap, if needed
    if (q.className != null) {
      try {
        iterateOops(kls, visitor, q.isInstanceOf);
      } finally {
        endQuery();
      }
    } else {
      // simple "select <expr>" query
      try {
        Object select = call("result", new Object[] {});
        visitor.visit(select);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
Beispiel #2
0
 public String toString() {
   StringBuffer buf = new StringBuffer();
   buf.append("aload_0");
   buf.append(spaces);
   buf.append(super.toString());
   return buf.toString();
 }
 public String toString() {
   StringBuffer buf = new StringBuffer();
   buf.append("bipush");
   buf.append(spaces);
   buf.append(new Byte(getValue()).toString());
   return buf.toString();
 }
Beispiel #4
0
 public String toString() {
   StringBuffer buf = new StringBuffer();
   buf.append("Java Heap (capacity=");
   buf.append(getCapacity());
   buf.append(", used=");
   buf.append(getUsed());
   buf.append(")");
   return buf.toString();
 }
Beispiel #5
0
 /** Returns name and signature in external form for debugging purposes */
 public String externalNameAndSignature() {
   final StringBuffer buf = new StringBuffer();
   buf.append(getMethodHolder().getName().asString());
   buf.append(".");
   buf.append(getName().asString());
   buf.append("(");
   new SignatureConverter(getSignature(), buf).iterateParameters();
   buf.append(")");
   return buf.toString().replace('/', '.');
 }