KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > xsltc > compiler > util > AttributeSetMethodGenerator


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: AttributeSetMethodGenerator.java,v 1.7 2004/02/16 22:26:44 minchau Exp $
18  */

19
20 package org.apache.xalan.xsltc.compiler.util;
21
22 import org.apache.bcel.generic.ALOAD;
23 import org.apache.bcel.generic.ASTORE;
24 import org.apache.bcel.generic.ClassGen;
25 import org.apache.bcel.generic.Instruction;
26 import org.apache.bcel.generic.InstructionList;
27
28 /**
29  * @author Jacek Ambroziak
30  * @author Santiago Pericas-Geertsen
31  */

32 public final class AttributeSetMethodGenerator extends MethodGenerator {
33     private static final int DOM_INDEX = 1;
34     private static final int ITERATOR_INDEX = 2;
35     private static final int HANDLER_INDEX = 3;
36
37     private static final org.apache.bcel.generic.Type[] argTypes =
38    new org.apache.bcel.generic.Type[3];
39     private static final String JavaDoc[] argNames = new String JavaDoc[3];
40     
41     static {
42        argTypes[0] = Util.getJCRefType(DOM_INTF_SIG);
43        argNames[0] = DOM_PNAME;
44        argTypes[1] = Util.getJCRefType(NODE_ITERATOR_SIG);
45        argNames[1] = ITERATOR_PNAME;
46        argTypes[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG);
47        argNames[2] = TRANSLET_OUTPUT_PNAME;
48     }
49
50     
51     private final Instruction _aloadDom;
52     private final Instruction _astoreDom;
53     private final Instruction _astoreIterator;
54     private final Instruction _aloadIterator;
55     private final Instruction _astoreHandler;
56     private final Instruction _aloadHandler;
57     
58     public AttributeSetMethodGenerator(String JavaDoc methodName, ClassGen classGen) {
59     super(org.apache.bcel.Constants.ACC_PRIVATE,
60           org.apache.bcel.generic.Type.VOID,
61           argTypes, argNames, methodName,
62           classGen.getClassName(),
63           new InstructionList(),
64           classGen.getConstantPool());
65     
66     _aloadDom = new ALOAD(DOM_INDEX);
67     _astoreDom = new ASTORE(DOM_INDEX);
68     _astoreIterator = new ASTORE(ITERATOR_INDEX);
69     _aloadIterator = new ALOAD(ITERATOR_INDEX);
70     _astoreHandler = new ASTORE(HANDLER_INDEX);
71     _aloadHandler = new ALOAD(HANDLER_INDEX);
72     }
73
74     public Instruction storeIterator() {
75     return _astoreIterator;
76     }
77     
78     public Instruction loadIterator() {
79     return _aloadIterator;
80     }
81
82     public int getIteratorIndex() {
83     return ITERATOR_INDEX;
84     }
85
86     public Instruction storeHandler() {
87     return _astoreHandler;
88     }
89
90     public Instruction loadHandler() {
91     return _aloadHandler;
92     }
93
94     public int getLocalIndex(String JavaDoc name) {
95     return INVALID_INDEX; // not available
96
}
97 }
98
Popular Tags