Package org.apache.xalan.xsltc.compiler.util

Examples of org.apache.xalan.xsltc.compiler.util.MatchGenerator


         MethodGenerator methodGen)
    {
  int current;
  int field;
  LocalVariableGen local;
  MatchGenerator matchGen;
  NodeCounterGenerator nodeCounterGen;

  _className = getXSLTC().getHelperClassName();
  nodeCounterGen = new NodeCounterGenerator(_className,
              ClassNames[_level],
              toString(),
              ACC_PUBLIC | ACC_SUPER,
              null,
              classGen.getStylesheet());
  InstructionList il = null;
  ConstantPoolGen cpg = nodeCounterGen.getConstantPool();

  // Add a new instance variable for each var in closure
  final int closureLen = (_closureVars == null) ? 0 :
      _closureVars.size();

  for (int i = 0; i < closureLen; i++) {
      VariableBase var =
    ((VariableRefBase) _closureVars.get(i)).getVariable();

      nodeCounterGen.addField(new Field(ACC_PUBLIC,
          cpg.addUtf8(var.getEscapedName()),
          cpg.addUtf8(var.getType().toSignature()),
          null, cpg.getConstantPool()));
  }

  // Add a single constructor to the class
  compileConstructor(nodeCounterGen);

  /*
   * Compile method matchesFrom()
   */
  if (_from != null) {
      il = new InstructionList();
      matchGen =
    new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
           org.apache.bcel.generic.Type.BOOLEAN,
           new org.apache.bcel.generic.Type[] {
               org.apache.bcel.generic.Type.INT,
           },
           new String[] {
               "node",
           },
           "matchesFrom", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);

      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _from.translate(nodeCounterGen, matchGen);
      _from.synthesize(nodeCounterGen, matchGen);
      il.append(IRETURN);
       
      nodeCounterGen.addMethod(matchGen);
  }

  /*
   * Compile method matchesCount()
   */
  if (_count != null) {
      il = new InstructionList();
      matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
            org.apache.bcel.generic.Type.BOOLEAN,
            new org.apache.bcel.generic.Type[] {
                org.apache.bcel.generic.Type.INT,
            },
            new String[] {
                "node",
            },
            "matchesCount", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);
     
      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _count.translate(nodeCounterGen, matchGen);
      _count.synthesize(nodeCounterGen, matchGen);
     
      il.append(IRETURN);
       
View Full Code Here


         MethodGenerator methodGen)
    {
  int current;
  int field;
  LocalVariableGen local;
  MatchGenerator matchGen;
  NodeCounterGenerator nodeCounterGen;

  _className = getXSLTC().getHelperClassName();
  nodeCounterGen = new NodeCounterGenerator(_className,
              ClassNames[_level],
              toString(),
              ACC_PUBLIC | ACC_SUPER,
              null,
              classGen.getStylesheet());
  InstructionList il = null;
  ConstantPoolGen cpg = nodeCounterGen.getConstantPool();

  // Add a new instance variable for each var in closure
  final int closureLen = (_closureVars == null) ? 0 :
      _closureVars.size();

  for (int i = 0; i < closureLen; i++) {
      VariableBase var =
    ((VariableRefBase) _closureVars.get(i)).getVariable();

      nodeCounterGen.addField(new Field(ACC_PUBLIC,
          cpg.addUtf8(var.getEscapedName()),
          cpg.addUtf8(var.getType().toSignature()),
          null, cpg.getConstantPool()));
  }

  // Add a single constructor to the class
  compileConstructor(nodeCounterGen);

  /*
   * Compile method matchesFrom()
   */
  if (_from != null) {
      il = new InstructionList();
      matchGen =
    new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
           org.apache.bcel.generic.Type.BOOLEAN,
           new org.apache.bcel.generic.Type[] {
               org.apache.bcel.generic.Type.INT,
           },
           new String[] {
               "node",
           },
           "matchesFrom", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);

      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _from.translate(nodeCounterGen, matchGen);
      _from.synthesize(nodeCounterGen, matchGen);
      il.append(IRETURN);
       
      matchGen.stripAttributes(true);
      matchGen.setMaxLocals();
      matchGen.setMaxStack();
      matchGen.removeNOPs();
      nodeCounterGen.addMethod(matchGen.getMethod());
  }

  /*
   * Compile method matchesCount()
   */
  if (_count != null) {
      il = new InstructionList();
      matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
            org.apache.bcel.generic.Type.BOOLEAN,
            new org.apache.bcel.generic.Type[] {
                org.apache.bcel.generic.Type.INT,
            },
            new String[] {
                "node",
            },
            "matchesCount", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);
     
      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _count.translate(nodeCounterGen, matchGen);
      _count.synthesize(nodeCounterGen, matchGen);
     
      il.append(IRETURN);
       
      matchGen.stripAttributes(true);
      matchGen.setMaxLocals();
      matchGen.setMaxStack();
      matchGen.removeNOPs();
      nodeCounterGen.addMethod(matchGen.getMethod());
  }
 
  getXSLTC().dumpClass(nodeCounterGen.getJavaClass());

  // Push an instance of the newly created class
