01: /*
02: * Copyright (C) 2007 Jared Alexander Spigner
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * jspigner@openjx.org
19: *
20: * jxscriptCTL.java
21: *
22: * Created on June 9, 2007, 11:21 PM
23: *
24: */
25:
26: package org.openjx.jx;
27:
28: import org.openjx.core.JXObject;
29: import org.openjx.core.VirtualMachine;
30:
31: /**
32: * This is the control class for the jxscript otherwise known as the
33: * JXScript.
34: *
35: * @author Jared Spigner
36: */
37: public class jxscriptCTL extends JXControl {
38:
39: /**
40: * This is the constructor for the jxscriptCTL class. It creates a new
41: * instance of jxscriptCTL.
42: *
43: * @param vm points to an instance of the Virtual Machine.
44: */
45: public jxscriptCTL(VirtualMachine vm) {
46: super (vm);
47: }
48:
49: /**
50: * This method is called when the compiler wishes to compile the
51: * component into Java code.
52: *
53: * @param jxObject points to the JXObject in the stack we wish to compile
54: * into Java.
55: *
56: * @return true on success, else false on failure.
57: */
58: public boolean Compile(JXObject jxObject) {
59: return true;
60: }
61:
62: /**
63: * This method is called when the interpreter wishes to interpret the
64: * component's script into Java code.
65: *
66: * @param jxObject points to the JXObject in the stack we wish to interpret
67: * into Java.
68: *
69: * @return true on success, else false on failure.
70: */
71: public boolean Interpret(JXObject jxObject) {
72: return this .virtualMachine.getJXInterpreter().executeScript(
73: jxObject.getProperty("cdata"));
74: }
75:
76: }
|