Source Code Cross Referenced for IfEval.java in  » Scripting » sisc » sisc » exprs » 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 » sisc » sisc.exprs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package sisc.exprs;
002:
003:        import java.io.*;
004:        import sisc.data.*;
005:        import sisc.interpreter.*;
006:        import sisc.ser.Serializer;
007:        import sisc.ser.Deserializer;
008:        import sisc.util.ExpressionVisitor;
009:        import sisc.exprs.fp.OptimismUnwarrantedException;
010:        import sisc.exprs.fp.OptimisticHost;
011:        import sisc.exprs.fp.Utils;
012:
013:        public class IfEval extends Expression implements  OptimisticHost {
014:
015:            private static final int POS_CONSEQ = 0, POS_ALTERN = 1;
016:
017:            public Expression conseq, altern;
018:
019:            public IfEval(Expression conseq, Expression altern) {
020:                this .conseq = conseq;
021:                this .altern = altern;
022:            }
023:
024:            public void setHosts() {
025:                Utils.linkOptimistic(this , conseq, POS_CONSEQ);
026:                Utils.linkOptimistic(this , altern, POS_ALTERN);
027:            }
028:
029:            public void eval(Interpreter r) throws ContinuationException {
030:                boolean retry;
031:                do {
032:                    try {
033:                        r.next(truth(r.acc) ? conseq : altern);
034:                        retry = false;
035:                    } catch (OptimismUnwarrantedException uwe) {
036:                        retry = true;
037:                    }
038:                } while (retry);
039:            }
040:
041:            public Value express() {
042:                return list(sym("if"), conseq.express(), altern.express());
043:            }
044:
045:            public void serialize(Serializer s) throws IOException {
046:                s.writeExpression(conseq);
047:                s.writeExpression(altern);
048:            }
049:
050:            public IfEval() {
051:            }
052:
053:            public void deserialize(Deserializer s) throws IOException {
054:                conseq = s.readExpression();
055:                altern = s.readExpression();
056:            }
057:
058:            public boolean visit(ExpressionVisitor v) {
059:                return v.visit(conseq) && v.visit(altern);
060:            }
061:
062:            /* (non-Javadoc)
063:             * @see sisc.exprs.OptimisticHost#alter(int, sisc.data.Expression)
064:             */
065:            public synchronized void alter(Interpreter r, int uexpPosition,
066:                    Expression replaceWith) {
067:                switch (uexpPosition) {
068:                case POS_CONSEQ:
069:                    conseq = replaceWith;
070:                    break;
071:                case POS_ALTERN:
072:                    altern = replaceWith;
073:                    break;
074:                }
075:            }
076:
077:        }
078:
079:        /*
080:         * The contents of this file are subject to the Mozilla Public
081:         * License Version 1.1 (the "License"); you may not use this file
082:         * except in compliance with the License. You may obtain a copy of
083:         * the License at http://www.mozilla.org/MPL/
084:         * 
085:         * Software distributed under the License is distributed on an "AS
086:         * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
087:         * implied. See the License for the specific language governing
088:         * rights and limitations under the License.
089:         * 
090:         * The Original Code is the Second Interpreter of Scheme Code (SISC).
091:         * 
092:         * The Initial Developer of the Original Code is Scott G. Miller.
093:         * Portions created by Scott G. Miller are Copyright (C) 2000-2007
094:         * Scott G. Miller.  All Rights Reserved.
095:         * 
096:         * Contributor(s):
097:         * Matthias Radestock 
098:         * 
099:         * Alternatively, the contents of this file may be used under the
100:         * terms of the GNU General Public License Version 2 or later (the
101:         * "GPL"), in which case the provisions of the GPL are applicable 
102:         * instead of those above.  If you wish to allow use of your 
103:         * version of this file only under the terms of the GPL and not to
104:         * allow others to use your version of this file under the MPL,
105:         * indicate your decision by deleting the provisions above and
106:         * replace them with the notice and other provisions required by
107:         * the GPL.  If you do not delete the provisions above, a recipient
108:         * may use your version of this file under either the MPL or the
109:         * GPL.
110:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.