View Javadoc
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: FilterGenerator.java,v 1.2.4.1 2005/09/05 11:13:52 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.Instruction;
28  import com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet;
29  
30  /**
31   * This class implements auxliary classes needed to compile
32   * filters (predicates). These classes defined a single method
33   * of type <tt>TestGenerator</tt>.
34   * @author Jacek Ambroziak
35   * @author Santiago Pericas-Geertsen
36   */
37  public final class FilterGenerator extends ClassGenerator {
38      private static int TRANSLET_INDEX = 5;   // translet
39      private final Instruction _aloadTranslet;
40  
41      public FilterGenerator(String className, String superClassName,
42                             String fileName,
43                             int accessFlags, String[] interfaces,
44                             Stylesheet stylesheet) {
45          super(className, superClassName, fileName,
46                accessFlags, interfaces, stylesheet);
47  
48          _aloadTranslet = new ALOAD(TRANSLET_INDEX);
49      }
50  
51      /**
52       * The index of the translet pointer within the execution of
53       * the test method.
54       */
55      public final Instruction loadTranslet() {
56          return _aloadTranslet;
57      }
58  
59      /**
60       * Returns <tt>true</tt> since this class is external to the
61       * translet.
62       */
63      public boolean isExternal() {
64          return true;
65      }
66  }