KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > runtime > parser > node > Node


1 /*
2  * Copyright 2000-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 package org.apache.velocity.runtime.parser.node;
18
19 import java.io.Writer JavaDoc;
20 import java.io.IOException JavaDoc;
21
22 import org.apache.velocity.context.InternalContextAdapter;
23 import org.apache.velocity.runtime.parser.Token;
24
25 import org.apache.velocity.exception.MethodInvocationException;
26 import org.apache.velocity.exception.ParseErrorException;
27 import org.apache.velocity.exception.ResourceNotFoundException;
28
29 /**
30  * All AST nodes must implement this interface. It provides basic
31  * machinery for constructing the parent and child relationships
32  * between nodes.
33  */

34
35 public interface Node
36 {
37
38     /**
39      * This method is called after the node has been made the current
40      * node. It indicates that child nodes can now be added to it.
41      */

42     public void jjtOpen();
43
44     /**
45      * This method is called after all the child nodes have been
46      * added.
47      */

48     public void jjtClose();
49
50     /**
51      * This pair of methods are used to inform the node of its
52      * parent.
53      */

54     public void jjtSetParent(Node n);
55     public Node jjtGetParent();
56
57     /**
58      * This method tells the node to add its argument to the node's
59      * list of children.
60      */

61     public void jjtAddChild(Node n, int i);
62
63     /**
64      * This method returns a child node. The children are numbered
65      * from zero, left to right.
66      */

67     public Node jjtGetChild(int i);
68
69     /** Return the number of children the node has. */
70     public int jjtGetNumChildren();
71
72     /** Accept the visitor. **/
73     public Object JavaDoc jjtAccept(ParserVisitor visitor, Object JavaDoc data);
74
75     public Object JavaDoc childrenAccept(ParserVisitor visitor, Object JavaDoc data);
76
77     // added
78
public Token getFirstToken();
79     public Token getLastToken();
80     public int getType();
81
82     public Object JavaDoc init( InternalContextAdapter context, Object JavaDoc data) throws Exception JavaDoc;
83
84     public boolean evaluate( InternalContextAdapter context)
85         throws MethodInvocationException;
86
87     public Object JavaDoc value( InternalContextAdapter context)
88         throws MethodInvocationException;
89
90     public boolean render( InternalContextAdapter context, Writer JavaDoc writer)
91         throws IOException JavaDoc,MethodInvocationException, ParseErrorException, ResourceNotFoundException;
92
93     public Object JavaDoc execute(Object JavaDoc o, InternalContextAdapter context)
94       throws MethodInvocationException;
95
96     public void setInfo(int info);
97     public int getInfo();
98
99     public String JavaDoc literal();
100     public void setInvalid();
101     public boolean isInvalid();
102     public int getLine();
103     public int getColumn();
104 }
105
Popular Tags