View Full Code Here

         MethodGenerator methodGen)
    {
  int current;
  int field;
  LocalVariableGen local;
  MatchGenerator matchGen;
  NodeCounterGenerator nodeCounterGen;

  _className = getXSLTC().getHelperClassName();
  nodeCounterGen = new NodeCounterGenerator(_className,
              ClassNames[_level],
              toString(),
              ACC_PUBLIC | ACC_SUPER,
              null,
              classGen.getStylesheet());
  InstructionList il = null;
  ConstantPoolGen cpg = nodeCounterGen.getConstantPool();

  // Add a new instance variable for each var in closure
  final int closureLen = (_closureVars == null) ? 0 :
      _closureVars.size();

  for (int i = 0; i < closureLen; i++) {
      VariableBase var =
    ((VariableRefBase) _closureVars.get(i)).getVariable();

      nodeCounterGen.addField(new Field(ACC_PUBLIC,
          cpg.addUtf8(var.getVariable()),
          cpg.addUtf8(var.getType().toSignature()),
          null, cpg.getConstantPool()));
  }

  // Add a single constructor to the class
  compileConstructor(nodeCounterGen);

  /*
   * Compile method matchesFrom()
   */
  if (_from != null) {
      il = new InstructionList();
      matchGen =
    new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
           org.apache.bcel.generic.Type.BOOLEAN,
           new org.apache.bcel.generic.Type[] {
               org.apache.bcel.generic.Type.INT,
           },
           new String[] {
               "node",
           },
           "matchesFrom", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);

      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _from.translate(nodeCounterGen, matchGen);
      _from.synthesize(nodeCounterGen, matchGen);
      il.append(IRETURN);
       
      matchGen.stripAttributes(true);
      matchGen.setMaxLocals();
      matchGen.setMaxStack();
      matchGen.removeNOPs();
      nodeCounterGen.addMethod(matchGen.getMethod());
  }

  /*
   * Compile method matchesCount()
   */
  if (_count != null) {
      il = new InstructionList();
      matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
            org.apache.bcel.generic.Type.BOOLEAN,
            new org.apache.bcel.generic.Type[] {
                org.apache.bcel.generic.Type.INT,
            },
            new String[] {
                "node",
            },
            "matchesCount", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);
     
      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _count.translate(nodeCounterGen, matchGen);
      _count.synthesize(nodeCounterGen, matchGen);
     
      il.append(IRETURN);
       
      matchGen.stripAttributes(true);
      matchGen.setMaxLocals();
      matchGen.setMaxStack();
      matchGen.removeNOPs();
      nodeCounterGen.addMethod(matchGen.getMethod());
  }
 
  getXSLTC().dumpClass(nodeCounterGen.getJavaClass());

  // Push an instance of the newly created class
