Source Code Cross Referenced for TypeReferencePattern.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » core » search » matching » 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 » IDE Eclipse » jdt » org.eclipse.jdt.internal.core.search.matching 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdt.internal.core.search.matching;
011:
012:        import org.eclipse.jdt.core.IType;
013:        import org.eclipse.jdt.core.compiler.CharOperation;
014:        import org.eclipse.jdt.core.search.SearchPattern;
015:        import org.eclipse.jdt.internal.core.util.Util;
016:
017:        public class TypeReferencePattern extends IntersectingPattern {
018:
019:            protected char[] qualification;
020:            protected char[] simpleName;
021:
022:            protected char[] currentCategory;
023:
024:            /* Optimization: case where simpleName == null */
025:            public int segmentsSize;
026:            protected char[][] segments;
027:            protected int currentSegment;
028:
029:            protected static char[][] CATEGORIES = { REF };
030:
031:            public TypeReferencePattern(char[] qualification,
032:                    char[] simpleName, int matchRule) {
033:                this (matchRule);
034:
035:                this .qualification = this .isCaseSensitive ? qualification
036:                        : CharOperation.toLowerCase(qualification);
037:                this .simpleName = (this .isCaseSensitive || this .isCamelCase) ? simpleName
038:                        : CharOperation.toLowerCase(simpleName);
039:
040:                if (simpleName == null)
041:                    this .segments = this .qualification == null ? ONE_STAR_CHAR
042:                            : CharOperation.splitOn('.', this .qualification);
043:                else
044:                    this .segments = null;
045:
046:                if (this .segments == null)
047:                    if (this .qualification == null)
048:                        this .segmentsSize = 0;
049:                    else
050:                        this .segmentsSize = CharOperation.occurencesOf('.',
051:                                this .qualification) + 1;
052:                else
053:                    this .segmentsSize = this .segments.length;
054:
055:                ((InternalSearchPattern) this ).mustResolve = true; // always resolve (in case of a simple name reference being a potential match)
056:            }
057:
058:            /*
059:             * Instanciate a type reference pattern with additional information for generics search
060:             */
061:            public TypeReferencePattern(char[] qualification,
062:                    char[] simpleName, String typeSignature, int matchRule) {
063:                this (qualification, simpleName, matchRule);
064:                if (typeSignature != null) {
065:                    // store type signatures and arguments
066:                    this .typeSignatures = Util
067:                            .splitTypeLevelsSignature(typeSignature);
068:                    setTypeArguments(Util
069:                            .getAllTypeArguments(this .typeSignatures));
070:                    if (hasTypeArguments()) {
071:                        this .segmentsSize = getTypeArguments().length
072:                                + CharOperation.occurencesOf('/',
073:                                        this .typeSignatures[0]) - 1;
074:                    }
075:                }
076:            }
077:
078:            /*
079:             * Instanciate a type reference pattern with additional information for generics search
080:             */
081:            public TypeReferencePattern(char[] qualification,
082:                    char[] simpleName, IType type, int matchRule) {
083:                this (qualification, simpleName, matchRule);
084:                storeTypeSignaturesAndArguments(type);
085:            }
086:
087:            TypeReferencePattern(int matchRule) {
088:                super (TYPE_REF_PATTERN, matchRule);
089:            }
090:
091:            public void decodeIndexKey(char[] key) {
092:                this .simpleName = key;
093:            }
094:
095:            public SearchPattern getBlankPattern() {
096:                return new TypeReferencePattern(R_EXACT_MATCH
097:                        | R_CASE_SENSITIVE);
098:            }
099:
100:            public char[] getIndexKey() {
101:                if (this .simpleName != null)
102:                    return this .simpleName;
103:
104:                // Optimization, eg. type reference is 'org.eclipse.jdt.core.*'
105:                if (this .currentSegment >= 0)
106:                    return this .segments[this .currentSegment];
107:                return null;
108:            }
109:
110:            public char[][] getIndexCategories() {
111:                return CATEGORIES;
112:            }
113:
114:            protected boolean hasNextQuery() {
115:                if (this .segments == null)
116:                    return false;
117:
118:                // Optimization, eg. type reference is 'org.eclipse.jdt.core.*'
119:                // if package has at least 4 segments, don't look at the first 2 since they are mostly
120:                // redundant (eg. in 'org.eclipse.jdt.core.*' 'org.eclipse' is used all the time)
121:                return --this .currentSegment >= (this .segments.length >= 4 ? 2
122:                        : 0);
123:            }
124:
125:            public boolean matchesDecodedKey(SearchPattern decodedPattern) {
126:                return true; // index key is not encoded so query results all match
127:            }
128:
129:            protected void resetQuery() {
130:                /* walk the segments from end to start as it will find less potential references using 'lang' than 'java' */
131:                if (this .segments != null)
132:                    this .currentSegment = this .segments.length - 1;
133:            }
134:
135:            protected StringBuffer print(StringBuffer output) {
136:                output.append("TypeReferencePattern: qualification<"); //$NON-NLS-1$
137:                if (qualification != null)
138:                    output.append(qualification);
139:                else
140:                    output.append("*"); //$NON-NLS-1$
141:                output.append(">, type<"); //$NON-NLS-1$
142:                if (simpleName != null)
143:                    output.append(simpleName);
144:                else
145:                    output.append("*"); //$NON-NLS-1$
146:                output.append(">"); //$NON-NLS-1$
147:                return super.print(output);
148:            }
149:        }
w___w_w___._j___a___v___a2__s_.__c__o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.