Source Code Cross Referenced for FieldReference.java in  » Testing » KeY » de » uka » ilkd » key » java » reference » 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 » Testing » KeY » de.uka.ilkd.key.java.reference 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // This file is part of KeY - Integrated Deductive Software Design
002:        // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
003:        //                         Universitaet Koblenz-Landau, Germany
004:        //                         Chalmers University of Technology, Sweden
005:        //
006:        // The KeY system is protected by the GNU General Public License. 
007:        // See LICENSE.TXT for details.
008:        //
009:        //
010:
011:        package de.uka.ilkd.key.java.reference;
012:
013:        import de.uka.ilkd.key.java.*;
014:        import de.uka.ilkd.key.java.visitor.Visitor;
015:        import de.uka.ilkd.key.logic.op.ProgramVariable;
016:        import de.uka.ilkd.key.util.ExtList;
017:
018:        /**
019:         *  Field reference.
020:         *  @author <TT>AutoDoc</TT>
021:         */
022:        public class FieldReference extends VariableReference implements 
023:                MemberReference, ReferenceSuffix, TypeReferenceContainer,
024:                ExpressionContainer {
025:
026:            /**
027:             *      Reference prefix.
028:             */
029:            protected ReferencePrefix prefix;
030:
031:            protected FieldReference() {
032:            }
033:
034:            public FieldReference(ProgramVariable pv, ReferencePrefix prefix) {
035:                super (pv);
036:                this .prefix = prefix;
037:            }
038:
039:            public FieldReference(ExtList children, ReferencePrefix prefix) {
040:                super (children);
041:                this .prefix = prefix;
042:            }
043:
044:            public FieldReference(ProgramVariable pv, ReferencePrefix prefix,
045:                    PositionInfo pi) {
046:                super (pv, pi);
047:                this .prefix = prefix;
048:
049:            }
050:
051:            /**
052:             *      Returns the number of children of this node.
053:             *      @return an int giving the number of children of this node
054:             */
055:            public int getChildCount() {
056:                int result = 0;
057:                if (prefix != null)
058:                    result++;
059:                if (variable != null)
060:                    result++;
061:                return result;
062:            }
063:
064:            /**
065:             *      Returns the child at the specified index in this node's "virtual"
066:             *      child array
067:             *      @param index an index into this node's "virtual" child array
068:             *      @return the program element at the given position
069:             *      @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
070:             *                 of bounds
071:             */
072:            public ProgramElement getChildAt(int index) {
073:                if (prefix != null) {
074:                    if (index == 0)
075:                        return prefix;
076:                    index--;
077:                }
078:                if (variable != null) {
079:                    if (index == 0)
080:                        return variable;
081:                }
082:                throw new ArrayIndexOutOfBoundsException();
083:            }
084:
085:            /**
086:             *      Get reference prefix.
087:             *      @return the reference prefix.
088:             */
089:            public ReferencePrefix getReferencePrefix() {
090:                return prefix;
091:            }
092:
093:            /*
094:             * returns true if the reference prefix is an explicit or implicit 
095:             * this reference this field reference does not refer to a static field
096:             */
097:            public boolean referencesOwnInstanceField() {
098:                return (prefix == null || prefix instanceof  ThisReference)
099:                        && !getProgramVariable().isStatic();
100:            }
101:
102:            /**
103:             *      Set reference prefix.
104:             *      @author VK
105:             */
106:            public ReferencePrefix setReferencePrefix(ReferencePrefix rp) {
107:                return new FieldReference(variable, rp);
108:            }
109:
110:            /**
111:             *      Get the number of type references in this container.
112:             *      @return the number of type references.
113:             */
114:
115:            public int getTypeReferenceCount() {
116:                return (prefix instanceof  TypeReference) ? 1 : 0;
117:            }
118:
119:            /*
120:              Return the type reference at the specified index in this node's
121:              "virtual" type reference array.
122:              @param index an index for a type reference.
123:              @return the type reference with the given index.
124:              @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
125:              of bounds.
126:             */
127:            public TypeReference getTypeReferenceAt(int index) {
128:                if (prefix instanceof  TypeReference && index == 0) {
129:                    return (TypeReference) prefix;
130:                }
131:                throw new ArrayIndexOutOfBoundsException();
132:            }
133:
134:            /**
135:             *      Get the number of expressions in this container.
136:             *      @return the number of expressions.
137:             */
138:            public int getExpressionCount() {
139:                return (prefix instanceof  Expression) ? 1 : 0;
140:            }
141:
142:            /*
143:              Return the expression at the specified index in this node's
144:              "virtual" expression array.
145:              @param index an index for an expression.
146:              @return the expression with the given index.
147:              @exception ArrayIndexOutOfBoundsException if <tt>index</tt> is out
148:              of bounds.
149:             */
150:            public Expression getExpressionAt(int index) {
151:                if (prefix instanceof  Expression && index == 0) {
152:                    return (Expression) prefix;
153:                }
154:                throw new ArrayIndexOutOfBoundsException();
155:            }
156:
157:            public SourceElement getFirstElement() {
158:                return (prefix == null) ? variable : prefix.getFirstElement();
159:            }
160:
161:            /** pretty print */
162:            public void prettyPrint(PrettyPrinter p) throws java.io.IOException {
163:                p.printFieldReference(this );
164:            }
165:
166:            /** calls the corresponding method of a visitor in order to
167:             * perform some action/transformation on this element
168:             * @param v the Visitor
169:             */
170:            public void visit(Visitor v) {
171:                v.performActionOnFieldReference(this );
172:            }
173:
174:            /** are there "dots" in the prefix? */
175:            public boolean isSingleDeref() {
176:                return prefix.getReferencePrefix() == null;
177:            }
178:
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.