View Full Code Here

         MethodGenerator methodGen)
    {
  int current;
  int field;
  LocalVariableGen local;
  MatchGenerator matchGen;
  NodeCounterGenerator nodeCounterGen;

  _className = getXSLTC().getHelperClassName();
  nodeCounterGen = new NodeCounterGenerator(_className,
              ClassNames[_level],
              toString(),
              ACC_PUBLIC | ACC_SUPER,
              null,
              classGen.getStylesheet());
  InstructionList il = null;
  ConstantPoolGen cpg = nodeCounterGen.getConstantPool();

  // Add a new instance variable for each var in closure
  final int closureLen = (_closureVars == null) ? 0 :
      _closureVars.size();

  for (int i = 0; i < closureLen; i++) {
      VariableBase var =
    ((VariableRefBase) _closureVars.get(i)).getVariable();

      nodeCounterGen.addField(new Field(ACC_PUBLIC,
          cpg.addUtf8(var.getEscapedName()),
          cpg.addUtf8(var.getType().toSignature()),
          null, cpg.getConstantPool()));
  }

  // Add a single constructor to the class
  compileConstructor(nodeCounterGen);

  /*
   * Compile method matchesFrom()
   */
  if (_from != null) {
      il = new InstructionList();
      matchGen =
    new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
           org.apache.bcel.generic.Type.BOOLEAN,
           new org.apache.bcel.generic.Type[] {
               org.apache.bcel.generic.Type.INT,
           },
           new String[] {
               "node",
           },
           "matchesFrom", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);

      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _from.translate(nodeCounterGen, matchGen);
      _from.synthesize(nodeCounterGen, matchGen);
      il.append(IRETURN);
       
      matchGen.stripAttributes(true);
      matchGen.setMaxLocals();
      matchGen.setMaxStack();
      matchGen.removeNOPs();
      nodeCounterGen.addMethod(matchGen.getMethod());
  }

  /*
   * Compile method matchesCount()
   */
  if (_count != null) {
      il = new InstructionList();
      matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
            org.apache.bcel.generic.Type.BOOLEAN,
            new org.apache.bcel.generic.Type[] {
                org.apache.bcel.generic.Type.INT,
            },
            new String[] {
                "node",
            },
            "matchesCount", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);
     
      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _count.translate(nodeCounterGen, matchGen);
      _count.synthesize(nodeCounterGen, matchGen);
     
      il.append(IRETURN);
       
      matchGen.stripAttributes(true);
      matchGen.setMaxLocals();
      matchGen.setMaxStack();
      matchGen.removeNOPs();
      nodeCounterGen.addMethod(matchGen.getMethod());
  }
 
  getXSLTC().dumpClass(nodeCounterGen.getJavaClass());

  // Push an instance of the newly created class
View Full Code Here

         MethodGenerator methodGen)
    {
  int current;
  int field;
  LocalVariableGen local;
  MatchGenerator matchGen;
  NodeCounterGenerator nodeCounterGen;

  _className = getXSLTC().getHelperClassName();
  nodeCounterGen = new NodeCounterGenerator(_className,
              ClassNames[_level],
              toString(),
              ACC_PUBLIC | ACC_SUPER,
              null,
              classGen.getStylesheet());
  InstructionList il = null;
  ConstantPoolGen cpg = nodeCounterGen.getConstantPool();

  // Add a new instance variable for each var in closure
  final int closureLen = (_closureVars == null) ? 0 :
      _closureVars.size();

  for (int i = 0; i < closureLen; i++) {
      VariableBase var =
    ((VariableRefBase) _closureVars.get(i)).getVariable();

      nodeCounterGen.addField(new Field(ACC_PUBLIC,
          cpg.addUtf8(var.getEscapedName()),
          cpg.addUtf8(var.getType().toSignature()),
          null, cpg.getConstantPool()));
  }

  // Add a single constructor to the class
  compileConstructor(nodeCounterGen);

  /*
   * Compile method matchesFrom()
   */
  if (_from != null) {
      il = new InstructionList();
      matchGen =
    new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
           org.apache.bcel.generic.Type.BOOLEAN,
           new org.apache.bcel.generic.Type[] {
               org.apache.bcel.generic.Type.INT,
           },
           new String[] {
               "node",
           },
           "matchesFrom", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);

      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _from.translate(nodeCounterGen, matchGen);
      _from.synthesize(nodeCounterGen, matchGen);
      il.append(IRETURN);
       
      nodeCounterGen.addMethod(matchGen);
  }

  /*
   * Compile method matchesCount()
   */
  if (_count != null) {
      il = new InstructionList();
      matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
            org.apache.bcel.generic.Type.BOOLEAN,
            new org.apache.bcel.generic.Type[] {
                org.apache.bcel.generic.Type.INT,
            },
            new String[] {
                "node",
            },
            "matchesCount", _className, il, cpg);

      compileLocals(nodeCounterGen,matchGen,il);
     
      // Translate Pattern
      il.append(matchGen.loadContextNode());
      _count.translate(nodeCounterGen, matchGen);
      _count.synthesize(nodeCounterGen, matchGen);
     
      il.append(IRETURN);
       
View Full Code Here

TOP

Related Classes of org.apache.xalan.xsltc.compiler.util.MatchGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.