1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Copyright 2001-2004 The Apache Software Foundation.
   7  *
   8  * Licensed under the Apache License, Version 2.0 (the "License");
   9  * you may not use this file except in compliance with the License.
  10  * You may obtain a copy of the License at
  11  *
  12  *     http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 /*
  21  * $Id: RtMethodGenerator.java,v 1.2.4.1 2005/09/05 11:30:49 pvedula Exp $
  22  */
  23 
  24 package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
  25 
  26 import com.sun.org.apache.bcel.internal.generic.ALOAD;
  27 import com.sun.org.apache.bcel.internal.generic.ASTORE;
  28 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
  29 import com.sun.org.apache.bcel.internal.generic.Instruction;
  30 import com.sun.org.apache.bcel.internal.generic.InstructionList;
  31 import com.sun.org.apache.bcel.internal.generic.Type;
  32 
  33 /**
  34  * This class is used for result trees implemented as methods. These
  35  * methods take a reference to the DOM and to the handler only.
  36  * @author Jacek Ambroziak
  37  * @author Santiago Pericas-Geertsen
  38  */
  39 public final class RtMethodGenerator extends MethodGenerator {
  40     private static final int HANDLER_INDEX = 2;
  41     private final Instruction _astoreHandler;
  42     private final Instruction _aloadHandler;
  43 
  44     public RtMethodGenerator(int access_flags, Type return_type,
  45                              Type[] arg_types, String[] arg_names,
  46                              String method_name, String class_name,
  47                              InstructionList il, ConstantPoolGen cp) {
  48         super(access_flags, return_type, arg_types, arg_names, method_name,
  49               class_name, il, cp);
  50 
  51         _astoreHandler = new ASTORE(HANDLER_INDEX);
  52         _aloadHandler  = new ALOAD(HANDLER_INDEX);
  53     }
  54 
  55     public int getIteratorIndex() {
  56         return INVALID_INDEX;           // not available
  57     }
  58 
  59     public final Instruction storeHandler() {
  60         return _astoreHandler;
  61     }
  62 
  63     public final Instruction loadHandler() {
  64         return _aloadHandler;
  65     }
  66 
  67     public int getLocalIndex(String name) {
  68         return INVALID_INDEX;           // not available
  69     }
  70 }