Source Code Cross Referenced for JsBinaryOperator.java in  » Ajax » GWT » com » google » gwt » dev » js » ast » 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 » Ajax » GWT » com.google.gwt.dev.js.ast 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 Google Inc.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005:         * use this file except in compliance with the License. You may obtain a copy of
006:         * the License at
007:         * 
008:         * http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013:         * License for the specific language governing permissions and limitations under
014:         * the License.
015:         */
016:        package com.google.gwt.dev.js.ast;
017:
018:        /**
019:         * Represents the operator in a JavaScript binary operation.
020:         */
021:        public final class JsBinaryOperator extends JsOperator {
022:
023:            // Precedence indices from "JavaScript - The Definitive Guide" 4th Edition
024:            // (page 57)
025:            //
026:
027:            // Precendence 15 is for really important things that have their own AST
028:            // classes.
029:
030:            // Precendence 14 is for unary operators.
031:
032:            private static final int LEFT_INFIX = LEFT | INFIX;
033:            public static final JsBinaryOperator MUL = create("*", 13,
034:                    LEFT_INFIX);
035:            public static final JsBinaryOperator DIV = create("/", 13,
036:                    LEFT_INFIX);
037:            public static final JsBinaryOperator MOD = create("%", 13,
038:                    LEFT_INFIX);
039:
040:            public static final JsBinaryOperator ADD = create("+", 12,
041:                    LEFT_INFIX);
042:            public static final JsBinaryOperator SUB = create("-", 12,
043:                    LEFT_INFIX);
044:
045:            public static final JsBinaryOperator SHL = create("<<", 11,
046:                    LEFT_INFIX);
047:            public static final JsBinaryOperator SHR = create(">>", 11,
048:                    LEFT_INFIX);
049:            public static final JsBinaryOperator SHRU = create(">>>", 11,
050:                    LEFT_INFIX);
051:
052:            public static final JsBinaryOperator LT = create("<", 10,
053:                    LEFT_INFIX);
054:            public static final JsBinaryOperator LTE = create("<=", 10,
055:                    LEFT_INFIX);
056:            public static final JsBinaryOperator GT = create(">", 10,
057:                    LEFT_INFIX);
058:            public static final JsBinaryOperator GTE = create(">=", 10,
059:                    LEFT_INFIX);
060:            public static final JsBinaryOperator INSTANCEOF = create(
061:                    "instanceof", 10, LEFT_INFIX);
062:            public static final JsBinaryOperator INOP = create("in", 10,
063:                    LEFT_INFIX);
064:
065:            public static final JsBinaryOperator EQ = create("==", 9,
066:                    LEFT_INFIX);
067:            public static final JsBinaryOperator NEQ = create("!=", 9,
068:                    LEFT_INFIX);
069:            public static final JsBinaryOperator REF_EQ = create("===", 9,
070:                    LEFT_INFIX);
071:            public static final JsBinaryOperator REF_NEQ = create("!==", 9,
072:                    LEFT_INFIX);
073:
074:            public static final JsBinaryOperator BIT_AND = create("&", 8,
075:                    LEFT_INFIX);
076:
077:            public static final JsBinaryOperator BIT_XOR = create("^", 7,
078:                    LEFT_INFIX);
079:
080:            public static final JsBinaryOperator BIT_OR = create("|", 6,
081:                    LEFT_INFIX);
082:
083:            public static final JsBinaryOperator AND = create("&&", 5,
084:                    LEFT_INFIX);
085:
086:            public static final JsBinaryOperator OR = create("||", 4,
087:                    LEFT_INFIX);
088:
089:            // Precendence 3 is for the condition operator.
090:
091:            // These assignment operators are right-associatve.
092:            public static final JsBinaryOperator ASG = create("=", 2, INFIX);
093:            public static final JsBinaryOperator ASG_ADD = create("+=", 2,
094:                    INFIX);
095:            public static final JsBinaryOperator ASG_SUB = create("-=", 2,
096:                    INFIX);
097:            public static final JsBinaryOperator ASG_MUL = create("*=", 2,
098:                    INFIX);
099:            public static final JsBinaryOperator ASG_DIV = create("/=", 2,
100:                    INFIX);
101:            public static final JsBinaryOperator ASG_MOD = create("%=", 2,
102:                    INFIX);
103:            public static final JsBinaryOperator ASG_SHL = create("<<=", 2,
104:                    INFIX);
105:            public static final JsBinaryOperator ASG_SHR = create(">>=", 2,
106:                    INFIX);
107:            public static final JsBinaryOperator ASG_SHRU = create(">>>=", 2,
108:                    INFIX);
109:            public static final JsBinaryOperator ASG_BIT_AND = create("&=", 2,
110:                    INFIX);
111:            public static final JsBinaryOperator ASG_BIT_OR = create("|=", 2,
112:                    INFIX);
113:            public static final JsBinaryOperator ASG_BIT_XOR = create("^=", 2,
114:                    INFIX);
115:
116:            public static final JsBinaryOperator COMMA = create(",", 1,
117:                    LEFT_INFIX);
118:
119:            private static JsBinaryOperator create(String symbol,
120:                    int precedence, int mask) {
121:                JsBinaryOperator op = new JsBinaryOperator(symbol, precedence,
122:                        mask);
123:                return op;
124:            }
125:
126:            private JsBinaryOperator(String symbol, int precedence, int mask) {
127:                super (symbol, precedence, mask);
128:            }
129:
130:            public boolean isAssignment() {
131:                /*
132:                 * Beware, flaky! Maybe I should have added Yet Another Field to
133:                 * BinaryOperator?
134:                 */
135:                return (getPrecedence() == ASG.getPrecedence());
136:            }
137:
138:            @Override
139:            public boolean isKeyword() {
140:                return this == INSTANCEOF || this == INOP;
141:            }
142:
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.