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