1 16 19 20 package com.sun.org.apache.xalan.internal.xsltc.compiler.util; 21 22 import com.sun.org.apache.bcel.internal.generic.ALOAD; 23 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; 24 import com.sun.org.apache.bcel.internal.generic.ILOAD; 25 import com.sun.org.apache.bcel.internal.generic.ISTORE; 26 import com.sun.org.apache.bcel.internal.generic.Instruction; 27 import com.sun.org.apache.bcel.internal.generic.InstructionList; 28 import com.sun.org.apache.bcel.internal.generic.Type; 29 30 34 public final class MatchGenerator extends MethodGenerator { 35 private static int CURRENT_INDEX = 1; 36 37 private int _iteratorIndex = INVALID_INDEX; 38 39 private final Instruction _iloadCurrent; 40 private final Instruction _istoreCurrent; 41 private Instruction _aloadDom; 42 43 public MatchGenerator(int access_flags, Type return_type, 44 Type[] arg_types, String [] arg_names, 45 String method_name, String class_name, 46 InstructionList il, ConstantPoolGen cp) { 47 super(access_flags, return_type, arg_types, arg_names, method_name, 48 class_name, il, cp); 49 50 _iloadCurrent = new ILOAD(CURRENT_INDEX); 51 _istoreCurrent = new ISTORE(CURRENT_INDEX); 52 } 53 54 public Instruction loadCurrentNode() { 55 return _iloadCurrent; 56 } 57 58 public Instruction storeCurrentNode() { 59 return _istoreCurrent; 60 } 61 62 public int getHandlerIndex() { 63 return INVALID_INDEX; } 65 66 69 public Instruction loadDOM() { 70 return _aloadDom; 71 } 72 73 76 public void setDomIndex(int domIndex) { 77 _aloadDom = new ALOAD(domIndex); 78 } 79 80 83 public int getIteratorIndex() { 84 return _iteratorIndex; 85 } 86 87 90 public void setIteratorIndex(int iteratorIndex) { 91 _iteratorIndex = iteratorIndex; 92 } 93 94 public int getLocalIndex(String name) { 95 if (name.equals("current")) { 96 return CURRENT_INDEX; 97 } 98 return super.getLocalIndex(name); 99 } 100 } 101 | Popular Tags |