~vcs-imports/xena/trunk

« back to all changes in this revision

Viewing changes to ext/src/xalan-j_2_7_1/src/org/apache/xalan/xsltc/compiler/Pattern.java

  • Committer: matthewoliver
  • Date: 2009-12-10 03:18:07 UTC
  • Revision ID: vcs-imports@canonical.com-20091210031807-l086qguzdlljtkl9
Merged Xena Testing into Xena Stable for the Xena 5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Licensed to the Apache Software Foundation (ASF) under one
 
3
 * or more contributor license agreements. See the NOTICE file
 
4
 * distributed with this work for additional information
 
5
 * regarding copyright ownership. The ASF licenses this file
 
6
 * to you under the Apache License, Version 2.0 (the  "License");
 
7
 * you may not use this file except in compliance with the License.
 
8
 * You may obtain a copy of the License at
 
9
 *
 
10
 *     http://www.apache.org/licenses/LICENSE-2.0
 
11
 *
 
12
 * Unless required by applicable law or agreed to in writing, software
 
13
 * distributed under the License is distributed on an "AS IS" BASIS,
 
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
15
 * See the License for the specific language governing permissions and
 
16
 * limitations under the License.
 
17
 */
 
18
/*
 
19
 * $Id: Pattern.java,v 1.2 2009/12/10 03:18:18 matthewoliver Exp $
 
20
 */
 
21
 
 
22
package org.apache.xalan.xsltc.compiler;
 
23
 
 
24
import org.apache.xalan.xsltc.compiler.util.ClassGenerator;
 
25
import org.apache.xalan.xsltc.compiler.util.MethodGenerator;
 
26
import org.apache.xalan.xsltc.compiler.util.Type;
 
27
import org.apache.xalan.xsltc.compiler.util.TypeCheckError;
 
28
 
 
29
/**
 
30
 * @author Jacek Ambroziak
 
31
 * @author Santiago Pericas-Geertsen
 
32
 */
 
33
public abstract class Pattern extends Expression {
 
34
    /**
 
35
     * Returns the type of a pattern, which is always a <code>NodeType</code>.
 
36
     * A <code>NodeType</code> has a number of subtypes defined by 
 
37
     * <code>NodeType._type</code> corresponding to each type of node.
 
38
     */
 
39
    public abstract Type typeCheck(SymbolTable stable) throws TypeCheckError;
 
40
 
 
41
    /**
 
42
     * Translate this node into JVM bytecodes. Patterns are translated as
 
43
     * boolean expressions with true/false lists. Before calling 
 
44
     * <code>translate</code> on a pattern, make sure that the node being 
 
45
     * matched is on top of the stack. After calling <code>translate</code>, 
 
46
     * make sure to backpatch both true and false lists. True lists are the 
 
47
     * default, in the sense that they always <em>"fall through"</em>. If this
 
48
     * is not the intended semantics (e.g., see 
 
49
     * {@link org.apache.xalan.xsltc.compiler.AlternativePattern#translate})
 
50
     * then a GOTO must be appended to the instruction list after calling
 
51
     * <code>translate</code>. 
 
52
     */
 
53
    public abstract void translate(ClassGenerator classGen,
 
54
                                   MethodGenerator methodGen);
 
55
 
 
56
    /**
 
57
     * Returns the priority of this pattern (section 5.5 in the XSLT spec).
 
58
     */
 
59
    public abstract double getPriority();
 
60
}