Java Code Examples for com.sun.org.apache.bcel.internal.generic.InstructionList#insert()

The following examples show how to use com.sun.org.apache.bcel.internal.generic.InstructionList#insert() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Sort.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 2
Source File: Sort.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 3
Source File: Sort.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = (Sort)sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 4
Source File: Sort.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 5
Source File: Sort.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 6
Source File: Sort.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 7
Source File: Sort.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(List<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.get(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 8
Source File: Sort.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 9
Source File: Sort.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 10
Source File: Sort.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = (Sort)sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}
 
Example 11
Source File: Sort.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
 */
private static MethodGenerator compileExtract(Vector sortObjects,
                                     NodeSortRecordGenerator sortRecord,
                                     ConstantPoolGen cpg,
                                     String className) {
    final InstructionList il = new InstructionList();

    // String NodeSortRecord.extractValueFromDOM(dom,node,level);
    final CompareGenerator extractMethod =
        new CompareGenerator(ACC_PUBLIC | ACC_FINAL,
                             com.sun.org.apache.bcel.internal.generic.Type.STRING,
                             new com.sun.org.apache.bcel.internal.generic.Type[] {
                                 Util.getJCRefType(DOM_INTF_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 com.sun.org.apache.bcel.internal.generic.Type.INT,
                                 Util.getJCRefType(TRANSLET_SIG),
                                 com.sun.org.apache.bcel.internal.generic.Type.INT
                             },
                             new String[] { "dom",
                                            "current",
                                            "level",
                                            "translet",
                                            "last"
                             },
                             "extractValueFromDOM", className, il, cpg);

    // Values needed for the switch statement
    final int levels = sortObjects.size();
    final int match[] = new int[levels];
    final InstructionHandle target[] = new InstructionHandle[levels];
    InstructionHandle tblswitch = null;

    // Compile switch statement only if the key has multiple levels
    if (levels > 1) {
        // Put the parameter to the swtich statement on the stack
        il.append(new ILOAD(extractMethod.getLocalIndex("level")));
        // Append the switch statement here later on
        tblswitch = il.append(new NOP());
    }

    // Append all the cases for the switch statment
    for (int level = 0; level < levels; level++) {
        match[level] = level;
        final Sort sort = (Sort)sortObjects.elementAt(level);
        target[level] = il.append(NOP);
        sort.translateSelect(sortRecord, extractMethod);
        il.append(ARETURN);
    }

    // Compile def. target for switch statement if key has multiple levels
    if (levels > 1) {
        // Append the default target - it will _NEVER_ be reached
        InstructionHandle defaultTarget =
            il.append(new PUSH(cpg, EMPTYSTRING));
        il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
        il.append(ARETURN);
    }

    return extractMethod;
}