Source Code Cross Referenced for Literal.java in  » Scripting » Kawa » gnu » expr » 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 » Kawa » gnu.expr 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package gnu.expr;
002:
003:        import gnu.bytecode.*;
004:
005:        /** A Literal contains compile-time information about a constant. */
006:
007:        public class Literal {
008:            Literal next;
009:
010:            public Field field;
011:
012:            Object value;
013:
014:            /* If field is non-null, it is the number of the Field.
015:             * I.e. if the index is 10, the value of the Literal is the value of
016:             * the static Field named Lit10. */
017:            int index;
018:
019:            public Type type;
020:
021:            public int flags;
022:
023:            /** Set at the beginning of the call to writeObject. */
024:            static final int WRITING = 1;
025:
026:            /** Set at the end of the call to writeObject. */
027:            static final int WRITTEN = 2;
028:
029:            static final int CYCLIC = 4;
030:
031:            /** In pass 2, object has been at least allocated. */
032:            static final int EMITTED = 8;
033:
034:            /** Values produced by calling writeObject on value. */
035:            Object[] argValues;
036:            /** Types produced by calling writeObject on value. */
037:            Type[] argTypes;
038:
039:            public static final Literal nullLiteral = new Literal(null,
040:                    Type.nullType);
041:
042:            public final Object getValue() {
043:                return value;
044:            }
045:
046:            void assign(LitTable litTable) {
047:                assign((String) null, litTable);
048:            }
049:
050:            /** Assign a static Field to hold the value of this Literal.
051:             * This supports the same value being used multiple times or cyclically. */
052:            void assign(String name, LitTable litTable) {
053:                int flags = litTable.comp.immediate ? Access.STATIC
054:                        | Access.PUBLIC : Access.STATIC | Access.FINAL;
055:                if (name == null) {
056:                    index = litTable.literalsCount++;
057:                    name = "Lit" + index;
058:                } else
059:                    flags |= Access.PUBLIC;
060:                assign(litTable.mainClass.addField(name, type, flags), litTable);
061:            }
062:
063:            void assign(Field field, LitTable litTable) {
064:                next = litTable.literalsChain;
065:                litTable.literalsChain = this ;
066:                this .field = field;
067:            }
068:
069:            /** Create a new Literal, where comp must be in immediate mode. */
070:            public Literal(Object value, LitTable litTable) {
071:                this (value, (String) null, litTable);
072:            }
073:
074:            public Literal(Object value, String name, LitTable litTable) {
075:                this .value = value;
076:                litTable.literalTable.put(value, this );
077:                this .type = Type.make(value.getClass());
078:                assign(name, litTable);
079:            }
080:
081:            /** Create a new Literal, for a value available from a static field.
082:             * The field must be static and already exist. */
083:            public Literal(Object value, Field field, LitTable litTable) {
084:                this .value = value;
085:                litTable.literalTable.put(value, this );
086:                this .field = field;
087:                this .type = field.getType();
088:                flags = WRITTEN | EMITTED;
089:            }
090:
091:            public Literal(Object value, Type type, LitTable litTable) {
092:                this .value = value;
093:                litTable.literalTable.put(value, this );
094:                this .type = type;
095:            }
096:
097:            Literal(Object value, Type type) {
098:                this.value = value;
099:                this.type = type;
100:            }
101:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.