Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/tripi/asp/Node.java


1   /**
2    * ArrowHead ASP Server 
3    * This is a source file for the ArrowHead ASP Server - an 100% Java
4    * VBScript interpreter and ASP server.
5    *
6    * For more information, see http://www.tripi.com/arrowhead
7    *
8    * Copyright (C) 2002  Terence Haddock
9    *
10   * This program is free software; you can redistribute it and/or modify
11   * it under the terms of the GNU General Public License as published by
12   * the Free Software Foundation; either version 2 of the License, or
13   * (at your option) any later version.
14   *
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Public License for more details.
19   *
20   * You should have received a copy of the GNU General Public License
21   * along with this program; if not, write to the Free Software
22   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23   *
24   */
25  package com.tripi.asp;
26  
27  /**
28   * This is the base interface for all internal ASP objects.
29   * Implemented statements:
30   * <ul>
31   * <li><b>Call</b> - Fully implemented.
32   * <li><b>Const</b> - Implemented, <b>TODO</b> not for Public/Private.
33   * <li><b>Dim</b> - Fully implemented.
34   * <li><b>Do ... Loop</b> - Fully implemented.
35   * <li><b>Erase</b> - <b>TODO</b> not implemented.
36   * <li><b>Exit ... </b> - Fully implemented.
37   * <li><b>For ... Next</b> - Fully implemented.
38   * <li><b>For Each ... Next</b> - Fully implemented.
39   * <li><b>Function</b> -
40   * <li><b>If ... Then .. Else</b> -
41   * <li><b>On Error</b> -
42   * <li><b>Option Explicit</b> -
43   * <li><b>Private</b> -
44   * <li><b>Public</b> -
45   * <li><b>Randomize</b> -
46   * <li><b>ReDim</b> -
47   * <li><b>Rem</b> -
48   * <li><b>Select Case</b> -
49   * <li><b>Set</b> -
50   * <li><b>Sub</b> -
51   * <li><b>While ... Wend</b> -
52   * </ul>
53   *
54   * @author Terence Haddock
55   * @version 0.9
56   */
57  public interface Node
58  {
59      /**
60       * Dumps the node representation in ASP textual format.
61       * This function is primarily used for debugging, but it is recommended
62       * that the node dump itself in a format which could be re-parsed as
63       * valid code. Whitespace need not be preserved.
64       *
65       * @throws AspException if an error occurs.
66       */
67      public void dump() throws AspException;
68  
69      /**
70       * Prepares the code for execution. This includes defining global
71       * functions and subroutines, setting global variables, and
72       * any other preprocessing required. This procedure should be called
73       * before execute(AspContext). As part of the preparation, it should call
74       * prepare() on any child nodes it may use during execution.
75       *
76       * @param context The global context
77       * @throws AspException on error
78       * @see #execute(AspContext)
79       */
80      public void prepare(AspContext context) throws AspException;
81  
82      /**
83       * Executes this node in the defined context. This function should return
84       * a valid Node or base type as a return value. It can return one of the
85       * Exit... objects to signal the Asp server to exit the block, loop, etc.
86       * Except in special cases, prepare(AspContext) should
87       * be called before execute(AspContext)
88       *
89       * @param context The current context
90       * @return result of executing this node.
91       * @throws AspException on error
92       * @see #prepare(AspContext)
93       */
94      public Object execute(AspContext context) throws AspException;
95  }