Source Code Cross Referenced for CompiledInnerNodeEvaluator.java in  » Scripting » oscript-2.10.4 » oscript » compiler » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » oscript 2.10.4 » oscript.compiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*=============================================================================
002:         *     Copyright Texas Instruments 2004.  All Rights Reserved.
003:         *   
004:         * This program is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         * 
009:         * This program is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         * 
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package oscript.compiler;
020:
021:        import oscript.data.*;
022:        import oscript.util.*;
023:        import oscript.*;
024:        import oscript.fs.AbstractFile;
025:        import oscript.exceptions.PackagedScriptObjectException;
026:        import oscript.parser.ParseException;
027:
028:        /**
029:         * In an effort to generate fewer classes, and improve startup performance,
030:         * functions within the file/function node that is passed to the compiler
031:         * generate additional <tt>evalNodeX</tt> methods within the same class that
032:         * is generated for the parent.  But since we still need individual 
033:         * {@link NodeEvaluator}s for each function, this class acts as a lightweight
034:         * wrapper object which forwards the {@link #evalNode} method to the appropriate
035:         * {@link CompiledNodeEvaluator#evalInnerNode}
036:         * 
037:         * @author Rob Clark (rob@ti.com)
038:         * @version 1
039:         */
040:        public class CompiledInnerNodeEvaluator extends NodeEvaluator {
041:            private int id;
042:            private int idx;
043:            private CompiledNodeEvaluator cne;
044:
045:            /*=======================================================================*/
046:            /**
047:             * Class Constructor.
048:             * 
049:             * @param id      the function name symbol id
050:             * @param idx     the index to pass back to {@link CompiledNodeEvaluator#evalInnerNode}
051:             * @param cne     the compiled node which contains the compiled code
052:             */
053:            public CompiledInnerNodeEvaluator(int id, int idx,
054:                    CompiledNodeEvaluator cne) {
055:                super ();
056:
057:                this .id = id;
058:                this .idx = idx;
059:                this .cne = cne;
060:            }
061:
062:            /*=======================================================================*/
063:            /**
064:             * Get the file that this node was parsed from.
065:             * 
066:             * @return the file
067:             */
068:            public AbstractFile getFile() {
069:                // the file is always the same as the parent
070:                return cne.getFile();
071:            }
072:
073:            /*=======================================================================*/
074:            /**
075:             * Get the function symbol (name), if this node evaluator is a function, 
076:             * otherwise return <code>-1</code>.
077:             * 
078:             * @return the symbol, or <code>-1</code>
079:             */
080:            public int getId() {
081:                return id;
082:            }
083:
084:            /*=======================================================================*/
085:            /**
086:             * Evaluate, in the specified scope.  If this is a function, the Arguments 
087:             * to the function, etc., are defined in the <code>scope</code> that the 
088:             * function is evaluated in.
089:             * 
090:             * @param sf           the stack frame to evaluate the node in
091:             * @param scope        the scope to evaluate the function in
092:             * @return the result of evaluating the function
093:             */
094:            public Object evalNode(StackFrame sf, Scope scope)
095:                    throws PackagedScriptObjectException {
096:                return cne.evalInnerNode(idx, sf, scope);
097:            }
098:
099:            /*=======================================================================*/
100:            /**
101:             * Get the SMIT for the scope(s) created when invoking this node evaluator.
102:             * 
103:             * @param perm  <code>PRIVATE</code>, <code>PUBPROT</code>,
104:             *   <code>ALL</code>
105:             */
106:            public SymbolTable getSharedMemberIndexTable(int perm) {
107:                return cne.getInnerSharedMemberIndexTable(idx, perm);
108:            }
109:        }
110:
111:        /*
112:         *   Local Variables:
113:         *   tab-width: 2
114:         *   indent-tabs-mode: nil
115:         *   mode: java
116:         *   c-indentation-style: java
117:         *   c-basic-offset: 2
118:         *   eval: (c-set-offset 'substatement-open '0)
119:         *   eval: (c-set-offset 'case-label '+)
120:         *   eval: (c-set-offset 'inclass '+)
121:         *   eval: (c-set-offset 'inline-open '0)
122:         *   End:
123:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.