001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements. See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership. The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the  "License");
007     * you may not use this file except in compliance with the License.
008     * You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    /*
019     * $Id: RtMethodGenerator.java 468649 2006-10-28 07:00:55Z minchau $
020     */
021    
022    package org.apache.xalan.xsltc.compiler.util;
023    
024    import org.apache.bcel.generic.ALOAD;
025    import org.apache.bcel.generic.ASTORE;
026    import org.apache.bcel.generic.ConstantPoolGen;
027    import org.apache.bcel.generic.Instruction;
028    import org.apache.bcel.generic.InstructionList;
029    import org.apache.bcel.generic.Type;
030    
031    /**
032     * This class is used for result trees implemented as methods. These
033     * methods take a reference to the DOM and to the handler only.
034     * @author Jacek Ambroziak
035     * @author Santiago Pericas-Geertsen
036     */
037    public final class RtMethodGenerator extends MethodGenerator {
038        private static final int HANDLER_INDEX = 2;
039        private final Instruction _astoreHandler;
040        private final Instruction _aloadHandler;
041    
042        public RtMethodGenerator(int access_flags, Type return_type,
043                                 Type[] arg_types, String[] arg_names,
044                                 String method_name, String class_name,
045                                 InstructionList il, ConstantPoolGen cp) {
046            super(access_flags, return_type, arg_types, arg_names, method_name, 
047                  class_name, il, cp);
048            
049            _astoreHandler = new ASTORE(HANDLER_INDEX);
050            _aloadHandler  = new ALOAD(HANDLER_INDEX);
051        }
052    
053        public int getIteratorIndex() {
054            return INVALID_INDEX;           // not available
055        }
056        
057        public final Instruction storeHandler() {
058            return _astoreHandler;
059        }
060    
061        public final Instruction loadHandler() {
062            return _aloadHandler;
063        }
064    
065        public int getLocalIndex(String name) {
066            return INVALID_INDEX;           // not available
067        }
068    }