id
int32
0
12.9k
code
sequencelengths
2
264k
2,500
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "index", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "text", ".", "MessageFormat", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclipse", ".", "equinox", ".", "app", ".", "IApplication", ";", "import", "org", ".", "eclipse", ".", "equinox", ".", "app", ".", "IApplicationContext", ";", "import", "org", ".", "eclipse", ".", "osgi", ".", "util", ".", "NLS", ";", "public", "class", "JavaIndexerApplication", "implements", "IApplication", "{", "private", "final", "static", "class", "Messages", "extends", "NLS", "{", "private", "static", "final", "String", "MESSAGES_NAME", "=", "\"\"", ";", "public", "static", "String", "CommandLineProcessing", ";", "public", "static", "String", "CommandLineUsage", ";", "public", "static", "String", "CommandLineOnlyOneOutputError", ";", "public", "static", "String", "CommandLineOutputTakesArgs", ";", "public", "static", "String", "CommandLineOnlyOneJarError", ";", "public", "static", "String", "CommandLineJarNotSpecified", ";", "public", "static", "String", "CommandLineIndexFileNotSpecified", ";", "public", "static", "String", "CaughtException", ";", "public", "static", "String", "CommandLineJarFileNotExist", ";", "static", "{", "NLS", ".", "initializeMessages", "(", "MESSAGES_NAME", ",", "Messages", ".", "class", ")", ";", "}", "public", "static", "String", "bind", "(", "String", "message", ")", "{", "return", "bind", "(", "message", ",", "null", ")", ";", "}", "public", "static", "String", "bind", "(", "String", "message", ",", "Object", "binding", ")", "{", "return", "bind", "(", "message", ",", "new", "Object", "[", "]", "{", "binding", "}", ")", ";", "}", "public", "static", "String", "bind", "(", "String", "message", ",", "Object", "binding1", ",", "Object", "binding2", ")", "{", "return", "bind", "(", "message", ",", "new", "Object", "[", "]", "{", "binding1", ",", "binding2", "}", ")", ";", "}", "public", "static", "String", "bind", "(", "String", "message", ",", "Object", "[", "]", "bindings", ")", "{", "return", "MessageFormat", ".", "format", "(", "message", ",", "bindings", ")", ";", "}", "}", "private", "String", "jarToIndex", ";", "private", "String", "indexFile", ";", "private", "boolean", "verbose", "=", "false", ";", "private", "static", "final", "String", "PDE_LAUNCH", "=", "\"-pdelaunch\"", ";", "private", "static", "final", "String", "ARG_HELP", "=", "\"-help\"", ";", "private", "static", "final", "String", "ARG_VERBOSE", "=", "\"-verbose\"", ";", "private", "static", "final", "String", "ARG_OUTPUT", "=", "\"-output\"", ";", "private", "void", "displayHelp", "(", ")", "{", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "CommandLineUsage", ")", ")", ";", "}", "private", "void", "displayError", "(", "String", "message", ")", "{", "System", ".", "out", ".", "println", "(", "message", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "displayHelp", "(", ")", ";", "}", "private", "boolean", "processCommandLine", "(", "String", "[", "]", "argsArray", ")", "{", "ArrayList", "args", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "argsArray", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "args", ".", "add", "(", "argsArray", "[", "i", "]", ")", ";", "}", "int", "index", "=", "0", ";", "final", "int", "argCount", "=", "argsArray", ".", "length", ";", "loop", ":", "while", "(", "index", "<", "argCount", ")", "{", "String", "currentArg", "=", "argsArray", "[", "index", "++", "]", ";", "if", "(", "PDE_LAUNCH", ".", "equals", "(", "currentArg", ")", ")", "{", "continue", "loop", ";", "}", "else", "if", "(", "ARG_HELP", ".", "equals", "(", "currentArg", ")", ")", "{", "displayHelp", "(", ")", ";", "return", "false", ";", "}", "else", "if", "(", "ARG_VERBOSE", ".", "equals", "(", "currentArg", ")", ")", "{", "this", ".", "verbose", "=", "true", ";", "continue", "loop", ";", "}", "else", "if", "(", "ARG_OUTPUT", ".", "equals", "(", "currentArg", ")", ")", "{", "if", "(", "this", ".", "indexFile", "!=", "null", ")", "{", "displayError", "(", "Messages", ".", "bind", "(", "Messages", ".", "CommandLineOnlyOneOutputError", ")", ")", ";", "return", "false", ";", "}", "else", "if", "(", "index", "==", "argCount", ")", "{", "displayError", "(", "Messages", ".", "bind", "(", "Messages", ".", "CommandLineOutputTakesArgs", ")", ")", ";", "return", "false", ";", "}", "this", ".", "indexFile", "=", "argsArray", "[", "index", "++", "]", ";", "}", "else", "{", "if", "(", "this", ".", "jarToIndex", "!=", "null", ")", "{", "displayError", "(", "Messages", ".", "bind", "(", "Messages", ".", "CommandLineOnlyOneJarError", ")", ")", ";", "return", "false", ";", "}", "this", ".", "jarToIndex", "=", "currentArg", ";", "}", "}", "return", "true", ";", "}", "public", "Object", "start", "(", "IApplicationContext", "context", ")", "throws", "Exception", "{", "boolean", "execute", "=", "processCommandLine", "(", "(", "String", "[", "]", ")", "context", ".", "getArguments", "(", ")", ".", "get", "(", "IApplicationContext", ".", "APPLICATION_ARGS", ")", ")", ";", "if", "(", "execute", ")", "{", "if", "(", "this", ".", "jarToIndex", "!=", "null", "&&", "this", ".", "indexFile", "!=", "null", ")", "{", "File", "f", "=", "new", "File", "(", "this", ".", "jarToIndex", ")", ";", "if", "(", "f", ".", "exists", "(", ")", ")", "{", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "CommandLineProcessing", ",", "this", ".", "indexFile", ",", "this", ".", "jarToIndex", ")", ")", ";", "}", "try", "{", "JavaIndexer", ".", "generateIndexForJar", "(", "this", ".", "jarToIndex", ",", "this", ".", "indexFile", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "CaughtException", ",", "\"IOException\"", ",", "e", ".", "getLocalizedMessage", "(", ")", ")", ")", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "CommandLineJarFileNotExist", ",", "this", ".", "jarToIndex", ")", ")", ";", "}", "}", "else", "if", "(", "this", ".", "jarToIndex", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "CommandLineJarNotSpecified", ")", ")", ";", "}", "else", "if", "(", "this", ".", "indexFile", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "CommandLineIndexFileNotSpecified", ")", ")", ";", "}", "}", "return", "IApplication", ".", "EXIT_OK", ";", "}", "public", "void", "stop", "(", ")", "{", "}", "}", "</s>" ]
2,501
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "index", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "DefaultJavaIndexer", ";", "public", "final", "class", "JavaIndexer", "{", "public", "static", "void", "generateIndexForJar", "(", "String", "pathToJar", ",", "String", "pathToIndexFile", ")", "throws", "IOException", "{", "new", "DefaultJavaIndexer", "(", ")", ".", "generateIndexForJar", "(", "pathToJar", ",", "pathToIndexFile", ")", ";", "}", "}", "</s>" ]
2,502
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ";", "import", "java", ".", "io", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "HashtableOfObject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "ReadWriteMonitor", ";", "public", "class", "Index", "{", "public", "String", "containerPath", ";", "public", "ReadWriteMonitor", "monitor", ";", "static", "final", "char", "DEFAULT_SEPARATOR", "=", "'/'", ";", "public", "char", "separator", "=", "DEFAULT_SEPARATOR", ";", "static", "final", "char", "JAR_SEPARATOR", "=", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", ".", "charAt", "(", "0", ")", ";", "protected", "DiskIndex", "diskIndex", ";", "protected", "MemoryIndex", "memoryIndex", ";", "static", "final", "int", "MATCH_RULE_INDEX_MASK", "=", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_PREFIX_MATCH", "|", "SearchPattern", ".", "R_PATTERN_MATCH", "|", "SearchPattern", ".", "R_REGEXP_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", "|", "SearchPattern", ".", "R_CAMELCASE_MATCH", "|", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ";", "public", "static", "boolean", "isMatch", "(", "char", "[", "]", "pattern", ",", "char", "[", "]", "word", ",", "int", "matchRule", ")", "{", "if", "(", "pattern", "==", "null", ")", "return", "true", ";", "int", "patternLength", "=", "pattern", ".", "length", ";", "int", "wordLength", "=", "word", ".", "length", ";", "if", "(", "patternLength", "==", "0", ")", "return", "matchRule", "!=", "SearchPattern", ".", "R_EXACT_MATCH", ";", "if", "(", "wordLength", "==", "0", ")", "return", "(", "matchRule", "&", "SearchPattern", ".", "R_PATTERN_MATCH", ")", "!=", "0", "&&", "patternLength", "==", "1", "&&", "pattern", "[", "0", "]", "==", "'*'", ";", "switch", "(", "matchRule", "&", "MATCH_RULE_INDEX_MASK", ")", "{", "case", "SearchPattern", ".", "R_EXACT_MATCH", ":", "return", "patternLength", "==", "wordLength", "&&", "CharOperation", ".", "equals", "(", "pattern", ",", "word", ",", "false", ")", ";", "case", "SearchPattern", ".", "R_PREFIX_MATCH", ":", "return", "patternLength", "<=", "wordLength", "&&", "CharOperation", ".", "prefixEquals", "(", "pattern", ",", "word", ",", "false", ")", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "return", "CharOperation", ".", "match", "(", "pattern", ",", "word", ",", "false", ")", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "if", "(", "CharOperation", ".", "camelCaseMatch", "(", "pattern", ",", "word", ",", "false", ")", ")", "{", "return", "true", ";", "}", "return", "patternLength", "<=", "wordLength", "&&", "CharOperation", ".", "prefixEquals", "(", "pattern", ",", "word", ",", "false", ")", ";", "case", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "return", "pattern", "[", "0", "]", "==", "word", "[", "0", "]", "&&", "patternLength", "==", "wordLength", "&&", "CharOperation", ".", "equals", "(", "pattern", ",", "word", ")", ";", "case", "SearchPattern", ".", "R_PREFIX_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "return", "pattern", "[", "0", "]", "==", "word", "[", "0", "]", "&&", "patternLength", "<=", "wordLength", "&&", "CharOperation", ".", "prefixEquals", "(", "pattern", ",", "word", ")", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "return", "CharOperation", ".", "match", "(", "pattern", ",", "word", ",", "true", ")", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "return", "(", "pattern", "[", "0", "]", "==", "word", "[", "0", "]", "&&", "CharOperation", ".", "camelCaseMatch", "(", "pattern", ",", "word", ",", "false", ")", ")", ";", "}", "return", "false", ";", "}", "public", "Index", "(", "IndexLocation", "location", ",", "String", "containerPath", ",", "boolean", "reuseExistingFile", ")", "throws", "IOException", "{", "this", ".", "containerPath", "=", "containerPath", ";", "this", ".", "monitor", "=", "new", "ReadWriteMonitor", "(", ")", ";", "this", ".", "memoryIndex", "=", "new", "MemoryIndex", "(", ")", ";", "this", ".", "diskIndex", "=", "new", "DiskIndex", "(", "location", ")", ";", "this", ".", "diskIndex", ".", "initialize", "(", "reuseExistingFile", ")", ";", "if", "(", "reuseExistingFile", ")", "this", ".", "separator", "=", "this", ".", "diskIndex", ".", "separator", ";", "}", "public", "void", "addIndexEntry", "(", "char", "[", "]", "category", ",", "char", "[", "]", "key", ",", "String", "containerRelativePath", ")", "{", "this", ".", "memoryIndex", ".", "addIndexEntry", "(", "category", ",", "key", ",", "containerRelativePath", ")", ";", "}", "public", "String", "containerRelativePath", "(", "String", "documentPath", ")", "{", "int", "index", "=", "documentPath", ".", "indexOf", "(", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "index", "=", "this", ".", "containerPath", ".", "length", "(", ")", ";", "if", "(", "documentPath", ".", "length", "(", ")", "<=", "index", ")", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "documentPath", "+", "\"\"", "+", "this", ".", "containerPath", ")", ";", "}", "return", "documentPath", ".", "substring", "(", "index", "+", "1", ")", ";", "}", "public", "File", "getIndexFile", "(", ")", "{", "return", "this", ".", "diskIndex", "==", "null", "?", "null", ":", "this", ".", "diskIndex", ".", "indexLocation", ".", "getIndexFile", "(", ")", ";", "}", "public", "IndexLocation", "getIndexLocation", "(", ")", "{", "return", "this", ".", "diskIndex", "==", "null", "?", "null", ":", "this", ".", "diskIndex", ".", "indexLocation", ";", "}", "public", "long", "getIndexLastModified", "(", ")", "{", "return", "this", ".", "diskIndex", "==", "null", "?", "-", "1", ":", "this", ".", "diskIndex", ".", "indexLocation", ".", "lastModified", "(", ")", ";", "}", "public", "boolean", "hasChanged", "(", ")", "{", "return", "this", ".", "memoryIndex", ".", "hasChanged", "(", ")", ";", "}", "public", "EntryResult", "[", "]", "query", "(", "char", "[", "]", "[", "]", "categories", ",", "char", "[", "]", "key", ",", "int", "matchRule", ")", "throws", "IOException", "{", "if", "(", "this", ".", "memoryIndex", ".", "shouldMerge", "(", ")", "&&", "this", ".", "monitor", ".", "exitReadEnterWrite", "(", ")", ")", "{", "try", "{", "save", "(", ")", ";", "}", "finally", "{", "this", ".", "monitor", ".", "exitWriteEnterRead", "(", ")", ";", "}", "}", "HashtableOfObject", "results", ";", "int", "rule", "=", "matchRule", "&", "MATCH_RULE_INDEX_MASK", ";", "if", "(", "this", ".", "memoryIndex", ".", "hasChanged", "(", ")", ")", "{", "results", "=", "this", ".", "diskIndex", ".", "addQueryResults", "(", "categories", ",", "key", ",", "rule", ",", "this", ".", "memoryIndex", ")", ";", "results", "=", "this", ".", "memoryIndex", ".", "addQueryResults", "(", "categories", ",", "key", ",", "rule", ",", "results", ")", ";", "}", "else", "{", "results", "=", "this", ".", "diskIndex", ".", "addQueryResults", "(", "categories", ",", "key", ",", "rule", ",", "null", ")", ";", "}", "if", "(", "results", "==", "null", ")", "return", "null", ";", "EntryResult", "[", "]", "entryResults", "=", "new", "EntryResult", "[", "results", ".", "elementSize", "]", ";", "int", "count", "=", "0", ";", "Object", "[", "]", "values", "=", "results", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "values", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "EntryResult", "result", "=", "(", "EntryResult", ")", "values", "[", "i", "]", ";", "if", "(", "result", "!=", "null", ")", "entryResults", "[", "count", "++", "]", "=", "result", ";", "}", "return", "entryResults", ";", "}", "public", "String", "[", "]", "queryDocumentNames", "(", "String", "substring", ")", "throws", "IOException", "{", "SimpleSet", "results", ";", "if", "(", "this", ".", "memoryIndex", ".", "hasChanged", "(", ")", ")", "{", "results", "=", "this", ".", "diskIndex", ".", "addDocumentNames", "(", "substring", ",", "this", ".", "memoryIndex", ")", ";", "this", ".", "memoryIndex", ".", "addDocumentNames", "(", "substring", ",", "results", ")", ";", "}", "else", "{", "results", "=", "this", ".", "diskIndex", ".", "addDocumentNames", "(", "substring", ",", "null", ")", ";", "}", "if", "(", "results", ".", "elementSize", "==", "0", ")", "return", "null", ";", "String", "[", "]", "documentNames", "=", "new", "String", "[", "results", ".", "elementSize", "]", ";", "int", "count", "=", "0", ";", "Object", "[", "]", "paths", "=", "results", ".", "values", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "paths", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "paths", "[", "i", "]", "!=", "null", ")", "documentNames", "[", "count", "++", "]", "=", "(", "String", ")", "paths", "[", "i", "]", ";", "return", "documentNames", ";", "}", "public", "void", "remove", "(", "String", "containerRelativePath", ")", "{", "this", ".", "memoryIndex", ".", "remove", "(", "containerRelativePath", ")", ";", "}", "public", "void", "reset", "(", ")", "throws", "IOException", "{", "this", ".", "memoryIndex", "=", "new", "MemoryIndex", "(", ")", ";", "this", ".", "diskIndex", "=", "new", "DiskIndex", "(", "this", ".", "diskIndex", ".", "indexLocation", ")", ";", "this", ".", "diskIndex", ".", "initialize", "(", "false", ")", ";", "}", "public", "void", "save", "(", ")", "throws", "IOException", "{", "if", "(", "!", "hasChanged", "(", ")", ")", "return", ";", "int", "numberOfChanges", "=", "this", ".", "memoryIndex", ".", "docsToReferences", ".", "elementSize", ";", "this", ".", "diskIndex", ".", "separator", "=", "this", ".", "separator", ";", "this", ".", "diskIndex", "=", "this", ".", "diskIndex", ".", "mergeWith", "(", "this", ".", "memoryIndex", ")", ";", "this", ".", "memoryIndex", "=", "new", "MemoryIndex", "(", ")", ";", "if", "(", "numberOfChanges", ">", "1000", ")", "System", ".", "gc", "(", ")", ";", "}", "public", "void", "startQuery", "(", ")", "{", "if", "(", "this", ".", "diskIndex", "!=", "null", ")", "this", ".", "diskIndex", ".", "startQuery", "(", ")", ";", "}", "public", "void", "stopQuery", "(", ")", "{", "if", "(", "this", ".", "diskIndex", "!=", "null", ")", "this", ".", "diskIndex", ".", "stopQuery", "(", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Index", "for", "\"", "+", "this", ".", "containerPath", ";", "}", "public", "boolean", "isIndexForJar", "(", ")", "{", "return", "this", ".", "separator", "==", "JAR_SEPARATOR", ";", "}", "}", "</s>" ]
2,503
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ";", "import", "java", ".", "io", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "HashtableOfIntValues", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "HashtableOfObject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSetOfCharArray", ";", "public", "class", "DiskIndex", "{", "IndexLocation", "indexLocation", ";", "private", "int", "headerInfoOffset", ";", "private", "int", "numberOfChunks", ";", "private", "int", "sizeOfLastChunk", ";", "private", "int", "[", "]", "chunkOffsets", ";", "private", "int", "documentReferenceSize", ";", "private", "int", "startOfCategoryTables", ";", "private", "HashtableOfIntValues", "categoryOffsets", ",", "categoryEnds", ";", "private", "int", "cacheUserCount", ";", "private", "String", "[", "]", "[", "]", "cachedChunks", ";", "private", "HashtableOfObject", "categoryTables", ";", "private", "char", "[", "]", "cachedCategoryName", ";", "private", "static", "final", "int", "DEFAULT_BUFFER_SIZE", "=", "2048", ";", "private", "static", "int", "BUFFER_READ_SIZE", "=", "DEFAULT_BUFFER_SIZE", ";", "private", "static", "final", "int", "BUFFER_WRITE_SIZE", "=", "DEFAULT_BUFFER_SIZE", ";", "private", "byte", "[", "]", "streamBuffer", ";", "private", "int", "bufferIndex", ",", "bufferEnd", ";", "private", "int", "streamEnd", ";", "char", "separator", "=", "Index", ".", "DEFAULT_SEPARATOR", ";", "public", "static", "final", "String", "SIGNATURE", "=", "\"\"", ";", "private", "static", "final", "char", "[", "]", "SIGNATURE_CHARS", "=", "SIGNATURE", ".", "toCharArray", "(", ")", ";", "public", "static", "boolean", "DEBUG", "=", "false", ";", "private", "static", "final", "int", "RE_INDEXED", "=", "-", "1", ";", "private", "static", "final", "int", "DELETED", "=", "-", "2", ";", "private", "static", "final", "int", "CHUNK_SIZE", "=", "100", ";", "private", "static", "final", "SimpleSetOfCharArray", "INTERNED_CATEGORY_NAMES", "=", "new", "SimpleSetOfCharArray", "(", "20", ")", ";", "static", "class", "IntList", "{", "int", "size", ";", "int", "[", "]", "elements", ";", "IntList", "(", "int", "[", "]", "elements", ")", "{", "this", ".", "elements", "=", "elements", ";", "this", ".", "size", "=", "elements", ".", "length", ";", "}", "void", "add", "(", "int", "newElement", ")", "{", "if", "(", "this", ".", "size", "==", "this", ".", "elements", ".", "length", ")", "{", "int", "newSize", "=", "this", ".", "size", "*", "3", ";", "if", "(", "newSize", "<", "7", ")", "newSize", "=", "7", ";", "System", ".", "arraycopy", "(", "this", ".", "elements", ",", "0", ",", "this", ".", "elements", "=", "new", "int", "[", "newSize", "]", ",", "0", ",", "this", ".", "size", ")", ";", "}", "this", ".", "elements", "[", "this", ".", "size", "++", "]", "=", "newElement", ";", "}", "int", "[", "]", "asArray", "(", ")", "{", "int", "[", "]", "result", "=", "new", "int", "[", "this", ".", "size", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "elements", ",", "0", ",", "result", ",", "0", ",", "this", ".", "size", ")", ";", "return", "result", ";", "}", "}", "DiskIndex", "(", ")", "{", "this", ".", "headerInfoOffset", "=", "-", "1", ";", "this", ".", "numberOfChunks", "=", "-", "1", ";", "this", ".", "sizeOfLastChunk", "=", "-", "1", ";", "this", ".", "chunkOffsets", "=", "null", ";", "this", ".", "documentReferenceSize", "=", "-", "1", ";", "this", ".", "cacheUserCount", "=", "-", "1", ";", "this", ".", "cachedChunks", "=", "null", ";", "this", ".", "categoryTables", "=", "null", ";", "this", ".", "cachedCategoryName", "=", "null", ";", "this", ".", "categoryOffsets", "=", "null", ";", "this", ".", "categoryEnds", "=", "null", ";", "}", "DiskIndex", "(", "IndexLocation", "location", ")", "throws", "IOException", "{", "this", "(", ")", ";", "if", "(", "location", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "indexLocation", "=", "location", ";", "}", "SimpleSet", "addDocumentNames", "(", "String", "substring", ",", "MemoryIndex", "memoryIndex", ")", "throws", "IOException", "{", "String", "[", "]", "docNames", "=", "readAllDocumentNames", "(", ")", ";", "SimpleSet", "results", "=", "new", "SimpleSet", "(", "docNames", ".", "length", ")", ";", "if", "(", "substring", "==", "null", ")", "{", "if", "(", "memoryIndex", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "docNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "results", ".", "add", "(", "docNames", "[", "i", "]", ")", ";", "}", "else", "{", "SimpleLookupTable", "docsToRefs", "=", "memoryIndex", ".", "docsToReferences", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "docNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "String", "docName", "=", "docNames", "[", "i", "]", ";", "if", "(", "!", "docsToRefs", ".", "containsKey", "(", "docName", ")", ")", "results", ".", "add", "(", "docName", ")", ";", "}", "}", "}", "else", "{", "if", "(", "memoryIndex", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "docNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "docNames", "[", "i", "]", ".", "startsWith", "(", "substring", ",", "0", ")", ")", "results", ".", "add", "(", "docNames", "[", "i", "]", ")", ";", "}", "else", "{", "SimpleLookupTable", "docsToRefs", "=", "memoryIndex", ".", "docsToReferences", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "docNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "String", "docName", "=", "docNames", "[", "i", "]", ";", "if", "(", "docName", ".", "startsWith", "(", "substring", ",", "0", ")", "&&", "!", "docsToRefs", ".", "containsKey", "(", "docName", ")", ")", "results", ".", "add", "(", "docName", ")", ";", "}", "}", "}", "return", "results", ";", "}", "private", "HashtableOfObject", "addQueryResult", "(", "HashtableOfObject", "results", ",", "char", "[", "]", "word", ",", "Object", "docs", ",", "MemoryIndex", "memoryIndex", ",", "boolean", "prevResults", ")", "throws", "IOException", "{", "if", "(", "results", "==", "null", ")", "results", "=", "new", "HashtableOfObject", "(", "13", ")", ";", "EntryResult", "result", "=", "prevResults", "?", "(", "EntryResult", ")", "results", ".", "get", "(", "word", ")", ":", "null", ";", "if", "(", "memoryIndex", "==", "null", ")", "{", "if", "(", "result", "==", "null", ")", "results", ".", "putUnsafely", "(", "word", ",", "new", "EntryResult", "(", "word", ",", "docs", ")", ")", ";", "else", "result", ".", "addDocumentTable", "(", "docs", ")", ";", "}", "else", "{", "SimpleLookupTable", "docsToRefs", "=", "memoryIndex", ".", "docsToReferences", ";", "if", "(", "result", "==", "null", ")", "result", "=", "new", "EntryResult", "(", "word", ",", "null", ")", ";", "int", "[", "]", "docNumbers", "=", "readDocumentNumbers", "(", "docs", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "docNumbers", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "String", "docName", "=", "readDocumentName", "(", "docNumbers", "[", "i", "]", ")", ";", "if", "(", "!", "docsToRefs", ".", "containsKey", "(", "docName", ")", ")", "result", ".", "addDocumentName", "(", "docName", ")", ";", "}", "if", "(", "!", "result", ".", "isEmpty", "(", ")", ")", "results", ".", "put", "(", "word", ",", "result", ")", ";", "}", "return", "results", ";", "}", "HashtableOfObject", "addQueryResults", "(", "char", "[", "]", "[", "]", "categories", ",", "char", "[", "]", "key", ",", "int", "matchRule", ",", "MemoryIndex", "memoryIndex", ")", "throws", "IOException", "{", "if", "(", "this", ".", "categoryOffsets", "==", "null", ")", "return", "null", ";", "HashtableOfObject", "results", "=", "null", ";", "boolean", "prevResults", "=", "false", ";", "if", "(", "key", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "categories", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "HashtableOfObject", "wordsToDocNumbers", "=", "readCategoryTable", "(", "categories", "[", "i", "]", ",", "true", ")", ";", "if", "(", "wordsToDocNumbers", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "words", "=", "wordsToDocNumbers", ".", "keyTable", ";", "Object", "[", "]", "values", "=", "wordsToDocNumbers", ".", "valueTable", ";", "if", "(", "results", "==", "null", ")", "results", "=", "new", "HashtableOfObject", "(", "wordsToDocNumbers", ".", "elementSize", ")", ";", "for", "(", "int", "j", "=", "0", ",", "m", "=", "words", ".", "length", ";", "j", "<", "m", ";", "j", "++", ")", "if", "(", "words", "[", "j", "]", "!=", "null", ")", "results", "=", "addQueryResult", "(", "results", ",", "words", "[", "j", "]", ",", "values", "[", "j", "]", ",", "memoryIndex", ",", "prevResults", ")", ";", "}", "prevResults", "=", "results", "!=", "null", ";", "}", "if", "(", "results", "!=", "null", "&&", "this", ".", "cachedChunks", "==", "null", ")", "cacheDocumentNames", "(", ")", ";", "}", "else", "{", "switch", "(", "matchRule", ")", "{", "case", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "for", "(", "int", "i", "=", "0", ",", "l", "=", "categories", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "HashtableOfObject", "wordsToDocNumbers", "=", "readCategoryTable", "(", "categories", "[", "i", "]", ",", "false", ")", ";", "Object", "value", ";", "if", "(", "wordsToDocNumbers", "!=", "null", "&&", "(", "value", "=", "wordsToDocNumbers", ".", "get", "(", "key", ")", ")", "!=", "null", ")", "results", "=", "addQueryResult", "(", "results", ",", "key", ",", "value", ",", "memoryIndex", ",", "prevResults", ")", ";", "prevResults", "=", "results", "!=", "null", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_PREFIX_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "for", "(", "int", "i", "=", "0", ",", "l", "=", "categories", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "HashtableOfObject", "wordsToDocNumbers", "=", "readCategoryTable", "(", "categories", "[", "i", "]", ",", "false", ")", ";", "if", "(", "wordsToDocNumbers", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "words", "=", "wordsToDocNumbers", ".", "keyTable", ";", "Object", "[", "]", "values", "=", "wordsToDocNumbers", ".", "valueTable", ";", "for", "(", "int", "j", "=", "0", ",", "m", "=", "words", ".", "length", ";", "j", "<", "m", ";", "j", "++", ")", "{", "char", "[", "]", "word", "=", "words", "[", "j", "]", ";", "if", "(", "word", "!=", "null", "&&", "key", "[", "0", "]", "==", "word", "[", "0", "]", "&&", "CharOperation", ".", "prefixEquals", "(", "key", ",", "word", ")", ")", "results", "=", "addQueryResult", "(", "results", ",", "word", ",", "values", "[", "j", "]", ",", "memoryIndex", ",", "prevResults", ")", ";", "}", "}", "prevResults", "=", "results", "!=", "null", ";", "}", "break", ";", "default", ":", "for", "(", "int", "i", "=", "0", ",", "l", "=", "categories", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "HashtableOfObject", "wordsToDocNumbers", "=", "readCategoryTable", "(", "categories", "[", "i", "]", ",", "false", ")", ";", "if", "(", "wordsToDocNumbers", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "words", "=", "wordsToDocNumbers", ".", "keyTable", ";", "Object", "[", "]", "values", "=", "wordsToDocNumbers", ".", "valueTable", ";", "for", "(", "int", "j", "=", "0", ",", "m", "=", "words", ".", "length", ";", "j", "<", "m", ";", "j", "++", ")", "{", "char", "[", "]", "word", "=", "words", "[", "j", "]", ";", "if", "(", "word", "!=", "null", "&&", "Index", ".", "isMatch", "(", "key", ",", "word", ",", "matchRule", ")", ")", "results", "=", "addQueryResult", "(", "results", ",", "word", ",", "values", "[", "j", "]", ",", "memoryIndex", ",", "prevResults", ")", ";", "}", "}", "prevResults", "=", "results", "!=", "null", ";", "}", "}", "}", "if", "(", "results", "==", "null", ")", "return", "null", ";", "return", "results", ";", "}", "private", "void", "cacheDocumentNames", "(", ")", "throws", "IOException", "{", "this", ".", "cachedChunks", "=", "new", "String", "[", "this", ".", "numberOfChunks", "]", "[", "]", ";", "InputStream", "stream", "=", "this", ".", "indexLocation", ".", "getInputStream", "(", ")", ";", "try", "{", "if", "(", "this", ".", "numberOfChunks", ">", "5", ")", "BUFFER_READ_SIZE", "<<=", "1", ";", "int", "offset", "=", "this", ".", "chunkOffsets", "[", "0", "]", ";", "stream", ".", "skip", "(", "offset", ")", ";", "this", ".", "streamBuffer", "=", "new", "byte", "[", "BUFFER_READ_SIZE", "]", ";", "this", ".", "bufferIndex", "=", "0", ";", "this", ".", "bufferEnd", "=", "stream", ".", "read", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "streamBuffer", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "numberOfChunks", ";", "i", "++", ")", "{", "int", "size", "=", "i", "==", "this", ".", "numberOfChunks", "-", "1", "?", "this", ".", "sizeOfLastChunk", ":", "CHUNK_SIZE", ";", "readChunk", "(", "this", ".", "cachedChunks", "[", "i", "]", "=", "new", "String", "[", "size", "]", ",", "stream", ",", "0", ",", "size", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "this", ".", "cachedChunks", "=", "null", ";", "throw", "e", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "this", ".", "streamBuffer", "=", "null", ";", "BUFFER_READ_SIZE", "=", "DEFAULT_BUFFER_SIZE", ";", "}", "}", "private", "String", "[", "]", "computeDocumentNames", "(", "String", "[", "]", "onDiskNames", ",", "int", "[", "]", "positions", ",", "SimpleLookupTable", "indexedDocuments", ",", "MemoryIndex", "memoryIndex", ")", "{", "int", "onDiskLength", "=", "onDiskNames", ".", "length", ";", "Object", "[", "]", "docNames", "=", "memoryIndex", ".", "docsToReferences", ".", "keyTable", ";", "Object", "[", "]", "referenceTables", "=", "memoryIndex", ".", "docsToReferences", ".", "valueTable", ";", "if", "(", "onDiskLength", "==", "0", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "referenceTables", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "referenceTables", "[", "i", "]", "!=", "null", ")", "indexedDocuments", ".", "put", "(", "docNames", "[", "i", "]", ",", "null", ")", ";", "String", "[", "]", "newDocNames", "=", "new", "String", "[", "indexedDocuments", ".", "elementSize", "]", ";", "int", "count", "=", "0", ";", "Object", "[", "]", "added", "=", "indexedDocuments", ".", "keyTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "added", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "added", "[", "i", "]", "!=", "null", ")", "newDocNames", "[", "count", "++", "]", "=", "(", "String", ")", "added", "[", "i", "]", ";", "Util", ".", "sort", "(", "newDocNames", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "newDocNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "indexedDocuments", ".", "put", "(", "newDocNames", "[", "i", "]", ",", "new", "Integer", "(", "i", ")", ")", ";", "return", "newDocNames", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "onDiskLength", ";", "i", "++", ")", "positions", "[", "i", "]", "=", "i", ";", "int", "numDeletedDocNames", "=", "0", ";", "nextPath", ":", "for", "(", "int", "i", "=", "0", ",", "l", "=", "docNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "String", "docName", "=", "(", "String", ")", "docNames", "[", "i", "]", ";", "if", "(", "docName", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "onDiskLength", ";", "j", "++", ")", "{", "if", "(", "docName", ".", "equals", "(", "onDiskNames", "[", "j", "]", ")", ")", "{", "if", "(", "referenceTables", "[", "i", "]", "==", "null", ")", "{", "positions", "[", "j", "]", "=", "DELETED", ";", "numDeletedDocNames", "++", ";", "}", "else", "{", "positions", "[", "j", "]", "=", "RE_INDEXED", ";", "}", "continue", "nextPath", ";", "}", "}", "if", "(", "referenceTables", "[", "i", "]", "!=", "null", ")", "indexedDocuments", ".", "put", "(", "docName", ",", "null", ")", ";", "}", "}", "String", "[", "]", "newDocNames", "=", "onDiskNames", ";", "if", "(", "numDeletedDocNames", ">", "0", "||", "indexedDocuments", ".", "elementSize", ">", "0", ")", "{", "newDocNames", "=", "new", "String", "[", "onDiskLength", "+", "indexedDocuments", ".", "elementSize", "-", "numDeletedDocNames", "]", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "onDiskLength", ";", "i", "++", ")", "if", "(", "positions", "[", "i", "]", ">=", "RE_INDEXED", ")", "newDocNames", "[", "count", "++", "]", "=", "onDiskNames", "[", "i", "]", ";", "Object", "[", "]", "added", "=", "indexedDocuments", ".", "keyTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "added", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "added", "[", "i", "]", "!=", "null", ")", "newDocNames", "[", "count", "++", "]", "=", "(", "String", ")", "added", "[", "i", "]", ";", "Util", ".", "sort", "(", "newDocNames", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "newDocNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "indexedDocuments", ".", "containsKey", "(", "newDocNames", "[", "i", "]", ")", ")", "indexedDocuments", ".", "put", "(", "newDocNames", "[", "i", "]", ",", "new", "Integer", "(", "i", ")", ")", ";", "}", "int", "count", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "onDiskLength", ";", ")", "{", "switch", "(", "positions", "[", "i", "]", ")", "{", "case", "DELETED", ":", "i", "++", ";", "break", ";", "case", "RE_INDEXED", ":", "String", "newName", "=", "newDocNames", "[", "++", "count", "]", ";", "if", "(", "newName", ".", "equals", "(", "onDiskNames", "[", "i", "]", ")", ")", "{", "indexedDocuments", ".", "put", "(", "newName", ",", "new", "Integer", "(", "count", ")", ")", ";", "i", "++", ";", "}", "break", ";", "default", ":", "if", "(", "newDocNames", "[", "++", "count", "]", ".", "equals", "(", "onDiskNames", "[", "i", "]", ")", ")", "positions", "[", "i", "++", "]", "=", "count", ";", "}", "}", "return", "newDocNames", ";", "}", "private", "void", "copyQueryResults", "(", "HashtableOfObject", "categoryToWords", ",", "int", "newPosition", ")", "{", "char", "[", "]", "[", "]", "categoryNames", "=", "categoryToWords", ".", "keyTable", ";", "Object", "[", "]", "wordSets", "=", "categoryToWords", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "categoryNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "char", "[", "]", "categoryName", "=", "categoryNames", "[", "i", "]", ";", "if", "(", "categoryName", "!=", "null", ")", "{", "SimpleWordSet", "wordSet", "=", "(", "SimpleWordSet", ")", "wordSets", "[", "i", "]", ";", "HashtableOfObject", "wordsToDocs", "=", "(", "HashtableOfObject", ")", "this", ".", "categoryTables", ".", "get", "(", "categoryName", ")", ";", "if", "(", "wordsToDocs", "==", "null", ")", "this", ".", "categoryTables", ".", "put", "(", "categoryName", ",", "wordsToDocs", "=", "new", "HashtableOfObject", "(", "wordSet", ".", "elementSize", ")", ")", ";", "char", "[", "]", "[", "]", "words", "=", "wordSet", ".", "words", ";", "for", "(", "int", "j", "=", "0", ",", "m", "=", "words", ".", "length", ";", "j", "<", "m", ";", "j", "++", ")", "{", "char", "[", "]", "word", "=", "words", "[", "j", "]", ";", "if", "(", "word", "!=", "null", ")", "{", "Object", "o", "=", "wordsToDocs", ".", "get", "(", "word", ")", ";", "if", "(", "o", "==", "null", ")", "{", "wordsToDocs", ".", "putUnsafely", "(", "word", ",", "new", "int", "[", "]", "{", "newPosition", "}", ")", ";", "}", "else", "if", "(", "o", "instanceof", "IntList", ")", "{", "(", "(", "IntList", ")", "o", ")", ".", "add", "(", "newPosition", ")", ";", "}", "else", "{", "IntList", "list", "=", "new", "IntList", "(", "(", "int", "[", "]", ")", "o", ")", ";", "list", ".", "add", "(", "newPosition", ")", ";", "wordsToDocs", ".", "put", "(", "word", ",", "list", ")", ";", "}", "}", "}", "}", "}", "}", "void", "initialize", "(", "boolean", "reuseExistingFile", ")", "throws", "IOException", "{", "if", "(", "this", ".", "indexLocation", ".", "exists", "(", ")", ")", "{", "if", "(", "reuseExistingFile", ")", "{", "InputStream", "stream", "=", "this", ".", "indexLocation", ".", "getInputStream", "(", ")", ";", "if", "(", "stream", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "this", ".", "streamBuffer", "=", "new", "byte", "[", "BUFFER_READ_SIZE", "]", ";", "this", ".", "bufferIndex", "=", "0", ";", "this", ".", "bufferEnd", "=", "stream", ".", "read", "(", "this", ".", "streamBuffer", ",", "0", ",", "128", ")", ";", "try", "{", "char", "[", "]", "signature", "=", "readStreamChars", "(", "stream", ")", ";", "if", "(", "!", "CharOperation", ".", "equals", "(", "signature", ",", "SIGNATURE_CHARS", ")", ")", "{", "throw", "new", "IOException", "(", "Messages", ".", "exception_wrongFormat", ")", ";", "}", "this", ".", "headerInfoOffset", "=", "readStreamInt", "(", "stream", ")", ";", "if", "(", "this", ".", "headerInfoOffset", ">", "0", ")", "{", "stream", ".", "skip", "(", "this", ".", "headerInfoOffset", "-", "this", ".", "bufferEnd", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "this", ".", "bufferEnd", "=", "stream", ".", "read", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "streamBuffer", ".", "length", ")", ";", "readHeaderInfo", "(", "stream", ")", ";", "}", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "}", "return", ";", "}", "if", "(", "!", "this", ".", "indexLocation", ".", "delete", "(", ")", ")", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "throw", "new", "IOException", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "}", "}", "if", "(", "this", ".", "indexLocation", ".", "createNewFile", "(", ")", ")", "{", "FileOutputStream", "stream", "=", "new", "FileOutputStream", "(", "this", ".", "indexLocation", ".", "getIndexFile", "(", ")", ",", "false", ")", ";", "try", "{", "this", ".", "streamBuffer", "=", "new", "byte", "[", "BUFFER_READ_SIZE", "]", ";", "this", ".", "bufferIndex", "=", "0", ";", "writeStreamChars", "(", "stream", ",", "SIGNATURE_CHARS", ")", ";", "writeStreamInt", "(", "stream", ",", "-", "1", ")", ";", "if", "(", "this", ".", "bufferIndex", ">", "0", ")", "{", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "}", "}", "else", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "throw", "new", "IOException", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "}", "}", "private", "void", "initializeFrom", "(", "DiskIndex", "diskIndex", ",", "File", "newIndexFile", ")", "throws", "IOException", "{", "if", "(", "newIndexFile", ".", "exists", "(", ")", "&&", "!", "newIndexFile", ".", "delete", "(", ")", ")", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "}", "else", "if", "(", "!", "newIndexFile", ".", "createNewFile", "(", ")", ")", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "throw", "new", "IOException", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "}", "int", "size", "=", "diskIndex", ".", "categoryOffsets", "==", "null", "?", "8", ":", "diskIndex", ".", "categoryOffsets", ".", "elementSize", ";", "this", ".", "categoryOffsets", "=", "new", "HashtableOfIntValues", "(", "size", ")", ";", "this", ".", "categoryEnds", "=", "new", "HashtableOfIntValues", "(", "size", ")", ";", "this", ".", "categoryTables", "=", "new", "HashtableOfObject", "(", "size", ")", ";", "this", ".", "separator", "=", "diskIndex", ".", "separator", ";", "}", "private", "void", "mergeCategories", "(", "DiskIndex", "onDisk", ",", "int", "[", "]", "positions", ",", "FileOutputStream", "stream", ")", "throws", "IOException", "{", "char", "[", "]", "[", "]", "oldNames", "=", "onDisk", ".", "categoryOffsets", ".", "keyTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "oldNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "char", "[", "]", "oldName", "=", "oldNames", "[", "i", "]", ";", "if", "(", "oldName", "!=", "null", "&&", "!", "this", ".", "categoryTables", ".", "containsKey", "(", "oldName", ")", ")", "this", ".", "categoryTables", ".", "put", "(", "oldName", ",", "null", ")", ";", "}", "char", "[", "]", "[", "]", "categoryNames", "=", "this", ".", "categoryTables", ".", "keyTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "categoryNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "categoryNames", "[", "i", "]", "!=", "null", ")", "mergeCategory", "(", "categoryNames", "[", "i", "]", ",", "onDisk", ",", "positions", ",", "stream", ")", ";", "this", ".", "categoryTables", "=", "null", ";", "}", "private", "void", "mergeCategory", "(", "char", "[", "]", "categoryName", ",", "DiskIndex", "onDisk", ",", "int", "[", "]", "positions", ",", "FileOutputStream", "stream", ")", "throws", "IOException", "{", "HashtableOfObject", "wordsToDocs", "=", "(", "HashtableOfObject", ")", "this", ".", "categoryTables", ".", "get", "(", "categoryName", ")", ";", "if", "(", "wordsToDocs", "==", "null", ")", "wordsToDocs", "=", "new", "HashtableOfObject", "(", "3", ")", ";", "HashtableOfObject", "oldWordsToDocs", "=", "onDisk", ".", "readCategoryTable", "(", "categoryName", ",", "true", ")", ";", "if", "(", "oldWordsToDocs", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "oldWords", "=", "oldWordsToDocs", ".", "keyTable", ";", "Object", "[", "]", "oldArrayOffsets", "=", "oldWordsToDocs", ".", "valueTable", ";", "nextWord", ":", "for", "(", "int", "i", "=", "0", ",", "l", "=", "oldWords", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "char", "[", "]", "oldWord", "=", "oldWords", "[", "i", "]", ";", "if", "(", "oldWord", "!=", "null", ")", "{", "int", "[", "]", "oldDocNumbers", "=", "(", "int", "[", "]", ")", "oldArrayOffsets", "[", "i", "]", ";", "int", "length", "=", "oldDocNumbers", ".", "length", ";", "int", "[", "]", "mappedNumbers", "=", "new", "int", "[", "length", "]", ";", "int", "count", "=", "0", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length", ";", "j", "++", ")", "{", "int", "pos", "=", "positions", "[", "oldDocNumbers", "[", "j", "]", "]", ";", "if", "(", "pos", ">", "RE_INDEXED", ")", "mappedNumbers", "[", "count", "++", "]", "=", "pos", ";", "}", "if", "(", "count", "<", "length", ")", "{", "if", "(", "count", "==", "0", ")", "continue", "nextWord", ";", "System", ".", "arraycopy", "(", "mappedNumbers", ",", "0", ",", "mappedNumbers", "=", "new", "int", "[", "count", "]", ",", "0", ",", "count", ")", ";", "}", "Object", "o", "=", "wordsToDocs", ".", "get", "(", "oldWord", ")", ";", "if", "(", "o", "==", "null", ")", "{", "wordsToDocs", ".", "putUnsafely", "(", "oldWord", ",", "mappedNumbers", ")", ";", "}", "else", "{", "IntList", "list", "=", "null", ";", "if", "(", "o", "instanceof", "IntList", ")", "{", "list", "=", "(", "IntList", ")", "o", ";", "}", "else", "{", "list", "=", "new", "IntList", "(", "(", "int", "[", "]", ")", "o", ")", ";", "wordsToDocs", ".", "put", "(", "oldWord", ",", "list", ")", ";", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "count", ";", "j", "++", ")", "list", ".", "add", "(", "mappedNumbers", "[", "j", "]", ")", ";", "}", "}", "}", "onDisk", ".", "categoryTables", ".", "put", "(", "categoryName", ",", "null", ")", ";", "}", "writeCategoryTable", "(", "categoryName", ",", "wordsToDocs", ",", "stream", ")", ";", "}", "DiskIndex", "mergeWith", "(", "MemoryIndex", "memoryIndex", ")", "throws", "IOException", "{", "if", "(", "this", ".", "indexLocation", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "String", "[", "]", "docNames", "=", "readAllDocumentNames", "(", ")", ";", "int", "previousLength", "=", "docNames", ".", "length", ";", "int", "[", "]", "positions", "=", "new", "int", "[", "previousLength", "]", ";", "SimpleLookupTable", "indexedDocuments", "=", "new", "SimpleLookupTable", "(", "3", ")", ";", "docNames", "=", "computeDocumentNames", "(", "docNames", ",", "positions", ",", "indexedDocuments", ",", "memoryIndex", ")", ";", "if", "(", "docNames", ".", "length", "==", "0", ")", "{", "if", "(", "previousLength", "==", "0", ")", "return", "this", ";", "DiskIndex", "newDiskIndex", "=", "new", "DiskIndex", "(", "this", ".", "indexLocation", ")", ";", "newDiskIndex", ".", "initialize", "(", "false", ")", ";", "return", "newDiskIndex", ";", "}", "File", "oldIndexFile", "=", "this", ".", "indexLocation", ".", "getIndexFile", "(", ")", ";", "DiskIndex", "newDiskIndex", "=", "new", "DiskIndex", "(", "new", "FileIndexLocation", "(", "new", "File", "(", "oldIndexFile", ".", "getPath", "(", ")", "+", "\".tmp\"", ")", ")", ")", ";", "File", "newIndexFile", "=", "newDiskIndex", ".", "indexLocation", ".", "getIndexFile", "(", ")", ";", "try", "{", "newDiskIndex", ".", "initializeFrom", "(", "this", ",", "newIndexFile", ")", ";", "FileOutputStream", "stream", "=", "new", "FileOutputStream", "(", "newIndexFile", ",", "false", ")", ";", "int", "offsetToHeader", "=", "-", "1", ";", "try", "{", "newDiskIndex", ".", "writeAllDocumentNames", "(", "docNames", ",", "stream", ")", ";", "docNames", "=", "null", ";", "if", "(", "indexedDocuments", ".", "elementSize", ">", "0", ")", "{", "Object", "[", "]", "names", "=", "indexedDocuments", ".", "keyTable", ";", "Object", "[", "]", "integerPositions", "=", "indexedDocuments", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "names", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "names", "[", "i", "]", "!=", "null", ")", "newDiskIndex", ".", "copyQueryResults", "(", "(", "HashtableOfObject", ")", "memoryIndex", ".", "docsToReferences", ".", "get", "(", "names", "[", "i", "]", ")", ",", "(", "(", "Integer", ")", "integerPositions", "[", "i", "]", ")", ".", "intValue", "(", ")", ")", ";", "}", "indexedDocuments", "=", "null", ";", "if", "(", "previousLength", "==", "0", ")", "newDiskIndex", ".", "writeCategories", "(", "stream", ")", ";", "else", "newDiskIndex", ".", "mergeCategories", "(", "this", ",", "positions", ",", "stream", ")", ";", "offsetToHeader", "=", "newDiskIndex", ".", "streamEnd", ";", "newDiskIndex", ".", "writeHeaderInfo", "(", "stream", ")", ";", "positions", "=", "null", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "this", ".", "streamBuffer", "=", "null", ";", "}", "newDiskIndex", ".", "writeOffsetToHeader", "(", "offsetToHeader", ")", ";", "if", "(", "oldIndexFile", ".", "exists", "(", ")", "&&", "!", "oldIndexFile", ".", "delete", "(", ")", ")", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "throw", "new", "IOException", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "}", "if", "(", "!", "newIndexFile", ".", "renameTo", "(", "oldIndexFile", ")", ")", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "throw", "new", "IOException", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "newIndexFile", ".", "exists", "(", ")", "&&", "!", "newIndexFile", ".", "delete", "(", ")", ")", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "newDiskIndex", ".", "indexLocation", ")", ";", "throw", "e", ";", "}", "newDiskIndex", ".", "indexLocation", "=", "this", ".", "indexLocation", ";", "return", "newDiskIndex", ";", "}", "private", "synchronized", "String", "[", "]", "readAllDocumentNames", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "numberOfChunks", "<=", "0", ")", "return", "CharOperation", ".", "NO_STRINGS", ";", "InputStream", "stream", "=", "this", ".", "indexLocation", ".", "getInputStream", "(", ")", ";", "try", "{", "int", "offset", "=", "this", ".", "chunkOffsets", "[", "0", "]", ";", "stream", ".", "skip", "(", "offset", ")", ";", "this", ".", "streamBuffer", "=", "new", "byte", "[", "BUFFER_READ_SIZE", "]", ";", "this", ".", "bufferIndex", "=", "0", ";", "this", ".", "bufferEnd", "=", "stream", ".", "read", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "streamBuffer", ".", "length", ")", ";", "int", "lastIndex", "=", "this", ".", "numberOfChunks", "-", "1", ";", "String", "[", "]", "docNames", "=", "new", "String", "[", "lastIndex", "*", "CHUNK_SIZE", "+", "this", ".", "sizeOfLastChunk", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "numberOfChunks", ";", "i", "++", ")", "readChunk", "(", "docNames", ",", "stream", ",", "i", "*", "CHUNK_SIZE", ",", "i", "<", "lastIndex", "?", "CHUNK_SIZE", ":", "this", ".", "sizeOfLastChunk", ")", ";", "return", "docNames", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "this", ".", "streamBuffer", "=", "null", ";", "}", "}", "private", "synchronized", "HashtableOfObject", "readCategoryTable", "(", "char", "[", "]", "categoryName", ",", "boolean", "readDocNumbers", ")", "throws", "IOException", "{", "int", "offset", "=", "this", ".", "categoryOffsets", ".", "get", "(", "categoryName", ")", ";", "if", "(", "offset", "==", "HashtableOfIntValues", ".", "NO_VALUE", ")", "{", "return", "null", ";", "}", "if", "(", "this", ".", "categoryTables", "==", "null", ")", "{", "this", ".", "categoryTables", "=", "new", "HashtableOfObject", "(", "3", ")", ";", "}", "else", "{", "HashtableOfObject", "cachedTable", "=", "(", "HashtableOfObject", ")", "this", ".", "categoryTables", ".", "get", "(", "categoryName", ")", ";", "if", "(", "cachedTable", "!=", "null", ")", "{", "if", "(", "readDocNumbers", ")", "{", "Object", "[", "]", "arrayOffsets", "=", "cachedTable", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "arrayOffsets", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "arrayOffsets", "[", "i", "]", "instanceof", "Integer", ")", "arrayOffsets", "[", "i", "]", "=", "readDocumentNumbers", "(", "arrayOffsets", "[", "i", "]", ")", ";", "}", "return", "cachedTable", ";", "}", "}", "InputStream", "stream", "=", "this", ".", "indexLocation", ".", "getInputStream", "(", ")", ";", "HashtableOfObject", "categoryTable", "=", "null", ";", "char", "[", "]", "[", "]", "matchingWords", "=", "null", ";", "int", "count", "=", "0", ";", "int", "firstOffset", "=", "-", "1", ";", "this", ".", "streamBuffer", "=", "new", "byte", "[", "BUFFER_READ_SIZE", "]", ";", "try", "{", "stream", ".", "skip", "(", "offset", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "this", ".", "bufferEnd", "=", "stream", ".", "read", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "streamBuffer", ".", "length", ")", ";", "int", "size", "=", "readStreamInt", "(", "stream", ")", ";", "try", "{", "if", "(", "size", "<", "0", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"file", "=", "\"", "+", "this", ".", "indexLocation", ")", ";", "System", ".", "err", ".", "println", "(", "\"offset", "=", "\"", "+", "offset", ")", ";", "System", ".", "err", ".", "println", "(", "\"size", "=", "\"", "+", "size", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "categoryTable", "=", "new", "HashtableOfObject", "(", "size", ")", ";", "}", "catch", "(", "OutOfMemoryError", "oom", ")", "{", "oom", ".", "printStackTrace", "(", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"file", "=", "\"", "+", "this", ".", "indexLocation", ")", ";", "System", ".", "err", ".", "println", "(", "\"offset", "=", "\"", "+", "offset", ")", ";", "System", ".", "err", ".", "println", "(", "\"size", "=", "\"", "+", "size", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "throw", "oom", ";", "}", "int", "largeArraySize", "=", "256", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "char", "[", "]", "word", "=", "readStreamChars", "(", "stream", ")", ";", "int", "arrayOffset", "=", "readStreamInt", "(", "stream", ")", ";", "if", "(", "arrayOffset", "<=", "0", ")", "{", "categoryTable", ".", "putUnsafely", "(", "word", ",", "new", "int", "[", "]", "{", "-", "arrayOffset", "}", ")", ";", "}", "else", "if", "(", "arrayOffset", "<", "largeArraySize", ")", "{", "categoryTable", ".", "putUnsafely", "(", "word", ",", "readStreamDocumentArray", "(", "stream", ",", "arrayOffset", ")", ")", ";", "}", "else", "{", "arrayOffset", "=", "readStreamInt", "(", "stream", ")", ";", "if", "(", "readDocNumbers", ")", "{", "if", "(", "matchingWords", "==", "null", ")", "matchingWords", "=", "new", "char", "[", "size", "]", "[", "]", ";", "if", "(", "count", "==", "0", ")", "firstOffset", "=", "arrayOffset", ";", "matchingWords", "[", "count", "++", "]", "=", "word", ";", "}", "categoryTable", ".", "putUnsafely", "(", "word", ",", "new", "Integer", "(", "arrayOffset", ")", ")", ";", "}", "}", "this", ".", "categoryTables", ".", "put", "(", "INTERNED_CATEGORY_NAMES", ".", "get", "(", "categoryName", ")", ",", "categoryTable", ")", ";", "this", ".", "cachedCategoryName", "=", "categoryTable", ".", "elementSize", "<", "20000", "?", "categoryName", ":", "null", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "this", ".", "streamBuffer", "=", "null", ";", "throw", "ioe", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "}", "if", "(", "matchingWords", "!=", "null", "&&", "count", ">", "0", ")", "{", "stream", "=", "this", ".", "indexLocation", ".", "getInputStream", "(", ")", ";", "try", "{", "stream", ".", "skip", "(", "firstOffset", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "this", ".", "bufferEnd", "=", "stream", ".", "read", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "streamBuffer", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "categoryTable", ".", "put", "(", "matchingWords", "[", "i", "]", ",", "readStreamDocumentArray", "(", "stream", ",", "readStreamInt", "(", "stream", ")", ")", ")", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "this", ".", "streamBuffer", "=", "null", ";", "throw", "ioe", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "}", "}", "this", ".", "streamBuffer", "=", "null", ";", "return", "categoryTable", ";", "}", "private", "void", "readChunk", "(", "String", "[", "]", "docNames", ",", "InputStream", "stream", ",", "int", "index", ",", "int", "size", ")", "throws", "IOException", "{", "String", "current", "=", "new", "String", "(", "readStreamChars", "(", "stream", ")", ")", ";", "docNames", "[", "index", "++", "]", "=", "current", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "stream", "!=", "null", "&&", "this", ".", "bufferIndex", "+", "2", ">=", "this", ".", "bufferEnd", ")", "readStreamBuffer", "(", "stream", ")", ";", "int", "start", "=", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ";", "int", "end", "=", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ";", "String", "next", "=", "new", "String", "(", "readStreamChars", "(", "stream", ")", ")", ";", "if", "(", "start", ">", "0", ")", "{", "if", "(", "end", ">", "0", ")", "{", "int", "length", "=", "current", ".", "length", "(", ")", ";", "next", "=", "current", ".", "substring", "(", "0", ",", "start", ")", "+", "next", "+", "current", ".", "substring", "(", "length", "-", "end", ",", "length", ")", ";", "}", "else", "{", "next", "=", "current", ".", "substring", "(", "0", ",", "start", ")", "+", "next", ";", "}", "}", "else", "if", "(", "end", ">", "0", ")", "{", "int", "length", "=", "current", ".", "length", "(", ")", ";", "next", "=", "next", "+", "current", ".", "substring", "(", "length", "-", "end", ",", "length", ")", ";", "}", "docNames", "[", "index", "++", "]", "=", "next", ";", "current", "=", "next", ";", "}", "}", "synchronized", "String", "readDocumentName", "(", "int", "docNumber", ")", "throws", "IOException", "{", "if", "(", "this", ".", "cachedChunks", "==", "null", ")", "this", ".", "cachedChunks", "=", "new", "String", "[", "this", ".", "numberOfChunks", "]", "[", "]", ";", "int", "chunkNumber", "=", "docNumber", "/", "CHUNK_SIZE", ";", "String", "[", "]", "chunk", "=", "this", ".", "cachedChunks", "[", "chunkNumber", "]", ";", "if", "(", "chunk", "==", "null", ")", "{", "boolean", "isLastChunk", "=", "chunkNumber", "==", "this", ".", "numberOfChunks", "-", "1", ";", "int", "start", "=", "this", ".", "chunkOffsets", "[", "chunkNumber", "]", ";", "int", "numberOfBytes", "=", "(", "isLastChunk", "?", "this", ".", "startOfCategoryTables", ":", "this", ".", "chunkOffsets", "[", "chunkNumber", "+", "1", "]", ")", "-", "start", ";", "if", "(", "numberOfBytes", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "this", ".", "streamBuffer", "=", "new", "byte", "[", "numberOfBytes", "]", ";", "this", ".", "bufferIndex", "=", "0", ";", "InputStream", "file", "=", "this", ".", "indexLocation", ".", "getInputStream", "(", ")", ";", "try", "{", "file", ".", "skip", "(", "start", ")", ";", "if", "(", "file", ".", "read", "(", "this", ".", "streamBuffer", ",", "0", ",", "numberOfBytes", ")", "!=", "numberOfBytes", ")", "throw", "new", "IOException", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "this", ".", "streamBuffer", "=", "null", ";", "throw", "ioe", ";", "}", "finally", "{", "file", ".", "close", "(", ")", ";", "}", "int", "numberOfNames", "=", "isLastChunk", "?", "this", ".", "sizeOfLastChunk", ":", "CHUNK_SIZE", ";", "chunk", "=", "new", "String", "[", "numberOfNames", "]", ";", "try", "{", "readChunk", "(", "chunk", ",", "null", ",", "0", ",", "numberOfNames", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "this", ".", "streamBuffer", "=", "null", ";", "throw", "ioe", ";", "}", "this", ".", "cachedChunks", "[", "chunkNumber", "]", "=", "chunk", ";", "}", "this", ".", "streamBuffer", "=", "null", ";", "return", "chunk", "[", "docNumber", "-", "(", "chunkNumber", "*", "CHUNK_SIZE", ")", "]", ";", "}", "synchronized", "int", "[", "]", "readDocumentNumbers", "(", "Object", "arrayOffset", ")", "throws", "IOException", "{", "if", "(", "arrayOffset", "instanceof", "int", "[", "]", ")", "return", "(", "int", "[", "]", ")", "arrayOffset", ";", "InputStream", "stream", "=", "this", ".", "indexLocation", ".", "getInputStream", "(", ")", ";", "try", "{", "int", "offset", "=", "(", "(", "Integer", ")", "arrayOffset", ")", ".", "intValue", "(", ")", ";", "stream", ".", "skip", "(", "offset", ")", ";", "this", ".", "streamBuffer", "=", "new", "byte", "[", "BUFFER_READ_SIZE", "]", ";", "this", ".", "bufferIndex", "=", "0", ";", "this", ".", "bufferEnd", "=", "stream", ".", "read", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "streamBuffer", ".", "length", ")", ";", "return", "readStreamDocumentArray", "(", "stream", ",", "readStreamInt", "(", "stream", ")", ")", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "this", ".", "streamBuffer", "=", "null", ";", "}", "}", "private", "void", "readHeaderInfo", "(", "InputStream", "stream", ")", "throws", "IOException", "{", "this", ".", "numberOfChunks", "=", "readStreamInt", "(", "stream", ")", ";", "this", ".", "sizeOfLastChunk", "=", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ";", "this", ".", "documentReferenceSize", "=", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ";", "this", ".", "separator", "=", "(", "char", ")", "(", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ")", ";", "long", "length", "=", "this", ".", "indexLocation", ".", "length", "(", ")", ";", "if", "(", "length", "!=", "-", "1", "&&", "this", ".", "numberOfChunks", ">", "length", ")", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "throw", "new", "IOException", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "}", "this", ".", "chunkOffsets", "=", "new", "int", "[", "this", ".", "numberOfChunks", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "numberOfChunks", ";", "i", "++", ")", "this", ".", "chunkOffsets", "[", "i", "]", "=", "readStreamInt", "(", "stream", ")", ";", "this", ".", "startOfCategoryTables", "=", "readStreamInt", "(", "stream", ")", ";", "int", "size", "=", "readStreamInt", "(", "stream", ")", ";", "this", ".", "categoryOffsets", "=", "new", "HashtableOfIntValues", "(", "size", ")", ";", "this", ".", "categoryEnds", "=", "new", "HashtableOfIntValues", "(", "size", ")", ";", "if", "(", "length", "!=", "-", "1", "&&", "size", ">", "length", ")", "{", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "throw", "new", "IOException", "(", "\"\"", "+", "this", ".", "indexLocation", ")", ";", "}", "char", "[", "]", "previousCategory", "=", "null", ";", "int", "offset", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "char", "[", "]", "categoryName", "=", "INTERNED_CATEGORY_NAMES", ".", "get", "(", "readStreamChars", "(", "stream", ")", ")", ";", "offset", "=", "readStreamInt", "(", "stream", ")", ";", "this", ".", "categoryOffsets", ".", "put", "(", "categoryName", ",", "offset", ")", ";", "if", "(", "previousCategory", "!=", "null", ")", "{", "this", ".", "categoryEnds", ".", "put", "(", "previousCategory", ",", "offset", ")", ";", "}", "previousCategory", "=", "categoryName", ";", "}", "if", "(", "previousCategory", "!=", "null", ")", "{", "this", ".", "categoryEnds", ".", "put", "(", "previousCategory", ",", "this", ".", "headerInfoOffset", ")", ";", "}", "this", ".", "categoryTables", "=", "new", "HashtableOfObject", "(", "3", ")", ";", "}", "synchronized", "void", "startQuery", "(", ")", "{", "this", ".", "cacheUserCount", "++", ";", "}", "synchronized", "void", "stopQuery", "(", ")", "{", "if", "(", "--", "this", ".", "cacheUserCount", "<", "0", ")", "{", "this", ".", "cacheUserCount", "=", "-", "1", ";", "this", ".", "cachedChunks", "=", "null", ";", "if", "(", "this", ".", "categoryTables", "!=", "null", ")", "{", "if", "(", "this", ".", "cachedCategoryName", "==", "null", ")", "{", "this", ".", "categoryTables", "=", "null", ";", "}", "else", "if", "(", "this", ".", "categoryTables", ".", "elementSize", ">", "1", ")", "{", "HashtableOfObject", "newTables", "=", "new", "HashtableOfObject", "(", "3", ")", ";", "newTables", ".", "put", "(", "this", ".", "cachedCategoryName", ",", "this", ".", "categoryTables", ".", "get", "(", "this", ".", "cachedCategoryName", ")", ")", ";", "this", ".", "categoryTables", "=", "newTables", ";", "}", "}", "}", "}", "private", "void", "readStreamBuffer", "(", "InputStream", "stream", ")", "throws", "IOException", "{", "if", "(", "this", ".", "bufferEnd", "<", "this", ".", "streamBuffer", ".", "length", ")", "{", "if", "(", "stream", ".", "available", "(", ")", "==", "0", ")", "return", ";", "}", "int", "bytesInBuffer", "=", "this", ".", "bufferEnd", "-", "this", ".", "bufferIndex", ";", "if", "(", "bytesInBuffer", ">", "0", ")", "System", ".", "arraycopy", "(", "this", ".", "streamBuffer", ",", "this", ".", "bufferIndex", ",", "this", ".", "streamBuffer", ",", "0", ",", "bytesInBuffer", ")", ";", "this", ".", "bufferEnd", "=", "bytesInBuffer", "+", "stream", ".", "read", "(", "this", ".", "streamBuffer", ",", "bytesInBuffer", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "private", "char", "[", "]", "readStreamChars", "(", "InputStream", "stream", ")", "throws", "IOException", "{", "if", "(", "stream", "!=", "null", "&&", "this", ".", "bufferIndex", "+", "2", ">=", "this", ".", "bufferEnd", ")", "readStreamBuffer", "(", "stream", ")", ";", "int", "length", "=", "(", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ")", "<<", "8", ";", "length", "+=", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ";", "char", "[", "]", "word", "=", "new", "char", "[", "length", "]", ";", "int", "i", "=", "0", ";", "while", "(", "i", "<", "length", ")", "{", "int", "charsInBuffer", "=", "i", "+", "(", "(", "this", ".", "bufferEnd", "-", "this", ".", "bufferIndex", ")", "/", "3", ")", ";", "if", "(", "charsInBuffer", ">", "length", "||", "stream", "==", "null", "||", "(", "this", ".", "bufferEnd", "!=", "this", ".", "streamBuffer", ".", "length", "&&", "stream", ".", "available", "(", ")", "==", "0", ")", ")", "charsInBuffer", "=", "length", ";", "while", "(", "i", "<", "charsInBuffer", ")", "{", "byte", "b", "=", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", ";", "switch", "(", "b", "&", "0xF0", ")", "{", "case", "0x00", ":", "case", "0x10", ":", "case", "0x20", ":", "case", "0x30", ":", "case", "0x40", ":", "case", "0x50", ":", "case", "0x60", ":", "case", "0x70", ":", "word", "[", "i", "++", "]", "=", "(", "char", ")", "b", ";", "break", ";", "case", "0xC0", ":", "case", "0xD0", ":", "char", "next", "=", "(", "char", ")", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", ";", "if", "(", "(", "next", "&", "0xC0", ")", "!=", "0x80", ")", "{", "throw", "new", "UTFDataFormatException", "(", ")", ";", "}", "char", "ch", "=", "(", "char", ")", "(", "(", "b", "&", "0x1F", ")", "<<", "6", ")", ";", "ch", "|=", "next", "&", "0x3F", ";", "word", "[", "i", "++", "]", "=", "ch", ";", "break", ";", "case", "0xE0", ":", "char", "first", "=", "(", "char", ")", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", ";", "char", "second", "=", "(", "char", ")", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", ";", "if", "(", "(", "first", "&", "second", "&", "0xC0", ")", "!=", "0x80", ")", "{", "throw", "new", "UTFDataFormatException", "(", ")", ";", "}", "ch", "=", "(", "char", ")", "(", "(", "b", "&", "0x0F", ")", "<<", "12", ")", ";", "ch", "|=", "(", "(", "first", "&", "0x3F", ")", "<<", "6", ")", ";", "ch", "|=", "second", "&", "0x3F", ";", "word", "[", "i", "++", "]", "=", "ch", ";", "break", ";", "default", ":", "throw", "new", "UTFDataFormatException", "(", ")", ";", "}", "}", "if", "(", "i", "<", "length", "&&", "stream", "!=", "null", ")", "readStreamBuffer", "(", "stream", ")", ";", "}", "return", "word", ";", "}", "private", "int", "[", "]", "readStreamDocumentArray", "(", "InputStream", "stream", ",", "int", "arraySize", ")", "throws", "IOException", "{", "int", "[", "]", "indexes", "=", "new", "int", "[", "arraySize", "]", ";", "if", "(", "arraySize", "==", "0", ")", "return", "indexes", ";", "int", "i", "=", "0", ";", "switch", "(", "this", ".", "documentReferenceSize", ")", "{", "case", "1", ":", "while", "(", "i", "<", "arraySize", ")", "{", "int", "bytesInBuffer", "=", "i", "+", "this", ".", "bufferEnd", "-", "this", ".", "bufferIndex", ";", "if", "(", "bytesInBuffer", ">", "arraySize", ")", "bytesInBuffer", "=", "arraySize", ";", "while", "(", "i", "<", "bytesInBuffer", ")", "{", "indexes", "[", "i", "++", "]", "=", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ";", "}", "if", "(", "i", "<", "arraySize", "&&", "stream", "!=", "null", ")", "readStreamBuffer", "(", "stream", ")", ";", "}", "break", ";", "case", "2", ":", "while", "(", "i", "<", "arraySize", ")", "{", "int", "shortsInBuffer", "=", "i", "+", "(", "(", "this", ".", "bufferEnd", "-", "this", ".", "bufferIndex", ")", "/", "2", ")", ";", "if", "(", "shortsInBuffer", ">", "arraySize", ")", "shortsInBuffer", "=", "arraySize", ";", "while", "(", "i", "<", "shortsInBuffer", ")", "{", "int", "val", "=", "(", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ")", "<<", "8", ";", "indexes", "[", "i", "++", "]", "=", "val", "+", "(", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ")", ";", "}", "if", "(", "i", "<", "arraySize", "&&", "stream", "!=", "null", ")", "readStreamBuffer", "(", "stream", ")", ";", "}", "break", ";", "default", ":", "while", "(", "i", "<", "arraySize", ")", "{", "indexes", "[", "i", "++", "]", "=", "readStreamInt", "(", "stream", ")", ";", "}", "break", ";", "}", "return", "indexes", ";", "}", "private", "int", "readStreamInt", "(", "InputStream", "stream", ")", "throws", "IOException", "{", "if", "(", "this", ".", "bufferIndex", "+", "4", ">=", "this", ".", "bufferEnd", ")", "{", "readStreamBuffer", "(", "stream", ")", ";", "}", "int", "val", "=", "(", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ")", "<<", "24", ";", "val", "+=", "(", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ")", "<<", "16", ";", "val", "+=", "(", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ")", "<<", "8", ";", "return", "val", "+", "(", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "&", "0xFF", ")", ";", "}", "private", "void", "writeAllDocumentNames", "(", "String", "[", "]", "sortedDocNames", ",", "FileOutputStream", "stream", ")", "throws", "IOException", "{", "if", "(", "sortedDocNames", ".", "length", "==", "0", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "this", ".", "streamBuffer", "=", "new", "byte", "[", "BUFFER_WRITE_SIZE", "]", ";", "this", ".", "bufferIndex", "=", "0", ";", "this", ".", "streamEnd", "=", "0", ";", "writeStreamChars", "(", "stream", ",", "SIGNATURE_CHARS", ")", ";", "this", ".", "headerInfoOffset", "=", "this", ".", "streamEnd", ";", "writeStreamInt", "(", "stream", ",", "-", "1", ")", ";", "int", "size", "=", "sortedDocNames", ".", "length", ";", "this", ".", "numberOfChunks", "=", "(", "size", "/", "CHUNK_SIZE", ")", "+", "1", ";", "this", ".", "sizeOfLastChunk", "=", "size", "%", "CHUNK_SIZE", ";", "if", "(", "this", ".", "sizeOfLastChunk", "==", "0", ")", "{", "this", ".", "numberOfChunks", "--", ";", "this", ".", "sizeOfLastChunk", "=", "CHUNK_SIZE", ";", "}", "this", ".", "documentReferenceSize", "=", "size", "<=", "0x7F", "?", "1", ":", "(", "size", "<=", "0x7FFF", "?", "2", ":", "4", ")", ";", "this", ".", "chunkOffsets", "=", "new", "int", "[", "this", ".", "numberOfChunks", "]", ";", "int", "lastIndex", "=", "this", ".", "numberOfChunks", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "numberOfChunks", ";", "i", "++", ")", "{", "this", ".", "chunkOffsets", "[", "i", "]", "=", "this", ".", "streamEnd", ";", "int", "chunkSize", "=", "i", "==", "lastIndex", "?", "this", ".", "sizeOfLastChunk", ":", "CHUNK_SIZE", ";", "int", "chunkIndex", "=", "i", "*", "CHUNK_SIZE", ";", "String", "current", "=", "sortedDocNames", "[", "chunkIndex", "]", ";", "writeStreamChars", "(", "stream", ",", "current", ".", "toCharArray", "(", ")", ")", ";", "for", "(", "int", "j", "=", "1", ";", "j", "<", "chunkSize", ";", "j", "++", ")", "{", "String", "next", "=", "sortedDocNames", "[", "chunkIndex", "+", "j", "]", ";", "int", "len1", "=", "current", ".", "length", "(", ")", ";", "int", "len2", "=", "next", ".", "length", "(", ")", ";", "int", "max", "=", "len1", "<", "len2", "?", "len1", ":", "len2", ";", "int", "start", "=", "0", ";", "while", "(", "current", ".", "charAt", "(", "start", ")", "==", "next", ".", "charAt", "(", "start", ")", ")", "{", "start", "++", ";", "if", "(", "max", "==", "start", ")", "break", ";", "}", "if", "(", "start", ">", "255", ")", "start", "=", "255", ";", "int", "end", "=", "0", ";", "while", "(", "current", ".", "charAt", "(", "--", "len1", ")", "==", "next", ".", "charAt", "(", "--", "len2", ")", ")", "{", "end", "++", ";", "if", "(", "len2", "==", "start", ")", "break", ";", "if", "(", "len1", "==", "0", ")", "break", ";", "}", "if", "(", "end", ">", "255", ")", "end", "=", "255", ";", "if", "(", "(", "this", ".", "bufferIndex", "+", "2", ")", ">=", "BUFFER_WRITE_SIZE", ")", "{", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "start", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "end", ";", "this", ".", "streamEnd", "+=", "2", ";", "int", "last", "=", "next", ".", "length", "(", ")", "-", "end", ";", "writeStreamChars", "(", "stream", ",", "(", "start", "<", "last", "?", "CharOperation", ".", "subarray", "(", "next", ".", "toCharArray", "(", ")", ",", "start", ",", "last", ")", ":", "CharOperation", ".", "NO_CHAR", ")", ")", ";", "current", "=", "next", ";", "}", "}", "this", ".", "startOfCategoryTables", "=", "this", ".", "streamEnd", "+", "1", ";", "}", "private", "void", "writeCategories", "(", "FileOutputStream", "stream", ")", "throws", "IOException", "{", "char", "[", "]", "[", "]", "categoryNames", "=", "this", ".", "categoryTables", ".", "keyTable", ";", "Object", "[", "]", "tables", "=", "this", ".", "categoryTables", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "categoryNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "categoryNames", "[", "i", "]", "!=", "null", ")", "writeCategoryTable", "(", "categoryNames", "[", "i", "]", ",", "(", "HashtableOfObject", ")", "tables", "[", "i", "]", ",", "stream", ")", ";", "this", ".", "categoryTables", "=", "null", ";", "}", "private", "void", "writeCategoryTable", "(", "char", "[", "]", "categoryName", ",", "HashtableOfObject", "wordsToDocs", ",", "FileOutputStream", "stream", ")", "throws", "IOException", "{", "int", "largeArraySize", "=", "256", ";", "Object", "[", "]", "values", "=", "wordsToDocs", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "values", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "Object", "o", "=", "values", "[", "i", "]", ";", "if", "(", "o", "!=", "null", ")", "{", "if", "(", "o", "instanceof", "IntList", ")", "o", "=", "values", "[", "i", "]", "=", "(", "(", "IntList", ")", "values", "[", "i", "]", ")", ".", "asArray", "(", ")", ";", "int", "[", "]", "documentNumbers", "=", "(", "int", "[", "]", ")", "o", ";", "if", "(", "documentNumbers", ".", "length", ">=", "largeArraySize", ")", "{", "values", "[", "i", "]", "=", "new", "Integer", "(", "this", ".", "streamEnd", ")", ";", "writeDocumentNumbers", "(", "documentNumbers", ",", "stream", ")", ";", "}", "}", "}", "this", ".", "categoryOffsets", ".", "put", "(", "categoryName", ",", "this", ".", "streamEnd", ")", ";", "this", ".", "categoryTables", ".", "put", "(", "categoryName", ",", "null", ")", ";", "writeStreamInt", "(", "stream", ",", "wordsToDocs", ".", "elementSize", ")", ";", "char", "[", "]", "[", "]", "words", "=", "wordsToDocs", ".", "keyTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "words", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "Object", "o", "=", "values", "[", "i", "]", ";", "if", "(", "o", "!=", "null", ")", "{", "writeStreamChars", "(", "stream", ",", "words", "[", "i", "]", ")", ";", "if", "(", "o", "instanceof", "int", "[", "]", ")", "{", "int", "[", "]", "documentNumbers", "=", "(", "int", "[", "]", ")", "o", ";", "if", "(", "documentNumbers", ".", "length", "==", "1", ")", "writeStreamInt", "(", "stream", ",", "-", "documentNumbers", "[", "0", "]", ")", ";", "else", "writeDocumentNumbers", "(", "documentNumbers", ",", "stream", ")", ";", "}", "else", "{", "writeStreamInt", "(", "stream", ",", "largeArraySize", ")", ";", "writeStreamInt", "(", "stream", ",", "(", "(", "Integer", ")", "o", ")", ".", "intValue", "(", ")", ")", ";", "}", "}", "}", "}", "private", "void", "writeDocumentNumbers", "(", "int", "[", "]", "documentNumbers", ",", "FileOutputStream", "stream", ")", "throws", "IOException", "{", "int", "length", "=", "documentNumbers", ".", "length", ";", "writeStreamInt", "(", "stream", ",", "length", ")", ";", "Util", ".", "sort", "(", "documentNumbers", ")", ";", "int", "start", "=", "0", ";", "switch", "(", "this", ".", "documentReferenceSize", ")", "{", "case", "1", ":", "while", "(", "(", "this", ".", "bufferIndex", "+", "length", "-", "start", ")", ">=", "BUFFER_WRITE_SIZE", ")", "{", "int", "bytesLeft", "=", "BUFFER_WRITE_SIZE", "-", "this", ".", "bufferIndex", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bytesLeft", ";", "i", "++", ")", "{", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "documentNumbers", "[", "start", "++", "]", ";", "}", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "while", "(", "start", "<", "length", ")", "{", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "documentNumbers", "[", "start", "++", "]", ";", "}", "this", ".", "streamEnd", "+=", "length", ";", "break", ";", "case", "2", ":", "while", "(", "(", "this", ".", "bufferIndex", "+", "(", "(", "length", "-", "start", ")", "*", "2", ")", ")", ">=", "BUFFER_WRITE_SIZE", ")", "{", "int", "shortsLeft", "=", "(", "BUFFER_WRITE_SIZE", "-", "this", ".", "bufferIndex", ")", "/", "2", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "shortsLeft", ";", "i", "++", ")", "{", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "(", "documentNumbers", "[", "start", "]", ">>", "8", ")", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "documentNumbers", "[", "start", "++", "]", ";", "}", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "while", "(", "start", "<", "length", ")", "{", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "(", "documentNumbers", "[", "start", "]", ">>", "8", ")", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "documentNumbers", "[", "start", "++", "]", ";", "}", "this", ".", "streamEnd", "+=", "length", "*", "2", ";", "break", ";", "default", ":", "while", "(", "start", "<", "length", ")", "{", "writeStreamInt", "(", "stream", ",", "documentNumbers", "[", "start", "++", "]", ")", ";", "}", "break", ";", "}", "}", "private", "void", "writeHeaderInfo", "(", "FileOutputStream", "stream", ")", "throws", "IOException", "{", "writeStreamInt", "(", "stream", ",", "this", ".", "numberOfChunks", ")", ";", "if", "(", "(", "this", ".", "bufferIndex", "+", "3", ")", ">=", "BUFFER_WRITE_SIZE", ")", "{", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "this", ".", "sizeOfLastChunk", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "this", ".", "documentReferenceSize", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "this", ".", "separator", ";", "this", ".", "streamEnd", "+=", "3", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "numberOfChunks", ";", "i", "++", ")", "{", "writeStreamInt", "(", "stream", ",", "this", ".", "chunkOffsets", "[", "i", "]", ")", ";", "}", "writeStreamInt", "(", "stream", ",", "this", ".", "startOfCategoryTables", ")", ";", "writeStreamInt", "(", "stream", ",", "this", ".", "categoryOffsets", ".", "elementSize", ")", ";", "char", "[", "]", "[", "]", "categoryNames", "=", "this", ".", "categoryOffsets", ".", "keyTable", ";", "int", "[", "]", "offsets", "=", "this", ".", "categoryOffsets", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "categoryNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "categoryNames", "[", "i", "]", "!=", "null", ")", "{", "writeStreamChars", "(", "stream", ",", "categoryNames", "[", "i", "]", ")", ";", "writeStreamInt", "(", "stream", ",", "offsets", "[", "i", "]", ")", ";", "}", "}", "if", "(", "this", ".", "bufferIndex", ">", "0", ")", "{", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "}", "private", "void", "writeOffsetToHeader", "(", "int", "offsetToHeader", ")", "throws", "IOException", "{", "if", "(", "offsetToHeader", ">", "0", ")", "{", "RandomAccessFile", "file", "=", "new", "RandomAccessFile", "(", "this", ".", "indexLocation", ".", "getIndexFile", "(", ")", ",", "\"rw\"", ")", ";", "try", "{", "file", ".", "seek", "(", "this", ".", "headerInfoOffset", ")", ";", "file", ".", "writeInt", "(", "offsetToHeader", ")", ";", "this", ".", "headerInfoOffset", "=", "offsetToHeader", ";", "}", "finally", "{", "file", ".", "close", "(", ")", ";", "}", "}", "}", "private", "void", "writeStreamChars", "(", "FileOutputStream", "stream", ",", "char", "[", "]", "array", ")", "throws", "IOException", "{", "if", "(", "(", "this", ".", "bufferIndex", "+", "2", ")", ">=", "BUFFER_WRITE_SIZE", ")", "{", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "int", "length", "=", "array", ".", "length", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "(", "(", "length", ">>>", "8", ")", "&", "0xFF", ")", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "(", "length", "&", "0xFF", ")", ";", "this", ".", "streamEnd", "+=", "2", ";", "int", "totalBytesNeeded", "=", "length", "*", "3", ";", "if", "(", "totalBytesNeeded", "<=", "BUFFER_WRITE_SIZE", ")", "{", "if", "(", "this", ".", "bufferIndex", "+", "totalBytesNeeded", ">", "BUFFER_WRITE_SIZE", ")", "{", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "writeStreamChars", "(", "stream", ",", "array", ",", "0", ",", "length", ")", ";", "}", "else", "{", "int", "charsPerWrite", "=", "BUFFER_WRITE_SIZE", "/", "3", ";", "int", "start", "=", "0", ";", "while", "(", "start", "<", "length", ")", "{", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "int", "charsLeftToWrite", "=", "length", "-", "start", ";", "int", "end", "=", "start", "+", "(", "charsPerWrite", "<", "charsLeftToWrite", "?", "charsPerWrite", ":", "charsLeftToWrite", ")", ";", "writeStreamChars", "(", "stream", ",", "array", ",", "start", ",", "end", ")", ";", "start", "=", "end", ";", "}", "}", "}", "private", "void", "writeStreamChars", "(", "FileOutputStream", "stream", ",", "char", "[", "]", "array", ",", "int", "start", ",", "int", "end", ")", "throws", "IOException", "{", "int", "oldIndex", "=", "this", ".", "bufferIndex", ";", "while", "(", "start", "<", "end", ")", "{", "int", "ch", "=", "array", "[", "start", "++", "]", ";", "if", "(", "(", "ch", "&", "0x007F", ")", "==", "ch", ")", "{", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "ch", ";", "}", "else", "if", "(", "(", "ch", "&", "0x07FF", ")", "==", "ch", ")", "{", "byte", "b", "=", "(", "byte", ")", "(", "ch", ">>", "6", ")", ";", "b", "&=", "0x1F", ";", "b", "|=", "0xC0", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "b", ";", "b", "=", "(", "byte", ")", "(", "ch", "&", "0x3F", ")", ";", "b", "|=", "0x80", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "b", ";", "}", "else", "{", "byte", "b", "=", "(", "byte", ")", "(", "ch", ">>", "12", ")", ";", "b", "&=", "0x0F", ";", "b", "|=", "0xE0", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "b", ";", "b", "=", "(", "byte", ")", "(", "ch", ">>", "6", ")", ";", "b", "&=", "0x3F", ";", "b", "|=", "0x80", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "b", ";", "b", "=", "(", "byte", ")", "(", "ch", "&", "0x3F", ")", ";", "b", "|=", "0x80", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "b", ";", "}", "}", "this", ".", "streamEnd", "+=", "this", ".", "bufferIndex", "-", "oldIndex", ";", "}", "private", "void", "writeStreamInt", "(", "FileOutputStream", "stream", ",", "int", "val", ")", "throws", "IOException", "{", "if", "(", "(", "this", ".", "bufferIndex", "+", "4", ")", ">=", "BUFFER_WRITE_SIZE", ")", "{", "stream", ".", "write", "(", "this", ".", "streamBuffer", ",", "0", ",", "this", ".", "bufferIndex", ")", ";", "this", ".", "bufferIndex", "=", "0", ";", "}", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "(", "val", ">>", "24", ")", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "(", "val", ">>", "16", ")", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "(", "val", ">>", "8", ")", ";", "this", ".", "streamBuffer", "[", "this", ".", "bufferIndex", "++", "]", "=", "(", "byte", ")", "val", ";", "this", ".", "streamEnd", "+=", "4", ";", "}", "}", "</s>" ]
2,504
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "public", "class", "FileIndexLocation", "extends", "IndexLocation", "{", "File", "indexFile", ";", "public", "FileIndexLocation", "(", "File", "file", ")", "{", "super", "(", "file", ")", ";", "this", ".", "indexFile", "=", "file", ";", "}", "public", "FileIndexLocation", "(", "URL", "url", ",", "File", "file", ")", "{", "super", "(", "url", ")", ";", "this", ".", "indexFile", "=", "file", ";", "}", "public", "FileIndexLocation", "(", "File", "file", ",", "boolean", "participantIndex", ")", "{", "this", "(", "file", ")", ";", "this", ".", "participantIndex", "=", "true", ";", "}", "public", "boolean", "createNewFile", "(", ")", "throws", "IOException", "{", "return", "this", ".", "indexFile", ".", "createNewFile", "(", ")", ";", "}", "public", "boolean", "delete", "(", ")", "{", "return", "this", ".", "indexFile", ".", "delete", "(", ")", ";", "}", "public", "boolean", "equals", "(", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "FileIndexLocation", ")", ")", "return", "false", ";", "return", "this", ".", "indexFile", ".", "equals", "(", "(", "(", "FileIndexLocation", ")", "other", ")", ".", "indexFile", ")", ";", "}", "public", "boolean", "exists", "(", ")", "{", "return", "this", ".", "indexFile", ".", "exists", "(", ")", ";", "}", "public", "String", "fileName", "(", ")", "{", "return", "this", ".", "indexFile", ".", "getName", "(", ")", ";", "}", "public", "File", "getIndexFile", "(", ")", "{", "return", "this", ".", "indexFile", ";", "}", "InputStream", "getInputStream", "(", ")", "throws", "IOException", "{", "return", "new", "FileInputStream", "(", "this", ".", "indexFile", ")", ";", "}", "public", "String", "getCanonicalFilePath", "(", ")", "{", "try", "{", "return", "this", ".", "indexFile", ".", "getCanonicalPath", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "return", "null", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "this", ".", "indexFile", ".", "hashCode", "(", ")", ";", "}", "public", "long", "lastModified", "(", ")", "{", "return", "this", ".", "indexFile", ".", "lastModified", "(", ")", ";", "}", "public", "long", "length", "(", ")", "{", "return", "this", ".", "indexFile", ".", "length", "(", ")", ";", "}", "public", "boolean", "startsWith", "(", "IPath", "path", ")", "{", "try", "{", "return", "path", ".", "isPrefixOf", "(", "new", "Path", "(", "this", ".", "indexFile", ".", "getCanonicalPath", "(", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "false", ";", "}", "}", "}", "</s>" ]
2,505
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "public", "class", "EntryResult", "{", "private", "char", "[", "]", "word", ";", "private", "Object", "[", "]", "documentTables", ";", "private", "SimpleSet", "documentNames", ";", "public", "EntryResult", "(", "char", "[", "]", "word", ",", "Object", "table", ")", "{", "this", ".", "word", "=", "word", ";", "if", "(", "table", "!=", "null", ")", "this", ".", "documentTables", "=", "new", "Object", "[", "]", "{", "table", "}", ";", "}", "public", "void", "addDocumentName", "(", "String", "documentName", ")", "{", "if", "(", "this", ".", "documentNames", "==", "null", ")", "this", ".", "documentNames", "=", "new", "SimpleSet", "(", "3", ")", ";", "this", ".", "documentNames", ".", "add", "(", "documentName", ")", ";", "}", "public", "void", "addDocumentTable", "(", "Object", "table", ")", "{", "if", "(", "this", ".", "documentTables", "!=", "null", ")", "{", "int", "length", "=", "this", ".", "documentTables", ".", "length", ";", "System", ".", "arraycopy", "(", "this", ".", "documentTables", ",", "0", ",", "this", ".", "documentTables", "=", "new", "Object", "[", "length", "+", "1", "]", ",", "0", ",", "length", ")", ";", "this", ".", "documentTables", "[", "length", "]", "=", "table", ";", "}", "else", "{", "this", ".", "documentTables", "=", "new", "Object", "[", "]", "{", "table", "}", ";", "}", "}", "public", "char", "[", "]", "getWord", "(", ")", "{", "return", "this", ".", "word", ";", "}", "public", "String", "[", "]", "getDocumentNames", "(", "Index", "index", ")", "throws", "java", ".", "io", ".", "IOException", "{", "if", "(", "this", ".", "documentTables", "!=", "null", ")", "{", "int", "length", "=", "this", ".", "documentTables", ".", "length", ";", "if", "(", "length", "==", "1", "&&", "this", ".", "documentNames", "==", "null", ")", "{", "Object", "offset", "=", "this", ".", "documentTables", "[", "0", "]", ";", "int", "[", "]", "numbers", "=", "index", ".", "diskIndex", ".", "readDocumentNumbers", "(", "offset", ")", ";", "String", "[", "]", "names", "=", "new", "String", "[", "numbers", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "numbers", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "names", "[", "i", "]", "=", "index", ".", "diskIndex", ".", "readDocumentName", "(", "numbers", "[", "i", "]", ")", ";", "return", "names", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Object", "offset", "=", "this", ".", "documentTables", "[", "i", "]", ";", "int", "[", "]", "numbers", "=", "index", ".", "diskIndex", ".", "readDocumentNumbers", "(", "offset", ")", ";", "for", "(", "int", "j", "=", "0", ",", "k", "=", "numbers", ".", "length", ";", "j", "<", "k", ";", "j", "++", ")", "addDocumentName", "(", "index", ".", "diskIndex", ".", "readDocumentName", "(", "numbers", "[", "j", "]", ")", ")", ";", "}", "}", "if", "(", "this", ".", "documentNames", "==", "null", ")", "return", "CharOperation", ".", "NO_STRINGS", ";", "String", "[", "]", "names", "=", "new", "String", "[", "this", ".", "documentNames", ".", "elementSize", "]", ";", "int", "count", "=", "0", ";", "Object", "[", "]", "values", "=", "this", ".", "documentNames", ".", "values", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "values", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "values", "[", "i", "]", "!=", "null", ")", "names", "[", "count", "++", "]", "=", "(", "String", ")", "values", "[", "i", "]", ";", "return", "names", ";", "}", "public", "boolean", "isEmpty", "(", ")", "{", "return", "this", ".", "documentTables", "==", "null", "&&", "this", ".", "documentNames", "==", "null", ";", "}", "}", "</s>" ]
2,506
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "net", ".", "JarURLConnection", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "java", ".", "util", ".", "jar", ".", "JarEntry", ";", "import", "java", ".", "util", ".", "jar", ".", "JarFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "public", "class", "JarIndexLocation", "extends", "IndexLocation", "{", "private", "JarFile", "jarFile", "=", "null", ";", "private", "JarEntry", "jarEntry", "=", "null", ";", "private", "URL", "localUrl", ";", "public", "JarIndexLocation", "(", "URL", "url", ",", "URL", "localUrl2", ")", "{", "super", "(", "url", ")", ";", "this", ".", "localUrl", "=", "localUrl2", ";", "}", "public", "boolean", "createNewFile", "(", ")", "throws", "IOException", "{", "return", "false", ";", "}", "public", "void", "close", "(", ")", "{", "if", "(", "this", ".", "jarFile", "!=", "null", ")", "{", "try", "{", "this", ".", "jarFile", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "this", ".", "jarFile", "=", "null", ";", "}", "}", "public", "boolean", "delete", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "equals", "(", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "JarIndexLocation", ")", ")", "return", "false", ";", "return", "this", ".", "localUrl", ".", "equals", "(", "(", "(", "JarIndexLocation", ")", "other", ")", ".", "localUrl", ")", ";", "}", "public", "boolean", "exists", "(", ")", "{", "try", "{", "if", "(", "this", ".", "jarFile", "==", "null", ")", "{", "JarURLConnection", "connection", "=", "(", "JarURLConnection", ")", "this", ".", "localUrl", ".", "openConnection", "(", ")", ";", "JarFile", "file", "=", "connection", ".", "getJarFile", "(", ")", ";", "if", "(", "file", "==", "null", ")", "return", "false", ";", "file", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "public", "String", "fileName", "(", ")", "{", "return", "null", ";", "}", "public", "File", "getIndexFile", "(", ")", "{", "return", "null", ";", "}", "InputStream", "getInputStream", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "jarFile", "==", "null", ")", "{", "JarURLConnection", "connection", "=", "(", "JarURLConnection", ")", "this", ".", "localUrl", ".", "openConnection", "(", ")", ";", "this", ".", "jarFile", "=", "connection", ".", "getJarFile", "(", ")", ";", "this", ".", "jarEntry", "=", "connection", ".", "getJarEntry", "(", ")", ";", "}", "if", "(", "this", ".", "jarFile", "==", "null", "||", "this", ".", "jarEntry", "==", "null", ")", "return", "null", ";", "return", "this", ".", "jarFile", ".", "getInputStream", "(", "this", ".", "jarEntry", ")", ";", "}", "public", "String", "getCanonicalFilePath", "(", ")", "{", "return", "null", ";", "}", "public", "long", "lastModified", "(", ")", "{", "return", "-", "1", ";", "}", "public", "long", "length", "(", ")", "{", "return", "-", "1", ";", "}", "public", "boolean", "startsWith", "(", "IPath", "path", ")", "{", "return", "(", "path", ".", "isPrefixOf", "(", "new", "Path", "(", "this", ".", "localUrl", ".", "getPath", "(", ")", ")", ")", ")", ";", "}", "}", "</s>" ]
2,507
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "net", ".", "MalformedURLException", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "FileLocator", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "public", "abstract", "class", "IndexLocation", "{", "public", "static", "IndexLocation", "createIndexLocation", "(", "URL", "url", ")", "{", "URL", "localUrl", ";", "try", "{", "localUrl", "=", "FileLocator", ".", "resolve", "(", "url", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "if", "(", "localUrl", ".", "getProtocol", "(", ")", ".", "equals", "(", "\"file\"", ")", ")", "{", "return", "new", "FileIndexLocation", "(", "url", ",", "new", "File", "(", "localUrl", ".", "getPath", "(", ")", ")", ")", ";", "}", "return", "new", "JarIndexLocation", "(", "url", ",", "localUrl", ")", ";", "}", "private", "final", "URL", "url", ";", "protected", "boolean", "participantIndex", ";", "protected", "IndexLocation", "(", "File", "file", ")", "{", "URL", "tempUrl", "=", "null", ";", "try", "{", "tempUrl", "=", "file", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "}", "this", ".", "url", "=", "tempUrl", ";", "}", "public", "IndexLocation", "(", "URL", "url", ")", "{", "this", ".", "url", "=", "url", ";", "}", "public", "void", "close", "(", ")", "{", "}", "public", "abstract", "boolean", "createNewFile", "(", ")", "throws", "IOException", ";", "public", "abstract", "boolean", "delete", "(", ")", ";", "public", "abstract", "boolean", "exists", "(", ")", ";", "public", "abstract", "String", "fileName", "(", ")", ";", "public", "abstract", "String", "getCanonicalFilePath", "(", ")", ";", "public", "abstract", "File", "getIndexFile", "(", ")", ";", "abstract", "InputStream", "getInputStream", "(", ")", "throws", "IOException", ";", "public", "URL", "getUrl", "(", ")", "{", "return", "this", ".", "url", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "this", ".", "url", ".", "hashCode", "(", ")", ";", "}", "public", "boolean", "isParticipantIndex", "(", ")", "{", "return", "this", ".", "participantIndex", ";", "}", "public", "abstract", "long", "lastModified", "(", ")", ";", "public", "abstract", "long", "length", "(", ")", ";", "public", "abstract", "boolean", "startsWith", "(", "IPath", "path", ")", ";", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "url", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,508
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "HashtableOfObject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "public", "class", "MemoryIndex", "{", "public", "int", "NUM_CHANGES", "=", "100", ";", "SimpleLookupTable", "docsToReferences", ";", "SimpleWordSet", "allWords", ";", "String", "lastDocumentName", ";", "HashtableOfObject", "lastReferenceTable", ";", "MemoryIndex", "(", ")", "{", "this", ".", "docsToReferences", "=", "new", "SimpleLookupTable", "(", "7", ")", ";", "this", ".", "allWords", "=", "new", "SimpleWordSet", "(", "7", ")", ";", "}", "void", "addDocumentNames", "(", "String", "substring", ",", "SimpleSet", "results", ")", "{", "Object", "[", "]", "paths", "=", "this", ".", "docsToReferences", ".", "keyTable", ";", "Object", "[", "]", "referenceTables", "=", "this", ".", "docsToReferences", ".", "valueTable", ";", "if", "(", "substring", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "referenceTables", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "referenceTables", "[", "i", "]", "!=", "null", ")", "results", ".", "add", "(", "paths", "[", "i", "]", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "referenceTables", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "referenceTables", "[", "i", "]", "!=", "null", "&&", "(", "(", "String", ")", "paths", "[", "i", "]", ")", ".", "startsWith", "(", "substring", ",", "0", ")", ")", "results", ".", "add", "(", "paths", "[", "i", "]", ")", ";", "}", "}", "void", "addIndexEntry", "(", "char", "[", "]", "category", ",", "char", "[", "]", "key", ",", "String", "documentName", ")", "{", "HashtableOfObject", "referenceTable", ";", "if", "(", "documentName", ".", "equals", "(", "this", ".", "lastDocumentName", ")", ")", "referenceTable", "=", "this", ".", "lastReferenceTable", ";", "else", "{", "referenceTable", "=", "(", "HashtableOfObject", ")", "this", ".", "docsToReferences", ".", "get", "(", "documentName", ")", ";", "if", "(", "referenceTable", "==", "null", ")", "this", ".", "docsToReferences", ".", "put", "(", "documentName", ",", "referenceTable", "=", "new", "HashtableOfObject", "(", "3", ")", ")", ";", "this", ".", "lastDocumentName", "=", "documentName", ";", "this", ".", "lastReferenceTable", "=", "referenceTable", ";", "}", "SimpleWordSet", "existingWords", "=", "(", "SimpleWordSet", ")", "referenceTable", ".", "get", "(", "category", ")", ";", "if", "(", "existingWords", "==", "null", ")", "referenceTable", ".", "put", "(", "category", ",", "existingWords", "=", "new", "SimpleWordSet", "(", "1", ")", ")", ";", "existingWords", ".", "add", "(", "this", ".", "allWords", ".", "add", "(", "key", ")", ")", ";", "}", "HashtableOfObject", "addQueryResults", "(", "char", "[", "]", "[", "]", "categories", ",", "char", "[", "]", "key", ",", "int", "matchRule", ",", "HashtableOfObject", "results", ")", "{", "Object", "[", "]", "paths", "=", "this", ".", "docsToReferences", ".", "keyTable", ";", "Object", "[", "]", "referenceTables", "=", "this", ".", "docsToReferences", ".", "valueTable", ";", "if", "(", "matchRule", "==", "(", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ")", "&&", "key", "!=", "null", ")", "{", "nextPath", ":", "for", "(", "int", "i", "=", "0", ",", "l", "=", "referenceTables", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "HashtableOfObject", "categoryToWords", "=", "(", "HashtableOfObject", ")", "referenceTables", "[", "i", "]", ";", "if", "(", "categoryToWords", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ",", "m", "=", "categories", ".", "length", ";", "j", "<", "m", ";", "j", "++", ")", "{", "SimpleWordSet", "wordSet", "=", "(", "SimpleWordSet", ")", "categoryToWords", ".", "get", "(", "categories", "[", "j", "]", ")", ";", "if", "(", "wordSet", "!=", "null", "&&", "wordSet", ".", "includes", "(", "key", ")", ")", "{", "if", "(", "results", "==", "null", ")", "results", "=", "new", "HashtableOfObject", "(", "13", ")", ";", "EntryResult", "result", "=", "(", "EntryResult", ")", "results", ".", "get", "(", "key", ")", ";", "if", "(", "result", "==", "null", ")", "results", ".", "put", "(", "key", ",", "result", "=", "new", "EntryResult", "(", "key", ",", "null", ")", ")", ";", "result", ".", "addDocumentName", "(", "(", "String", ")", "paths", "[", "i", "]", ")", ";", "continue", "nextPath", ";", "}", "}", "}", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "referenceTables", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "HashtableOfObject", "categoryToWords", "=", "(", "HashtableOfObject", ")", "referenceTables", "[", "i", "]", ";", "if", "(", "categoryToWords", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ",", "m", "=", "categories", ".", "length", ";", "j", "<", "m", ";", "j", "++", ")", "{", "SimpleWordSet", "wordSet", "=", "(", "SimpleWordSet", ")", "categoryToWords", ".", "get", "(", "categories", "[", "j", "]", ")", ";", "if", "(", "wordSet", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "words", "=", "wordSet", ".", "words", ";", "for", "(", "int", "k", "=", "0", ",", "n", "=", "words", ".", "length", ";", "k", "<", "n", ";", "k", "++", ")", "{", "char", "[", "]", "word", "=", "words", "[", "k", "]", ";", "if", "(", "word", "!=", "null", "&&", "Index", ".", "isMatch", "(", "key", ",", "word", ",", "matchRule", ")", ")", "{", "if", "(", "results", "==", "null", ")", "results", "=", "new", "HashtableOfObject", "(", "13", ")", ";", "EntryResult", "result", "=", "(", "EntryResult", ")", "results", ".", "get", "(", "word", ")", ";", "if", "(", "result", "==", "null", ")", "results", ".", "put", "(", "word", ",", "result", "=", "new", "EntryResult", "(", "word", ",", "null", ")", ")", ";", "result", ".", "addDocumentName", "(", "(", "String", ")", "paths", "[", "i", "]", ")", ";", "}", "}", "}", "}", "}", "}", "}", "return", "results", ";", "}", "boolean", "hasChanged", "(", ")", "{", "return", "this", ".", "docsToReferences", ".", "elementSize", ">", "0", ";", "}", "void", "remove", "(", "String", "documentName", ")", "{", "if", "(", "documentName", ".", "equals", "(", "this", ".", "lastDocumentName", ")", ")", "{", "this", ".", "lastDocumentName", "=", "null", ";", "this", ".", "lastReferenceTable", "=", "null", ";", "}", "this", ".", "docsToReferences", ".", "put", "(", "documentName", ",", "null", ")", ";", "}", "boolean", "shouldMerge", "(", ")", "{", "return", "this", ".", "docsToReferences", ".", "elementSize", ">=", "this", ".", "NUM_CHANGES", ";", "}", "}", "</s>" ]
2,509
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAccessRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClassFile", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "TypeNameMatchRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "TypeNameRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRestriction", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "Openable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HandleFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HashtableOfArrayToObject", ";", "public", "class", "TypeNameMatchRequestorWrapper", "implements", "IRestrictedAccessTypeRequestor", "{", "TypeNameMatchRequestor", "requestor", ";", "private", "IJavaSearchScope", "scope", ";", "private", "HandleFactory", "handleFactory", ";", "private", "String", "lastPkgFragmentRootPath", ";", "private", "IPackageFragmentRoot", "lastPkgFragmentRoot", ";", "private", "HashtableOfArrayToObject", "packageHandles", ";", "private", "Object", "lastProject", ";", "private", "long", "complianceValue", ";", "public", "TypeNameMatchRequestorWrapper", "(", "TypeNameMatchRequestor", "requestor", ",", "IJavaSearchScope", "scope", ")", "{", "this", ".", "requestor", "=", "requestor", ";", "this", ".", "scope", "=", "scope", ";", "if", "(", "!", "(", "scope", "instanceof", "AbstractJavaSearchScope", ")", ")", "{", "this", ".", "handleFactory", "=", "new", "HandleFactory", "(", ")", ";", "}", "}", "public", "void", "acceptType", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ",", "AccessRestriction", "access", ")", "{", "try", "{", "IType", "type", "=", "null", ";", "if", "(", "this", ".", "handleFactory", "!=", "null", ")", "{", "Openable", "openable", "=", "this", ".", "handleFactory", ".", "createOpenable", "(", "path", ",", "this", ".", "scope", ")", ";", "if", "(", "openable", "==", "null", ")", "return", ";", "switch", "(", "openable", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "ICompilationUnit", "cu", "=", "(", "ICompilationUnit", ")", "openable", ";", "if", "(", "enclosingTypeNames", "!=", "null", "&&", "enclosingTypeNames", ".", "length", ">", "0", ")", "{", "type", "=", "cu", ".", "getType", "(", "new", "String", "(", "enclosingTypeNames", "[", "0", "]", ")", ")", ";", "for", "(", "int", "j", "=", "1", ",", "l", "=", "enclosingTypeNames", ".", "length", ";", "j", "<", "l", ";", "j", "++", ")", "{", "type", "=", "type", ".", "getType", "(", "new", "String", "(", "enclosingTypeNames", "[", "j", "]", ")", ")", ";", "}", "type", "=", "type", ".", "getType", "(", "new", "String", "(", "simpleTypeName", ")", ")", ";", "}", "else", "{", "type", "=", "cu", ".", "getType", "(", "new", "String", "(", "simpleTypeName", ")", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "CLASS_FILE", ":", "type", "=", "(", "(", "IClassFile", ")", "openable", ")", ".", "getType", "(", ")", ";", "break", ";", "}", "}", "else", "{", "int", "separatorIndex", "=", "path", ".", "indexOf", "(", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", ")", ";", "type", "=", "separatorIndex", "==", "-", "1", "?", "createTypeFromPath", "(", "path", ",", "new", "String", "(", "simpleTypeName", ")", ",", "enclosingTypeNames", ")", ":", "createTypeFromJar", "(", "path", ",", "separatorIndex", ")", ";", "}", "if", "(", "type", "!=", "null", ")", "{", "if", "(", "!", "(", "this", ".", "scope", "instanceof", "HierarchyScope", ")", "||", "(", "(", "HierarchyScope", ")", "this", ".", "scope", ")", ".", "enclosesFineGrained", "(", "type", ")", ")", "{", "final", "JavaSearchTypeNameMatch", "match", "=", "new", "JavaSearchTypeNameMatch", "(", "type", ",", "modifiers", ")", ";", "if", "(", "access", "!=", "null", ")", "{", "switch", "(", "access", ".", "getProblemId", "(", ")", ")", "{", "case", "IProblem", ".", "ForbiddenReference", ":", "match", ".", "setAccessibility", "(", "IAccessRule", ".", "K_NON_ACCESSIBLE", ")", ";", "break", ";", "case", "IProblem", ".", "DiscouragedReference", ":", "match", ".", "setAccessibility", "(", "IAccessRule", ".", "K_DISCOURAGED", ")", ";", "break", ";", "}", "}", "this", ".", "requestor", ".", "acceptTypeNameMatch", "(", "match", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "private", "IType", "createTypeFromJar", "(", "String", "resourcePath", ",", "int", "separatorIndex", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "lastPkgFragmentRootPath", "==", "null", "||", "this", ".", "lastPkgFragmentRootPath", ".", "length", "(", ")", ">", "resourcePath", ".", "length", "(", ")", "||", "!", "resourcePath", ".", "startsWith", "(", "this", ".", "lastPkgFragmentRootPath", ")", ")", "{", "String", "jarPath", "=", "resourcePath", ".", "substring", "(", "0", ",", "separatorIndex", ")", ";", "IPackageFragmentRoot", "root", "=", "(", "(", "AbstractJavaSearchScope", ")", "this", ".", "scope", ")", ".", "packageFragmentRoot", "(", "resourcePath", ",", "separatorIndex", ",", "jarPath", ")", ";", "if", "(", "root", "==", "null", ")", "return", "null", ";", "this", ".", "lastPkgFragmentRootPath", "=", "jarPath", ";", "this", ".", "lastPkgFragmentRoot", "=", "root", ";", "this", ".", "packageHandles", "=", "new", "HashtableOfArrayToObject", "(", "5", ")", ";", "}", "String", "classFilePath", "=", "resourcePath", ".", "substring", "(", "separatorIndex", "+", "1", ")", ";", "String", "[", "]", "simpleNames", "=", "new", "Path", "(", "classFilePath", ")", ".", "segments", "(", ")", ";", "String", "[", "]", "pkgName", ";", "int", "length", "=", "simpleNames", ".", "length", "-", "1", ";", "if", "(", "length", ">", "0", ")", "{", "pkgName", "=", "new", "String", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "simpleNames", ",", "0", ",", "pkgName", ",", "0", ",", "length", ")", ";", "}", "else", "{", "pkgName", "=", "CharOperation", ".", "NO_STRINGS", ";", "}", "IPackageFragment", "pkgFragment", "=", "(", "IPackageFragment", ")", "this", ".", "packageHandles", ".", "get", "(", "pkgName", ")", ";", "if", "(", "pkgFragment", "==", "null", ")", "{", "pkgFragment", "=", "(", "(", "PackageFragmentRoot", ")", "this", ".", "lastPkgFragmentRoot", ")", ".", "getPackageFragment", "(", "pkgName", ")", ";", "if", "(", "length", "==", "5", "&&", "pkgName", "[", "4", "]", ".", "equals", "(", "\"enum\"", ")", ")", "{", "IJavaProject", "proj", "=", "(", "IJavaProject", ")", "pkgFragment", ".", "getAncestor", "(", "IJavaElement", ".", "JAVA_PROJECT", ")", ";", "if", "(", "!", "proj", ".", "equals", "(", "this", ".", "lastProject", ")", ")", "{", "String", "complianceStr", "=", "proj", ".", "getOption", "(", "CompilerOptions", ".", "OPTION_Source", ",", "true", ")", ";", "this", ".", "complianceValue", "=", "CompilerOptions", ".", "versionToJdkLevel", "(", "complianceStr", ")", ";", "this", ".", "lastProject", "=", "proj", ";", "}", "if", "(", "this", ".", "complianceValue", ">=", "ClassFileConstants", ".", "JDK1_5", ")", "return", "null", ";", "}", "this", ".", "packageHandles", ".", "put", "(", "pkgName", ",", "pkgFragment", ")", ";", "}", "return", "pkgFragment", ".", "getClassFile", "(", "simpleNames", "[", "length", "]", ")", ".", "getType", "(", ")", ";", "}", "private", "IType", "createTypeFromPath", "(", "String", "resourcePath", ",", "String", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ")", "throws", "JavaModelException", "{", "int", "rootPathLength", "=", "-", "1", ";", "if", "(", "this", ".", "lastPkgFragmentRootPath", "==", "null", "||", "!", "(", "resourcePath", ".", "startsWith", "(", "this", ".", "lastPkgFragmentRootPath", ")", "&&", "(", "rootPathLength", "=", "this", ".", "lastPkgFragmentRootPath", ".", "length", "(", ")", ")", ">", "0", "&&", "resourcePath", ".", "charAt", "(", "rootPathLength", ")", "==", "'/'", ")", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "(", "(", "AbstractJavaSearchScope", ")", "this", ".", "scope", ")", ".", "packageFragmentRoot", "(", "resourcePath", ",", "-", "1", ",", "null", ")", ";", "if", "(", "root", "==", "null", ")", "return", "null", ";", "this", ".", "lastPkgFragmentRoot", "=", "root", ";", "this", ".", "lastPkgFragmentRootPath", "=", "root", ".", "internalPath", "(", ")", ".", "toString", "(", ")", ";", "this", ".", "packageHandles", "=", "new", "HashtableOfArrayToObject", "(", "5", ")", ";", "}", "resourcePath", "=", "resourcePath", ".", "substring", "(", "this", ".", "lastPkgFragmentRootPath", ".", "length", "(", ")", "+", "1", ")", ";", "String", "[", "]", "simpleNames", "=", "new", "Path", "(", "resourcePath", ")", ".", "segments", "(", ")", ";", "String", "[", "]", "pkgName", ";", "int", "length", "=", "simpleNames", ".", "length", "-", "1", ";", "if", "(", "length", ">", "0", ")", "{", "pkgName", "=", "new", "String", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "simpleNames", ",", "0", ",", "pkgName", ",", "0", ",", "length", ")", ";", "}", "else", "{", "pkgName", "=", "CharOperation", ".", "NO_STRINGS", ";", "}", "IPackageFragment", "pkgFragment", "=", "(", "IPackageFragment", ")", "this", ".", "packageHandles", ".", "get", "(", "pkgName", ")", ";", "if", "(", "pkgFragment", "==", "null", ")", "{", "pkgFragment", "=", "(", "(", "PackageFragmentRoot", ")", "this", ".", "lastPkgFragmentRoot", ")", ".", "getPackageFragment", "(", "pkgName", ")", ";", "this", ".", "packageHandles", ".", "put", "(", "pkgName", ",", "pkgFragment", ")", ";", "}", "String", "simpleName", "=", "simpleNames", "[", "length", "]", ";", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "simpleName", ")", ")", "{", "ICompilationUnit", "unit", "=", "pkgFragment", ".", "getCompilationUnit", "(", "simpleName", ")", ";", "int", "etnLength", "=", "enclosingTypeNames", "==", "null", "?", "0", ":", "enclosingTypeNames", ".", "length", ";", "IType", "type", "=", "(", "etnLength", "==", "0", ")", "?", "unit", ".", "getType", "(", "simpleTypeName", ")", ":", "unit", ".", "getType", "(", "new", "String", "(", "enclosingTypeNames", "[", "0", "]", ")", ")", ";", "if", "(", "etnLength", ">", "0", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<", "etnLength", ";", "i", "++", ")", "{", "type", "=", "type", ".", "getType", "(", "new", "String", "(", "enclosingTypeNames", "[", "i", "]", ")", ")", ";", "}", "type", "=", "type", ".", "getType", "(", "simpleTypeName", ")", ";", "}", "return", "type", ";", "}", "else", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "simpleName", ")", ")", "{", "IClassFile", "classFile", "=", "pkgFragment", ".", "getClassFile", "(", "simpleName", ")", ";", "return", "classFile", ".", "getType", "(", ")", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
2,510
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "java", ".", "util", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRestriction", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Parser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "ProblemReporter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "BasicSearchEngine", "{", "private", "Parser", "parser", ";", "private", "CompilerOptions", "compilerOptions", ";", "private", "ICompilationUnit", "[", "]", "workingCopies", ";", "private", "WorkingCopyOwner", "workingCopyOwner", ";", "public", "static", "boolean", "VERBOSE", "=", "false", ";", "public", "BasicSearchEngine", "(", ")", "{", "}", "public", "BasicSearchEngine", "(", "ICompilationUnit", "[", "]", "workingCopies", ")", "{", "this", ".", "workingCopies", "=", "workingCopies", ";", "}", "char", "convertTypeKind", "(", "int", "typeDeclarationKind", ")", "{", "switch", "(", "typeDeclarationKind", ")", "{", "case", "TypeDeclaration", ".", "CLASS_DECL", ":", "return", "IIndexConstants", ".", "CLASS_SUFFIX", ";", "case", "TypeDeclaration", ".", "INTERFACE_DECL", ":", "return", "IIndexConstants", ".", "INTERFACE_SUFFIX", ";", "case", "TypeDeclaration", ".", "ENUM_DECL", ":", "return", "IIndexConstants", ".", "ENUM_SUFFIX", ";", "case", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ":", "return", "IIndexConstants", ".", "ANNOTATION_TYPE_SUFFIX", ";", "default", ":", "return", "IIndexConstants", ".", "TYPE_SUFFIX", ";", "}", "}", "public", "BasicSearchEngine", "(", "WorkingCopyOwner", "workingCopyOwner", ")", "{", "this", ".", "workingCopyOwner", "=", "workingCopyOwner", ";", "}", "public", "static", "IJavaSearchScope", "createHierarchyScope", "(", "IType", "type", ")", "throws", "JavaModelException", "{", "return", "createHierarchyScope", "(", "type", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "static", "IJavaSearchScope", "createHierarchyScope", "(", "IType", "type", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "return", "new", "HierarchyScope", "(", "type", ",", "owner", ")", ";", "}", "public", "static", "IJavaSearchScope", "createStrictHierarchyScope", "(", "IJavaProject", "project", ",", "IType", "type", ",", "boolean", "onlySubtypes", ",", "boolean", "includeFocusType", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "return", "new", "HierarchyScope", "(", "project", ",", "type", ",", "owner", ",", "onlySubtypes", ",", "true", ",", "includeFocusType", ")", ";", "}", "public", "static", "IJavaSearchScope", "createJavaSearchScope", "(", "IJavaElement", "[", "]", "elements", ")", "{", "return", "createJavaSearchScope", "(", "elements", ",", "true", ")", ";", "}", "public", "static", "IJavaSearchScope", "createJavaSearchScope", "(", "IJavaElement", "[", "]", "elements", ",", "boolean", "includeReferencedProjects", ")", "{", "int", "includeMask", "=", "IJavaSearchScope", ".", "SOURCES", "|", "IJavaSearchScope", ".", "APPLICATION_LIBRARIES", "|", "IJavaSearchScope", ".", "SYSTEM_LIBRARIES", ";", "if", "(", "includeReferencedProjects", ")", "{", "includeMask", "|=", "IJavaSearchScope", ".", "REFERENCED_PROJECTS", ";", "}", "return", "createJavaSearchScope", "(", "elements", ",", "includeMask", ")", ";", "}", "public", "static", "IJavaSearchScope", "createJavaSearchScope", "(", "IJavaElement", "[", "]", "elements", ",", "int", "includeMask", ")", "{", "HashSet", "projectsToBeAdded", "=", "new", "HashSet", "(", "2", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "elements", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "element", "=", "elements", "[", "i", "]", ";", "if", "(", "element", "instanceof", "JavaProject", ")", "{", "projectsToBeAdded", ".", "add", "(", "element", ")", ";", "}", "}", "JavaSearchScope", "scope", "=", "new", "JavaSearchScope", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "elements", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "element", "=", "elements", "[", "i", "]", ";", "if", "(", "element", "!=", "null", ")", "{", "try", "{", "if", "(", "projectsToBeAdded", ".", "contains", "(", "element", ")", ")", "{", "scope", ".", "add", "(", "(", "JavaProject", ")", "element", ",", "includeMask", ",", "projectsToBeAdded", ")", ";", "}", "else", "{", "scope", ".", "add", "(", "element", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "return", "scope", ";", "}", "public", "static", "TypeNameMatch", "createTypeNameMatch", "(", "IType", "type", ",", "int", "modifiers", ")", "{", "return", "new", "JavaSearchTypeNameMatch", "(", "type", ",", "modifiers", ")", ";", "}", "public", "static", "IJavaSearchScope", "createWorkspaceScope", "(", ")", "{", "return", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkspaceScope", "(", ")", ";", "}", "void", "findMatches", "(", "SearchPattern", "pattern", ",", "SearchParticipant", "[", "]", "participants", ",", "IJavaSearchScope", "scope", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "try", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "pattern", ".", "toString", "(", ")", ")", ";", "Util", ".", "verbose", "(", "scope", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "participants", "==", "null", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ")", ";", "return", ";", "}", "int", "length", "=", "participants", ".", "length", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "beginTask", "(", "Messages", ".", "engine_searching", ",", "100", "*", "length", ")", ";", "IndexManager", "indexManager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "requestor", ".", "beginReporting", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "SearchParticipant", "participant", "=", "participants", "[", "i", "]", ";", "try", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "subTask", "(", "Messages", ".", "bind", "(", "Messages", ".", "engine_searching_indexing", ",", "new", "String", "[", "]", "{", "participant", ".", "getDescription", "(", ")", "}", ")", ")", ";", "participant", ".", "beginSearching", "(", ")", ";", "requestor", ".", "enterParticipant", "(", "participant", ")", ";", "PathCollector", "pathCollector", "=", "new", "PathCollector", "(", ")", ";", "indexManager", ".", "performConcurrentJob", "(", "new", "PatternSearchJob", "(", "pattern", ",", "participant", ",", "scope", ",", "pathCollector", ")", ",", "IJavaSearchConstants", ".", "WAIT_UNTIL_READY_TO_SEARCH", ",", "monitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "monitor", ",", "50", ")", ")", ";", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "subTask", "(", "Messages", ".", "bind", "(", "Messages", ".", "engine_searching_matching", ",", "new", "String", "[", "]", "{", "participant", ".", "getDescription", "(", ")", "}", ")", ")", ";", "String", "[", "]", "indexMatchPaths", "=", "pathCollector", ".", "getPaths", "(", ")", ";", "if", "(", "indexMatchPaths", "!=", "null", ")", "{", "pathCollector", "=", "null", ";", "int", "indexMatchLength", "=", "indexMatchPaths", ".", "length", ";", "SearchDocument", "[", "]", "indexMatches", "=", "new", "SearchDocument", "[", "indexMatchLength", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "indexMatchLength", ";", "j", "++", ")", "{", "indexMatches", "[", "j", "]", "=", "participant", ".", "getDocument", "(", "indexMatchPaths", "[", "j", "]", ")", ";", "}", "SearchDocument", "[", "]", "matches", "=", "MatchLocator", ".", "addWorkingCopies", "(", "pattern", ",", "indexMatches", ",", "getWorkingCopies", "(", ")", ",", "participant", ")", ";", "participant", ".", "locateMatches", "(", "matches", ",", "pattern", ",", "scope", ",", "requestor", ",", "monitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "monitor", ",", "50", ")", ")", ";", "}", "}", "finally", "{", "requestor", ".", "exitParticipant", "(", "participant", ")", ";", "participant", ".", "doneSearching", "(", ")", ";", "}", "}", "}", "finally", "{", "requestor", ".", "endReporting", "(", ")", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "done", "(", ")", ";", "}", "}", "public", "static", "SearchParticipant", "getDefaultSearchParticipant", "(", ")", "{", "return", "new", "JavaSearchParticipant", "(", ")", ";", "}", "public", "static", "String", "getMatchRuleString", "(", "final", "int", "matchRule", ")", "{", "if", "(", "matchRule", "==", "0", ")", "{", "return", "\"\"", ";", "}", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "16", ";", "i", "++", ")", "{", "int", "bit", "=", "matchRule", "&", "(", "1", "<<", "(", "i", "-", "1", ")", ")", ";", "if", "(", "bit", "!=", "0", "&&", "buffer", ".", "length", "(", ")", ">", "0", ")", "buffer", ".", "append", "(", "\"", "|", "\"", ")", ";", "switch", "(", "bit", ")", "{", "case", "SearchPattern", ".", "R_PREFIX_MATCH", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_EQUIVALENT_MATCH", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_ERASURE_MATCH", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_FULL_MATCH", ":", "buffer", ".", "append", "(", "\"R_FULL_MATCH\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_REGEXP_MATCH", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "public", "static", "String", "getSearchForString", "(", "final", "int", "searchFor", ")", "{", "switch", "(", "searchFor", ")", "{", "case", "IJavaSearchConstants", ".", "TYPE", ":", "return", "(", "\"TYPE\"", ")", ";", "case", "IJavaSearchConstants", ".", "METHOD", ":", "return", "(", "\"METHOD\"", ")", ";", "case", "IJavaSearchConstants", ".", "PACKAGE", ":", "return", "(", "\"PACKAGE\"", ")", ";", "case", "IJavaSearchConstants", ".", "CONSTRUCTOR", ":", "return", "(", "\"CONSTRUCTOR\"", ")", ";", "case", "IJavaSearchConstants", ".", "FIELD", ":", "return", "(", "\"FIELD\"", ")", ";", "case", "IJavaSearchConstants", ".", "CLASS", ":", "return", "(", "\"CLASS\"", ")", ";", "case", "IJavaSearchConstants", ".", "INTERFACE", ":", "return", "(", "\"INTERFACE\"", ")", ";", "case", "IJavaSearchConstants", ".", "ENUM", ":", "return", "(", "\"ENUM\"", ")", ";", "case", "IJavaSearchConstants", ".", "ANNOTATION_TYPE", ":", "return", "(", "\"\"", ")", ";", "case", "IJavaSearchConstants", ".", "CLASS_AND_ENUM", ":", "return", "(", "\"\"", ")", ";", "case", "IJavaSearchConstants", ".", "CLASS_AND_INTERFACE", ":", "return", "(", "\"\"", ")", ";", "case", "IJavaSearchConstants", ".", "INTERFACE_AND_ANNOTATION", ":", "return", "(", "\"\"", ")", ";", "}", "return", "\"UNKNOWN\"", ";", "}", "private", "Parser", "getParser", "(", ")", "{", "if", "(", "this", ".", "parser", "==", "null", ")", "{", "this", ".", "compilerOptions", "=", "new", "CompilerOptions", "(", "JavaCore", ".", "getOptions", "(", ")", ")", ";", "ProblemReporter", "problemReporter", "=", "new", "ProblemReporter", "(", "DefaultErrorHandlingPolicies", ".", "proceedWithAllProblems", "(", ")", ",", "this", ".", "compilerOptions", ",", "new", "DefaultProblemFactory", "(", ")", ")", ";", "this", ".", "parser", "=", "new", "Parser", "(", "problemReporter", ",", "true", ")", ";", "}", "return", "this", ".", "parser", ";", "}", "private", "ICompilationUnit", "[", "]", "getWorkingCopies", "(", ")", "{", "ICompilationUnit", "[", "]", "copies", ";", "if", "(", "this", ".", "workingCopies", "!=", "null", ")", "{", "if", "(", "this", ".", "workingCopyOwner", "==", "null", ")", "{", "copies", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkingCopies", "(", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "false", ")", ";", "if", "(", "copies", "==", "null", ")", "{", "copies", "=", "this", ".", "workingCopies", ";", "}", "else", "{", "HashMap", "pathToCUs", "=", "new", "HashMap", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "copies", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ICompilationUnit", "unit", "=", "copies", "[", "i", "]", ";", "pathToCUs", ".", "put", "(", "unit", ".", "getPath", "(", ")", ",", "unit", ")", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "workingCopies", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ICompilationUnit", "unit", "=", "this", ".", "workingCopies", "[", "i", "]", ";", "pathToCUs", ".", "put", "(", "unit", ".", "getPath", "(", ")", ",", "unit", ")", ";", "}", "int", "length", "=", "pathToCUs", ".", "size", "(", ")", ";", "copies", "=", "new", "ICompilationUnit", "[", "length", "]", ";", "pathToCUs", ".", "values", "(", ")", ".", "toArray", "(", "copies", ")", ";", "}", "}", "else", "{", "copies", "=", "this", ".", "workingCopies", ";", "}", "}", "else", "if", "(", "this", ".", "workingCopyOwner", "!=", "null", ")", "{", "copies", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkingCopies", "(", "this", ".", "workingCopyOwner", ",", "true", ")", ";", "}", "else", "{", "copies", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkingCopies", "(", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "false", ")", ";", "}", "if", "(", "copies", "==", "null", ")", "return", "null", ";", "ICompilationUnit", "[", "]", "result", "=", "null", ";", "int", "length", "=", "copies", ".", "length", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "CompilationUnit", "copy", "=", "(", "CompilationUnit", ")", "copies", "[", "i", "]", ";", "try", "{", "if", "(", "!", "copy", ".", "isPrimary", "(", ")", "||", "copy", ".", "hasUnsavedChanges", "(", ")", "||", "copy", ".", "hasResourceChanged", "(", ")", ")", "{", "if", "(", "result", "==", "null", ")", "{", "result", "=", "new", "ICompilationUnit", "[", "length", "]", ";", "}", "result", "[", "index", "++", "]", "=", "copy", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "if", "(", "index", "!=", "length", "&&", "result", "!=", "null", ")", "{", "System", ".", "arraycopy", "(", "result", ",", "0", ",", "result", "=", "new", "ICompilationUnit", "[", "index", "]", ",", "0", ",", "index", ")", ";", "}", "return", "result", ";", "}", "private", "ICompilationUnit", "[", "]", "getWorkingCopies", "(", "IJavaElement", "element", ")", "{", "if", "(", "element", "instanceof", "IMember", ")", "{", "ICompilationUnit", "cu", "=", "(", "(", "IMember", ")", "element", ")", ".", "getCompilationUnit", "(", ")", ";", "if", "(", "cu", "!=", "null", "&&", "cu", ".", "isWorkingCopy", "(", ")", ")", "{", "return", "new", "ICompilationUnit", "[", "]", "{", "cu", "}", ";", "}", "}", "else", "if", "(", "element", "instanceof", "ICompilationUnit", ")", "{", "return", "new", "ICompilationUnit", "[", "]", "{", "(", "ICompilationUnit", ")", "element", "}", ";", "}", "return", "null", ";", "}", "boolean", "match", "(", "char", "patternTypeSuffix", ",", "int", "modifiers", ")", "{", "switch", "(", "patternTypeSuffix", ")", "{", "case", "IIndexConstants", ".", "CLASS_SUFFIX", ":", "return", "(", "modifiers", "&", "(", "Flags", ".", "AccAnnotation", "|", "Flags", ".", "AccInterface", "|", "Flags", ".", "AccEnum", ")", ")", "==", "0", ";", "case", "IIndexConstants", ".", "CLASS_AND_INTERFACE_SUFFIX", ":", "return", "(", "modifiers", "&", "(", "Flags", ".", "AccAnnotation", "|", "Flags", ".", "AccEnum", ")", ")", "==", "0", ";", "case", "IIndexConstants", ".", "CLASS_AND_ENUM_SUFFIX", ":", "return", "(", "modifiers", "&", "(", "Flags", ".", "AccAnnotation", "|", "Flags", ".", "AccInterface", ")", ")", "==", "0", ";", "case", "IIndexConstants", ".", "INTERFACE_SUFFIX", ":", "return", "(", "modifiers", "&", "Flags", ".", "AccInterface", ")", "!=", "0", ";", "case", "IIndexConstants", ".", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "return", "(", "modifiers", "&", "(", "Flags", ".", "AccInterface", "|", "Flags", ".", "AccAnnotation", ")", ")", "!=", "0", ";", "case", "IIndexConstants", ".", "ENUM_SUFFIX", ":", "return", "(", "modifiers", "&", "Flags", ".", "AccEnum", ")", "!=", "0", ";", "case", "IIndexConstants", ".", "ANNOTATION_TYPE_SUFFIX", ":", "return", "(", "modifiers", "&", "Flags", ".", "AccAnnotation", ")", "!=", "0", ";", "}", "return", "true", ";", "}", "boolean", "match", "(", "char", "patternTypeSuffix", ",", "char", "[", "]", "patternPkg", ",", "int", "matchRulePkg", ",", "char", "[", "]", "patternTypeName", ",", "int", "matchRuleType", ",", "int", "typeKind", ",", "char", "[", "]", "pkg", ",", "char", "[", "]", "typeName", ")", "{", "switch", "(", "patternTypeSuffix", ")", "{", "case", "IIndexConstants", ".", "CLASS_SUFFIX", ":", "if", "(", "typeKind", "!=", "TypeDeclaration", ".", "CLASS_DECL", ")", "return", "false", ";", "break", ";", "case", "IIndexConstants", ".", "CLASS_AND_INTERFACE_SUFFIX", ":", "if", "(", "typeKind", "!=", "TypeDeclaration", ".", "CLASS_DECL", "&&", "typeKind", "!=", "TypeDeclaration", ".", "INTERFACE_DECL", ")", "return", "false", ";", "break", ";", "case", "IIndexConstants", ".", "CLASS_AND_ENUM_SUFFIX", ":", "if", "(", "typeKind", "!=", "TypeDeclaration", ".", "CLASS_DECL", "&&", "typeKind", "!=", "TypeDeclaration", ".", "ENUM_DECL", ")", "return", "false", ";", "break", ";", "case", "IIndexConstants", ".", "INTERFACE_SUFFIX", ":", "if", "(", "typeKind", "!=", "TypeDeclaration", ".", "INTERFACE_DECL", ")", "return", "false", ";", "break", ";", "case", "IIndexConstants", ".", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "if", "(", "typeKind", "!=", "TypeDeclaration", ".", "INTERFACE_DECL", "&&", "typeKind", "!=", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ")", "return", "false", ";", "break", ";", "case", "IIndexConstants", ".", "ENUM_SUFFIX", ":", "if", "(", "typeKind", "!=", "TypeDeclaration", ".", "ENUM_DECL", ")", "return", "false", ";", "break", ";", "case", "IIndexConstants", ".", "ANNOTATION_TYPE_SUFFIX", ":", "if", "(", "typeKind", "!=", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ")", "return", "false", ";", "break", ";", "case", "IIndexConstants", ".", "TYPE_SUFFIX", ":", "}", "boolean", "isPkgCaseSensitive", "=", "(", "matchRulePkg", "&", "SearchPattern", ".", "R_CASE_SENSITIVE", ")", "!=", "0", ";", "if", "(", "patternPkg", "!=", "null", "&&", "!", "CharOperation", ".", "equals", "(", "patternPkg", ",", "pkg", ",", "isPkgCaseSensitive", ")", ")", "return", "false", ";", "boolean", "isCaseSensitive", "=", "(", "matchRuleType", "&", "SearchPattern", ".", "R_CASE_SENSITIVE", ")", "!=", "0", ";", "if", "(", "patternTypeName", "!=", "null", ")", "{", "boolean", "isCamelCase", "=", "(", "matchRuleType", "&", "(", "SearchPattern", ".", "R_CAMELCASE_MATCH", "|", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ")", ")", "!=", "0", ";", "int", "matchMode", "=", "matchRuleType", "&", "JavaSearchPattern", ".", "MATCH_MODE_MASK", ";", "if", "(", "!", "isCaseSensitive", "&&", "!", "isCamelCase", ")", "{", "patternTypeName", "=", "CharOperation", ".", "toLowerCase", "(", "patternTypeName", ")", ";", "}", "boolean", "matchFirstChar", "=", "!", "isCaseSensitive", "||", "patternTypeName", "[", "0", "]", "==", "typeName", "[", "0", "]", ";", "switch", "(", "matchMode", ")", "{", "case", "SearchPattern", ".", "R_EXACT_MATCH", ":", "return", "matchFirstChar", "&&", "CharOperation", ".", "equals", "(", "patternTypeName", ",", "typeName", ",", "isCaseSensitive", ")", ";", "case", "SearchPattern", ".", "R_PREFIX_MATCH", ":", "return", "matchFirstChar", "&&", "CharOperation", ".", "prefixEquals", "(", "patternTypeName", ",", "typeName", ",", "isCaseSensitive", ")", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "return", "CharOperation", ".", "match", "(", "patternTypeName", ",", "typeName", ",", "isCaseSensitive", ")", ";", "case", "SearchPattern", ".", "R_REGEXP_MATCH", ":", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "if", "(", "matchFirstChar", "&&", "CharOperation", ".", "camelCaseMatch", "(", "patternTypeName", ",", "typeName", ",", "false", ")", ")", "{", "return", "true", ";", "}", "return", "!", "isCaseSensitive", "&&", "matchFirstChar", "&&", "CharOperation", ".", "prefixEquals", "(", "patternTypeName", ",", "typeName", ",", "false", ")", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "return", "matchFirstChar", "&&", "CharOperation", ".", "camelCaseMatch", "(", "patternTypeName", ",", "typeName", ",", "true", ")", ";", "}", "}", "return", "true", ";", "}", "public", "void", "search", "(", "SearchPattern", "pattern", ",", "SearchParticipant", "[", "]", "participants", ",", "IJavaSearchScope", "scope", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "findMatches", "(", "pattern", ",", "participants", ",", "scope", ",", "requestor", ",", "monitor", ")", ";", "}", "public", "void", "searchAllConstructorDeclarations", "(", "final", "char", "[", "]", "packageName", ",", "final", "char", "[", "]", "typeName", ",", "final", "int", "typeMatchRule", ",", "IJavaSearchScope", "scope", ",", "final", "IRestrictedAccessConstructorRequestor", "nameRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "final", "int", "validatedTypeMatchRule", "=", "SearchPattern", ".", "validateMatchRule", "(", "typeName", "==", "null", "?", "null", ":", "new", "String", "(", "typeName", ")", ",", "typeMatchRule", ")", ";", "final", "int", "pkgMatchRule", "=", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ";", "final", "char", "NoSuffix", "=", "IIndexConstants", ".", "TYPE_SUFFIX", ";", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "(", "packageName", "==", "null", "?", "\"null\"", ":", "new", "String", "(", "packageName", ")", ")", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "(", "typeName", "==", "null", "?", "\"null\"", ":", "new", "String", "(", "typeName", ")", ")", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "getMatchRuleString", "(", "typeMatchRule", ")", ")", ";", "if", "(", "validatedTypeMatchRule", "!=", "typeMatchRule", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "getMatchRuleString", "(", "validatedTypeMatchRule", ")", ")", ";", "}", "Util", ".", "verbose", "(", "\"t-", "scope:", "\"", "+", "scope", ")", ";", "}", "if", "(", "validatedTypeMatchRule", "==", "-", "1", ")", "return", ";", "IndexManager", "indexManager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "final", "ConstructorDeclarationPattern", "pattern", "=", "new", "ConstructorDeclarationPattern", "(", "packageName", ",", "typeName", ",", "validatedTypeMatchRule", ")", ";", "final", "HashSet", "workingCopyPaths", "=", "new", "HashSet", "(", ")", ";", "String", "workingCopyPath", "=", "null", ";", "ICompilationUnit", "[", "]", "copies", "=", "getWorkingCopies", "(", ")", ";", "final", "int", "copiesLength", "=", "copies", "==", "null", "?", "0", ":", "copies", ".", "length", ";", "if", "(", "copies", "!=", "null", ")", "{", "if", "(", "copiesLength", "==", "1", ")", "{", "workingCopyPath", "=", "copies", "[", "0", "]", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "copiesLength", ";", "i", "++", ")", "{", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "workingCopyPaths", ".", "add", "(", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "final", "String", "singleWkcpPath", "=", "workingCopyPath", ";", "IndexQueryRequestor", "searchRequestor", "=", "new", "IndexQueryRequestor", "(", ")", "{", "public", "boolean", "acceptIndexMatch", "(", "String", "documentPath", ",", "SearchPattern", "indexRecord", ",", "SearchParticipant", "participant", ",", "AccessRuleSet", "access", ")", "{", "ConstructorDeclarationPattern", "record", "=", "(", "ConstructorDeclarationPattern", ")", "indexRecord", ";", "if", "(", "(", "record", ".", "extraFlags", "&", "ExtraFlags", ".", "IsMemberType", ")", "!=", "0", ")", "{", "return", "true", ";", "}", "if", "(", "(", "record", ".", "extraFlags", "&", "ExtraFlags", ".", "IsLocalType", ")", "!=", "0", ")", "{", "return", "true", ";", "}", "switch", "(", "copiesLength", ")", "{", "case", "0", ":", "break", ";", "case", "1", ":", "if", "(", "singleWkcpPath", ".", "equals", "(", "documentPath", ")", ")", "{", "return", "true", ";", "}", "break", ";", "default", ":", "if", "(", "workingCopyPaths", ".", "contains", "(", "documentPath", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "AccessRestriction", "accessRestriction", "=", "null", ";", "if", "(", "access", "!=", "null", ")", "{", "int", "pkgLength", "=", "(", "record", ".", "declaringPackageName", "==", "null", "||", "record", ".", "declaringPackageName", ".", "length", "==", "0", ")", "?", "0", ":", "record", ".", "declaringPackageName", ".", "length", "+", "1", ";", "int", "nameLength", "=", "record", ".", "declaringSimpleName", "==", "null", "?", "0", ":", "record", ".", "declaringSimpleName", ".", "length", ";", "char", "[", "]", "path", "=", "new", "char", "[", "pkgLength", "+", "nameLength", "]", ";", "int", "pos", "=", "0", ";", "if", "(", "pkgLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "record", ".", "declaringPackageName", ",", "0", ",", "path", ",", "pos", ",", "pkgLength", "-", "1", ")", ";", "CharOperation", ".", "replace", "(", "path", ",", "'.'", ",", "'/'", ")", ";", "path", "[", "pkgLength", "-", "1", "]", "=", "'/'", ";", "pos", "+=", "pkgLength", ";", "}", "if", "(", "nameLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "record", ".", "declaringSimpleName", ",", "0", ",", "path", ",", "pos", ",", "nameLength", ")", ";", "pos", "+=", "nameLength", ";", "}", "if", "(", "pos", ">", "0", ")", "{", "accessRestriction", "=", "access", ".", "getViolatedRestriction", "(", "path", ")", ";", "}", "}", "nameRequestor", ".", "acceptConstructor", "(", "record", ".", "modifiers", ",", "record", ".", "declaringSimpleName", ",", "record", ".", "parameterCount", ",", "record", ".", "signature", ",", "record", ".", "parameterTypes", ",", "record", ".", "parameterNames", ",", "record", ".", "declaringTypeModifiers", ",", "record", ".", "declaringPackageName", ",", "record", ".", "extraFlags", ",", "documentPath", ",", "accessRestriction", ")", ";", "return", "true", ";", "}", "}", ";", "try", "{", "if", "(", "progressMonitor", "!=", "null", ")", "{", "progressMonitor", ".", "beginTask", "(", "Messages", ".", "engine_searching", ",", "1000", ")", ";", "}", "indexManager", ".", "performConcurrentJob", "(", "new", "PatternSearchJob", "(", "pattern", ",", "getDefaultSearchParticipant", "(", ")", ",", "scope", ",", "searchRequestor", ")", ",", "waitingPolicy", ",", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "progressMonitor", ",", "1000", "-", "copiesLength", ")", ")", ";", "if", "(", "copies", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "copiesLength", ";", "i", "++", ")", "{", "final", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "if", "(", "scope", "instanceof", "HierarchyScope", ")", "{", "if", "(", "!", "(", "(", "HierarchyScope", ")", "scope", ")", ".", "encloses", "(", "workingCopy", ",", "progressMonitor", ")", ")", "continue", ";", "}", "else", "{", "if", "(", "!", "scope", ".", "encloses", "(", "workingCopy", ")", ")", "continue", ";", "}", "final", "String", "path", "=", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "workingCopy", ".", "isConsistent", "(", ")", ")", "{", "IPackageDeclaration", "[", "]", "packageDeclarations", "=", "workingCopy", ".", "getPackageDeclarations", "(", ")", ";", "char", "[", "]", "packageDeclaration", "=", "packageDeclarations", ".", "length", "==", "0", "?", "CharOperation", ".", "NO_CHAR", ":", "packageDeclarations", "[", "0", "]", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "IType", "[", "]", "allTypes", "=", "workingCopy", ".", "getAllTypes", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "allTypesLength", "=", "allTypes", ".", "length", ";", "j", "<", "allTypesLength", ";", "j", "++", ")", "{", "IType", "type", "=", "allTypes", "[", "j", "]", ";", "char", "[", "]", "simpleName", "=", "type", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "if", "(", "match", "(", "NoSuffix", ",", "packageName", ",", "pkgMatchRule", ",", "typeName", ",", "validatedTypeMatchRule", ",", "0", ",", "packageDeclaration", ",", "simpleName", ")", "&&", "!", "type", ".", "isMember", "(", ")", ")", "{", "int", "extraFlags", "=", "ExtraFlags", ".", "getExtraFlags", "(", "type", ")", ";", "boolean", "hasConstructor", "=", "false", ";", "IMethod", "[", "]", "methods", "=", "type", ".", "getMethods", "(", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "methods", ".", "length", ";", "k", "++", ")", "{", "IMethod", "method", "=", "methods", "[", "k", "]", ";", "if", "(", "method", ".", "isConstructor", "(", ")", ")", "{", "hasConstructor", "=", "true", ";", "String", "[", "]", "stringParameterNames", "=", "method", ".", "getParameterNames", "(", ")", ";", "String", "[", "]", "stringParameterTypes", "=", "method", ".", "getParameterTypes", "(", ")", ";", "int", "length", "=", "stringParameterNames", ".", "length", ";", "char", "[", "]", "[", "]", "parameterNames", "=", "new", "char", "[", "length", "]", "[", "]", ";", "char", "[", "]", "[", "]", "parameterTypes", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "l", "=", "0", ";", "l", "<", "length", ";", "l", "++", ")", "{", "parameterNames", "[", "l", "]", "=", "stringParameterNames", "[", "l", "]", ".", "toCharArray", "(", ")", ";", "parameterTypes", "[", "l", "]", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "stringParameterTypes", "[", "l", "]", ")", ".", "toCharArray", "(", ")", ")", ";", "}", "nameRequestor", ".", "acceptConstructor", "(", "method", ".", "getFlags", "(", ")", ",", "simpleName", ",", "parameterNames", ".", "length", ",", "null", ",", "parameterTypes", ",", "parameterNames", ",", "type", ".", "getFlags", "(", ")", ",", "packageDeclaration", ",", "extraFlags", ",", "path", ",", "null", ")", ";", "}", "}", "if", "(", "!", "hasConstructor", ")", "{", "nameRequestor", ".", "acceptConstructor", "(", "Flags", ".", "AccPublic", ",", "simpleName", ",", "-", "1", ",", "null", ",", "CharOperation", ".", "NO_CHAR_CHAR", ",", "CharOperation", ".", "NO_CHAR_CHAR", ",", "type", ".", "getFlags", "(", ")", ",", "packageDeclaration", ",", "extraFlags", ",", "path", ",", "null", ")", ";", "}", "}", "}", "}", "else", "{", "Parser", "basicParser", "=", "getParser", "(", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", "unit", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ")", "workingCopy", ";", "CompilationResult", "compilationUnitResult", "=", "new", "CompilationResult", "(", "unit", ",", "0", ",", "0", ",", "this", ".", "compilerOptions", ".", "maxProblemsPerUnit", ")", ";", "CompilationUnitDeclaration", "parsedUnit", "=", "basicParser", ".", "dietParse", "(", "unit", ",", "compilationUnitResult", ")", ";", "if", "(", "parsedUnit", "!=", "null", ")", "{", "final", "char", "[", "]", "packageDeclaration", "=", "parsedUnit", ".", "currentPackage", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "CharOperation", ".", "concatWith", "(", "parsedUnit", ".", "currentPackage", ".", "getImportName", "(", ")", ",", "'.'", ")", ";", "class", "AllConstructorDeclarationsVisitor", "extends", "ASTVisitor", "{", "private", "TypeDeclaration", "[", "]", "declaringTypes", "=", "new", "TypeDeclaration", "[", "0", "]", ";", "private", "int", "declaringTypesPtr", "=", "-", "1", ";", "private", "void", "endVisit", "(", "TypeDeclaration", "typeDeclaration", ")", "{", "if", "(", "!", "hasConstructor", "(", "typeDeclaration", ")", "&&", "typeDeclaration", ".", "enclosingType", "==", "null", ")", "{", "if", "(", "match", "(", "NoSuffix", ",", "packageName", ",", "pkgMatchRule", ",", "typeName", ",", "validatedTypeMatchRule", ",", "0", ",", "packageDeclaration", ",", "typeDeclaration", ".", "name", ")", ")", "{", "nameRequestor", ".", "acceptConstructor", "(", "Flags", ".", "AccPublic", ",", "typeName", ",", "-", "1", ",", "null", ",", "CharOperation", ".", "NO_CHAR_CHAR", ",", "CharOperation", ".", "NO_CHAR_CHAR", ",", "typeDeclaration", ".", "modifiers", ",", "packageDeclaration", ",", "ExtraFlags", ".", "getExtraFlags", "(", "typeDeclaration", ")", ",", "path", ",", "null", ")", ";", "}", "}", "this", ".", "declaringTypes", "[", "this", ".", "declaringTypesPtr", "]", "=", "null", ";", "this", ".", "declaringTypesPtr", "--", ";", "}", "public", "void", "endVisit", "(", "TypeDeclaration", "typeDeclaration", ",", "CompilationUnitScope", "s", ")", "{", "endVisit", "(", "typeDeclaration", ")", ";", "}", "public", "void", "endVisit", "(", "TypeDeclaration", "memberTypeDeclaration", ",", "ClassScope", "s", ")", "{", "endVisit", "(", "memberTypeDeclaration", ")", ";", "}", "private", "boolean", "hasConstructor", "(", "TypeDeclaration", "typeDeclaration", ")", "{", "AbstractMethodDeclaration", "[", "]", "methods", "=", "typeDeclaration", ".", "methods", ";", "int", "length", "=", "methods", "==", "null", "?", "0", ":", "methods", ".", "length", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length", ";", "j", "++", ")", "{", "if", "(", "methods", "[", "j", "]", ".", "isConstructor", "(", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ConstructorDeclaration", "constructorDeclaration", ",", "ClassScope", "classScope", ")", "{", "TypeDeclaration", "typeDeclaration", "=", "this", ".", "declaringTypes", "[", "this", ".", "declaringTypesPtr", "]", ";", "if", "(", "match", "(", "NoSuffix", ",", "packageName", ",", "pkgMatchRule", ",", "typeName", ",", "validatedTypeMatchRule", ",", "0", ",", "packageDeclaration", ",", "typeDeclaration", ".", "name", ")", ")", "{", "Argument", "[", "]", "arguments", "=", "constructorDeclaration", ".", "arguments", ";", "int", "length", "=", "arguments", "==", "null", "?", "0", ":", "arguments", ".", "length", ";", "char", "[", "]", "[", "]", "parameterNames", "=", "new", "char", "[", "length", "]", "[", "]", ";", "char", "[", "]", "[", "]", "parameterTypes", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "l", "=", "0", ";", "l", "<", "length", ";", "l", "++", ")", "{", "Argument", "argument", "=", "arguments", "[", "l", "]", ";", "parameterNames", "[", "l", "]", "=", "argument", ".", "name", ";", "if", "(", "argument", ".", "type", "instanceof", "SingleTypeReference", ")", "{", "parameterTypes", "[", "l", "]", "=", "(", "(", "SingleTypeReference", ")", "argument", ".", "type", ")", ".", "token", ";", "}", "else", "{", "parameterTypes", "[", "l", "]", "=", "CharOperation", ".", "concatWith", "(", "(", "(", "QualifiedTypeReference", ")", "argument", ".", "type", ")", ".", "tokens", ",", "'.'", ")", ";", "}", "}", "TypeDeclaration", "enclosing", "=", "typeDeclaration", ".", "enclosingType", ";", "char", "[", "]", "[", "]", "enclosingTypeNames", "=", "CharOperation", ".", "NO_CHAR_CHAR", ";", "while", "(", "enclosing", "!=", "null", ")", "{", "enclosingTypeNames", "=", "CharOperation", ".", "arrayConcat", "(", "new", "char", "[", "]", "[", "]", "{", "enclosing", ".", "name", "}", ",", "enclosingTypeNames", ")", ";", "if", "(", "(", "enclosing", ".", "bits", "&", "ASTNode", ".", "IsMemberType", ")", "!=", "0", ")", "{", "enclosing", "=", "enclosing", ".", "enclosingType", ";", "}", "else", "{", "enclosing", "=", "null", ";", "}", "}", "nameRequestor", ".", "acceptConstructor", "(", "constructorDeclaration", ".", "modifiers", ",", "typeName", ",", "parameterNames", ".", "length", ",", "null", ",", "parameterTypes", ",", "parameterNames", ",", "typeDeclaration", ".", "modifiers", ",", "packageDeclaration", ",", "ExtraFlags", ".", "getExtraFlags", "(", "typeDeclaration", ")", ",", "path", ",", "null", ")", ";", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "BlockScope", "blockScope", ")", "{", "return", "false", ";", "}", "private", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ")", "{", "if", "(", "this", ".", "declaringTypes", ".", "length", "<=", "++", "this", ".", "declaringTypesPtr", ")", "{", "int", "length", "=", "this", ".", "declaringTypesPtr", ";", "System", ".", "arraycopy", "(", "this", ".", "declaringTypes", ",", "0", ",", "this", ".", "declaringTypes", "=", "new", "TypeDeclaration", "[", "length", "*", "2", "+", "1", "]", ",", "0", ",", "length", ")", ";", "}", "this", ".", "declaringTypes", "[", "this", ".", "declaringTypesPtr", "]", "=", "typeDeclaration", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "CompilationUnitScope", "s", ")", "{", "return", "visit", "(", "typeDeclaration", ")", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "memberTypeDeclaration", ",", "ClassScope", "s", ")", "{", "return", "visit", "(", "memberTypeDeclaration", ")", ";", "}", "}", "parsedUnit", ".", "traverse", "(", "new", "AllConstructorDeclarationsVisitor", "(", ")", ",", "parsedUnit", ".", "scope", ")", ";", "}", "}", "if", "(", "progressMonitor", "!=", "null", ")", "{", "if", "(", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "progressMonitor", ".", "worked", "(", "1", ")", ";", "}", "}", "}", "}", "finally", "{", "if", "(", "progressMonitor", "!=", "null", ")", "{", "progressMonitor", ".", "done", "(", ")", ";", "}", "}", "}", "public", "void", "searchAllSecondaryTypeNames", "(", "IPackageFragmentRoot", "[", "]", "sourceFolders", ",", "final", "IRestrictedAccessTypeRequestor", "nameRequestor", ",", "boolean", "waitForIndexes", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "int", "length", "=", "sourceFolders", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "i", "==", "0", ")", "{", "buffer", ".", "append", "(", "'['", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "','", ")", ";", "}", "buffer", ".", "append", "(", "sourceFolders", "[", "i", "]", ".", "getElementName", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "waitForIndexes", ")", ";", "Util", ".", "verbose", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "IndexManager", "indexManager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "final", "TypeDeclarationPattern", "pattern", "=", "new", "SecondaryTypeDeclarationPattern", "(", ")", ";", "final", "HashSet", "workingCopyPaths", "=", "new", "HashSet", "(", ")", ";", "String", "workingCopyPath", "=", "null", ";", "ICompilationUnit", "[", "]", "copies", "=", "getWorkingCopies", "(", ")", ";", "final", "int", "copiesLength", "=", "copies", "==", "null", "?", "0", ":", "copies", ".", "length", ";", "if", "(", "copies", "!=", "null", ")", "{", "if", "(", "copiesLength", "==", "1", ")", "{", "workingCopyPath", "=", "copies", "[", "0", "]", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "copiesLength", ";", "i", "++", ")", "{", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "workingCopyPaths", ".", "add", "(", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "final", "String", "singleWkcpPath", "=", "workingCopyPath", ";", "IndexQueryRequestor", "searchRequestor", "=", "new", "IndexQueryRequestor", "(", ")", "{", "public", "boolean", "acceptIndexMatch", "(", "String", "documentPath", ",", "SearchPattern", "indexRecord", ",", "SearchParticipant", "participant", ",", "AccessRuleSet", "access", ")", "{", "TypeDeclarationPattern", "record", "=", "(", "TypeDeclarationPattern", ")", "indexRecord", ";", "if", "(", "!", "record", ".", "secondary", ")", "{", "return", "true", ";", "}", "if", "(", "record", ".", "enclosingTypeNames", "==", "IIndexConstants", ".", "ONE_ZERO_CHAR", ")", "{", "return", "true", ";", "}", "switch", "(", "copiesLength", ")", "{", "case", "0", ":", "break", ";", "case", "1", ":", "if", "(", "singleWkcpPath", ".", "equals", "(", "documentPath", ")", ")", "{", "return", "true", ";", "}", "break", ";", "default", ":", "if", "(", "workingCopyPaths", ".", "contains", "(", "documentPath", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "AccessRestriction", "accessRestriction", "=", "null", ";", "if", "(", "access", "!=", "null", ")", "{", "int", "pkgLength", "=", "(", "record", ".", "pkg", "==", "null", "||", "record", ".", "pkg", ".", "length", "==", "0", ")", "?", "0", ":", "record", ".", "pkg", ".", "length", "+", "1", ";", "int", "nameLength", "=", "record", ".", "simpleName", "==", "null", "?", "0", ":", "record", ".", "simpleName", ".", "length", ";", "char", "[", "]", "path", "=", "new", "char", "[", "pkgLength", "+", "nameLength", "]", ";", "int", "pos", "=", "0", ";", "if", "(", "pkgLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "record", ".", "pkg", ",", "0", ",", "path", ",", "pos", ",", "pkgLength", "-", "1", ")", ";", "CharOperation", ".", "replace", "(", "path", ",", "'.'", ",", "'/'", ")", ";", "path", "[", "pkgLength", "-", "1", "]", "=", "'/'", ";", "pos", "+=", "pkgLength", ";", "}", "if", "(", "nameLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "record", ".", "simpleName", ",", "0", ",", "path", ",", "pos", ",", "nameLength", ")", ";", "pos", "+=", "nameLength", ";", "}", "if", "(", "pos", ">", "0", ")", "{", "accessRestriction", "=", "access", ".", "getViolatedRestriction", "(", "path", ")", ";", "}", "}", "nameRequestor", ".", "acceptType", "(", "record", ".", "modifiers", ",", "record", ".", "pkg", ",", "record", ".", "simpleName", ",", "record", ".", "enclosingTypeNames", ",", "documentPath", ",", "accessRestriction", ")", ";", "return", "true", ";", "}", "}", ";", "try", "{", "if", "(", "progressMonitor", "!=", "null", ")", "{", "progressMonitor", ".", "beginTask", "(", "Messages", ".", "engine_searching", ",", "100", ")", ";", "}", "indexManager", ".", "performConcurrentJob", "(", "new", "PatternSearchJob", "(", "pattern", ",", "getDefaultSearchParticipant", "(", ")", ",", "createJavaSearchScope", "(", "sourceFolders", ")", ",", "searchRequestor", ")", ",", "waitForIndexes", "?", "IJavaSearchConstants", ".", "WAIT_UNTIL_READY_TO_SEARCH", ":", "IJavaSearchConstants", ".", "FORCE_IMMEDIATE_SEARCH", ",", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "progressMonitor", ",", "100", ")", ")", ";", "}", "catch", "(", "OperationCanceledException", "oce", ")", "{", "}", "finally", "{", "if", "(", "progressMonitor", "!=", "null", ")", "{", "progressMonitor", ".", "done", "(", ")", ";", "}", "}", "}", "public", "void", "searchAllTypeNames", "(", "final", "char", "[", "]", "packageName", ",", "final", "int", "packageMatchRule", ",", "final", "char", "[", "]", "typeName", ",", "final", "int", "typeMatchRule", ",", "int", "searchFor", ",", "IJavaSearchScope", "scope", ",", "final", "IRestrictedAccessTypeRequestor", "nameRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "final", "int", "validatedTypeMatchRule", "=", "SearchPattern", ".", "validateMatchRule", "(", "typeName", "==", "null", "?", "null", ":", "new", "String", "(", "typeName", ")", ",", "typeMatchRule", ")", ";", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "(", "packageName", "==", "null", "?", "\"null\"", ":", "new", "String", "(", "packageName", ")", ")", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "getMatchRuleString", "(", "packageMatchRule", ")", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "(", "typeName", "==", "null", "?", "\"null\"", ":", "new", "String", "(", "typeName", ")", ")", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "getMatchRuleString", "(", "typeMatchRule", ")", ")", ";", "if", "(", "validatedTypeMatchRule", "!=", "typeMatchRule", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "getMatchRuleString", "(", "validatedTypeMatchRule", ")", ")", ";", "}", "Util", ".", "verbose", "(", "\"\"", "+", "searchFor", ")", ";", "Util", ".", "verbose", "(", "\"t-", "scope:", "\"", "+", "scope", ")", ";", "}", "if", "(", "validatedTypeMatchRule", "==", "-", "1", ")", "return", ";", "IndexManager", "indexManager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "final", "char", "typeSuffix", ";", "switch", "(", "searchFor", ")", "{", "case", "IJavaSearchConstants", ".", "CLASS", ":", "typeSuffix", "=", "IIndexConstants", ".", "CLASS_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "CLASS_AND_INTERFACE", ":", "typeSuffix", "=", "IIndexConstants", ".", "CLASS_AND_INTERFACE_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "CLASS_AND_ENUM", ":", "typeSuffix", "=", "IIndexConstants", ".", "CLASS_AND_ENUM_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "INTERFACE", ":", "typeSuffix", "=", "IIndexConstants", ".", "INTERFACE_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "INTERFACE_AND_ANNOTATION", ":", "typeSuffix", "=", "IIndexConstants", ".", "INTERFACE_AND_ANNOTATION_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "ENUM", ":", "typeSuffix", "=", "IIndexConstants", ".", "ENUM_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "ANNOTATION_TYPE", ":", "typeSuffix", "=", "IIndexConstants", ".", "ANNOTATION_TYPE_SUFFIX", ";", "break", ";", "default", ":", "typeSuffix", "=", "IIndexConstants", ".", "TYPE_SUFFIX", ";", "break", ";", "}", "final", "TypeDeclarationPattern", "pattern", "=", "packageMatchRule", "==", "SearchPattern", ".", "R_EXACT_MATCH", "?", "new", "TypeDeclarationPattern", "(", "packageName", ",", "null", ",", "typeName", ",", "typeSuffix", ",", "validatedTypeMatchRule", ")", ":", "new", "QualifiedTypeDeclarationPattern", "(", "packageName", ",", "packageMatchRule", ",", "typeName", ",", "typeSuffix", ",", "validatedTypeMatchRule", ")", ";", "final", "HashSet", "workingCopyPaths", "=", "new", "HashSet", "(", ")", ";", "String", "workingCopyPath", "=", "null", ";", "ICompilationUnit", "[", "]", "copies", "=", "getWorkingCopies", "(", ")", ";", "final", "int", "copiesLength", "=", "copies", "==", "null", "?", "0", ":", "copies", ".", "length", ";", "if", "(", "copies", "!=", "null", ")", "{", "if", "(", "copiesLength", "==", "1", ")", "{", "workingCopyPath", "=", "copies", "[", "0", "]", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "copiesLength", ";", "i", "++", ")", "{", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "workingCopyPaths", ".", "add", "(", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "final", "String", "singleWkcpPath", "=", "workingCopyPath", ";", "IndexQueryRequestor", "searchRequestor", "=", "new", "IndexQueryRequestor", "(", ")", "{", "public", "boolean", "acceptIndexMatch", "(", "String", "documentPath", ",", "SearchPattern", "indexRecord", ",", "SearchParticipant", "participant", ",", "AccessRuleSet", "access", ")", "{", "TypeDeclarationPattern", "record", "=", "(", "TypeDeclarationPattern", ")", "indexRecord", ";", "if", "(", "record", ".", "enclosingTypeNames", "==", "IIndexConstants", ".", "ONE_ZERO_CHAR", ")", "{", "return", "true", ";", "}", "switch", "(", "copiesLength", ")", "{", "case", "0", ":", "break", ";", "case", "1", ":", "if", "(", "singleWkcpPath", ".", "equals", "(", "documentPath", ")", ")", "{", "return", "true", ";", "}", "break", ";", "default", ":", "if", "(", "workingCopyPaths", ".", "contains", "(", "documentPath", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "AccessRestriction", "accessRestriction", "=", "null", ";", "if", "(", "access", "!=", "null", ")", "{", "int", "pkgLength", "=", "(", "record", ".", "pkg", "==", "null", "||", "record", ".", "pkg", ".", "length", "==", "0", ")", "?", "0", ":", "record", ".", "pkg", ".", "length", "+", "1", ";", "int", "nameLength", "=", "record", ".", "simpleName", "==", "null", "?", "0", ":", "record", ".", "simpleName", ".", "length", ";", "char", "[", "]", "path", "=", "new", "char", "[", "pkgLength", "+", "nameLength", "]", ";", "int", "pos", "=", "0", ";", "if", "(", "pkgLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "record", ".", "pkg", ",", "0", ",", "path", ",", "pos", ",", "pkgLength", "-", "1", ")", ";", "CharOperation", ".", "replace", "(", "path", ",", "'.'", ",", "'/'", ")", ";", "path", "[", "pkgLength", "-", "1", "]", "=", "'/'", ";", "pos", "+=", "pkgLength", ";", "}", "if", "(", "nameLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "record", ".", "simpleName", ",", "0", ",", "path", ",", "pos", ",", "nameLength", ")", ";", "pos", "+=", "nameLength", ";", "}", "if", "(", "pos", ">", "0", ")", "{", "accessRestriction", "=", "access", ".", "getViolatedRestriction", "(", "path", ")", ";", "}", "}", "if", "(", "match", "(", "record", ".", "typeSuffix", ",", "record", ".", "modifiers", ")", ")", "{", "nameRequestor", ".", "acceptType", "(", "record", ".", "modifiers", ",", "record", ".", "pkg", ",", "record", ".", "simpleName", ",", "record", ".", "enclosingTypeNames", ",", "documentPath", ",", "accessRestriction", ")", ";", "}", "return", "true", ";", "}", "}", ";", "try", "{", "if", "(", "progressMonitor", "!=", "null", ")", "{", "progressMonitor", ".", "beginTask", "(", "Messages", ".", "engine_searching", ",", "1000", ")", ";", "}", "indexManager", ".", "performConcurrentJob", "(", "new", "PatternSearchJob", "(", "pattern", ",", "getDefaultSearchParticipant", "(", ")", ",", "scope", ",", "searchRequestor", ")", ",", "waitingPolicy", ",", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "progressMonitor", ",", "1000", "-", "copiesLength", ")", ")", ";", "if", "(", "copies", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "copiesLength", ";", "i", "++", ")", "{", "final", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "if", "(", "scope", "instanceof", "HierarchyScope", ")", "{", "if", "(", "!", "(", "(", "HierarchyScope", ")", "scope", ")", ".", "encloses", "(", "workingCopy", ",", "progressMonitor", ")", ")", "continue", ";", "}", "else", "{", "if", "(", "!", "scope", ".", "encloses", "(", "workingCopy", ")", ")", "continue", ";", "}", "final", "String", "path", "=", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "workingCopy", ".", "isConsistent", "(", ")", ")", "{", "IPackageDeclaration", "[", "]", "packageDeclarations", "=", "workingCopy", ".", "getPackageDeclarations", "(", ")", ";", "char", "[", "]", "packageDeclaration", "=", "packageDeclarations", ".", "length", "==", "0", "?", "CharOperation", ".", "NO_CHAR", ":", "packageDeclarations", "[", "0", "]", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "IType", "[", "]", "allTypes", "=", "workingCopy", ".", "getAllTypes", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "allTypesLength", "=", "allTypes", ".", "length", ";", "j", "<", "allTypesLength", ";", "j", "++", ")", "{", "IType", "type", "=", "allTypes", "[", "j", "]", ";", "IJavaElement", "parent", "=", "type", ".", "getParent", "(", ")", ";", "char", "[", "]", "[", "]", "enclosingTypeNames", ";", "if", "(", "parent", "instanceof", "IType", ")", "{", "char", "[", "]", "parentQualifiedName", "=", "(", "(", "IType", ")", "parent", ")", ".", "getTypeQualifiedName", "(", "'.'", ")", ".", "toCharArray", "(", ")", ";", "enclosingTypeNames", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "parentQualifiedName", ")", ";", "}", "else", "{", "enclosingTypeNames", "=", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "char", "[", "]", "simpleName", "=", "type", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "int", "kind", ";", "if", "(", "type", ".", "isEnum", "(", ")", ")", "{", "kind", "=", "TypeDeclaration", ".", "ENUM_DECL", ";", "}", "else", "if", "(", "type", ".", "isAnnotation", "(", ")", ")", "{", "kind", "=", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ";", "}", "else", "if", "(", "type", ".", "isClass", "(", ")", ")", "{", "kind", "=", "TypeDeclaration", ".", "CLASS_DECL", ";", "}", "else", "{", "kind", "=", "TypeDeclaration", ".", "INTERFACE_DECL", ";", "}", "if", "(", "match", "(", "typeSuffix", ",", "packageName", ",", "packageMatchRule", ",", "typeName", ",", "validatedTypeMatchRule", ",", "kind", ",", "packageDeclaration", ",", "simpleName", ")", ")", "{", "if", "(", "nameRequestor", "instanceof", "TypeNameMatchRequestorWrapper", ")", "{", "(", "(", "TypeNameMatchRequestorWrapper", ")", "nameRequestor", ")", ".", "requestor", ".", "acceptTypeNameMatch", "(", "new", "JavaSearchTypeNameMatch", "(", "type", ",", "type", ".", "getFlags", "(", ")", ")", ")", ";", "}", "else", "{", "nameRequestor", ".", "acceptType", "(", "type", ".", "getFlags", "(", ")", ",", "packageDeclaration", ",", "simpleName", ",", "enclosingTypeNames", ",", "path", ",", "null", ")", ";", "}", "}", "}", "}", "else", "{", "Parser", "basicParser", "=", "getParser", "(", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", "unit", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ")", "workingCopy", ";", "CompilationResult", "compilationUnitResult", "=", "new", "CompilationResult", "(", "unit", ",", "0", ",", "0", ",", "this", ".", "compilerOptions", ".", "maxProblemsPerUnit", ")", ";", "CompilationUnitDeclaration", "parsedUnit", "=", "basicParser", ".", "dietParse", "(", "unit", ",", "compilationUnitResult", ")", ";", "if", "(", "parsedUnit", "!=", "null", ")", "{", "final", "char", "[", "]", "packageDeclaration", "=", "parsedUnit", ".", "currentPackage", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "CharOperation", ".", "concatWith", "(", "parsedUnit", ".", "currentPackage", ".", "getImportName", "(", ")", ",", "'.'", ")", ";", "class", "AllTypeDeclarationsVisitor", "extends", "ASTVisitor", "{", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "BlockScope", "blockScope", ")", "{", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "CompilationUnitScope", "compilationUnitScope", ")", "{", "if", "(", "match", "(", "typeSuffix", ",", "packageName", ",", "packageMatchRule", ",", "typeName", ",", "validatedTypeMatchRule", ",", "TypeDeclaration", ".", "kind", "(", "typeDeclaration", ".", "modifiers", ")", ",", "packageDeclaration", ",", "typeDeclaration", ".", "name", ")", ")", "{", "if", "(", "nameRequestor", "instanceof", "TypeNameMatchRequestorWrapper", ")", "{", "IType", "type", "=", "workingCopy", ".", "getType", "(", "new", "String", "(", "typeName", ")", ")", ";", "(", "(", "TypeNameMatchRequestorWrapper", ")", "nameRequestor", ")", ".", "requestor", ".", "acceptTypeNameMatch", "(", "new", "JavaSearchTypeNameMatch", "(", "type", ",", "typeDeclaration", ".", "modifiers", ")", ")", ";", "}", "else", "{", "nameRequestor", ".", "acceptType", "(", "typeDeclaration", ".", "modifiers", ",", "packageDeclaration", ",", "typeDeclaration", ".", "name", ",", "CharOperation", ".", "NO_CHAR_CHAR", ",", "path", ",", "null", ")", ";", "}", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "memberTypeDeclaration", ",", "ClassScope", "classScope", ")", "{", "if", "(", "match", "(", "typeSuffix", ",", "packageName", ",", "packageMatchRule", ",", "typeName", ",", "validatedTypeMatchRule", ",", "TypeDeclaration", ".", "kind", "(", "memberTypeDeclaration", ".", "modifiers", ")", ",", "packageDeclaration", ",", "memberTypeDeclaration", ".", "name", ")", ")", "{", "TypeDeclaration", "enclosing", "=", "memberTypeDeclaration", ".", "enclosingType", ";", "char", "[", "]", "[", "]", "enclosingTypeNames", "=", "CharOperation", ".", "NO_CHAR_CHAR", ";", "while", "(", "enclosing", "!=", "null", ")", "{", "enclosingTypeNames", "=", "CharOperation", ".", "arrayConcat", "(", "new", "char", "[", "]", "[", "]", "{", "enclosing", ".", "name", "}", ",", "enclosingTypeNames", ")", ";", "if", "(", "(", "enclosing", ".", "bits", "&", "ASTNode", ".", "IsMemberType", ")", "!=", "0", ")", "{", "enclosing", "=", "enclosing", ".", "enclosingType", ";", "}", "else", "{", "enclosing", "=", "null", ";", "}", "}", "if", "(", "nameRequestor", "instanceof", "TypeNameMatchRequestorWrapper", ")", "{", "IType", "type", "=", "workingCopy", ".", "getType", "(", "new", "String", "(", "enclosingTypeNames", "[", "0", "]", ")", ")", ";", "for", "(", "int", "j", "=", "1", ",", "l", "=", "enclosingTypeNames", ".", "length", ";", "j", "<", "l", ";", "j", "++", ")", "{", "type", "=", "type", ".", "getType", "(", "new", "String", "(", "enclosingTypeNames", "[", "j", "]", ")", ")", ";", "}", "(", "(", "TypeNameMatchRequestorWrapper", ")", "nameRequestor", ")", ".", "requestor", ".", "acceptTypeNameMatch", "(", "new", "JavaSearchTypeNameMatch", "(", "type", ",", "0", ")", ")", ";", "}", "else", "{", "nameRequestor", ".", "acceptType", "(", "memberTypeDeclaration", ".", "modifiers", ",", "packageDeclaration", ",", "memberTypeDeclaration", ".", "name", ",", "enclosingTypeNames", ",", "path", ",", "null", ")", ";", "}", "}", "return", "true", ";", "}", "}", "parsedUnit", ".", "traverse", "(", "new", "AllTypeDeclarationsVisitor", "(", ")", ",", "parsedUnit", ".", "scope", ")", ";", "}", "}", "if", "(", "progressMonitor", "!=", "null", ")", "{", "if", "(", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "progressMonitor", ".", "worked", "(", "1", ")", ";", "}", "}", "}", "}", "finally", "{", "if", "(", "progressMonitor", "!=", "null", ")", "{", "progressMonitor", ".", "done", "(", ")", ";", "}", "}", "}", "public", "void", "searchAllTypeNames", "(", "final", "char", "[", "]", "[", "]", "qualifications", ",", "final", "char", "[", "]", "[", "]", "typeNames", ",", "final", "int", "matchRule", ",", "int", "searchFor", ",", "IJavaSearchScope", "scope", ",", "final", "IRestrictedAccessTypeRequestor", "nameRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "(", "qualifications", "==", "null", "?", "\"null\"", ":", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "qualifications", ",", "','", ")", ")", ")", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "(", "typeNames", "==", "null", "?", "\"null\"", ":", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "typeNames", ",", "','", ")", ")", ")", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "getMatchRuleString", "(", "matchRule", ")", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "searchFor", ")", ";", "Util", ".", "verbose", "(", "\"t-", "scope:", "\"", "+", "scope", ")", ";", "}", "IndexManager", "indexManager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "final", "char", "typeSuffix", ";", "switch", "(", "searchFor", ")", "{", "case", "IJavaSearchConstants", ".", "CLASS", ":", "typeSuffix", "=", "IIndexConstants", ".", "CLASS_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "CLASS_AND_INTERFACE", ":", "typeSuffix", "=", "IIndexConstants", ".", "CLASS_AND_INTERFACE_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "CLASS_AND_ENUM", ":", "typeSuffix", "=", "IIndexConstants", ".", "CLASS_AND_ENUM_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "INTERFACE", ":", "typeSuffix", "=", "IIndexConstants", ".", "INTERFACE_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "INTERFACE_AND_ANNOTATION", ":", "typeSuffix", "=", "IIndexConstants", ".", "INTERFACE_AND_ANNOTATION_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "ENUM", ":", "typeSuffix", "=", "IIndexConstants", ".", "ENUM_SUFFIX", ";", "break", ";", "case", "IJavaSearchConstants", ".", "ANNOTATION_TYPE", ":", "typeSuffix", "=", "IIndexConstants", ".", "ANNOTATION_TYPE_SUFFIX", ";", "break", ";", "default", ":", "typeSuffix", "=", "IIndexConstants", ".", "TYPE_SUFFIX", ";", "break", ";", "}", "final", "MultiTypeDeclarationPattern", "pattern", "=", "new", "MultiTypeDeclarationPattern", "(", "qualifications", ",", "typeNames", ",", "typeSuffix", ",", "matchRule", ")", ";", "final", "HashSet", "workingCopyPaths", "=", "new", "HashSet", "(", ")", ";", "String", "workingCopyPath", "=", "null", ";", "ICompilationUnit", "[", "]", "copies", "=", "getWorkingCopies", "(", ")", ";", "final", "int", "copiesLength", "=", "copies", "==", "null", "?", "0", ":", "copies", ".", "length", ";", "if", "(", "copies", "!=", "null", ")", "{", "if", "(", "copiesLength", "==", "1", ")", "{", "workingCopyPath", "=", "copies", "[", "0", "]", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "copiesLength", ";", "i", "++", ")", "{", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "workingCopyPaths", ".", "add", "(", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "final", "String", "singleWkcpPath", "=", "workingCopyPath", ";", "IndexQueryRequestor", "searchRequestor", "=", "new", "IndexQueryRequestor", "(", ")", "{", "public", "boolean", "acceptIndexMatch", "(", "String", "documentPath", ",", "SearchPattern", "indexRecord", ",", "SearchParticipant", "participant", ",", "AccessRuleSet", "access", ")", "{", "QualifiedTypeDeclarationPattern", "record", "=", "(", "QualifiedTypeDeclarationPattern", ")", "indexRecord", ";", "if", "(", "record", ".", "enclosingTypeNames", "==", "IIndexConstants", ".", "ONE_ZERO_CHAR", ")", "{", "return", "true", ";", "}", "switch", "(", "copiesLength", ")", "{", "case", "0", ":", "break", ";", "case", "1", ":", "if", "(", "singleWkcpPath", ".", "equals", "(", "documentPath", ")", ")", "{", "return", "true", ";", "}", "break", ";", "default", ":", "if", "(", "workingCopyPaths", ".", "contains", "(", "documentPath", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "AccessRestriction", "accessRestriction", "=", "null", ";", "if", "(", "access", "!=", "null", ")", "{", "int", "qualificationLength", "=", "(", "record", ".", "qualification", "==", "null", "||", "record", ".", "qualification", ".", "length", "==", "0", ")", "?", "0", ":", "record", ".", "qualification", ".", "length", "+", "1", ";", "int", "nameLength", "=", "record", ".", "simpleName", "==", "null", "?", "0", ":", "record", ".", "simpleName", ".", "length", ";", "char", "[", "]", "path", "=", "new", "char", "[", "qualificationLength", "+", "nameLength", "]", ";", "int", "pos", "=", "0", ";", "if", "(", "qualificationLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "record", ".", "qualification", ",", "0", ",", "path", ",", "pos", ",", "qualificationLength", "-", "1", ")", ";", "CharOperation", ".", "replace", "(", "path", ",", "'.'", ",", "'/'", ")", ";", "path", "[", "qualificationLength", "-", "1", "]", "=", "'/'", ";", "pos", "+=", "qualificationLength", ";", "}", "if", "(", "nameLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "record", ".", "simpleName", ",", "0", ",", "path", ",", "pos", ",", "nameLength", ")", ";", "pos", "+=", "nameLength", ";", "}", "if", "(", "pos", ">", "0", ")", "{", "accessRestriction", "=", "access", ".", "getViolatedRestriction", "(", "path", ")", ";", "}", "}", "nameRequestor", ".", "acceptType", "(", "record", ".", "modifiers", ",", "record", ".", "pkg", ",", "record", ".", "simpleName", ",", "record", ".", "enclosingTypeNames", ",", "documentPath", ",", "accessRestriction", ")", ";", "return", "true", ";", "}", "}", ";", "try", "{", "if", "(", "progressMonitor", "!=", "null", ")", "{", "progressMonitor", ".", "beginTask", "(", "Messages", ".", "engine_searching", ",", "100", ")", ";", "}", "indexManager", ".", "performConcurrentJob", "(", "new", "PatternSearchJob", "(", "pattern", ",", "getDefaultSearchParticipant", "(", ")", ",", "scope", ",", "searchRequestor", ")", ",", "waitingPolicy", ",", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "progressMonitor", ",", "100", ")", ")", ";", "if", "(", "copies", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "copies", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "final", "String", "path", "=", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "workingCopy", ".", "isConsistent", "(", ")", ")", "{", "IPackageDeclaration", "[", "]", "packageDeclarations", "=", "workingCopy", ".", "getPackageDeclarations", "(", ")", ";", "char", "[", "]", "packageDeclaration", "=", "packageDeclarations", ".", "length", "==", "0", "?", "CharOperation", ".", "NO_CHAR", ":", "packageDeclarations", "[", "0", "]", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "IType", "[", "]", "allTypes", "=", "workingCopy", ".", "getAllTypes", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "allTypesLength", "=", "allTypes", ".", "length", ";", "j", "<", "allTypesLength", ";", "j", "++", ")", "{", "IType", "type", "=", "allTypes", "[", "j", "]", ";", "IJavaElement", "parent", "=", "type", ".", "getParent", "(", ")", ";", "char", "[", "]", "[", "]", "enclosingTypeNames", ";", "char", "[", "]", "qualification", "=", "packageDeclaration", ";", "if", "(", "parent", "instanceof", "IType", ")", "{", "char", "[", "]", "parentQualifiedName", "=", "(", "(", "IType", ")", "parent", ")", ".", "getTypeQualifiedName", "(", "'.'", ")", ".", "toCharArray", "(", ")", ";", "enclosingTypeNames", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "parentQualifiedName", ")", ";", "qualification", "=", "CharOperation", ".", "concat", "(", "qualification", ",", "parentQualifiedName", ")", ";", "}", "else", "{", "enclosingTypeNames", "=", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "char", "[", "]", "simpleName", "=", "type", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "char", "suffix", "=", "IIndexConstants", ".", "TYPE_SUFFIX", ";", "if", "(", "type", ".", "isClass", "(", ")", ")", "{", "suffix", "=", "IIndexConstants", ".", "CLASS_SUFFIX", ";", "}", "else", "if", "(", "type", ".", "isInterface", "(", ")", ")", "{", "suffix", "=", "IIndexConstants", ".", "INTERFACE_SUFFIX", ";", "}", "else", "if", "(", "type", ".", "isEnum", "(", ")", ")", "{", "suffix", "=", "IIndexConstants", ".", "ENUM_SUFFIX", ";", "}", "else", "if", "(", "type", ".", "isAnnotation", "(", ")", ")", "{", "suffix", "=", "IIndexConstants", ".", "ANNOTATION_TYPE_SUFFIX", ";", "}", "if", "(", "pattern", ".", "matchesDecodedKey", "(", "new", "QualifiedTypeDeclarationPattern", "(", "qualification", ",", "simpleName", ",", "suffix", ",", "matchRule", ")", ")", ")", "{", "nameRequestor", ".", "acceptType", "(", "type", ".", "getFlags", "(", ")", ",", "packageDeclaration", ",", "simpleName", ",", "enclosingTypeNames", ",", "path", ",", "null", ")", ";", "}", "}", "}", "else", "{", "Parser", "basicParser", "=", "getParser", "(", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", "unit", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ")", "workingCopy", ";", "CompilationResult", "compilationUnitResult", "=", "new", "CompilationResult", "(", "unit", ",", "0", ",", "0", ",", "this", ".", "compilerOptions", ".", "maxProblemsPerUnit", ")", ";", "CompilationUnitDeclaration", "parsedUnit", "=", "basicParser", ".", "dietParse", "(", "unit", ",", "compilationUnitResult", ")", ";", "if", "(", "parsedUnit", "!=", "null", ")", "{", "final", "char", "[", "]", "packageDeclaration", "=", "parsedUnit", ".", "currentPackage", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "CharOperation", ".", "concatWith", "(", "parsedUnit", ".", "currentPackage", ".", "getImportName", "(", ")", ",", "'.'", ")", ";", "class", "AllTypeDeclarationsVisitor", "extends", "ASTVisitor", "{", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "BlockScope", "blockScope", ")", "{", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "CompilationUnitScope", "compilationUnitScope", ")", "{", "SearchPattern", "decodedPattern", "=", "new", "QualifiedTypeDeclarationPattern", "(", "packageDeclaration", ",", "typeDeclaration", ".", "name", ",", "convertTypeKind", "(", "TypeDeclaration", ".", "kind", "(", "typeDeclaration", ".", "modifiers", ")", ")", ",", "matchRule", ")", ";", "if", "(", "pattern", ".", "matchesDecodedKey", "(", "decodedPattern", ")", ")", "{", "nameRequestor", ".", "acceptType", "(", "typeDeclaration", ".", "modifiers", ",", "packageDeclaration", ",", "typeDeclaration", ".", "name", ",", "CharOperation", ".", "NO_CHAR_CHAR", ",", "path", ",", "null", ")", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "memberTypeDeclaration", ",", "ClassScope", "classScope", ")", "{", "char", "[", "]", "qualification", "=", "packageDeclaration", ";", "TypeDeclaration", "enclosing", "=", "memberTypeDeclaration", ".", "enclosingType", ";", "char", "[", "]", "[", "]", "enclosingTypeNames", "=", "CharOperation", ".", "NO_CHAR_CHAR", ";", "while", "(", "enclosing", "!=", "null", ")", "{", "qualification", "=", "CharOperation", ".", "concat", "(", "qualification", ",", "enclosing", ".", "name", ",", "'.'", ")", ";", "enclosingTypeNames", "=", "CharOperation", ".", "arrayConcat", "(", "new", "char", "[", "]", "[", "]", "{", "enclosing", ".", "name", "}", ",", "enclosingTypeNames", ")", ";", "if", "(", "(", "enclosing", ".", "bits", "&", "ASTNode", ".", "IsMemberType", ")", "!=", "0", ")", "{", "enclosing", "=", "enclosing", ".", "enclosingType", ";", "}", "else", "{", "enclosing", "=", "null", ";", "}", "}", "SearchPattern", "decodedPattern", "=", "new", "QualifiedTypeDeclarationPattern", "(", "qualification", ",", "memberTypeDeclaration", ".", "name", ",", "convertTypeKind", "(", "TypeDeclaration", ".", "kind", "(", "memberTypeDeclaration", ".", "modifiers", ")", ")", ",", "matchRule", ")", ";", "if", "(", "pattern", ".", "matchesDecodedKey", "(", "decodedPattern", ")", ")", "{", "nameRequestor", ".", "acceptType", "(", "memberTypeDeclaration", ".", "modifiers", ",", "packageDeclaration", ",", "memberTypeDeclaration", ".", "name", ",", "enclosingTypeNames", ",", "path", ",", "null", ")", ";", "}", "return", "true", ";", "}", "}", "parsedUnit", ".", "traverse", "(", "new", "AllTypeDeclarationsVisitor", "(", ")", ",", "parsedUnit", ".", "scope", ")", ";", "}", "}", "}", "}", "}", "finally", "{", "if", "(", "progressMonitor", "!=", "null", ")", "{", "progressMonitor", ".", "done", "(", ")", ";", "}", "}", "}", "public", "void", "searchDeclarations", "(", "IJavaElement", "enclosingElement", ",", "SearchRequestor", "requestor", ",", "SearchPattern", "pattern", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "enclosingElement", ")", ";", "}", "IJavaSearchScope", "scope", "=", "createJavaSearchScope", "(", "new", "IJavaElement", "[", "]", "{", "enclosingElement", "}", ")", ";", "IResource", "resource", "=", "(", "(", "JavaElement", ")", "enclosingElement", ")", ".", "resource", "(", ")", ";", "if", "(", "enclosingElement", "instanceof", "IMember", ")", "{", "IMember", "member", "=", "(", "IMember", ")", "enclosingElement", ";", "ICompilationUnit", "cu", "=", "member", ".", "getCompilationUnit", "(", ")", ";", "if", "(", "cu", "!=", "null", ")", "{", "resource", "=", "cu", ".", "getResource", "(", ")", ";", "}", "else", "if", "(", "member", ".", "isBinary", "(", ")", ")", "{", "resource", "=", "null", ";", "}", "}", "try", "{", "if", "(", "resource", "instanceof", "IFile", ")", "{", "try", "{", "requestor", ".", "beginReporting", "(", ")", ";", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "pattern", "+", "\"", "in", "\"", "+", "resource", ".", "getFullPath", "(", ")", ")", ";", "}", "SearchParticipant", "participant", "=", "getDefaultSearchParticipant", "(", ")", ";", "SearchDocument", "[", "]", "documents", "=", "MatchLocator", ".", "addWorkingCopies", "(", "pattern", ",", "new", "SearchDocument", "[", "]", "{", "new", "JavaSearchDocument", "(", "enclosingElement", ".", "getPath", "(", ")", ".", "toString", "(", ")", ",", "participant", ")", "}", ",", "getWorkingCopies", "(", "enclosingElement", ")", ",", "participant", ")", ";", "participant", ".", "locateMatches", "(", "documents", ",", "pattern", ",", "scope", ",", "requestor", ",", "monitor", ")", ";", "}", "finally", "{", "requestor", ".", "endReporting", "(", ")", ";", "}", "}", "else", "{", "search", "(", "pattern", ",", "new", "SearchParticipant", "[", "]", "{", "getDefaultSearchParticipant", "(", ")", "}", ",", "scope", ",", "requestor", ",", "monitor", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "e", "instanceof", "JavaModelException", ")", "throw", "(", "JavaModelException", ")", "e", ";", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "public", "void", "searchDeclarationsOfAccessedFields", "(", "IJavaElement", "enclosingElement", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "switch", "(", "enclosingElement", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "METHOD", ":", "case", "IJavaElement", ".", "TYPE", ":", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "SearchPattern", "pattern", "=", "new", "DeclarationOfAccessedFieldsPattern", "(", "enclosingElement", ")", ";", "searchDeclarations", "(", "enclosingElement", ",", "requestor", ",", "pattern", ",", "monitor", ")", ";", "}", "public", "void", "searchDeclarationsOfReferencedTypes", "(", "IJavaElement", "enclosingElement", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "switch", "(", "enclosingElement", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "METHOD", ":", "case", "IJavaElement", ".", "TYPE", ":", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "SearchPattern", "pattern", "=", "new", "DeclarationOfReferencedTypesPattern", "(", "enclosingElement", ")", ";", "searchDeclarations", "(", "enclosingElement", ",", "requestor", ",", "pattern", ",", "monitor", ")", ";", "}", "public", "void", "searchDeclarationsOfSentMessages", "(", "IJavaElement", "enclosingElement", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "switch", "(", "enclosingElement", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "METHOD", ":", "case", "IJavaElement", ".", "TYPE", ":", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "SearchPattern", "pattern", "=", "new", "DeclarationOfReferencedMethodsPattern", "(", "enclosingElement", ")", ";", "searchDeclarations", "(", "enclosingElement", ",", "requestor", ",", "pattern", ",", "monitor", ")", ";", "}", "}", "</s>" ]
2,511
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRestriction", ";", "public", "interface", "IRestrictedAccessTypeRequestor", "{", "public", "void", "acceptType", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ",", "AccessRestriction", "access", ")", ";", "}", "</s>" ]
2,512
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "java", ".", "util", ".", "LinkedHashSet", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFolder", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "ObjectVector", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JarPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModel", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "ReferenceCollection", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "State", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "IndexLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IndexManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocator", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MethodPattern", ";", "public", "class", "IndexSelector", "{", "IJavaSearchScope", "searchScope", ";", "SearchPattern", "pattern", ";", "IndexLocation", "[", "]", "indexLocations", ";", "public", "IndexSelector", "(", "IJavaSearchScope", "searchScope", ",", "SearchPattern", "pattern", ")", "{", "this", ".", "searchScope", "=", "searchScope", ";", "this", ".", "pattern", "=", "pattern", ";", "}", "public", "static", "boolean", "canSeeFocus", "(", "SearchPattern", "pattern", ",", "IPath", "projectOrJarPath", ")", "{", "try", "{", "IJavaModel", "model", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ";", "IJavaProject", "project", "=", "getJavaProject", "(", "projectOrJarPath", ",", "model", ")", ";", "IJavaElement", "[", "]", "focuses", "=", "getFocusedElementsAndTypes", "(", "pattern", ",", "project", ",", "null", ")", ";", "if", "(", "focuses", ".", "length", "==", "0", ")", "return", "false", ";", "if", "(", "project", "!=", "null", ")", "{", "return", "canSeeFocus", "(", "focuses", ",", "(", "JavaProject", ")", "project", ",", "null", ")", ";", "}", "IJavaProject", "[", "]", "allProjects", "=", "model", ".", "getJavaProjects", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "allProjects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JavaProject", "otherProject", "=", "(", "JavaProject", ")", "allProjects", "[", "i", "]", ";", "IClasspathEntry", "entry", "=", "otherProject", ".", "getClasspathEntryFor", "(", "projectOrJarPath", ")", ";", "if", "(", "entry", "!=", "null", "&&", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "if", "(", "canSeeFocus", "(", "focuses", ",", "otherProject", ",", "null", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "private", "static", "boolean", "canSeeFocus", "(", "IJavaElement", "[", "]", "focuses", ",", "JavaProject", "javaProject", ",", "char", "[", "]", "[", "]", "[", "]", "focusQualifiedNames", ")", "{", "int", "length", "=", "focuses", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "canSeeFocus", "(", "focuses", "[", "i", "]", ",", "javaProject", ",", "focusQualifiedNames", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "private", "static", "boolean", "canSeeFocus", "(", "IJavaElement", "focus", ",", "JavaProject", "javaProject", ",", "char", "[", "]", "[", "]", "[", "]", "focusQualifiedNames", ")", "{", "try", "{", "if", "(", "focus", "==", "null", ")", "return", "false", ";", "if", "(", "focus", ".", "equals", "(", "javaProject", ")", ")", "return", "true", ";", "if", "(", "focus", "instanceof", "JarPackageFragmentRoot", ")", "{", "IPath", "focusPath", "=", "focus", ".", "getPath", "(", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "javaProject", ".", "getExpandedClasspath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "entries", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", "&&", "entry", ".", "getPath", "(", ")", ".", "equals", "(", "focusPath", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "IPath", "focusPath", "=", "(", "(", "JavaProject", ")", "focus", ")", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "javaProject", ".", "getExpandedClasspath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "entries", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_PROJECT", "&&", "entry", ".", "getPath", "(", ")", ".", "equals", "(", "focusPath", ")", ")", "{", "if", "(", "focusQualifiedNames", "!=", "null", ")", "{", "State", "projectState", "=", "(", "State", ")", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getLastBuiltState", "(", "javaProject", ".", "getProject", "(", ")", ",", "null", ")", ";", "if", "(", "projectState", "!=", "null", ")", "{", "Object", "[", "]", "values", "=", "projectState", ".", "getReferences", "(", ")", ".", "valueTable", ";", "int", "vLength", "=", "values", ".", "length", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "vLength", ";", "j", "++", ")", "{", "if", "(", "values", "[", "j", "]", "==", "null", ")", "continue", ";", "ReferenceCollection", "references", "=", "(", "ReferenceCollection", ")", "values", "[", "j", "]", ";", "if", "(", "references", ".", "includes", "(", "focusQualifiedNames", ",", "null", ",", "null", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "}", "return", "true", ";", "}", "}", "return", "false", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "private", "static", "IJavaElement", "[", "]", "getFocusedElementsAndTypes", "(", "SearchPattern", "pattern", ",", "IJavaElement", "focusElement", ",", "ObjectVector", "superTypes", ")", "throws", "JavaModelException", "{", "if", "(", "pattern", "instanceof", "MethodPattern", ")", "{", "IType", "type", "=", "(", "IType", ")", "pattern", ".", "focus", ".", "getAncestor", "(", "IJavaElement", ".", "TYPE", ")", ";", "MethodPattern", "methodPattern", "=", "(", "MethodPattern", ")", "pattern", ";", "String", "selector", "=", "new", "String", "(", "methodPattern", ".", "selector", ")", ";", "int", "parameterCount", "=", "methodPattern", ".", "parameterCount", ";", "ITypeHierarchy", "superHierarchy", "=", "type", ".", "newSupertypeHierarchy", "(", "null", ")", ";", "IType", "[", "]", "allTypes", "=", "superHierarchy", ".", "getAllSupertypes", "(", "type", ")", ";", "int", "length", "=", "allTypes", ".", "length", ";", "SimpleSet", "focusSet", "=", "new", "SimpleSet", "(", "length", "+", "1", ")", ";", "if", "(", "focusElement", "!=", "null", ")", "focusSet", ".", "add", "(", "focusElement", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IMethod", "[", "]", "methods", "=", "allTypes", "[", "i", "]", ".", "getMethods", "(", ")", ";", "int", "mLength", "=", "methods", ".", "length", ";", "for", "(", "int", "m", "=", "0", ";", "m", "<", "mLength", ";", "m", "++", ")", "{", "if", "(", "parameterCount", "==", "methods", "[", "m", "]", ".", "getNumberOfParameters", "(", ")", "&&", "methods", "[", "m", "]", ".", "getElementName", "(", ")", ".", "equals", "(", "selector", ")", ")", "{", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "allTypes", "[", "i", "]", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "IJavaElement", "element", "=", "root", ".", "isArchive", "(", ")", "?", "root", ":", "root", ".", "getParent", "(", ")", ";", "focusSet", ".", "add", "(", "element", ")", ";", "if", "(", "superTypes", "!=", "null", ")", "superTypes", ".", "add", "(", "allTypes", "[", "i", "]", ")", ";", "break", ";", "}", "}", "}", "IJavaElement", "[", "]", "focuses", "=", "new", "IJavaElement", "[", "focusSet", ".", "elementSize", "]", ";", "Object", "[", "]", "values", "=", "focusSet", ".", "values", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "values", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "{", "if", "(", "values", "[", "i", "]", "!=", "null", ")", "{", "focuses", "[", "count", "++", "]", "=", "(", "IJavaElement", ")", "values", "[", "i", "]", ";", "}", "}", "return", "focuses", ";", "}", "if", "(", "focusElement", "==", "null", ")", "return", "new", "IJavaElement", "[", "0", "]", ";", "return", "new", "IJavaElement", "[", "]", "{", "focusElement", "}", ";", "}", "private", "void", "initializeIndexLocations", "(", ")", "{", "IPath", "[", "]", "projectsAndJars", "=", "this", ".", "searchScope", ".", "enclosingProjectsAndJars", "(", ")", ";", "IndexManager", "manager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "LinkedHashSet", "locations", "=", "new", "LinkedHashSet", "(", ")", ";", "IJavaElement", "focus", "=", "MatchLocator", ".", "projectOrJarFocus", "(", "this", ".", "pattern", ")", ";", "if", "(", "focus", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projectsAndJars", ".", "length", ";", "i", "++", ")", "{", "IPath", "path", "=", "projectsAndJars", "[", "i", "]", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "false", ")", ";", "if", "(", "target", "instanceof", "IFolder", ")", "path", "=", "(", "(", "IFolder", ")", "target", ")", ".", "getFullPath", "(", ")", ";", "locations", ".", "add", "(", "manager", ".", "computeIndexLocation", "(", "path", ")", ")", ";", "}", "}", "else", "{", "try", "{", "int", "length", "=", "projectsAndJars", ".", "length", ";", "JavaProject", "[", "]", "projectsCanSeeFocus", "=", "new", "JavaProject", "[", "length", "]", ";", "SimpleSet", "visitedProjects", "=", "new", "SimpleSet", "(", "length", ")", ";", "int", "projectIndex", "=", "0", ";", "SimpleSet", "externalLibsToCheck", "=", "new", "SimpleSet", "(", "length", ")", ";", "ObjectVector", "superTypes", "=", "new", "ObjectVector", "(", ")", ";", "IJavaElement", "[", "]", "focuses", "=", "getFocusedElementsAndTypes", "(", "this", ".", "pattern", ",", "focus", ",", "superTypes", ")", ";", "char", "[", "]", "[", "]", "[", "]", "focusQualifiedNames", "=", "null", ";", "boolean", "isAutoBuilding", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getDescription", "(", ")", ".", "isAutoBuilding", "(", ")", ";", "if", "(", "isAutoBuilding", "&&", "focus", "instanceof", "IJavaProject", ")", "{", "focusQualifiedNames", "=", "getQualifiedNames", "(", "superTypes", ")", ";", "}", "IJavaModel", "model", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IPath", "path", "=", "projectsAndJars", "[", "i", "]", ";", "JavaProject", "project", "=", "(", "JavaProject", ")", "getJavaProject", "(", "path", ",", "model", ")", ";", "if", "(", "project", "!=", "null", ")", "{", "visitedProjects", ".", "add", "(", "project", ")", ";", "if", "(", "canSeeFocus", "(", "focuses", ",", "project", ",", "focusQualifiedNames", ")", ")", "{", "locations", ".", "add", "(", "manager", ".", "computeIndexLocation", "(", "path", ")", ")", ";", "projectsCanSeeFocus", "[", "projectIndex", "++", "]", "=", "project", ";", "}", "}", "else", "{", "externalLibsToCheck", ".", "add", "(", "path", ")", ";", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projectIndex", "&&", "externalLibsToCheck", ".", "elementSize", ">", "0", ";", "i", "++", ")", "{", "IClasspathEntry", "[", "]", "entries", "=", "projectsCanSeeFocus", "[", "i", "]", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "j", "=", "entries", ".", "length", ";", "--", "j", ">=", "0", ";", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "j", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "externalLibsToCheck", ".", "remove", "(", "path", ")", "!=", "null", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "false", ")", ";", "if", "(", "target", "instanceof", "IFolder", ")", "path", "=", "(", "(", "IFolder", ")", "target", ")", ".", "getFullPath", "(", ")", ";", "locations", ".", "add", "(", "manager", ".", "computeIndexLocation", "(", "path", ")", ")", ";", "}", "}", "}", "}", "if", "(", "externalLibsToCheck", ".", "elementSize", ">", "0", ")", "{", "IJavaProject", "[", "]", "allProjects", "=", "model", ".", "getJavaProjects", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "allProjects", ".", "length", ";", "i", "<", "l", "&&", "externalLibsToCheck", ".", "elementSize", ">", "0", ";", "i", "++", ")", "{", "JavaProject", "project", "=", "(", "JavaProject", ")", "allProjects", "[", "i", "]", ";", "if", "(", "!", "visitedProjects", ".", "includes", "(", "project", ")", ")", "{", "IClasspathEntry", "[", "]", "entries", "=", "project", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "j", "=", "entries", ".", "length", ";", "--", "j", ">=", "0", ";", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "j", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "externalLibsToCheck", ".", "remove", "(", "path", ")", "!=", "null", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "false", ")", ";", "if", "(", "target", "instanceof", "IFolder", ")", "path", "=", "(", "(", "IFolder", ")", "target", ")", ".", "getFullPath", "(", ")", ";", "locations", ".", "add", "(", "manager", ".", "computeIndexLocation", "(", "path", ")", ")", ";", "}", "}", "}", "}", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "locations", ".", "remove", "(", "null", ")", ";", "this", ".", "indexLocations", "=", "(", "IndexLocation", "[", "]", ")", "locations", ".", "toArray", "(", "new", "IndexLocation", "[", "locations", ".", "size", "(", ")", "]", ")", ";", "}", "public", "IndexLocation", "[", "]", "getIndexLocations", "(", ")", "{", "if", "(", "this", ".", "indexLocations", "==", "null", ")", "{", "initializeIndexLocations", "(", ")", ";", "}", "return", "this", ".", "indexLocations", ";", "}", "private", "static", "IJavaProject", "getJavaProject", "(", "IPath", "path", ",", "IJavaModel", "model", ")", "{", "IJavaProject", "project", "=", "model", ".", "getJavaProject", "(", "path", ".", "lastSegment", "(", ")", ")", ";", "if", "(", "project", ".", "exists", "(", ")", ")", "{", "return", "project", ";", "}", "return", "null", ";", "}", "private", "char", "[", "]", "[", "]", "[", "]", "getQualifiedNames", "(", "ObjectVector", "types", ")", "{", "final", "int", "size", "=", "types", ".", "size", ";", "char", "[", "]", "[", "]", "[", "]", "focusQualifiedNames", "=", "null", ";", "IJavaElement", "javaElement", "=", "this", ".", "pattern", ".", "focus", ";", "int", "index", "=", "0", ";", "while", "(", "javaElement", "!=", "null", "&&", "!", "(", "javaElement", "instanceof", "ITypeRoot", ")", ")", "{", "javaElement", "=", "javaElement", ".", "getParent", "(", ")", ";", "}", "if", "(", "javaElement", "!=", "null", ")", "{", "IType", "primaryType", "=", "(", "(", "ITypeRoot", ")", "javaElement", ")", ".", "findPrimaryType", "(", ")", ";", "if", "(", "primaryType", "!=", "null", ")", "{", "focusQualifiedNames", "=", "new", "char", "[", "size", "+", "1", "]", "[", "]", "[", "]", ";", "focusQualifiedNames", "[", "index", "++", "]", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "primaryType", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "}", "}", "if", "(", "focusQualifiedNames", "==", "null", ")", "{", "focusQualifiedNames", "=", "new", "char", "[", "size", "]", "[", "]", "[", "]", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "focusQualifiedNames", "[", "index", "++", "]", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "(", "(", "IType", ")", "(", "types", ".", "elementAt", "(", "i", ")", ")", ")", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "}", "return", "focusQualifiedNames", ".", "length", "==", "0", "?", "null", ":", "ReferenceCollection", ".", "internQualifiedNames", "(", "focusQualifiedNames", ",", "true", ")", ";", "}", "}", "</s>" ]
2,513
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ".", "TypeHierarchy", ";", "public", "class", "HierarchyScope", "extends", "AbstractSearchScope", "implements", "SuffixConstants", "{", "public", "IType", "focusType", ";", "private", "String", "focusPath", ";", "private", "WorkingCopyOwner", "owner", ";", "private", "ITypeHierarchy", "hierarchy", ";", "private", "HashSet", "resourcePaths", ";", "private", "IPath", "[", "]", "enclosingProjectsAndJars", ";", "protected", "IResource", "[", "]", "elements", ";", "protected", "int", "elementCount", ";", "public", "boolean", "needsRefresh", ";", "private", "HashSet", "subTypes", "=", "null", ";", "private", "IJavaProject", "javaProject", "=", "null", ";", "private", "boolean", "allowMemberAndEnclosingTypes", "=", "true", ";", "private", "boolean", "includeFocusType", "=", "true", ";", "public", "void", "add", "(", "IResource", "element", ")", "{", "if", "(", "this", ".", "elementCount", "==", "this", ".", "elements", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "elements", ",", "0", ",", "this", ".", "elements", "=", "new", "IResource", "[", "this", ".", "elementCount", "*", "2", "]", ",", "0", ",", "this", ".", "elementCount", ")", ";", "}", "this", ".", "elements", "[", "this", ".", "elementCount", "++", "]", "=", "element", ";", "}", "public", "HierarchyScope", "(", "IJavaProject", "project", ",", "IType", "type", ",", "WorkingCopyOwner", "owner", ",", "boolean", "onlySubtypes", ",", "boolean", "noMembersOrEnclosingTypes", ",", "boolean", "includeFocusType", ")", "throws", "JavaModelException", "{", "this", "(", "type", ",", "owner", ")", ";", "this", ".", "javaProject", "=", "project", ";", "if", "(", "onlySubtypes", ")", "{", "this", ".", "subTypes", "=", "new", "HashSet", "(", ")", ";", "}", "this", ".", "includeFocusType", "=", "includeFocusType", ";", "this", ".", "allowMemberAndEnclosingTypes", "=", "!", "noMembersOrEnclosingTypes", ";", "}", "public", "HierarchyScope", "(", "IType", "type", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "this", ".", "focusType", "=", "type", ";", "this", ".", "owner", "=", "owner", ";", "this", ".", "enclosingProjectsAndJars", "=", "computeProjectsAndJars", "(", "type", ")", ";", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "type", ".", "getPackageFragment", "(", ")", ".", "getParent", "(", ")", ";", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "IPath", "jarPath", "=", "root", ".", "getPath", "(", ")", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "jarPath", ",", "true", ")", ";", "String", "zipFileName", ";", "if", "(", "target", "instanceof", "IFile", ")", "{", "zipFileName", "=", "jarPath", ".", "toString", "(", ")", ";", "}", "else", "if", "(", "target", "instanceof", "File", ")", "{", "zipFileName", "=", "(", "(", "File", ")", "target", ")", ".", "getPath", "(", ")", ";", "}", "else", "{", "return", ";", "}", "this", ".", "focusPath", "=", "zipFileName", "+", "JAR_FILE_ENTRY_SEPARATOR", "+", "type", ".", "getFullyQualifiedName", "(", ")", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "SUFFIX_STRING_class", ";", "}", "else", "{", "this", ".", "focusPath", "=", "type", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "}", "this", ".", "needsRefresh", "=", "true", ";", "}", "private", "void", "buildResourceVector", "(", ")", "{", "HashMap", "resources", "=", "new", "HashMap", "(", ")", ";", "HashMap", "paths", "=", "new", "HashMap", "(", ")", ";", "IType", "[", "]", "types", "=", "null", ";", "if", "(", "this", ".", "subTypes", "!=", "null", ")", "{", "types", "=", "this", ".", "hierarchy", ".", "getAllSubtypes", "(", "this", ".", "focusType", ")", ";", "if", "(", "this", ".", "includeFocusType", ")", "{", "int", "len", "=", "types", ".", "length", ";", "System", ".", "arraycopy", "(", "types", ",", "0", ",", "types", "=", "new", "IType", "[", "len", "+", "1", "]", ",", "0", ",", "len", ")", ";", "types", "[", "len", "]", "=", "this", ".", "focusType", ";", "}", "}", "else", "{", "types", "=", "this", ".", "hierarchy", ".", "getAllTypes", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "types", "[", "i", "]", ";", "if", "(", "this", ".", "subTypes", "!=", "null", ")", "{", "this", ".", "subTypes", ".", "add", "(", "type", ")", ";", "}", "IResource", "resource", "=", "(", "(", "JavaElement", ")", "type", ")", ".", "resource", "(", ")", ";", "if", "(", "resource", "!=", "null", "&&", "resources", ".", "get", "(", "resource", ")", "==", "null", ")", "{", "resources", ".", "put", "(", "resource", ",", "resource", ")", ";", "add", "(", "resource", ")", ";", "}", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "type", ".", "getPackageFragment", "(", ")", ".", "getParent", "(", ")", ";", "if", "(", "root", "instanceof", "JarPackageFragmentRoot", ")", "{", "JarPackageFragmentRoot", "jar", "=", "(", "JarPackageFragmentRoot", ")", "root", ";", "IPath", "jarPath", "=", "jar", ".", "getPath", "(", ")", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "jarPath", ",", "true", ")", ";", "String", "zipFileName", ";", "if", "(", "target", "instanceof", "IFile", ")", "{", "zipFileName", "=", "jarPath", ".", "toString", "(", ")", ";", "}", "else", "if", "(", "target", "instanceof", "File", ")", "{", "zipFileName", "=", "(", "(", "File", ")", "target", ")", ".", "getPath", "(", ")", ";", "}", "else", "{", "continue", ";", "}", "String", "resourcePath", "=", "zipFileName", "+", "JAR_FILE_ENTRY_SEPARATOR", "+", "type", ".", "getFullyQualifiedName", "(", ")", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "SUFFIX_STRING_class", ";", "this", ".", "resourcePaths", ".", "add", "(", "resourcePath", ")", ";", "paths", ".", "put", "(", "jarPath", ",", "type", ")", ";", "}", "else", "{", "paths", ".", "put", "(", "type", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ",", "type", ")", ";", "}", "}", "this", ".", "enclosingProjectsAndJars", "=", "new", "IPath", "[", "paths", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Iterator", "iter", "=", "paths", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "this", ".", "enclosingProjectsAndJars", "[", "i", "++", "]", "=", "(", "IPath", ")", "iter", ".", "next", "(", ")", ";", "}", "}", "private", "IPath", "[", "]", "computeProjectsAndJars", "(", "IType", "type", ")", "throws", "JavaModelException", "{", "HashSet", "set", "=", "new", "HashSet", "(", ")", ";", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "type", ".", "getPackageFragment", "(", ")", ".", "getParent", "(", ")", ";", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "set", ".", "add", "(", "root", ".", "getPath", "(", ")", ")", ";", "IPath", "rootPath", "=", "root", ".", "getPath", "(", ")", ";", "IJavaModel", "model", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ";", "IJavaProject", "[", "]", "projects", "=", "model", ".", "getJavaProjects", "(", ")", ";", "HashSet", "visited", "=", "new", "HashSet", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projects", ".", "length", ";", "i", "++", ")", "{", "JavaProject", "project", "=", "(", "JavaProject", ")", "projects", "[", "i", "]", ";", "IClasspathEntry", "entry", "=", "project", ".", "getClasspathEntryFor", "(", "rootPath", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "IPackageFragmentRoot", "[", "]", "roots", "=", "project", ".", "getAllPackageFragmentRoots", "(", ")", ";", "set", ".", "add", "(", "project", ".", "getPath", "(", ")", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "roots", ".", "length", ";", "k", "++", ")", "{", "IPackageFragmentRoot", "pkgFragmentRoot", "=", "roots", "[", "k", "]", ";", "if", "(", "pkgFragmentRoot", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_BINARY", ")", "{", "set", ".", "add", "(", "pkgFragmentRoot", ".", "getPath", "(", ")", ")", ";", "}", "}", "computeDependents", "(", "project", ",", "set", ",", "visited", ")", ";", "}", "}", "}", "else", "{", "IJavaProject", "project", "=", "(", "IJavaProject", ")", "root", ".", "getParent", "(", ")", ";", "IPackageFragmentRoot", "[", "]", "roots", "=", "project", ".", "getAllPackageFragmentRoots", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "roots", ".", "length", ";", "i", "++", ")", "{", "IPackageFragmentRoot", "pkgFragmentRoot", "=", "roots", "[", "i", "]", ";", "if", "(", "pkgFragmentRoot", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_BINARY", ")", "{", "set", ".", "add", "(", "pkgFragmentRoot", ".", "getPath", "(", ")", ")", ";", "}", "else", "{", "set", ".", "add", "(", "pkgFragmentRoot", ".", "getParent", "(", ")", ".", "getPath", "(", ")", ")", ";", "}", "}", "computeDependents", "(", "project", ",", "set", ",", "new", "HashSet", "(", ")", ")", ";", "}", "IPath", "[", "]", "result", "=", "new", "IPath", "[", "set", ".", "size", "(", ")", "]", ";", "set", ".", "toArray", "(", "result", ")", ";", "return", "result", ";", "}", "private", "void", "computeDependents", "(", "IJavaProject", "project", ",", "HashSet", "set", ",", "HashSet", "visited", ")", "{", "if", "(", "visited", ".", "contains", "(", "project", ")", ")", "return", ";", "visited", ".", "add", "(", "project", ")", ";", "IProject", "[", "]", "dependents", "=", "project", ".", "getProject", "(", ")", ".", "getReferencingProjects", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dependents", ".", "length", ";", "i", "++", ")", "{", "try", "{", "IJavaProject", "dependent", "=", "JavaCore", ".", "create", "(", "dependents", "[", "i", "]", ")", ";", "IPackageFragmentRoot", "[", "]", "roots", "=", "dependent", ".", "getPackageFragmentRoots", "(", ")", ";", "set", ".", "add", "(", "dependent", ".", "getPath", "(", ")", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "roots", ".", "length", ";", "j", "++", ")", "{", "IPackageFragmentRoot", "pkgFragmentRoot", "=", "roots", "[", "j", "]", ";", "if", "(", "pkgFragmentRoot", ".", "isArchive", "(", ")", ")", "{", "set", ".", "add", "(", "pkgFragmentRoot", ".", "getPath", "(", ")", ")", ";", "}", "}", "computeDependents", "(", "dependent", ",", "set", ",", "visited", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "public", "boolean", "encloses", "(", "String", "resourcePath", ")", "{", "return", "encloses", "(", "resourcePath", ",", "null", ")", ";", "}", "public", "boolean", "encloses", "(", "String", "resourcePath", ",", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "hierarchy", "==", "null", ")", "{", "if", "(", "resourcePath", ".", "equals", "(", "this", ".", "focusPath", ")", ")", "{", "return", "true", ";", "}", "else", "{", "if", "(", "this", ".", "needsRefresh", ")", "{", "try", "{", "initialize", "(", "progressMonitor", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "else", "{", "return", "true", ";", "}", "}", "}", "if", "(", "this", ".", "needsRefresh", ")", "{", "try", "{", "refresh", "(", "progressMonitor", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "int", "separatorIndex", "=", "resourcePath", ".", "indexOf", "(", "JAR_FILE_ENTRY_SEPARATOR", ")", ";", "if", "(", "separatorIndex", "!=", "-", "1", ")", "{", "return", "this", ".", "resourcePaths", ".", "contains", "(", "resourcePath", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "elementCount", ";", "i", "++", ")", "{", "if", "(", "resourcePath", ".", "startsWith", "(", "this", ".", "elements", "[", "i", "]", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "public", "boolean", "enclosesFineGrained", "(", "IJavaElement", "element", ")", "{", "if", "(", "(", "this", ".", "subTypes", "==", "null", ")", "&&", "this", ".", "allowMemberAndEnclosingTypes", ")", "return", "true", ";", "return", "encloses", "(", "element", ",", "null", ")", ";", "}", "public", "boolean", "encloses", "(", "IJavaElement", "element", ")", "{", "return", "encloses", "(", "element", ",", "null", ")", ";", "}", "public", "boolean", "encloses", "(", "IJavaElement", "element", ",", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "hierarchy", "==", "null", ")", "{", "if", "(", "this", ".", "includeFocusType", "&&", "this", ".", "focusType", ".", "equals", "(", "element", ".", "getAncestor", "(", "IJavaElement", ".", "TYPE", ")", ")", ")", "{", "return", "true", ";", "}", "else", "{", "if", "(", "this", ".", "needsRefresh", ")", "{", "try", "{", "initialize", "(", "progressMonitor", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "else", "{", "return", "true", ";", "}", "}", "}", "if", "(", "this", ".", "needsRefresh", ")", "{", "try", "{", "refresh", "(", "progressMonitor", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "IType", "type", "=", "null", ";", "if", "(", "element", "instanceof", "IType", ")", "{", "type", "=", "(", "IType", ")", "element", ";", "}", "else", "if", "(", "element", "instanceof", "IMember", ")", "{", "type", "=", "(", "(", "IMember", ")", "element", ")", ".", "getDeclaringType", "(", ")", ";", "}", "if", "(", "type", "!=", "null", ")", "{", "if", "(", "this", ".", "focusType", ".", "equals", "(", "type", ")", ")", "return", "this", ".", "includeFocusType", ";", "if", "(", "enclosesType", "(", "type", ",", "this", ".", "allowMemberAndEnclosingTypes", ")", ")", "{", "return", "true", ";", "}", "if", "(", "this", ".", "allowMemberAndEnclosingTypes", ")", "{", "IType", "enclosing", "=", "type", ".", "getDeclaringType", "(", ")", ";", "while", "(", "enclosing", "!=", "null", ")", "{", "if", "(", "enclosesType", "(", "enclosing", ",", "false", ")", ")", "{", "return", "true", ";", "}", "enclosing", "=", "enclosing", ".", "getDeclaringType", "(", ")", ";", "}", "}", "}", "return", "false", ";", "}", "private", "boolean", "enclosesType", "(", "IType", "type", ",", "boolean", "recurse", ")", "{", "if", "(", "this", ".", "subTypes", "!=", "null", ")", "{", "if", "(", "this", ".", "subTypes", ".", "contains", "(", "type", ")", ")", "{", "return", "true", ";", "}", "IType", "original", "=", "type", ".", "isBinary", "(", ")", "?", "null", ":", "(", "IType", ")", "type", ".", "getPrimaryElement", "(", ")", ";", "if", "(", "original", "!=", "type", "&&", "this", ".", "subTypes", ".", "contains", "(", "original", ")", ")", "{", "return", "true", ";", "}", "}", "else", "{", "if", "(", "this", ".", "hierarchy", ".", "contains", "(", "type", ")", ")", "{", "return", "true", ";", "}", "else", "{", "IType", "original", ";", "if", "(", "!", "type", ".", "isBinary", "(", ")", "&&", "(", "original", "=", "(", "IType", ")", "type", ".", "getPrimaryElement", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "this", ".", "hierarchy", ".", "contains", "(", "original", ")", ")", "{", "return", "true", ";", "}", "}", "}", "}", "if", "(", "recurse", ")", "{", "try", "{", "IType", "[", "]", "memberTypes", "=", "type", ".", "getTypes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "memberTypes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "enclosesType", "(", "memberTypes", "[", "i", "]", ",", "recurse", ")", ")", "{", "return", "true", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "return", "false", ";", "}", "public", "IPath", "[", "]", "enclosingProjectsAndJars", "(", ")", "{", "if", "(", "this", ".", "needsRefresh", ")", "{", "try", "{", "refresh", "(", "null", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "new", "IPath", "[", "0", "]", ";", "}", "}", "return", "this", ".", "enclosingProjectsAndJars", ";", "}", "protected", "void", "initialize", "(", ")", "throws", "JavaModelException", "{", "initialize", "(", "null", ")", ";", "}", "protected", "void", "initialize", "(", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "this", ".", "resourcePaths", "=", "new", "HashSet", "(", ")", ";", "this", ".", "elements", "=", "new", "IResource", "[", "5", "]", ";", "this", ".", "elementCount", "=", "0", ";", "this", ".", "needsRefresh", "=", "false", ";", "if", "(", "this", ".", "hierarchy", "==", "null", ")", "{", "if", "(", "this", ".", "javaProject", "!=", "null", ")", "{", "this", ".", "hierarchy", "=", "this", ".", "focusType", ".", "newTypeHierarchy", "(", "this", ".", "javaProject", ",", "this", ".", "owner", ",", "progressMonitor", ")", ";", "}", "else", "{", "this", ".", "hierarchy", "=", "this", ".", "focusType", ".", "newTypeHierarchy", "(", "this", ".", "owner", ",", "progressMonitor", ")", ";", "}", "}", "else", "{", "this", ".", "hierarchy", ".", "refresh", "(", "progressMonitor", ")", ";", "}", "buildResourceVector", "(", ")", ";", "}", "public", "void", "processDelta", "(", "IJavaElementDelta", "delta", ",", "int", "eventType", ")", "{", "if", "(", "this", ".", "needsRefresh", ")", "return", ";", "this", ".", "needsRefresh", "=", "this", ".", "hierarchy", "==", "null", "?", "false", ":", "(", "(", "TypeHierarchy", ")", "this", ".", "hierarchy", ")", ".", "isAffected", "(", "delta", ",", "eventType", ")", ";", "}", "protected", "void", "refresh", "(", ")", "throws", "JavaModelException", "{", "refresh", "(", "null", ")", ";", "}", "protected", "void", "refresh", "(", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "hierarchy", "!=", "null", ")", "{", "initialize", "(", "progressMonitor", ")", ";", "}", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "(", "(", "JavaElement", ")", "this", ".", "focusType", ")", ".", "toStringWithAncestors", "(", ")", ";", "}", "}", "</s>" ]
2,514
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "TypeNameRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRestriction", ";", "public", "class", "TypeNameRequestorWrapper", "implements", "IRestrictedAccessTypeRequestor", "{", "TypeNameRequestor", "requestor", ";", "public", "TypeNameRequestorWrapper", "(", "TypeNameRequestor", "requestor", ")", "{", "this", ".", "requestor", "=", "requestor", ";", "}", "public", "void", "acceptType", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ",", "AccessRestriction", "access", ")", "{", "this", ".", "requestor", ".", "acceptType", "(", "modifiers", ",", "packageName", ",", "simpleTypeName", ",", "enclosingTypeNames", ",", "path", ")", ";", "}", "}", "</s>" ]
2,515
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRestriction", ";", "public", "interface", "IRestrictedAccessConstructorRequestor", "{", "public", "void", "acceptConstructor", "(", "int", "modifiers", ",", "char", "[", "]", "simpleTypeName", ",", "int", "parameterCount", ",", "char", "[", "]", "signature", ",", "char", "[", "]", "[", "]", "parameterTypes", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "int", "typeModifiers", ",", "char", "[", "]", "packageName", ",", "int", "extraFlags", ",", "String", "path", ",", "AccessRestriction", "access", ")", ";", "}", "</s>" ]
2,516
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "public", "class", "JavaSearchTypeNameMatch", "extends", "TypeNameMatch", "{", "private", "IType", "type", ";", "private", "int", "modifiers", "=", "-", "1", ";", "private", "int", "accessibility", "=", "IAccessRule", ".", "K_ACCESSIBLE", ";", "public", "JavaSearchTypeNameMatch", "(", "IType", "type", ",", "int", "modifiers", ")", "{", "this", ".", "type", "=", "type", ";", "this", ".", "modifiers", "=", "modifiers", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "this", ")", "return", "true", ";", "if", "(", "obj", "instanceof", "TypeNameMatch", ")", "{", "TypeNameMatch", "match", "=", "(", "TypeNameMatch", ")", "obj", ";", "if", "(", "this", ".", "type", "==", "null", ")", "{", "return", "match", ".", "getType", "(", ")", "==", "null", "&&", "match", ".", "getModifiers", "(", ")", "==", "this", ".", "modifiers", ";", "}", "return", "this", ".", "type", ".", "equals", "(", "match", ".", "getType", "(", ")", ")", "&&", "match", ".", "getModifiers", "(", ")", "==", "this", ".", "modifiers", ";", "}", "return", "false", ";", "}", "public", "int", "getAccessibility", "(", ")", "{", "return", "this", ".", "accessibility", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "return", "this", ".", "modifiers", ";", "}", "public", "IType", "getType", "(", ")", "{", "return", "this", ".", "type", ";", "}", "public", "int", "hashCode", "(", ")", "{", "if", "(", "this", ".", "type", "==", "null", ")", "return", "this", ".", "modifiers", ";", "return", "this", ".", "type", ".", "hashCode", "(", ")", ";", "}", "public", "void", "setAccessibility", "(", "int", "accessibility", ")", "{", "this", ".", "accessibility", "=", "accessibility", ";", "}", "public", "void", "setModifiers", "(", "int", "modifiers", ")", "{", "this", ".", "modifiers", "=", "modifiers", ";", "}", "public", "void", "setType", "(", "IType", "type", ")", "{", "this", ".", "type", "=", "type", ";", "}", "public", "String", "toString", "(", ")", "{", "if", "(", "this", ".", "type", "==", "null", ")", "return", "super", ".", "toString", "(", ")", ";", "return", "this", ".", "type", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,517
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "ScannerHelper", ";", "public", "final", "class", "StringOperation", "{", "private", "final", "static", "int", "[", "]", "EMPTY_REGIONS", "=", "new", "int", "[", "0", "]", ";", "public", "static", "final", "int", "[", "]", "getCamelCaseMatchingRegions", "(", "String", "pattern", ",", "int", "patternStart", ",", "int", "patternEnd", ",", "String", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "boolean", "samePartCount", ")", "{", "if", "(", "name", "==", "null", ")", "return", "null", ";", "if", "(", "pattern", "==", "null", ")", "{", "return", "EMPTY_REGIONS", ";", "}", "if", "(", "patternEnd", "<", "0", ")", "patternEnd", "=", "pattern", ".", "length", "(", ")", ";", "if", "(", "nameEnd", "<", "0", ")", "nameEnd", "=", "name", ".", "length", "(", ")", ";", "if", "(", "patternEnd", "<=", "patternStart", ")", "{", "return", "nameEnd", "<=", "nameStart", "?", "new", "int", "[", "]", "{", "patternStart", ",", "patternEnd", "-", "patternStart", "}", ":", "null", ";", "}", "if", "(", "nameEnd", "<=", "nameStart", ")", "return", "null", ";", "if", "(", "name", ".", "charAt", "(", "nameStart", ")", "!=", "pattern", ".", "charAt", "(", "patternStart", ")", ")", "{", "return", "null", ";", "}", "char", "patternChar", ",", "nameChar", ";", "int", "iPattern", "=", "patternStart", ";", "int", "iName", "=", "nameStart", ";", "int", "parts", "=", "1", ";", "for", "(", "int", "i", "=", "patternStart", "+", "1", ";", "i", "<", "patternEnd", ";", "i", "++", ")", "{", "final", "char", "ch", "=", "pattern", ".", "charAt", "(", "i", ")", ";", "if", "(", "ch", "<", "ScannerHelper", ".", "MAX_OBVIOUS", ")", "{", "if", "(", "(", "ScannerHelper", ".", "OBVIOUS_IDENT_CHAR_NATURES", "[", "ch", "]", "&", "(", "ScannerHelper", ".", "C_UPPER_LETTER", "|", "ScannerHelper", ".", "C_DIGIT", ")", ")", "!=", "0", ")", "{", "parts", "++", ";", "}", "}", "else", "if", "(", "Character", ".", "isJavaIdentifierPart", "(", "ch", ")", "&&", "(", "Character", ".", "isUpperCase", "(", "ch", ")", "||", "Character", ".", "isDigit", "(", "ch", ")", ")", ")", "{", "parts", "++", ";", "}", "}", "int", "[", "]", "segments", "=", "null", ";", "int", "count", "=", "0", ";", "int", "segmentStart", "=", "iName", ";", "while", "(", "true", ")", "{", "iPattern", "++", ";", "iName", "++", ";", "if", "(", "iPattern", "==", "patternEnd", ")", "{", "if", "(", "!", "samePartCount", "||", "iName", "==", "nameEnd", ")", "{", "if", "(", "segments", "==", "null", ")", "{", "segments", "=", "new", "int", "[", "2", "]", ";", "}", "segments", "[", "count", "++", "]", "=", "segmentStart", ";", "segments", "[", "count", "++", "]", "=", "iName", "-", "segmentStart", ";", "if", "(", "count", "<", "segments", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "segments", ",", "0", ",", "segments", "=", "new", "int", "[", "count", "]", ",", "0", ",", "count", ")", ";", "}", "return", "segments", ";", "}", "int", "segmentEnd", "=", "iName", ";", "while", "(", "true", ")", "{", "if", "(", "iName", "==", "nameEnd", ")", "{", "if", "(", "segments", "==", "null", ")", "{", "segments", "=", "new", "int", "[", "2", "]", ";", "}", "segments", "[", "count", "++", "]", "=", "segmentStart", ";", "segments", "[", "count", "++", "]", "=", "segmentEnd", "-", "segmentStart", ";", "if", "(", "count", "<", "segments", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "segments", ",", "0", ",", "segments", "=", "new", "int", "[", "count", "]", ",", "0", ",", "count", ")", ";", "}", "return", "segments", ";", "}", "nameChar", "=", "name", ".", "charAt", "(", "iName", ")", ";", "if", "(", "nameChar", "<", "ScannerHelper", ".", "MAX_OBVIOUS", ")", "{", "if", "(", "(", "ScannerHelper", ".", "OBVIOUS_IDENT_CHAR_NATURES", "[", "nameChar", "]", "&", "ScannerHelper", ".", "C_UPPER_LETTER", ")", "!=", "0", ")", "{", "return", "null", ";", "}", "}", "else", "if", "(", "!", "Character", ".", "isJavaIdentifierPart", "(", "nameChar", ")", "||", "Character", ".", "isUpperCase", "(", "nameChar", ")", ")", "{", "return", "null", ";", "}", "iName", "++", ";", "}", "}", "if", "(", "iName", "==", "nameEnd", ")", "{", "return", "null", ";", "}", "if", "(", "(", "patternChar", "=", "pattern", ".", "charAt", "(", "iPattern", ")", ")", "==", "name", ".", "charAt", "(", "iName", ")", ")", "{", "continue", ";", "}", "int", "segmentEnd", "=", "iName", ";", "if", "(", "patternChar", "<", "ScannerHelper", ".", "MAX_OBVIOUS", ")", "{", "if", "(", "(", "ScannerHelper", ".", "OBVIOUS_IDENT_CHAR_NATURES", "[", "patternChar", "]", "&", "(", "ScannerHelper", ".", "C_UPPER_LETTER", "|", "ScannerHelper", ".", "C_DIGIT", ")", ")", "==", "0", ")", "{", "return", "null", ";", "}", "}", "else", "if", "(", "Character", ".", "isJavaIdentifierPart", "(", "patternChar", ")", "&&", "!", "Character", ".", "isUpperCase", "(", "patternChar", ")", "&&", "!", "Character", ".", "isDigit", "(", "patternChar", ")", ")", "{", "return", "null", ";", "}", "while", "(", "true", ")", "{", "if", "(", "iName", "==", "nameEnd", ")", "{", "return", "null", ";", "}", "nameChar", "=", "name", ".", "charAt", "(", "iName", ")", ";", "if", "(", "nameChar", "<", "ScannerHelper", ".", "MAX_OBVIOUS", ")", "{", "int", "charNature", "=", "ScannerHelper", ".", "OBVIOUS_IDENT_CHAR_NATURES", "[", "nameChar", "]", ";", "if", "(", "(", "charNature", "&", "(", "ScannerHelper", ".", "C_LOWER_LETTER", "|", "ScannerHelper", ".", "C_SPECIAL", ")", ")", "!=", "0", ")", "{", "iName", "++", ";", "}", "else", "if", "(", "(", "charNature", "&", "ScannerHelper", ".", "C_DIGIT", ")", "!=", "0", ")", "{", "if", "(", "patternChar", "==", "nameChar", ")", "break", ";", "iName", "++", ";", "}", "else", "if", "(", "patternChar", "!=", "nameChar", ")", "{", "return", "null", ";", "}", "else", "{", "break", ";", "}", "}", "else", "if", "(", "Character", ".", "isJavaIdentifierPart", "(", "nameChar", ")", "&&", "!", "Character", ".", "isUpperCase", "(", "nameChar", ")", ")", "{", "iName", "++", ";", "}", "else", "if", "(", "Character", ".", "isDigit", "(", "nameChar", ")", ")", "{", "if", "(", "patternChar", "==", "nameChar", ")", "break", ";", "iName", "++", ";", "}", "else", "if", "(", "patternChar", "!=", "nameChar", ")", "{", "return", "null", ";", "}", "else", "{", "break", ";", "}", "}", "if", "(", "segments", "==", "null", ")", "{", "segments", "=", "new", "int", "[", "parts", "*", "2", "]", ";", "}", "segments", "[", "count", "++", "]", "=", "segmentStart", ";", "segments", "[", "count", "++", "]", "=", "segmentEnd", "-", "segmentStart", ";", "segmentStart", "=", "iName", ";", "}", "}", "public", "static", "final", "int", "[", "]", "getPatternMatchingRegions", "(", "String", "pattern", ",", "int", "patternStart", ",", "int", "patternEnd", ",", "String", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "boolean", "isCaseSensitive", ")", "{", "if", "(", "name", "==", "null", ")", "return", "null", ";", "if", "(", "pattern", "==", "null", ")", "{", "return", "EMPTY_REGIONS", ";", "}", "int", "iPattern", "=", "patternStart", ";", "int", "iName", "=", "nameStart", ";", "if", "(", "patternEnd", "<", "0", ")", "patternEnd", "=", "pattern", ".", "length", "(", ")", ";", "if", "(", "nameEnd", "<", "0", ")", "nameEnd", "=", "name", ".", "length", "(", ")", ";", "int", "questions", "=", "0", ";", "int", "parts", "=", "0", ";", "char", "previous", "=", "0", ";", "for", "(", "int", "i", "=", "patternStart", ";", "i", "<", "patternEnd", ";", "i", "++", ")", "{", "char", "ch", "=", "pattern", ".", "charAt", "(", "i", ")", ";", "switch", "(", "ch", ")", "{", "case", "'?'", ":", "questions", "++", ";", "break", ";", "case", "'*'", ":", "break", ";", "default", ":", "switch", "(", "previous", ")", "{", "case", "0", ":", "case", "'?'", ":", "case", "'*'", ":", "parts", "++", ";", "break", ";", "}", "}", "previous", "=", "ch", ";", "}", "if", "(", "parts", "==", "0", ")", "{", "if", "(", "questions", "<=", "(", "nameEnd", "-", "nameStart", ")", ")", "return", "EMPTY_REGIONS", ";", "return", "null", ";", "}", "int", "[", "]", "segments", "=", "new", "int", "[", "parts", "*", "2", "]", ";", "int", "count", "=", "0", ";", "int", "start", "=", "iName", ";", "char", "patternChar", "=", "0", ";", "previous", "=", "0", ";", "while", "(", "(", "iPattern", "<", "patternEnd", ")", "&&", "(", "patternChar", "=", "pattern", ".", "charAt", "(", "iPattern", ")", ")", "!=", "'*'", ")", "{", "if", "(", "iName", "==", "nameEnd", ")", "return", "null", ";", "if", "(", "patternChar", "==", "'?'", ")", "{", "switch", "(", "previous", ")", "{", "case", "0", ":", "case", "'?'", ":", "break", ";", "default", ":", "segments", "[", "count", "++", "]", "=", "start", ";", "segments", "[", "count", "++", "]", "=", "iPattern", "-", "start", ";", "break", ";", "}", "}", "else", "{", "if", "(", "isCaseSensitive", ")", "{", "if", "(", "patternChar", "!=", "name", ".", "charAt", "(", "iName", ")", ")", "{", "return", "null", ";", "}", "}", "else", "if", "(", "ScannerHelper", ".", "toLowerCase", "(", "patternChar", ")", "!=", "ScannerHelper", ".", "toLowerCase", "(", "name", ".", "charAt", "(", "iName", ")", ")", ")", "{", "return", "null", ";", "}", "switch", "(", "previous", ")", "{", "case", "0", ":", "case", "'?'", ":", "start", "=", "iPattern", ";", "break", ";", "}", "}", "iName", "++", ";", "iPattern", "++", ";", "previous", "=", "patternChar", ";", "}", "int", "segmentStart", ";", "if", "(", "patternChar", "==", "'*'", ")", "{", "if", "(", "iPattern", ">", "0", "&&", "previous", "!=", "'?'", ")", "{", "segments", "[", "count", "++", "]", "=", "start", ";", "segments", "[", "count", "++", "]", "=", "iName", "-", "start", ";", "start", "=", "iName", ";", "}", "segmentStart", "=", "++", "iPattern", ";", "}", "else", "{", "if", "(", "iName", "==", "nameEnd", ")", "{", "if", "(", "count", "==", "(", "parts", "*", "2", ")", ")", "return", "segments", ";", "int", "end", "=", "patternEnd", ";", "if", "(", "previous", "==", "'?'", ")", "{", "while", "(", "pattern", ".", "charAt", "(", "--", "end", "-", "1", ")", "==", "'?'", ")", "{", "if", "(", "end", "==", "start", ")", "{", "return", "new", "int", "[", "]", "{", "patternStart", ",", "patternEnd", "-", "patternStart", "}", ";", "}", "}", "}", "return", "new", "int", "[", "]", "{", "start", ",", "end", "-", "start", "}", ";", "}", "return", "null", ";", "}", "int", "prefixStart", "=", "iName", ";", "int", "previousCount", "=", "count", ";", "previous", "=", "patternChar", ";", "char", "previousSegment", "=", "patternChar", ";", "checkSegment", ":", "while", "(", "iName", "<", "nameEnd", ")", "{", "if", "(", "iPattern", "==", "patternEnd", ")", "{", "iPattern", "=", "segmentStart", ";", "iName", "=", "++", "prefixStart", ";", "previous", "=", "previousSegment", ";", "continue", "checkSegment", ";", "}", "if", "(", "(", "patternChar", "=", "pattern", ".", "charAt", "(", "iPattern", ")", ")", "==", "'*'", ")", "{", "segmentStart", "=", "++", "iPattern", ";", "if", "(", "segmentStart", "==", "patternEnd", ")", "{", "if", "(", "count", "<", "(", "parts", "*", "2", ")", ")", "{", "segments", "[", "count", "++", "]", "=", "start", ";", "segments", "[", "count", "++", "]", "=", "iName", "-", "start", ";", "}", "return", "segments", ";", "}", "switch", "(", "previous", ")", "{", "case", "'*'", ":", "case", "'?'", ":", "break", ";", "default", ":", "segments", "[", "count", "++", "]", "=", "start", ";", "segments", "[", "count", "++", "]", "=", "iName", "-", "start", ";", "break", ";", "}", "prefixStart", "=", "iName", ";", "start", "=", "prefixStart", ";", "previous", "=", "patternChar", ";", "previousSegment", "=", "patternChar", ";", "continue", "checkSegment", ";", "}", "previousCount", "=", "count", ";", "if", "(", "patternChar", "==", "'?'", ")", "{", "switch", "(", "previous", ")", "{", "case", "'*'", ":", "case", "'?'", ":", "break", ";", "default", ":", "segments", "[", "count", "++", "]", "=", "start", ";", "segments", "[", "count", "++", "]", "=", "iName", "-", "start", ";", "break", ";", "}", "}", "else", "{", "boolean", "mismatch", ";", "if", "(", "isCaseSensitive", ")", "{", "mismatch", "=", "name", ".", "charAt", "(", "iName", ")", "!=", "patternChar", ";", "}", "else", "{", "mismatch", "=", "ScannerHelper", ".", "toLowerCase", "(", "name", ".", "charAt", "(", "iName", ")", ")", "!=", "ScannerHelper", ".", "toLowerCase", "(", "patternChar", ")", ";", "}", "if", "(", "mismatch", ")", "{", "iPattern", "=", "segmentStart", ";", "iName", "=", "++", "prefixStart", ";", "start", "=", "prefixStart", ";", "count", "=", "previousCount", ";", "previous", "=", "previousSegment", ";", "continue", "checkSegment", ";", "}", "switch", "(", "previous", ")", "{", "case", "'?'", ":", "start", "=", "iName", ";", "break", ";", "}", "}", "iName", "++", ";", "iPattern", "++", ";", "previous", "=", "patternChar", ";", "}", "if", "(", "(", "segmentStart", "==", "patternEnd", ")", "||", "(", "iName", "==", "nameEnd", "&&", "iPattern", "==", "patternEnd", ")", "||", "(", "iPattern", "==", "patternEnd", "-", "1", "&&", "pattern", ".", "charAt", "(", "iPattern", ")", "==", "'*'", ")", ")", "{", "if", "(", "count", "<", "(", "parts", "*", "2", ")", ")", "{", "segments", "[", "count", "++", "]", "=", "start", ";", "segments", "[", "count", "++", "]", "=", "iName", "-", "start", ";", "}", "return", "segments", ";", "}", "return", "null", ";", "}", "}", "</s>" ]
2,518
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchDocument", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "JavaSearchDocument", "extends", "SearchDocument", "{", "private", "IFile", "file", ";", "protected", "byte", "[", "]", "byteContents", ";", "protected", "char", "[", "]", "charContents", ";", "public", "JavaSearchDocument", "(", "String", "documentPath", ",", "SearchParticipant", "participant", ")", "{", "super", "(", "documentPath", ",", "participant", ")", ";", "}", "public", "JavaSearchDocument", "(", "java", ".", "util", ".", "zip", ".", "ZipEntry", "zipEntry", ",", "IPath", "zipFilePath", ",", "byte", "[", "]", "contents", ",", "SearchParticipant", "participant", ")", "{", "super", "(", "zipFilePath", "+", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", "+", "zipEntry", ".", "getName", "(", ")", ",", "participant", ")", ";", "this", ".", "byteContents", "=", "contents", ";", "}", "public", "byte", "[", "]", "getByteContents", "(", ")", "{", "if", "(", "this", ".", "byteContents", "!=", "null", ")", "return", "this", ".", "byteContents", ";", "try", "{", "return", "Util", ".", "getResourceContentsAsByteArray", "(", "getFile", "(", ")", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", "||", "JobManager", ".", "VERBOSE", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "}", "public", "char", "[", "]", "getCharContents", "(", ")", "{", "if", "(", "this", ".", "charContents", "!=", "null", ")", "return", "this", ".", "charContents", ";", "try", "{", "return", "Util", ".", "getResourceContentsAsCharArray", "(", "getFile", "(", ")", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", "||", "JobManager", ".", "VERBOSE", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "}", "public", "String", "getEncoding", "(", ")", "{", "IFile", "resource", "=", "getFile", "(", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "try", "{", "return", "resource", ".", "getCharset", "(", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "try", "{", "return", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getDefaultCharset", "(", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "}", "}", "return", "null", ";", "}", "private", "IFile", "getFile", "(", ")", "{", "if", "(", "this", ".", "file", "==", "null", ")", "this", ".", "file", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getFile", "(", "new", "Path", "(", "getPath", "(", ")", ")", ")", ";", "return", "this", ".", "file", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "getPath", "(", ")", ";", "}", "}", "</s>" ]
2,519
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "public", "abstract", "class", "AbstractJavaSearchScope", "extends", "AbstractSearchScope", "{", "abstract", "public", "AccessRuleSet", "getAccessRuleSet", "(", "String", "relativePath", ",", "String", "containerPath", ")", ";", "abstract", "public", "IPackageFragmentRoot", "packageFragmentRoot", "(", "String", "resourcePathString", ",", "int", "jarSeparatorIndex", ",", "String", "jarPath", ")", ";", "}", "</s>" ]
2,520
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "FileIndexLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "IndexLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "ReadWriteMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocator", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "IJob", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "PatternSearchJob", "implements", "IJob", "{", "protected", "SearchPattern", "pattern", ";", "protected", "IJavaSearchScope", "scope", ";", "protected", "SearchParticipant", "participant", ";", "protected", "IndexQueryRequestor", "requestor", ";", "protected", "boolean", "areIndexesReady", ";", "protected", "long", "executionTime", "=", "0", ";", "public", "PatternSearchJob", "(", "SearchPattern", "pattern", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IndexQueryRequestor", "requestor", ")", "{", "this", ".", "pattern", "=", "pattern", ";", "this", ".", "participant", "=", "participant", ";", "this", ".", "scope", "=", "scope", ";", "this", ".", "requestor", "=", "requestor", ";", "}", "public", "boolean", "belongsTo", "(", "String", "jobFamily", ")", "{", "return", "true", ";", "}", "public", "void", "cancel", "(", ")", "{", "}", "public", "void", "ensureReadyToRun", "(", ")", "{", "if", "(", "!", "this", ".", "areIndexesReady", ")", "getIndexes", "(", "null", ")", ";", "}", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "boolean", "isComplete", "=", "COMPLETE", ";", "this", ".", "executionTime", "=", "0", ";", "Index", "[", "]", "indexes", "=", "getIndexes", "(", "progressMonitor", ")", ";", "try", "{", "int", "max", "=", "indexes", ".", "length", ";", "if", "(", "progressMonitor", "!=", "null", ")", "progressMonitor", ".", "beginTask", "(", "\"\"", ",", "max", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "isComplete", "&=", "search", "(", "indexes", "[", "i", "]", ",", "progressMonitor", ")", ";", "if", "(", "progressMonitor", "!=", "null", ")", "{", "if", "(", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "progressMonitor", ".", "worked", "(", "1", ")", ";", "}", "}", "if", "(", "JobManager", ".", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "executionTime", "+", "\"ms", "-", "\"", "+", "this", ")", ";", "return", "isComplete", ";", "}", "finally", "{", "if", "(", "progressMonitor", "!=", "null", ")", "progressMonitor", ".", "done", "(", ")", ";", "}", "}", "public", "Index", "[", "]", "getIndexes", "(", "IProgressMonitor", "progressMonitor", ")", "{", "IndexLocation", "[", "]", "indexLocations", ";", "int", "length", ";", "if", "(", "this", ".", "participant", "instanceof", "JavaSearchParticipant", ")", "{", "indexLocations", "=", "(", "(", "JavaSearchParticipant", ")", "this", ".", "participant", ")", ".", "selectIndexURLs", "(", "this", ".", "pattern", ",", "this", ".", "scope", ")", ";", "length", "=", "indexLocations", ".", "length", ";", "}", "else", "{", "IPath", "[", "]", "paths", "=", "this", ".", "participant", ".", "selectIndexes", "(", "this", ".", "pattern", ",", "this", ".", "scope", ")", ";", "length", "=", "paths", ".", "length", ";", "indexLocations", "=", "new", "IndexLocation", "[", "paths", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ",", "len", "=", "paths", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "indexLocations", "[", "i", "]", "=", "new", "FileIndexLocation", "(", "paths", "[", "i", "]", ".", "toFile", "(", ")", ",", "true", ")", ";", "}", "}", "Index", "[", "]", "indexes", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ".", "getIndexes", "(", "indexLocations", ",", "progressMonitor", ")", ";", "this", ".", "areIndexesReady", "=", "indexes", ".", "length", "==", "length", ";", "return", "indexes", ";", "}", "public", "String", "getJobFamily", "(", ")", "{", "return", "\"\"", ";", "}", "public", "boolean", "search", "(", "Index", "index", ",", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "index", "==", "null", ")", "return", "COMPLETE", ";", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "return", "COMPLETE", ";", "try", "{", "monitor", ".", "enterRead", "(", ")", ";", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "MatchLocator", ".", "findIndexMatches", "(", "this", ".", "pattern", ",", "index", ",", "this", ".", "requestor", ",", "this", ".", "participant", ",", "this", ".", "scope", ",", "progressMonitor", ")", ";", "this", ".", "executionTime", "+=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ";", "return", "COMPLETE", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "e", "instanceof", "java", ".", "io", ".", "EOFException", ")", "e", ".", "printStackTrace", "(", ")", ";", "return", "FAILED", ";", "}", "finally", "{", "monitor", ".", "exitRead", "(", ")", ";", "}", "}", "public", "String", "toString", "(", ")", "{", "return", "\"searching", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,521
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "LinkedHashSet", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFolder", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElementDelta", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "DeltaProcessor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ExternalFoldersManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModel", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "JavaWorkspaceScope", "extends", "AbstractJavaSearchScope", "{", "private", "IPath", "[", "]", "enclosingPaths", "=", "null", ";", "public", "JavaWorkspaceScope", "(", ")", "{", "}", "public", "boolean", "encloses", "(", "IJavaElement", "element", ")", "{", "return", "true", ";", "}", "public", "boolean", "encloses", "(", "String", "resourcePathString", ")", "{", "return", "true", ";", "}", "public", "IPath", "[", "]", "enclosingProjectsAndJars", "(", ")", "{", "IPath", "[", "]", "result", "=", "this", ".", "enclosingPaths", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "long", "start", "=", "BasicSearchEngine", ".", "VERBOSE", "?", "System", ".", "currentTimeMillis", "(", ")", ":", "-", "1", ";", "try", "{", "IJavaProject", "[", "]", "projects", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProjects", "(", ")", ";", "Set", "paths", "=", "new", "LinkedHashSet", "(", "projects", ".", "length", "*", "2", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "projects", "[", "i", "]", ";", "IPath", "projectPath", "=", "javaProject", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ";", "paths", ".", "add", "(", "projectPath", ")", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "projects", "[", "i", "]", ";", "IClasspathEntry", "[", "]", "entries", "=", "javaProject", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "eLength", "=", "entries", ".", "length", ";", "j", "<", "eLength", ";", "j", "++", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "j", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "false", ")", ";", "if", "(", "target", "instanceof", "IFolder", ")", "path", "=", "(", "(", "IFolder", ")", "target", ")", ".", "getFullPath", "(", ")", ";", "paths", ".", "add", "(", "entry", ".", "getPath", "(", ")", ")", ";", "}", "}", "}", "result", "=", "new", "IPath", "[", "paths", ".", "size", "(", ")", "]", ";", "paths", ".", "toArray", "(", "result", ")", ";", "return", "this", ".", "enclosingPaths", "=", "result", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "return", "new", "IPath", "[", "0", "]", ";", "}", "finally", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "long", "time", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ";", "int", "length", "=", "result", "==", "null", "?", "0", ":", "result", ".", "length", ";", "Util", ".", "verbose", "(", "\"\"", "+", "length", "+", "\"\"", "+", "time", "+", "\"ms.\"", ")", ";", "}", "}", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "return", "o", "==", "this", ";", "}", "public", "AccessRuleSet", "getAccessRuleSet", "(", "String", "relativePath", ",", "String", "containerPath", ")", "{", "return", "null", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "JavaWorkspaceScope", ".", "class", ".", "hashCode", "(", ")", ";", "}", "public", "IPackageFragmentRoot", "packageFragmentRoot", "(", "String", "resourcePathString", ",", "int", "jarSeparatorIndex", ",", "String", "jarPath", ")", "{", "HashMap", "rootInfos", "=", "JavaModelManager", ".", "getDeltaState", "(", ")", ".", "roots", ";", "DeltaProcessor", ".", "RootInfo", "rootInfo", "=", "null", ";", "if", "(", "jarPath", "!=", "null", ")", "{", "IPath", "path", "=", "new", "Path", "(", "jarPath", ")", ";", "rootInfo", "=", "(", "DeltaProcessor", ".", "RootInfo", ")", "rootInfos", ".", "get", "(", "path", ")", ";", "}", "else", "{", "IPath", "path", "=", "new", "Path", "(", "resourcePathString", ")", ";", "if", "(", "ExternalFoldersManager", ".", "isInternalPathForExternalFolder", "(", "path", ")", ")", "{", "IResource", "resource", "=", "JavaModel", ".", "getWorkspaceTarget", "(", "path", ".", "uptoSegment", "(", "2", ")", ")", ";", "if", "(", "resource", "!=", "null", ")", "rootInfo", "=", "(", "DeltaProcessor", ".", "RootInfo", ")", "rootInfos", ".", "get", "(", "resource", ".", "getLocation", "(", ")", ")", ";", "}", "else", "{", "rootInfo", "=", "(", "DeltaProcessor", ".", "RootInfo", ")", "rootInfos", ".", "get", "(", "path", ")", ";", "while", "(", "rootInfo", "==", "null", "&&", "path", ".", "segmentCount", "(", ")", ">", "0", ")", "{", "path", "=", "path", ".", "removeLastSegments", "(", "1", ")", ";", "rootInfo", "=", "(", "DeltaProcessor", ".", "RootInfo", ")", "rootInfos", ".", "get", "(", "path", ")", ";", "}", "}", "}", "if", "(", "rootInfo", "==", "null", ")", "return", "null", ";", "return", "rootInfo", ".", "getPackageFragmentRoot", "(", "null", ")", ";", "}", "public", "void", "processDelta", "(", "IJavaElementDelta", "delta", ",", "int", "eventType", ")", "{", "if", "(", "this", ".", "enclosingPaths", "==", "null", ")", "return", ";", "IJavaElement", "element", "=", "delta", ".", "getElement", "(", ")", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "IJavaElementDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElementDelta", "child", "=", "children", "[", "i", "]", ";", "processDelta", "(", "child", ",", "eventType", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "int", "kind", "=", "delta", ".", "getKind", "(", ")", ";", "switch", "(", "kind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "case", "IJavaElementDelta", ".", "REMOVED", ":", "this", ".", "enclosingPaths", "=", "null", ";", "break", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "(", "flags", "&", "IJavaElementDelta", ".", "F_CLOSED", ")", "!=", "0", "||", "(", "flags", "&", "IJavaElementDelta", ".", "F_OPENED", ")", "!=", "0", ")", "{", "this", ".", "enclosingPaths", "=", "null", ";", "}", "else", "{", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElementDelta", "child", "=", "children", "[", "i", "]", ";", "processDelta", "(", "child", ",", "eventType", ")", ";", "}", "}", "break", ";", "}", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "kind", "=", "delta", ".", "getKind", "(", ")", ";", "switch", "(", "kind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "case", "IJavaElementDelta", ".", "REMOVED", ":", "this", ".", "enclosingPaths", "=", "null", ";", "break", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "(", "flags", "&", "IJavaElementDelta", ".", "F_ADDED_TO_CLASSPATH", ")", ">", "0", "||", "(", "flags", "&", "IJavaElementDelta", ".", "F_REMOVED_FROM_CLASSPATH", ")", ">", "0", ")", "{", "this", ".", "enclosingPaths", "=", "null", ";", "}", "break", ";", "}", "break", ";", "}", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "IPath", "[", "]", "paths", "=", "enclosingProjectsAndJars", "(", ")", ";", "int", "length", "=", "paths", "==", "null", "?", "0", ":", "paths", ".", "length", ";", "if", "(", "length", "==", "0", ")", "{", "result", ".", "append", "(", "\"\"", ")", ";", "}", "else", "{", "result", ".", "append", "(", "\"[\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "result", ".", "append", "(", "\"nt\"", ")", ";", "result", ".", "append", "(", "paths", "[", "i", "]", ")", ";", "}", "result", ".", "append", "(", "\"n]\"", ")", ";", "}", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,522
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "org", ".", "eclipse", ".", "core", ".", "filesystem", ".", "EFS", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceProxy", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceProxyVisitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspaceRoot", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "IndexAllProject", "extends", "IndexRequest", "{", "IProject", "project", ";", "public", "IndexAllProject", "(", "IProject", "project", ",", "IndexManager", "manager", ")", "{", "super", "(", "project", ".", "getFullPath", "(", ")", ",", "manager", ")", ";", "this", ".", "project", "=", "project", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "o", "instanceof", "IndexAllProject", ")", "return", "this", ".", "project", ".", "equals", "(", "(", "(", "IndexAllProject", ")", "o", ")", ".", "project", ")", ";", "return", "false", ";", "}", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "isCancelled", "||", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", "true", ";", "if", "(", "!", "this", ".", "project", ".", "isAccessible", "(", ")", ")", "return", "true", ";", "ReadWriteMonitor", "monitor", "=", "null", ";", "try", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "this", ".", "project", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "javaProject", ".", "getRawClasspath", "(", ")", ";", "int", "length", "=", "entries", ".", "length", ";", "IClasspathEntry", "[", "]", "sourceEntries", "=", "new", "IClasspathEntry", "[", "length", "]", ";", "int", "sourceEntriesNumber", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_SOURCE", ")", "sourceEntries", "[", "sourceEntriesNumber", "++", "]", "=", "entry", ";", "}", "if", "(", "sourceEntriesNumber", "==", "0", ")", "{", "IPath", "projectPath", "=", "javaProject", ".", "getPath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", "&&", "entry", ".", "getPath", "(", ")", ".", "equals", "(", "projectPath", ")", ")", "{", "this", ".", "manager", ".", "indexLibrary", "(", "projectPath", ",", "this", ".", "project", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "getLibraryIndexLocation", "(", ")", ")", ";", "return", "true", ";", "}", "}", "Index", "index", "=", "this", ".", "manager", ".", "getIndexForUpdate", "(", "this", ".", "containerPath", ",", "true", ",", "true", ")", ";", "if", "(", "index", "!=", "null", ")", "this", ".", "manager", ".", "saveIndex", "(", "index", ")", ";", "return", "true", ";", "}", "if", "(", "sourceEntriesNumber", "!=", "length", ")", "System", ".", "arraycopy", "(", "sourceEntries", ",", "0", ",", "sourceEntries", "=", "new", "IClasspathEntry", "[", "sourceEntriesNumber", "]", ",", "0", ",", "sourceEntriesNumber", ")", ";", "Index", "index", "=", "this", ".", "manager", ".", "getIndexForUpdate", "(", "this", ".", "containerPath", ",", "true", ",", "true", ")", ";", "if", "(", "index", "==", "null", ")", "return", "true", ";", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "return", "true", ";", "monitor", ".", "enterRead", "(", ")", ";", "String", "[", "]", "paths", "=", "index", ".", "queryDocumentNames", "(", "\"\"", ")", ";", "int", "max", "=", "paths", "==", "null", "?", "0", ":", "paths", ".", "length", ";", "final", "SimpleLookupTable", "indexedFileNames", "=", "new", "SimpleLookupTable", "(", "max", "==", "0", "?", "33", ":", "max", "+", "11", ")", ";", "final", "String", "OK", "=", "\"OK\"", ";", "final", "String", "DELETED", "=", "\"DELETED\"", ";", "if", "(", "paths", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "indexedFileNames", ".", "put", "(", "paths", "[", "i", "]", ",", "DELETED", ")", ";", "}", "final", "long", "indexLastModified", "=", "max", "==", "0", "?", "0L", ":", "index", ".", "getIndexLastModified", "(", ")", ";", "IWorkspaceRoot", "root", "=", "this", ".", "project", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sourceEntriesNumber", ";", "i", "++", ")", "{", "if", "(", "this", ".", "isCancelled", ")", "return", "false", ";", "IClasspathEntry", "entry", "=", "sourceEntries", "[", "i", "]", ";", "IResource", "sourceFolder", "=", "root", ".", "findMember", "(", "entry", ".", "getPath", "(", ")", ")", ";", "if", "(", "sourceFolder", "!=", "null", ")", "{", "final", "HashSet", "outputs", "=", "new", "HashSet", "(", ")", ";", "if", "(", "sourceFolder", ".", "getType", "(", ")", "==", "IResource", ".", "PROJECT", ")", "{", "outputs", ".", "add", "(", "javaProject", ".", "getOutputLocation", "(", ")", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "sourceEntriesNumber", ";", "j", "++", ")", "{", "IPath", "output", "=", "sourceEntries", "[", "j", "]", ".", "getOutputLocation", "(", ")", ";", "if", "(", "output", "!=", "null", ")", "{", "outputs", ".", "add", "(", "output", ")", ";", "}", "}", "}", "final", "boolean", "hasOutputs", "=", "!", "outputs", ".", "isEmpty", "(", ")", ";", "final", "char", "[", "]", "[", "]", "inclusionPatterns", "=", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullInclusionPatternChars", "(", ")", ";", "final", "char", "[", "]", "[", "]", "exclusionPatterns", "=", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullExclusionPatternChars", "(", ")", ";", "if", "(", "max", "==", "0", ")", "{", "sourceFolder", ".", "accept", "(", "new", "IResourceProxyVisitor", "(", ")", "{", "public", "boolean", "visit", "(", "IResourceProxy", "proxy", ")", "{", "if", "(", "IndexAllProject", ".", "this", ".", "isCancelled", ")", "return", "false", ";", "switch", "(", "proxy", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "FILE", ":", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "proxy", ".", "getName", "(", ")", ")", ")", "{", "IFile", "file", "=", "(", "IFile", ")", "proxy", ".", "requestResource", "(", ")", ";", "if", "(", "exclusionPatterns", "!=", "null", "||", "inclusionPatterns", "!=", "null", ")", "if", "(", "Util", ".", "isExcluded", "(", "file", ",", "inclusionPatterns", ",", "exclusionPatterns", ")", ")", "return", "false", ";", "indexedFileNames", ".", "put", "(", "Util", ".", "relativePath", "(", "file", ".", "getFullPath", "(", ")", ",", "1", ")", ",", "file", ")", ";", "}", "return", "false", ";", "case", "IResource", ".", "FOLDER", ":", "if", "(", "exclusionPatterns", "!=", "null", "&&", "inclusionPatterns", "==", "null", ")", "{", "if", "(", "Util", ".", "isExcluded", "(", "proxy", ".", "requestFullPath", "(", ")", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "true", ")", ")", "return", "false", ";", "}", "if", "(", "hasOutputs", "&&", "outputs", ".", "contains", "(", "proxy", ".", "requestFullPath", "(", ")", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "}", ",", "IResource", ".", "NONE", ")", ";", "}", "else", "{", "sourceFolder", ".", "accept", "(", "new", "IResourceProxyVisitor", "(", ")", "{", "public", "boolean", "visit", "(", "IResourceProxy", "proxy", ")", "throws", "CoreException", "{", "if", "(", "IndexAllProject", ".", "this", ".", "isCancelled", ")", "return", "false", ";", "switch", "(", "proxy", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "FILE", ":", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "proxy", ".", "getName", "(", ")", ")", ")", "{", "IFile", "file", "=", "(", "IFile", ")", "proxy", ".", "requestResource", "(", ")", ";", "URI", "location", "=", "file", ".", "getLocationURI", "(", ")", ";", "if", "(", "location", "==", "null", ")", "return", "false", ";", "if", "(", "exclusionPatterns", "!=", "null", "||", "inclusionPatterns", "!=", "null", ")", "if", "(", "Util", ".", "isExcluded", "(", "file", ",", "inclusionPatterns", ",", "exclusionPatterns", ")", ")", "return", "false", ";", "String", "relativePathString", "=", "Util", ".", "relativePath", "(", "file", ".", "getFullPath", "(", ")", ",", "1", ")", ";", "indexedFileNames", ".", "put", "(", "relativePathString", ",", "indexedFileNames", ".", "get", "(", "relativePathString", ")", "==", "null", "||", "indexLastModified", "<", "EFS", ".", "getStore", "(", "location", ")", ".", "fetchInfo", "(", ")", ".", "getLastModified", "(", ")", "?", "(", "Object", ")", "file", ":", "(", "Object", ")", "OK", ")", ";", "}", "return", "false", ";", "case", "IResource", ".", "FOLDER", ":", "if", "(", "exclusionPatterns", "!=", "null", "||", "inclusionPatterns", "!=", "null", ")", "if", "(", "Util", ".", "isExcluded", "(", "proxy", ".", "requestResource", "(", ")", ",", "inclusionPatterns", ",", "exclusionPatterns", ")", ")", "return", "false", ";", "if", "(", "hasOutputs", "&&", "outputs", ".", "contains", "(", "proxy", ".", "requestFullPath", "(", ")", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "}", ",", "IResource", ".", "NONE", ")", ";", "}", "}", "}", "SourceElementParser", "parser", "=", "this", ".", "manager", ".", "getSourceElementParser", "(", "javaProject", ",", "null", ")", ";", "Object", "[", "]", "names", "=", "indexedFileNames", ".", "keyTable", ";", "Object", "[", "]", "values", "=", "indexedFileNames", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "namesLength", "=", "names", ".", "length", ";", "i", "<", "namesLength", ";", "i", "++", ")", "{", "String", "name", "=", "(", "String", ")", "names", "[", "i", "]", ";", "if", "(", "name", "!=", "null", ")", "{", "if", "(", "this", ".", "isCancelled", ")", "return", "false", ";", "Object", "value", "=", "values", "[", "i", "]", ";", "if", "(", "value", "!=", "OK", ")", "{", "if", "(", "value", "==", "DELETED", ")", "this", ".", "manager", ".", "remove", "(", "name", ",", "this", ".", "containerPath", ")", ";", "else", "this", ".", "manager", ".", "addSource", "(", "(", "IFile", ")", "value", ",", "this", ".", "containerPath", ",", "parser", ")", ";", "}", "}", "}", "this", ".", "manager", ".", "request", "(", "new", "SaveIndex", "(", "this", ".", "containerPath", ",", "this", ".", "manager", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "project", "+", "\"\"", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "this", ".", "manager", ".", "removeIndex", "(", "this", ".", "containerPath", ")", ";", "return", "false", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "project", "+", "\"\"", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "this", ".", "manager", ".", "removeIndex", "(", "this", ".", "containerPath", ")", ";", "return", "false", ";", "}", "finally", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "exitRead", "(", ")", ";", "}", "return", "true", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "this", ".", "project", ".", "hashCode", "(", ")", ";", "}", "protected", "Integer", "updatedIndexState", "(", ")", "{", "return", "IndexManager", ".", "REBUILDING_STATE", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "this", ".", "project", ".", "getFullPath", "(", ")", ";", "}", "}", "</s>" ]
2,523
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "java", ".", "io", ".", "*", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "java", ".", "util", ".", "*", ";", "import", "java", ".", "util", ".", "zip", ".", "CRC32", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ISourceElementRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "BasicSearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "PatternSearchJob", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "IJob", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "IndexManager", "extends", "JobManager", "implements", "IIndexConstants", "{", "public", "SimpleLookupTable", "indexLocations", "=", "new", "SimpleLookupTable", "(", ")", ";", "private", "SimpleLookupTable", "indexes", "=", "new", "SimpleLookupTable", "(", ")", ";", "private", "boolean", "needToSave", "=", "false", ";", "private", "IPath", "javaPluginLocation", "=", "null", ";", "private", "SimpleLookupTable", "indexStates", "=", "null", ";", "private", "File", "indexNamesMapFile", "=", "new", "File", "(", "getSavedIndexesDirectory", "(", ")", ",", "\"\"", ")", ";", "private", "File", "savedIndexNamesFile", "=", "new", "File", "(", "getSavedIndexesDirectory", "(", ")", ",", "\"\"", ")", ";", "private", "File", "participantIndexNamesFile", "=", "new", "File", "(", "getSavedIndexesDirectory", "(", ")", ",", "\"\"", ")", ";", "private", "boolean", "javaLikeNamesChanged", "=", "true", ";", "public", "static", "final", "Integer", "SAVED_STATE", "=", "new", "Integer", "(", "0", ")", ";", "public", "static", "final", "Integer", "UPDATING_STATE", "=", "new", "Integer", "(", "1", ")", ";", "public", "static", "final", "Integer", "UNKNOWN_STATE", "=", "new", "Integer", "(", "2", ")", ";", "public", "static", "final", "Integer", "REBUILDING_STATE", "=", "new", "Integer", "(", "3", ")", ";", "public", "static", "final", "Integer", "REUSE_STATE", "=", "new", "Integer", "(", "4", ")", ";", "private", "SimpleLookupTable", "participantsContainers", "=", "null", ";", "private", "boolean", "participantUpdated", "=", "false", ";", "public", "static", "boolean", "DEBUG", "=", "false", ";", "public", "synchronized", "void", "aboutToUpdateIndex", "(", "IPath", "containerPath", ",", "Integer", "newIndexState", ")", "{", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "Object", "state", "=", "getIndexStates", "(", ")", ".", "get", "(", "indexLocation", ")", ";", "Integer", "currentIndexState", "=", "state", "==", "null", "?", "UNKNOWN_STATE", ":", "(", "Integer", ")", "state", ";", "if", "(", "currentIndexState", ".", "compareTo", "(", "REBUILDING_STATE", ")", ">=", "0", ")", "return", ";", "int", "compare", "=", "newIndexState", ".", "compareTo", "(", "currentIndexState", ")", ";", "if", "(", "compare", ">", "0", ")", "{", "updateIndexState", "(", "indexLocation", ",", "newIndexState", ")", ";", "}", "else", "if", "(", "compare", "<", "0", "&&", "this", ".", "indexes", ".", "get", "(", "indexLocation", ")", "==", "null", ")", "{", "rebuildIndex", "(", "indexLocation", ",", "containerPath", ")", ";", "}", "}", "public", "void", "addBinary", "(", "IFile", "resource", ",", "IPath", "containerPath", ")", "{", "if", "(", "JavaCore", ".", "getPlugin", "(", ")", "==", "null", ")", "return", ";", "SearchParticipant", "participant", "=", "SearchEngine", ".", "getDefaultSearchParticipant", "(", ")", ";", "SearchDocument", "document", "=", "participant", ".", "getDocument", "(", "resource", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ";", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "scheduleDocumentIndexing", "(", "document", ",", "containerPath", ",", "indexLocation", ",", "participant", ")", ";", "}", "public", "void", "addSource", "(", "IFile", "resource", ",", "IPath", "containerPath", ",", "SourceElementParser", "parser", ")", "{", "if", "(", "JavaCore", ".", "getPlugin", "(", ")", "==", "null", ")", "return", ";", "SearchParticipant", "participant", "=", "SearchEngine", ".", "getDefaultSearchParticipant", "(", ")", ";", "SearchDocument", "document", "=", "participant", ".", "getDocument", "(", "resource", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ";", "document", ".", "setParser", "(", "parser", ")", ";", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "scheduleDocumentIndexing", "(", "document", ",", "containerPath", ",", "indexLocation", ",", "participant", ")", ";", "}", "public", "void", "cleanUpIndexes", "(", ")", "{", "SimpleSet", "knownPaths", "=", "new", "SimpleSet", "(", ")", ";", "IJavaSearchScope", "scope", "=", "BasicSearchEngine", ".", "createWorkspaceScope", "(", ")", ";", "PatternSearchJob", "job", "=", "new", "PatternSearchJob", "(", "null", ",", "SearchEngine", ".", "getDefaultSearchParticipant", "(", ")", ",", "scope", ",", "null", ")", ";", "Index", "[", "]", "selectedIndexes", "=", "job", ".", "getIndexes", "(", "null", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "selectedIndexes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "IndexLocation", "IndexLocation", "=", "selectedIndexes", "[", "i", "]", ".", "getIndexLocation", "(", ")", ";", "knownPaths", ".", "add", "(", "IndexLocation", ")", ";", "}", "if", "(", "this", ".", "indexStates", "!=", "null", ")", "{", "Object", "[", "]", "keys", "=", "this", ".", "indexStates", ".", "keyTable", ";", "IndexLocation", "[", "]", "locations", "=", "new", "IndexLocation", "[", "this", ".", "indexStates", ".", "elementSize", "]", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "keys", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "IndexLocation", "key", "=", "(", "IndexLocation", ")", "keys", "[", "i", "]", ";", "if", "(", "key", "!=", "null", "&&", "!", "knownPaths", ".", "includes", "(", "key", ")", ")", "locations", "[", "count", "++", "]", "=", "key", ";", "}", "if", "(", "count", ">", "0", ")", "removeIndexesState", "(", "locations", ")", ";", "}", "deleteIndexFiles", "(", "knownPaths", ")", ";", "}", "public", "synchronized", "IndexLocation", "computeIndexLocation", "(", "IPath", "containerPath", ")", "{", "IndexLocation", "indexLocation", "=", "(", "IndexLocation", ")", "this", ".", "indexLocations", ".", "get", "(", "containerPath", ")", ";", "if", "(", "indexLocation", "==", "null", ")", "{", "String", "pathString", "=", "containerPath", ".", "toOSString", "(", ")", ";", "CRC32", "checksumCalculator", "=", "new", "CRC32", "(", ")", ";", "checksumCalculator", ".", "update", "(", "pathString", ".", "getBytes", "(", ")", ")", ";", "String", "fileName", "=", "Long", ".", "toString", "(", "checksumCalculator", ".", "getValue", "(", ")", ")", "+", "\".index\"", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "pathString", "+", "\"", "is", "\"", "+", "fileName", ")", ";", "indexLocation", "=", "(", "IndexLocation", ")", "getIndexStates", "(", ")", ".", "getKey", "(", "new", "FileIndexLocation", "(", "new", "File", "(", "getSavedIndexesDirectory", "(", ")", ",", "fileName", ")", ")", ")", ";", "this", ".", "indexLocations", ".", "put", "(", "containerPath", ",", "indexLocation", ")", ";", "}", "return", "indexLocation", ";", "}", "public", "void", "deleteIndexFiles", "(", ")", "{", "if", "(", "DEBUG", ")", "Util", ".", "verbose", "(", "\"\"", ")", ";", "this", ".", "savedIndexNamesFile", ".", "delete", "(", ")", ";", "deleteIndexFiles", "(", "null", ")", ";", "}", "private", "void", "deleteIndexFiles", "(", "SimpleSet", "pathsToKeep", ")", "{", "File", "[", "]", "indexesFiles", "=", "getSavedIndexesDirectory", "(", ")", ".", "listFiles", "(", ")", ";", "if", "(", "indexesFiles", "==", "null", ")", "return", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "indexesFiles", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "String", "fileName", "=", "indexesFiles", "[", "i", "]", ".", "getAbsolutePath", "(", ")", ";", "if", "(", "pathsToKeep", "!=", "null", "&&", "pathsToKeep", ".", "includes", "(", "new", "FileIndexLocation", "(", "indexesFiles", "[", "i", "]", ")", ")", ")", "continue", ";", "String", "suffix", "=", "\".index\"", ";", "if", "(", "fileName", ".", "regionMatches", "(", "true", ",", "fileName", ".", "length", "(", ")", "-", "suffix", ".", "length", "(", ")", ",", "suffix", ",", "0", ",", "suffix", ".", "length", "(", ")", ")", ")", "{", "if", "(", "VERBOSE", "||", "DEBUG", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexesFiles", "[", "i", "]", ")", ";", "indexesFiles", "[", "i", "]", ".", "delete", "(", ")", ";", "}", "}", "}", "public", "synchronized", "void", "ensureIndexExists", "(", "IndexLocation", "indexLocation", ",", "IPath", "containerPath", ")", "{", "SimpleLookupTable", "states", "=", "getIndexStates", "(", ")", ";", "Object", "state", "=", "states", ".", "get", "(", "indexLocation", ")", ";", "if", "(", "state", "==", "null", ")", "{", "updateIndexState", "(", "indexLocation", ",", "REBUILDING_STATE", ")", ";", "getIndex", "(", "containerPath", ",", "indexLocation", ",", "true", ",", "true", ")", ";", "}", "}", "public", "SourceElementParser", "getSourceElementParser", "(", "IJavaProject", "project", ",", "ISourceElementRequestor", "requestor", ")", "{", "Map", "options", "=", "project", ".", "getOptions", "(", "true", ")", ";", "options", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_TAGS", ",", "\"\"", ")", ";", "SourceElementParser", "parser", "=", "LanguageSupportFactory", ".", "getIndexingParser", "(", "requestor", ",", "new", "DefaultProblemFactory", "(", "Locale", ".", "getDefault", "(", ")", ")", ",", "new", "CompilerOptions", "(", "options", ")", ",", "true", ",", "true", ",", "false", ")", ";", "parser", ".", "reportOnlyOneSyntaxError", "=", "true", ";", "parser", ".", "javadocParser", ".", "checkDocComment", "=", "true", ";", "parser", ".", "javadocParser", ".", "reportProblems", "=", "false", ";", "return", "parser", ";", "}", "public", "synchronized", "Index", "getIndex", "(", "IndexLocation", "indexLocation", ")", "{", "return", "(", "Index", ")", "this", ".", "indexes", ".", "get", "(", "indexLocation", ")", ";", "}", "public", "synchronized", "Index", "getIndex", "(", "IPath", "containerPath", ",", "boolean", "reuseExistingFile", ",", "boolean", "createIfMissing", ")", "{", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "return", "getIndex", "(", "containerPath", ",", "indexLocation", ",", "reuseExistingFile", ",", "createIfMissing", ")", ";", "}", "public", "synchronized", "Index", "getIndex", "(", "IPath", "containerPath", ",", "IndexLocation", "indexLocation", ",", "boolean", "reuseExistingFile", ",", "boolean", "createIfMissing", ")", "{", "Index", "index", "=", "getIndex", "(", "indexLocation", ")", ";", "if", "(", "index", "==", "null", ")", "{", "Object", "state", "=", "getIndexStates", "(", ")", ".", "get", "(", "indexLocation", ")", ";", "Integer", "currentIndexState", "=", "state", "==", "null", "?", "UNKNOWN_STATE", ":", "(", "Integer", ")", "state", ";", "if", "(", "currentIndexState", "==", "UNKNOWN_STATE", ")", "{", "rebuildIndex", "(", "indexLocation", ",", "containerPath", ")", ";", "return", "null", ";", "}", "String", "containerPathString", "=", "containerPath", ".", "getDevice", "(", ")", "==", "null", "?", "containerPath", ".", "toString", "(", ")", ":", "containerPath", ".", "toOSString", "(", ")", ";", "if", "(", "reuseExistingFile", ")", "{", "if", "(", "indexLocation", ".", "exists", "(", ")", ")", "{", "try", "{", "index", "=", "new", "Index", "(", "indexLocation", ",", "containerPathString", ",", "true", ")", ";", "this", ".", "indexes", ".", "put", "(", "indexLocation", ",", "index", ")", ";", "return", "index", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "currentIndexState", "!=", "REBUILDING_STATE", "&&", "currentIndexState", "!=", "REUSE_STATE", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", "+", "\"", "path:", "\"", "+", "containerPathString", ")", ";", "rebuildIndex", "(", "indexLocation", ",", "containerPath", ")", ";", "return", "null", ";", "}", "}", "}", "if", "(", "currentIndexState", "==", "SAVED_STATE", ")", "{", "rebuildIndex", "(", "indexLocation", ",", "containerPath", ")", ";", "return", "null", ";", "}", "if", "(", "currentIndexState", "==", "REUSE_STATE", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", "+", "\"", "path:", "\"", "+", "containerPathString", ")", ";", "this", ".", "indexLocations", ".", "put", "(", "containerPath", ",", "null", ")", ";", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "rebuildIndex", "(", "indexLocation", ",", "containerPath", ")", ";", "return", "null", ";", "}", "}", "if", "(", "createIfMissing", ")", "{", "try", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", "+", "\"", "path:", "\"", "+", "containerPathString", ")", ";", "index", "=", "new", "Index", "(", "indexLocation", ",", "containerPathString", ",", "false", ")", ";", "this", ".", "indexes", ".", "put", "(", "indexLocation", ",", "index", ")", ";", "return", "index", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", "+", "\"", "path:", "\"", "+", "containerPathString", ")", ";", "return", "null", ";", "}", "}", "}", "return", "index", ";", "}", "public", "Index", "[", "]", "getIndexes", "(", "IndexLocation", "[", "]", "locations", ",", "IProgressMonitor", "progressMonitor", ")", "{", "int", "length", "=", "locations", ".", "length", ";", "Index", "[", "]", "locatedIndexes", "=", "new", "Index", "[", "length", "]", ";", "int", "count", "=", "0", ";", "if", "(", "this", ".", "javaLikeNamesChanged", ")", "{", "this", ".", "javaLikeNamesChanged", "=", "hasJavaLikeNamesChanged", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "{", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "IndexLocation", "indexLocation", "=", "locations", "[", "i", "]", ";", "Index", "index", "=", "getIndex", "(", "indexLocation", ")", ";", "if", "(", "index", "==", "null", ")", "{", "IPath", "containerPath", "=", "(", "IPath", ")", "this", ".", "indexLocations", ".", "keyForValue", "(", "indexLocation", ")", ";", "if", "(", "containerPath", "!=", "null", ")", "{", "index", "=", "getIndex", "(", "containerPath", ",", "indexLocation", ",", "true", ",", "false", ")", ";", "if", "(", "index", "!=", "null", "&&", "this", ".", "javaLikeNamesChanged", "&&", "!", "index", ".", "isIndexForJar", "(", ")", ")", "{", "File", "indexFile", "=", "index", ".", "getIndexFile", "(", ")", ";", "if", "(", "indexFile", ".", "exists", "(", ")", ")", "{", "if", "(", "DEBUG", ")", "Util", ".", "verbose", "(", "\"\"", "+", "containerPath", ")", ";", "indexFile", ".", "delete", "(", ")", ";", "}", "this", ".", "indexes", ".", "put", "(", "indexLocation", ",", "null", ")", ";", "rebuildIndex", "(", "indexLocation", ",", "containerPath", ")", ";", "index", "=", "null", ";", "}", "}", "else", "{", "if", "(", "indexLocation", ".", "isParticipantIndex", "(", ")", "&&", "indexLocation", ".", "exists", "(", ")", ")", "{", "try", "{", "IPath", "container", "=", "getParticipantsContainer", "(", "indexLocation", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "index", "=", "new", "Index", "(", "indexLocation", ",", "container", ".", "toOSString", "(", ")", ",", "true", ")", ";", "this", ".", "indexes", ".", "put", "(", "indexLocation", ",", "index", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}", "if", "(", "index", "!=", "null", ")", "locatedIndexes", "[", "count", "++", "]", "=", "index", ";", "}", "if", "(", "this", ".", "javaLikeNamesChanged", ")", "{", "writeJavaLikeNamesFile", "(", ")", ";", "this", ".", "javaLikeNamesChanged", "=", "false", ";", "}", "if", "(", "count", "<", "length", ")", "{", "System", ".", "arraycopy", "(", "locatedIndexes", ",", "0", ",", "locatedIndexes", "=", "new", "Index", "[", "count", "]", ",", "0", ",", "count", ")", ";", "}", "return", "locatedIndexes", ";", "}", "public", "synchronized", "Index", "getIndexForUpdate", "(", "IPath", "containerPath", ",", "boolean", "reuseExistingFile", ",", "boolean", "createIfMissing", ")", "{", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "if", "(", "getIndexStates", "(", ")", ".", "get", "(", "indexLocation", ")", "==", "REBUILDING_STATE", ")", "return", "getIndex", "(", "containerPath", ",", "indexLocation", ",", "reuseExistingFile", ",", "createIfMissing", ")", ";", "return", "null", ";", "}", "private", "SimpleLookupTable", "getIndexStates", "(", ")", "{", "if", "(", "this", ".", "indexStates", "!=", "null", ")", "return", "this", ".", "indexStates", ";", "this", ".", "indexStates", "=", "new", "SimpleLookupTable", "(", ")", ";", "File", "indexesDirectoryPath", "=", "getSavedIndexesDirectory", "(", ")", ";", "char", "[", "]", "[", "]", "savedNames", "=", "readIndexState", "(", "getJavaPluginWorkingLocation", "(", ")", ".", "toOSString", "(", ")", ")", ";", "if", "(", "savedNames", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "1", ",", "l", "=", "savedNames", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "char", "[", "]", "savedName", "=", "savedNames", "[", "i", "]", ";", "if", "(", "savedName", ".", "length", ">", "0", ")", "{", "IndexLocation", "indexLocation", "=", "new", "FileIndexLocation", "(", "new", "File", "(", "indexesDirectoryPath", ",", "String", ".", "valueOf", "(", "savedName", ")", ")", ")", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", ")", ";", "this", ".", "indexStates", ".", "put", "(", "indexLocation", ",", "SAVED_STATE", ")", ";", "}", "}", "}", "else", "{", "writeJavaLikeNamesFile", "(", ")", ";", "this", ".", "javaLikeNamesChanged", "=", "false", ";", "deleteIndexFiles", "(", ")", ";", "}", "readIndexMap", "(", ")", ";", "return", "this", ".", "indexStates", ";", "}", "private", "IPath", "getParticipantsContainer", "(", "IndexLocation", "indexLocation", ")", "{", "if", "(", "this", ".", "participantsContainers", "==", "null", ")", "{", "readParticipantsIndexNamesFile", "(", ")", ";", "}", "return", "(", "IPath", ")", "this", ".", "participantsContainers", ".", "get", "(", "indexLocation", ")", ";", "}", "private", "IPath", "getJavaPluginWorkingLocation", "(", ")", "{", "if", "(", "this", ".", "javaPluginLocation", "!=", "null", ")", "return", "this", ".", "javaPluginLocation", ";", "IPath", "stateLocation", "=", "JavaCore", ".", "getPlugin", "(", ")", ".", "getStateLocation", "(", ")", ";", "return", "this", ".", "javaPluginLocation", "=", "stateLocation", ";", "}", "private", "File", "getSavedIndexesDirectory", "(", ")", "{", "return", "new", "File", "(", "getJavaPluginWorkingLocation", "(", ")", ".", "toOSString", "(", ")", ")", ";", "}", "private", "boolean", "hasJavaLikeNamesChanged", "(", ")", "{", "char", "[", "]", "[", "]", "currentNames", "=", "Util", ".", "getJavaLikeExtensions", "(", ")", ";", "int", "current", "=", "currentNames", ".", "length", ";", "char", "[", "]", "[", "]", "prevNames", "=", "readJavaLikeNamesFile", "(", ")", ";", "if", "(", "prevNames", "==", "null", ")", "{", "if", "(", "VERBOSE", "&&", "current", "!=", "1", ")", "Util", ".", "verbose", "(", "\"\"", ",", "System", ".", "err", ")", ";", "return", "(", "current", "!=", "1", ")", ";", "}", "int", "prev", "=", "prevNames", ".", "length", ";", "if", "(", "current", "!=", "prev", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ",", "System", ".", "err", ")", ";", "return", "true", ";", "}", "if", "(", "current", ">", "1", ")", "{", "System", ".", "arraycopy", "(", "currentNames", ",", "0", ",", "currentNames", "=", "new", "char", "[", "current", "]", "[", "]", ",", "0", ",", "current", ")", ";", "Util", ".", "sort", "(", "currentNames", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "current", ";", "i", "++", ")", "{", "if", "(", "!", "CharOperation", ".", "equals", "(", "currentNames", "[", "i", "]", ",", "prevNames", "[", "i", "]", ")", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ",", "System", ".", "err", ")", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "void", "indexDocument", "(", "SearchDocument", "searchDocument", ",", "SearchParticipant", "searchParticipant", ",", "Index", "index", ",", "IPath", "indexLocation", ")", "{", "try", "{", "searchDocument", ".", "setIndex", "(", "index", ")", ";", "searchParticipant", ".", "indexDocument", "(", "searchDocument", ",", "indexLocation", ")", ";", "}", "finally", "{", "searchDocument", ".", "setIndex", "(", "null", ")", ";", "}", "}", "public", "void", "indexAll", "(", "IProject", "project", ")", "{", "if", "(", "JavaCore", ".", "getPlugin", "(", ")", "==", "null", ")", "return", ";", "try", "{", "JavaModel", "model", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ";", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "model", ".", "getJavaProject", "(", "project", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "javaProject", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entries", ".", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "indexLibrary", "(", "entry", ".", "getPath", "(", ")", ",", "project", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "getLibraryIndexLocation", "(", ")", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "IndexRequest", "request", "=", "new", "IndexAllProject", "(", "project", ",", "this", ")", ";", "if", "(", "!", "isJobWaiting", "(", "request", ")", ")", "request", "(", "request", ")", ";", "}", "public", "void", "indexLibrary", "(", "IPath", "path", ",", "IProject", "requestingProject", ",", "URL", "indexURL", ")", "{", "IndexLocation", "indexFile", "=", "indexURL", "!=", "null", "?", "IndexLocation", ".", "createIndexLocation", "(", "indexURL", ")", ":", "null", ";", "if", "(", "JavaCore", ".", "getPlugin", "(", ")", "==", "null", ")", "return", ";", "IndexRequest", "request", "=", "null", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "true", ")", ";", "if", "(", "target", "instanceof", "IFile", ")", "{", "request", "=", "new", "AddJarFileToIndex", "(", "(", "IFile", ")", "target", ",", "indexFile", ",", "this", ")", ";", "}", "else", "if", "(", "target", "instanceof", "File", ")", "{", "request", "=", "new", "AddJarFileToIndex", "(", "path", ",", "indexFile", ",", "this", ")", ";", "}", "else", "if", "(", "target", "instanceof", "IContainer", ")", "{", "request", "=", "new", "IndexBinaryFolder", "(", "(", "IContainer", ")", "target", ",", "this", ")", ";", "}", "else", "{", "return", ";", "}", "if", "(", "!", "isJobWaiting", "(", "request", ")", ")", "request", "(", "request", ")", ";", "}", "synchronized", "boolean", "addIndex", "(", "IPath", "containerPath", ",", "IndexLocation", "indexFile", ")", "{", "getIndexStates", "(", ")", ".", "put", "(", "indexFile", ",", "REUSE_STATE", ")", ";", "this", ".", "indexLocations", ".", "put", "(", "containerPath", ",", "indexFile", ")", ";", "Index", "index", "=", "getIndex", "(", "containerPath", ",", "indexFile", ",", "true", ",", "false", ")", ";", "if", "(", "index", "==", "null", ")", "{", "indexFile", ".", "close", "(", ")", ";", "this", ".", "indexLocations", ".", "put", "(", "containerPath", ",", "null", ")", ";", "return", "false", ";", "}", "writeIndexMapFile", "(", ")", ";", "return", "true", ";", "}", "public", "void", "indexSourceFolder", "(", "JavaProject", "javaProject", ",", "IPath", "sourceFolder", ",", "char", "[", "]", "[", "]", "inclusionPatterns", ",", "char", "[", "]", "[", "]", "exclusionPatterns", ")", "{", "IProject", "project", "=", "javaProject", ".", "getProject", "(", ")", ";", "if", "(", "this", ".", "jobEnd", ">", "this", ".", "jobStart", ")", "{", "IndexRequest", "request", "=", "new", "IndexAllProject", "(", "project", ",", "this", ")", ";", "if", "(", "isJobWaiting", "(", "request", ")", ")", "return", ";", "}", "request", "(", "new", "AddFolderToIndex", "(", "sourceFolder", ",", "project", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "this", ")", ")", ";", "}", "public", "synchronized", "void", "jobWasCancelled", "(", "IPath", "containerPath", ")", "{", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "Index", "index", "=", "getIndex", "(", "indexLocation", ")", ";", "if", "(", "index", "!=", "null", ")", "{", "index", ".", "monitor", "=", "null", ";", "this", ".", "indexes", ".", "removeKey", "(", "indexLocation", ")", ";", "}", "updateIndexState", "(", "indexLocation", ",", "UNKNOWN_STATE", ")", ";", "}", "protected", "synchronized", "void", "moveToNextJob", "(", ")", "{", "this", ".", "needToSave", "=", "true", ";", "super", ".", "moveToNextJob", "(", ")", ";", "}", "protected", "void", "notifyIdle", "(", "long", "idlingTime", ")", "{", "if", "(", "idlingTime", ">", "1000", "&&", "this", ".", "needToSave", ")", "saveIndexes", "(", ")", ";", "}", "public", "String", "processName", "(", ")", "{", "return", "Messages", ".", "process_name", ";", "}", "private", "char", "[", "]", "[", "]", "readJavaLikeNamesFile", "(", ")", "{", "try", "{", "String", "pathName", "=", "getJavaPluginWorkingLocation", "(", ")", ".", "toOSString", "(", ")", ";", "File", "javaLikeNamesFile", "=", "new", "File", "(", "pathName", ",", "\"\"", ")", ";", "if", "(", "!", "javaLikeNamesFile", ".", "exists", "(", ")", ")", "return", "null", ";", "char", "[", "]", "javaLikeNames", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "getFileCharContent", "(", "javaLikeNamesFile", ",", "null", ")", ";", "if", "(", "javaLikeNames", ".", "length", ">", "0", ")", "{", "char", "[", "]", "[", "]", "names", "=", "CharOperation", ".", "splitOn", "(", "'\\n'", ",", "javaLikeNames", ")", ";", "return", "names", ";", "}", "}", "catch", "(", "IOException", "ignored", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "return", "null", ";", "}", "private", "void", "rebuildIndex", "(", "IndexLocation", "indexLocation", ",", "IPath", "containerPath", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "containerPath", ",", "true", ")", ";", "if", "(", "target", "==", "null", ")", "return", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", "+", "\"", "path:", "\"", "+", "containerPath", ")", ";", "updateIndexState", "(", "indexLocation", ",", "REBUILDING_STATE", ")", ";", "IndexRequest", "request", "=", "null", ";", "if", "(", "target", "instanceof", "IProject", ")", "{", "IProject", "p", "=", "(", "IProject", ")", "target", ";", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "p", ")", ")", "request", "=", "new", "IndexAllProject", "(", "p", ",", "this", ")", ";", "}", "else", "if", "(", "target", "instanceof", "IFolder", ")", "{", "request", "=", "new", "IndexBinaryFolder", "(", "(", "IFolder", ")", "target", ",", "this", ")", ";", "}", "else", "if", "(", "target", "instanceof", "IFile", ")", "{", "request", "=", "new", "AddJarFileToIndex", "(", "(", "IFile", ")", "target", ",", "null", ",", "this", ")", ";", "}", "else", "if", "(", "target", "instanceof", "File", ")", "{", "request", "=", "new", "AddJarFileToIndex", "(", "containerPath", ",", "null", ",", "this", ")", ";", "}", "if", "(", "request", "!=", "null", ")", "request", "(", "request", ")", ";", "}", "public", "synchronized", "Index", "recreateIndex", "(", "IPath", "containerPath", ")", "{", "String", "containerPathString", "=", "containerPath", ".", "getDevice", "(", ")", "==", "null", "?", "containerPath", ".", "toString", "(", ")", ":", "containerPath", ".", "toOSString", "(", ")", ";", "try", "{", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "Index", "index", "=", "getIndex", "(", "indexLocation", ")", ";", "ReadWriteMonitor", "monitor", "=", "index", "==", "null", "?", "null", ":", "index", ".", "monitor", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", "+", "\"", "for", "path:", "\"", "+", "containerPathString", ")", ";", "index", "=", "new", "Index", "(", "indexLocation", ",", "containerPathString", ",", "false", ")", ";", "this", ".", "indexes", ".", "put", "(", "indexLocation", ",", "index", ")", ";", "index", ".", "monitor", "=", "monitor", ";", "return", "index", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "containerPathString", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "}", "public", "void", "remove", "(", "String", "containerRelativePath", ",", "IPath", "indexedContainer", ")", "{", "request", "(", "new", "RemoveFromIndex", "(", "containerRelativePath", ",", "indexedContainer", ",", "this", ")", ")", ";", "}", "public", "synchronized", "void", "removeIndex", "(", "IPath", "containerPath", ")", "{", "if", "(", "VERBOSE", "||", "DEBUG", ")", "Util", ".", "verbose", "(", "\"\"", "+", "containerPath", ")", ";", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "Index", "index", "=", "getIndex", "(", "indexLocation", ")", ";", "File", "indexFile", "=", "null", ";", "if", "(", "index", "!=", "null", ")", "{", "index", ".", "monitor", "=", "null", ";", "indexFile", "=", "index", ".", "getIndexFile", "(", ")", ";", "}", "if", "(", "indexFile", "==", "null", ")", "indexFile", "=", "indexLocation", ".", "getIndexFile", "(", ")", ";", "if", "(", "this", ".", "indexStates", ".", "get", "(", "indexLocation", ")", "==", "REUSE_STATE", ")", "{", "indexLocation", ".", "close", "(", ")", ";", "this", ".", "indexLocations", ".", "put", "(", "containerPath", ",", "null", ")", ";", "}", "else", "if", "(", "indexFile", "!=", "null", "&&", "indexFile", ".", "exists", "(", ")", ")", "{", "if", "(", "DEBUG", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexFile", ")", ";", "indexFile", ".", "delete", "(", ")", ";", "}", "this", ".", "indexes", ".", "removeKey", "(", "indexLocation", ")", ";", "updateIndexState", "(", "indexLocation", ",", "null", ")", ";", "}", "public", "synchronized", "void", "removeIndexPath", "(", "IPath", "path", ")", "{", "if", "(", "VERBOSE", "||", "DEBUG", ")", "Util", ".", "verbose", "(", "\"\"", "+", "path", ")", ";", "Object", "[", "]", "keyTable", "=", "this", ".", "indexes", ".", "keyTable", ";", "Object", "[", "]", "valueTable", "=", "this", ".", "indexes", ".", "valueTable", ";", "IndexLocation", "[", "]", "locations", "=", "null", ";", "int", "max", "=", "this", ".", "indexes", ".", "elementSize", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "keyTable", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "IndexLocation", "indexLocation", "=", "(", "IndexLocation", ")", "keyTable", "[", "i", "]", ";", "if", "(", "indexLocation", "==", "null", ")", "continue", ";", "if", "(", "indexLocation", ".", "startsWith", "(", "path", ")", ")", "{", "Index", "index", "=", "(", "Index", ")", "valueTable", "[", "i", "]", ";", "index", ".", "monitor", "=", "null", ";", "if", "(", "locations", "==", "null", ")", "locations", "=", "new", "IndexLocation", "[", "max", "]", ";", "locations", "[", "count", "++", "]", "=", "indexLocation", ";", "if", "(", "this", ".", "indexStates", ".", "get", "(", "indexLocation", ")", "==", "REUSE_STATE", ")", "{", "indexLocation", ".", "close", "(", ")", ";", "}", "else", "{", "if", "(", "DEBUG", ")", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", ")", ";", "indexLocation", ".", "delete", "(", ")", ";", "}", "}", "else", "{", "max", "--", ";", "}", "}", "if", "(", "locations", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "this", ".", "indexes", ".", "removeKey", "(", "locations", "[", "i", "]", ")", ";", "removeIndexesState", "(", "locations", ")", ";", "if", "(", "this", ".", "participantsContainers", "!=", "null", ")", "{", "boolean", "update", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "if", "(", "this", ".", "participantsContainers", ".", "get", "(", "locations", "[", "i", "]", ")", "!=", "null", ")", "{", "update", "=", "true", ";", "this", ".", "participantsContainers", ".", "removeKey", "(", "locations", "[", "i", "]", ")", ";", "}", "}", "if", "(", "update", ")", "writeParticipantsIndexNamesFile", "(", ")", ";", "}", "}", "}", "public", "synchronized", "void", "removeIndexFamily", "(", "IPath", "path", ")", "{", "ArrayList", "toRemove", "=", "null", ";", "Object", "[", "]", "containerPaths", "=", "this", ".", "indexLocations", ".", "keyTable", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "containerPaths", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IPath", "containerPath", "=", "(", "IPath", ")", "containerPaths", "[", "i", "]", ";", "if", "(", "containerPath", "==", "null", ")", "continue", ";", "if", "(", "path", ".", "isPrefixOf", "(", "containerPath", ")", ")", "{", "if", "(", "toRemove", "==", "null", ")", "toRemove", "=", "new", "ArrayList", "(", ")", ";", "toRemove", ".", "add", "(", "containerPath", ")", ";", "}", "}", "if", "(", "toRemove", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ",", "length", "=", "toRemove", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "removeIndex", "(", "(", "IPath", ")", "toRemove", ".", "get", "(", "i", ")", ")", ";", "}", "public", "void", "removeSourceFolderFromIndex", "(", "JavaProject", "javaProject", ",", "IPath", "sourceFolder", ",", "char", "[", "]", "[", "]", "inclusionPatterns", ",", "char", "[", "]", "[", "]", "exclusionPatterns", ")", "{", "IProject", "project", "=", "javaProject", ".", "getProject", "(", ")", ";", "if", "(", "this", ".", "jobEnd", ">", "this", ".", "jobStart", ")", "{", "IndexRequest", "request", "=", "new", "IndexAllProject", "(", "project", ",", "this", ")", ";", "if", "(", "isJobWaiting", "(", "request", ")", ")", "return", ";", "}", "request", "(", "new", "RemoveFolderFromIndex", "(", "sourceFolder", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "project", ",", "this", ")", ")", ";", "}", "public", "synchronized", "void", "reset", "(", ")", "{", "super", ".", "reset", "(", ")", ";", "if", "(", "this", ".", "indexes", "!=", "null", ")", "{", "this", ".", "indexes", "=", "new", "SimpleLookupTable", "(", ")", ";", "this", ".", "indexStates", "=", "null", ";", "}", "this", ".", "indexLocations", "=", "new", "SimpleLookupTable", "(", ")", ";", "this", ".", "javaPluginLocation", "=", "null", ";", "}", "public", "synchronized", "boolean", "resetIndex", "(", "IPath", "containerPath", ")", "{", "String", "containerPathString", "=", "containerPath", ".", "getDevice", "(", ")", "==", "null", "?", "containerPath", ".", "toString", "(", ")", ":", "containerPath", ".", "toOSString", "(", ")", ";", "try", "{", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "Index", "index", "=", "getIndex", "(", "indexLocation", ")", ";", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", "+", "\"", "for", "path:", "\"", "+", "containerPathString", ")", ";", "}", "if", "(", "index", "==", "null", ")", "{", "return", "recreateIndex", "(", "containerPath", ")", "!=", "null", ";", "}", "index", ".", "reset", "(", ")", ";", "return", "true", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "containerPathString", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}", "}", "public", "void", "saveIndex", "(", "Index", "index", ")", "throws", "IOException", "{", "if", "(", "index", ".", "hasChanged", "(", ")", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "index", ".", "getIndexLocation", "(", ")", ")", ";", "index", ".", "save", "(", ")", ";", "}", "synchronized", "(", "this", ")", "{", "IPath", "containerPath", "=", "new", "Path", "(", "index", ".", "containerPath", ")", ";", "if", "(", "this", ".", "jobEnd", ">", "this", ".", "jobStart", ")", "{", "for", "(", "int", "i", "=", "this", ".", "jobEnd", ";", "i", ">", "this", ".", "jobStart", ";", "i", "--", ")", "{", "IJob", "job", "=", "this", ".", "awaitingJobs", "[", "i", "]", ";", "if", "(", "job", "instanceof", "IndexRequest", ")", "if", "(", "(", "(", "IndexRequest", ")", "job", ")", ".", "containerPath", ".", "equals", "(", "containerPath", ")", ")", "return", ";", "}", "}", "IndexLocation", "indexLocation", "=", "computeIndexLocation", "(", "containerPath", ")", ";", "updateIndexState", "(", "indexLocation", ",", "SAVED_STATE", ")", ";", "}", "}", "public", "void", "saveIndexes", "(", ")", "{", "ArrayList", "toSave", "=", "new", "ArrayList", "(", ")", ";", "synchronized", "(", "this", ")", "{", "Object", "[", "]", "valueTable", "=", "this", ".", "indexes", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "valueTable", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "Index", "index", "=", "(", "Index", ")", "valueTable", "[", "i", "]", ";", "if", "(", "index", "!=", "null", ")", "toSave", ".", "add", "(", "index", ")", ";", "}", "}", "boolean", "allSaved", "=", "true", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "toSave", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Index", "index", "=", "(", "Index", ")", "toSave", ".", "get", "(", "i", ")", ";", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "continue", ";", "try", "{", "monitor", ".", "enterRead", "(", ")", ";", "if", "(", "index", ".", "hasChanged", "(", ")", ")", "{", "if", "(", "monitor", ".", "exitReadEnterWrite", "(", ")", ")", "{", "try", "{", "saveIndex", "(", "index", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "allSaved", "=", "false", ";", "}", "finally", "{", "monitor", ".", "exitWriteEnterRead", "(", ")", ";", "}", "}", "else", "{", "allSaved", "=", "false", ";", "}", "}", "}", "finally", "{", "monitor", ".", "exitRead", "(", ")", ";", "}", "}", "if", "(", "this", ".", "participantsContainers", "!=", "null", "&&", "this", ".", "participantUpdated", ")", "{", "writeParticipantsIndexNamesFile", "(", ")", ";", "this", ".", "participantUpdated", "=", "false", ";", "}", "this", ".", "needToSave", "=", "!", "allSaved", ";", "}", "public", "void", "scheduleDocumentIndexing", "(", "final", "SearchDocument", "searchDocument", ",", "IPath", "container", ",", "final", "IndexLocation", "indexLocation", ",", "final", "SearchParticipant", "searchParticipant", ")", "{", "request", "(", "new", "IndexRequest", "(", "container", ",", "this", ")", "{", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "isCancelled", "||", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", "true", ";", "Index", "index", "=", "getIndex", "(", "this", ".", "containerPath", ",", "indexLocation", ",", "true", ",", "true", ")", ";", "if", "(", "index", "==", "null", ")", "return", "true", ";", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "return", "true", ";", "try", "{", "monitor", ".", "enterWrite", "(", ")", ";", "indexDocument", "(", "searchDocument", ",", "searchParticipant", ",", "index", ",", "new", "Path", "(", "indexLocation", ".", "getCanonicalFilePath", "(", ")", ")", ")", ";", "}", "finally", "{", "monitor", ".", "exitWrite", "(", ")", ";", "}", "return", "true", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"indexing", "\"", "+", "searchDocument", ".", "getPath", "(", ")", ";", "}", "}", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "10", ")", ";", "buffer", ".", "append", "(", "super", ".", "toString", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "int", "count", "=", "0", ";", "Object", "[", "]", "valueTable", "=", "this", ".", "indexes", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "valueTable", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "Index", "index", "=", "(", "Index", ")", "valueTable", "[", "i", "]", ";", "if", "(", "index", "!=", "null", ")", "buffer", ".", "append", "(", "++", "count", ")", ".", "append", "(", "\"", "-", "\"", ")", ".", "append", "(", "index", ".", "toString", "(", ")", ")", ".", "append", "(", "'\\n'", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "private", "void", "readIndexMap", "(", ")", "{", "try", "{", "char", "[", "]", "indexMaps", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "getFileCharContent", "(", "this", ".", "indexNamesMapFile", ",", "null", ")", ";", "char", "[", "]", "[", "]", "names", "=", "CharOperation", ".", "splitOn", "(", "'\\n'", ",", "indexMaps", ")", ";", "if", "(", "names", ".", "length", ">=", "3", ")", "{", "String", "savedSignature", "=", "DiskIndex", ".", "SIGNATURE", ";", "if", "(", "savedSignature", ".", "equals", "(", "new", "String", "(", "names", "[", "0", "]", ")", ")", ")", "{", "for", "(", "int", "i", "=", "1", ",", "l", "=", "names", ".", "length", "-", "1", ";", "i", "<", "l", ";", "i", "+=", "2", ")", "{", "IndexLocation", "indexPath", "=", "IndexLocation", ".", "createIndexLocation", "(", "new", "URL", "(", "new", "String", "(", "names", "[", "i", "]", ")", ")", ")", ";", "this", ".", "indexLocations", ".", "put", "(", "new", "Path", "(", "new", "String", "(", "names", "[", "i", "+", "1", "]", ")", ")", ",", "indexPath", ")", ";", "this", ".", "indexStates", ".", "put", "(", "indexPath", ",", "REUSE_STATE", ")", ";", "}", "}", "}", "}", "catch", "(", "IOException", "ignored", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "return", ";", "}", "private", "char", "[", "]", "[", "]", "readIndexState", "(", "String", "dirOSString", ")", "{", "try", "{", "char", "[", "]", "savedIndexNames", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "getFileCharContent", "(", "this", ".", "savedIndexNamesFile", ",", "null", ")", ";", "if", "(", "savedIndexNames", ".", "length", ">", "0", ")", "{", "char", "[", "]", "[", "]", "names", "=", "CharOperation", ".", "splitOn", "(", "'\\n'", ",", "savedIndexNames", ")", ";", "if", "(", "names", ".", "length", ">", "1", ")", "{", "String", "savedSignature", "=", "DiskIndex", ".", "SIGNATURE", "+", "\"+\"", "+", "dirOSString", ";", "if", "(", "savedSignature", ".", "equals", "(", "new", "String", "(", "names", "[", "0", "]", ")", ")", ")", "return", "names", ";", "}", "}", "}", "catch", "(", "IOException", "ignored", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "return", "null", ";", "}", "private", "void", "readParticipantsIndexNamesFile", "(", ")", "{", "SimpleLookupTable", "containers", "=", "new", "SimpleLookupTable", "(", "3", ")", ";", "try", "{", "char", "[", "]", "participantIndexNames", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "getFileCharContent", "(", "this", ".", "participantIndexNamesFile", ",", "null", ")", ";", "if", "(", "participantIndexNames", ".", "length", ">", "0", ")", "{", "char", "[", "]", "[", "]", "names", "=", "CharOperation", ".", "splitOn", "(", "'\\n'", ",", "participantIndexNames", ")", ";", "if", "(", "names", ".", "length", ">=", "3", ")", "{", "if", "(", "DiskIndex", ".", "SIGNATURE", ".", "equals", "(", "new", "String", "(", "names", "[", "0", "]", ")", ")", ")", "{", "for", "(", "int", "i", "=", "1", ",", "l", "=", "names", ".", "length", "-", "1", ";", "i", "<", "l", ";", "i", "+=", "2", ")", "{", "IndexLocation", "indexLocation", "=", "new", "FileIndexLocation", "(", "new", "File", "(", "new", "String", "(", "names", "[", "i", "]", ")", ")", ",", "true", ")", ";", "containers", ".", "put", "(", "indexLocation", ",", "new", "Path", "(", "new", "String", "(", "names", "[", "i", "+", "1", "]", ")", ")", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "IOException", "ignored", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "this", ".", "participantsContainers", "=", "containers", ";", "return", ";", "}", "private", "synchronized", "void", "removeIndexesState", "(", "IndexLocation", "[", "]", "locations", ")", "{", "getIndexStates", "(", ")", ";", "int", "length", "=", "locations", ".", "length", ";", "boolean", "changed", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "locations", "[", "i", "]", "==", "null", ")", "continue", ";", "if", "(", "(", "this", ".", "indexStates", ".", "removeKey", "(", "locations", "[", "i", "]", ")", "!=", "null", ")", ")", "{", "changed", "=", "true", ";", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "locations", "[", "i", "]", ")", ";", "}", "}", "}", "if", "(", "!", "changed", ")", "return", ";", "writeSavedIndexNamesFile", "(", ")", ";", "writeIndexMapFile", "(", ")", ";", "}", "private", "synchronized", "void", "updateIndexState", "(", "IndexLocation", "indexLocation", ",", "Integer", "indexState", ")", "{", "if", "(", "indexLocation", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "getIndexStates", "(", ")", ";", "if", "(", "indexState", "!=", "null", ")", "{", "if", "(", "indexState", ".", "equals", "(", "this", ".", "indexStates", ".", "get", "(", "indexLocation", ")", ")", ")", "return", ";", "this", ".", "indexStates", ".", "put", "(", "indexLocation", ",", "indexState", ")", ";", "}", "else", "{", "if", "(", "!", "this", ".", "indexStates", ".", "containsKey", "(", "indexLocation", ")", ")", "return", ";", "this", ".", "indexStates", ".", "removeKey", "(", "indexLocation", ")", ";", "}", "writeSavedIndexNamesFile", "(", ")", ";", "if", "(", "VERBOSE", ")", "{", "if", "(", "indexState", "==", "null", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "indexLocation", ")", ";", "}", "else", "{", "String", "state", "=", "\"?\"", ";", "if", "(", "indexState", "==", "SAVED_STATE", ")", "state", "=", "\"SAVED\"", ";", "else", "if", "(", "indexState", "==", "UPDATING_STATE", ")", "state", "=", "\"UPDATING\"", ";", "else", "if", "(", "indexState", "==", "UNKNOWN_STATE", ")", "state", "=", "\"UNKNOWN\"", ";", "else", "if", "(", "indexState", "==", "REBUILDING_STATE", ")", "state", "=", "\"REBUILDING\"", ";", "Util", ".", "verbose", "(", "\"\"", "+", "state", "+", "\"", "for:", "\"", "+", "indexLocation", ")", ";", "}", "}", "}", "public", "void", "updateParticipant", "(", "IPath", "indexPath", ",", "IPath", "containerPath", ")", "{", "if", "(", "this", ".", "participantsContainers", "==", "null", ")", "{", "readParticipantsIndexNamesFile", "(", ")", ";", "}", "IndexLocation", "indexLocation", "=", "new", "FileIndexLocation", "(", "indexPath", ".", "toFile", "(", ")", ",", "true", ")", ";", "if", "(", "this", ".", "participantsContainers", ".", "get", "(", "indexLocation", ")", "==", "null", ")", "{", "this", ".", "participantsContainers", ".", "put", "(", "indexLocation", ",", "containerPath", ")", ";", "this", ".", "participantUpdated", "=", "true", ";", "}", "}", "private", "void", "writeJavaLikeNamesFile", "(", ")", "{", "BufferedWriter", "writer", "=", "null", ";", "String", "pathName", "=", "getJavaPluginWorkingLocation", "(", ")", ".", "toOSString", "(", ")", ";", "try", "{", "char", "[", "]", "[", "]", "currentNames", "=", "Util", ".", "getJavaLikeExtensions", "(", ")", ";", "int", "length", "=", "currentNames", ".", "length", ";", "if", "(", "length", ">", "1", ")", "{", "System", ".", "arraycopy", "(", "currentNames", ",", "0", ",", "currentNames", "=", "new", "char", "[", "length", "]", "[", "]", ",", "0", ",", "length", ")", ";", "Util", ".", "sort", "(", "currentNames", ")", ";", "}", "File", "javaLikeNamesFile", "=", "new", "File", "(", "pathName", ",", "\"\"", ")", ";", "writer", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "javaLikeNamesFile", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", "-", "1", ";", "i", "++", ")", "{", "writer", ".", "write", "(", "currentNames", "[", "i", "]", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "}", "if", "(", "length", ">", "0", ")", "writer", ".", "write", "(", "currentNames", "[", "length", "-", "1", "]", ")", ";", "}", "catch", "(", "IOException", "ignored", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ",", "System", ".", "err", ")", ";", "}", "finally", "{", "if", "(", "writer", "!=", "null", ")", "{", "try", "{", "writer", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}", "private", "void", "writeIndexMapFile", "(", ")", "{", "BufferedWriter", "writer", "=", "null", ";", "try", "{", "writer", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "this", ".", "indexNamesMapFile", ")", ")", ";", "writer", ".", "write", "(", "DiskIndex", ".", "SIGNATURE", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "Object", "[", "]", "keys", "=", "this", ".", "indexStates", ".", "keyTable", ";", "Object", "[", "]", "states", "=", "this", ".", "indexStates", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "states", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "IndexLocation", "location", "=", "(", "IndexLocation", ")", "keys", "[", "i", "]", ";", "if", "(", "location", "!=", "null", "&&", "states", "[", "i", "]", "==", "REUSE_STATE", ")", "{", "IPath", "container", "=", "(", "IPath", ")", "this", ".", "indexLocations", ".", "keyForValue", "(", "location", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "writer", ".", "write", "(", "location", ".", "toString", "(", ")", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "writer", ".", "write", "(", "container", ".", "toOSString", "(", ")", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "}", "}", "}", "}", "catch", "(", "IOException", "ignored", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ",", "System", ".", "err", ")", ";", "}", "finally", "{", "if", "(", "writer", "!=", "null", ")", "{", "try", "{", "writer", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}", "private", "void", "writeParticipantsIndexNamesFile", "(", ")", "{", "BufferedWriter", "writer", "=", "null", ";", "try", "{", "writer", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "this", ".", "participantIndexNamesFile", ")", ")", ";", "writer", ".", "write", "(", "DiskIndex", ".", "SIGNATURE", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "Object", "[", "]", "indexFiles", "=", "this", ".", "participantsContainers", ".", "keyTable", ";", "Object", "[", "]", "containers", "=", "this", ".", "participantsContainers", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "indexFiles", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "IndexLocation", "indexFile", "=", "(", "IndexLocation", ")", "indexFiles", "[", "i", "]", ";", "if", "(", "indexFile", "!=", "null", ")", "{", "writer", ".", "write", "(", "indexFile", ".", "getIndexFile", "(", ")", ".", "getPath", "(", ")", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "writer", ".", "write", "(", "(", "(", "IPath", ")", "containers", "[", "i", "]", ")", ".", "toOSString", "(", ")", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "}", "}", "}", "catch", "(", "IOException", "ignored", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ",", "System", ".", "err", ")", ";", "}", "finally", "{", "if", "(", "writer", "!=", "null", ")", "{", "try", "{", "writer", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}", "private", "void", "writeSavedIndexNamesFile", "(", ")", "{", "BufferedWriter", "writer", "=", "null", ";", "try", "{", "writer", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "this", ".", "savedIndexNamesFile", ")", ")", ";", "writer", ".", "write", "(", "DiskIndex", ".", "SIGNATURE", ")", ";", "writer", ".", "write", "(", "'+'", ")", ";", "writer", ".", "write", "(", "getJavaPluginWorkingLocation", "(", ")", ".", "toOSString", "(", ")", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "Object", "[", "]", "keys", "=", "this", ".", "indexStates", ".", "keyTable", ";", "Object", "[", "]", "states", "=", "this", ".", "indexStates", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "states", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "IndexLocation", "key", "=", "(", "IndexLocation", ")", "keys", "[", "i", "]", ";", "if", "(", "key", "!=", "null", "&&", "states", "[", "i", "]", "==", "SAVED_STATE", ")", "{", "writer", ".", "write", "(", "key", ".", "fileName", "(", ")", ")", ";", "writer", ".", "write", "(", "'\\n'", ")", ";", "}", "}", "}", "catch", "(", "IOException", "ignored", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ",", "System", ".", "err", ")", ";", "}", "finally", "{", "if", "(", "writer", "!=", "null", ")", "{", "try", "{", "writer", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}", "}", "</s>" ]
2,524
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchDocument", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ExtraFlags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileReader", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFormatException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "FieldInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "MethodInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ClassSignature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "EnumConstantSignature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryElementValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TagBits", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "BinaryIndexer", "extends", "AbstractIndexer", "implements", "SuffixConstants", "{", "private", "static", "final", "char", "[", "]", "BYTE", "=", "\"byte\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "CHAR", "=", "\"char\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "DOUBLE", "=", "\"double\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "FLOAT", "=", "\"float\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "INT", "=", "\"int\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "LONG", "=", "\"long\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "SHORT", "=", "\"short\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "BOOLEAN", "=", "\"boolean\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "VOID", "=", "\"void\"", ".", "toCharArray", "(", ")", ";", "private", "static", "final", "char", "[", "]", "INIT", "=", "\"<init>\"", ".", "toCharArray", "(", ")", ";", "public", "BinaryIndexer", "(", "SearchDocument", "document", ")", "{", "super", "(", "document", ")", ";", "}", "private", "void", "addBinaryStandardAnnotations", "(", "long", "annotationTagBits", ")", "{", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AllStandardAnnotationsMask", ")", "==", "0", ")", "{", "return", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationTargetMASK", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_TARGET", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "addBinaryTargetAnnotation", "(", "annotationTagBits", ")", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationRetentionMASK", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_RETENTION", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "addBinaryRetentionAnnotation", "(", "annotationTagBits", ")", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationDeprecated", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_DEPRECATED", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationDocumented", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_DOCUMENTED", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationInherited", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_INHERITED", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationOverride", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_OVERRIDE", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationSuppressWarnings", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_SUPPRESSWARNINGS", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationSafeVarargs", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_SAFEVARARGS", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationPolymorphicSignature", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE", ";", "addAnnotationTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "}", "private", "void", "addBinaryTargetAnnotation", "(", "long", "bits", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "null", ";", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationForAnnotationType", ")", "!=", "0", ")", "{", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "addFieldReference", "(", "TypeConstants", ".", "UPPER_ANNOTATION_TYPE", ")", ";", "}", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationForConstructor", ")", "!=", "0", ")", "{", "if", "(", "compoundName", "==", "null", ")", "{", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "addFieldReference", "(", "TypeConstants", ".", "UPPER_CONSTRUCTOR", ")", ";", "}", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationForField", ")", "!=", "0", ")", "{", "if", "(", "compoundName", "==", "null", ")", "{", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "addFieldReference", "(", "TypeConstants", ".", "UPPER_FIELD", ")", ";", "}", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationForLocalVariable", ")", "!=", "0", ")", "{", "if", "(", "compoundName", "==", "null", ")", "{", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "addFieldReference", "(", "TypeConstants", ".", "UPPER_LOCAL_VARIABLE", ")", ";", "}", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationForMethod", ")", "!=", "0", ")", "{", "if", "(", "compoundName", "==", "null", ")", "{", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "addFieldReference", "(", "TypeConstants", ".", "UPPER_METHOD", ")", ";", "}", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationForPackage", ")", "!=", "0", ")", "{", "if", "(", "compoundName", "==", "null", ")", "{", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "addFieldReference", "(", "TypeConstants", ".", "UPPER_PACKAGE", ")", ";", "}", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationForParameter", ")", "!=", "0", ")", "{", "if", "(", "compoundName", "==", "null", ")", "{", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "addFieldReference", "(", "TypeConstants", ".", "UPPER_PARAMETER", ")", ";", "}", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationForType", ")", "!=", "0", ")", "{", "if", "(", "compoundName", "==", "null", ")", "{", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "}", "addFieldReference", "(", "TypeConstants", ".", "TYPE", ")", ";", "}", "}", "private", "void", "addBinaryRetentionAnnotation", "(", "long", "bits", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_RETENTIONPOLICY", ";", "addTypeReference", "(", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationRuntimeRetention", ")", "==", "TagBits", ".", "AnnotationRuntimeRetention", ")", "{", "addFieldReference", "(", "TypeConstants", ".", "UPPER_RUNTIME", ")", ";", "}", "else", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationClassRetention", ")", "!=", "0", ")", "{", "addFieldReference", "(", "TypeConstants", ".", "UPPER_CLASS", ")", ";", "}", "else", "if", "(", "(", "bits", "&", "TagBits", ".", "AnnotationSourceRetention", ")", "!=", "0", ")", "{", "addFieldReference", "(", "TypeConstants", ".", "UPPER_SOURCE", ")", ";", "}", "}", "private", "void", "addBinaryAnnotation", "(", "IBinaryAnnotation", "annotation", ")", "{", "addAnnotationTypeReference", "(", "replace", "(", "'/'", ",", "'.'", ",", "Signature", ".", "toCharArray", "(", "annotation", ".", "getTypeName", "(", ")", ")", ")", ")", ";", "IBinaryElementValuePair", "[", "]", "valuePairs", "=", "annotation", ".", "getElementValuePairs", "(", ")", ";", "if", "(", "valuePairs", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ",", "vpLength", "=", "valuePairs", ".", "length", ";", "j", "<", "vpLength", ";", "j", "++", ")", "{", "IBinaryElementValuePair", "valuePair", "=", "valuePairs", "[", "j", "]", ";", "addMethodReference", "(", "valuePair", ".", "getName", "(", ")", ",", "0", ")", ";", "Object", "pairValue", "=", "valuePair", ".", "getValue", "(", ")", ";", "addPairValue", "(", "pairValue", ")", ";", "}", "}", "}", "private", "void", "addPairValue", "(", "Object", "pairValue", ")", "{", "if", "(", "pairValue", "instanceof", "EnumConstantSignature", ")", "{", "EnumConstantSignature", "enumConstant", "=", "(", "EnumConstantSignature", ")", "pairValue", ";", "addTypeReference", "(", "replace", "(", "'/'", ",", "'.'", ",", "Signature", ".", "toCharArray", "(", "enumConstant", ".", "getTypeName", "(", ")", ")", ")", ")", ";", "addNameReference", "(", "enumConstant", ".", "getEnumConstantName", "(", ")", ")", ";", "}", "else", "if", "(", "pairValue", "instanceof", "ClassSignature", ")", "{", "ClassSignature", "classConstant", "=", "(", "ClassSignature", ")", "pairValue", ";", "addTypeReference", "(", "replace", "(", "'/'", ",", "'.'", ",", "Signature", ".", "toCharArray", "(", "classConstant", ".", "getTypeName", "(", ")", ")", ")", ")", ";", "}", "else", "if", "(", "pairValue", "instanceof", "IBinaryAnnotation", ")", "{", "addBinaryAnnotation", "(", "(", "IBinaryAnnotation", ")", "pairValue", ")", ";", "}", "else", "if", "(", "pairValue", "instanceof", "Object", "[", "]", ")", "{", "Object", "[", "]", "objects", "=", "(", "Object", "[", "]", ")", "pairValue", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "objects", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "addPairValue", "(", "objects", "[", "i", "]", ")", ";", "}", "}", "}", "public", "void", "addTypeReference", "(", "char", "[", "]", "typeName", ")", "{", "int", "length", "=", "typeName", ".", "length", ";", "if", "(", "length", ">", "2", "&&", "typeName", "[", "length", "-", "2", "]", "==", "'$'", ")", "{", "switch", "(", "typeName", "[", "length", "-", "1", "]", ")", "{", "case", "'0'", ":", "case", "'1'", ":", "case", "'2'", ":", "case", "'3'", ":", "case", "'4'", ":", "case", "'5'", ":", "case", "'6'", ":", "case", "'7'", ":", "case", "'8'", ":", "case", "'9'", ":", "return", ";", "}", "}", "typeName", "=", "CharOperation", ".", "replaceOnCopy", "(", "typeName", ",", "'$'", ",", "'.'", ")", ";", "super", ".", "addTypeReference", "(", "typeName", ")", ";", "}", "private", "void", "convertToArrayType", "(", "char", "[", "]", "[", "]", "parameterTypes", ",", "int", "counter", ",", "int", "arrayDim", ")", "{", "int", "length", "=", "parameterTypes", "[", "counter", "]", ".", "length", ";", "char", "[", "]", "arrayType", "=", "new", "char", "[", "length", "+", "arrayDim", "*", "2", "]", ";", "System", ".", "arraycopy", "(", "parameterTypes", "[", "counter", "]", ",", "0", ",", "arrayType", ",", "0", ",", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arrayDim", ";", "i", "++", ")", "{", "arrayType", "[", "length", "+", "(", "i", "*", "2", ")", "]", "=", "'['", ";", "arrayType", "[", "length", "+", "(", "i", "*", "2", ")", "+", "1", "]", "=", "']'", ";", "}", "parameterTypes", "[", "counter", "]", "=", "arrayType", ";", "}", "private", "char", "[", "]", "convertToArrayType", "(", "char", "[", "]", "typeName", ",", "int", "arrayDim", ")", "{", "int", "length", "=", "typeName", ".", "length", ";", "char", "[", "]", "arrayType", "=", "new", "char", "[", "length", "+", "arrayDim", "*", "2", "]", ";", "System", ".", "arraycopy", "(", "typeName", ",", "0", ",", "arrayType", ",", "0", ",", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arrayDim", ";", "i", "++", ")", "{", "arrayType", "[", "length", "+", "(", "i", "*", "2", ")", "]", "=", "'['", ";", "arrayType", "[", "length", "+", "(", "i", "*", "2", ")", "+", "1", "]", "=", "']'", ";", "}", "return", "arrayType", ";", "}", "private", "char", "[", "]", "decodeFieldType", "(", "char", "[", "]", "signature", ")", "throws", "ClassFormatException", "{", "if", "(", "signature", "==", "null", ")", "return", "null", ";", "int", "arrayDim", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "signature", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "switch", "(", "signature", "[", "i", "]", ")", "{", "case", "'B'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "BYTE", ",", "arrayDim", ")", ";", "return", "BYTE", ";", "case", "'C'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "CHAR", ",", "arrayDim", ")", ";", "return", "CHAR", ";", "case", "'D'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "DOUBLE", ",", "arrayDim", ")", ";", "return", "DOUBLE", ";", "case", "'F'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "FLOAT", ",", "arrayDim", ")", ";", "return", "FLOAT", ";", "case", "'I'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "INT", ",", "arrayDim", ")", ";", "return", "INT", ";", "case", "'J'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "LONG", ",", "arrayDim", ")", ";", "return", "LONG", ";", "case", "'L'", ":", "int", "indexOfSemiColon", "=", "CharOperation", ".", "indexOf", "(", "';'", ",", "signature", ",", "i", "+", "1", ")", ";", "if", "(", "indexOfSemiColon", "==", "-", "1", ")", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "if", "(", "arrayDim", ">", "0", ")", "{", "return", "convertToArrayType", "(", "replace", "(", "'/'", ",", "'.'", ",", "CharOperation", ".", "subarray", "(", "signature", ",", "i", "+", "1", ",", "indexOfSemiColon", ")", ")", ",", "arrayDim", ")", ";", "}", "return", "replace", "(", "'/'", ",", "'.'", ",", "CharOperation", ".", "subarray", "(", "signature", ",", "i", "+", "1", ",", "indexOfSemiColon", ")", ")", ";", "case", "'S'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "SHORT", ",", "arrayDim", ")", ";", "return", "SHORT", ";", "case", "'Z'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "BOOLEAN", ",", "arrayDim", ")", ";", "return", "BOOLEAN", ";", "case", "'V'", ":", "return", "VOID", ";", "case", "'['", ":", "arrayDim", "++", ";", "break", ";", "default", ":", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "}", "}", "return", "null", ";", "}", "private", "char", "[", "]", "[", "]", "decodeParameterTypes", "(", "char", "[", "]", "signature", ",", "boolean", "firstIsSynthetic", ")", "throws", "ClassFormatException", "{", "if", "(", "signature", "==", "null", ")", "return", "null", ";", "int", "indexOfClosingParen", "=", "CharOperation", ".", "lastIndexOf", "(", "')'", ",", "signature", ")", ";", "if", "(", "indexOfClosingParen", "==", "1", ")", "{", "return", "null", ";", "}", "if", "(", "indexOfClosingParen", "==", "-", "1", ")", "{", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "}", "char", "[", "]", "[", "]", "parameterTypes", "=", "new", "char", "[", "3", "]", "[", "]", ";", "int", "parameterTypesCounter", "=", "0", ";", "int", "arrayDim", "=", "0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "indexOfClosingParen", ";", "i", "++", ")", "{", "if", "(", "parameterTypesCounter", "==", "parameterTypes", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "parameterTypes", ",", "0", ",", "(", "parameterTypes", "=", "new", "char", "[", "parameterTypesCounter", "*", "2", "]", "[", "]", ")", ",", "0", ",", "parameterTypesCounter", ")", ";", "}", "switch", "(", "signature", "[", "i", "]", ")", "{", "case", "'B'", ":", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "BYTE", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'C'", ":", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "CHAR", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'D'", ":", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "DOUBLE", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'F'", ":", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "FLOAT", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'I'", ":", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "INT", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'J'", ":", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "LONG", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'L'", ":", "int", "indexOfSemiColon", "=", "CharOperation", ".", "indexOf", "(", "';'", ",", "signature", ",", "i", "+", "1", ")", ";", "if", "(", "indexOfSemiColon", "==", "-", "1", ")", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "if", "(", "firstIsSynthetic", "&&", "parameterTypesCounter", "==", "0", ")", "{", "firstIsSynthetic", "=", "false", ";", "}", "else", "{", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "replace", "(", "'/'", ",", "'.'", ",", "CharOperation", ".", "subarray", "(", "signature", ",", "i", "+", "1", ",", "indexOfSemiColon", ")", ")", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "}", "i", "=", "indexOfSemiColon", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'S'", ":", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "SHORT", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'Z'", ":", "parameterTypes", "[", "parameterTypesCounter", "++", "]", "=", "BOOLEAN", ";", "if", "(", "arrayDim", ">", "0", ")", "convertToArrayType", "(", "parameterTypes", ",", "parameterTypesCounter", "-", "1", ",", "arrayDim", ")", ";", "arrayDim", "=", "0", ";", "break", ";", "case", "'['", ":", "arrayDim", "++", ";", "break", ";", "default", ":", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "}", "}", "if", "(", "parameterTypes", ".", "length", "!=", "parameterTypesCounter", ")", "{", "System", ".", "arraycopy", "(", "parameterTypes", ",", "0", ",", "parameterTypes", "=", "new", "char", "[", "parameterTypesCounter", "]", "[", "]", ",", "0", ",", "parameterTypesCounter", ")", ";", "}", "return", "parameterTypes", ";", "}", "private", "char", "[", "]", "decodeReturnType", "(", "char", "[", "]", "signature", ")", "throws", "ClassFormatException", "{", "if", "(", "signature", "==", "null", ")", "return", "null", ";", "int", "indexOfClosingParen", "=", "CharOperation", ".", "lastIndexOf", "(", "')'", ",", "signature", ")", ";", "if", "(", "indexOfClosingParen", "==", "-", "1", ")", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "int", "arrayDim", "=", "0", ";", "for", "(", "int", "i", "=", "indexOfClosingParen", "+", "1", ",", "max", "=", "signature", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "switch", "(", "signature", "[", "i", "]", ")", "{", "case", "'B'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "BYTE", ",", "arrayDim", ")", ";", "return", "BYTE", ";", "case", "'C'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "CHAR", ",", "arrayDim", ")", ";", "return", "CHAR", ";", "case", "'D'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "DOUBLE", ",", "arrayDim", ")", ";", "return", "DOUBLE", ";", "case", "'F'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "FLOAT", ",", "arrayDim", ")", ";", "return", "FLOAT", ";", "case", "'I'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "INT", ",", "arrayDim", ")", ";", "return", "INT", ";", "case", "'J'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "LONG", ",", "arrayDim", ")", ";", "return", "LONG", ";", "case", "'L'", ":", "int", "indexOfSemiColon", "=", "CharOperation", ".", "indexOf", "(", "';'", ",", "signature", ",", "i", "+", "1", ")", ";", "if", "(", "indexOfSemiColon", "==", "-", "1", ")", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "if", "(", "arrayDim", ">", "0", ")", "{", "return", "convertToArrayType", "(", "replace", "(", "'/'", ",", "'.'", ",", "CharOperation", ".", "subarray", "(", "signature", ",", "i", "+", "1", ",", "indexOfSemiColon", ")", ")", ",", "arrayDim", ")", ";", "}", "return", "replace", "(", "'/'", ",", "'.'", ",", "CharOperation", ".", "subarray", "(", "signature", ",", "i", "+", "1", ",", "indexOfSemiColon", ")", ")", ";", "case", "'S'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "SHORT", ",", "arrayDim", ")", ";", "return", "SHORT", ";", "case", "'Z'", ":", "if", "(", "arrayDim", ">", "0", ")", "return", "convertToArrayType", "(", "BOOLEAN", ",", "arrayDim", ")", ";", "return", "BOOLEAN", ";", "case", "'V'", ":", "return", "VOID", ";", "case", "'['", ":", "arrayDim", "++", ";", "break", ";", "default", ":", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "}", "}", "return", "null", ";", "}", "private", "int", "extractArgCount", "(", "char", "[", "]", "signature", ",", "char", "[", "]", "className", ")", "throws", "ClassFormatException", "{", "int", "indexOfClosingParen", "=", "CharOperation", ".", "lastIndexOf", "(", "')'", ",", "signature", ")", ";", "if", "(", "indexOfClosingParen", "==", "1", ")", "{", "return", "0", ";", "}", "if", "(", "indexOfClosingParen", "==", "-", "1", ")", "{", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "}", "int", "parameterTypesCounter", "=", "0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "indexOfClosingParen", ";", "i", "++", ")", "{", "switch", "(", "signature", "[", "i", "]", ")", "{", "case", "'B'", ":", "case", "'C'", ":", "case", "'D'", ":", "case", "'F'", ":", "case", "'I'", ":", "case", "'J'", ":", "case", "'S'", ":", "case", "'Z'", ":", "parameterTypesCounter", "++", ";", "break", ";", "case", "'L'", ":", "int", "indexOfSemiColon", "=", "CharOperation", ".", "indexOf", "(", "';'", ",", "signature", ",", "i", "+", "1", ")", ";", "if", "(", "indexOfSemiColon", "==", "-", "1", ")", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "if", "(", "className", "!=", "null", "&&", "parameterTypesCounter", "==", "0", ")", "{", "char", "[", "]", "classSignature", "=", "Signature", ".", "createCharArrayTypeSignature", "(", "className", ",", "true", ")", ";", "int", "length", "=", "indexOfSemiColon", "-", "i", "+", "1", ";", "if", "(", "classSignature", ".", "length", ">", "(", "length", "+", "1", ")", ")", "{", "for", "(", "int", "j", "=", "i", ",", "k", "=", "0", ";", "j", "<", "indexOfSemiColon", ";", "j", "++", ",", "k", "++", ")", "{", "if", "(", "!", "(", "signature", "[", "j", "]", "==", "classSignature", "[", "k", "]", "||", "(", "signature", "[", "j", "]", "==", "'/'", "&&", "classSignature", "[", "k", "]", "==", "'.'", ")", ")", ")", "{", "parameterTypesCounter", "++", ";", "break", ";", "}", "}", "}", "else", "{", "parameterTypesCounter", "++", ";", "}", "className", "=", "null", ";", "}", "else", "{", "parameterTypesCounter", "++", ";", "}", "i", "=", "indexOfSemiColon", ";", "break", ";", "case", "'['", ":", "break", ";", "default", ":", "throw", "new", "ClassFormatException", "(", "ClassFormatException", ".", "ErrInvalidMethodSignature", ")", ";", "}", "}", "return", "parameterTypesCounter", ";", "}", "private", "char", "[", "]", "extractClassName", "(", "int", "[", "]", "constantPoolOffsets", ",", "ClassFileReader", "reader", ",", "int", "index", ")", "{", "int", "class_index", "=", "reader", ".", "u2At", "(", "constantPoolOffsets", "[", "index", "]", "+", "1", ")", ";", "int", "utf8Offset", "=", "constantPoolOffsets", "[", "reader", ".", "u2At", "(", "constantPoolOffsets", "[", "class_index", "]", "+", "1", ")", "]", ";", "return", "reader", ".", "utf8At", "(", "utf8Offset", "+", "3", ",", "reader", ".", "u2At", "(", "utf8Offset", "+", "1", ")", ")", ";", "}", "private", "char", "[", "]", "extractName", "(", "int", "[", "]", "constantPoolOffsets", ",", "ClassFileReader", "reader", ",", "int", "index", ")", "{", "int", "nameAndTypeIndex", "=", "reader", ".", "u2At", "(", "constantPoolOffsets", "[", "index", "]", "+", "3", ")", ";", "int", "utf8Offset", "=", "constantPoolOffsets", "[", "reader", ".", "u2At", "(", "constantPoolOffsets", "[", "nameAndTypeIndex", "]", "+", "1", ")", "]", ";", "return", "reader", ".", "utf8At", "(", "utf8Offset", "+", "3", ",", "reader", ".", "u2At", "(", "utf8Offset", "+", "1", ")", ")", ";", "}", "private", "char", "[", "]", "extractClassReference", "(", "int", "[", "]", "constantPoolOffsets", ",", "ClassFileReader", "reader", ",", "int", "index", ")", "{", "int", "utf8Offset", "=", "constantPoolOffsets", "[", "reader", ".", "u2At", "(", "constantPoolOffsets", "[", "index", "]", "+", "1", ")", "]", ";", "return", "reader", ".", "utf8At", "(", "utf8Offset", "+", "3", ",", "reader", ".", "u2At", "(", "utf8Offset", "+", "1", ")", ")", ";", "}", "private", "void", "extractReferenceFromConstantPool", "(", "byte", "[", "]", "contents", ",", "ClassFileReader", "reader", ")", "throws", "ClassFormatException", "{", "int", "[", "]", "constantPoolOffsets", "=", "reader", ".", "getConstantPoolOffsets", "(", ")", ";", "int", "constantPoolCount", "=", "constantPoolOffsets", ".", "length", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "constantPoolCount", ";", "i", "++", ")", "{", "int", "tag", "=", "reader", ".", "u1At", "(", "constantPoolOffsets", "[", "i", "]", ")", ";", "char", "[", "]", "name", "=", "null", ";", "char", "[", "]", "type", "=", "null", ";", "switch", "(", "tag", ")", "{", "case", "ClassFileConstants", ".", "FieldRefTag", ":", "name", "=", "extractName", "(", "constantPoolOffsets", ",", "reader", ",", "i", ")", ";", "addFieldReference", "(", "name", ")", ";", "break", ";", "case", "ClassFileConstants", ".", "MethodRefTag", ":", "case", "ClassFileConstants", ".", "InterfaceMethodRefTag", ":", "name", "=", "extractName", "(", "constantPoolOffsets", ",", "reader", ",", "i", ")", ";", "type", "=", "extractType", "(", "constantPoolOffsets", ",", "reader", ",", "i", ")", ";", "if", "(", "CharOperation", ".", "equals", "(", "INIT", ",", "name", ")", ")", "{", "char", "[", "]", "className", "=", "extractClassName", "(", "constantPoolOffsets", ",", "reader", ",", "i", ")", ";", "boolean", "localType", "=", "false", ";", "if", "(", "className", "!=", "null", ")", "{", "for", "(", "int", "c", "=", "0", ",", "max", "=", "className", ".", "length", ";", "c", "<", "max", ";", "c", "++", ")", "{", "switch", "(", "className", "[", "c", "]", ")", "{", "case", "'/'", ":", "className", "[", "c", "]", "=", "'.'", ";", "break", ";", "case", "'$'", ":", "localType", "=", "true", ";", "break", ";", "}", "}", "}", "addConstructorReference", "(", "className", ",", "extractArgCount", "(", "type", ",", "localType", "?", "className", ":", "null", ")", ")", ";", "}", "else", "{", "addMethodReference", "(", "name", ",", "extractArgCount", "(", "type", ",", "null", ")", ")", ";", "}", "break", ";", "case", "ClassFileConstants", ".", "ClassTag", ":", "name", "=", "extractClassReference", "(", "constantPoolOffsets", ",", "reader", ",", "i", ")", ";", "if", "(", "name", ".", "length", ">", "0", "&&", "name", "[", "0", "]", "==", "'['", ")", "break", ";", "name", "=", "replace", "(", "'/'", ",", "'.'", ",", "name", ")", ";", "addTypeReference", "(", "name", ")", ";", "char", "[", "]", "[", "]", "qualification", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "name", ")", ";", "for", "(", "int", "j", "=", "0", ",", "length", "=", "qualification", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "addNameReference", "(", "qualification", "[", "j", "]", ")", ";", "}", "break", ";", "}", "}", "}", "private", "char", "[", "]", "extractType", "(", "int", "[", "]", "constantPoolOffsets", ",", "ClassFileReader", "reader", ",", "int", "index", ")", "{", "int", "constantPoolIndex", "=", "reader", ".", "u2At", "(", "constantPoolOffsets", "[", "index", "]", "+", "3", ")", ";", "int", "utf8Offset", "=", "constantPoolOffsets", "[", "reader", ".", "u2At", "(", "constantPoolOffsets", "[", "constantPoolIndex", "]", "+", "3", ")", "]", ";", "return", "reader", ".", "utf8At", "(", "utf8Offset", "+", "3", ",", "reader", ".", "u2At", "(", "utf8Offset", "+", "1", ")", ")", ";", "}", "public", "void", "indexDocument", "(", ")", "{", "try", "{", "final", "byte", "[", "]", "contents", "=", "this", ".", "document", ".", "getByteContents", "(", ")", ";", "if", "(", "contents", "==", "null", ")", "return", ";", "final", "String", "path", "=", "this", ".", "document", ".", "getPath", "(", ")", ";", "ClassFileReader", "reader", "=", "new", "ClassFileReader", "(", "contents", ",", "path", "==", "null", "?", "null", ":", "path", ".", "toCharArray", "(", ")", ")", ";", "char", "[", "]", "className", "=", "replace", "(", "'/'", ",", "'.'", ",", "reader", ".", "getName", "(", ")", ")", ";", "int", "packageNameIndex", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "className", ")", ";", "char", "[", "]", "packageName", "=", "null", ";", "char", "[", "]", "name", "=", "null", ";", "if", "(", "packageNameIndex", ">=", "0", ")", "{", "packageName", "=", "CharOperation", ".", "subarray", "(", "className", ",", "0", ",", "packageNameIndex", ")", ";", "name", "=", "CharOperation", ".", "subarray", "(", "className", ",", "packageNameIndex", "+", "1", ",", "className", ".", "length", ")", ";", "}", "else", "{", "packageName", "=", "CharOperation", ".", "NO_CHAR", ";", "name", "=", "className", ";", "}", "char", "[", "]", "enclosingTypeName", "=", "null", ";", "boolean", "isNestedType", "=", "reader", ".", "isNestedType", "(", ")", ";", "if", "(", "isNestedType", ")", "{", "if", "(", "reader", ".", "isAnonymous", "(", ")", ")", "{", "name", "=", "CharOperation", ".", "NO_CHAR", ";", "}", "else", "{", "name", "=", "reader", ".", "getInnerSourceName", "(", ")", ";", "}", "if", "(", "reader", ".", "isLocal", "(", ")", "||", "reader", ".", "isAnonymous", "(", ")", ")", "{", "enclosingTypeName", "=", "ONE_ZERO", ";", "}", "else", "{", "char", "[", "]", "fullEnclosingName", "=", "reader", ".", "getEnclosingTypeName", "(", ")", ";", "int", "nameLength", "=", "fullEnclosingName", ".", "length", "-", "packageNameIndex", "-", "1", ";", "if", "(", "nameLength", "<=", "0", ")", "{", "return", ";", "}", "enclosingTypeName", "=", "new", "char", "[", "nameLength", "]", ";", "System", ".", "arraycopy", "(", "fullEnclosingName", ",", "packageNameIndex", "+", "1", ",", "enclosingTypeName", ",", "0", ",", "nameLength", ")", ";", "}", "}", "char", "[", "]", "[", "]", "typeParameterSignatures", "=", "null", ";", "char", "[", "]", "genericSignature", "=", "reader", ".", "getGenericSignature", "(", ")", ";", "if", "(", "genericSignature", "!=", "null", ")", "{", "CharOperation", ".", "replace", "(", "genericSignature", ",", "'/'", ",", "'.'", ")", ";", "typeParameterSignatures", "=", "Signature", ".", "getTypeParameters", "(", "genericSignature", ")", ";", "}", "if", "(", "name", "==", "null", ")", "return", ";", "char", "[", "]", "[", "]", "superinterfaces", "=", "replace", "(", "'/'", ",", "'.'", ",", "reader", ".", "getInterfaceNames", "(", ")", ")", ";", "char", "[", "]", "[", "]", "enclosingTypeNames", "=", "enclosingTypeName", "==", "null", "?", "null", ":", "new", "char", "[", "]", "[", "]", "{", "enclosingTypeName", "}", ";", "int", "modifiers", "=", "reader", ".", "getModifiers", "(", ")", ";", "switch", "(", "TypeDeclaration", ".", "kind", "(", "modifiers", ")", ")", "{", "case", "TypeDeclaration", ".", "CLASS_DECL", ":", "char", "[", "]", "superclass", "=", "replace", "(", "'/'", ",", "'.'", ",", "reader", ".", "getSuperclassName", "(", ")", ")", ";", "addClassDeclaration", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "superclass", ",", "superinterfaces", ",", "typeParameterSignatures", ",", "false", ")", ";", "break", ";", "case", "TypeDeclaration", ".", "INTERFACE_DECL", ":", "addInterfaceDeclaration", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "superinterfaces", ",", "typeParameterSignatures", ",", "false", ")", ";", "break", ";", "case", "TypeDeclaration", ".", "ENUM_DECL", ":", "superclass", "=", "replace", "(", "'/'", ",", "'.'", ",", "reader", ".", "getSuperclassName", "(", ")", ")", ";", "addEnumDeclaration", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "superclass", ",", "superinterfaces", ",", "false", ")", ";", "break", ";", "case", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ":", "addAnnotationTypeDeclaration", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "false", ")", ";", "break", ";", "}", "IBinaryAnnotation", "[", "]", "annotations", "=", "reader", ".", "getAnnotations", "(", ")", ";", "if", "(", "annotations", "!=", "null", ")", "{", "for", "(", "int", "a", "=", "0", ",", "length", "=", "annotations", ".", "length", ";", "a", "<", "length", ";", "a", "++", ")", "{", "IBinaryAnnotation", "annotation", "=", "annotations", "[", "a", "]", ";", "addBinaryAnnotation", "(", "annotation", ")", ";", "}", "}", "long", "tagBits", "=", "reader", ".", "getTagBits", "(", ")", "&", "TagBits", ".", "AllStandardAnnotationsMask", ";", "if", "(", "tagBits", "!=", "0", ")", "{", "addBinaryStandardAnnotations", "(", "tagBits", ")", ";", "}", "int", "extraFlags", "=", "ExtraFlags", ".", "getExtraFlags", "(", "reader", ")", ";", "MethodInfo", "[", "]", "methods", "=", "(", "MethodInfo", "[", "]", ")", "reader", ".", "getMethods", "(", ")", ";", "boolean", "noConstructor", "=", "true", ";", "if", "(", "methods", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "methods", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "MethodInfo", "method", "=", "methods", "[", "i", "]", ";", "boolean", "isConstructor", "=", "method", ".", "isConstructor", "(", ")", ";", "char", "[", "]", "descriptor", "=", "method", ".", "getMethodDescriptor", "(", ")", ";", "char", "[", "]", "[", "]", "parameterTypes", "=", "decodeParameterTypes", "(", "descriptor", ",", "isConstructor", "&&", "isNestedType", ")", ";", "char", "[", "]", "returnType", "=", "decodeReturnType", "(", "descriptor", ")", ";", "char", "[", "]", "[", "]", "exceptionTypes", "=", "replace", "(", "'/'", ",", "'.'", ",", "method", ".", "getExceptionTypeNames", "(", ")", ")", ";", "if", "(", "isConstructor", ")", "{", "noConstructor", "=", "false", ";", "char", "[", "]", "signature", "=", "method", ".", "getGenericSignature", "(", ")", ";", "if", "(", "signature", "==", "null", ")", "{", "if", "(", "reader", ".", "isNestedType", "(", ")", "&&", "(", "(", "modifiers", "&", "ClassFileConstants", ".", "AccStatic", ")", "==", "0", ")", ")", "{", "signature", "=", "removeFirstSyntheticParameter", "(", "descriptor", ")", ";", "}", "else", "{", "signature", "=", "descriptor", ";", "}", "}", "addConstructorDeclaration", "(", "name", ",", "parameterTypes", "==", "null", "?", "0", ":", "parameterTypes", ".", "length", ",", "signature", ",", "parameterTypes", ",", "method", ".", "getArgumentNames", "(", ")", ",", "method", ".", "getModifiers", "(", ")", ",", "packageName", ",", "modifiers", ",", "exceptionTypes", ",", "extraFlags", ")", ";", "}", "else", "{", "if", "(", "!", "method", ".", "isClinit", "(", ")", ")", "{", "addMethodDeclaration", "(", "method", ".", "getSelector", "(", ")", ",", "parameterTypes", ",", "returnType", ",", "exceptionTypes", ")", ";", "}", "}", "annotations", "=", "method", ".", "getAnnotations", "(", ")", ";", "if", "(", "annotations", "!=", "null", ")", "{", "for", "(", "int", "a", "=", "0", ",", "length", "=", "annotations", ".", "length", ";", "a", "<", "length", ";", "a", "++", ")", "{", "IBinaryAnnotation", "annotation", "=", "annotations", "[", "a", "]", ";", "addBinaryAnnotation", "(", "annotation", ")", ";", "}", "}", "tagBits", "=", "method", ".", "getTagBits", "(", ")", "&", "TagBits", ".", "AllStandardAnnotationsMask", ";", "if", "(", "tagBits", "!=", "0", ")", "{", "addBinaryStandardAnnotations", "(", "tagBits", ")", ";", "}", "}", "}", "if", "(", "noConstructor", ")", "{", "addDefaultConstructorDeclaration", "(", "className", ",", "packageName", ",", "modifiers", ",", "extraFlags", ")", ";", "}", "FieldInfo", "[", "]", "fields", "=", "(", "FieldInfo", "[", "]", ")", "reader", ".", "getFields", "(", ")", ";", "if", "(", "fields", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "fields", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "FieldInfo", "field", "=", "fields", "[", "i", "]", ";", "char", "[", "]", "fieldName", "=", "field", ".", "getName", "(", ")", ";", "char", "[", "]", "fieldType", "=", "decodeFieldType", "(", "replace", "(", "'/'", ",", "'.'", ",", "field", ".", "getTypeName", "(", ")", ")", ")", ";", "addFieldDeclaration", "(", "fieldType", ",", "fieldName", ")", ";", "annotations", "=", "field", ".", "getAnnotations", "(", ")", ";", "if", "(", "annotations", "!=", "null", ")", "{", "for", "(", "int", "a", "=", "0", ",", "length", "=", "annotations", ".", "length", ";", "a", "<", "length", ";", "a", "++", ")", "{", "IBinaryAnnotation", "annotation", "=", "annotations", "[", "a", "]", ";", "addBinaryAnnotation", "(", "annotation", ")", ";", "}", "}", "tagBits", "=", "field", ".", "getTagBits", "(", ")", "&", "TagBits", ".", "AllStandardAnnotationsMask", ";", "if", "(", "tagBits", "!=", "0", ")", "{", "addBinaryStandardAnnotations", "(", "tagBits", ")", ";", "}", "}", "}", "extractReferenceFromConstantPool", "(", "contents", ",", "reader", ")", ";", "}", "catch", "(", "ClassFormatException", "e", ")", "{", "this", ".", "document", ".", "removeAllIndexEntries", "(", ")", ";", "Util", ".", "log", "(", "IStatus", ".", "WARNING", ",", "\"\"", "+", "this", ".", "document", ".", "getPath", "(", ")", "+", "\"\"", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "this", ".", "document", ".", "removeAllIndexEntries", "(", ")", ";", "Util", ".", "log", "(", "IStatus", ".", "WARNING", ",", "\"\"", "+", "this", ".", "document", ".", "getPath", "(", ")", "+", "\"\"", ")", ";", "}", "}", "private", "char", "[", "]", "removeFirstSyntheticParameter", "(", "char", "[", "]", "descriptor", ")", "{", "if", "(", "descriptor", "==", "null", ")", "return", "null", ";", "if", "(", "descriptor", ".", "length", "<", "3", ")", "return", "descriptor", ";", "if", "(", "descriptor", "[", "0", "]", "!=", "'('", ")", "return", "descriptor", ";", "if", "(", "descriptor", "[", "1", "]", "!=", "')'", ")", "{", "int", "start", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "scanTypeSignature", "(", "descriptor", ",", "1", ")", "+", "1", ";", "int", "length", "=", "descriptor", ".", "length", "-", "start", ";", "char", "[", "]", "signature", "=", "new", "char", "[", "length", "+", "1", "]", ";", "signature", "[", "0", "]", "=", "descriptor", "[", "0", "]", ";", "System", ".", "arraycopy", "(", "descriptor", ",", "start", ",", "signature", ",", "1", ",", "length", ")", ";", "return", "signature", ";", "}", "else", "{", "return", "descriptor", ";", "}", "}", "private", "char", "[", "]", "[", "]", "replace", "(", "char", "toBeReplaced", ",", "char", "newChar", ",", "char", "[", "]", "[", "]", "array", ")", "{", "if", "(", "array", "==", "null", ")", "return", "null", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "array", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "replace", "(", "toBeReplaced", ",", "newChar", ",", "array", "[", "i", "]", ")", ";", "}", "return", "array", ";", "}", "private", "char", "[", "]", "replace", "(", "char", "toBeReplaced", ",", "char", "newChar", ",", "char", "[", "]", "array", ")", "{", "if", "(", "array", "==", "null", ")", "return", "null", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "array", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i", "]", "==", "toBeReplaced", ")", "{", "array", "[", "i", "]", "=", "newChar", ";", "}", "}", "return", "array", ";", "}", "}", "</s>" ]
2,525
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "RemoveFolderFromIndex", "extends", "IndexRequest", "{", "IPath", "folderPath", ";", "char", "[", "]", "[", "]", "inclusionPatterns", ";", "char", "[", "]", "[", "]", "exclusionPatterns", ";", "public", "RemoveFolderFromIndex", "(", "IPath", "folderPath", ",", "char", "[", "]", "[", "]", "inclusionPatterns", ",", "char", "[", "]", "[", "]", "exclusionPatterns", ",", "IProject", "project", ",", "IndexManager", "manager", ")", "{", "super", "(", "project", ".", "getFullPath", "(", ")", ",", "manager", ")", ";", "this", ".", "folderPath", "=", "folderPath", ";", "this", ".", "inclusionPatterns", "=", "inclusionPatterns", ";", "this", ".", "exclusionPatterns", "=", "exclusionPatterns", ";", "}", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "isCancelled", "||", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", "true", ";", "Index", "index", "=", "this", ".", "manager", ".", "getIndex", "(", "this", ".", "containerPath", ",", "true", ",", "false", ")", ";", "if", "(", "index", "==", "null", ")", "return", "true", ";", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "return", "true", ";", "try", "{", "monitor", ".", "enterRead", "(", ")", ";", "String", "containerRelativePath", "=", "Util", ".", "relativePath", "(", "this", ".", "folderPath", ",", "this", ".", "containerPath", ".", "segmentCount", "(", ")", ")", ";", "String", "[", "]", "paths", "=", "index", ".", "queryDocumentNames", "(", "containerRelativePath", ")", ";", "if", "(", "paths", "!=", "null", ")", "{", "if", "(", "this", ".", "exclusionPatterns", "==", "null", "&&", "this", ".", "inclusionPatterns", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "paths", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "this", ".", "manager", ".", "remove", "(", "paths", "[", "i", "]", ",", "this", ".", "containerPath", ")", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "paths", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "String", "documentPath", "=", "this", ".", "containerPath", ".", "toString", "(", ")", "+", "'/'", "+", "paths", "[", "i", "]", ";", "if", "(", "!", "Util", ".", "isExcluded", "(", "new", "Path", "(", "documentPath", ")", ",", "this", ".", "inclusionPatterns", ",", "this", ".", "exclusionPatterns", ",", "false", ")", ")", "this", ".", "manager", ".", "remove", "(", "paths", "[", "i", "]", ",", "this", ".", "containerPath", ")", ";", "}", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "folderPath", "+", "\"\"", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}", "finally", "{", "monitor", ".", "exitRead", "(", ")", ";", "}", "return", "true", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"removing", "\"", "+", "this", ".", "folderPath", "+", "\"", "from", "index", "\"", "+", "this", ".", "containerPath", ";", "}", "}", "</s>" ]
2,526
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileNotFoundException", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipEntry", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "FileIndexLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "IndexLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaSearchDocument", ";", "public", "class", "DefaultJavaIndexer", "{", "private", "static", "final", "char", "JAR_SEPARATOR", "=", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", ".", "charAt", "(", "0", ")", ";", "public", "void", "generateIndexForJar", "(", "String", "pathToJar", ",", "String", "pathToIndexFile", ")", "throws", "IOException", "{", "File", "f", "=", "new", "File", "(", "pathToJar", ")", ";", "if", "(", "!", "f", ".", "exists", "(", ")", ")", "{", "throw", "new", "FileNotFoundException", "(", "pathToJar", "+", "\"", "not", "found\"", ")", ";", "}", "IndexLocation", "indexLocation", "=", "new", "FileIndexLocation", "(", "new", "File", "(", "pathToIndexFile", ")", ")", ";", "Index", "index", "=", "new", "Index", "(", "indexLocation", ",", "pathToJar", ",", "false", ")", ";", "SearchParticipant", "participant", "=", "SearchEngine", ".", "getDefaultSearchParticipant", "(", ")", ";", "index", ".", "separator", "=", "JAR_SEPARATOR", ";", "ZipFile", "zip", "=", "new", "ZipFile", "(", "pathToJar", ")", ";", "try", "{", "for", "(", "Enumeration", "e", "=", "zip", ".", "entries", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "ZipEntry", "ze", "=", "(", "ZipEntry", ")", "e", ".", "nextElement", "(", ")", ";", "String", "zipEntryName", "=", "ze", ".", "getName", "(", ")", ";", "if", "(", "Util", ".", "isClassFileName", "(", "zipEntryName", ")", ")", "{", "final", "byte", "[", "]", "classFileBytes", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "getZipEntryByteContent", "(", "ze", ",", "zip", ")", ";", "JavaSearchDocument", "entryDocument", "=", "new", "JavaSearchDocument", "(", "ze", ",", "new", "Path", "(", "pathToJar", ")", ",", "classFileBytes", ",", "participant", ")", ";", "entryDocument", ".", "setIndex", "(", "index", ")", ";", "new", "BinaryIndexer", "(", "entryDocument", ")", ".", "indexDocument", "(", ")", ";", "}", "}", "index", ".", "save", "(", ")", ";", "}", "finally", "{", "zip", ".", "close", "(", ")", ";", "}", "return", ";", "}", "}", "</s>" ]
2,527
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchDocument", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "*", ";", "public", "abstract", "class", "AbstractIndexer", "implements", "IIndexConstants", "{", "SearchDocument", "document", ";", "public", "AbstractIndexer", "(", "SearchDocument", "document", ")", "{", "this", ".", "document", "=", "document", ";", "}", "public", "void", "addAnnotationTypeDeclaration", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "name", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "boolean", "secondary", ")", "{", "addTypeDeclaration", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "secondary", ")", ";", "addIndexEntry", "(", "SUPER_REF", ",", "SuperTypeReferencePattern", ".", "createIndexKey", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "null", ",", "ANNOTATION_TYPE_SUFFIX", ",", "CharOperation", ".", "concatWith", "(", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ANNOTATION", ",", "'.'", ")", ",", "ANNOTATION_TYPE_SUFFIX", ")", ")", ";", "}", "public", "void", "addAnnotationTypeReference", "(", "char", "[", "]", "typeName", ")", "{", "addIndexEntry", "(", "ANNOTATION_REF", ",", "CharOperation", ".", "lastSegment", "(", "typeName", ",", "'.'", ")", ")", ";", "}", "public", "void", "addClassDeclaration", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "name", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "char", "[", "]", "superclass", ",", "char", "[", "]", "[", "]", "superinterfaces", ",", "char", "[", "]", "[", "]", "typeParameterSignatures", ",", "boolean", "secondary", ")", "{", "addTypeDeclaration", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "secondary", ")", ";", "if", "(", "superclass", "!=", "null", ")", "{", "superclass", "=", "erasure", "(", "superclass", ")", ";", "addTypeReference", "(", "superclass", ")", ";", "}", "addIndexEntry", "(", "SUPER_REF", ",", "SuperTypeReferencePattern", ".", "createIndexKey", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "typeParameterSignatures", ",", "CLASS_SUFFIX", ",", "superclass", ",", "CLASS_SUFFIX", ")", ")", ";", "if", "(", "superinterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "superinterfaces", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "char", "[", "]", "superinterface", "=", "erasure", "(", "superinterfaces", "[", "i", "]", ")", ";", "addTypeReference", "(", "superinterface", ")", ";", "addIndexEntry", "(", "SUPER_REF", ",", "SuperTypeReferencePattern", ".", "createIndexKey", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "typeParameterSignatures", ",", "CLASS_SUFFIX", ",", "superinterface", ",", "INTERFACE_SUFFIX", ")", ")", ";", "}", "}", "}", "private", "char", "[", "]", "erasure", "(", "char", "[", "]", "typeName", ")", "{", "int", "genericStart", "=", "CharOperation", ".", "indexOf", "(", "Signature", ".", "C_GENERIC_START", ",", "typeName", ")", ";", "if", "(", "genericStart", ">", "-", "1", ")", "typeName", "=", "CharOperation", ".", "subarray", "(", "typeName", ",", "0", ",", "genericStart", ")", ";", "return", "typeName", ";", "}", "public", "void", "addConstructorDeclaration", "(", "char", "[", "]", "typeName", ",", "int", "argCount", ",", "char", "[", "]", "signature", ",", "char", "[", "]", "[", "]", "parameterTypes", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "int", "typeModifiers", ",", "char", "[", "]", "[", "]", "exceptionTypes", ",", "int", "extraFlags", ")", "{", "addIndexEntry", "(", "CONSTRUCTOR_DECL", ",", "ConstructorPattern", ".", "createDeclarationIndexKey", "(", "typeName", ",", "argCount", ",", "signature", ",", "parameterTypes", ",", "parameterNames", ",", "modifiers", ",", "packageName", ",", "typeModifiers", ",", "extraFlags", ")", ")", ";", "if", "(", "parameterTypes", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "argCount", ";", "i", "++", ")", "addTypeReference", "(", "parameterTypes", "[", "i", "]", ")", ";", "}", "if", "(", "exceptionTypes", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ",", "max", "=", "exceptionTypes", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "addTypeReference", "(", "exceptionTypes", "[", "i", "]", ")", ";", "}", "public", "void", "addConstructorReference", "(", "char", "[", "]", "typeName", ",", "int", "argCount", ")", "{", "char", "[", "]", "simpleTypeName", "=", "CharOperation", ".", "lastSegment", "(", "typeName", ",", "'.'", ")", ";", "addTypeReference", "(", "simpleTypeName", ")", ";", "addIndexEntry", "(", "CONSTRUCTOR_REF", ",", "ConstructorPattern", ".", "createIndexKey", "(", "simpleTypeName", ",", "argCount", ")", ")", ";", "char", "[", "]", "innermostTypeName", "=", "CharOperation", ".", "lastSegment", "(", "simpleTypeName", ",", "'$'", ")", ";", "if", "(", "innermostTypeName", "!=", "simpleTypeName", ")", "addIndexEntry", "(", "CONSTRUCTOR_REF", ",", "ConstructorPattern", ".", "createIndexKey", "(", "innermostTypeName", ",", "argCount", ")", ")", ";", "}", "public", "void", "addDefaultConstructorDeclaration", "(", "char", "[", "]", "typeName", ",", "char", "[", "]", "packageName", ",", "int", "typeModifiers", ",", "int", "extraFlags", ")", "{", "addIndexEntry", "(", "CONSTRUCTOR_DECL", ",", "ConstructorPattern", ".", "createDefaultDeclarationIndexKey", "(", "CharOperation", ".", "lastSegment", "(", "typeName", ",", "'.'", ")", ",", "packageName", ",", "typeModifiers", ",", "extraFlags", ")", ")", ";", "}", "public", "void", "addEnumDeclaration", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "name", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "char", "[", "]", "superclass", ",", "char", "[", "]", "[", "]", "superinterfaces", ",", "boolean", "secondary", ")", "{", "addTypeDeclaration", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "secondary", ")", ";", "addIndexEntry", "(", "SUPER_REF", ",", "SuperTypeReferencePattern", ".", "createIndexKey", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "null", ",", "ENUM_SUFFIX", ",", "superclass", ",", "CLASS_SUFFIX", ")", ")", ";", "if", "(", "superinterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "superinterfaces", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "char", "[", "]", "superinterface", "=", "erasure", "(", "superinterfaces", "[", "i", "]", ")", ";", "addTypeReference", "(", "superinterface", ")", ";", "addIndexEntry", "(", "SUPER_REF", ",", "SuperTypeReferencePattern", ".", "createIndexKey", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "null", ",", "ENUM_SUFFIX", ",", "superinterface", ",", "INTERFACE_SUFFIX", ")", ")", ";", "}", "}", "}", "public", "void", "addFieldDeclaration", "(", "char", "[", "]", "typeName", ",", "char", "[", "]", "fieldName", ")", "{", "addIndexEntry", "(", "FIELD_DECL", ",", "FieldPattern", ".", "createIndexKey", "(", "fieldName", ")", ")", ";", "addTypeReference", "(", "typeName", ")", ";", "}", "public", "void", "addFieldReference", "(", "char", "[", "]", "fieldName", ")", "{", "addNameReference", "(", "fieldName", ")", ";", "}", "protected", "void", "addIndexEntry", "(", "char", "[", "]", "category", ",", "char", "[", "]", "key", ")", "{", "this", ".", "document", ".", "addIndexEntry", "(", "category", ",", "key", ")", ";", "}", "public", "void", "addInterfaceDeclaration", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "name", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "char", "[", "]", "[", "]", "superinterfaces", ",", "char", "[", "]", "[", "]", "typeParameterSignatures", ",", "boolean", "secondary", ")", "{", "addTypeDeclaration", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "secondary", ")", ";", "if", "(", "superinterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "superinterfaces", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "char", "[", "]", "superinterface", "=", "erasure", "(", "superinterfaces", "[", "i", "]", ")", ";", "addTypeReference", "(", "superinterface", ")", ";", "addIndexEntry", "(", "SUPER_REF", ",", "SuperTypeReferencePattern", ".", "createIndexKey", "(", "modifiers", ",", "packageName", ",", "name", ",", "enclosingTypeNames", ",", "typeParameterSignatures", ",", "INTERFACE_SUFFIX", ",", "superinterface", ",", "INTERFACE_SUFFIX", ")", ")", ";", "}", "}", "}", "public", "void", "addMethodDeclaration", "(", "char", "[", "]", "methodName", ",", "char", "[", "]", "[", "]", "parameterTypes", ",", "char", "[", "]", "returnType", ",", "char", "[", "]", "[", "]", "exceptionTypes", ")", "{", "int", "argCount", "=", "parameterTypes", "==", "null", "?", "0", ":", "parameterTypes", ".", "length", ";", "addIndexEntry", "(", "METHOD_DECL", ",", "MethodPattern", ".", "createIndexKey", "(", "methodName", ",", "argCount", ")", ")", ";", "if", "(", "parameterTypes", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "argCount", ";", "i", "++", ")", "addTypeReference", "(", "parameterTypes", "[", "i", "]", ")", ";", "}", "if", "(", "exceptionTypes", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ",", "max", "=", "exceptionTypes", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "addTypeReference", "(", "exceptionTypes", "[", "i", "]", ")", ";", "if", "(", "returnType", "!=", "null", ")", "addTypeReference", "(", "returnType", ")", ";", "}", "public", "void", "addMethodReference", "(", "char", "[", "]", "methodName", ",", "int", "argCount", ")", "{", "addIndexEntry", "(", "METHOD_REF", ",", "MethodPattern", ".", "createIndexKey", "(", "methodName", ",", "argCount", ")", ")", ";", "}", "public", "void", "addNameReference", "(", "char", "[", "]", "name", ")", "{", "addIndexEntry", "(", "REF", ",", "name", ")", ";", "}", "protected", "void", "addTypeDeclaration", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "name", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "boolean", "secondary", ")", "{", "char", "[", "]", "indexKey", "=", "TypeDeclarationPattern", ".", "createIndexKey", "(", "modifiers", ",", "name", ",", "packageName", ",", "enclosingTypeNames", ",", "secondary", ")", ";", "if", "(", "secondary", ")", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "secondaryTypeAdding", "(", "this", ".", "document", ".", "getPath", "(", ")", ",", "name", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "name", ",", "packageName", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "packageName", ")", ";", "addIndexEntry", "(", "TYPE_DECL", ",", "indexKey", ")", ";", "}", "public", "void", "addTypeReference", "(", "char", "[", "]", "typeName", ")", "{", "addNameReference", "(", "CharOperation", ".", "lastSegment", "(", "typeName", ",", "'.'", ")", ")", ";", "}", "public", "abstract", "void", "indexDocument", "(", ")", ";", "}", "</s>" ]
2,528
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ExtraFlags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ISourceElementRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "AbstractMethodDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Expression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ImportReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "public", "class", "SourceIndexerRequestor", "implements", "ISourceElementRequestor", ",", "IIndexConstants", "{", "SourceIndexer", "indexer", ";", "char", "[", "]", "packageName", "=", "CharOperation", ".", "NO_CHAR", ";", "char", "[", "]", "[", "]", "enclosingTypeNames", "=", "new", "char", "[", "5", "]", "[", "]", ";", "int", "depth", "=", "0", ";", "int", "methodDepth", "=", "0", ";", "public", "SourceIndexerRequestor", "(", "SourceIndexer", "indexer", ")", "{", "this", ".", "indexer", "=", "indexer", ";", "}", "public", "void", "acceptAnnotationTypeReference", "(", "char", "[", "]", "[", "]", "typeName", ",", "int", "sourceStart", ",", "int", "sourceEnd", ")", "{", "int", "length", "=", "typeName", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", "-", "1", ";", "i", "++", ")", "acceptUnknownReference", "(", "typeName", "[", "i", "]", ",", "0", ")", ";", "acceptAnnotationTypeReference", "(", "typeName", "[", "length", "-", "1", "]", ",", "0", ")", ";", "}", "public", "void", "acceptAnnotationTypeReference", "(", "char", "[", "]", "simpleTypeName", ",", "int", "sourcePosition", ")", "{", "this", ".", "indexer", ".", "addAnnotationTypeReference", "(", "simpleTypeName", ")", ";", "}", "public", "void", "acceptConstructorReference", "(", "char", "[", "]", "typeName", ",", "int", "argCount", ",", "int", "sourcePosition", ")", "{", "if", "(", "CharOperation", ".", "indexOf", "(", "Signature", ".", "C_GENERIC_START", ",", "typeName", ")", ">", "0", ")", "{", "typeName", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "Signature", ".", "createTypeSignature", "(", "typeName", ",", "false", ")", ")", ".", "toCharArray", "(", ")", ")", ";", "}", "this", ".", "indexer", ".", "addConstructorReference", "(", "typeName", ",", "argCount", ")", ";", "int", "lastDot", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "typeName", ")", ";", "if", "(", "lastDot", "!=", "-", "1", ")", "{", "char", "[", "]", "[", "]", "qualification", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "CharOperation", ".", "subarray", "(", "typeName", ",", "0", ",", "lastDot", ")", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "qualification", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "indexer", ".", "addNameReference", "(", "qualification", "[", "i", "]", ")", ";", "}", "}", "}", "public", "void", "acceptFieldReference", "(", "char", "[", "]", "fieldName", ",", "int", "sourcePosition", ")", "{", "this", ".", "indexer", ".", "addFieldReference", "(", "fieldName", ")", ";", "}", "public", "void", "acceptImport", "(", "int", "declarationStart", ",", "int", "declarationEnd", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "[", "]", "tokens", ",", "boolean", "onDemand", ",", "int", "modifiers", ")", "{", "}", "public", "void", "acceptLineSeparatorPositions", "(", "int", "[", "]", "positions", ")", "{", "}", "public", "void", "acceptMethodReference", "(", "char", "[", "]", "methodName", ",", "int", "argCount", ",", "int", "sourcePosition", ")", "{", "this", ".", "indexer", ".", "addMethodReference", "(", "methodName", ",", "argCount", ")", ";", "}", "public", "void", "acceptPackage", "(", "ImportReference", "importReference", ")", "{", "this", ".", "packageName", "=", "CharOperation", ".", "concatWith", "(", "importReference", ".", "getImportName", "(", ")", ",", "'.'", ")", ";", "}", "public", "void", "acceptProblem", "(", "CategorizedProblem", "problem", ")", "{", "}", "public", "void", "acceptTypeReference", "(", "char", "[", "]", "[", "]", "typeName", ",", "int", "sourceStart", ",", "int", "sourceEnd", ")", "{", "int", "length", "=", "typeName", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", "-", "1", ";", "i", "++", ")", "acceptUnknownReference", "(", "typeName", "[", "i", "]", ",", "0", ")", ";", "acceptTypeReference", "(", "typeName", "[", "length", "-", "1", "]", ",", "0", ")", ";", "}", "public", "void", "acceptTypeReference", "(", "char", "[", "]", "simpleTypeName", ",", "int", "sourcePosition", ")", "{", "this", ".", "indexer", ".", "addTypeReference", "(", "simpleTypeName", ")", ";", "}", "public", "void", "acceptUnknownReference", "(", "char", "[", "]", "[", "]", "name", ",", "int", "sourceStart", ",", "int", "sourceEnd", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "name", ".", "length", ";", "i", "++", ")", "{", "acceptUnknownReference", "(", "name", "[", "i", "]", ",", "0", ")", ";", "}", "}", "public", "void", "acceptUnknownReference", "(", "char", "[", "]", "name", ",", "int", "sourcePosition", ")", "{", "this", ".", "indexer", ".", "addNameReference", "(", "name", ")", ";", "}", "private", "void", "addDefaultConstructorIfNecessary", "(", "TypeInfo", "typeInfo", ")", "{", "boolean", "hasConstructor", "=", "false", ";", "TypeDeclaration", "typeDeclaration", "=", "typeInfo", ".", "node", ";", "AbstractMethodDeclaration", "[", "]", "methods", "=", "typeDeclaration", ".", "methods", ";", "int", "methodCounter", "=", "methods", "==", "null", "?", "0", ":", "methods", ".", "length", ";", "done", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methodCounter", ";", "i", "++", ")", "{", "AbstractMethodDeclaration", "method", "=", "methods", "[", "i", "]", ";", "if", "(", "method", ".", "isConstructor", "(", ")", "&&", "!", "method", ".", "isDefaultConstructor", "(", ")", ")", "{", "hasConstructor", "=", "true", ";", "break", "done", ";", "}", "}", "if", "(", "!", "hasConstructor", ")", "{", "this", ".", "indexer", ".", "addDefaultConstructorDeclaration", "(", "typeInfo", ".", "name", ",", "this", ".", "packageName", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "this", ".", "packageName", ",", "typeInfo", ".", "modifiers", ",", "getMoreExtraFlags", "(", "typeInfo", ".", "extraFlags", ")", ")", ";", "}", "}", "public", "char", "[", "]", "[", "]", "enclosingTypeNames", "(", ")", "{", "if", "(", "this", ".", "depth", "==", "0", ")", "return", "null", ";", "char", "[", "]", "[", "]", "qualification", "=", "new", "char", "[", "this", ".", "depth", "]", "[", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "enclosingTypeNames", ",", "0", ",", "qualification", ",", "0", ",", "this", ".", "depth", ")", ";", "return", "qualification", ";", "}", "private", "void", "enterAnnotationType", "(", "TypeInfo", "typeInfo", ")", "{", "char", "[", "]", "[", "]", "typeNames", ";", "if", "(", "this", ".", "methodDepth", ">", "0", ")", "{", "typeNames", "=", "ONE_ZERO_CHAR", ";", "}", "else", "{", "typeNames", "=", "enclosingTypeNames", "(", ")", ";", "}", "this", ".", "indexer", ".", "addAnnotationTypeDeclaration", "(", "typeInfo", ".", "modifiers", ",", "this", ".", "packageName", ",", "typeInfo", ".", "name", ",", "typeNames", ",", "typeInfo", ".", "secondary", ")", ";", "addDefaultConstructorIfNecessary", "(", "typeInfo", ")", ";", "pushTypeName", "(", "typeInfo", ".", "name", ")", ";", "}", "private", "void", "enterClass", "(", "TypeInfo", "typeInfo", ")", "{", "if", "(", "typeInfo", ".", "superclass", "!=", "null", ")", "{", "typeInfo", ".", "superclass", "=", "getSimpleName", "(", "typeInfo", ".", "superclass", ")", ";", "this", ".", "indexer", ".", "addConstructorReference", "(", "typeInfo", ".", "superclass", ",", "0", ")", ";", "}", "if", "(", "typeInfo", ".", "superinterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "typeInfo", ".", "superinterfaces", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "typeInfo", ".", "superinterfaces", "[", "i", "]", "=", "getSimpleName", "(", "typeInfo", ".", "superinterfaces", "[", "i", "]", ")", ";", "}", "}", "char", "[", "]", "[", "]", "typeNames", ";", "if", "(", "this", ".", "methodDepth", ">", "0", ")", "{", "typeNames", "=", "ONE_ZERO_CHAR", ";", "}", "else", "{", "typeNames", "=", "enclosingTypeNames", "(", ")", ";", "}", "char", "[", "]", "[", "]", "typeParameterSignatures", "=", "null", ";", "if", "(", "typeInfo", ".", "typeParameters", "!=", "null", ")", "{", "int", "typeParametersLength", "=", "typeInfo", ".", "typeParameters", ".", "length", ";", "typeParameterSignatures", "=", "new", "char", "[", "typeParametersLength", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeParametersLength", ";", "i", "++", ")", "{", "ISourceElementRequestor", ".", "TypeParameterInfo", "typeParameterInfo", "=", "typeInfo", ".", "typeParameters", "[", "i", "]", ";", "typeParameterSignatures", "[", "i", "]", "=", "Signature", ".", "createTypeParameterSignature", "(", "typeParameterInfo", ".", "name", ",", "typeParameterInfo", ".", "bounds", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "typeParameterInfo", ".", "bounds", ")", ";", "}", "}", "this", ".", "indexer", ".", "addClassDeclaration", "(", "typeInfo", ".", "modifiers", ",", "this", ".", "packageName", ",", "typeInfo", ".", "name", ",", "typeNames", ",", "typeInfo", ".", "superclass", ",", "typeInfo", ".", "superinterfaces", ",", "typeParameterSignatures", ",", "typeInfo", ".", "secondary", ")", ";", "addDefaultConstructorIfNecessary", "(", "typeInfo", ")", ";", "pushTypeName", "(", "typeInfo", ".", "name", ")", ";", "}", "public", "void", "enterCompilationUnit", "(", ")", "{", "}", "public", "void", "enterConstructor", "(", "MethodInfo", "methodInfo", ")", "{", "int", "argCount", "=", "methodInfo", ".", "parameterTypes", "==", "null", "?", "0", ":", "methodInfo", ".", "parameterTypes", ".", "length", ";", "this", ".", "indexer", ".", "addConstructorDeclaration", "(", "methodInfo", ".", "name", ",", "argCount", ",", "null", ",", "methodInfo", ".", "parameterTypes", ",", "methodInfo", ".", "parameterNames", ",", "methodInfo", ".", "modifiers", ",", "methodInfo", ".", "declaringPackageName", ",", "methodInfo", ".", "declaringTypeModifiers", ",", "methodInfo", ".", "exceptionTypes", ",", "getMoreExtraFlags", "(", "methodInfo", ".", "extraFlags", ")", ")", ";", "this", ".", "methodDepth", "++", ";", "}", "private", "void", "enterEnum", "(", "TypeInfo", "typeInfo", ")", "{", "if", "(", "typeInfo", ".", "superinterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "typeInfo", ".", "superinterfaces", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "typeInfo", ".", "superinterfaces", "[", "i", "]", "=", "getSimpleName", "(", "typeInfo", ".", "superinterfaces", "[", "i", "]", ")", ";", "}", "}", "char", "[", "]", "[", "]", "typeNames", ";", "if", "(", "this", ".", "methodDepth", ">", "0", ")", "{", "typeNames", "=", "ONE_ZERO_CHAR", ";", "}", "else", "{", "typeNames", "=", "enclosingTypeNames", "(", ")", ";", "}", "char", "[", "]", "superclass", "=", "typeInfo", ".", "superclass", "==", "null", "?", "CharOperation", ".", "concatWith", "(", "TypeConstants", ".", "JAVA_LANG_ENUM", ",", "'.'", ")", ":", "typeInfo", ".", "superclass", ";", "this", ".", "indexer", ".", "addEnumDeclaration", "(", "typeInfo", ".", "modifiers", ",", "this", ".", "packageName", ",", "typeInfo", ".", "name", ",", "typeNames", ",", "superclass", ",", "typeInfo", ".", "superinterfaces", ",", "typeInfo", ".", "secondary", ")", ";", "addDefaultConstructorIfNecessary", "(", "typeInfo", ")", ";", "pushTypeName", "(", "typeInfo", ".", "name", ")", ";", "}", "public", "void", "enterField", "(", "FieldInfo", "fieldInfo", ")", "{", "this", ".", "indexer", ".", "addFieldDeclaration", "(", "fieldInfo", ".", "type", ",", "fieldInfo", ".", "name", ")", ";", "this", ".", "methodDepth", "++", ";", "}", "public", "void", "enterInitializer", "(", "int", "declarationSourceStart", ",", "int", "modifiers", ")", "{", "this", ".", "methodDepth", "++", ";", "}", "private", "void", "enterInterface", "(", "TypeInfo", "typeInfo", ")", "{", "if", "(", "typeInfo", ".", "superinterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "typeInfo", ".", "superinterfaces", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "typeInfo", ".", "superinterfaces", "[", "i", "]", "=", "getSimpleName", "(", "typeInfo", ".", "superinterfaces", "[", "i", "]", ")", ";", "}", "}", "char", "[", "]", "[", "]", "typeNames", ";", "if", "(", "this", ".", "methodDepth", ">", "0", ")", "{", "typeNames", "=", "ONE_ZERO_CHAR", ";", "}", "else", "{", "typeNames", "=", "enclosingTypeNames", "(", ")", ";", "}", "char", "[", "]", "[", "]", "typeParameterSignatures", "=", "null", ";", "if", "(", "typeInfo", ".", "typeParameters", "!=", "null", ")", "{", "int", "typeParametersLength", "=", "typeInfo", ".", "typeParameters", ".", "length", ";", "typeParameterSignatures", "=", "new", "char", "[", "typeParametersLength", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeParametersLength", ";", "i", "++", ")", "{", "ISourceElementRequestor", ".", "TypeParameterInfo", "typeParameterInfo", "=", "typeInfo", ".", "typeParameters", "[", "i", "]", ";", "typeParameterSignatures", "[", "i", "]", "=", "Signature", ".", "createTypeParameterSignature", "(", "typeParameterInfo", ".", "name", ",", "typeParameterInfo", ".", "bounds", ")", ";", "}", "}", "this", ".", "indexer", ".", "addInterfaceDeclaration", "(", "typeInfo", ".", "modifiers", ",", "this", ".", "packageName", ",", "typeInfo", ".", "name", ",", "typeNames", ",", "typeInfo", ".", "superinterfaces", ",", "typeParameterSignatures", ",", "typeInfo", ".", "secondary", ")", ";", "addDefaultConstructorIfNecessary", "(", "typeInfo", ")", ";", "pushTypeName", "(", "typeInfo", ".", "name", ")", ";", "}", "public", "void", "enterMethod", "(", "MethodInfo", "methodInfo", ")", "{", "this", ".", "indexer", ".", "addMethodDeclaration", "(", "methodInfo", ".", "name", ",", "methodInfo", ".", "parameterTypes", ",", "methodInfo", ".", "returnType", ",", "methodInfo", ".", "exceptionTypes", ")", ";", "this", ".", "methodDepth", "++", ";", "}", "public", "void", "enterType", "(", "TypeInfo", "typeInfo", ")", "{", "switch", "(", "TypeDeclaration", ".", "kind", "(", "typeInfo", ".", "modifiers", ")", ")", "{", "case", "TypeDeclaration", ".", "CLASS_DECL", ":", "enterClass", "(", "typeInfo", ")", ";", "break", ";", "case", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ":", "enterAnnotationType", "(", "typeInfo", ")", ";", "break", ";", "case", "TypeDeclaration", ".", "INTERFACE_DECL", ":", "enterInterface", "(", "typeInfo", ")", ";", "break", ";", "case", "TypeDeclaration", ".", "ENUM_DECL", ":", "enterEnum", "(", "typeInfo", ")", ";", "break", ";", "}", "}", "public", "void", "exitCompilationUnit", "(", "int", "declarationEnd", ")", "{", "}", "public", "void", "exitConstructor", "(", "int", "declarationEnd", ")", "{", "this", ".", "methodDepth", "--", ";", "}", "public", "void", "exitField", "(", "int", "initializationStart", ",", "int", "declarationEnd", ",", "int", "declarationSourceEnd", ")", "{", "this", ".", "methodDepth", "--", ";", "}", "public", "void", "exitInitializer", "(", "int", "declarationEnd", ")", "{", "this", ".", "methodDepth", "--", ";", "}", "public", "void", "exitMethod", "(", "int", "declarationEnd", ",", "Expression", "defaultValue", ")", "{", "this", ".", "methodDepth", "--", ";", "}", "public", "void", "exitType", "(", "int", "declarationEnd", ")", "{", "popTypeName", "(", ")", ";", "}", "private", "char", "[", "]", "getSimpleName", "(", "char", "[", "]", "typeName", ")", "{", "int", "lastDot", "=", "-", "1", ",", "lastGenericStart", "=", "-", "1", ";", "int", "depthCount", "=", "0", ";", "int", "length", "=", "typeName", ".", "length", ";", "lastDotLookup", ":", "for", "(", "int", "i", "=", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "switch", "(", "typeName", "[", "i", "]", ")", "{", "case", "'.'", ":", "if", "(", "depthCount", "==", "0", ")", "{", "lastDot", "=", "i", ";", "break", "lastDotLookup", ";", "}", "break", ";", "case", "'<'", ":", "depthCount", "--", ";", "if", "(", "depthCount", "==", "0", ")", "lastGenericStart", "=", "i", ";", "break", ";", "case", "'>'", ":", "depthCount", "++", ";", "break", ";", "}", "}", "if", "(", "lastGenericStart", "<", "0", ")", "{", "if", "(", "lastDot", "<", "0", ")", "{", "return", "typeName", ";", "}", "return", "CharOperation", ".", "subarray", "(", "typeName", ",", "lastDot", "+", "1", ",", "length", ")", ";", "}", "return", "CharOperation", ".", "subarray", "(", "typeName", ",", "lastDot", "+", "1", ",", "lastGenericStart", ")", ";", "}", "private", "int", "getMoreExtraFlags", "(", "int", "extraFlags", ")", "{", "if", "(", "this", ".", "methodDepth", ">", "0", ")", "{", "extraFlags", "|=", "ExtraFlags", ".", "IsLocalType", ";", "}", "return", "extraFlags", ";", "}", "public", "void", "popTypeName", "(", ")", "{", "if", "(", "this", ".", "depth", ">", "0", ")", "{", "this", ".", "enclosingTypeNames", "[", "--", "this", ".", "depth", "]", "=", "null", ";", "}", "else", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "try", "{", "this", ".", "enclosingTypeNames", "[", "-", "1", "]", "=", "null", ";", "}", "catch", "(", "ArrayIndexOutOfBoundsException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "public", "void", "pushTypeName", "(", "char", "[", "]", "typeName", ")", "{", "if", "(", "this", ".", "depth", "==", "this", ".", "enclosingTypeNames", ".", "length", ")", "System", ".", "arraycopy", "(", "this", ".", "enclosingTypeNames", ",", "0", ",", "this", ".", "enclosingTypeNames", "=", "new", "char", "[", "this", ".", "depth", "*", "2", "]", "[", "]", ",", "0", ",", "this", ".", "depth", ")", ";", "this", ".", "enclosingTypeNames", "[", "this", ".", "depth", "++", "]", "=", "typeName", ";", "}", "}", "</s>" ]
2,529
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "class", "RemoveFromIndex", "extends", "IndexRequest", "{", "String", "resourceName", ";", "public", "RemoveFromIndex", "(", "String", "resourceName", ",", "IPath", "containerPath", ",", "IndexManager", "manager", ")", "{", "super", "(", "containerPath", ",", "manager", ")", ";", "this", ".", "resourceName", "=", "resourceName", ";", "}", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "isCancelled", "||", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", "true", ";", "Index", "index", "=", "this", ".", "manager", ".", "getIndex", "(", "this", ".", "containerPath", ",", "true", ",", "false", ")", ";", "if", "(", "index", "==", "null", ")", "return", "true", ";", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "return", "true", ";", "try", "{", "monitor", ".", "enterWrite", "(", ")", ";", "index", ".", "remove", "(", "this", ".", "resourceName", ")", ";", "}", "finally", "{", "monitor", ".", "exitWrite", "(", ")", ";", "}", "return", "true", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"removing", "\"", "+", "this", ".", "resourceName", "+", "\"", "from", "index", "\"", "+", "this", ".", "containerPath", ";", "}", "}", "</s>" ]
2,530
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceProxy", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceProxyVisitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "AddFolderToIndex", "extends", "IndexRequest", "{", "IPath", "folderPath", ";", "IProject", "project", ";", "char", "[", "]", "[", "]", "inclusionPatterns", ";", "char", "[", "]", "[", "]", "exclusionPatterns", ";", "public", "AddFolderToIndex", "(", "IPath", "folderPath", ",", "IProject", "project", ",", "char", "[", "]", "[", "]", "inclusionPatterns", ",", "char", "[", "]", "[", "]", "exclusionPatterns", ",", "IndexManager", "manager", ")", "{", "super", "(", "project", ".", "getFullPath", "(", ")", ",", "manager", ")", ";", "this", ".", "folderPath", "=", "folderPath", ";", "this", ".", "project", "=", "project", ";", "this", ".", "inclusionPatterns", "=", "inclusionPatterns", ";", "this", ".", "exclusionPatterns", "=", "exclusionPatterns", ";", "}", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "isCancelled", "||", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", "true", ";", "if", "(", "!", "this", ".", "project", ".", "isAccessible", "(", ")", ")", "return", "true", ";", "IResource", "folder", "=", "this", ".", "project", ".", "getParent", "(", ")", ".", "findMember", "(", "this", ".", "folderPath", ")", ";", "if", "(", "folder", "==", "null", "||", "folder", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", ")", "return", "true", ";", "Index", "index", "=", "this", ".", "manager", ".", "getIndex", "(", "this", ".", "containerPath", ",", "true", ",", "true", ")", ";", "if", "(", "index", "==", "null", ")", "return", "true", ";", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "return", "true", ";", "try", "{", "monitor", ".", "enterRead", "(", ")", ";", "final", "IPath", "container", "=", "this", ".", "containerPath", ";", "final", "IndexManager", "indexManager", "=", "this", ".", "manager", ";", "final", "SourceElementParser", "parser", "=", "indexManager", ".", "getSourceElementParser", "(", "JavaCore", ".", "create", "(", "this", ".", "project", ")", ",", "null", ")", ";", "if", "(", "this", ".", "exclusionPatterns", "==", "null", "&&", "this", ".", "inclusionPatterns", "==", "null", ")", "{", "folder", ".", "accept", "(", "new", "IResourceProxyVisitor", "(", ")", "{", "public", "boolean", "visit", "(", "IResourceProxy", "proxy", ")", "{", "if", "(", "proxy", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", ")", "{", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "proxy", ".", "getName", "(", ")", ")", ")", "indexManager", ".", "addSource", "(", "(", "IFile", ")", "proxy", ".", "requestResource", "(", ")", ",", "container", ",", "parser", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}", "}", ",", "IResource", ".", "NONE", ")", ";", "}", "else", "{", "folder", ".", "accept", "(", "new", "IResourceProxyVisitor", "(", ")", "{", "public", "boolean", "visit", "(", "IResourceProxy", "proxy", ")", "{", "switch", "(", "proxy", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "FILE", ":", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "proxy", ".", "getName", "(", ")", ")", ")", "{", "IResource", "resource", "=", "proxy", ".", "requestResource", "(", ")", ";", "if", "(", "!", "Util", ".", "isExcluded", "(", "resource", ",", "AddFolderToIndex", ".", "this", ".", "inclusionPatterns", ",", "AddFolderToIndex", ".", "this", ".", "exclusionPatterns", ")", ")", "indexManager", ".", "addSource", "(", "(", "IFile", ")", "resource", ",", "container", ",", "parser", ")", ";", "}", "return", "false", ";", "case", "IResource", ".", "FOLDER", ":", "if", "(", "AddFolderToIndex", ".", "this", ".", "exclusionPatterns", "!=", "null", "&&", "AddFolderToIndex", ".", "this", ".", "inclusionPatterns", "==", "null", ")", "{", "if", "(", "Util", ".", "isExcluded", "(", "proxy", ".", "requestFullPath", "(", ")", ",", "AddFolderToIndex", ".", "this", ".", "inclusionPatterns", ",", "AddFolderToIndex", ".", "this", ".", "exclusionPatterns", ",", "true", ")", ")", "return", "false", ";", "}", "}", "return", "true", ";", "}", "}", ",", "IResource", ".", "NONE", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "folderPath", "+", "\"\"", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}", "finally", "{", "monitor", ".", "exitRead", "(", ")", ";", "}", "return", "true", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"adding", "\"", "+", "this", ".", "folderPath", "+", "\"", "to", "index", "\"", "+", "this", ".", "containerPath", ";", "}", "}", "</s>" ]
2,531
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "IJob", ";", "public", "abstract", "class", "IndexRequest", "implements", "IJob", "{", "protected", "boolean", "isCancelled", "=", "false", ";", "protected", "IPath", "containerPath", ";", "protected", "IndexManager", "manager", ";", "public", "IndexRequest", "(", "IPath", "containerPath", ",", "IndexManager", "manager", ")", "{", "this", ".", "containerPath", "=", "containerPath", ";", "this", ".", "manager", "=", "manager", ";", "}", "public", "boolean", "belongsTo", "(", "String", "projectNameOrJarPath", ")", "{", "return", "projectNameOrJarPath", ".", "equals", "(", "this", ".", "containerPath", ".", "segment", "(", "0", ")", ")", "||", "projectNameOrJarPath", ".", "equals", "(", "this", ".", "containerPath", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "cancel", "(", ")", "{", "this", ".", "manager", ".", "jobWasCancelled", "(", "this", ".", "containerPath", ")", ";", "this", ".", "isCancelled", "=", "true", ";", "}", "public", "void", "ensureReadyToRun", "(", ")", "{", "this", ".", "manager", ".", "aboutToUpdateIndex", "(", "this", ".", "containerPath", ",", "updatedIndexState", "(", ")", ")", ";", "}", "public", "String", "getJobFamily", "(", ")", "{", "return", "this", ".", "containerPath", ".", "toString", "(", ")", ";", "}", "protected", "Integer", "updatedIndexState", "(", ")", "{", "return", "IndexManager", ".", "UPDATING_STATE", ";", "}", "}", "</s>" ]
2,532
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "public", "interface", "IIndexConstants", "{", "char", "[", "]", "REF", "=", "\"ref\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "ANNOTATION_REF", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "METHOD_REF", "=", "\"methodRef\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "CONSTRUCTOR_REF", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "SUPER_REF", "=", "\"superRef\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "TYPE_DECL", "=", "\"typeDecl\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "METHOD_DECL", "=", "\"methodDecl\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "CONSTRUCTOR_DECL", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "FIELD_DECL", "=", "\"fieldDecl\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "OBJECT", "=", "\"Object\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "[", "]", "COUNTS", "=", "new", "char", "[", "]", "[", "]", "{", "new", "char", "[", "]", "{", "'/'", ",", "'0'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'1'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'2'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'3'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'4'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'5'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'6'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'7'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'8'", "}", ",", "new", "char", "[", "]", "{", "'/'", ",", "'9'", "}", "}", ";", "char", "[", "]", "DEFAULT_CONSTRUCTOR", "=", "new", "char", "[", "]", "{", "'/'", ",", "'#'", "}", ";", "char", "CLASS_SUFFIX", "=", "'C'", ";", "char", "INTERFACE_SUFFIX", "=", "'I'", ";", "char", "ENUM_SUFFIX", "=", "'E'", ";", "char", "ANNOTATION_TYPE_SUFFIX", "=", "'A'", ";", "char", "TYPE_SUFFIX", "=", "0", ";", "char", "CLASS_AND_ENUM_SUFFIX", "=", "IJavaSearchConstants", ".", "CLASS_AND_ENUM", ";", "char", "CLASS_AND_INTERFACE_SUFFIX", "=", "IJavaSearchConstants", ".", "CLASS_AND_INTERFACE", ";", "char", "INTERFACE_AND_ANNOTATION_SUFFIX", "=", "IJavaSearchConstants", ".", "INTERFACE_AND_ANNOTATION", ";", "char", "SEPARATOR", "=", "'/'", ";", "char", "PARAMETER_SEPARATOR", "=", "','", ";", "char", "SECONDARY_SUFFIX", "=", "'S'", ";", "char", "[", "]", "ONE_STAR", "=", "new", "char", "[", "]", "{", "'*'", "}", ";", "char", "[", "]", "[", "]", "ONE_STAR_CHAR", "=", "new", "char", "[", "]", "[", "]", "{", "ONE_STAR", "}", ";", "char", "ZERO_CHAR", "=", "'0'", ";", "char", "[", "]", "ONE_ZERO", "=", "new", "char", "[", "]", "{", "ZERO_CHAR", "}", ";", "char", "[", "]", "[", "]", "ONE_ZERO_CHAR", "=", "new", "char", "[", "]", "[", "]", "{", "ONE_ZERO", "}", ";", "int", "PKG_REF_PATTERN", "=", "0x0001", ";", "int", "PKG_DECL_PATTERN", "=", "0x0002", ";", "int", "TYPE_REF_PATTERN", "=", "0x0004", ";", "int", "TYPE_DECL_PATTERN", "=", "0x0008", ";", "int", "SUPER_REF_PATTERN", "=", "0x0010", ";", "int", "CONSTRUCTOR_PATTERN", "=", "0x0020", ";", "int", "FIELD_PATTERN", "=", "0x0040", ";", "int", "METHOD_PATTERN", "=", "0x0080", ";", "int", "OR_PATTERN", "=", "0x0100", ";", "int", "LOCAL_VAR_PATTERN", "=", "0x0200", ";", "int", "TYPE_PARAM_PATTERN", "=", "0x0400", ";", "int", "AND_PATTERN", "=", "0x0800", ";", "int", "ANNOT_REF_PATTERN", "=", "0x1000", ";", "}", "</s>" ]
2,533
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "SaveIndex", "extends", "IndexRequest", "{", "public", "SaveIndex", "(", "IPath", "containerPath", ",", "IndexManager", "manager", ")", "{", "super", "(", "containerPath", ",", "manager", ")", ";", "}", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "isCancelled", "||", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", "true", ";", "Index", "index", "=", "this", ".", "manager", ".", "getIndex", "(", "this", ".", "containerPath", ",", "true", ",", "false", ")", ";", "if", "(", "index", "==", "null", ")", "return", "true", ";", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "return", "true", ";", "try", "{", "monitor", ".", "enterWrite", "(", ")", ";", "this", ".", "manager", ".", "saveIndex", "(", "index", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "containerPath", "+", "\"\"", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}", "finally", "{", "monitor", ".", "exitWrite", "(", ")", ";", "}", "return", "true", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "this", ".", "containerPath", ";", "}", "}", "</s>" ]
2,534
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipEntry", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "InvalidInputException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "TerminalTokens", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "IndexLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaSearchDocument", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "class", "AddJarFileToIndex", "extends", "IndexRequest", "{", "private", "static", "final", "char", "JAR_SEPARATOR", "=", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", ".", "charAt", "(", "0", ")", ";", "IFile", "resource", ";", "Scanner", "scanner", ";", "private", "IndexLocation", "indexFileURL", ";", "public", "AddJarFileToIndex", "(", "IFile", "resource", ",", "IndexLocation", "indexFile", ",", "IndexManager", "manager", ")", "{", "super", "(", "resource", ".", "getFullPath", "(", ")", ",", "manager", ")", ";", "this", ".", "resource", "=", "resource", ";", "this", ".", "indexFileURL", "=", "indexFile", ";", "}", "public", "AddJarFileToIndex", "(", "IPath", "jarPath", ",", "IndexLocation", "indexFile", ",", "IndexManager", "manager", ")", "{", "super", "(", "jarPath", ",", "manager", ")", ";", "this", ".", "indexFileURL", "=", "indexFile", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "o", "instanceof", "AddJarFileToIndex", ")", "{", "if", "(", "this", ".", "resource", "!=", "null", ")", "return", "this", ".", "resource", ".", "equals", "(", "(", "(", "AddJarFileToIndex", ")", "o", ")", ".", "resource", ")", ";", "if", "(", "this", ".", "containerPath", "!=", "null", ")", "return", "this", ".", "containerPath", ".", "equals", "(", "(", "(", "AddJarFileToIndex", ")", "o", ")", ".", "containerPath", ")", ";", "}", "return", "false", ";", "}", "public", "int", "hashCode", "(", ")", "{", "if", "(", "this", ".", "resource", "!=", "null", ")", "return", "this", ".", "resource", ".", "hashCode", "(", ")", ";", "if", "(", "this", ".", "containerPath", "!=", "null", ")", "return", "this", ".", "containerPath", ".", "hashCode", "(", ")", ";", "return", "-", "1", ";", "}", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "isCancelled", "||", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", "true", ";", "if", "(", "this", ".", "indexFileURL", "!=", "null", ")", "{", "boolean", "added", "=", "this", ".", "manager", ".", "addIndex", "(", "this", ".", "containerPath", ",", "this", ".", "indexFileURL", ")", ";", "if", "(", "added", ")", "return", "true", ";", "this", ".", "indexFileURL", "=", "null", ";", "}", "try", "{", "Index", "index", "=", "this", ".", "manager", ".", "getIndexForUpdate", "(", "this", ".", "containerPath", ",", "false", ",", "false", ")", ";", "if", "(", "index", "!=", "null", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "containerPath", ")", ";", "return", "true", ";", "}", "index", "=", "this", ".", "manager", ".", "getIndexForUpdate", "(", "this", ".", "containerPath", ",", "true", ",", "true", ")", ";", "if", "(", "index", "==", "null", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "containerPath", ")", ";", "return", "true", ";", "}", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "containerPath", "+", "\"\"", ")", ";", "return", "true", ";", "}", "index", ".", "separator", "=", "JAR_SEPARATOR", ";", "ZipFile", "zip", "=", "null", ";", "try", "{", "Path", "zipFilePath", "=", "null", ";", "monitor", ".", "enterWrite", "(", ")", ";", "if", "(", "this", ".", "resource", "!=", "null", ")", "{", "URI", "location", "=", "this", ".", "resource", ".", "getLocationURI", "(", ")", ";", "if", "(", "location", "==", "null", ")", "return", "false", ";", "if", "(", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", ")", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "location", ".", "getPath", "(", ")", ")", ";", "File", "file", "=", "null", ";", "try", "{", "file", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "toLocalFile", "(", "location", ",", "progressMonitor", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "location", ".", "getPath", "(", ")", "+", "\"\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "if", "(", "file", "==", "null", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "location", ".", "getPath", "(", ")", "+", "\"\"", ")", ";", "return", "false", ";", "}", "zip", "=", "new", "ZipFile", "(", "file", ")", ";", "zipFilePath", "=", "(", "Path", ")", "this", ".", "resource", ".", "getFullPath", "(", ")", ".", "makeRelative", "(", ")", ";", "}", "else", "{", "if", "(", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", ")", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "this", ".", "containerPath", ")", ";", "zip", "=", "new", "ZipFile", "(", "this", ".", "containerPath", ".", "toFile", "(", ")", ")", ";", "zipFilePath", "=", "(", "Path", ")", "this", ".", "containerPath", ";", "}", "if", "(", "this", ".", "isCancelled", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "zip", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", "false", ";", "}", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"->", "indexing", "\"", "+", "zip", ".", "getName", "(", ")", ")", ";", "long", "initialTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "String", "[", "]", "paths", "=", "index", ".", "queryDocumentNames", "(", "\"\"", ")", ";", "if", "(", "paths", "!=", "null", ")", "{", "int", "max", "=", "paths", ".", "length", ";", "String", "EXISTS", "=", "\"OK\"", ";", "String", "DELETED", "=", "\"DELETED\"", ";", "SimpleLookupTable", "indexedFileNames", "=", "new", "SimpleLookupTable", "(", "max", "==", "0", "?", "33", ":", "max", "+", "11", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "indexedFileNames", ".", "put", "(", "paths", "[", "i", "]", ",", "DELETED", ")", ";", "for", "(", "Enumeration", "e", "=", "zip", ".", "entries", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "ZipEntry", "ze", "=", "(", "ZipEntry", ")", "e", ".", "nextElement", "(", ")", ";", "String", "zipEntryName", "=", "ze", ".", "getName", "(", ")", ";", "if", "(", "Util", ".", "isClassFileName", "(", "zipEntryName", ")", "&&", "isValidPackageNameForClass", "(", "zipEntryName", ")", ")", "indexedFileNames", ".", "put", "(", "zipEntryName", ",", "EXISTS", ")", ";", "}", "boolean", "needToReindex", "=", "indexedFileNames", ".", "elementSize", "!=", "max", ";", "if", "(", "!", "needToReindex", ")", "{", "Object", "[", "]", "valueTable", "=", "indexedFileNames", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "valueTable", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "valueTable", "[", "i", "]", "==", "DELETED", ")", "{", "needToReindex", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "needToReindex", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "zip", ".", "getName", "(", ")", "+", "\"", "(\"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "initialTime", ")", "+", "\"ms)\"", ")", ";", "this", ".", "manager", ".", "saveIndex", "(", "index", ")", ";", "return", "true", ";", "}", "}", "}", "SearchParticipant", "participant", "=", "SearchEngine", ".", "getDefaultSearchParticipant", "(", ")", ";", "if", "(", "!", "this", ".", "manager", ".", "resetIndex", "(", "this", ".", "containerPath", ")", ")", "{", "this", ".", "manager", ".", "removeIndex", "(", "this", ".", "containerPath", ")", ";", "return", "false", ";", "}", "index", ".", "separator", "=", "JAR_SEPARATOR", ";", "IPath", "indexPath", "=", "null", ";", "IndexLocation", "indexLocation", ";", "if", "(", "(", "indexLocation", "=", "index", ".", "getIndexLocation", "(", ")", ")", "!=", "null", ")", "{", "indexPath", "=", "new", "Path", "(", "indexLocation", ".", "getCanonicalFilePath", "(", ")", ")", ";", "}", "for", "(", "Enumeration", "e", "=", "zip", ".", "entries", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "if", "(", "this", ".", "isCancelled", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "zip", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", "false", ";", "}", "ZipEntry", "ze", "=", "(", "ZipEntry", ")", "e", ".", "nextElement", "(", ")", ";", "String", "zipEntryName", "=", "ze", ".", "getName", "(", ")", ";", "if", "(", "Util", ".", "isClassFileName", "(", "zipEntryName", ")", "&&", "isValidPackageNameForClass", "(", "zipEntryName", ")", ")", "{", "final", "byte", "[", "]", "classFileBytes", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "getZipEntryByteContent", "(", "ze", ",", "zip", ")", ";", "JavaSearchDocument", "entryDocument", "=", "new", "JavaSearchDocument", "(", "ze", ",", "zipFilePath", ",", "classFileBytes", ",", "participant", ")", ";", "this", ".", "manager", ".", "indexDocument", "(", "entryDocument", ",", "participant", ",", "index", ",", "indexPath", ")", ";", "}", "}", "this", ".", "manager", ".", "saveIndex", "(", "index", ")", ";", "if", "(", "JobManager", ".", "VERBOSE", ")", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "zip", ".", "getName", "(", ")", "+", "\"", "(\"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "initialTime", ")", "+", "\"ms)\"", ")", ";", "}", "finally", "{", "if", "(", "zip", "!=", "null", ")", "{", "if", "(", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", ")", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "zip", ")", ";", "zip", ".", "close", "(", ")", ";", "}", "monitor", ".", "exitWrite", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "containerPath", "+", "\"\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "this", ".", "manager", ".", "removeIndex", "(", "this", ".", "containerPath", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}", "public", "String", "getJobFamily", "(", ")", "{", "if", "(", "this", ".", "resource", "!=", "null", ")", "return", "super", ".", "getJobFamily", "(", ")", ";", "return", "this", ".", "containerPath", ".", "toOSString", "(", ")", ";", "}", "private", "boolean", "isIdentifier", "(", ")", "throws", "InvalidInputException", "{", "switch", "(", "this", ".", "scanner", ".", "scanIdentifier", "(", ")", ")", "{", "case", "TerminalTokens", ".", "TokenNameIdentifier", ":", "case", "TerminalTokens", ".", "TokenNameassert", ":", "case", "TerminalTokens", ".", "TokenNameenum", ":", "return", "true", ";", "default", ":", "return", "false", ";", "}", "}", "private", "boolean", "isValidPackageNameForClass", "(", "String", "className", ")", "{", "char", "[", "]", "classNameArray", "=", "className", ".", "toCharArray", "(", ")", ";", "if", "(", "this", ".", "scanner", "==", "null", ")", "this", ".", "scanner", "=", "new", "Scanner", "(", "false", ",", "true", ",", "false", ",", "ClassFileConstants", ".", "JDK1_7", ",", "null", ",", "null", ",", "true", ")", ";", "this", ".", "scanner", ".", "setSource", "(", "classNameArray", ")", ";", "this", ".", "scanner", ".", "eofPosition", "=", "classNameArray", ".", "length", "-", "SuffixConstants", ".", "SUFFIX_CLASS", ".", "length", ";", "try", "{", "if", "(", "isIdentifier", "(", ")", ")", "{", "while", "(", "this", ".", "scanner", ".", "eofPosition", ">", "this", ".", "scanner", ".", "currentPosition", ")", "{", "if", "(", "this", ".", "scanner", ".", "getNextChar", "(", ")", "!=", "'/'", "||", "this", ".", "scanner", ".", "eofPosition", "<=", "this", ".", "scanner", ".", "currentPosition", ")", "{", "return", "false", ";", "}", "if", "(", "!", "isIdentifier", "(", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "}", "return", "false", ";", "}", "protected", "Integer", "updatedIndexState", "(", ")", "{", "return", "IndexManager", ".", "REBUILDING_STATE", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"indexing", "\"", "+", "this", ".", "containerPath", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,535
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchDocument", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "public", "class", "SourceIndexer", "extends", "AbstractIndexer", "implements", "SuffixConstants", "{", "public", "SourceIndexer", "(", "SearchDocument", "document", ")", "{", "super", "(", "document", ")", ";", "}", "public", "void", "indexDocument", "(", ")", "{", "SourceIndexerRequestor", "requestor", "=", "new", "SourceIndexerRequestor", "(", "this", ")", ";", "String", "documentPath", "=", "this", ".", "document", ".", "getPath", "(", ")", ";", "SourceElementParser", "parser", "=", "this", ".", "document", ".", "getParser", "(", ")", ";", "if", "(", "parser", "==", "null", ")", "{", "IPath", "path", "=", "new", "Path", "(", "documentPath", ")", ";", "IProject", "project", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProject", "(", "path", ".", "segment", "(", "0", ")", ")", ";", "parser", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "indexManager", ".", "getSourceElementParser", "(", "JavaCore", ".", "create", "(", "project", ")", ",", "requestor", ")", ";", "}", "else", "{", "parser", ".", "setRequestor", "(", "requestor", ")", ";", "}", "char", "[", "]", "source", "=", "null", ";", "char", "[", "]", "name", "=", "null", ";", "try", "{", "source", "=", "this", ".", "document", ".", "getCharContents", "(", ")", ";", "name", "=", "documentPath", ".", "toCharArray", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "if", "(", "source", "==", "null", "||", "name", "==", "null", ")", "return", ";", "CompilationUnit", "compilationUnit", "=", "new", "CompilationUnit", "(", "source", ",", "name", ")", ";", "try", "{", "parser", ".", "parseCompilationUnit", "(", "compilationUnit", ",", "true", ",", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}", "</s>" ]
2,536
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "IProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ISourceElementRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ImportReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "QualifiedNameReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "SingleNameReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "public", "class", "IndexingParser", "extends", "SourceElementParser", "{", "SingleNameReference", "singleNameReference", "=", "new", "SingleNameReference", "(", "CharOperation", ".", "NO_CHAR", ",", "0", ")", ";", "QualifiedNameReference", "qualifiedNameReference", "=", "new", "QualifiedNameReference", "(", "CharOperation", ".", "NO_CHAR_CHAR", ",", "new", "long", "[", "0", "]", ",", "0", ",", "0", ")", ";", "ImportReference", "importReference", "=", "new", "ImportReference", "(", "CharOperation", ".", "NO_CHAR_CHAR", ",", "new", "long", "[", "1", "]", ",", "false", ",", "0", ")", ";", "public", "IndexingParser", "(", "ISourceElementRequestor", "requestor", ",", "IProblemFactory", "problemFactory", ",", "CompilerOptions", "options", ",", "boolean", "reportLocalDeclarations", ",", "boolean", "optimizeStringLiterals", ",", "boolean", "useSourceJavadocParser", ")", "{", "super", "(", "requestor", ",", "problemFactory", ",", "options", ",", "reportLocalDeclarations", ",", "optimizeStringLiterals", ",", "useSourceJavadocParser", ")", ";", "}", "protected", "ImportReference", "newImportReference", "(", "char", "[", "]", "[", "]", "tokens", ",", "long", "[", "]", "sourcePositions", ",", "boolean", "onDemand", ",", "int", "mod", ")", "{", "ImportReference", "ref", "=", "this", ".", "importReference", ";", "ref", ".", "tokens", "=", "tokens", ";", "ref", ".", "sourcePositions", "=", "sourcePositions", ";", "if", "(", "onDemand", ")", "{", "ref", ".", "bits", "|=", "ASTNode", ".", "OnDemand", ";", "}", "ref", ".", "sourceEnd", "=", "(", "int", ")", "(", "sourcePositions", "[", "sourcePositions", ".", "length", "-", "1", "]", "&", "0x00000000FFFFFFFF", ")", ";", "ref", ".", "sourceStart", "=", "(", "int", ")", "(", "sourcePositions", "[", "0", "]", ">>>", "32", ")", ";", "ref", ".", "modifiers", "=", "this", ".", "modifiers", ";", "return", "ref", ";", "}", "protected", "SingleNameReference", "newSingleNameReference", "(", "char", "[", "]", "source", ",", "long", "positions", ")", "{", "SingleNameReference", "ref", "=", "this", ".", "singleNameReference", ";", "ref", ".", "token", "=", "source", ";", "ref", ".", "sourceStart", "=", "(", "int", ")", "(", "positions", ">>>", "32", ")", ";", "ref", ".", "sourceEnd", "=", "(", "int", ")", "positions", ";", "return", "ref", ";", "}", "protected", "QualifiedNameReference", "newQualifiedNameReference", "(", "char", "[", "]", "[", "]", "tokens", ",", "long", "[", "]", "positions", ",", "int", "sourceStart", ",", "int", "sourceEnd", ")", "{", "QualifiedNameReference", "ref", "=", "this", ".", "qualifiedNameReference", ";", "ref", ".", "tokens", "=", "tokens", ";", "ref", ".", "sourcePositions", "=", "positions", ";", "ref", ".", "sourceStart", "=", "sourceStart", ";", "ref", ".", "sourceEnd", "=", "sourceEnd", ";", "return", "ref", ";", "}", "}", "</s>" ]
2,537
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "org", ".", "eclipse", ".", "core", ".", "filesystem", ".", "EFS", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IContainer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceProxy", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceProxyVisitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "IndexBinaryFolder", "extends", "IndexRequest", "{", "IContainer", "folder", ";", "public", "IndexBinaryFolder", "(", "IContainer", "folder", ",", "IndexManager", "manager", ")", "{", "super", "(", "folder", ".", "getFullPath", "(", ")", ",", "manager", ")", ";", "this", ".", "folder", "=", "folder", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "o", "instanceof", "IndexBinaryFolder", ")", "return", "this", ".", "folder", ".", "equals", "(", "(", "(", "IndexBinaryFolder", ")", "o", ")", ".", "folder", ")", ";", "return", "false", ";", "}", "public", "boolean", "execute", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "isCancelled", "||", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", "true", ";", "if", "(", "!", "this", ".", "folder", ".", "isAccessible", "(", ")", ")", "return", "true", ";", "Index", "index", "=", "this", ".", "manager", ".", "getIndexForUpdate", "(", "this", ".", "containerPath", ",", "true", ",", "true", ")", ";", "if", "(", "index", "==", "null", ")", "return", "true", ";", "ReadWriteMonitor", "monitor", "=", "index", ".", "monitor", ";", "if", "(", "monitor", "==", "null", ")", "return", "true", ";", "try", "{", "monitor", ".", "enterRead", "(", ")", ";", "String", "[", "]", "paths", "=", "index", ".", "queryDocumentNames", "(", "\"\"", ")", ";", "int", "max", "=", "paths", "==", "null", "?", "0", ":", "paths", ".", "length", ";", "final", "SimpleLookupTable", "indexedFileNames", "=", "new", "SimpleLookupTable", "(", "max", "==", "0", "?", "33", ":", "max", "+", "11", ")", ";", "final", "String", "OK", "=", "\"OK\"", ";", "final", "String", "DELETED", "=", "\"DELETED\"", ";", "if", "(", "paths", "==", "null", ")", "{", "this", ".", "folder", ".", "accept", "(", "new", "IResourceProxyVisitor", "(", ")", "{", "public", "boolean", "visit", "(", "IResourceProxy", "proxy", ")", "{", "if", "(", "IndexBinaryFolder", ".", "this", ".", "isCancelled", ")", "return", "false", ";", "if", "(", "proxy", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", ")", "{", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "proxy", ".", "getName", "(", ")", ")", ")", "{", "IFile", "file", "=", "(", "IFile", ")", "proxy", ".", "requestResource", "(", ")", ";", "String", "containerRelativePath", "=", "Util", ".", "relativePath", "(", "file", ".", "getFullPath", "(", ")", ",", "IndexBinaryFolder", ".", "this", ".", "containerPath", ".", "segmentCount", "(", ")", ")", ";", "indexedFileNames", ".", "put", "(", "containerRelativePath", ",", "file", ")", ";", "}", "return", "false", ";", "}", "return", "true", ";", "}", "}", ",", "IResource", ".", "NONE", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "indexedFileNames", ".", "put", "(", "paths", "[", "i", "]", ",", "DELETED", ")", ";", "}", "final", "long", "indexLastModified", "=", "index", ".", "getIndexLastModified", "(", ")", ";", "this", ".", "folder", ".", "accept", "(", "new", "IResourceProxyVisitor", "(", ")", "{", "public", "boolean", "visit", "(", "IResourceProxy", "proxy", ")", "throws", "CoreException", "{", "if", "(", "IndexBinaryFolder", ".", "this", ".", "isCancelled", ")", "return", "false", ";", "if", "(", "proxy", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", ")", "{", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "proxy", ".", "getName", "(", ")", ")", ")", "{", "IFile", "file", "=", "(", "IFile", ")", "proxy", ".", "requestResource", "(", ")", ";", "URI", "location", "=", "file", ".", "getLocationURI", "(", ")", ";", "if", "(", "location", "!=", "null", ")", "{", "String", "containerRelativePath", "=", "Util", ".", "relativePath", "(", "file", ".", "getFullPath", "(", ")", ",", "IndexBinaryFolder", ".", "this", ".", "containerPath", ".", "segmentCount", "(", ")", ")", ";", "indexedFileNames", ".", "put", "(", "containerRelativePath", ",", "indexedFileNames", ".", "get", "(", "containerRelativePath", ")", "==", "null", "||", "indexLastModified", "<", "EFS", ".", "getStore", "(", "location", ")", ".", "fetchInfo", "(", ")", ".", "getLastModified", "(", ")", "?", "(", "Object", ")", "file", ":", "(", "Object", ")", "OK", ")", ";", "}", "}", "return", "false", ";", "}", "return", "true", ";", "}", "}", ",", "IResource", ".", "NONE", ")", ";", "}", "Object", "[", "]", "names", "=", "indexedFileNames", ".", "keyTable", ";", "Object", "[", "]", "values", "=", "indexedFileNames", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "names", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "name", "=", "(", "String", ")", "names", "[", "i", "]", ";", "if", "(", "name", "!=", "null", ")", "{", "if", "(", "this", ".", "isCancelled", ")", "return", "false", ";", "Object", "value", "=", "values", "[", "i", "]", ";", "if", "(", "value", "!=", "OK", ")", "{", "if", "(", "value", "==", "DELETED", ")", "this", ".", "manager", ".", "remove", "(", "name", ",", "this", ".", "containerPath", ")", ";", "else", "{", "this", ".", "manager", ".", "addBinary", "(", "(", "IFile", ")", "value", ",", "this", ".", "containerPath", ")", ";", "}", "}", "}", "}", "this", ".", "manager", ".", "request", "(", "new", "SaveIndex", "(", "this", ".", "containerPath", ",", "this", ".", "manager", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "folder", "+", "\"\"", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "this", ".", "manager", ".", "removeIndex", "(", "this", ".", "containerPath", ")", ";", "return", "false", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "JobManager", ".", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "this", ".", "folder", "+", "\"\"", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "this", ".", "manager", ".", "removeIndex", "(", "this", ".", "containerPath", ")", ";", "return", "false", ";", "}", "finally", "{", "monitor", ".", "exitRead", "(", ")", ";", "}", "return", "true", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "this", ".", "folder", ".", "hashCode", "(", ")", ";", "}", "protected", "Integer", "updatedIndexState", "(", ")", "{", "return", "IndexManager", ".", "REBUILDING_STATE", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "this", ".", "folder", ".", "getFullPath", "(", ")", ";", "}", "}", "</s>" ]
2,538
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ";", "public", "class", "ReadWriteMonitor", "{", "private", "int", "status", "=", "0", ";", "public", "synchronized", "void", "enterRead", "(", ")", "{", "while", "(", "this", ".", "status", "<", "0", ")", "{", "try", "{", "wait", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "this", ".", "status", "++", ";", "}", "public", "synchronized", "void", "enterWrite", "(", ")", "{", "while", "(", "this", ".", "status", "!=", "0", ")", "{", "try", "{", "wait", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "this", ".", "status", "--", ";", "}", "public", "synchronized", "void", "exitRead", "(", ")", "{", "if", "(", "--", "this", ".", "status", "==", "0", ")", "notifyAll", "(", ")", ";", "}", "public", "synchronized", "void", "exitWrite", "(", ")", "{", "if", "(", "++", "this", ".", "status", "==", "0", ")", "notifyAll", "(", ")", ";", "}", "public", "synchronized", "boolean", "exitReadEnterWrite", "(", ")", "{", "if", "(", "this", ".", "status", "!=", "1", ")", "return", "false", ";", "this", ".", "status", "=", "-", "1", ";", "return", "true", ";", "}", "public", "synchronized", "void", "exitWriteEnterRead", "(", ")", "{", "exitWrite", "(", ")", ";", "enterRead", "(", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "this", ".", "status", "==", "0", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "else", "if", "(", "this", ".", "status", "<", "0", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "else", "if", "(", "this", ".", "status", ">", "0", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "buffer", ".", "append", "(", "\"(status", "=", "\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "status", ")", ";", "buffer", ".", "append", "(", "\")\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,539
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "public", "abstract", "class", "IndexQueryRequestor", "{", "public", "abstract", "boolean", "acceptIndexMatch", "(", "String", "documentPath", ",", "SearchPattern", "indexRecord", ",", "SearchParticipant", "participant", ",", "AccessRuleSet", "access", ")", ";", "}", "</s>" ]
2,540
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "public", "interface", "IJob", "{", "int", "ForceImmediate", "=", "1", ";", "int", "CancelIfNotReady", "=", "2", ";", "int", "WaitUntilReady", "=", "3", ";", "boolean", "FAILED", "=", "false", ";", "boolean", "COMPLETE", "=", "true", ";", "public", "boolean", "belongsTo", "(", "String", "jobFamily", ")", ";", "public", "void", "cancel", "(", ")", ";", "public", "void", "ensureReadyToRun", "(", ")", ";", "public", "boolean", "execute", "(", "IProgressMonitor", "progress", ")", ";", "public", "String", "getJobFamily", "(", ")", ";", "}", "</s>" ]
2,541
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "Job", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "abstract", "class", "JobManager", "implements", "Runnable", "{", "protected", "IJob", "[", "]", "awaitingJobs", "=", "new", "IJob", "[", "10", "]", ";", "protected", "int", "jobStart", "=", "0", ";", "protected", "int", "jobEnd", "=", "-", "1", ";", "protected", "boolean", "executing", "=", "false", ";", "protected", "Thread", "processingThread", ";", "protected", "Job", "progressJob", ";", "private", "int", "enableCount", "=", "1", ";", "public", "static", "boolean", "VERBOSE", "=", "false", ";", "public", "boolean", "activated", "=", "false", ";", "private", "int", "awaitingClients", "=", "0", ";", "public", "void", "activateProcessing", "(", ")", "{", "this", ".", "activated", "=", "true", ";", "}", "public", "synchronized", "int", "awaitingJobsCount", "(", ")", "{", "return", "this", ".", "activated", "?", "this", ".", "jobEnd", "-", "this", ".", "jobStart", "+", "1", ":", "1", ";", "}", "public", "synchronized", "IJob", "currentJob", "(", ")", "{", "if", "(", "this", ".", "enableCount", ">", "0", "&&", "this", ".", "jobStart", "<=", "this", ".", "jobEnd", ")", "return", "this", ".", "awaitingJobs", "[", "this", ".", "jobStart", "]", ";", "return", "null", ";", "}", "public", "synchronized", "void", "disable", "(", ")", "{", "this", ".", "enableCount", "--", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ")", ";", "}", "public", "void", "discardJobs", "(", "String", "jobFamily", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "jobFamily", ")", ";", "try", "{", "IJob", "currentJob", ";", "synchronized", "(", "this", ")", "{", "currentJob", "=", "currentJob", "(", ")", ";", "disable", "(", ")", ";", "}", "if", "(", "currentJob", "!=", "null", "&&", "(", "jobFamily", "==", "null", "||", "currentJob", ".", "belongsTo", "(", "jobFamily", ")", ")", ")", "{", "currentJob", ".", "cancel", "(", ")", ";", "while", "(", "this", ".", "processingThread", "!=", "null", "&&", "this", ".", "executing", ")", "{", "try", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "currentJob", ")", ";", "Thread", ".", "sleep", "(", "50", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "}", "int", "loc", "=", "-", "1", ";", "synchronized", "(", "this", ")", "{", "for", "(", "int", "i", "=", "this", ".", "jobStart", ";", "i", "<=", "this", ".", "jobEnd", ";", "i", "++", ")", "{", "currentJob", "=", "this", ".", "awaitingJobs", "[", "i", "]", ";", "if", "(", "currentJob", "!=", "null", ")", "{", "this", ".", "awaitingJobs", "[", "i", "]", "=", "null", ";", "if", "(", "!", "(", "jobFamily", "==", "null", "||", "currentJob", ".", "belongsTo", "(", "jobFamily", ")", ")", ")", "{", "this", ".", "awaitingJobs", "[", "++", "loc", "]", "=", "currentJob", ";", "}", "else", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "currentJob", ")", ";", "currentJob", ".", "cancel", "(", ")", ";", "}", "}", "}", "this", ".", "jobStart", "=", "0", ";", "this", ".", "jobEnd", "=", "loc", ";", "}", "}", "finally", "{", "enable", "(", ")", ";", "}", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "jobFamily", ")", ";", "}", "public", "synchronized", "void", "enable", "(", ")", "{", "this", ".", "enableCount", "++", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", ")", ";", "notifyAll", "(", ")", ";", "}", "protected", "synchronized", "boolean", "isJobWaiting", "(", "IJob", "request", ")", "{", "for", "(", "int", "i", "=", "this", ".", "jobEnd", ";", "i", ">", "this", ".", "jobStart", ";", "i", "--", ")", "if", "(", "request", ".", "equals", "(", "this", ".", "awaitingJobs", "[", "i", "]", ")", ")", "return", "true", ";", "return", "false", ";", "}", "protected", "synchronized", "void", "moveToNextJob", "(", ")", "{", "if", "(", "this", ".", "jobStart", "<=", "this", ".", "jobEnd", ")", "{", "this", ".", "awaitingJobs", "[", "this", ".", "jobStart", "++", "]", "=", "null", ";", "if", "(", "this", ".", "jobStart", ">", "this", ".", "jobEnd", ")", "{", "this", ".", "jobStart", "=", "0", ";", "this", ".", "jobEnd", "=", "-", "1", ";", "}", "}", "}", "protected", "void", "notifyIdle", "(", "long", "idlingTime", ")", "{", "}", "public", "boolean", "performConcurrentJob", "(", "IJob", "searchJob", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progress", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "searchJob", ")", ";", "searchJob", ".", "ensureReadyToRun", "(", ")", ";", "boolean", "status", "=", "IJob", ".", "FAILED", ";", "try", "{", "int", "concurrentJobWork", "=", "100", ";", "if", "(", "progress", "!=", "null", ")", "progress", ".", "beginTask", "(", "\"\"", ",", "concurrentJobWork", ")", ";", "if", "(", "awaitingJobsCount", "(", ")", ">", "0", ")", "{", "switch", "(", "waitingPolicy", ")", "{", "case", "IJob", ".", "ForceImmediate", ":", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "searchJob", ")", ";", "try", "{", "disable", "(", ")", ";", "status", "=", "searchJob", ".", "execute", "(", "progress", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "progress", ",", "concurrentJobWork", ")", ")", ";", "}", "finally", "{", "enable", "(", ")", ";", "}", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "searchJob", ")", ";", "return", "status", ";", "case", "IJob", ".", "CancelIfNotReady", ":", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "searchJob", ")", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "searchJob", ")", ";", "throw", "new", "OperationCanceledException", "(", ")", ";", "case", "IJob", ".", "WaitUntilReady", ":", "IProgressMonitor", "subProgress", "=", "null", ";", "try", "{", "int", "totalWork", "=", "1000", ";", "if", "(", "progress", "!=", "null", ")", "{", "subProgress", "=", "new", "SubProgressMonitor", "(", "progress", ",", "concurrentJobWork", "*", "8", "/", "10", ")", ";", "subProgress", ".", "beginTask", "(", "\"\"", ",", "totalWork", ")", ";", "concurrentJobWork", "=", "concurrentJobWork", "*", "2", "/", "10", ";", "}", "Thread", "t", "=", "this", ".", "processingThread", ";", "int", "originalPriority", "=", "t", "==", "null", "?", "-", "1", ":", "t", ".", "getPriority", "(", ")", ";", "try", "{", "if", "(", "t", "!=", "null", ")", "t", ".", "setPriority", "(", "Thread", ".", "currentThread", "(", ")", ".", "getPriority", "(", ")", ")", ";", "synchronized", "(", "this", ")", "{", "this", ".", "awaitingClients", "++", ";", "}", "IJob", "previousJob", "=", "null", ";", "int", "awaitingJobsCount", ";", "int", "lastJobsCount", "=", "totalWork", ";", "float", "lastWorked", "=", "0", ";", "float", "totalWorked", "=", "0", ";", "while", "(", "(", "awaitingJobsCount", "=", "awaitingJobsCount", "(", ")", ")", ">", "0", ")", "{", "if", "(", "(", "subProgress", "!=", "null", "&&", "subProgress", ".", "isCanceled", "(", ")", ")", "||", "this", ".", "processingThread", "==", "null", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "IJob", "currentJob", "=", "currentJob", "(", ")", ";", "if", "(", "currentJob", "!=", "null", "&&", "currentJob", "!=", "previousJob", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "searchJob", ")", ";", "if", "(", "subProgress", "!=", "null", ")", "{", "String", "indexing", "=", "Messages", ".", "bind", "(", "Messages", ".", "jobmanager_filesToIndex", ",", "currentJob", ".", "getJobFamily", "(", ")", ",", "Integer", ".", "toString", "(", "awaitingJobsCount", ")", ")", ";", "subProgress", ".", "subTask", "(", "indexing", ")", ";", "float", "ratio", "=", "awaitingJobsCount", "<", "totalWork", "?", "1", ":", "(", "(", "float", ")", "totalWork", ")", "/", "awaitingJobsCount", ";", "if", "(", "lastJobsCount", ">", "awaitingJobsCount", ")", "{", "totalWorked", "+=", "(", "lastJobsCount", "-", "awaitingJobsCount", ")", "*", "ratio", ";", "}", "else", "{", "totalWorked", "+=", "ratio", ";", "}", "if", "(", "totalWorked", "-", "lastWorked", ">=", "1", ")", "{", "subProgress", ".", "worked", "(", "(", "int", ")", "(", "totalWorked", "-", "lastWorked", ")", ")", ";", "lastWorked", "=", "totalWorked", ";", "}", "lastJobsCount", "=", "awaitingJobsCount", ";", "}", "previousJob", "=", "currentJob", ";", "}", "try", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "searchJob", ")", ";", "Thread", ".", "sleep", "(", "50", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "}", "finally", "{", "synchronized", "(", "this", ")", "{", "this", ".", "awaitingClients", "--", ";", "}", "if", "(", "t", "!=", "null", "&&", "originalPriority", ">", "-", "1", "&&", "t", ".", "isAlive", "(", ")", ")", "t", ".", "setPriority", "(", "originalPriority", ")", ";", "}", "}", "finally", "{", "if", "(", "subProgress", "!=", "null", ")", "subProgress", ".", "done", "(", ")", ";", "}", "}", "}", "status", "=", "searchJob", ".", "execute", "(", "progress", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "progress", ",", "concurrentJobWork", ")", ")", ";", "}", "finally", "{", "if", "(", "progress", "!=", "null", ")", "progress", ".", "done", "(", ")", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "searchJob", ")", ";", "}", "return", "status", ";", "}", "public", "abstract", "String", "processName", "(", ")", ";", "public", "synchronized", "void", "request", "(", "IJob", "job", ")", "{", "job", ".", "ensureReadyToRun", "(", ")", ";", "int", "size", "=", "this", ".", "awaitingJobs", ".", "length", ";", "if", "(", "++", "this", ".", "jobEnd", "==", "size", ")", "{", "this", ".", "jobEnd", "-=", "this", ".", "jobStart", ";", "if", "(", "this", ".", "jobEnd", "<", "50", "&&", "this", ".", "jobEnd", "<", "this", ".", "jobStart", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "awaitingJobs", ",", "this", ".", "jobStart", ",", "this", ".", "awaitingJobs", ",", "0", ",", "this", ".", "jobEnd", ")", ";", "for", "(", "int", "i", "=", "this", ".", "jobStart", ";", "i", "<", "size", ";", "i", "++", ")", "this", ".", "awaitingJobs", "[", "i", "]", "=", "null", ";", "}", "else", "{", "System", ".", "arraycopy", "(", "this", ".", "awaitingJobs", ",", "this", ".", "jobStart", ",", "this", ".", "awaitingJobs", "=", "new", "IJob", "[", "size", "*", "2", "]", ",", "0", ",", "this", ".", "jobEnd", ")", ";", "}", "this", ".", "jobStart", "=", "0", ";", "}", "this", ".", "awaitingJobs", "[", "this", ".", "jobEnd", "]", "=", "job", ";", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "job", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "awaitingJobsCount", "(", ")", ")", ";", "}", "notifyAll", "(", ")", ";", "}", "public", "synchronized", "void", "reset", "(", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"Reset\"", ")", ";", "if", "(", "this", ".", "processingThread", "!=", "null", ")", "{", "discardJobs", "(", "null", ")", ";", "}", "else", "{", "this", ".", "processingThread", "=", "new", "Thread", "(", "this", ",", "processName", "(", ")", ")", ";", "this", ".", "processingThread", ".", "setDaemon", "(", "true", ")", ";", "this", ".", "processingThread", ".", "setPriority", "(", "Thread", ".", "NORM_PRIORITY", "-", "1", ")", ";", "this", ".", "processingThread", ".", "setContextClassLoader", "(", "this", ".", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ")", ";", "this", ".", "processingThread", ".", "start", "(", ")", ";", "}", "}", "public", "void", "run", "(", ")", "{", "long", "idlingStart", "=", "-", "1", ";", "activateProcessing", "(", ")", ";", "try", "{", "class", "ProgressJob", "extends", "Job", "{", "ProgressJob", "(", "String", "name", ")", "{", "super", "(", "name", ")", ";", "}", "protected", "IStatus", "run", "(", "IProgressMonitor", "monitor", ")", "{", "IJob", "job", "=", "currentJob", "(", ")", ";", "while", "(", "!", "monitor", ".", "isCanceled", "(", ")", "&&", "job", "!=", "null", ")", "{", "String", "taskName", "=", "new", "StringBuffer", "(", "Messages", ".", "jobmanager_indexing", ")", ".", "append", "(", "Messages", ".", "bind", "(", "Messages", ".", "jobmanager_filesToIndex", ",", "job", ".", "getJobFamily", "(", ")", ",", "Integer", ".", "toString", "(", "awaitingJobsCount", "(", ")", ")", ")", ")", ".", "toString", "(", ")", ";", "monitor", ".", "subTask", "(", "taskName", ")", ";", "setName", "(", "taskName", ")", ";", "try", "{", "Thread", ".", "sleep", "(", "500", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "job", "=", "currentJob", "(", ")", ";", "}", "return", "Status", ".", "OK_STATUS", ";", "}", "}", "this", ".", "progressJob", "=", "null", ";", "while", "(", "this", ".", "processingThread", "!=", "null", ")", "{", "try", "{", "IJob", "job", ";", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "processingThread", "==", "null", ")", "continue", ";", "if", "(", "(", "job", "=", "currentJob", "(", ")", ")", "==", "null", ")", "{", "if", "(", "this", ".", "progressJob", "!=", "null", ")", "{", "this", ".", "progressJob", ".", "cancel", "(", ")", ";", "this", ".", "progressJob", "=", "null", ";", "}", "if", "(", "idlingStart", "<", "0", ")", "idlingStart", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "else", "notifyIdle", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "idlingStart", ")", ";", "this", ".", "wait", "(", ")", ";", "}", "else", "{", "idlingStart", "=", "-", "1", ";", "}", "}", "if", "(", "job", "==", "null", ")", "{", "notifyIdle", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "idlingStart", ")", ";", "Thread", ".", "sleep", "(", "500", ")", ";", "continue", ";", "}", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "awaitingJobsCount", "(", ")", "+", "\"\"", ")", ";", "Util", ".", "verbose", "(", "\"\"", "+", "job", ")", ";", "}", "try", "{", "this", ".", "executing", "=", "true", ";", "if", "(", "this", ".", "progressJob", "==", "null", ")", "{", "this", ".", "progressJob", "=", "new", "ProgressJob", "(", "Messages", ".", "bind", "(", "Messages", ".", "jobmanager_indexing", ",", "\"\"", ",", "\"\"", ")", ")", ";", "this", ".", "progressJob", ".", "setPriority", "(", "Job", ".", "LONG", ")", ";", "this", ".", "progressJob", ".", "setSystem", "(", "true", ")", ";", "this", ".", "progressJob", ".", "schedule", "(", ")", ";", "}", "job", ".", "execute", "(", "null", ")", ";", "}", "finally", "{", "this", ".", "executing", "=", "false", ";", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"\"", "+", "job", ")", ";", "moveToNextJob", "(", ")", ";", "if", "(", "this", ".", "awaitingClients", "==", "0", ")", "Thread", ".", "sleep", "(", "50", ")", ";", "}", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "if", "(", "this", ".", "processingThread", "!=", "null", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "discardJobs", "(", "null", ")", ";", "this", ".", "processingThread", "=", "null", ";", "reset", "(", ")", ";", "}", "throw", "e", ";", "}", "catch", "(", "Error", "e", ")", "{", "if", "(", "this", ".", "processingThread", "!=", "null", "&&", "!", "(", "e", "instanceof", "ThreadDeath", ")", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "discardJobs", "(", "null", ")", ";", "this", ".", "processingThread", "=", "null", ";", "reset", "(", ")", ";", "}", "throw", "e", ";", "}", "}", "public", "void", "shutdown", "(", ")", "{", "if", "(", "VERBOSE", ")", "Util", ".", "verbose", "(", "\"Shutdown\"", ")", ";", "disable", "(", ")", ";", "discardJobs", "(", "null", ")", ";", "Thread", "thread", "=", "this", ".", "processingThread", ";", "try", "{", "if", "(", "thread", "!=", "null", ")", "{", "synchronized", "(", "this", ")", "{", "this", ".", "processingThread", "=", "null", ";", "notifyAll", "(", ")", ";", "}", "thread", ".", "join", "(", ")", ";", "}", "Job", "job", "=", "this", ".", "progressJob", ";", "if", "(", "job", "!=", "null", ")", "{", "job", ".", "cancel", "(", ")", ";", "job", ".", "join", "(", ")", ";", "}", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "10", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ".", "append", "(", "this", ".", "enableCount", ")", ".", "append", "(", "'\\n'", ")", ";", "int", "numJobs", "=", "this", ".", "jobEnd", "-", "this", ".", "jobStart", "+", "1", ";", "buffer", ".", "append", "(", "\"\"", ")", ".", "append", "(", "numJobs", ")", ".", "append", "(", "'\\n'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numJobs", "&&", "i", "<", "15", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "i", ")", ".", "append", "(", "\"", "-", "job[\"", "+", "i", "+", "\"]:", "\"", ")", ".", "append", "(", "this", ".", "awaitingJobs", "[", "this", ".", "jobStart", "+", "i", "]", ")", ".", "append", "(", "'\\n'", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,542
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "public", "class", "SubTypeSearchJob", "extends", "PatternSearchJob", "{", "SimpleSet", "indexes", "=", "new", "SimpleSet", "(", "5", ")", ";", "public", "SubTypeSearchJob", "(", "SearchPattern", "pattern", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IndexQueryRequestor", "requestor", ")", "{", "super", "(", "pattern", ",", "participant", ",", "scope", ",", "requestor", ")", ";", "}", "public", "void", "finished", "(", ")", "{", "Object", "[", "]", "values", "=", "this", ".", "indexes", ".", "values", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "values", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "values", "[", "i", "]", "!=", "null", ")", "(", "(", "Index", ")", "values", "[", "i", "]", ")", ".", "stopQuery", "(", ")", ";", "}", "public", "Index", "[", "]", "getIndexes", "(", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "this", ".", "indexes", ".", "elementSize", "==", "0", ")", "{", "return", "super", ".", "getIndexes", "(", "progressMonitor", ")", ";", "}", "this", ".", "areIndexesReady", "=", "true", ";", "Index", "[", "]", "values", "=", "new", "Index", "[", "this", ".", "indexes", ".", "elementSize", "]", ";", "this", ".", "indexes", ".", "asArray", "(", "values", ")", ";", "return", "values", ";", "}", "public", "boolean", "search", "(", "Index", "index", ",", "IProgressMonitor", "progressMonitor", ")", "{", "if", "(", "index", "==", "null", ")", "return", "COMPLETE", ";", "if", "(", "this", ".", "indexes", ".", "addIfNotIncluded", "(", "index", ")", "==", "index", ")", "index", ".", "startQuery", "(", ")", ";", "return", "super", ".", "search", "(", "index", ",", "progressMonitor", ")", ";", "}", "}", "</s>" ]
2,543
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "public", "class", "PathCollector", "extends", "IndexQueryRequestor", "{", "public", "HashSet", "paths", "=", "new", "HashSet", "(", "5", ")", ";", "public", "boolean", "acceptIndexMatch", "(", "String", "documentPath", ",", "SearchPattern", "indexRecord", ",", "SearchParticipant", "participant", ",", "AccessRuleSet", "access", ")", "{", "this", ".", "paths", ".", "add", "(", "documentPath", ")", ";", "return", "true", ";", "}", "public", "String", "[", "]", "getPaths", "(", ")", "{", "String", "[", "]", "result", "=", "new", "String", "[", "this", ".", "paths", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Iterator", "iter", "=", "this", ".", "paths", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "result", "[", "i", "++", "]", "=", "(", "String", ")", "iter", ".", "next", "(", ")", ";", "}", "return", "result", ";", "}", "}", "</s>" ]
2,544
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeVariableBinding", ";", "public", "class", "TypeParameterLocator", "extends", "PatternLocator", "{", "protected", "TypeParameterPattern", "pattern", ";", "public", "TypeParameterLocator", "(", "TypeParameterPattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "}", "public", "int", "match", "(", "TypeReference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "if", "(", "node", "instanceof", "SingleTypeReference", ")", "{", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "(", "(", "SingleTypeReference", ")", "node", ")", ".", "token", ")", ")", "{", "int", "level", "=", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "level", ")", ";", "}", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "TypeParameter", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "this", ".", "pattern", ".", "findDeclarations", ")", "{", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "node", ".", "name", ")", ")", "{", "int", "level", "=", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "level", ")", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "return", "ALL_CONTAINER", ";", "}", "return", "CLASS_CONTAINER", "|", "METHOD_CONTAINER", ";", "}", "protected", "int", "matchTypeParameter", "(", "TypeVariableBinding", "variable", ",", "boolean", "matchName", ")", "{", "if", "(", "variable", "==", "null", "||", "variable", ".", "declaringElement", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "variable", ".", "declaringElement", "instanceof", "ReferenceBinding", ")", "{", "ReferenceBinding", "refBinding", "=", "(", "ReferenceBinding", ")", "variable", ".", "declaringElement", ";", "if", "(", "matchesName", "(", "refBinding", ".", "sourceName", ",", "this", ".", "pattern", ".", "declaringMemberName", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "}", "else", "if", "(", "variable", ".", "declaringElement", "instanceof", "MethodBinding", ")", "{", "MethodBinding", "methBinding", "=", "(", "MethodBinding", ")", "variable", ".", "declaringElement", ";", "if", "(", "matchesName", "(", "methBinding", ".", "declaringClass", ".", "sourceName", ",", "this", ".", "pattern", ".", "methodDeclaringClassName", ")", "&&", "(", "methBinding", ".", "isConstructor", "(", ")", "||", "matchesName", "(", "methBinding", ".", "selector", ",", "this", ".", "pattern", ".", "declaringMemberName", ")", ")", ")", "{", "int", "length", "=", "this", ".", "pattern", ".", "methodArgumentTypes", "==", "null", "?", "0", ":", "this", ".", "pattern", ".", "methodArgumentTypes", ".", "length", ";", "if", "(", "methBinding", ".", "parameters", "==", "null", ")", "{", "if", "(", "length", "==", "0", ")", "return", "ACCURATE_MATCH", ";", "}", "else", "if", "(", "methBinding", ".", "parameters", ".", "length", "==", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "matchesName", "(", "methBinding", ".", "parameters", "[", "i", "]", ".", "shortReadableName", "(", ")", ",", "this", ".", "pattern", ".", "methodArgumentTypes", "[", "i", "]", ")", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "}", "return", "ACCURATE_MATCH", ";", "}", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "IJavaElement", ".", "TYPE_PARAMETER", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "possibleMatchingNode", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "if", "(", "possibleMatchingNode", "instanceof", "SingleTypeReference", ")", "{", "return", "resolveLevel", "(", "(", "(", "SingleTypeReference", ")", "possibleMatchingNode", ")", ".", "resolvedType", ")", ";", "}", "}", "if", "(", "this", ".", "pattern", ".", "findDeclarations", ")", "{", "if", "(", "possibleMatchingNode", "instanceof", "TypeParameter", ")", "{", "return", "matchTypeParameter", "(", "(", "(", "TypeParameter", ")", "possibleMatchingNode", ")", ".", "binding", ",", "true", ")", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "!", "(", "binding", "instanceof", "TypeVariableBinding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "matchTypeParameter", "(", "(", "TypeVariableBinding", ")", "binding", ",", "true", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,545
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchDocument", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "CompilationUnitDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileReader", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "PossibleMatch", "implements", "ICompilationUnit", "{", "public", "static", "final", "String", "NO_SOURCE_FILE_NAME", "=", "\"\"", ";", "public", "static", "final", "char", "[", "]", "NO_SOURCE_FILE", "=", "new", "char", "[", "0", "]", ";", "public", "IResource", "resource", ";", "public", "Openable", "openable", ";", "public", "MatchingNodeSet", "nodeSet", ";", "public", "char", "[", "]", "[", "]", "compoundName", ";", "CompilationUnitDeclaration", "parsedUnit", ";", "public", "SearchDocument", "document", ";", "private", "String", "sourceFileName", ";", "private", "char", "[", "]", "source", ";", "private", "PossibleMatch", "similarMatch", ";", "public", "PossibleMatch", "(", "MatchLocator", "locator", ",", "IResource", "resource", ",", "Openable", "openable", ",", "SearchDocument", "document", ",", "boolean", "mustResolve", ")", "{", "this", ".", "resource", "=", "resource", ";", "this", ".", "openable", "=", "openable", ";", "this", ".", "document", "=", "document", ";", "this", ".", "nodeSet", "=", "new", "MatchingNodeSet", "(", "mustResolve", ")", ";", "char", "[", "]", "qualifiedName", "=", "getQualifiedName", "(", ")", ";", "if", "(", "qualifiedName", "!=", "null", ")", "this", ".", "compoundName", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "qualifiedName", ")", ";", "}", "public", "void", "cleanUp", "(", ")", "{", "this", ".", "source", "=", "null", ";", "if", "(", "this", ".", "parsedUnit", "!=", "null", ")", "{", "this", ".", "parsedUnit", ".", "cleanUp", "(", ")", ";", "this", ".", "parsedUnit", "=", "null", ";", "}", "this", ".", "nodeSet", "=", "null", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "this", ".", "compoundName", "==", "null", ")", "return", "super", ".", "equals", "(", "obj", ")", ";", "if", "(", "!", "(", "obj", "instanceof", "PossibleMatch", ")", ")", "return", "false", ";", "return", "CharOperation", ".", "equals", "(", "this", ".", "compoundName", ",", "(", "(", "PossibleMatch", ")", "obj", ")", ".", "compoundName", ")", ";", "}", "public", "char", "[", "]", "getContents", "(", ")", "{", "char", "[", "]", "contents", "=", "(", "this", ".", "source", "==", "NO_SOURCE_FILE", ")", "?", "null", ":", "this", ".", "source", ";", "if", "(", "this", ".", "source", "==", "null", ")", "{", "if", "(", "this", ".", "openable", "instanceof", "ClassFile", ")", "{", "String", "fileName", "=", "getSourceFileName", "(", ")", ";", "if", "(", "fileName", "==", "NO_SOURCE_FILE_NAME", ")", "return", "CharOperation", ".", "NO_CHAR", ";", "SourceMapper", "sourceMapper", "=", "this", ".", "openable", ".", "getSourceMapper", "(", ")", ";", "if", "(", "sourceMapper", "!=", "null", ")", "{", "IType", "type", "=", "(", "(", "ClassFile", ")", "this", ".", "openable", ")", ".", "getType", "(", ")", ";", "contents", "=", "sourceMapper", ".", "findSource", "(", "type", ",", "fileName", ")", ";", "}", "}", "else", "{", "contents", "=", "this", ".", "document", ".", "getCharContents", "(", ")", ";", "}", "this", ".", "source", "=", "(", "contents", "==", "null", ")", "?", "NO_SOURCE_FILE", ":", "contents", ";", "}", "return", "contents", ";", "}", "public", "char", "[", "]", "getFileName", "(", ")", "{", "return", "this", ".", "openable", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "public", "char", "[", "]", "getMainTypeName", "(", ")", "{", "return", "this", ".", "compoundName", "[", "this", ".", "compoundName", ".", "length", "-", "1", "]", ";", "}", "public", "char", "[", "]", "[", "]", "getPackageName", "(", ")", "{", "int", "length", "=", "this", ".", "compoundName", ".", "length", ";", "if", "(", "length", "<=", "1", ")", "return", "CharOperation", ".", "NO_CHAR_CHAR", ";", "return", "CharOperation", ".", "subarray", "(", "this", ".", "compoundName", ",", "0", ",", "length", "-", "1", ")", ";", "}", "private", "char", "[", "]", "getQualifiedName", "(", ")", "{", "if", "(", "this", ".", "openable", "instanceof", "CompilationUnit", ")", "{", "String", "fileName", "=", "this", ".", "openable", ".", "getElementName", "(", ")", ";", "char", "[", "]", "mainTypeName", "=", "Util", ".", "getNameWithoutJavaLikeExtension", "(", "fileName", ")", ".", "toCharArray", "(", ")", ";", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "this", ".", "openable", ";", "return", "cu", ".", "getType", "(", "new", "String", "(", "mainTypeName", ")", ")", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "else", "if", "(", "this", ".", "openable", "instanceof", "ClassFile", ")", "{", "String", "fileName", "=", "getSourceFileName", "(", ")", ";", "if", "(", "fileName", "==", "NO_SOURCE_FILE_NAME", ")", "return", "(", "(", "ClassFile", ")", "this", ".", "openable", ")", ".", "getType", "(", ")", ".", "getFullyQualifiedName", "(", "'.'", ")", ".", "toCharArray", "(", ")", ";", "int", "index", "=", "Util", ".", "indexOfJavaLikeExtension", "(", "fileName", ")", ";", "String", "simpleName", "=", "index", "==", "-", "1", "?", "fileName", ":", "fileName", ".", "substring", "(", "0", ",", "index", ")", ";", "PackageFragment", "pkg", "=", "(", "PackageFragment", ")", "this", ".", "openable", ".", "getParent", "(", ")", ";", "return", "Util", ".", "concatWith", "(", "pkg", ".", "names", ",", "simpleName", ",", "'.'", ")", ".", "toCharArray", "(", ")", ";", "}", "return", "null", ";", "}", "PossibleMatch", "getSimilarMatch", "(", ")", "{", "return", "this", ".", "similarMatch", ";", "}", "private", "String", "getSourceFileName", "(", ")", "{", "if", "(", "this", ".", "sourceFileName", "!=", "null", ")", "return", "this", ".", "sourceFileName", ";", "this", ".", "sourceFileName", "=", "NO_SOURCE_FILE_NAME", ";", "if", "(", "this", ".", "openable", ".", "getSourceMapper", "(", ")", "!=", "null", ")", "{", "BinaryType", "type", "=", "(", "BinaryType", ")", "(", "(", "ClassFile", ")", "this", ".", "openable", ")", ".", "getType", "(", ")", ";", "ClassFileReader", "reader", "=", "MatchLocator", ".", "classFileReader", "(", "type", ")", ";", "if", "(", "reader", "!=", "null", ")", "{", "String", "fileName", "=", "type", ".", "sourceFileName", "(", "reader", ")", ";", "this", ".", "sourceFileName", "=", "fileName", "==", "null", "?", "NO_SOURCE_FILE_NAME", ":", "fileName", ";", "}", "}", "return", "this", ".", "sourceFileName", ";", "}", "boolean", "hasSimilarMatch", "(", ")", "{", "return", "this", ".", "similarMatch", "!=", "null", "&&", "this", ".", "source", "==", "NO_SOURCE_FILE", ";", "}", "public", "int", "hashCode", "(", ")", "{", "if", "(", "this", ".", "compoundName", "==", "null", ")", "return", "super", ".", "hashCode", "(", ")", ";", "int", "hashCode", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "compoundName", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "hashCode", "+=", "CharOperation", ".", "hashCode", "(", "this", ".", "compoundName", "[", "i", "]", ")", ";", "return", "hashCode", ";", "}", "public", "boolean", "ignoreOptionalProblems", "(", ")", "{", "return", "false", ";", "}", "void", "setSimilarMatch", "(", "PossibleMatch", "possibleMatch", ")", "{", "possibleMatch", ".", "source", "=", "NO_SOURCE_FILE", ";", "this", ".", "similarMatch", "=", "possibleMatch", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "openable", "==", "null", "?", "\"\"", ":", "this", ".", "openable", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,546
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "public", "abstract", "class", "VariablePattern", "extends", "JavaSearchPattern", "{", "protected", "boolean", "findDeclarations", "=", "false", ";", "protected", "boolean", "findReferences", "=", "false", ";", "protected", "boolean", "readAccess", "=", "false", ";", "protected", "boolean", "writeAccess", "=", "false", ";", "protected", "char", "[", "]", "name", ";", "public", "final", "static", "int", "FINE_GRAIN_MASK", "=", "IJavaSearchConstants", ".", "SUPER_REFERENCE", "|", "IJavaSearchConstants", ".", "QUALIFIED_REFERENCE", "|", "IJavaSearchConstants", ".", "THIS_REFERENCE", "|", "IJavaSearchConstants", ".", "IMPLICIT_THIS_REFERENCE", ";", "public", "VariablePattern", "(", "int", "patternKind", ",", "char", "[", "]", "name", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "super", "(", "patternKind", ",", "matchRule", ")", ";", "this", ".", "fineGrain", "=", "limitTo", "&", "FINE_GRAIN_MASK", ";", "if", "(", "this", ".", "fineGrain", "==", "0", ")", "{", "switch", "(", "limitTo", "&", "0xF", ")", "{", "case", "IJavaSearchConstants", ".", "DECLARATIONS", ":", "this", ".", "findDeclarations", "=", "true", ";", "break", ";", "case", "IJavaSearchConstants", ".", "REFERENCES", ":", "this", ".", "readAccess", "=", "true", ";", "this", ".", "writeAccess", "=", "true", ";", "break", ";", "case", "IJavaSearchConstants", ".", "READ_ACCESSES", ":", "this", ".", "readAccess", "=", "true", ";", "break", ";", "case", "IJavaSearchConstants", ".", "WRITE_ACCESSES", ":", "this", ".", "writeAccess", "=", "true", ";", "break", ";", "case", "IJavaSearchConstants", ".", "ALL_OCCURRENCES", ":", "this", ".", "findDeclarations", "=", "true", ";", "this", ".", "readAccess", "=", "true", ";", "this", ".", "writeAccess", "=", "true", ";", "break", ";", "}", "this", ".", "findReferences", "=", "this", ".", "readAccess", "||", "this", ".", "writeAccess", ";", "}", "this", ".", "name", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "name", ":", "CharOperation", ".", "toLowerCase", "(", "name", ")", ";", "}", "protected", "boolean", "mustResolve", "(", ")", "{", "return", "this", ".", "findReferences", "||", "this", ".", "fineGrain", "!=", "0", ";", "}", "}", "</s>" ]
2,547
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ASTVisitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Parser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "ProblemReporter", ";", "public", "class", "MatchLocatorParser", "extends", "Parser", "{", "MatchingNodeSet", "nodeSet", ";", "PatternLocator", "patternLocator", ";", "private", "ASTVisitor", "localDeclarationVisitor", ";", "final", "int", "patternFineGrain", ";", "public", "static", "MatchLocatorParser", "createParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", "{", "if", "(", "(", "locator", ".", "matchContainer", "&", "PatternLocator", ".", "COMPILATION_UNIT_CONTAINER", ")", "!=", "0", ")", "{", "return", "LanguageSupportFactory", ".", "getImportMatchLocatorParser", "(", "problemReporter", ",", "locator", ")", ";", "}", "return", "LanguageSupportFactory", ".", "getMatchLocatorParser", "(", "problemReporter", ",", "locator", ")", ";", "}", "public", "class", "NoClassNoMethodDeclarationVisitor", "extends", "ASTVisitor", "{", "public", "boolean", "visit", "(", "ConstructorDeclaration", "constructorDeclaration", ",", "ClassScope", "scope", ")", "{", "return", "(", "constructorDeclaration", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ";", "}", "public", "boolean", "visit", "(", "FieldDeclaration", "fieldDeclaration", ",", "MethodScope", "scope", ")", "{", "return", "(", "fieldDeclaration", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ";", "}", "public", "boolean", "visit", "(", "Initializer", "initializer", ",", "MethodScope", "scope", ")", "{", "return", "(", "initializer", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ";", "}", "public", "boolean", "visit", "(", "MethodDeclaration", "methodDeclaration", ",", "ClassScope", "scope", ")", "{", "return", "(", "methodDeclaration", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ";", "}", "}", "public", "class", "MethodButNoClassDeclarationVisitor", "extends", "NoClassNoMethodDeclarationVisitor", "{", "public", "boolean", "visit", "(", "TypeDeclaration", "localTypeDeclaration", ",", "BlockScope", "scope", ")", "{", "MatchLocatorParser", ".", "this", ".", "patternLocator", ".", "match", "(", "localTypeDeclaration", ",", "MatchLocatorParser", ".", "this", ".", "nodeSet", ")", ";", "return", "true", ";", "}", "}", "public", "class", "ClassButNoMethodDeclarationVisitor", "extends", "ASTVisitor", "{", "public", "boolean", "visit", "(", "ConstructorDeclaration", "constructorDeclaration", ",", "ClassScope", "scope", ")", "{", "MatchLocatorParser", ".", "this", ".", "patternLocator", ".", "match", "(", "constructorDeclaration", ",", "MatchLocatorParser", ".", "this", ".", "nodeSet", ")", ";", "return", "(", "constructorDeclaration", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ";", "}", "public", "boolean", "visit", "(", "FieldDeclaration", "fieldDeclaration", ",", "MethodScope", "scope", ")", "{", "MatchLocatorParser", ".", "this", ".", "patternLocator", ".", "match", "(", "fieldDeclaration", ",", "MatchLocatorParser", ".", "this", ".", "nodeSet", ")", ";", "return", "(", "fieldDeclaration", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ";", "}", "public", "boolean", "visit", "(", "Initializer", "initializer", ",", "MethodScope", "scope", ")", "{", "MatchLocatorParser", ".", "this", ".", "patternLocator", ".", "match", "(", "initializer", ",", "MatchLocatorParser", ".", "this", ".", "nodeSet", ")", ";", "return", "(", "initializer", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "memberTypeDeclaration", ",", "ClassScope", "scope", ")", "{", "MatchLocatorParser", ".", "this", ".", "patternLocator", ".", "match", "(", "memberTypeDeclaration", ",", "MatchLocatorParser", ".", "this", ".", "nodeSet", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MethodDeclaration", "methodDeclaration", ",", "ClassScope", "scope", ")", "{", "MatchLocatorParser", ".", "this", ".", "patternLocator", ".", "match", "(", "methodDeclaration", ",", "MatchLocatorParser", ".", "this", ".", "nodeSet", ")", ";", "return", "(", "methodDeclaration", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ";", "}", "public", "boolean", "visit", "(", "AnnotationMethodDeclaration", "methodDeclaration", ",", "ClassScope", "scope", ")", "{", "MatchLocatorParser", ".", "this", ".", "patternLocator", ".", "match", "(", "methodDeclaration", ",", "MatchLocatorParser", ".", "this", ".", "nodeSet", ")", ";", "return", "false", ";", "}", "}", "public", "class", "ClassAndMethodDeclarationVisitor", "extends", "ClassButNoMethodDeclarationVisitor", "{", "public", "boolean", "visit", "(", "TypeDeclaration", "localTypeDeclaration", ",", "BlockScope", "scope", ")", "{", "MatchLocatorParser", ".", "this", ".", "patternLocator", ".", "match", "(", "localTypeDeclaration", ",", "MatchLocatorParser", ".", "this", ".", "nodeSet", ")", ";", "return", "true", ";", "}", "}", "public", "MatchLocatorParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", "{", "super", "(", "problemReporter", ",", "true", ")", ";", "this", ".", "reportOnlyOneSyntaxError", "=", "true", ";", "this", ".", "patternLocator", "=", "locator", ".", "patternLocator", ";", "if", "(", "(", "locator", ".", "matchContainer", "&", "PatternLocator", ".", "CLASS_CONTAINER", ")", "!=", "0", ")", "{", "this", ".", "localDeclarationVisitor", "=", "(", "locator", ".", "matchContainer", "&", "PatternLocator", ".", "METHOD_CONTAINER", ")", "!=", "0", "?", "new", "ClassAndMethodDeclarationVisitor", "(", ")", ":", "new", "ClassButNoMethodDeclarationVisitor", "(", ")", ";", "}", "else", "{", "this", ".", "localDeclarationVisitor", "=", "(", "locator", ".", "matchContainer", "&", "PatternLocator", ".", "METHOD_CONTAINER", ")", "!=", "0", "?", "new", "MethodButNoClassDeclarationVisitor", "(", ")", ":", "new", "NoClassNoMethodDeclarationVisitor", "(", ")", ";", "}", "this", ".", "patternFineGrain", "=", "this", ".", "patternLocator", ".", "fineGrain", "(", ")", ";", "}", "public", "void", "checkComment", "(", ")", "{", "super", ".", "checkComment", "(", ")", ";", "if", "(", "this", ".", "javadocParser", ".", "checkDocComment", "&&", "this", ".", "javadoc", "!=", "null", "&&", "this", ".", "patternFineGrain", "==", "0", ")", "{", "JavadocSingleNameReference", "[", "]", "paramReferences", "=", "this", ".", "javadoc", ".", "paramReferences", ";", "if", "(", "paramReferences", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "paramReferences", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "paramReferences", "[", "i", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "JavadocSingleTypeReference", "[", "]", "paramTypeParameters", "=", "this", ".", "javadoc", ".", "paramTypeParameters", ";", "if", "(", "paramTypeParameters", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "paramTypeParameters", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "paramTypeParameters", "[", "i", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "TypeReference", "[", "]", "thrownExceptions", "=", "this", ".", "javadoc", ".", "exceptionReferences", ";", "if", "(", "thrownExceptions", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "thrownExceptions", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "thrownExceptions", "[", "i", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "Expression", "[", "]", "references", "=", "this", ".", "javadoc", ".", "seeReferences", ";", "if", "(", "references", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "references", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Expression", "reference", "=", "references", "[", "i", "]", ";", "if", "(", "reference", "instanceof", "TypeReference", ")", "{", "TypeReference", "typeRef", "=", "(", "TypeReference", ")", "reference", ";", "this", ".", "patternLocator", ".", "match", "(", "typeRef", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "if", "(", "reference", "instanceof", "JavadocFieldReference", ")", "{", "JavadocFieldReference", "fieldRef", "=", "(", "JavadocFieldReference", ")", "reference", ";", "this", ".", "patternLocator", ".", "match", "(", "fieldRef", ",", "this", ".", "nodeSet", ")", ";", "if", "(", "fieldRef", ".", "receiver", "instanceof", "TypeReference", "&&", "!", "fieldRef", ".", "receiver", ".", "isThis", "(", ")", ")", "{", "TypeReference", "typeRef", "=", "(", "TypeReference", ")", "fieldRef", ".", "receiver", ";", "this", ".", "patternLocator", ".", "match", "(", "typeRef", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "else", "if", "(", "reference", "instanceof", "JavadocMessageSend", ")", "{", "JavadocMessageSend", "messageSend", "=", "(", "JavadocMessageSend", ")", "reference", ";", "this", ".", "patternLocator", ".", "match", "(", "messageSend", ",", "this", ".", "nodeSet", ")", ";", "if", "(", "messageSend", ".", "receiver", "instanceof", "TypeReference", "&&", "!", "messageSend", ".", "receiver", ".", "isThis", "(", ")", ")", "{", "TypeReference", "typeRef", "=", "(", "TypeReference", ")", "messageSend", ".", "receiver", ";", "this", ".", "patternLocator", ".", "match", "(", "typeRef", ",", "this", ".", "nodeSet", ")", ";", "}", "if", "(", "messageSend", ".", "arguments", "!=", "null", ")", "{", "for", "(", "int", "a", "=", "0", ",", "al", "=", "messageSend", ".", "arguments", ".", "length", ";", "a", "<", "al", ";", "a", "++", ")", "{", "JavadocArgumentExpression", "argument", "=", "(", "JavadocArgumentExpression", ")", "messageSend", ".", "arguments", "[", "a", "]", ";", "if", "(", "argument", ".", "argument", "!=", "null", "&&", "argument", ".", "argument", ".", "type", "!=", "null", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "argument", ".", "argument", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "else", "if", "(", "reference", "instanceof", "JavadocAllocationExpression", ")", "{", "JavadocAllocationExpression", "constructor", "=", "(", "JavadocAllocationExpression", ")", "reference", ";", "this", ".", "patternLocator", ".", "match", "(", "constructor", ",", "this", ".", "nodeSet", ")", ";", "if", "(", "constructor", ".", "type", "!=", "null", "&&", "!", "constructor", ".", "type", ".", "isThis", "(", ")", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "constructor", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "if", "(", "constructor", ".", "arguments", "!=", "null", ")", "{", "for", "(", "int", "a", "=", "0", ",", "al", "=", "constructor", ".", "arguments", ".", "length", ";", "a", "<", "al", ";", "a", "++", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "constructor", ".", "arguments", "[", "a", "]", ",", "this", ".", "nodeSet", ")", ";", "JavadocArgumentExpression", "argument", "=", "(", "JavadocArgumentExpression", ")", "constructor", ".", "arguments", "[", "a", "]", ";", "if", "(", "argument", ".", "argument", "!=", "null", "&&", "argument", ".", "argument", ".", "type", "!=", "null", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "argument", ".", "argument", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "}", "}", "}", "}", "protected", "void", "classInstanceCreation", "(", "boolean", "alwaysQualified", ")", "{", "super", ".", "classInstanceCreation", "(", "alwaysQualified", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CLASS_INSTANCE_CREATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "AllocationExpression", "allocation", "=", "(", "AllocationExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "allocation", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeAdditionalBound", "(", ")", "{", "super", ".", "consumeAdditionalBound", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_VARIABLE_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeReference", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeAssignment", "(", ")", "{", "super", ".", "consumeAssignment", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeCastExpressionLL1", "(", ")", "{", "super", ".", "consumeCastExpressionLL1", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeCastExpressionWithGenericsArray", "(", ")", "{", "super", ".", "consumeCastExpressionWithGenericsArray", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeCastExpressionWithNameArray", "(", ")", "{", "super", ".", "consumeCastExpressionWithNameArray", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeCastExpressionWithPrimitiveType", "(", ")", "{", "super", ".", "consumeCastExpressionWithPrimitiveType", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeCastExpressionWithQualifiedGenericsArray", "(", ")", "{", "super", ".", "consumeCastExpressionWithQualifiedGenericsArray", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeCatchFormalParameter", "(", ")", "{", "super", ".", "consumeCatchFormalParameter", "(", ")", ";", "this", ".", "patternLocator", ".", "match", "(", "(", "LocalDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "protected", "void", "consumeClassHeaderExtends", "(", ")", "{", "this", ".", "patternLocator", ".", "setFlavors", "(", "PatternLocator", ".", "SUPERTYPE_REF_FLAVOR", ")", ";", "super", ".", "consumeClassHeaderExtends", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "SUPERTYPE_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeDeclaration", "typeDeclaration", "=", "(", "TypeDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeDeclaration", ".", "superclass", ",", "this", ".", "nodeSet", ")", ";", "}", "this", ".", "patternLocator", ".", "setFlavors", "(", "PatternLocator", ".", "NO_FLAVOR", ")", ";", "}", "protected", "void", "consumeClassInstanceCreationExpressionQualifiedWithTypeArguments", "(", ")", "{", "super", ".", "consumeClassInstanceCreationExpressionWithTypeArguments", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CLASS_INSTANCE_CREATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "AllocationExpression", "allocation", "=", "(", "AllocationExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "allocation", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeClassInstanceCreationExpressionWithTypeArguments", "(", ")", "{", "super", ".", "consumeClassInstanceCreationExpressionWithTypeArguments", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CLASS_INSTANCE_CREATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "AllocationExpression", "allocation", "=", "(", "AllocationExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "allocation", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeEnterAnonymousClassBody", "(", "boolean", "qualified", ")", "{", "this", ".", "patternLocator", ".", "setFlavors", "(", "PatternLocator", ".", "SUPERTYPE_REF_FLAVOR", ")", ";", "super", ".", "consumeEnterAnonymousClassBody", "(", "qualified", ")", ";", "this", ".", "patternLocator", ".", "setFlavors", "(", "PatternLocator", ".", "NO_FLAVOR", ")", ";", "}", "protected", "void", "consumeEnterVariable", "(", ")", "{", "boolean", "isLocalDeclaration", "=", "this", ".", "nestedMethod", "[", "this", ".", "nestedType", "]", "!=", "0", ";", "super", ".", "consumeEnterVariable", "(", ")", ";", "if", "(", "isLocalDeclaration", ")", "{", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "LocalDeclaration", "localDeclaration", "=", "(", "LocalDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "localDeclaration", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "else", "{", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "FIELD_DECLARATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "FieldDeclaration", "fieldDeclaration", "=", "(", "FieldDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "fieldDeclaration", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "protected", "void", "consumeExplicitConstructorInvocation", "(", "int", "flag", ",", "int", "recFlag", ")", "{", "super", ".", "consumeExplicitConstructorInvocation", "(", "flag", ",", "recFlag", ")", ";", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "protected", "void", "consumeExplicitConstructorInvocationWithTypeArguments", "(", "int", "flag", ",", "int", "recFlag", ")", "{", "super", ".", "consumeExplicitConstructorInvocationWithTypeArguments", "(", "flag", ",", "recFlag", ")", ";", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "protected", "void", "consumeFieldAccess", "(", "boolean", "isSuperAccess", ")", "{", "super", ".", "consumeFieldAccess", "(", "isSuperAccess", ")", ";", "int", "fineGrain", "=", "isSuperAccess", "?", "IJavaSearchConstants", ".", "SUPER_REFERENCE", ":", "IJavaSearchConstants", ".", "THIS_REFERENCE", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "fineGrain", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "Reference", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeFormalParameter", "(", "boolean", "isVarArgs", ")", "{", "super", ".", "consumeFormalParameter", "(", "isVarArgs", ")", ";", "this", ".", "patternLocator", ".", "match", "(", "(", "LocalDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "protected", "void", "consumeInstanceOfExpression", "(", ")", "{", "super", ".", "consumeInstanceOfExpression", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "INSTANCEOF_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "InstanceOfExpression", "expression", "=", "(", "InstanceOfExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "expression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeInstanceOfExpressionWithName", "(", ")", "{", "super", ".", "consumeInstanceOfExpressionWithName", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "INSTANCEOF_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "InstanceOfExpression", "expression", "=", "(", "InstanceOfExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "expression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeInterfaceType", "(", ")", "{", "this", ".", "patternLocator", ".", "setFlavors", "(", "PatternLocator", ".", "SUPERTYPE_REF_FLAVOR", ")", ";", "super", ".", "consumeInterfaceType", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "SUPERTYPE_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeReference", ",", "this", ".", "nodeSet", ")", ";", "}", "this", ".", "patternLocator", ".", "setFlavors", "(", "PatternLocator", ".", "NO_FLAVOR", ")", ";", "}", "protected", "void", "consumeLocalVariableDeclaration", "(", ")", "{", "super", ".", "consumeLocalVariableDeclaration", "(", ")", ";", "this", ".", "patternLocator", ".", "match", "(", "(", "LocalDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "protected", "void", "consumeMarkerAnnotation", "(", ")", "{", "super", ".", "consumeMarkerAnnotation", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "ANNOTATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Annotation", "annotation", "=", "(", "Annotation", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "annotation", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeMemberValuePair", "(", ")", "{", "super", ".", "consumeMemberValuePair", "(", ")", ";", "this", ".", "patternLocator", ".", "match", "(", "(", "MemberValuePair", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "protected", "void", "consumeMethodHeaderName", "(", "boolean", "isAnnotationMethod", ")", "{", "super", ".", "consumeMethodHeaderName", "(", "isAnnotationMethod", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "RETURN_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "MethodDeclaration", "methodDeclaration", "=", "(", "MethodDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "methodDeclaration", ".", "returnType", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeMethodHeaderRightParen", "(", ")", "{", "super", ".", "consumeMethodHeaderRightParen", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "PARAMETER_DECLARATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "AbstractMethodDeclaration", "methodDeclaration", "=", "(", "AbstractMethodDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "Argument", "[", "]", "arguments", "=", "methodDeclaration", ".", "arguments", ";", "if", "(", "arguments", "!=", "null", ")", "{", "int", "argLength", "=", "arguments", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "argLength", ";", "i", "++", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "arguments", "[", "i", "]", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumeMethodHeaderThrowsClause", "(", ")", "{", "super", ".", "consumeMethodHeaderThrowsClause", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "THROWS_CLAUSE_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "AbstractMethodDeclaration", "methodDeclaration", "=", "(", "AbstractMethodDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "TypeReference", "[", "]", "thrownExceptions", "=", "methodDeclaration", ".", "thrownExceptions", ";", "if", "(", "thrownExceptions", "!=", "null", ")", "{", "int", "thrownLength", "=", "thrownExceptions", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "thrownLength", ";", "i", "++", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "thrownExceptions", "[", "i", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumeMethodInvocationName", "(", ")", "{", "super", ".", "consumeMethodInvocationName", "(", ")", ";", "MessageSend", "messageSend", "=", "(", "MessageSend", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "messageSend", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "{", "if", "(", "messageSend", ".", "receiver", ".", "isThis", "(", ")", ")", "{", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "IMPLICIT_THIS_REFERENCE", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "messageSend", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "else", "{", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "QUALIFIED_REFERENCE", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "messageSend", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumeMethodInvocationNameWithTypeArguments", "(", ")", "{", "super", ".", "consumeMethodInvocationNameWithTypeArguments", "(", ")", ";", "MessageSend", "messageSend", "=", "(", "MessageSend", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "messageSend", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "{", "if", "(", "messageSend", ".", "receiver", ".", "isThis", "(", ")", ")", "{", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "IMPLICIT_THIS_REFERENCE", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "messageSend", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "else", "{", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "QUALIFIED_REFERENCE", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "messageSend", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumeMethodInvocationPrimary", "(", ")", "{", "super", ".", "consumeMethodInvocationPrimary", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "THIS_REFERENCE", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "MessageSend", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeMethodInvocationPrimaryWithTypeArguments", "(", ")", "{", "super", ".", "consumeMethodInvocationPrimaryWithTypeArguments", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "THIS_REFERENCE", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "MessageSend", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeMethodInvocationSuper", "(", ")", "{", "super", ".", "consumeMethodInvocationSuper", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "SUPER_REFERENCE", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "MessageSend", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeMethodInvocationSuperWithTypeArguments", "(", ")", "{", "super", ".", "consumeMethodInvocationSuperWithTypeArguments", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "SUPER_REFERENCE", ")", "!=", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "MessageSend", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeNormalAnnotation", "(", ")", "{", "super", ".", "consumeNormalAnnotation", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "ANNOTATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Annotation", "annotation", "=", "(", "Annotation", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "annotation", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeOnlyTypeArguments", "(", ")", "{", "super", ".", "consumeOnlyTypeArguments", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_ARGUMENT_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "int", "length", "=", "this", ".", "genericsLengthStack", "[", "this", ".", "genericsLengthPtr", "]", ";", "if", "(", "length", "==", "1", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "if", "(", "!", "(", "typeReference", "instanceof", "Wildcard", ")", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "typeReference", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumePrimaryNoNewArray", "(", ")", "{", "this", ".", "intPtr", "--", ";", "this", ".", "intPtr", "--", ";", "}", "protected", "void", "consumePrimaryNoNewArrayWithName", "(", ")", "{", "pushOnExpressionStack", "(", "getUnspecifiedReferenceOptimized", "(", ")", ")", ";", "this", ".", "intPtr", "--", ";", "this", ".", "intPtr", "--", ";", "}", "protected", "void", "consumeSingleMemberAnnotation", "(", ")", "{", "super", ".", "consumeSingleMemberAnnotation", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "ANNOTATION_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Annotation", "annotation", "=", "(", "Annotation", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "annotation", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeStatementCatch", "(", ")", "{", "super", ".", "consumeStatementCatch", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CATCH_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "LocalDeclaration", "localDeclaration", "=", "(", "LocalDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "-", "1", "]", ";", "if", "(", "localDeclaration", ".", "type", "instanceof", "UnionTypeReference", ")", "{", "TypeReference", "[", "]", "refs", "=", "(", "(", "UnionTypeReference", ")", "localDeclaration", ".", "type", ")", ".", "typeReferences", ";", "for", "(", "int", "i", "=", "0", ",", "len", "=", "refs", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "refs", "[", "i", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "else", "{", "this", ".", "patternLocator", ".", "match", "(", "localDeclaration", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "protected", "void", "consumeTypeArgumentList1", "(", ")", "{", "super", ".", "consumeTypeArgumentList1", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_ARGUMENT_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "for", "(", "int", "i", "=", "this", ".", "genericsPtr", "-", "this", ".", "genericsLengthStack", "[", "this", ".", "genericsLengthPtr", "]", "+", "1", ";", "i", "<=", "this", ".", "genericsPtr", ";", "i", "++", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "genericsStack", "[", "i", "]", ";", "if", "(", "!", "(", "typeReference", "instanceof", "Wildcard", ")", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "typeReference", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumeTypeArgumentList2", "(", ")", "{", "super", ".", "consumeTypeArgumentList2", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_ARGUMENT_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "for", "(", "int", "i", "=", "this", ".", "genericsPtr", "-", "this", ".", "genericsLengthStack", "[", "this", ".", "genericsLengthPtr", "]", "+", "1", ";", "i", "<=", "this", ".", "genericsPtr", ";", "i", "++", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "genericsStack", "[", "i", "]", ";", "if", "(", "!", "(", "typeReference", "instanceof", "Wildcard", ")", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "typeReference", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumeTypeArgumentList3", "(", ")", "{", "super", ".", "consumeTypeArgumentList3", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_ARGUMENT_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "for", "(", "int", "i", "=", "this", ".", "genericsPtr", "-", "this", ".", "genericsLengthStack", "[", "this", ".", "genericsLengthPtr", "]", "+", "1", ";", "i", "<=", "this", ".", "genericsPtr", ";", "i", "++", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "genericsStack", "[", "i", "]", ";", "if", "(", "!", "(", "typeReference", "instanceof", "Wildcard", ")", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "typeReference", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumeTypeArgumentReferenceType1", "(", ")", "{", "super", ".", "consumeTypeArgumentReferenceType1", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_ARGUMENT_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "int", "length", "=", "this", ".", "genericsLengthStack", "[", "this", ".", "genericsLengthPtr", "]", ";", "if", "(", "length", "==", "1", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "TypeReference", "[", "]", "typeArguments", "=", "null", ";", "if", "(", "typeReference", "instanceof", "ParameterizedSingleTypeReference", ")", "{", "typeArguments", "=", "(", "(", "ParameterizedSingleTypeReference", ")", "typeReference", ")", ".", "typeArguments", ";", "}", "else", "if", "(", "typeReference", "instanceof", "ParameterizedQualifiedTypeReference", ")", "{", "TypeReference", "[", "]", "[", "]", "allTypeArguments", "=", "(", "(", "ParameterizedQualifiedTypeReference", ")", "typeReference", ")", ".", "typeArguments", ";", "typeArguments", "=", "allTypeArguments", "[", "allTypeArguments", ".", "length", "-", "1", "]", ";", "}", "if", "(", "typeArguments", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "ln", "=", "typeArguments", ".", "length", ";", "i", "<", "ln", ";", "i", "++", ")", "{", "if", "(", "!", "(", "typeArguments", "[", "i", "]", "instanceof", "Wildcard", ")", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "typeArguments", "[", "i", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "}", "}", "protected", "void", "consumeTypeArgumentReferenceType2", "(", ")", "{", "super", ".", "consumeTypeArgumentReferenceType2", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_ARGUMENT_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "int", "length", "=", "this", ".", "genericsLengthStack", "[", "this", ".", "genericsLengthPtr", "]", ";", "if", "(", "length", "==", "1", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "TypeReference", "[", "]", "typeArguments", "=", "null", ";", "if", "(", "typeReference", "instanceof", "ParameterizedSingleTypeReference", ")", "{", "typeArguments", "=", "(", "(", "ParameterizedSingleTypeReference", ")", "typeReference", ")", ".", "typeArguments", ";", "}", "else", "if", "(", "typeReference", "instanceof", "ParameterizedQualifiedTypeReference", ")", "{", "TypeReference", "[", "]", "[", "]", "allTypeArguments", "=", "(", "(", "ParameterizedQualifiedTypeReference", ")", "typeReference", ")", ".", "typeArguments", ";", "typeArguments", "=", "allTypeArguments", "[", "allTypeArguments", ".", "length", "-", "1", "]", ";", "}", "if", "(", "typeArguments", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "ln", "=", "typeArguments", ".", "length", ";", "i", "<", "ln", ";", "i", "++", ")", "{", "if", "(", "!", "(", "typeArguments", "[", "i", "]", "instanceof", "Wildcard", ")", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "typeArguments", "[", "i", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "}", "}", "protected", "void", "consumeTypeArguments", "(", ")", "{", "super", ".", "consumeTypeArguments", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_ARGUMENT_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "int", "length", "=", "this", ".", "genericsLengthStack", "[", "this", ".", "genericsLengthPtr", "]", ";", "if", "(", "length", "==", "1", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "if", "(", "!", "(", "typeReference", "instanceof", "Wildcard", ")", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "typeReference", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "}", "protected", "void", "consumeTypeParameter1WithExtends", "(", ")", "{", "super", ".", "consumeTypeParameter1WithExtends", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_VARIABLE_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeParameter", "typeParameter", "=", "(", "TypeParameter", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeParameter", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeTypeParameter1WithExtendsAndBounds", "(", ")", "{", "super", ".", "consumeTypeParameter1WithExtendsAndBounds", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_VARIABLE_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeParameter", "typeParameter", "=", "(", "TypeParameter", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeParameter", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeTypeParameterHeader", "(", ")", "{", "super", ".", "consumeTypeParameterHeader", "(", ")", ";", "this", ".", "patternLocator", ".", "match", "(", "(", "TypeParameter", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "protected", "void", "consumeTypeParameterWithExtends", "(", ")", "{", "super", ".", "consumeTypeParameterWithExtends", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_VARIABLE_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeParameter", "typeParameter", "=", "(", "TypeParameter", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeParameter", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeTypeParameterWithExtendsAndBounds", "(", ")", "{", "super", ".", "consumeTypeParameterWithExtendsAndBounds", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "TYPE_VARIABLE_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeParameter", "typeParameter", "=", "(", "TypeParameter", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeParameter", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeUnaryExpression", "(", "int", "op", ",", "boolean", "post", ")", "{", "super", ".", "consumeUnaryExpression", "(", "op", ",", "post", ")", ";", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "protected", "void", "consumeWildcardBounds1Extends", "(", ")", "{", "super", ".", "consumeWildcardBounds1Extends", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Wildcard", "wildcard", "=", "(", "Wildcard", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "wildcard", ".", "bound", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeWildcardBounds1Super", "(", ")", "{", "super", ".", "consumeWildcardBounds1Super", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Wildcard", "wildcard", "=", "(", "Wildcard", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "wildcard", ".", "bound", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeWildcardBounds2Extends", "(", ")", "{", "super", ".", "consumeWildcardBounds2Extends", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Wildcard", "wildcard", "=", "(", "Wildcard", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "wildcard", ".", "bound", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeWildcardBounds2Super", "(", ")", "{", "super", ".", "consumeWildcardBounds2Super", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Wildcard", "wildcard", "=", "(", "Wildcard", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "wildcard", ".", "bound", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeWildcardBounds3Extends", "(", ")", "{", "super", ".", "consumeWildcardBounds3Extends", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Wildcard", "wildcard", "=", "(", "Wildcard", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "wildcard", ".", "bound", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeWildcardBounds3Super", "(", ")", "{", "super", ".", "consumeWildcardBounds3Super", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Wildcard", "wildcard", "=", "(", "Wildcard", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "wildcard", ".", "bound", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeWildcardBoundsExtends", "(", ")", "{", "super", ".", "consumeWildcardBoundsExtends", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Wildcard", "wildcard", "=", "(", "Wildcard", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "wildcard", ".", "bound", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeWildcardBoundsSuper", "(", ")", "{", "super", ".", "consumeWildcardBoundsSuper", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "Wildcard", "wildcard", "=", "(", "Wildcard", ")", "this", ".", "genericsStack", "[", "this", ".", "genericsPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "wildcard", ".", "bound", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "TypeReference", "copyDims", "(", "TypeReference", "typeRef", ",", "int", "dim", ")", "{", "TypeReference", "result", "=", "super", ".", "copyDims", "(", "typeRef", ",", "dim", ")", ";", "if", "(", "this", ".", "nodeSet", ".", "removePossibleMatch", "(", "typeRef", ")", "!=", "null", ")", "this", ".", "nodeSet", ".", "addPossibleMatch", "(", "result", ")", ";", "else", "if", "(", "this", ".", "nodeSet", ".", "removeTrustedMatch", "(", "typeRef", ")", "!=", "null", ")", "this", ".", "nodeSet", ".", "addTrustedMatch", "(", "result", ",", "true", ")", ";", "return", "result", ";", "}", "protected", "TypeReference", "getTypeReference", "(", "int", "dim", ")", "{", "TypeReference", "typeRef", "=", "super", ".", "getTypeReference", "(", "dim", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "typeRef", ",", "this", ".", "nodeSet", ")", ";", "}", "return", "typeRef", ";", "}", "protected", "NameReference", "getUnspecifiedReference", "(", ")", "{", "NameReference", "nameRef", "=", "super", ".", "getUnspecifiedReference", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "nameRef", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "QUALIFIED_REFERENCE", ")", "!=", "0", ")", "{", "if", "(", "nameRef", "instanceof", "QualifiedNameReference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "nameRef", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "else", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "IMPLICIT_THIS_REFERENCE", ")", "!=", "0", ")", "{", "if", "(", "nameRef", "instanceof", "SingleNameReference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "nameRef", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "return", "nameRef", ";", "}", "protected", "NameReference", "getUnspecifiedReferenceOptimized", "(", ")", "{", "NameReference", "nameRef", "=", "super", ".", "getUnspecifiedReferenceOptimized", "(", ")", ";", "if", "(", "this", ".", "patternFineGrain", "==", "0", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "nameRef", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "{", "boolean", "flagQualifiedRef", "=", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "QUALIFIED_REFERENCE", ")", "!=", "0", ";", "boolean", "flagImplicitThis", "=", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "IMPLICIT_THIS_REFERENCE", ")", "!=", "0", ";", "if", "(", "flagQualifiedRef", "&&", "flagImplicitThis", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "nameRef", ",", "this", ".", "nodeSet", ")", ";", "}", "else", "if", "(", "flagQualifiedRef", ")", "{", "if", "(", "nameRef", "instanceof", "QualifiedNameReference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "nameRef", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "else", "if", "(", "flagImplicitThis", ")", "{", "if", "(", "nameRef", "instanceof", "SingleNameReference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "nameRef", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "return", "nameRef", ";", "}", "public", "void", "parseBodies", "(", "CompilationUnitDeclaration", "unit", ")", "{", "TypeDeclaration", "[", "]", "types", "=", "unit", ".", "types", ";", "if", "(", "types", "==", "null", ")", "return", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "TypeDeclaration", "type", "=", "types", "[", "i", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "type", ",", "this", ".", "nodeSet", ")", ";", "this", ".", "parseBodies", "(", "type", ",", "unit", ")", ";", "}", "}", "protected", "void", "parseBodies", "(", "TypeDeclaration", "type", ",", "CompilationUnitDeclaration", "unit", ")", "{", "FieldDeclaration", "[", "]", "fields", "=", "type", ".", "fields", ";", "if", "(", "fields", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "FieldDeclaration", "field", "=", "fields", "[", "i", "]", ";", "if", "(", "field", "instanceof", "Initializer", ")", "this", ".", "parse", "(", "(", "Initializer", ")", "field", ",", "type", ",", "unit", ")", ";", "field", ".", "traverse", "(", "this", ".", "localDeclarationVisitor", ",", "null", ")", ";", "}", "}", "AbstractMethodDeclaration", "[", "]", "methods", "=", "type", ".", "methods", ";", "if", "(", "methods", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methods", ".", "length", ";", "i", "++", ")", "{", "AbstractMethodDeclaration", "method", "=", "methods", "[", "i", "]", ";", "if", "(", "method", ".", "sourceStart", ">=", "type", ".", "bodyStart", ")", "{", "if", "(", "method", "instanceof", "MethodDeclaration", ")", "{", "MethodDeclaration", "methodDeclaration", "=", "(", "MethodDeclaration", ")", "method", ";", "this", ".", "parse", "(", "methodDeclaration", ",", "unit", ")", ";", "methodDeclaration", ".", "traverse", "(", "this", ".", "localDeclarationVisitor", ",", "(", "ClassScope", ")", "null", ")", ";", "}", "else", "if", "(", "method", "instanceof", "ConstructorDeclaration", ")", "{", "ConstructorDeclaration", "constructorDeclaration", "=", "(", "ConstructorDeclaration", ")", "method", ";", "this", ".", "parse", "(", "constructorDeclaration", ",", "unit", ",", "false", ")", ";", "constructorDeclaration", ".", "traverse", "(", "this", ".", "localDeclarationVisitor", ",", "(", "ClassScope", ")", "null", ")", ";", "}", "}", "else", "if", "(", "method", ".", "isDefaultConstructor", "(", ")", ")", "{", "method", ".", "parseStatements", "(", "this", ",", "unit", ")", ";", "}", "}", "}", "TypeDeclaration", "[", "]", "memberTypes", "=", "type", ".", "memberTypes", ";", "if", "(", "memberTypes", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "memberTypes", ".", "length", ";", "i", "++", ")", "{", "TypeDeclaration", "memberType", "=", "memberTypes", "[", "i", "]", ";", "this", ".", "parseBodies", "(", "memberType", ",", "unit", ")", ";", "memberType", ".", "traverse", "(", "this", ".", "localDeclarationVisitor", ",", "(", "ClassScope", ")", "null", ")", ";", "}", "}", "}", "}", "</s>" ]
2,548
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "public", "class", "SuperTypeReferenceLocator", "extends", "PatternLocator", "{", "protected", "SuperTypeReferencePattern", "pattern", ";", "public", "SuperTypeReferenceLocator", "(", "SuperTypeReferencePattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "}", "public", "int", "match", "(", "TypeReference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "this", ".", "flavors", "!=", "SUPERTYPE_REF_FLAVOR", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "superSimpleName", "==", "null", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "char", "[", "]", "typeRefSimpleName", "=", "null", ";", "if", "(", "node", "instanceof", "SingleTypeReference", ")", "{", "typeRefSimpleName", "=", "(", "(", "SingleTypeReference", ")", "node", ")", ".", "token", ";", "}", "else", "{", "char", "[", "]", "[", "]", "tokens", "=", "(", "(", "QualifiedTypeReference", ")", "node", ")", ".", "tokens", ";", "typeRefSimpleName", "=", "tokens", "[", "tokens", ".", "length", "-", "1", "]", ";", "}", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "superSimpleName", ",", "typeRefSimpleName", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "return", "CLASS_CONTAINER", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "elementBinding", "instanceof", "ReferenceBinding", ")", "{", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "elementBinding", ";", "if", "(", "referenceBinding", ".", "isClass", "(", ")", "&&", "this", ".", "pattern", ".", "typeSuffix", "==", "IIndexConstants", ".", "INTERFACE_SUFFIX", ")", "{", "return", ";", "}", "if", "(", "referenceBinding", ".", "isInterface", "(", ")", "&&", "this", ".", "pattern", ".", "typeSuffix", "==", "IIndexConstants", ".", "CLASS_SUFFIX", ")", "{", "return", ";", "}", "}", "super", ".", "matchReportReference", "(", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "IJavaElement", ".", "TYPE", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "node", ")", "{", "if", "(", "!", "(", "node", "instanceof", "TypeReference", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "TypeReference", "typeRef", "=", "(", "TypeReference", ")", "node", ";", "TypeBinding", "typeBinding", "=", "typeRef", ".", "resolvedType", ";", "if", "(", "typeBinding", "instanceof", "ArrayBinding", ")", "typeBinding", "=", "(", "(", "ArrayBinding", ")", "typeBinding", ")", ".", "leafComponentType", ";", "if", "(", "typeBinding", "instanceof", "ProblemReferenceBinding", ")", "typeBinding", "=", "(", "(", "ProblemReferenceBinding", ")", "typeBinding", ")", ".", "closestMatch", "(", ")", ";", "if", "(", "typeBinding", "==", "null", "||", "!", "typeBinding", ".", "isValidBinding", "(", ")", ")", "return", "INACCURATE_MATCH", ";", "return", "resolveLevelForType", "(", "this", ".", "pattern", ".", "superSimpleName", ",", "this", ".", "pattern", ".", "superQualification", ",", "typeBinding", ")", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "!", "(", "binding", "instanceof", "ReferenceBinding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "ReferenceBinding", "type", "=", "(", "ReferenceBinding", ")", "binding", ";", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "superRefKind", "!=", "SuperTypeReferencePattern", ".", "ONLY_SUPER_INTERFACES", ")", "{", "level", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "superSimpleName", ",", "this", ".", "pattern", ".", "superQualification", ",", "type", ".", "superclass", "(", ")", ")", ";", "if", "(", "level", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "}", "if", "(", "this", ".", "pattern", ".", "superRefKind", "!=", "SuperTypeReferencePattern", ".", "ONLY_SUPER_CLASSES", ")", "{", "ReferenceBinding", "[", "]", "superInterfaces", "=", "type", ".", "superInterfaces", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "superInterfaces", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "int", "newLevel", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "superSimpleName", ",", "this", ".", "pattern", ".", "superQualification", ",", "superInterfaces", "[", "i", "]", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "}", "return", "level", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,549
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "public", "class", "PackageDeclarationLocator", "extends", "PatternLocator", "{", "protected", "PackageDeclarationPattern", "pattern", ";", "public", "PackageDeclarationLocator", "(", "PackageDeclarationPattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "return", "0", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,550
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "LocalVariable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IndexQueryRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "LocalVariablePattern", "extends", "VariablePattern", "{", "LocalVariable", "localVariable", ";", "public", "LocalVariablePattern", "(", "LocalVariable", "localVariable", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "super", "(", "LOCAL_VAR_PATTERN", ",", "localVariable", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ",", "limitTo", ",", "matchRule", ")", ";", "this", ".", "localVariable", "=", "localVariable", ";", "}", "public", "void", "findIndexMatches", "(", "Index", "index", ",", "IndexQueryRequestor", "requestor", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IProgressMonitor", "progressMonitor", ")", "{", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "this", ".", "localVariable", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "String", "documentPath", ";", "String", "relativePath", ";", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "IType", "type", "=", "(", "IType", ")", "this", ".", "localVariable", ".", "getAncestor", "(", "IJavaElement", ".", "TYPE", ")", ";", "relativePath", "=", "(", "type", ".", "getFullyQualifiedName", "(", "'$'", ")", ")", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "SuffixConstants", ".", "SUFFIX_STRING_class", ";", "documentPath", "=", "root", ".", "getPath", "(", ")", "+", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", "+", "relativePath", ";", "}", "else", "{", "IPath", "path", "=", "this", ".", "localVariable", ".", "getPath", "(", ")", ";", "documentPath", "=", "path", ".", "toString", "(", ")", ";", "relativePath", "=", "Util", ".", "relativePath", "(", "path", ",", "1", ")", ";", "}", "if", "(", "scope", "instanceof", "JavaSearchScope", ")", "{", "JavaSearchScope", "javaSearchScope", "=", "(", "JavaSearchScope", ")", "scope", ";", "AccessRuleSet", "access", "=", "javaSearchScope", ".", "getAccessRuleSet", "(", "relativePath", ",", "index", ".", "containerPath", ")", ";", "if", "(", "access", "!=", "JavaSearchScope", ".", "NOT_ENCLOSED", ")", "{", "if", "(", "!", "requestor", ".", "acceptIndexMatch", "(", "documentPath", ",", "this", ",", "participant", ",", "access", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "}", "else", "if", "(", "scope", ".", "encloses", "(", "documentPath", ")", ")", "{", "if", "(", "!", "requestor", ".", "acceptIndexMatch", "(", "documentPath", ",", "this", ",", "participant", ",", "null", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "if", "(", "this", ".", "findDeclarations", ")", "{", "output", ".", "append", "(", "this", ".", "findReferences", "?", "\"\"", ":", "\"\"", ")", ";", "}", "else", "{", "output", ".", "append", "(", "\"\"", ")", ";", "}", "output", ".", "append", "(", "this", ".", "localVariable", ".", "toStringWithAncestors", "(", ")", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,551
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "BindingKey", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ExtraFlags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "EntryResult", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "ConstructorPattern", "extends", "JavaSearchPattern", "{", "protected", "boolean", "findDeclarations", "=", "true", ";", "protected", "boolean", "findReferences", "=", "true", ";", "public", "char", "[", "]", "declaringQualification", ";", "public", "char", "[", "]", "declaringSimpleName", ";", "public", "char", "[", "]", "[", "]", "parameterQualifications", ";", "public", "char", "[", "]", "[", "]", "parameterSimpleNames", ";", "public", "int", "parameterCount", ";", "public", "boolean", "varargs", "=", "false", ";", "char", "[", "]", "[", "]", "[", "]", "parametersTypeSignatures", ";", "char", "[", "]", "[", "]", "[", "]", "[", "]", "parametersTypeArguments", ";", "boolean", "constructorParameters", "=", "false", ";", "char", "[", "]", "[", "]", "constructorArguments", ";", "protected", "static", "char", "[", "]", "[", "]", "REF_CATEGORIES", "=", "{", "CONSTRUCTOR_REF", "}", ";", "protected", "static", "char", "[", "]", "[", "]", "REF_AND_DECL_CATEGORIES", "=", "{", "CONSTRUCTOR_REF", ",", "CONSTRUCTOR_DECL", "}", ";", "protected", "static", "char", "[", "]", "[", "]", "DECL_CATEGORIES", "=", "{", "CONSTRUCTOR_DECL", "}", ";", "public", "final", "static", "int", "FINE_GRAIN_MASK", "=", "IJavaSearchConstants", ".", "SUPER_REFERENCE", "|", "IJavaSearchConstants", ".", "QUALIFIED_REFERENCE", "|", "IJavaSearchConstants", ".", "THIS_REFERENCE", "|", "IJavaSearchConstants", ".", "IMPLICIT_THIS_REFERENCE", ";", "public", "static", "char", "[", "]", "createDeclarationIndexKey", "(", "char", "[", "]", "typeName", ",", "int", "argCount", ",", "char", "[", "]", "signature", ",", "char", "[", "]", "[", "]", "parameterTypes", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "int", "typeModifiers", ",", "int", "extraFlags", ")", "{", "char", "[", "]", "countChars", ";", "char", "[", "]", "parameterTypesChars", "=", "null", ";", "char", "[", "]", "parameterNamesChars", "=", "null", ";", "if", "(", "argCount", "<", "0", ")", "{", "countChars", "=", "DEFAULT_CONSTRUCTOR", ";", "}", "else", "{", "countChars", "=", "argCount", "<", "10", "?", "COUNTS", "[", "argCount", "]", ":", "(", "\"/\"", "+", "String", ".", "valueOf", "(", "argCount", ")", ")", ".", "toCharArray", "(", ")", ";", "if", "(", "argCount", ">", "0", ")", "{", "if", "(", "signature", "==", "null", ")", "{", "if", "(", "parameterTypes", "!=", "null", "&&", "parameterTypes", ".", "length", "==", "argCount", ")", "{", "char", "[", "]", "[", "]", "parameterTypeErasures", "=", "new", "char", "[", "argCount", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameterTypes", ".", "length", ";", "i", "++", ")", "{", "parameterTypeErasures", "[", "i", "]", "=", "getTypeErasure", "(", "parameterTypes", "[", "i", "]", ")", ";", "}", "parameterTypesChars", "=", "CharOperation", ".", "concatWith", "(", "parameterTypeErasures", ",", "PARAMETER_SEPARATOR", ")", ";", "}", "}", "else", "{", "extraFlags", "|=", "ExtraFlags", ".", "ParameterTypesStoredAsSignature", ";", "}", "if", "(", "parameterNames", "!=", "null", "&&", "parameterNames", ".", "length", "==", "argCount", ")", "{", "parameterNamesChars", "=", "CharOperation", ".", "concatWith", "(", "parameterNames", ",", "PARAMETER_SEPARATOR", ")", ";", "}", "}", "}", "boolean", "isMemberType", "=", "(", "extraFlags", "&", "ExtraFlags", ".", "IsMemberType", ")", "!=", "0", ";", "int", "typeNameLength", "=", "typeName", "==", "null", "?", "0", ":", "typeName", ".", "length", ";", "int", "packageNameLength", "=", "packageName", "==", "null", "?", "0", ":", "packageName", ".", "length", ";", "int", "countCharsLength", "=", "countChars", ".", "length", ";", "int", "parameterTypesLength", "=", "signature", "==", "null", "?", "(", "parameterTypesChars", "==", "null", "?", "0", ":", "parameterTypesChars", ".", "length", ")", ":", "signature", ".", "length", ";", "int", "parameterNamesLength", "=", "parameterNamesChars", "==", "null", "?", "0", ":", "parameterNamesChars", ".", "length", ";", "int", "resultLength", "=", "typeNameLength", "+", "countCharsLength", "+", "3", ";", "if", "(", "!", "isMemberType", ")", "{", "resultLength", "+=", "packageNameLength", "+", "1", ";", "if", "(", "argCount", ">=", "0", ")", "{", "resultLength", "+=", "3", ";", "}", "if", "(", "argCount", ">", "0", ")", "{", "resultLength", "+=", "parameterTypesLength", "+", "parameterNamesLength", "+", "2", ";", "}", "}", "char", "[", "]", "result", "=", "new", "char", "[", "resultLength", "]", ";", "int", "pos", "=", "0", ";", "if", "(", "typeNameLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "typeName", ",", "0", ",", "result", ",", "pos", ",", "typeNameLength", ")", ";", "pos", "+=", "typeNameLength", ";", "}", "if", "(", "countCharsLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "countChars", ",", "0", ",", "result", ",", "pos", ",", "countCharsLength", ")", ";", "pos", "+=", "countCharsLength", ";", "}", "int", "typeModifiersWithExtraFlags", "=", "typeModifiers", "|", "encodeExtraFlags", "(", "extraFlags", ")", ";", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "result", "[", "pos", "++", "]", "=", "(", "char", ")", "typeModifiersWithExtraFlags", ";", "result", "[", "pos", "++", "]", "=", "(", "char", ")", "(", "typeModifiersWithExtraFlags", ">>", "16", ")", ";", "if", "(", "!", "isMemberType", ")", "{", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "packageNameLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "packageName", ",", "0", ",", "result", ",", "pos", ",", "packageNameLength", ")", ";", "pos", "+=", "packageNameLength", ";", "}", "if", "(", "argCount", "==", "0", ")", "{", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "result", "[", "pos", "++", "]", "=", "(", "char", ")", "modifiers", ";", "result", "[", "pos", "++", "]", "=", "(", "char", ")", "(", "modifiers", ">>", "16", ")", ";", "}", "else", "if", "(", "argCount", ">", "0", ")", "{", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "parameterTypesLength", ">", "0", ")", "{", "if", "(", "signature", "==", "null", ")", "{", "System", ".", "arraycopy", "(", "parameterTypesChars", ",", "0", ",", "result", ",", "pos", ",", "parameterTypesLength", ")", ";", "}", "else", "{", "System", ".", "arraycopy", "(", "CharOperation", ".", "replaceOnCopy", "(", "signature", ",", "SEPARATOR", ",", "'\\\\'", ")", ",", "0", ",", "result", ",", "pos", ",", "parameterTypesLength", ")", ";", "}", "pos", "+=", "parameterTypesLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "parameterNamesLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "parameterNamesChars", ",", "0", ",", "result", ",", "pos", ",", "parameterNamesLength", ")", ";", "pos", "+=", "parameterNamesLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "result", "[", "pos", "++", "]", "=", "(", "char", ")", "modifiers", ";", "result", "[", "pos", "++", "]", "=", "(", "char", ")", "(", "modifiers", ">>", "16", ")", ";", "}", "}", "return", "result", ";", "}", "public", "static", "char", "[", "]", "createDefaultDeclarationIndexKey", "(", "char", "[", "]", "typeName", ",", "char", "[", "]", "packageName", ",", "int", "typeModifiers", ",", "int", "extraFlags", ")", "{", "return", "createDeclarationIndexKey", "(", "typeName", ",", "-", "1", ",", "null", ",", "null", ",", "null", ",", "0", ",", "packageName", ",", "typeModifiers", ",", "extraFlags", ")", ";", "}", "public", "static", "char", "[", "]", "createIndexKey", "(", "char", "[", "]", "typeName", ",", "int", "argCount", ")", "{", "char", "[", "]", "countChars", "=", "argCount", "<", "10", "?", "COUNTS", "[", "argCount", "]", ":", "(", "\"/\"", "+", "String", ".", "valueOf", "(", "argCount", ")", ")", ".", "toCharArray", "(", ")", ";", "return", "CharOperation", ".", "concat", "(", "typeName", ",", "countChars", ")", ";", "}", "static", "int", "decodeExtraFlags", "(", "int", "modifiersWithExtraFlags", ")", "{", "int", "extraFlags", "=", "0", ";", "if", "(", "(", "modifiersWithExtraFlags", "&", "ASTNode", ".", "Bit28", ")", "!=", "0", ")", "{", "extraFlags", "|=", "ExtraFlags", ".", "ParameterTypesStoredAsSignature", ";", "}", "if", "(", "(", "modifiersWithExtraFlags", "&", "ASTNode", ".", "Bit29", ")", "!=", "0", ")", "{", "extraFlags", "|=", "ExtraFlags", ".", "IsLocalType", ";", "}", "if", "(", "(", "modifiersWithExtraFlags", "&", "ASTNode", ".", "Bit30", ")", "!=", "0", ")", "{", "extraFlags", "|=", "ExtraFlags", ".", "IsMemberType", ";", "}", "if", "(", "(", "modifiersWithExtraFlags", "&", "ASTNode", ".", "Bit31", ")", "!=", "0", ")", "{", "extraFlags", "|=", "ExtraFlags", ".", "HasNonPrivateStaticMemberTypes", ";", "}", "return", "extraFlags", ";", "}", "static", "int", "decodeModifers", "(", "int", "modifiersWithExtraFlags", ")", "{", "return", "modifiersWithExtraFlags", "&", "~", "(", "ASTNode", ".", "Bit31", "|", "ASTNode", ".", "Bit30", "|", "ASTNode", ".", "Bit29", "|", "ASTNode", ".", "Bit28", ")", ";", "}", "private", "static", "int", "encodeExtraFlags", "(", "int", "extraFlags", ")", "{", "int", "encodedExtraFlags", "=", "0", ";", "if", "(", "(", "extraFlags", "&", "ExtraFlags", ".", "ParameterTypesStoredAsSignature", ")", "!=", "0", ")", "{", "encodedExtraFlags", "|=", "ASTNode", ".", "Bit28", ";", "}", "if", "(", "(", "extraFlags", "&", "ExtraFlags", ".", "IsLocalType", ")", "!=", "0", ")", "{", "encodedExtraFlags", "|=", "ASTNode", ".", "Bit29", ";", "}", "if", "(", "(", "extraFlags", "&", "ExtraFlags", ".", "IsMemberType", ")", "!=", "0", ")", "{", "encodedExtraFlags", "|=", "ASTNode", ".", "Bit30", ";", "}", "if", "(", "(", "extraFlags", "&", "ExtraFlags", ".", "HasNonPrivateStaticMemberTypes", ")", "!=", "0", ")", "{", "encodedExtraFlags", "|=", "ASTNode", ".", "Bit31", ";", "}", "return", "encodedExtraFlags", ";", "}", "private", "static", "char", "[", "]", "getTypeErasure", "(", "char", "[", "]", "typeName", ")", "{", "int", "index", ";", "if", "(", "(", "index", "=", "CharOperation", ".", "indexOf", "(", "'<'", ",", "typeName", ")", ")", "==", "-", "1", ")", "return", "typeName", ";", "int", "length", "=", "typeName", ".", "length", ";", "char", "[", "]", "typeErasurename", "=", "new", "char", "[", "length", "-", "2", "]", ";", "System", ".", "arraycopy", "(", "typeName", ",", "0", ",", "typeErasurename", ",", "0", ",", "index", ")", ";", "int", "depth", "=", "1", ";", "for", "(", "int", "i", "=", "index", "+", "1", ";", "i", "<", "length", ";", "i", "++", ")", "{", "switch", "(", "typeName", "[", "i", "]", ")", "{", "case", "'<'", ":", "depth", "++", ";", "break", ";", "case", "'>'", ":", "depth", "--", ";", "break", ";", "default", ":", "if", "(", "depth", "==", "0", ")", "{", "typeErasurename", "[", "index", "++", "]", "=", "typeName", "[", "i", "]", ";", "}", "break", ";", "}", "}", "System", ".", "arraycopy", "(", "typeErasurename", ",", "0", ",", "typeErasurename", "=", "new", "char", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "typeErasurename", ";", "}", "ConstructorPattern", "(", "int", "matchRule", ")", "{", "super", "(", "CONSTRUCTOR_PATTERN", ",", "matchRule", ")", ";", "}", "public", "ConstructorPattern", "(", "char", "[", "]", "declaringSimpleName", ",", "char", "[", "]", "declaringQualification", ",", "char", "[", "]", "[", "]", "parameterQualifications", ",", "char", "[", "]", "[", "]", "parameterSimpleNames", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "this", ".", "fineGrain", "=", "limitTo", "&", "FINE_GRAIN_MASK", ";", "if", "(", "this", ".", "fineGrain", "==", "0", ")", "{", "switch", "(", "limitTo", ")", "{", "case", "IJavaSearchConstants", ".", "DECLARATIONS", ":", "this", ".", "findReferences", "=", "false", ";", "break", ";", "case", "IJavaSearchConstants", ".", "REFERENCES", ":", "this", ".", "findDeclarations", "=", "false", ";", "break", ";", "case", "IJavaSearchConstants", ".", "ALL_OCCURRENCES", ":", "break", ";", "}", "}", "else", "{", "this", ".", "findDeclarations", "=", "false", ";", "}", "this", ".", "declaringQualification", "=", "this", ".", "isCaseSensitive", "?", "declaringQualification", ":", "CharOperation", ".", "toLowerCase", "(", "declaringQualification", ")", ";", "this", ".", "declaringSimpleName", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "declaringSimpleName", ":", "CharOperation", ".", "toLowerCase", "(", "declaringSimpleName", ")", ";", "if", "(", "parameterSimpleNames", "!=", "null", ")", "{", "this", ".", "parameterCount", "=", "parameterSimpleNames", ".", "length", ";", "boolean", "synthetic", "=", "this", ".", "parameterCount", ">", "0", "&&", "declaringQualification", "!=", "null", "&&", "CharOperation", ".", "equals", "(", "CharOperation", ".", "concat", "(", "parameterQualifications", "[", "0", "]", ",", "parameterSimpleNames", "[", "0", "]", ",", "'.'", ")", ",", "declaringQualification", ")", ";", "int", "offset", "=", "0", ";", "if", "(", "synthetic", ")", "{", "this", ".", "parameterCount", "--", ";", "offset", "++", ";", "}", "this", ".", "parameterQualifications", "=", "new", "char", "[", "this", ".", "parameterCount", "]", "[", "]", ";", "this", ".", "parameterSimpleNames", "=", "new", "char", "[", "this", ".", "parameterCount", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "parameterCount", ";", "i", "++", ")", "{", "this", ".", "parameterQualifications", "[", "i", "]", "=", "this", ".", "isCaseSensitive", "?", "parameterQualifications", "[", "i", "+", "offset", "]", ":", "CharOperation", ".", "toLowerCase", "(", "parameterQualifications", "[", "i", "+", "offset", "]", ")", ";", "this", ".", "parameterSimpleNames", "[", "i", "]", "=", "this", ".", "isCaseSensitive", "?", "parameterSimpleNames", "[", "i", "+", "offset", "]", ":", "CharOperation", ".", "toLowerCase", "(", "parameterSimpleNames", "[", "i", "+", "offset", "]", ")", ";", "}", "}", "else", "{", "this", ".", "parameterCount", "=", "-", "1", ";", "}", "this", ".", "mustResolve", "=", "mustResolve", "(", ")", ";", "}", "public", "ConstructorPattern", "(", "char", "[", "]", "declaringSimpleName", ",", "char", "[", "]", "declaringQualification", ",", "char", "[", "]", "[", "]", "parameterQualifications", ",", "char", "[", "]", "[", "]", "parameterSimpleNames", ",", "String", "[", "]", "parameterSignatures", ",", "IMethod", "method", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "this", "(", "declaringSimpleName", ",", "declaringQualification", ",", "parameterQualifications", ",", "parameterSimpleNames", ",", "limitTo", ",", "matchRule", ")", ";", "try", "{", "this", ".", "varargs", "=", "(", "method", ".", "getFlags", "(", ")", "&", "Flags", ".", "AccVarargs", ")", "!=", "0", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "String", "genericDeclaringTypeSignature", "=", "null", ";", "if", "(", "method", ".", "isResolved", "(", ")", ")", "{", "String", "key", "=", "method", ".", "getKey", "(", ")", ";", "BindingKey", "bindingKey", "=", "new", "BindingKey", "(", "key", ")", ";", "if", "(", "bindingKey", ".", "isParameterizedType", "(", ")", ")", "{", "genericDeclaringTypeSignature", "=", "Util", ".", "getDeclaringTypeSignature", "(", "key", ")", ";", "if", "(", "genericDeclaringTypeSignature", "!=", "null", ")", "{", "this", ".", "typeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "genericDeclaringTypeSignature", ")", ";", "setTypeArguments", "(", "Util", ".", "getAllTypeArguments", "(", "this", ".", "typeSignatures", ")", ")", ";", "}", "}", "}", "else", "{", "this", ".", "constructorParameters", "=", "true", ";", "storeTypeSignaturesAndArguments", "(", "method", ".", "getDeclaringType", "(", ")", ")", ";", "}", "if", "(", "parameterSignatures", "!=", "null", ")", "{", "int", "length", "=", "parameterSignatures", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "this", ".", "parametersTypeSignatures", "=", "new", "char", "[", "length", "]", "[", "]", "[", "]", ";", "this", ".", "parametersTypeArguments", "=", "new", "char", "[", "length", "]", "[", "]", "[", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "parametersTypeSignatures", "[", "i", "]", "=", "Util", ".", "splitTypeLevelsSignature", "(", "parameterSignatures", "[", "i", "]", ")", ";", "this", ".", "parametersTypeArguments", "[", "i", "]", "=", "Util", ".", "getAllTypeArguments", "(", "this", ".", "parametersTypeSignatures", "[", "i", "]", ")", ";", "}", "}", "}", "this", ".", "constructorArguments", "=", "extractMethodArguments", "(", "method", ")", ";", "if", "(", "hasConstructorArguments", "(", ")", ")", "this", ".", "mustResolve", "=", "true", ";", "}", "public", "ConstructorPattern", "(", "char", "[", "]", "declaringSimpleName", ",", "char", "[", "]", "declaringQualification", ",", "String", "declaringSignature", ",", "char", "[", "]", "[", "]", "parameterQualifications", ",", "char", "[", "]", "[", "]", "parameterSimpleNames", ",", "String", "[", "]", "parameterSignatures", ",", "char", "[", "]", "[", "]", "arguments", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "this", "(", "declaringSimpleName", ",", "declaringQualification", ",", "parameterQualifications", ",", "parameterSimpleNames", ",", "limitTo", ",", "matchRule", ")", ";", "if", "(", "declaringSignature", "!=", "null", ")", "{", "this", ".", "typeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "declaringSignature", ")", ";", "setTypeArguments", "(", "Util", ".", "getAllTypeArguments", "(", "this", ".", "typeSignatures", ")", ")", ";", "}", "if", "(", "parameterSignatures", "!=", "null", ")", "{", "int", "length", "=", "parameterSignatures", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "this", ".", "parametersTypeSignatures", "=", "new", "char", "[", "length", "]", "[", "]", "[", "]", ";", "this", ".", "parametersTypeArguments", "=", "new", "char", "[", "length", "]", "[", "]", "[", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "parametersTypeSignatures", "[", "i", "]", "=", "Util", ".", "splitTypeLevelsSignature", "(", "parameterSignatures", "[", "i", "]", ")", ";", "this", ".", "parametersTypeArguments", "[", "i", "]", "=", "Util", ".", "getAllTypeArguments", "(", "this", ".", "parametersTypeSignatures", "[", "i", "]", ")", ";", "}", "}", "}", "this", ".", "constructorArguments", "=", "arguments", ";", "if", "(", "arguments", "==", "null", "||", "arguments", ".", "length", "==", "0", ")", "{", "if", "(", "getTypeArguments", "(", ")", "!=", "null", "&&", "getTypeArguments", "(", ")", ".", "length", ">", "0", ")", "{", "this", ".", "constructorArguments", "=", "getTypeArguments", "(", ")", "[", "0", "]", ";", "}", "}", "if", "(", "hasConstructorArguments", "(", ")", ")", "this", ".", "mustResolve", "=", "true", ";", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "int", "last", "=", "key", ".", "length", "-", "1", ";", "int", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "0", ")", ";", "this", ".", "declaringSimpleName", "=", "CharOperation", ".", "subarray", "(", "key", ",", "0", ",", "slash", ")", ";", "int", "start", "=", "slash", "+", "1", ";", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "if", "(", "slash", "!=", "-", "1", ")", "{", "last", "=", "slash", "-", "1", ";", "}", "boolean", "isDefaultConstructor", "=", "key", "[", "last", "]", "==", "'#'", ";", "if", "(", "isDefaultConstructor", ")", "{", "this", ".", "parameterCount", "=", "-", "1", ";", "}", "else", "{", "this", ".", "parameterCount", "=", "0", ";", "int", "power", "=", "1", ";", "for", "(", "int", "i", "=", "last", ";", "i", ">=", "start", ";", "i", "--", ")", "{", "if", "(", "i", "==", "last", ")", "{", "this", ".", "parameterCount", "=", "key", "[", "i", "]", "-", "'0'", ";", "}", "else", "{", "power", "*=", "10", ";", "this", ".", "parameterCount", "+=", "power", "*", "(", "key", "[", "i", "]", "-", "'0'", ")", ";", "}", "}", "}", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "ConstructorPattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "if", "(", "this", ".", "findReferences", ")", "return", "this", ".", "findDeclarations", "?", "REF_AND_DECL_CATEGORIES", ":", "REF_CATEGORIES", ";", "if", "(", "this", ".", "findDeclarations", ")", "return", "DECL_CATEGORIES", ";", "return", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "boolean", "hasConstructorArguments", "(", ")", "{", "return", "this", ".", "constructorArguments", "!=", "null", "&&", "this", ".", "constructorArguments", ".", "length", ">", "0", ";", "}", "boolean", "hasConstructorParameters", "(", ")", "{", "return", "this", ".", "constructorParameters", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "ConstructorPattern", "pattern", "=", "(", "ConstructorPattern", ")", "decodedPattern", ";", "return", "pattern", ".", "parameterCount", "!=", "-", "1", "&&", "(", "this", ".", "parameterCount", "==", "pattern", ".", "parameterCount", "||", "this", ".", "parameterCount", "==", "-", "1", "||", "this", ".", "varargs", ")", "&&", "matchesName", "(", "this", ".", "declaringSimpleName", ",", "pattern", ".", "declaringSimpleName", ")", ";", "}", "protected", "boolean", "mustResolve", "(", ")", "{", "if", "(", "this", ".", "declaringQualification", "!=", "null", ")", "return", "true", ";", "if", "(", "this", ".", "parameterSimpleNames", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "parameterSimpleNames", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "if", "(", "this", ".", "parameterQualifications", "[", "i", "]", "!=", "null", ")", "return", "true", ";", "return", "this", ".", "findReferences", ";", "}", "public", "EntryResult", "[", "]", "queryIn", "(", "Index", "index", ")", "throws", "IOException", "{", "char", "[", "]", "key", "=", "this", ".", "declaringSimpleName", ";", "int", "matchRule", "=", "getMatchRule", "(", ")", ";", "switch", "(", "getMatchMode", "(", ")", ")", "{", "case", "R_EXACT_MATCH", ":", "if", "(", "this", ".", "declaringSimpleName", "!=", "null", "&&", "this", ".", "parameterCount", ">=", "0", "&&", "!", "this", ".", "varargs", ")", "{", "key", "=", "createIndexKey", "(", "this", ".", "declaringSimpleName", ",", "this", ".", "parameterCount", ")", ";", "}", "matchRule", "&=", "~", "R_EXACT_MATCH", ";", "matchRule", "|=", "R_PREFIX_MATCH", ";", "break", ";", "case", "R_PREFIX_MATCH", ":", "break", ";", "case", "R_PATTERN_MATCH", ":", "if", "(", "this", ".", "parameterCount", ">=", "0", "&&", "!", "this", ".", "varargs", ")", "{", "key", "=", "CharOperation", ".", "concat", "(", "createIndexKey", "(", "this", ".", "declaringSimpleName", "==", "null", "?", "ONE_STAR", ":", "this", ".", "declaringSimpleName", ",", "this", ".", "parameterCount", ")", ",", "ONE_STAR", ")", ";", "}", "else", "if", "(", "this", ".", "declaringSimpleName", "!=", "null", "&&", "this", ".", "declaringSimpleName", "[", "this", ".", "declaringSimpleName", ".", "length", "-", "1", "]", "!=", "'*'", ")", "{", "key", "=", "CharOperation", ".", "concat", "(", "this", ".", "declaringSimpleName", ",", "ONE_STAR", ",", "SEPARATOR", ")", ";", "}", "else", "if", "(", "key", "!=", "null", ")", "{", "key", "=", "CharOperation", ".", "concat", "(", "key", ",", "ONE_STAR", ")", ";", "}", "break", ";", "case", "R_REGEXP_MATCH", ":", "break", ";", "case", "R_CAMELCASE_MATCH", ":", "case", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "break", ";", "}", "return", "index", ".", "query", "(", "getIndexCategories", "(", ")", ",", "key", ",", "matchRule", ")", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "if", "(", "this", ".", "findDeclarations", ")", "{", "output", ".", "append", "(", "this", ".", "findReferences", "?", "\"\"", ":", "\"\"", ")", ";", "}", "else", "{", "output", ".", "append", "(", "\"\"", ")", ";", "}", "if", "(", "this", ".", "declaringQualification", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "declaringQualification", ")", ".", "append", "(", "'.'", ")", ";", "if", "(", "this", ".", "declaringSimpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "declaringSimpleName", ")", ";", "else", "if", "(", "this", ".", "declaringQualification", "!=", "null", ")", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "'('", ")", ";", "if", "(", "this", ".", "parameterSimpleNames", "==", "null", ")", "{", "output", ".", "append", "(", "\"...\"", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "parameterSimpleNames", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "output", ".", "append", "(", "\",", "\"", ")", ";", "if", "(", "this", ".", "parameterQualifications", "[", "i", "]", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "parameterQualifications", "[", "i", "]", ")", ".", "append", "(", "'.'", ")", ";", "if", "(", "this", ".", "parameterSimpleNames", "[", "i", "]", "==", "null", ")", "output", ".", "append", "(", "'*'", ")", ";", "else", "output", ".", "append", "(", "this", ".", "parameterSimpleNames", "[", "i", "]", ")", ";", "}", "}", "output", ".", "append", "(", "')'", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,552
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "TypeReferencePattern", "extends", "IntersectingPattern", "{", "protected", "char", "[", "]", "qualification", ";", "protected", "char", "[", "]", "simpleName", ";", "protected", "char", "[", "]", "currentCategory", ";", "public", "int", "segmentsSize", ";", "protected", "char", "[", "]", "[", "]", "segments", ";", "protected", "int", "currentSegment", ";", "private", "final", "static", "char", "[", "]", "[", "]", "CATEGORIES", "=", "{", "REF", ",", "ANNOTATION_REF", "}", ",", "CATEGORIES_ANNOT_REF", "=", "{", "ANNOTATION_REF", "}", ";", "private", "char", "[", "]", "[", "]", "categories", ";", "char", "typeSuffix", "=", "TYPE_SUFFIX", ";", "public", "TypeReferencePattern", "(", "char", "[", "]", "qualification", ",", "char", "[", "]", "simpleName", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "this", ".", "qualification", "=", "this", ".", "isCaseSensitive", "?", "qualification", ":", "CharOperation", ".", "toLowerCase", "(", "qualification", ")", ";", "this", ".", "simpleName", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "simpleName", ":", "CharOperation", ".", "toLowerCase", "(", "simpleName", ")", ";", "if", "(", "simpleName", "==", "null", ")", "this", ".", "segments", "=", "this", ".", "qualification", "==", "null", "?", "ONE_STAR_CHAR", ":", "CharOperation", ".", "splitOn", "(", "'.'", ",", "this", ".", "qualification", ")", ";", "else", "this", ".", "segments", "=", "null", ";", "if", "(", "this", ".", "segments", "==", "null", ")", "if", "(", "this", ".", "qualification", "==", "null", ")", "this", ".", "segmentsSize", "=", "0", ";", "else", "this", ".", "segmentsSize", "=", "CharOperation", ".", "occurencesOf", "(", "'.'", ",", "this", ".", "qualification", ")", "+", "1", ";", "else", "this", ".", "segmentsSize", "=", "this", ".", "segments", ".", "length", ";", "this", ".", "mustResolve", "=", "true", ";", "}", "public", "TypeReferencePattern", "(", "char", "[", "]", "qualification", ",", "char", "[", "]", "simpleName", ",", "String", "typeSignature", ",", "int", "matchRule", ")", "{", "this", "(", "qualification", ",", "simpleName", ",", "typeSignature", ",", "0", ",", "TYPE_SUFFIX", ",", "matchRule", ")", ";", "}", "public", "TypeReferencePattern", "(", "char", "[", "]", "qualification", ",", "char", "[", "]", "simpleName", ",", "String", "typeSignature", ",", "char", "typeSuffix", ",", "int", "matchRule", ")", "{", "this", "(", "qualification", ",", "simpleName", ",", "typeSignature", ",", "0", ",", "typeSuffix", ",", "matchRule", ")", ";", "}", "public", "TypeReferencePattern", "(", "char", "[", "]", "qualification", ",", "char", "[", "]", "simpleName", ",", "String", "typeSignature", ",", "int", "limitTo", ",", "char", "typeSuffix", ",", "int", "matchRule", ")", "{", "this", "(", "qualification", ",", "simpleName", ",", "matchRule", ")", ";", "this", ".", "typeSuffix", "=", "typeSuffix", ";", "if", "(", "typeSignature", "!=", "null", ")", "{", "this", ".", "typeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "typeSignature", ")", ";", "setTypeArguments", "(", "Util", ".", "getAllTypeArguments", "(", "this", ".", "typeSignatures", ")", ")", ";", "if", "(", "hasTypeArguments", "(", ")", ")", "{", "this", ".", "segmentsSize", "=", "getTypeArguments", "(", ")", ".", "length", "+", "CharOperation", ".", "occurencesOf", "(", "'/'", ",", "this", ".", "typeSignatures", "[", "0", "]", ")", "-", "1", ";", "}", "}", "this", ".", "fineGrain", "=", "limitTo", "&", "0xFFFFFFF0", ";", "if", "(", "this", ".", "fineGrain", "==", "IJavaSearchConstants", ".", "ANNOTATION_TYPE_REFERENCE", ")", "{", "this", ".", "categories", "=", "CATEGORIES_ANNOT_REF", ";", "}", "}", "public", "TypeReferencePattern", "(", "char", "[", "]", "qualification", ",", "char", "[", "]", "simpleName", ",", "IType", "type", ",", "int", "matchRule", ")", "{", "this", "(", "qualification", ",", "simpleName", ",", "type", ",", "0", ",", "matchRule", ")", ";", "}", "public", "TypeReferencePattern", "(", "char", "[", "]", "qualification", ",", "char", "[", "]", "simpleName", ",", "IType", "type", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "this", "(", "qualification", ",", "simpleName", ",", "matchRule", ")", ";", "storeTypeSignaturesAndArguments", "(", "type", ")", ";", "this", ".", "fineGrain", "=", "limitTo", "&", "0xFFFFFFF0", ";", "}", "TypeReferencePattern", "(", "int", "matchRule", ")", "{", "super", "(", "TYPE_REF_PATTERN", ",", "matchRule", ")", ";", "this", ".", "categories", "=", "CATEGORIES", ";", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "this", ".", "simpleName", "=", "key", ";", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "TypeReferencePattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "getIndexKey", "(", ")", "{", "if", "(", "this", ".", "simpleName", "!=", "null", ")", "return", "this", ".", "simpleName", ";", "if", "(", "this", ".", "currentSegment", ">=", "0", ")", "return", "this", ".", "segments", "[", "this", ".", "currentSegment", "]", ";", "return", "null", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "return", "this", ".", "categories", ";", "}", "protected", "boolean", "hasNextQuery", "(", ")", "{", "if", "(", "this", ".", "segments", "==", "null", ")", "return", "false", ";", "return", "--", "this", ".", "currentSegment", ">=", "(", "this", ".", "segments", ".", "length", ">=", "4", "?", "2", ":", "0", ")", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "return", "true", ";", "}", "protected", "void", "resetQuery", "(", ")", "{", "if", "(", "this", ".", "segments", "!=", "null", ")", "this", ".", "currentSegment", "=", "this", ".", "segments", ".", "length", "-", "1", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "String", "patternClassName", "=", "getClass", "(", ")", ".", "getName", "(", ")", ";", "output", ".", "append", "(", "patternClassName", ".", "substring", "(", "patternClassName", ".", "lastIndexOf", "(", "'.'", ")", "+", "1", ")", ")", ";", "output", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "qualification", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "qualification", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\">,", "type<\"", ")", ";", "if", "(", "this", ".", "simpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "simpleName", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\">\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,553
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "FieldPattern", "extends", "VariablePattern", "{", "protected", "char", "[", "]", "declaringQualification", ";", "protected", "char", "[", "]", "declaringSimpleName", ";", "protected", "char", "[", "]", "typeQualification", ";", "protected", "char", "[", "]", "typeSimpleName", ";", "protected", "static", "char", "[", "]", "[", "]", "REF_CATEGORIES", "=", "{", "REF", "}", ";", "protected", "static", "char", "[", "]", "[", "]", "REF_AND_DECL_CATEGORIES", "=", "{", "REF", ",", "FIELD_DECL", "}", ";", "protected", "static", "char", "[", "]", "[", "]", "DECL_CATEGORIES", "=", "{", "FIELD_DECL", "}", ";", "public", "static", "char", "[", "]", "createIndexKey", "(", "char", "[", "]", "fieldName", ")", "{", "return", "fieldName", ";", "}", "public", "FieldPattern", "(", "char", "[", "]", "name", ",", "char", "[", "]", "declaringQualification", ",", "char", "[", "]", "declaringSimpleName", ",", "char", "[", "]", "typeQualification", ",", "char", "[", "]", "typeSimpleName", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "super", "(", "FIELD_PATTERN", ",", "name", ",", "limitTo", ",", "matchRule", ")", ";", "this", ".", "declaringQualification", "=", "this", ".", "isCaseSensitive", "?", "declaringQualification", ":", "CharOperation", ".", "toLowerCase", "(", "declaringQualification", ")", ";", "this", ".", "declaringSimpleName", "=", "this", ".", "isCaseSensitive", "?", "declaringSimpleName", ":", "CharOperation", ".", "toLowerCase", "(", "declaringSimpleName", ")", ";", "this", ".", "typeQualification", "=", "this", ".", "isCaseSensitive", "?", "typeQualification", ":", "CharOperation", ".", "toLowerCase", "(", "typeQualification", ")", ";", "this", ".", "typeSimpleName", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "typeSimpleName", ":", "CharOperation", ".", "toLowerCase", "(", "typeSimpleName", ")", ";", "this", ".", "mustResolve", "=", "mustResolve", "(", ")", ";", "}", "public", "FieldPattern", "(", "char", "[", "]", "name", ",", "char", "[", "]", "declaringQualification", ",", "char", "[", "]", "declaringSimpleName", ",", "char", "[", "]", "typeQualification", ",", "char", "[", "]", "typeSimpleName", ",", "String", "typeSignature", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "this", "(", "name", ",", "declaringQualification", ",", "declaringSimpleName", ",", "typeQualification", ",", "typeSimpleName", ",", "limitTo", ",", "matchRule", ")", ";", "if", "(", "typeSignature", "!=", "null", ")", "{", "this", ".", "typeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "typeSignature", ")", ";", "setTypeArguments", "(", "Util", ".", "getAllTypeArguments", "(", "this", ".", "typeSignatures", ")", ")", ";", "}", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "this", ".", "name", "=", "key", ";", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "FieldPattern", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "0", ",", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "getIndexKey", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "if", "(", "this", ".", "findReferences", "||", "this", ".", "fineGrain", "!=", "0", ")", "return", "this", ".", "findDeclarations", "||", "this", ".", "writeAccess", "?", "REF_AND_DECL_CATEGORIES", ":", "REF_CATEGORIES", ";", "if", "(", "this", ".", "findDeclarations", ")", "return", "DECL_CATEGORIES", ";", "return", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "return", "true", ";", "}", "protected", "boolean", "mustResolve", "(", ")", "{", "if", "(", "this", ".", "declaringSimpleName", "!=", "null", "||", "this", ".", "declaringQualification", "!=", "null", ")", "return", "true", ";", "if", "(", "this", ".", "typeSimpleName", "!=", "null", "||", "this", ".", "typeQualification", "!=", "null", ")", "return", "true", ";", "return", "super", ".", "mustResolve", "(", ")", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "if", "(", "this", ".", "findDeclarations", ")", "{", "output", ".", "append", "(", "this", ".", "findReferences", "?", "\"\"", ":", "\"\"", ")", ";", "}", "else", "{", "output", ".", "append", "(", "\"\"", ")", ";", "}", "if", "(", "this", ".", "declaringQualification", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "declaringQualification", ")", ".", "append", "(", "'.'", ")", ";", "if", "(", "this", ".", "declaringSimpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "declaringSimpleName", ")", ".", "append", "(", "'.'", ")", ";", "else", "if", "(", "this", ".", "declaringQualification", "!=", "null", ")", "output", ".", "append", "(", "\"*.\"", ")", ";", "if", "(", "this", ".", "name", "==", "null", ")", "{", "output", ".", "append", "(", "\"*\"", ")", ";", "}", "else", "{", "output", ".", "append", "(", "this", ".", "name", ")", ";", "}", "if", "(", "this", ".", "typeQualification", "!=", "null", ")", "output", ".", "append", "(", "\"", "-->", "\"", ")", ".", "append", "(", "this", ".", "typeQualification", ")", ".", "append", "(", "'.'", ")", ";", "else", "if", "(", "this", ".", "typeSimpleName", "!=", "null", ")", "output", ".", "append", "(", "\"", "-->", "\"", ")", ";", "if", "(", "this", ".", "typeSimpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "typeSimpleName", ")", ";", "else", "if", "(", "this", ".", "typeQualification", "!=", "null", ")", "output", ".", "append", "(", "\"*\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,554
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "BasicSearchEngine", ";", "public", "class", "MethodLocator", "extends", "PatternLocator", "{", "protected", "MethodPattern", "pattern", ";", "protected", "boolean", "isDeclarationOfReferencedMethodsPattern", ";", "public", "char", "[", "]", "[", "]", "[", "]", "allSuperDeclaringTypeNames", ";", "private", "char", "[", "]", "[", "]", "[", "]", "samePkgSuperDeclaringTypeNames", ";", "private", "MatchLocator", "matchLocator", ";", "private", "HashMap", "methodDeclarationsWithInvalidParam", "=", "new", "HashMap", "(", ")", ";", "public", "MethodLocator", "(", "MethodPattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "this", ".", "isDeclarationOfReferencedMethodsPattern", "=", "this", ".", "pattern", "instanceof", "DeclarationOfReferencedMethodsPattern", ";", "}", "protected", "void", "clear", "(", ")", "{", "this", ".", "methodDeclarationsWithInvalidParam", "=", "new", "HashMap", "(", ")", ";", "}", "protected", "int", "fineGrain", "(", ")", "{", "return", "this", ".", "pattern", ".", "fineGrain", ";", "}", "private", "ReferenceBinding", "getMatchingSuper", "(", "ReferenceBinding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "null", ";", "ReferenceBinding", "superBinding", "=", "binding", ".", "superclass", "(", ")", ";", "int", "level", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "superBinding", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "return", "superBinding", ";", "if", "(", "!", "binding", ".", "isInterface", "(", ")", "&&", "!", "CharOperation", ".", "equals", "(", "binding", ".", "compoundName", ",", "TypeConstants", ".", "JAVA_LANG_OBJECT", ")", ")", "{", "superBinding", "=", "getMatchingSuper", "(", "superBinding", ")", ";", "if", "(", "superBinding", "!=", "null", ")", "return", "superBinding", ";", "}", "ReferenceBinding", "[", "]", "interfaces", "=", "binding", ".", "superInterfaces", "(", ")", ";", "if", "(", "interfaces", "==", "null", ")", "return", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "interfaces", ".", "length", ";", "i", "++", ")", "{", "level", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "interfaces", "[", "i", "]", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "return", "interfaces", "[", "i", "]", ";", "superBinding", "=", "getMatchingSuper", "(", "interfaces", "[", "i", "]", ")", ";", "if", "(", "superBinding", "!=", "null", ")", "return", "superBinding", ";", "}", "return", "null", ";", "}", "private", "MethodBinding", "getMethodBinding", "(", "ReferenceBinding", "type", ",", "char", "[", "]", "methodName", ",", "TypeBinding", "[", "]", "argumentTypes", ")", "{", "MethodBinding", "[", "]", "methods", "=", "type", ".", "getMethods", "(", "methodName", ")", ";", "MethodBinding", "method", "=", "null", ";", "methodsLoop", ":", "for", "(", "int", "i", "=", "0", ",", "length", "=", "methods", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "method", "=", "methods", "[", "i", "]", ";", "TypeBinding", "[", "]", "parameters", "=", "method", ".", "parameters", ";", "if", "(", "argumentTypes", ".", "length", "==", "parameters", ".", "length", ")", "{", "for", "(", "int", "j", "=", "0", ",", "l", "=", "parameters", ".", "length", ";", "j", "<", "l", ";", "j", "++", ")", "{", "if", "(", "parameters", "[", "j", "]", ".", "erasure", "(", ")", "!=", "argumentTypes", "[", "j", "]", ".", "erasure", "(", ")", ")", "{", "continue", "methodsLoop", ";", "}", "}", "return", "method", ";", "}", "}", "return", "null", ";", "}", "public", "void", "initializePolymorphicSearch", "(", "MatchLocator", "locator", ")", "{", "long", "start", "=", "0", ";", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "try", "{", "SuperTypeNamesCollector", "namesCollector", "=", "new", "SuperTypeNamesCollector", "(", "this", ".", "pattern", ",", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "locator", ",", "this", ".", "pattern", ".", "declaringType", ",", "locator", ".", "progressMonitor", ")", ";", "this", ".", "allSuperDeclaringTypeNames", "=", "namesCollector", ".", "collect", "(", ")", ";", "this", ".", "samePkgSuperDeclaringTypeNames", "=", "namesCollector", ".", "getSamePackageSuperTypeNames", "(", ")", ";", "this", ".", "matchLocator", "=", "locator", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", ")", ";", "}", "}", "private", "boolean", "isTypeInSuperDeclaringTypeNames", "(", "char", "[", "]", "[", "]", "typeName", ")", "{", "if", "(", "this", ".", "allSuperDeclaringTypeNames", "==", "null", ")", "return", "false", ";", "int", "length", "=", "this", ".", "allSuperDeclaringTypeNames", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "this", ".", "allSuperDeclaringTypeNames", "[", "i", "]", ",", "typeName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "protected", "boolean", "isVirtualInvoke", "(", "MethodBinding", "method", ",", "MessageSend", "messageSend", ")", "{", "return", "!", "method", ".", "isStatic", "(", ")", "&&", "!", "method", ".", "isPrivate", "(", ")", "&&", "!", "messageSend", ".", "isSuperAccess", "(", ")", "&&", "!", "(", "method", ".", "isDefault", "(", ")", "&&", "this", ".", "pattern", ".", "focus", "!=", "null", "&&", "!", "CharOperation", ".", "equals", "(", "this", ".", "pattern", ".", "declaringPackageName", ",", "method", ".", "declaringClass", ".", "qualifiedPackageName", "(", ")", ")", ")", ";", "}", "public", "int", "match", "(", "ASTNode", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "declarationsLevel", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "if", "(", "node", "instanceof", "ImportReference", ")", "{", "ImportReference", "importRef", "=", "(", "ImportReference", ")", "node", ";", "int", "length", "=", "importRef", ".", "tokens", ".", "length", "-", "1", ";", "if", "(", "importRef", ".", "isStatic", "(", ")", "&&", "(", "(", "importRef", ".", "bits", "&", "ASTNode", ".", "OnDemand", ")", "==", "0", ")", "&&", "matchesName", "(", "this", ".", "pattern", ".", "selector", ",", "importRef", ".", "tokens", "[", "length", "]", ")", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "new", "char", "[", "length", "]", "[", "]", ";", "System", ".", "arraycopy", "(", "importRef", ".", "tokens", ",", "0", ",", "compoundName", ",", "0", ",", "length", ")", ";", "char", "[", "]", "declaringType", "=", "CharOperation", ".", "concat", "(", "this", ".", "pattern", ".", "declaringQualification", ",", "this", ".", "pattern", ".", "declaringSimpleName", ",", "'.'", ")", ";", "if", "(", "matchesName", "(", "declaringType", ",", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ")", ")", "{", "declarationsLevel", "=", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "}", "}", "}", "}", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "declarationsLevel", ")", ";", "}", "public", "int", "match", "(", "MethodDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "findDeclarations", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "matchesName", "(", "this", ".", "pattern", ".", "selector", ",", "node", ".", "selector", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "boolean", "resolve", "=", "this", ".", "pattern", ".", "mustResolve", ";", "if", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "!=", "null", ")", "{", "int", "length", "=", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ";", "ASTNode", "[", "]", "args", "=", "node", ".", "arguments", ";", "int", "argsLength", "=", "args", "==", "null", "?", "0", ":", "args", ".", "length", ";", "if", "(", "length", "!=", "argsLength", ")", "return", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "argsLength", ";", "i", "++", ")", "{", "if", "(", "args", "!=", "null", "&&", "!", "matchesTypeReference", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "[", "i", "]", ",", "(", "(", "Argument", ")", "args", "[", "i", "]", ")", ".", "type", ")", ")", "{", "if", "(", "this", ".", "mayBeGeneric", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "mustResolve", ")", "{", "nodeSet", ".", "mustResolve", "=", "true", ";", "resolve", "=", "true", ";", "}", "this", ".", "methodDeclarationsWithInvalidParam", ".", "put", "(", "node", ",", "null", ")", ";", "}", "else", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "}", "}", "}", "if", "(", "this", ".", "pattern", ".", "hasMethodArguments", "(", ")", ")", "{", "if", "(", "node", ".", "typeParameters", "==", "null", "||", "node", ".", "typeParameters", ".", "length", "!=", "this", ".", "pattern", ".", "methodArguments", ".", "length", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "resolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "public", "int", "match", "(", "MemberValuePair", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "findReferences", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "matchesName", "(", "this", ".", "pattern", ".", "selector", ",", "node", ".", "name", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "public", "int", "match", "(", "MessageSend", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "findReferences", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "matchesName", "(", "this", ".", "pattern", ".", "selector", ",", "node", ".", "selector", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "!=", "null", "&&", "(", "!", "this", ".", "pattern", ".", "varargs", "||", "(", "(", "node", ".", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "!=", "0", ")", ")", ")", "{", "int", "length", "=", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ";", "ASTNode", "[", "]", "args", "=", "node", ".", "arguments", ";", "int", "argsLength", "=", "args", "==", "null", "?", "0", ":", "args", ".", "length", ";", "if", "(", "length", "!=", "argsLength", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "public", "int", "match", "(", "Annotation", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "findReferences", ")", "return", "IMPOSSIBLE_MATCH", ";", "MemberValuePair", "[", "]", "pairs", "=", "node", ".", "memberValuePairs", "(", ")", ";", "if", "(", "pairs", "==", "null", "||", "pairs", ".", "length", "==", "0", ")", "return", "IMPOSSIBLE_MATCH", ";", "int", "length", "=", "pairs", ".", "length", ";", "MemberValuePair", "pair", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "pair", "=", "node", ".", "memberValuePairs", "(", ")", "[", "i", "]", ";", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "selector", ",", "pair", ".", "name", ")", ")", "{", "ASTNode", "possibleNode", "=", "(", "node", "instanceof", "SingleMemberAnnotation", ")", "?", "(", "ASTNode", ")", "node", ":", "pair", ";", "return", "nodeSet", ".", "addMatch", "(", "possibleNode", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "return", "ALL_CONTAINER", ";", "}", "return", "CLASS_CONTAINER", ";", "}", "protected", "void", "matchLevelAndReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "importRef", ".", "isStatic", "(", ")", "&&", "binding", "instanceof", "MethodBinding", ")", "{", "super", ".", "matchLevelAndReportImportRef", "(", "importRef", ",", "binding", ",", "locator", ")", ";", "}", "}", "protected", "int", "matchMethod", "(", "MethodBinding", "method", ",", "boolean", "skipImpossibleArg", ")", "{", "if", "(", "!", "matchesName", "(", "this", ".", "pattern", ".", "selector", ",", "method", ".", "selector", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "int", "level", "=", "ACCURATE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "==", "null", ")", "{", "int", "newLevel", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "returnSimpleName", ",", "this", ".", "pattern", ".", "returnQualification", ",", "method", ".", "returnType", ")", ";", "if", "(", "level", ">", "newLevel", ")", "{", "if", "(", "newLevel", "==", "IMPOSSIBLE_MATCH", ")", "return", "IMPOSSIBLE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "int", "parameterCount", "=", "this", ".", "pattern", ".", "parameterSimpleNames", "==", "null", "?", "-", "1", ":", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ";", "if", "(", "parameterCount", ">", "-", "1", ")", "{", "if", "(", "method", ".", "parameters", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "parameterCount", "!=", "method", ".", "parameters", ".", "length", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "method", ".", "isValidBinding", "(", ")", "&&", "(", "(", "ProblemMethodBinding", ")", "method", ")", ".", "problemId", "(", ")", "==", "ProblemReasons", ".", "Ambiguous", ")", "{", "return", "INACCURATE_MATCH", ";", "}", "boolean", "foundTypeVariable", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameterCount", ";", "i", "++", ")", "{", "TypeBinding", "argType", "=", "method", ".", "parameters", "[", "i", "]", ";", "int", "newLevel", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "argType", ".", "isMemberType", "(", ")", ")", "{", "newLevel", "=", "CharOperation", ".", "match", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "[", "i", "]", ",", "argType", ".", "sourceName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", "?", "ACCURATE_MATCH", ":", "IMPOSSIBLE_MATCH", ";", "}", "else", "{", "newLevel", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "[", "i", "]", ",", "this", ".", "pattern", ".", "parameterQualifications", "[", "i", "]", ",", "argType", ")", ";", "}", "if", "(", "level", ">", "newLevel", ")", "{", "if", "(", "newLevel", "==", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "skipImpossibleArg", ")", "{", "newLevel", "=", "level", ";", "}", "else", "if", "(", "argType", ".", "isTypeVariable", "(", ")", ")", "{", "newLevel", "=", "level", ";", "foundTypeVariable", "=", "true", ";", "}", "else", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "}", "level", "=", "newLevel", ";", "}", "}", "if", "(", "foundTypeVariable", ")", "{", "if", "(", "!", "method", ".", "isStatic", "(", ")", "&&", "!", "method", ".", "isPrivate", "(", ")", ")", "{", "MethodBinding", "focusMethodBinding", "=", "this", ".", "matchLocator", ".", "getMethodBinding", "(", "this", ".", "pattern", ")", ";", "if", "(", "focusMethodBinding", "!=", "null", ")", "{", "if", "(", "matchOverriddenMethod", "(", "focusMethodBinding", ".", "declaringClass", ",", "focusMethodBinding", ",", "method", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "}", "return", "level", ";", "}", "private", "boolean", "matchOverriddenMethod", "(", "ReferenceBinding", "type", ",", "MethodBinding", "method", ",", "MethodBinding", "matchMethod", ")", "{", "if", "(", "type", "==", "null", "||", "this", ".", "pattern", ".", "selector", "==", "null", ")", "return", "false", ";", "if", "(", "!", "type", ".", "isInterface", "(", ")", "&&", "!", "CharOperation", ".", "equals", "(", "type", ".", "compoundName", ",", "TypeConstants", ".", "JAVA_LANG_OBJECT", ")", ")", "{", "ReferenceBinding", "superClass", "=", "type", ".", "superclass", "(", ")", ";", "if", "(", "superClass", ".", "isParameterizedType", "(", ")", ")", "{", "MethodBinding", "[", "]", "methods", "=", "superClass", ".", "getMethods", "(", "this", ".", "pattern", ".", "selector", ")", ";", "int", "length", "=", "methods", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "methods", "[", "i", "]", ".", "areParametersEqual", "(", "method", ")", ")", "{", "if", "(", "matchMethod", "==", "null", ")", "{", "if", "(", "methodParametersEqualsPattern", "(", "methods", "[", "i", "]", ".", "original", "(", ")", ")", ")", "return", "true", ";", "}", "else", "{", "if", "(", "methods", "[", "i", "]", ".", "original", "(", ")", ".", "areParametersEqual", "(", "matchMethod", ")", ")", "return", "true", ";", "}", "}", "}", "}", "if", "(", "matchOverriddenMethod", "(", "superClass", ",", "method", ",", "matchMethod", ")", ")", "{", "return", "true", ";", "}", "}", "ReferenceBinding", "[", "]", "interfaces", "=", "type", ".", "superInterfaces", "(", ")", ";", "if", "(", "interfaces", "==", "null", ")", "return", "false", ";", "int", "iLength", "=", "interfaces", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "iLength", ";", "i", "++", ")", "{", "if", "(", "interfaces", "[", "i", "]", ".", "isParameterizedType", "(", ")", ")", "{", "MethodBinding", "[", "]", "methods", "=", "interfaces", "[", "i", "]", ".", "getMethods", "(", "this", ".", "pattern", ".", "selector", ")", ";", "int", "length", "=", "methods", ".", "length", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length", ";", "j", "++", ")", "{", "if", "(", "methods", "[", "j", "]", ".", "areParametersEqual", "(", "method", ")", ")", "{", "if", "(", "matchMethod", "==", "null", ")", "{", "if", "(", "methodParametersEqualsPattern", "(", "methods", "[", "j", "]", ".", "original", "(", ")", ")", ")", "return", "true", ";", "}", "else", "{", "if", "(", "methods", "[", "j", "]", ".", "original", "(", ")", ".", "areParametersEqual", "(", "matchMethod", ")", ")", "return", "true", ";", "}", "}", "}", "}", "if", "(", "matchOverriddenMethod", "(", "interfaces", "[", "i", "]", ",", "method", ",", "matchMethod", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "matchReportReference", "(", "reference", ",", "element", ",", "null", ",", "null", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "IJavaElement", "localElement", ",", "IJavaElement", "[", "]", "otherElements", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "MethodBinding", "methodBinding", "=", "(", "reference", "instanceof", "MessageSend", ")", "?", "(", "(", "MessageSend", ")", "reference", ")", ".", "binding", ":", "(", "(", "elementBinding", "instanceof", "MethodBinding", ")", "?", "(", "MethodBinding", ")", "elementBinding", ":", "null", ")", ";", "if", "(", "this", ".", "isDeclarationOfReferencedMethodsPattern", ")", "{", "if", "(", "methodBinding", "==", "null", ")", "return", ";", "if", "(", "accuracy", "!=", "SearchMatch", ".", "A_ACCURATE", ")", "return", ";", "DeclarationOfReferencedMethodsPattern", "declPattern", "=", "(", "DeclarationOfReferencedMethodsPattern", ")", "this", ".", "pattern", ";", "while", "(", "element", "!=", "null", "&&", "!", "declPattern", ".", "enclosingElement", ".", "equals", "(", "element", ")", ")", "element", "=", "element", ".", "getParent", "(", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "reportDeclaration", "(", "methodBinding", ",", "locator", ",", "declPattern", ".", "knownMethods", ")", ";", "}", "}", "else", "{", "MethodReferenceMatch", "methodReferenceMatch", "=", "locator", ".", "newMethodReferenceMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "-", "1", ",", "-", "1", ",", "false", ",", "false", ",", "reference", ")", ";", "methodReferenceMatch", ".", "setLocalElement", "(", "localElement", ")", ";", "this", ".", "match", "=", "methodReferenceMatch", ";", "if", "(", "this", ".", "pattern", ".", "findReferences", "&&", "reference", "instanceof", "MessageSend", ")", "{", "IJavaElement", "focus", "=", "this", ".", "pattern", ".", "focus", ";", "if", "(", "focus", "!=", "null", "&&", "focus", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "METHOD", ")", "{", "if", "(", "methodBinding", "!=", "null", "&&", "methodBinding", ".", "declaringClass", "!=", "null", ")", "{", "boolean", "isPrivate", "=", "Flags", ".", "isPrivate", "(", "(", "(", "IMethod", ")", "focus", ")", ".", "getFlags", "(", ")", ")", ";", "if", "(", "isPrivate", "&&", "!", "CharOperation", ".", "equals", "(", "methodBinding", ".", "declaringClass", ".", "sourceName", ",", "focus", ".", "getParent", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ")", ")", "{", "return", ";", "}", "}", "}", "matchReportReference", "(", "(", "MessageSend", ")", "reference", ",", "locator", ",", "accuracy", ",", "(", "(", "MessageSend", ")", "reference", ")", ".", "binding", ")", ";", "}", "else", "{", "if", "(", "reference", "instanceof", "SingleMemberAnnotation", ")", "{", "reference", "=", "(", "(", "SingleMemberAnnotation", ")", "reference", ")", ".", "memberValuePairs", "(", ")", "[", "0", "]", ";", "this", ".", "match", ".", "setImplicit", "(", "true", ")", ";", "}", "int", "offset", "=", "reference", ".", "sourceStart", ";", "int", "length", "=", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ";", "this", ".", "match", ".", "setOffset", "(", "offset", ")", ";", "this", ".", "match", ".", "setLength", "(", "length", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "}", "void", "matchReportReference", "(", "MessageSend", "messageSend", ",", "MatchLocator", "locator", ",", "int", "accuracy", ",", "MethodBinding", "methodBinding", ")", "throws", "CoreException", "{", "boolean", "isParameterized", "=", "false", ";", "if", "(", "methodBinding", "instanceof", "ParameterizedGenericMethodBinding", ")", "{", "isParameterized", "=", "true", ";", "ParameterizedGenericMethodBinding", "parameterizedMethodBinding", "=", "(", "ParameterizedGenericMethodBinding", ")", "methodBinding", ";", "this", ".", "match", ".", "setRaw", "(", "parameterizedMethodBinding", ".", "isRaw", ")", ";", "TypeBinding", "[", "]", "typeArguments", "=", "parameterizedMethodBinding", ".", "typeArguments", ";", "updateMatch", "(", "typeArguments", ",", "locator", ",", "this", ".", "pattern", ".", "methodArguments", ",", "this", ".", "pattern", ".", "hasMethodParameters", "(", ")", ")", ";", "if", "(", "methodBinding", ".", "declaringClass", ".", "isParameterizedType", "(", ")", "||", "methodBinding", ".", "declaringClass", ".", "isRawType", "(", ")", ")", "{", "ParameterizedTypeBinding", "parameterizedBinding", "=", "(", "ParameterizedTypeBinding", ")", "methodBinding", ".", "declaringClass", ";", "if", "(", "!", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", "&&", "this", ".", "pattern", ".", "hasMethodArguments", "(", ")", "||", "parameterizedBinding", ".", "isParameterizedWithOwnVariables", "(", ")", ")", "{", "}", "else", "{", "updateMatch", "(", "parameterizedBinding", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "this", ".", "pattern", ".", "hasTypeParameters", "(", ")", ",", "0", ",", "locator", ")", ";", "}", "}", "else", "if", "(", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "if", "(", "this", ".", "match", ".", "getRule", "(", ")", "!=", "0", "&&", "messageSend", ".", "resolvedType", "==", "null", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "}", "else", "if", "(", "methodBinding", "instanceof", "ParameterizedMethodBinding", ")", "{", "isParameterized", "=", "true", ";", "if", "(", "methodBinding", ".", "declaringClass", ".", "isParameterizedType", "(", ")", "||", "methodBinding", ".", "declaringClass", ".", "isRawType", "(", ")", ")", "{", "ParameterizedTypeBinding", "parameterizedBinding", "=", "(", "ParameterizedTypeBinding", ")", "methodBinding", ".", "declaringClass", ";", "if", "(", "!", "parameterizedBinding", ".", "isParameterizedWithOwnVariables", "(", ")", ")", "{", "if", "(", "(", "accuracy", "&", "(", "SUB_INVOCATION_FLAVOR", "|", "OVERRIDDEN_METHOD_FLAVOR", ")", ")", "!=", "0", ")", "{", "ReferenceBinding", "refBinding", "=", "getMatchingSuper", "(", "(", "(", "ReferenceBinding", ")", "messageSend", ".", "actualReceiverType", ")", ")", ";", "if", "(", "refBinding", "instanceof", "ParameterizedTypeBinding", ")", "{", "parameterizedBinding", "=", "(", "(", "ParameterizedTypeBinding", ")", "refBinding", ")", ";", "}", "}", "if", "(", "(", "accuracy", "&", "SUPER_INVOCATION_FLAVOR", ")", "==", "0", ")", "{", "updateMatch", "(", "parameterizedBinding", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "this", ".", "pattern", ".", "hasTypeParameters", "(", ")", ",", "0", ",", "locator", ")", ";", "}", "}", "}", "else", "if", "(", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "if", "(", "this", ".", "match", ".", "getRule", "(", ")", "!=", "0", "&&", "messageSend", ".", "resolvedType", "==", "null", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "}", "else", "if", "(", "this", ".", "pattern", ".", "hasMethodArguments", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "if", "(", "this", ".", "match", ".", "getRule", "(", ")", "==", "0", ")", "return", ";", "boolean", "report", "=", "(", "this", ".", "isErasureMatch", "&&", "this", ".", "match", ".", "isErasure", "(", ")", ")", "||", "(", "this", ".", "isEquivalentMatch", "&&", "this", ".", "match", ".", "isEquivalent", "(", ")", ")", "||", "this", ".", "match", ".", "isExact", "(", ")", ";", "if", "(", "!", "report", ")", "return", ";", "int", "offset", "=", "(", "int", ")", "(", "messageSend", ".", "nameSourcePosition", ">>>", "32", ")", ";", "this", ".", "match", ".", "setOffset", "(", "offset", ")", ";", "this", ".", "match", ".", "setLength", "(", "messageSend", ".", "sourceEnd", "-", "offset", "+", "1", ")", ";", "if", "(", "isParameterized", "&&", "this", ".", "pattern", ".", "hasMethodArguments", "(", ")", ")", "{", "locator", ".", "reportAccurateParameterizedMethodReference", "(", "this", ".", "match", ",", "messageSend", ",", "messageSend", ".", "typeArguments", ")", ";", "}", "else", "{", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "private", "boolean", "methodParametersEqualsPattern", "(", "MethodBinding", "method", ")", "{", "TypeBinding", "[", "]", "methodParameters", "=", "method", ".", "parameters", ";", "int", "length", "=", "methodParameters", ".", "length", ";", "if", "(", "length", "!=", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "[", "]", "paramQualifiedName", "=", "qualifiedPattern", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "[", "i", "]", ",", "this", ".", "pattern", ".", "parameterQualifications", "[", "i", "]", ")", ";", "if", "(", "!", "CharOperation", ".", "match", "(", "paramQualifiedName", ",", "methodParameters", "[", "i", "]", ".", "readableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "public", "SearchMatch", "newDeclarationMatch", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "int", "length", ",", "MatchLocator", "locator", ")", "{", "if", "(", "elementBinding", "!=", "null", ")", "{", "MethodBinding", "methodBinding", "=", "(", "MethodBinding", ")", "elementBinding", ";", "if", "(", "this", ".", "methodDeclarationsWithInvalidParam", ".", "containsKey", "(", "reference", ")", ")", "{", "Boolean", "report", "=", "(", "Boolean", ")", "this", ".", "methodDeclarationsWithInvalidParam", ".", "get", "(", "reference", ")", ";", "if", "(", "report", "!=", "null", ")", "{", "if", "(", "report", ".", "booleanValue", "(", ")", ")", "{", "return", "super", ".", "newDeclarationMatch", "(", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "length", ",", "locator", ")", ";", "}", "return", "null", ";", "}", "if", "(", "matchOverriddenMethod", "(", "methodBinding", ".", "declaringClass", ",", "methodBinding", ",", "null", ")", ")", "{", "this", ".", "methodDeclarationsWithInvalidParam", ".", "put", "(", "reference", ",", "Boolean", ".", "TRUE", ")", ";", "return", "super", ".", "newDeclarationMatch", "(", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "length", ",", "locator", ")", ";", "}", "if", "(", "isTypeInSuperDeclaringTypeNames", "(", "methodBinding", ".", "declaringClass", ".", "compoundName", ")", ")", "{", "MethodBinding", "patternBinding", "=", "locator", ".", "getMethodBinding", "(", "this", ".", "pattern", ")", ";", "if", "(", "patternBinding", "!=", "null", ")", "{", "if", "(", "!", "matchOverriddenMethod", "(", "patternBinding", ".", "declaringClass", ",", "patternBinding", ",", "methodBinding", ")", ")", "{", "this", ".", "methodDeclarationsWithInvalidParam", ".", "put", "(", "reference", ",", "Boolean", ".", "FALSE", ")", ";", "return", "null", ";", "}", "}", "this", ".", "methodDeclarationsWithInvalidParam", ".", "put", "(", "reference", ",", "Boolean", ".", "TRUE", ")", ";", "return", "super", ".", "newDeclarationMatch", "(", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "length", ",", "locator", ")", ";", "}", "this", ".", "methodDeclarationsWithInvalidParam", ".", "put", "(", "reference", ",", "Boolean", ".", "FALSE", ")", ";", "return", "null", ";", "}", "}", "return", "super", ".", "newDeclarationMatch", "(", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "length", ",", "locator", ")", ";", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "IJavaElement", ".", "METHOD", ";", "}", "protected", "void", "reportDeclaration", "(", "MethodBinding", "methodBinding", ",", "MatchLocator", "locator", ",", "SimpleSet", "knownMethods", ")", "throws", "CoreException", "{", "ReferenceBinding", "declaringClass", "=", "methodBinding", ".", "declaringClass", ";", "IType", "type", "=", "locator", ".", "lookupType", "(", "declaringClass", ")", ";", "if", "(", "type", "==", "null", ")", "return", ";", "if", "(", "type", ".", "isBinary", "(", ")", ")", "{", "IMethod", "method", "=", "null", ";", "TypeBinding", "[", "]", "parameters", "=", "methodBinding", ".", "original", "(", ")", ".", "parameters", ";", "int", "parameterLength", "=", "parameters", ".", "length", ";", "char", "[", "]", "[", "]", "parameterTypes", "=", "new", "char", "[", "parameterLength", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameterLength", ";", "i", "++", ")", "{", "char", "[", "]", "typeName", "=", "parameters", "[", "i", "]", ".", "qualifiedSourceName", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "dim", "=", "parameters", "[", "i", "]", ".", "dimensions", "(", ")", ";", "j", "<", "dim", ";", "j", "++", ")", "{", "typeName", "=", "CharOperation", ".", "concat", "(", "typeName", ",", "new", "char", "[", "]", "{", "'['", ",", "']'", "}", ")", ";", "}", "parameterTypes", "[", "i", "]", "=", "typeName", ";", "}", "method", "=", "locator", ".", "createBinaryMethodHandle", "(", "type", ",", "methodBinding", ".", "selector", ",", "parameterTypes", ")", ";", "if", "(", "method", "==", "null", "||", "knownMethods", ".", "addIfNotIncluded", "(", "method", ")", "==", "null", ")", "return", ";", "IResource", "resource", "=", "type", ".", "getResource", "(", ")", ";", "if", "(", "resource", "==", "null", ")", "resource", "=", "type", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ";", "IBinaryType", "info", "=", "locator", ".", "getBinaryInfo", "(", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ClassFile", ")", "type", ".", "getClassFile", "(", ")", ",", "resource", ")", ";", "locator", ".", "reportBinaryMemberDeclaration", "(", "resource", ",", "method", ",", "methodBinding", ",", "info", ",", "SearchMatch", ".", "A_ACCURATE", ")", ";", "return", ";", "}", "IResource", "resource", "=", "type", ".", "getResource", "(", ")", ";", "if", "(", "declaringClass", "instanceof", "ParameterizedTypeBinding", ")", "declaringClass", "=", "(", "(", "ParameterizedTypeBinding", ")", "declaringClass", ")", ".", "genericType", "(", ")", ";", "ClassScope", "scope", "=", "(", "(", "SourceTypeBinding", ")", "declaringClass", ")", ".", "scope", ";", "if", "(", "scope", "!=", "null", ")", "{", "TypeDeclaration", "typeDecl", "=", "scope", ".", "referenceContext", ";", "AbstractMethodDeclaration", "methodDecl", "=", "typeDecl", ".", "declarationOf", "(", "methodBinding", ".", "original", "(", ")", ")", ";", "if", "(", "methodDecl", "!=", "null", ")", "{", "String", "methodName", "=", "new", "String", "(", "methodBinding", ".", "selector", ")", ";", "Argument", "[", "]", "arguments", "=", "methodDecl", ".", "arguments", ";", "int", "length", "=", "arguments", "==", "null", "?", "0", ":", "arguments", ".", "length", ";", "String", "[", "]", "parameterTypes", "=", "new", "String", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "[", "]", "[", "]", "typeName", "=", "arguments", "[", "i", "]", ".", "type", ".", "getParameterizedTypeName", "(", ")", ";", "parameterTypes", "[", "i", "]", "=", "Signature", ".", "createTypeSignature", "(", "CharOperation", ".", "concatWith", "(", "typeName", ",", "'.'", ")", ",", "false", ")", ";", "}", "IMethod", "method", "=", "type", ".", "getMethod", "(", "methodName", ",", "parameterTypes", ")", ";", "if", "(", "method", "==", "null", "||", "knownMethods", ".", "addIfNotIncluded", "(", "method", ")", "==", "null", ")", "return", ";", "int", "offset", "=", "methodDecl", ".", "sourceStart", ";", "this", ".", "match", "=", "new", "MethodDeclarationMatch", "(", "method", ",", "SearchMatch", ".", "A_ACCURATE", ",", "offset", ",", "methodDecl", ".", "sourceEnd", "-", "offset", "+", "1", ",", "locator", ".", "getParticipant", "(", ")", ",", "resource", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "}", "public", "int", "resolveLevel", "(", "ASTNode", "possibleMatchingNode", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "if", "(", "possibleMatchingNode", "instanceof", "MessageSend", ")", "{", "return", "resolveLevel", "(", "(", "MessageSend", ")", "possibleMatchingNode", ")", ";", "}", "if", "(", "possibleMatchingNode", "instanceof", "SingleMemberAnnotation", ")", "{", "SingleMemberAnnotation", "annotation", "=", "(", "SingleMemberAnnotation", ")", "possibleMatchingNode", ";", "return", "resolveLevel", "(", "annotation", ".", "memberValuePairs", "(", ")", "[", "0", "]", ".", "binding", ")", ";", "}", "if", "(", "possibleMatchingNode", "instanceof", "MemberValuePair", ")", "{", "MemberValuePair", "memberValuePair", "=", "(", "MemberValuePair", ")", "possibleMatchingNode", ";", "return", "resolveLevel", "(", "memberValuePair", ".", "binding", ")", ";", "}", "}", "if", "(", "this", ".", "pattern", ".", "findDeclarations", ")", "{", "if", "(", "possibleMatchingNode", "instanceof", "MethodDeclaration", ")", "{", "return", "resolveLevel", "(", "(", "(", "MethodDeclaration", ")", "possibleMatchingNode", ")", ".", "binding", ")", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "!", "(", "binding", "instanceof", "MethodBinding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "MethodBinding", "method", "=", "(", "MethodBinding", ")", "binding", ";", "boolean", "skipVerif", "=", "this", ".", "pattern", ".", "findDeclarations", "&&", "this", ".", "mayBeGeneric", ";", "int", "methodLevel", "=", "matchMethod", "(", "method", ",", "skipVerif", ")", ";", "if", "(", "methodLevel", "==", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "method", "!=", "method", ".", "original", "(", ")", ")", "methodLevel", "=", "matchMethod", "(", "method", ".", "original", "(", ")", ",", "skipVerif", ")", ";", "if", "(", "methodLevel", "==", "IMPOSSIBLE_MATCH", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "else", "{", "method", "=", "method", ".", "original", "(", ")", ";", "}", "}", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "==", "null", "&&", "this", ".", "pattern", ".", "declaringQualification", "==", "null", ")", "return", "methodLevel", ";", "boolean", "subType", "=", "!", "method", ".", "isStatic", "(", ")", "&&", "!", "method", ".", "isPrivate", "(", ")", ";", "if", "(", "subType", "&&", "this", ".", "pattern", ".", "declaringQualification", "!=", "null", "&&", "method", ".", "declaringClass", "!=", "null", "&&", "method", ".", "declaringClass", ".", "fPackage", "!=", "null", ")", "{", "subType", "=", "CharOperation", ".", "compareWith", "(", "this", ".", "pattern", ".", "declaringQualification", ",", "method", ".", "declaringClass", ".", "fPackage", ".", "shortReadableName", "(", ")", ")", "==", "0", ";", "}", "int", "declaringLevel", "=", "subType", "?", "resolveLevelAsSubtype", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "method", ".", "declaringClass", ",", "method", ".", "selector", ",", "null", ",", "method", ".", "declaringClass", ".", "qualifiedPackageName", "(", ")", ",", "method", ".", "isDefault", "(", ")", ")", ":", "resolveLevelForType", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "method", ".", "declaringClass", ")", ";", "return", "(", "methodLevel", "&", "MATCH_LEVEL_MASK", ")", ">", "(", "declaringLevel", "&", "MATCH_LEVEL_MASK", ")", "?", "declaringLevel", ":", "methodLevel", ";", "}", "protected", "int", "resolveLevel", "(", "MessageSend", "messageSend", ")", "{", "MethodBinding", "method", "=", "messageSend", ".", "binding", ";", "if", "(", "method", "==", "null", ")", "{", "return", "INACCURATE_MATCH", ";", "}", "if", "(", "messageSend", ".", "resolvedType", "==", "null", ")", "{", "int", "argLength", "=", "messageSend", ".", "arguments", "==", "null", "?", "0", ":", "messageSend", ".", "arguments", ".", "length", ";", "if", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "==", "null", "||", "argLength", "==", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ")", "{", "return", "INACCURATE_MATCH", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "int", "methodLevel", "=", "matchMethod", "(", "method", ",", "false", ")", ";", "if", "(", "methodLevel", "==", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "method", "!=", "method", ".", "original", "(", ")", ")", "methodLevel", "=", "matchMethod", "(", "method", ".", "original", "(", ")", ",", "false", ")", ";", "if", "(", "methodLevel", "==", "IMPOSSIBLE_MATCH", ")", "return", "IMPOSSIBLE_MATCH", ";", "method", "=", "method", ".", "original", "(", ")", ";", "}", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "==", "null", "&&", "this", ".", "pattern", ".", "declaringQualification", "==", "null", ")", "return", "methodLevel", ";", "int", "declaringLevel", ";", "if", "(", "isVirtualInvoke", "(", "method", ",", "messageSend", ")", "&&", "(", "messageSend", ".", "actualReceiverType", "instanceof", "ReferenceBinding", ")", ")", "{", "ReferenceBinding", "methodReceiverType", "=", "(", "ReferenceBinding", ")", "messageSend", ".", "actualReceiverType", ";", "declaringLevel", "=", "resolveLevelAsSubtype", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "methodReceiverType", ",", "method", ".", "selector", ",", "method", ".", "parameters", ",", "methodReceiverType", ".", "qualifiedPackageName", "(", ")", ",", "method", ".", "isDefault", "(", ")", ")", ";", "if", "(", "declaringLevel", "==", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "method", ".", "declaringClass", "==", "null", "||", "this", ".", "allSuperDeclaringTypeNames", "==", "null", ")", "{", "declaringLevel", "=", "INACCURATE_MATCH", ";", "}", "else", "{", "char", "[", "]", "[", "]", "[", "]", "superTypeNames", "=", "(", "method", ".", "isDefault", "(", ")", "&&", "this", ".", "pattern", ".", "focus", "==", "null", ")", "?", "this", ".", "samePkgSuperDeclaringTypeNames", ":", "this", ".", "allSuperDeclaringTypeNames", ";", "if", "(", "superTypeNames", "!=", "null", "&&", "resolveLevelAsSuperInvocation", "(", "methodReceiverType", ",", "method", ".", "parameters", ",", "superTypeNames", ",", "true", ")", ")", "{", "declaringLevel", "=", "methodLevel", "|", "SUPER_INVOCATION_FLAVOR", ";", "}", "}", "}", "if", "(", "(", "declaringLevel", "&", "FLAVORS_MASK", ")", "!=", "0", ")", "{", "return", "declaringLevel", ";", "}", "}", "else", "{", "declaringLevel", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "method", ".", "declaringClass", ")", ";", "}", "return", "(", "methodLevel", "&", "MATCH_LEVEL_MASK", ")", ">", "(", "declaringLevel", "&", "MATCH_LEVEL_MASK", ")", "?", "declaringLevel", ":", "methodLevel", ";", "}", "protected", "int", "resolveLevelAsSubtype", "(", "char", "[", "]", "simplePattern", ",", "char", "[", "]", "qualifiedPattern", ",", "ReferenceBinding", "type", ",", "char", "[", "]", "methodName", ",", "TypeBinding", "[", "]", "argumentTypes", ",", "char", "[", "]", "packageName", ",", "boolean", "isDefault", ")", "{", "if", "(", "type", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "int", "level", "=", "resolveLevelForType", "(", "simplePattern", ",", "qualifiedPattern", ",", "type", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "isDefault", "&&", "!", "CharOperation", ".", "equals", "(", "packageName", ",", "type", ".", "qualifiedPackageName", "(", ")", ")", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "MethodBinding", "method", "=", "argumentTypes", "==", "null", "?", "null", ":", "getMethodBinding", "(", "type", ",", "methodName", ",", "argumentTypes", ")", ";", "if", "(", "(", "(", "method", "!=", "null", "&&", "!", "method", ".", "isAbstract", "(", ")", ")", "||", "!", "type", ".", "isAbstract", "(", ")", ")", "&&", "!", "type", ".", "isInterface", "(", ")", ")", "{", "level", "|=", "OVERRIDDEN_METHOD_FLAVOR", ";", "}", "return", "level", ";", "}", "if", "(", "!", "type", ".", "isInterface", "(", ")", "&&", "!", "CharOperation", ".", "equals", "(", "type", ".", "compoundName", ",", "TypeConstants", ".", "JAVA_LANG_OBJECT", ")", ")", "{", "level", "=", "resolveLevelAsSubtype", "(", "simplePattern", ",", "qualifiedPattern", ",", "type", ".", "superclass", "(", ")", ",", "methodName", ",", "argumentTypes", ",", "packageName", ",", "isDefault", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "argumentTypes", "!=", "null", ")", "{", "MethodBinding", "method", "=", "getMethodBinding", "(", "type", ",", "methodName", ",", "argumentTypes", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "if", "(", "(", "level", "&", "OVERRIDDEN_METHOD_FLAVOR", ")", "!=", "0", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "if", "(", "!", "method", ".", "isAbstract", "(", ")", "&&", "!", "type", ".", "isInterface", "(", ")", ")", "{", "level", "|=", "OVERRIDDEN_METHOD_FLAVOR", ";", "}", "}", "}", "return", "level", "|", "SUB_INVOCATION_FLAVOR", ";", "}", "}", "ReferenceBinding", "[", "]", "interfaces", "=", "type", ".", "superInterfaces", "(", ")", ";", "if", "(", "interfaces", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "interfaces", ".", "length", ";", "i", "++", ")", "{", "level", "=", "resolveLevelAsSubtype", "(", "simplePattern", ",", "qualifiedPattern", ",", "interfaces", "[", "i", "]", ",", "methodName", ",", "null", ",", "packageName", ",", "isDefault", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "!", "type", ".", "isAbstract", "(", ")", "&&", "!", "type", ".", "isInterface", "(", ")", ")", "{", "level", "|=", "OVERRIDDEN_METHOD_FLAVOR", ";", "}", "return", "level", "|", "SUB_INVOCATION_FLAVOR", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "private", "boolean", "resolveLevelAsSuperInvocation", "(", "ReferenceBinding", "type", ",", "TypeBinding", "[", "]", "argumentTypes", ",", "char", "[", "]", "[", "]", "[", "]", "superTypeNames", ",", "boolean", "methodAlreadyVerified", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "type", ".", "compoundName", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "superTypeNames", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "superTypeNames", "[", "i", "]", ",", "compoundName", ")", ")", "{", "if", "(", "methodAlreadyVerified", ")", "return", "true", ";", "MethodBinding", "[", "]", "methods", "=", "type", ".", "getMethods", "(", "this", ".", "pattern", ".", "selector", ")", ";", "for", "(", "int", "j", "=", "0", ",", "length", "=", "methods", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "MethodBinding", "method", "=", "methods", "[", "j", "]", ";", "TypeBinding", "[", "]", "parameters", "=", "method", ".", "parameters", ";", "if", "(", "argumentTypes", ".", "length", "==", "parameters", ".", "length", ")", "{", "boolean", "found", "=", "true", ";", "for", "(", "int", "k", "=", "0", ",", "l", "=", "parameters", ".", "length", ";", "k", "<", "l", ";", "k", "++", ")", "{", "if", "(", "parameters", "[", "k", "]", ".", "erasure", "(", ")", "!=", "argumentTypes", "[", "k", "]", ".", "erasure", "(", ")", ")", "{", "found", "=", "false", ";", "break", ";", "}", "}", "if", "(", "found", ")", "{", "return", "true", ";", "}", "}", "}", "break", ";", "}", "}", "if", "(", "type", ".", "isInterface", "(", ")", ")", "{", "ReferenceBinding", "[", "]", "interfaces", "=", "type", ".", "superInterfaces", "(", ")", ";", "if", "(", "interfaces", "==", "null", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "interfaces", ".", "length", ";", "i", "++", ")", "{", "if", "(", "resolveLevelAsSuperInvocation", "(", "interfaces", "[", "i", "]", ",", "argumentTypes", ",", "superTypeNames", ",", "false", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,555
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "LocalVariableBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "LocalVariable", ";", "public", "class", "LocalVariableLocator", "extends", "VariableLocator", "{", "public", "LocalVariableLocator", "(", "LocalVariablePattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "}", "public", "int", "match", "(", "LocalDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "referencesLevel", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "if", "(", "this", ".", "pattern", ".", "writeAccess", "&&", "!", "this", ".", "pattern", ".", "readAccess", "&&", "node", ".", "initialization", "!=", "null", ")", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "node", ".", "name", ")", ")", "referencesLevel", "=", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "int", "declarationsLevel", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "findDeclarations", ")", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "node", ".", "name", ")", ")", "if", "(", "node", ".", "declarationSourceStart", "==", "getLocalVariable", "(", ")", ".", "declarationSourceStart", ")", "declarationsLevel", "=", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "referencesLevel", ">=", "declarationsLevel", "?", "referencesLevel", ":", "declarationsLevel", ")", ";", "}", "private", "LocalVariable", "getLocalVariable", "(", ")", "{", "return", "(", "(", "LocalVariablePattern", ")", "this", ".", "pattern", ")", ".", "localVariable", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "int", "offset", "=", "-", "1", ";", "int", "length", "=", "-", "1", ";", "if", "(", "reference", "instanceof", "SingleNameReference", ")", "{", "offset", "=", "reference", ".", "sourceStart", ";", "length", "=", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ";", "}", "else", "if", "(", "reference", "instanceof", "QualifiedNameReference", ")", "{", "QualifiedNameReference", "qNameRef", "=", "(", "QualifiedNameReference", ")", "reference", ";", "long", "sourcePosition", "=", "qNameRef", ".", "sourcePositions", "[", "0", "]", ";", "offset", "=", "(", "int", ")", "(", "sourcePosition", ">>>", "32", ")", ";", "length", "=", "(", "(", "int", ")", "sourcePosition", ")", "-", "offset", "+", "1", ";", "}", "else", "if", "(", "reference", "instanceof", "LocalDeclaration", ")", "{", "LocalVariable", "localVariable", "=", "getLocalVariable", "(", ")", ";", "offset", "=", "localVariable", ".", "nameStart", ";", "length", "=", "localVariable", ".", "nameEnd", "-", "offset", "+", "1", ";", "element", "=", "localVariable", ";", "this", ".", "match", "=", "locator", ".", "newDeclarationMatch", "(", "element", ",", "null", ",", "accuracy", ",", "offset", ",", "length", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "return", ";", "}", "if", "(", "offset", ">=", "0", ")", "{", "this", ".", "match", "=", "locator", ".", "newLocalVariableReferenceMatch", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "reference", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "protected", "int", "matchContainer", "(", ")", "{", "return", "METHOD_CONTAINER", ";", "}", "protected", "int", "matchLocalVariable", "(", "LocalVariableBinding", "variable", ",", "boolean", "matchName", ")", "{", "if", "(", "variable", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "matchName", "&&", "!", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "variable", ".", "readableName", "(", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "variable", ".", "declaration", ".", "declarationSourceStart", "==", "getLocalVariable", "(", ")", ".", "declarationSourceStart", "?", "ACCURATE_MATCH", ":", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "IJavaElement", ".", "LOCAL_VARIABLE", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "possiblelMatchingNode", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", "||", "this", ".", "pattern", ".", "fineGrain", "!=", "0", ")", "if", "(", "possiblelMatchingNode", "instanceof", "NameReference", ")", "return", "resolveLevel", "(", "(", "NameReference", ")", "possiblelMatchingNode", ")", ";", "if", "(", "possiblelMatchingNode", "instanceof", "LocalDeclaration", ")", "return", "matchLocalVariable", "(", "(", "(", "LocalDeclaration", ")", "possiblelMatchingNode", ")", ".", "binding", ",", "true", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "!", "(", "binding", "instanceof", "LocalVariableBinding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "matchLocalVariable", "(", "(", "LocalVariableBinding", ")", "binding", ",", "true", ")", ";", "}", "protected", "int", "resolveLevel", "(", "NameReference", "nameRef", ")", "{", "return", "resolveLevel", "(", "nameRef", ".", "binding", ")", ";", "}", "}", "</s>" ]
2,556
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "SubProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ASTVisitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "CompilationResult", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Initializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "AbortCompilation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IndexManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "ASTNodeFinder", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "SuperTypeNamesCollector", "{", "public", "class", "TypeDeclarationVisitor", "extends", "ASTVisitor", "{", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "BlockScope", "scope", ")", "{", "ReferenceBinding", "binding", "=", "typeDeclaration", ".", "binding", ";", "if", "(", "SuperTypeNamesCollector", ".", "this", ".", "matches", "(", "binding", ")", ")", "collectSuperTypeNames", "(", "binding", ",", "binding", ".", "compoundName", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "CompilationUnitScope", "scope", ")", "{", "ReferenceBinding", "binding", "=", "typeDeclaration", ".", "binding", ";", "if", "(", "SuperTypeNamesCollector", ".", "this", ".", "matches", "(", "binding", ")", ")", "collectSuperTypeNames", "(", "binding", ",", "binding", ".", "compoundName", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "memberTypeDeclaration", ",", "ClassScope", "scope", ")", "{", "ReferenceBinding", "binding", "=", "memberTypeDeclaration", ".", "binding", ";", "if", "(", "SuperTypeNamesCollector", ".", "this", ".", "matches", "(", "binding", ")", ")", "collectSuperTypeNames", "(", "binding", ",", "binding", ".", "compoundName", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "FieldDeclaration", "fieldDeclaration", ",", "MethodScope", "scope", ")", "{", "return", "false", ";", "}", "public", "boolean", "visit", "(", "Initializer", "initializer", ",", "MethodScope", "scope", ")", "{", "return", "false", ";", "}", "public", "boolean", "visit", "(", "ConstructorDeclaration", "constructorDeclaration", ",", "ClassScope", "scope", ")", "{", "return", "false", ";", "}", "public", "boolean", "visit", "(", "MethodDeclaration", "methodDeclaration", ",", "ClassScope", "scope", ")", "{", "return", "false", ";", "}", "}", "SearchPattern", "pattern", ";", "char", "[", "]", "typeSimpleName", ";", "char", "[", "]", "typeQualification", ";", "MatchLocator", "locator", ";", "IType", "type", ";", "IProgressMonitor", "progressMonitor", ";", "char", "[", "]", "[", "]", "[", "]", "result", ";", "int", "resultIndex", ";", "char", "[", "]", "[", "]", "[", "]", "samePackageSuperTypeName", ";", "int", "samePackageIndex", ";", "public", "SuperTypeNamesCollector", "(", "SearchPattern", "pattern", ",", "char", "[", "]", "typeSimpleName", ",", "char", "[", "]", "typeQualification", ",", "MatchLocator", "locator", ",", "IType", "type", ",", "IProgressMonitor", "progressMonitor", ")", "{", "this", ".", "pattern", "=", "pattern", ";", "this", ".", "typeSimpleName", "=", "typeSimpleName", ";", "this", ".", "typeQualification", "=", "typeQualification", ";", "this", ".", "locator", "=", "locator", ";", "this", ".", "type", "=", "type", ";", "this", ".", "progressMonitor", "=", "progressMonitor", ";", "}", "private", "boolean", "addIfSamePackage", "(", "char", "[", "]", "[", "]", "compoundName", ",", "char", "[", "]", "[", "]", "path", ")", "{", "if", "(", "compoundName", ".", "length", "!=", "path", ".", "length", ")", "return", "false", ";", "int", "resultLength", "=", "this", ".", "samePackageSuperTypeName", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "resultLength", ";", "i", "++", ")", "if", "(", "CharOperation", ".", "equals", "(", "this", ".", "samePackageSuperTypeName", "[", "i", "]", ",", "compoundName", ")", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "compoundName", ".", "length", "-", "1", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "CharOperation", ".", "equals", "(", "compoundName", "[", "i", "]", ",", "path", "[", "i", "]", ")", ")", "return", "false", ";", "}", "if", "(", "resultLength", "==", "this", ".", "samePackageIndex", ")", "System", ".", "arraycopy", "(", "this", ".", "samePackageSuperTypeName", ",", "0", ",", "this", ".", "samePackageSuperTypeName", "=", "new", "char", "[", "resultLength", "*", "2", "]", "[", "]", "[", "]", ",", "0", ",", "resultLength", ")", ";", "this", ".", "samePackageSuperTypeName", "[", "this", ".", "samePackageIndex", "++", "]", "=", "compoundName", ";", "return", "true", ";", "}", "protected", "void", "addToResult", "(", "char", "[", "]", "[", "]", "compoundName", ")", "{", "int", "resultLength", "=", "this", ".", "result", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "resultLength", ";", "i", "++", ")", "if", "(", "CharOperation", ".", "equals", "(", "this", ".", "result", "[", "i", "]", ",", "compoundName", ")", ")", "return", ";", "if", "(", "resultLength", "==", "this", ".", "resultIndex", ")", "System", ".", "arraycopy", "(", "this", ".", "result", ",", "0", ",", "this", ".", "result", "=", "new", "char", "[", "resultLength", "*", "2", "]", "[", "]", "[", "]", ",", "0", ",", "resultLength", ")", ";", "this", ".", "result", "[", "this", ".", "resultIndex", "++", "]", "=", "compoundName", ";", "}", "protected", "CompilationUnitDeclaration", "buildBindings", "(", "ICompilationUnit", "compilationUnit", ",", "boolean", "isTopLevelOrMember", ")", "throws", "JavaModelException", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", "sourceUnit", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ")", "compilationUnit", ";", "CompilationResult", "compilationResult", "=", "new", "CompilationResult", "(", "sourceUnit", ",", "1", ",", "1", ",", "0", ")", ";", "CompilationUnitDeclaration", "unit", "=", "isTopLevelOrMember", "?", "this", ".", "locator", ".", "basicParser", "(", ")", ".", "dietParse", "(", "sourceUnit", ",", "compilationResult", ")", ":", "this", ".", "locator", ".", "basicParser", "(", ")", ".", "parse", "(", "sourceUnit", ",", "compilationResult", ")", ";", "if", "(", "unit", "!=", "null", ")", "{", "this", ".", "locator", ".", "lookupEnvironment", ".", "buildTypeBindings", "(", "unit", ",", "null", ")", ";", "this", ".", "locator", ".", "lookupEnvironment", ".", "completeTypeBindings", "(", "unit", ",", "!", "isTopLevelOrMember", ")", ";", "if", "(", "!", "isTopLevelOrMember", ")", "{", "if", "(", "unit", ".", "scope", "!=", "null", ")", "unit", ".", "scope", ".", "faultInTypes", "(", ")", ";", "unit", ".", "resolve", "(", ")", ";", "}", "}", "return", "unit", ";", "}", "public", "char", "[", "]", "[", "]", "[", "]", "collect", "(", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "type", "!=", "null", ")", "{", "this", ".", "result", "=", "new", "char", "[", "1", "]", "[", "]", "[", "]", ";", "this", ".", "resultIndex", "=", "0", ";", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "this", ".", "type", ".", "getJavaProject", "(", ")", ";", "this", ".", "locator", ".", "initialize", "(", "javaProject", ",", "0", ")", ";", "try", "{", "if", "(", "this", ".", "type", ".", "isBinary", "(", ")", ")", "{", "BinaryTypeBinding", "binding", "=", "this", ".", "locator", ".", "cacheBinaryType", "(", "this", ".", "type", ",", "null", ")", ";", "if", "(", "binding", "!=", "null", ")", "collectSuperTypeNames", "(", "binding", ",", "null", ")", ";", "}", "else", "{", "ICompilationUnit", "unit", "=", "this", ".", "type", ".", "getCompilationUnit", "(", ")", ";", "SourceType", "sourceType", "=", "(", "SourceType", ")", "this", ".", "type", ";", "boolean", "isTopLevelOrMember", "=", "sourceType", ".", "getOuterMostLocalContext", "(", ")", "==", "null", ";", "CompilationUnitDeclaration", "parsedUnit", "=", "buildBindings", "(", "unit", ",", "isTopLevelOrMember", ")", ";", "if", "(", "parsedUnit", "!=", "null", ")", "{", "TypeDeclaration", "typeDecl", "=", "new", "ASTNodeFinder", "(", "parsedUnit", ")", ".", "findType", "(", "this", ".", "type", ")", ";", "if", "(", "typeDecl", "!=", "null", "&&", "typeDecl", ".", "binding", "!=", "null", ")", "collectSuperTypeNames", "(", "typeDecl", ".", "binding", ",", "null", ")", ";", "}", "}", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "return", "null", ";", "}", "if", "(", "this", ".", "result", ".", "length", ">", "this", ".", "resultIndex", ")", "System", ".", "arraycopy", "(", "this", ".", "result", ",", "0", ",", "this", ".", "result", "=", "new", "char", "[", "this", ".", "resultIndex", "]", "[", "]", "[", "]", ",", "0", ",", "this", ".", "resultIndex", ")", ";", "return", "this", ".", "result", ";", "}", "String", "[", "]", "paths", "=", "getPathsOfDeclaringType", "(", ")", ";", "if", "(", "paths", "==", "null", ")", "return", "null", ";", "Util", ".", "sort", "(", "paths", ")", ";", "JavaProject", "previousProject", "=", "null", ";", "this", ".", "result", "=", "new", "char", "[", "1", "]", "[", "]", "[", "]", ";", "this", ".", "samePackageSuperTypeName", "=", "new", "char", "[", "1", "]", "[", "]", "[", "]", ";", "this", ".", "resultIndex", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "paths", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "try", "{", "Openable", "openable", "=", "this", ".", "locator", ".", "handleFactory", ".", "createOpenable", "(", "paths", "[", "i", "]", ",", "this", ".", "locator", ".", "scope", ")", ";", "if", "(", "openable", "==", "null", ")", "continue", ";", "IJavaProject", "project", "=", "openable", ".", "getJavaProject", "(", ")", ";", "if", "(", "!", "project", ".", "equals", "(", "previousProject", ")", ")", "{", "previousProject", "=", "(", "JavaProject", ")", "project", ";", "this", ".", "locator", ".", "initialize", "(", "previousProject", ",", "0", ")", ";", "}", "if", "(", "openable", "instanceof", "ICompilationUnit", ")", "{", "ICompilationUnit", "unit", "=", "(", "ICompilationUnit", ")", "openable", ";", "CompilationUnitDeclaration", "parsedUnit", "=", "buildBindings", "(", "unit", ",", "true", ")", ";", "if", "(", "parsedUnit", "!=", "null", ")", "parsedUnit", ".", "traverse", "(", "new", "TypeDeclarationVisitor", "(", ")", ",", "parsedUnit", ".", "scope", ")", ";", "}", "else", "if", "(", "openable", "instanceof", "IClassFile", ")", "{", "IClassFile", "classFile", "=", "(", "IClassFile", ")", "openable", ";", "BinaryTypeBinding", "binding", "=", "this", ".", "locator", ".", "cacheBinaryType", "(", "classFile", ".", "getType", "(", ")", ",", "null", ")", ";", "if", "(", "matches", "(", "binding", ")", ")", "collectSuperTypeNames", "(", "binding", ",", "binding", ".", "compoundName", ")", ";", "}", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "if", "(", "this", ".", "result", ".", "length", ">", "this", ".", "resultIndex", ")", "System", ".", "arraycopy", "(", "this", ".", "result", ",", "0", ",", "this", ".", "result", "=", "new", "char", "[", "this", ".", "resultIndex", "]", "[", "]", "[", "]", ",", "0", ",", "this", ".", "resultIndex", ")", ";", "return", "this", ".", "result", ";", "}", "protected", "void", "collectSuperTypeNames", "(", "ReferenceBinding", "binding", ",", "char", "[", "]", "[", "]", "path", ")", "{", "ReferenceBinding", "superclass", "=", "binding", ".", "superclass", "(", ")", ";", "if", "(", "path", "!=", "null", "&&", "superclass", "!=", "null", ")", "{", "boolean", "samePackage", "=", "addIfSamePackage", "(", "superclass", ".", "compoundName", ",", "path", ")", ";", "if", "(", "!", "samePackage", ")", "path", "=", "null", ";", "}", "if", "(", "superclass", "!=", "null", ")", "{", "addToResult", "(", "superclass", ".", "compoundName", ")", ";", "collectSuperTypeNames", "(", "superclass", ",", "path", ")", ";", "}", "ReferenceBinding", "[", "]", "interfaces", "=", "binding", ".", "superInterfaces", "(", ")", ";", "if", "(", "interfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "interfaces", ".", "length", ";", "i", "++", ")", "{", "ReferenceBinding", "interfaceBinding", "=", "interfaces", "[", "i", "]", ";", "addToResult", "(", "interfaceBinding", ".", "compoundName", ")", ";", "collectSuperTypeNames", "(", "interfaceBinding", ",", "path", ")", ";", "}", "}", "}", "protected", "String", "[", "]", "getPathsOfDeclaringType", "(", ")", "{", "if", "(", "this", ".", "typeQualification", "==", "null", "&&", "this", ".", "typeSimpleName", "==", "null", ")", "return", "null", ";", "final", "PathCollector", "pathCollector", "=", "new", "PathCollector", "(", ")", ";", "IJavaSearchScope", "scope", "=", "SearchEngine", ".", "createWorkspaceScope", "(", ")", ";", "IndexManager", "indexManager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "SearchPattern", "searchPattern", "=", "new", "TypeDeclarationPattern", "(", "this", ".", "typeSimpleName", "!=", "null", "?", "null", ":", "this", ".", "typeQualification", ",", "null", ",", "this", ".", "typeSimpleName", ",", "IIndexConstants", ".", "TYPE_SUFFIX", ",", "this", ".", "pattern", ".", "getMatchRule", "(", ")", ")", ";", "IndexQueryRequestor", "searchRequestor", "=", "new", "IndexQueryRequestor", "(", ")", "{", "public", "boolean", "acceptIndexMatch", "(", "String", "documentPath", ",", "SearchPattern", "indexRecord", ",", "SearchParticipant", "participant", ",", "AccessRuleSet", "access", ")", "{", "TypeDeclarationPattern", "record", "=", "(", "TypeDeclarationPattern", ")", "indexRecord", ";", "if", "(", "record", ".", "enclosingTypeNames", "!=", "IIndexConstants", ".", "ONE_ZERO_CHAR", ")", "{", "pathCollector", ".", "acceptIndexMatch", "(", "documentPath", ",", "indexRecord", ",", "participant", ",", "access", ")", ";", "}", "return", "true", ";", "}", "}", ";", "indexManager", ".", "performConcurrentJob", "(", "new", "PatternSearchJob", "(", "searchPattern", ",", "new", "JavaSearchParticipant", "(", ")", ",", "scope", ",", "searchRequestor", ")", ",", "IJavaSearchConstants", ".", "WAIT_UNTIL_READY_TO_SEARCH", ",", "this", ".", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "this", ".", "progressMonitor", ",", "100", ")", ")", ";", "return", "pathCollector", ".", "getPaths", "(", ")", ";", "}", "public", "char", "[", "]", "[", "]", "[", "]", "getSamePackageSuperTypeNames", "(", ")", "{", "return", "this", ".", "samePackageSuperTypeName", ";", "}", "protected", "boolean", "matches", "(", "char", "[", "]", "[", "]", "compoundName", ")", "{", "int", "length", "=", "compoundName", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "false", ";", "char", "[", "]", "simpleName", "=", "compoundName", "[", "length", "-", "1", "]", ";", "int", "last", "=", "length", "-", "1", ";", "if", "(", "this", ".", "typeSimpleName", "==", "null", "||", "this", ".", "pattern", ".", "matchesName", "(", "simpleName", ",", "this", ".", "typeSimpleName", ")", ")", "{", "char", "[", "]", "[", "]", "qualification", "=", "new", "char", "[", "last", "]", "[", "]", ";", "System", ".", "arraycopy", "(", "compoundName", ",", "0", ",", "qualification", ",", "0", ",", "last", ")", ";", "return", "this", ".", "pattern", ".", "matchesName", "(", "this", ".", "typeQualification", ",", "CharOperation", ".", "concatWith", "(", "qualification", ",", "'.'", ")", ")", ";", "}", "if", "(", "!", "CharOperation", ".", "endsWith", "(", "simpleName", ",", "this", ".", "typeSimpleName", ")", ")", "return", "false", ";", "System", ".", "arraycopy", "(", "compoundName", ",", "0", ",", "compoundName", "=", "new", "char", "[", "length", "+", "1", "]", "[", "]", ",", "0", ",", "last", ")", ";", "int", "dollar", "=", "CharOperation", ".", "indexOf", "(", "'$'", ",", "simpleName", ")", ";", "if", "(", "dollar", "==", "-", "1", ")", "return", "false", ";", "compoundName", "[", "last", "]", "=", "CharOperation", ".", "subarray", "(", "simpleName", ",", "0", ",", "dollar", ")", ";", "compoundName", "[", "length", "]", "=", "CharOperation", ".", "subarray", "(", "simpleName", ",", "dollar", "+", "1", ",", "simpleName", ".", "length", ")", ";", "return", "this", ".", "matches", "(", "compoundName", ")", ";", "}", "protected", "boolean", "matches", "(", "ReferenceBinding", "binding", ")", "{", "return", "binding", "!=", "null", "&&", "binding", ".", "compoundName", "!=", "null", "&&", "this", ".", "matches", "(", "binding", ".", "compoundName", ")", ";", "}", "}", "</s>" ]
2,557
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "*", ";", "public", "class", "TypeDeclarationPattern", "extends", "JavaSearchPattern", "{", "public", "char", "[", "]", "simpleName", ";", "public", "char", "[", "]", "pkg", ";", "public", "char", "[", "]", "[", "]", "enclosingTypeNames", ";", "public", "char", "typeSuffix", ";", "public", "int", "modifiers", ";", "public", "boolean", "secondary", "=", "false", ";", "protected", "static", "char", "[", "]", "[", "]", "CATEGORIES", "=", "{", "TYPE_DECL", "}", ";", "static", "PackageNameSet", "internedPackageNames", "=", "new", "PackageNameSet", "(", "1001", ")", ";", "static", "class", "PackageNameSet", "{", "public", "char", "[", "]", "[", "]", "names", ";", "public", "int", "elementSize", ";", "public", "int", "threshold", ";", "PackageNameSet", "(", "int", "size", ")", "{", "this", ".", "elementSize", "=", "0", ";", "this", ".", "threshold", "=", "size", ";", "int", "extraRoom", "=", "(", "int", ")", "(", "size", "*", "1.5f", ")", ";", "if", "(", "this", ".", "threshold", "==", "extraRoom", ")", "extraRoom", "++", ";", "this", ".", "names", "=", "new", "char", "[", "extraRoom", "]", "[", "]", ";", "}", "char", "[", "]", "add", "(", "char", "[", "]", "name", ")", "{", "int", "length", "=", "this", ".", "names", ".", "length", ";", "int", "index", "=", "CharOperation", ".", "hashCode", "(", "name", ")", "%", "length", ";", "char", "[", "]", "current", ";", "while", "(", "(", "current", "=", "this", ".", "names", "[", "index", "]", ")", "!=", "null", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "current", ",", "name", ")", ")", "return", "current", ";", "if", "(", "++", "index", "==", "length", ")", "index", "=", "0", ";", "}", "this", ".", "names", "[", "index", "]", "=", "name", ";", "if", "(", "++", "this", ".", "elementSize", ">", "this", ".", "threshold", ")", "rehash", "(", ")", ";", "return", "name", ";", "}", "void", "rehash", "(", ")", "{", "PackageNameSet", "newSet", "=", "new", "PackageNameSet", "(", "this", ".", "elementSize", "*", "2", ")", ";", "char", "[", "]", "current", ";", "for", "(", "int", "i", "=", "this", ".", "names", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "if", "(", "(", "current", "=", "this", ".", "names", "[", "i", "]", ")", "!=", "null", ")", "newSet", ".", "add", "(", "current", ")", ";", "this", ".", "names", "=", "newSet", ".", "names", ";", "this", ".", "elementSize", "=", "newSet", ".", "elementSize", ";", "this", ".", "threshold", "=", "newSet", ".", "threshold", ";", "}", "}", "public", "static", "char", "[", "]", "createIndexKey", "(", "int", "modifiers", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "boolean", "secondary", ")", "{", "int", "typeNameLength", "=", "typeName", "==", "null", "?", "0", ":", "typeName", ".", "length", ";", "int", "packageLength", "=", "packageName", "==", "null", "?", "0", ":", "packageName", ".", "length", ";", "int", "enclosingNamesLength", "=", "0", ";", "if", "(", "enclosingTypeNames", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "enclosingTypeNames", ".", "length", ";", "i", "<", "length", ";", ")", "{", "enclosingNamesLength", "+=", "enclosingTypeNames", "[", "i", "]", ".", "length", ";", "if", "(", "++", "i", "<", "length", ")", "enclosingNamesLength", "++", ";", "}", "}", "int", "resultLength", "=", "typeNameLength", "+", "packageLength", "+", "enclosingNamesLength", "+", "5", ";", "if", "(", "secondary", ")", "resultLength", "+=", "2", ";", "char", "[", "]", "result", "=", "new", "char", "[", "resultLength", "]", ";", "int", "pos", "=", "0", ";", "if", "(", "typeNameLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "typeName", ",", "0", ",", "result", ",", "pos", ",", "typeNameLength", ")", ";", "pos", "+=", "typeNameLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "packageLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "packageName", ",", "0", ",", "result", ",", "pos", ",", "packageLength", ")", ";", "pos", "+=", "packageLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "enclosingTypeNames", "!=", "null", "&&", "enclosingNamesLength", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "enclosingTypeNames", ".", "length", ";", "i", "<", "length", ";", ")", "{", "char", "[", "]", "enclosingName", "=", "enclosingTypeNames", "[", "i", "]", ";", "int", "itsLength", "=", "enclosingName", ".", "length", ";", "System", ".", "arraycopy", "(", "enclosingName", ",", "0", ",", "result", ",", "pos", ",", "itsLength", ")", ";", "pos", "+=", "itsLength", ";", "if", "(", "++", "i", "<", "length", ")", "result", "[", "pos", "++", "]", "=", "'.'", ";", "}", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "result", "[", "pos", "++", "]", "=", "(", "char", ")", "modifiers", ";", "result", "[", "pos", "]", "=", "(", "char", ")", "(", "modifiers", ">>", "16", ")", ";", "if", "(", "secondary", ")", "{", "result", "[", "++", "pos", "]", "=", "SEPARATOR", ";", "result", "[", "++", "pos", "]", "=", "'S'", ";", "}", "return", "result", ";", "}", "public", "TypeDeclarationPattern", "(", "char", "[", "]", "pkg", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "char", "[", "]", "simpleName", ",", "char", "typeSuffix", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "this", ".", "pkg", "=", "this", ".", "isCaseSensitive", "?", "pkg", ":", "CharOperation", ".", "toLowerCase", "(", "pkg", ")", ";", "if", "(", "this", ".", "isCaseSensitive", "||", "enclosingTypeNames", "==", "null", ")", "{", "this", ".", "enclosingTypeNames", "=", "enclosingTypeNames", ";", "}", "else", "{", "int", "length", "=", "enclosingTypeNames", ".", "length", ";", "this", ".", "enclosingTypeNames", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "this", ".", "enclosingTypeNames", "[", "i", "]", "=", "CharOperation", ".", "toLowerCase", "(", "enclosingTypeNames", "[", "i", "]", ")", ";", "}", "this", ".", "simpleName", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "simpleName", ":", "CharOperation", ".", "toLowerCase", "(", "simpleName", ")", ";", "this", ".", "typeSuffix", "=", "typeSuffix", ";", "this", ".", "mustResolve", "=", "(", "this", ".", "pkg", "!=", "null", "&&", "this", ".", "enclosingTypeNames", "!=", "null", ")", "||", "typeSuffix", "!=", "TYPE_SUFFIX", ";", "}", "TypeDeclarationPattern", "(", "int", "matchRule", ")", "{", "super", "(", "TYPE_DECL_PATTERN", ",", "matchRule", ")", ";", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "int", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "0", ")", ";", "this", ".", "simpleName", "=", "CharOperation", ".", "subarray", "(", "key", ",", "0", ",", "slash", ")", ";", "int", "start", "=", "++", "slash", ";", "if", "(", "key", "[", "start", "]", "==", "SEPARATOR", ")", "{", "this", ".", "pkg", "=", "CharOperation", ".", "NO_CHAR", ";", "}", "else", "{", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "this", ".", "pkg", "=", "internedPackageNames", ".", "add", "(", "CharOperation", ".", "subarray", "(", "key", ",", "start", ",", "slash", ")", ")", ";", "}", "int", "last", "=", "key", ".", "length", "-", "1", ";", "this", ".", "secondary", "=", "key", "[", "last", "]", "==", "'S'", ";", "if", "(", "this", ".", "secondary", ")", "{", "last", "-=", "2", ";", "}", "this", ".", "modifiers", "=", "key", "[", "last", "-", "1", "]", "+", "(", "key", "[", "last", "]", "<<", "16", ")", ";", "decodeModifiers", "(", ")", ";", "start", "=", "slash", "+", "1", ";", "last", "-=", "2", ";", "if", "(", "start", "==", "last", ")", "{", "this", ".", "enclosingTypeNames", "=", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "else", "{", "if", "(", "last", "==", "(", "start", "+", "1", ")", "&&", "key", "[", "start", "]", "==", "ZERO_CHAR", ")", "{", "this", ".", "enclosingTypeNames", "=", "ONE_ZERO_CHAR", ";", "}", "else", "{", "this", ".", "enclosingTypeNames", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "key", ",", "start", ",", "last", ")", ";", "}", "}", "}", "protected", "void", "decodeModifiers", "(", ")", "{", "switch", "(", "this", ".", "modifiers", "&", "(", "ClassFileConstants", ".", "AccInterface", "|", "ClassFileConstants", ".", "AccEnum", "|", "ClassFileConstants", ".", "AccAnnotation", ")", ")", "{", "case", "ClassFileConstants", ".", "AccAnnotation", ":", "case", "ClassFileConstants", ".", "AccAnnotation", "+", "ClassFileConstants", ".", "AccInterface", ":", "this", ".", "typeSuffix", "=", "ANNOTATION_TYPE_SUFFIX", ";", "break", ";", "case", "ClassFileConstants", ".", "AccEnum", ":", "this", ".", "typeSuffix", "=", "ENUM_SUFFIX", ";", "break", ";", "case", "ClassFileConstants", ".", "AccInterface", ":", "this", ".", "typeSuffix", "=", "INTERFACE_SUFFIX", ";", "break", ";", "default", ":", "this", ".", "typeSuffix", "=", "CLASS_SUFFIX", ";", "break", ";", "}", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "TypeDeclarationPattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "return", "CATEGORIES", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "TypeDeclarationPattern", "pattern", "=", "(", "TypeDeclarationPattern", ")", "decodedPattern", ";", "if", "(", "this", ".", "typeSuffix", "!=", "pattern", ".", "typeSuffix", "&&", "this", ".", "typeSuffix", "!=", "TYPE_SUFFIX", ")", "{", "if", "(", "!", "matchDifferentTypeSuffixes", "(", "this", ".", "typeSuffix", ",", "pattern", ".", "typeSuffix", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "!", "matchesName", "(", "this", ".", "simpleName", ",", "pattern", ".", "simpleName", ")", ")", "return", "false", ";", "if", "(", "this", ".", "pkg", "!=", "null", "&&", "!", "CharOperation", ".", "equals", "(", "this", ".", "pkg", ",", "pattern", ".", "pkg", ",", "isCaseSensitive", "(", ")", ")", ")", "return", "false", ";", "if", "(", "this", ".", "enclosingTypeNames", "!=", "null", ")", "{", "if", "(", "this", ".", "enclosingTypeNames", ".", "length", "==", "0", ")", "return", "pattern", ".", "enclosingTypeNames", ".", "length", "==", "0", ";", "if", "(", "this", ".", "enclosingTypeNames", ".", "length", "==", "1", "&&", "pattern", ".", "enclosingTypeNames", ".", "length", "==", "1", ")", "return", "CharOperation", ".", "equals", "(", "this", ".", "enclosingTypeNames", "[", "0", "]", ",", "pattern", ".", "enclosingTypeNames", "[", "0", "]", ",", "isCaseSensitive", "(", ")", ")", ";", "if", "(", "pattern", ".", "enclosingTypeNames", "==", "ONE_ZERO_CHAR", ")", "return", "true", ";", "return", "CharOperation", ".", "equals", "(", "this", ".", "enclosingTypeNames", ",", "pattern", ".", "enclosingTypeNames", ",", "isCaseSensitive", "(", ")", ")", ";", "}", "return", "true", ";", "}", "public", "EntryResult", "[", "]", "queryIn", "(", "Index", "index", ")", "throws", "IOException", "{", "char", "[", "]", "key", "=", "this", ".", "simpleName", ";", "int", "matchRule", "=", "getMatchRule", "(", ")", ";", "switch", "(", "getMatchMode", "(", ")", ")", "{", "case", "R_PREFIX_MATCH", ":", "break", ";", "case", "R_EXACT_MATCH", ":", "matchRule", "&=", "~", "R_EXACT_MATCH", ";", "if", "(", "this", ".", "simpleName", "!=", "null", ")", "{", "matchRule", "|=", "R_PREFIX_MATCH", ";", "key", "=", "this", ".", "pkg", "==", "null", "?", "CharOperation", ".", "append", "(", "this", ".", "simpleName", ",", "SEPARATOR", ")", ":", "CharOperation", ".", "concat", "(", "this", ".", "simpleName", ",", "SEPARATOR", ",", "this", ".", "pkg", ",", "SEPARATOR", ",", "CharOperation", ".", "NO_CHAR", ")", ";", "break", ";", "}", "matchRule", "|=", "R_PATTERN_MATCH", ";", "case", "R_PATTERN_MATCH", ":", "if", "(", "this", ".", "pkg", "==", "null", ")", "{", "if", "(", "this", ".", "simpleName", "==", "null", ")", "{", "switch", "(", "this", ".", "typeSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "case", "INTERFACE_SUFFIX", ":", "case", "ENUM_SUFFIX", ":", "case", "ANNOTATION_TYPE_SUFFIX", ":", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "case", "CLASS_AND_ENUM_SUFFIX", ":", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "break", ";", "}", "}", "else", "if", "(", "this", ".", "simpleName", "[", "this", ".", "simpleName", ".", "length", "-", "1", "]", "!=", "'*'", ")", "{", "key", "=", "CharOperation", ".", "concat", "(", "this", ".", "simpleName", ",", "ONE_STAR", ",", "SEPARATOR", ")", ";", "}", "break", ";", "}", "key", "=", "CharOperation", ".", "concat", "(", "this", ".", "simpleName", "==", "null", "?", "ONE_STAR", ":", "this", ".", "simpleName", ",", "SEPARATOR", ",", "this", ".", "pkg", ",", "SEPARATOR", ",", "ONE_STAR", ")", ";", "break", ";", "case", "R_REGEXP_MATCH", ":", "break", ";", "case", "R_CAMELCASE_MATCH", ":", "case", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "break", ";", "}", "return", "index", ".", "query", "(", "getIndexCategories", "(", ")", ",", "key", ",", "matchRule", ")", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "switch", "(", "this", ".", "typeSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CLASS_AND_ENUM_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "INTERFACE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "ENUM_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "ANNOTATION_TYPE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "default", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "if", "(", "this", ".", "pkg", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "pkg", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "enclosingTypeNames", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "enclosingTypeNames", ".", "length", ";", "i", "++", ")", "{", "output", ".", "append", "(", "this", ".", "enclosingTypeNames", "[", "i", "]", ")", ";", "if", "(", "i", "<", "this", ".", "enclosingTypeNames", ".", "length", "-", "1", ")", "output", ".", "append", "(", "'.'", ")", ";", "}", "}", "else", "{", "output", ".", "append", "(", "\"*\"", ")", ";", "}", "output", ".", "append", "(", "\">,", "type<\"", ")", ";", "if", "(", "this", ".", "simpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "simpleName", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\">\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,558
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "public", "class", "AndPattern", "extends", "IntersectingPattern", "{", "protected", "SearchPattern", "[", "]", "patterns", ";", "int", "current", ";", "private", "static", "int", "combinedMatchRule", "(", "int", "matchRule", ",", "int", "matchRule2", ")", "{", "int", "combined", "=", "matchRule", "&", "matchRule2", ";", "int", "compatibility", "=", "combined", "&", "MATCH_COMPATIBILITY_MASK", ";", "if", "(", "compatibility", "==", "0", ")", "{", "if", "(", "(", "matchRule", "&", "MATCH_COMPATIBILITY_MASK", ")", "==", "R_FULL_MATCH", ")", "{", "compatibility", "=", "matchRule2", ";", "}", "else", "if", "(", "(", "matchRule2", "&", "MATCH_COMPATIBILITY_MASK", ")", "==", "R_FULL_MATCH", ")", "{", "compatibility", "=", "matchRule", ";", "}", "else", "{", "compatibility", "=", "Math", ".", "min", "(", "matchRule", "&", "MATCH_COMPATIBILITY_MASK", ",", "matchRule2", "&", "MATCH_COMPATIBILITY_MASK", ")", ";", "}", "}", "return", "(", "combined", "&", "(", "R_EXACT_MATCH", "|", "R_PREFIX_MATCH", "|", "R_PATTERN_MATCH", "|", "R_REGEXP_MATCH", ")", ")", "|", "(", "combined", "&", "R_CASE_SENSITIVE", ")", "|", "compatibility", "|", "(", "combined", "&", "(", "R_CAMELCASE_MATCH", "|", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ")", ")", ";", "}", "public", "AndPattern", "(", "SearchPattern", "leftPattern", ",", "SearchPattern", "rightPattern", ")", "{", "super", "(", "AND_PATTERN", ",", "combinedMatchRule", "(", "leftPattern", ".", "getMatchRule", "(", ")", ",", "rightPattern", ".", "getMatchRule", "(", ")", ")", ")", ";", "this", ".", "mustResolve", "=", "leftPattern", ".", "mustResolve", "||", "rightPattern", ".", "mustResolve", ";", "SearchPattern", "[", "]", "leftPatterns", "=", "leftPattern", "instanceof", "AndPattern", "?", "(", "(", "AndPattern", ")", "leftPattern", ")", ".", "patterns", ":", "null", ";", "SearchPattern", "[", "]", "rightPatterns", "=", "rightPattern", "instanceof", "AndPattern", "?", "(", "(", "AndPattern", ")", "rightPattern", ")", ".", "patterns", ":", "null", ";", "int", "leftSize", "=", "leftPatterns", "==", "null", "?", "1", ":", "leftPatterns", ".", "length", ";", "int", "rightSize", "=", "rightPatterns", "==", "null", "?", "1", ":", "rightPatterns", ".", "length", ";", "this", ".", "patterns", "=", "new", "SearchPattern", "[", "leftSize", "+", "rightSize", "]", ";", "if", "(", "leftPatterns", "==", "null", ")", "this", ".", "patterns", "[", "0", "]", "=", "leftPattern", ";", "else", "System", ".", "arraycopy", "(", "leftPatterns", ",", "0", ",", "this", ".", "patterns", ",", "0", ",", "leftSize", ")", ";", "if", "(", "rightPatterns", "==", "null", ")", "this", ".", "patterns", "[", "leftSize", "]", "=", "rightPattern", ";", "else", "System", ".", "arraycopy", "(", "rightPatterns", ",", "0", ",", "this", ".", "patterns", ",", "leftSize", ",", "rightSize", ")", ";", "this", ".", "matchCompatibility", "=", "getMatchRule", "(", ")", "&", "MATCH_COMPATIBILITY_MASK", ";", "this", ".", "current", "=", "0", ";", "}", "public", "SearchPattern", "currentPattern", "(", ")", "{", "return", "this", ".", "patterns", "[", "this", ".", "current", "++", "]", ";", "}", "protected", "boolean", "hasNextQuery", "(", ")", "{", "return", "this", ".", "current", "<", "(", "this", ".", "patterns", ".", "length", "-", "1", ")", ";", "}", "protected", "void", "resetQuery", "(", ")", "{", "this", ".", "current", "=", "0", ";", "}", "}", "</s>" ]
2,559
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IndexQueryRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "public", "class", "OrPattern", "extends", "SearchPattern", "implements", "IIndexConstants", "{", "protected", "SearchPattern", "[", "]", "patterns", ";", "int", "matchCompatibility", ";", "public", "OrPattern", "(", "SearchPattern", "leftPattern", ",", "SearchPattern", "rightPattern", ")", "{", "super", "(", "Math", ".", "max", "(", "leftPattern", ".", "getMatchRule", "(", ")", ",", "rightPattern", ".", "getMatchRule", "(", ")", ")", ")", ";", "this", ".", "kind", "=", "OR_PATTERN", ";", "this", ".", "mustResolve", "=", "leftPattern", ".", "mustResolve", "||", "rightPattern", ".", "mustResolve", ";", "SearchPattern", "[", "]", "leftPatterns", "=", "leftPattern", "instanceof", "OrPattern", "?", "(", "(", "OrPattern", ")", "leftPattern", ")", ".", "patterns", ":", "null", ";", "SearchPattern", "[", "]", "rightPatterns", "=", "rightPattern", "instanceof", "OrPattern", "?", "(", "(", "OrPattern", ")", "rightPattern", ")", ".", "patterns", ":", "null", ";", "int", "leftSize", "=", "leftPatterns", "==", "null", "?", "1", ":", "leftPatterns", ".", "length", ";", "int", "rightSize", "=", "rightPatterns", "==", "null", "?", "1", ":", "rightPatterns", ".", "length", ";", "this", ".", "patterns", "=", "new", "SearchPattern", "[", "leftSize", "+", "rightSize", "]", ";", "if", "(", "leftPatterns", "==", "null", ")", "this", ".", "patterns", "[", "0", "]", "=", "leftPattern", ";", "else", "System", ".", "arraycopy", "(", "leftPatterns", ",", "0", ",", "this", ".", "patterns", ",", "0", ",", "leftSize", ")", ";", "if", "(", "rightPatterns", "==", "null", ")", "this", ".", "patterns", "[", "leftSize", "]", "=", "rightPattern", ";", "else", "System", ".", "arraycopy", "(", "rightPatterns", ",", "0", ",", "this", ".", "patterns", ",", "leftSize", ",", "rightSize", ")", ";", "this", ".", "matchCompatibility", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "matchCompatibility", "|=", "(", "(", "JavaSearchPattern", ")", "this", ".", "patterns", "[", "i", "]", ")", ".", "matchCompatibility", ";", "}", "}", "public", "void", "findIndexMatches", "(", "Index", "index", ",", "IndexQueryRequestor", "requestor", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "IOException", "{", "try", "{", "index", ".", "startQuery", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "this", ".", "patterns", "[", "i", "]", ".", "findIndexMatches", "(", "index", ",", "requestor", ",", "participant", ",", "scope", ",", "progressMonitor", ")", ";", "}", "finally", "{", "index", ".", "stopQuery", "(", ")", ";", "}", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "null", ";", "}", "boolean", "isErasureMatch", "(", ")", "{", "return", "(", "this", ".", "matchCompatibility", "&", "R_ERASURE_MATCH", ")", "!=", "0", ";", "}", "public", "boolean", "isPolymorphicSearch", "(", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "if", "(", "this", ".", "patterns", "[", "i", "]", ".", "isPolymorphicSearch", "(", ")", ")", "return", "true", ";", "return", "false", ";", "}", "public", "final", "boolean", "hasPackageDeclaration", "(", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "patterns", "[", "i", "]", "instanceof", "PackageDeclarationPattern", ")", "return", "true", ";", "}", "return", "false", ";", "}", "public", "final", "boolean", "hasSignatures", "(", ")", "{", "boolean", "isErasureMatch", "=", "isErasureMatch", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patterns", ".", "length", ";", "i", "<", "length", "&&", "!", "isErasureMatch", ";", "i", "++", ")", "{", "if", "(", "(", "(", "JavaSearchPattern", ")", "this", ".", "patterns", "[", "i", "]", ")", ".", "hasSignatures", "(", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "this", ".", "patterns", "[", "0", "]", ".", "toString", "(", ")", ")", ";", "for", "(", "int", "i", "=", "1", ",", "length", "=", "this", ".", "patterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "\"n|", "\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "patterns", "[", "i", "]", ".", "toString", "(", ")", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,560
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "*", ";", "public", "class", "PackageDeclarationPattern", "extends", "JavaSearchPattern", "{", "protected", "char", "[", "]", "pkgName", ";", "public", "PackageDeclarationPattern", "(", "char", "[", "]", "pkgName", ",", "int", "matchRule", ")", "{", "super", "(", "PKG_DECL_PATTERN", ",", "matchRule", ")", ";", "this", ".", "pkgName", "=", "pkgName", ";", "}", "public", "EntryResult", "[", "]", "queryIn", "(", "Index", "index", ")", "{", "return", "null", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "pkgName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "pkgName", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\">\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,561
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "BindingKey", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeParameter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "JavaSearchPattern", "extends", "SearchPattern", "implements", "IIndexConstants", "{", "boolean", "isCaseSensitive", ";", "boolean", "isCamelCase", ";", "int", "matchMode", ";", "int", "matchCompatibility", ";", "public", "int", "fineGrain", "=", "0", ";", "public", "static", "final", "int", "MATCH_MODE_MASK", "=", "R_EXACT_MATCH", "|", "R_PREFIX_MATCH", "|", "R_PATTERN_MATCH", "|", "R_REGEXP_MATCH", "|", "R_CAMELCASE_MATCH", "|", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ";", "public", "static", "final", "int", "MATCH_COMPATIBILITY_MASK", "=", "R_ERASURE_MATCH", "|", "R_EQUIVALENT_MATCH", "|", "R_FULL_MATCH", ";", "char", "[", "]", "[", "]", "typeSignatures", ";", "private", "char", "[", "]", "[", "]", "[", "]", "typeArguments", ";", "private", "int", "flags", "=", "0", ";", "static", "final", "int", "HAS_TYPE_ARGUMENTS", "=", "1", ";", "protected", "JavaSearchPattern", "(", "int", "patternKind", ",", "int", "matchRule", ")", "{", "super", "(", "matchRule", ")", ";", "this", ".", "kind", "=", "patternKind", ";", "int", "rule", "=", "getMatchRule", "(", ")", ";", "this", ".", "isCaseSensitive", "=", "(", "rule", "&", "R_CASE_SENSITIVE", ")", "!=", "0", ";", "this", ".", "isCamelCase", "=", "(", "rule", "&", "(", "R_CAMELCASE_MATCH", "|", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ")", ")", "!=", "0", ";", "this", ".", "matchCompatibility", "=", "rule", "&", "MATCH_COMPATIBILITY_MASK", ";", "this", ".", "matchMode", "=", "rule", "&", "MATCH_MODE_MASK", ";", "}", "public", "static", "String", "getFineGrainFlagString", "(", "final", "int", "fineGrain", ")", "{", "if", "(", "fineGrain", "==", "0", ")", "{", "return", "\"none\"", ";", "}", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "32", ";", "i", "++", ")", "{", "int", "bit", "=", "fineGrain", "&", "(", "1", "<<", "(", "i", "-", "1", ")", ")", ";", "if", "(", "bit", "!=", "0", "&&", "buffer", ".", "length", "(", ")", ">", "0", ")", "buffer", ".", "append", "(", "\"", "|", "\"", ")", ";", "switch", "(", "bit", ")", "{", "case", "IJavaSearchConstants", ".", "FIELD_DECLARATION_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "PARAMETER_DECLARATION_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "SUPERTYPE_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "THROWS_CLAUSE_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "CATCH_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "CLASS_INSTANCE_CREATION_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "RETURN_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "IMPORT_DECLARATION_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "ANNOTATION_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "TYPE_ARGUMENT_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "TYPE_VARIABLE_BOUND_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "WILDCARD_BOUND_TYPE_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "SUPER_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "QUALIFIED_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "THIS_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "IJavaSearchConstants", ".", "IMPLICIT_THIS_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "null", ";", "}", "final", "int", "getMatchMode", "(", ")", "{", "return", "this", ".", "matchMode", ";", "}", "final", "boolean", "isCamelCase", "(", ")", "{", "return", "this", ".", "isCamelCase", ";", "}", "final", "boolean", "isCaseSensitive", "(", ")", "{", "return", "this", ".", "isCaseSensitive", ";", "}", "final", "boolean", "isErasureMatch", "(", ")", "{", "return", "(", "this", ".", "matchCompatibility", "&", "R_ERASURE_MATCH", ")", "!=", "0", ";", "}", "final", "boolean", "isEquivalentMatch", "(", ")", "{", "return", "(", "this", ".", "matchCompatibility", "&", "R_EQUIVALENT_MATCH", ")", "!=", "0", ";", "}", "char", "[", "]", "[", "]", "extractMethodArguments", "(", "IMethod", "method", ")", "{", "if", "(", "method", ".", "isResolved", "(", ")", ")", "{", "BindingKey", "bindingKey", "=", "new", "BindingKey", "(", "method", ".", "getKey", "(", ")", ")", ";", "if", "(", "bindingKey", ".", "isParameterizedMethod", "(", ")", ")", "{", "String", "[", "]", "argumentsSignatures", "=", "bindingKey", ".", "getTypeArguments", "(", ")", ";", "int", "length", "=", "argumentsSignatures", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "char", "[", "]", "[", "]", "methodArguments", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "methodArguments", "[", "i", "]", "=", "argumentsSignatures", "[", "i", "]", ".", "toCharArray", "(", ")", ";", "CharOperation", ".", "replace", "(", "methodArguments", "[", "i", "]", ",", "new", "char", "[", "]", "{", "'$'", ",", "'/'", "}", ",", "'.'", ")", ";", "}", "return", "methodArguments", ";", "}", "}", "return", "null", ";", "}", "try", "{", "ITypeParameter", "[", "]", "parameters", "=", "method", ".", "getTypeParameters", "(", ")", ";", "if", "(", "parameters", "!=", "null", ")", "{", "int", "length", "=", "parameters", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "char", "[", "]", "[", "]", "arguments", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "arguments", "[", "i", "]", "=", "Signature", ".", "createTypeSignature", "(", "parameters", "[", "i", "]", ".", "getElementName", "(", ")", ",", "false", ")", ".", "toCharArray", "(", ")", ";", "}", "return", "arguments", ";", "}", "}", "}", "catch", "(", "JavaModelException", "jme", ")", "{", "}", "return", "null", ";", "}", "final", "char", "[", "]", "[", "]", "[", "]", "getTypeArguments", "(", ")", "{", "return", "this", ".", "typeArguments", ";", "}", "public", "final", "boolean", "hasSignatures", "(", ")", "{", "return", "this", ".", "typeSignatures", "!=", "null", "&&", "this", ".", "typeSignatures", ".", "length", ">", "0", ";", "}", "public", "final", "boolean", "hasTypeArguments", "(", ")", "{", "return", "(", "this", ".", "flags", "&", "HAS_TYPE_ARGUMENTS", ")", "!=", "0", ";", "}", "public", "final", "boolean", "hasTypeParameters", "(", ")", "{", "return", "!", "hasSignatures", "(", ")", "&&", "hasTypeArguments", "(", ")", ";", "}", "boolean", "matchDifferentTypeSuffixes", "(", "int", "typeSuffix", ",", "int", "patternSuffix", ")", "{", "switch", "(", "typeSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "switch", "(", "patternSuffix", ")", "{", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "case", "CLASS_AND_ENUM_SUFFIX", ":", "return", "true", ";", "}", "return", "false", ";", "case", "INTERFACE_SUFFIX", ":", "switch", "(", "patternSuffix", ")", "{", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "return", "true", ";", "}", "return", "false", ";", "case", "ENUM_SUFFIX", ":", "return", "patternSuffix", "==", "CLASS_AND_ENUM_SUFFIX", ";", "case", "ANNOTATION_TYPE_SUFFIX", ":", "return", "patternSuffix", "==", "INTERFACE_AND_ANNOTATION_SUFFIX", ";", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "switch", "(", "patternSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "case", "INTERFACE_SUFFIX", ":", "return", "true", ";", "}", "return", "false", ";", "case", "CLASS_AND_ENUM_SUFFIX", ":", "switch", "(", "patternSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "case", "ENUM_SUFFIX", ":", "return", "true", ";", "}", "return", "false", ";", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "switch", "(", "patternSuffix", ")", "{", "case", "INTERFACE_SUFFIX", ":", "case", "ANNOTATION_TYPE_SUFFIX", ":", "return", "true", ";", "}", "return", "false", ";", "}", "return", "true", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "output", ".", "append", "(", "\",", "\"", ")", ";", "if", "(", "hasTypeArguments", "(", ")", "&&", "hasSignatures", "(", ")", ")", "{", "output", ".", "append", "(", "\"signature:\\\"\"", ")", ";", "output", ".", "append", "(", "this", ".", "typeSignatures", "[", "0", "]", ")", ";", "output", ".", "append", "(", "\"\\\",", "\"", ")", ";", "}", "switch", "(", "getMatchMode", "(", ")", ")", "{", "case", "R_EXACT_MATCH", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "R_PREFIX_MATCH", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "R_PATTERN_MATCH", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "R_REGEXP_MATCH", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "R_CAMELCASE_MATCH", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "if", "(", "isCaseSensitive", "(", ")", ")", "output", ".", "append", "(", "\"\"", ")", ";", "else", "output", ".", "append", "(", "\"\"", ")", ";", "if", "(", "(", "this", ".", "matchCompatibility", "&", "R_FULL_MATCH", ")", "!=", "0", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "}", "if", "(", "(", "this", ".", "matchCompatibility", "&", "R_ERASURE_MATCH", ")", "!=", "0", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "}", "if", "(", "(", "this", ".", "matchCompatibility", "&", "R_EQUIVALENT_MATCH", ")", "!=", "0", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "}", "output", ".", "append", "(", "\"fine", "grain:", "\"", ")", ";", "output", ".", "append", "(", "getFineGrainFlagString", "(", "this", ".", "fineGrain", ")", ")", ";", "return", "output", ";", "}", "final", "void", "setTypeArguments", "(", "char", "[", "]", "[", "]", "[", "]", "typeArguments", ")", "{", "this", ".", "typeArguments", "=", "typeArguments", ";", "if", "(", "this", ".", "typeArguments", "!=", "null", ")", "{", "int", "length", "=", "this", ".", "typeArguments", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "typeArguments", "[", "i", "]", "!=", "null", "&&", "this", ".", "typeArguments", "[", "i", "]", ".", "length", ">", "0", ")", "{", "this", ".", "flags", "|=", "HAS_TYPE_ARGUMENTS", ";", "break", ";", "}", "}", "}", "}", "void", "storeTypeSignaturesAndArguments", "(", "IType", "type", ")", "{", "if", "(", "type", ".", "isResolved", "(", ")", ")", "{", "BindingKey", "bindingKey", "=", "new", "BindingKey", "(", "type", ".", "getKey", "(", ")", ")", ";", "if", "(", "bindingKey", ".", "isParameterizedType", "(", ")", "||", "bindingKey", ".", "isRawType", "(", ")", ")", "{", "String", "signature", "=", "bindingKey", ".", "toSignature", "(", ")", ";", "this", ".", "typeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "signature", ")", ";", "setTypeArguments", "(", "Util", ".", "getAllTypeArguments", "(", "this", ".", "typeSignatures", ")", ")", ";", "}", "return", ";", "}", "char", "[", "]", "[", "]", "[", "]", "typeParameters", "=", "new", "char", "[", "10", "]", "[", "]", "[", "]", ";", "int", "ptr", "=", "-", "1", ";", "boolean", "hasParameters", "=", "false", ";", "try", "{", "IJavaElement", "parent", "=", "type", ";", "ITypeParameter", "[", "]", "parameters", "=", "null", ";", "while", "(", "parent", "!=", "null", "&&", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "if", "(", "++", "ptr", ">", "typeParameters", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "typeParameters", ",", "0", ",", "typeParameters", "=", "new", "char", "[", "typeParameters", ".", "length", "+", "10", "]", "[", "]", "[", "]", ",", "0", ",", "ptr", ")", ";", "}", "IType", "parentType", "=", "(", "IType", ")", "parent", ";", "parameters", "=", "parentType", ".", "getTypeParameters", "(", ")", ";", "if", "(", "parameters", "!=", "null", ")", "{", "int", "length", "=", "parameters", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "hasParameters", "=", "true", ";", "typeParameters", "[", "ptr", "]", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "typeParameters", "[", "ptr", "]", "[", "i", "]", "=", "Signature", ".", "createTypeSignature", "(", "parameters", "[", "i", "]", ".", "getElementName", "(", ")", ",", "false", ")", ".", "toCharArray", "(", ")", ";", "}", "}", "parent", "=", "parent", ".", "getParent", "(", ")", ";", "}", "}", "catch", "(", "JavaModelException", "jme", ")", "{", "return", ";", "}", "if", "(", "hasParameters", ")", "{", "if", "(", "++", "ptr", "<", "typeParameters", ".", "length", ")", "System", ".", "arraycopy", "(", "typeParameters", ",", "0", ",", "typeParameters", "=", "new", "char", "[", "ptr", "]", "[", "]", "[", "]", ",", "0", ",", "ptr", ")", ";", "setTypeArguments", "(", "typeParameters", ")", ";", "}", "}", "public", "final", "String", "toString", "(", ")", "{", "return", "print", "(", "new", "StringBuffer", "(", "30", ")", ")", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,562
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "public", "class", "VariableLocator", "extends", "PatternLocator", "{", "protected", "VariablePattern", "pattern", ";", "public", "VariableLocator", "(", "VariablePattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "}", "public", "int", "match", "(", "Expression", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "this", ".", "pattern", ".", "writeAccess", ")", "{", "if", "(", "this", ".", "pattern", ".", "readAccess", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "node", "instanceof", "Assignment", ")", "{", "Expression", "lhs", "=", "(", "(", "Assignment", ")", "node", ")", ".", "lhs", ";", "if", "(", "lhs", "instanceof", "Reference", ")", "return", "matchReference", "(", "(", "Reference", ")", "lhs", ",", "nodeSet", ",", "true", ")", ";", "}", "}", "else", "if", "(", "this", ".", "pattern", ".", "readAccess", "||", "this", ".", "pattern", ".", "fineGrain", "!=", "0", ")", "{", "if", "(", "node", "instanceof", "Assignment", "&&", "!", "(", "node", "instanceof", "CompoundAssignment", ")", ")", "{", "char", "[", "]", "lastToken", "=", "null", ";", "Expression", "lhs", "=", "(", "(", "Assignment", ")", "node", ")", ".", "lhs", ";", "if", "(", "lhs", "instanceof", "QualifiedNameReference", ")", "{", "char", "[", "]", "[", "]", "tokens", "=", "(", "(", "QualifiedNameReference", ")", "lhs", ")", ".", "tokens", ";", "lastToken", "=", "tokens", "[", "tokens", ".", "length", "-", "1", "]", ";", "}", "if", "(", "lastToken", "==", "null", "||", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "lastToken", ")", ")", "{", "nodeSet", ".", "removePossibleMatch", "(", "lhs", ")", ";", "nodeSet", ".", "removeTrustedMatch", "(", "lhs", ")", ";", "}", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "Reference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "(", "this", ".", "pattern", ".", "readAccess", "||", "this", ".", "pattern", ".", "fineGrain", "!=", "0", ")", "?", "matchReference", "(", "node", ",", "nodeSet", ",", "false", ")", ":", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "matchReference", "(", "Reference", "node", ",", "MatchingNodeSet", "nodeSet", ",", "boolean", "writeOnlyAccess", ")", "{", "if", "(", "node", "instanceof", "NameReference", ")", "{", "if", "(", "this", ".", "pattern", ".", "name", "==", "null", ")", "{", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "else", "if", "(", "node", "instanceof", "SingleNameReference", ")", "{", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "(", "(", "SingleNameReference", ")", "node", ")", ".", "token", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "POSSIBLE_MATCH", ")", ";", "}", "else", "{", "QualifiedNameReference", "qNameRef", "=", "(", "QualifiedNameReference", ")", "node", ";", "char", "[", "]", "[", "]", "tokens", "=", "qNameRef", ".", "tokens", ";", "if", "(", "writeOnlyAccess", ")", "{", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "tokens", "[", "tokens", ".", "length", "-", "1", "]", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "POSSIBLE_MATCH", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "tokens", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "tokens", "[", "i", "]", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "POSSIBLE_MATCH", ")", ";", "}", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,563
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ParameterizedGenericMethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ParameterizedMethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ParameterizedTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ";", "public", "class", "ConstructorLocator", "extends", "PatternLocator", "{", "protected", "ConstructorPattern", "pattern", ";", "public", "ConstructorLocator", "(", "ConstructorPattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "}", "public", "int", "match", "(", "ASTNode", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "findReferences", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "(", "node", "instanceof", "ExplicitConstructorCall", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "matchParametersCount", "(", "node", ",", "(", "(", "ExplicitConstructorCall", ")", "node", ")", ".", "arguments", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "public", "int", "match", "(", "ConstructorDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "referencesLevel", "=", "this", ".", "pattern", ".", "findReferences", "?", "matchLevelForReferences", "(", "node", ")", ":", "IMPOSSIBLE_MATCH", ";", "int", "declarationsLevel", "=", "this", ".", "pattern", ".", "findDeclarations", "?", "matchLevelForDeclarations", "(", "node", ")", ":", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "referencesLevel", ">=", "declarationsLevel", "?", "referencesLevel", ":", "declarationsLevel", ")", ";", "}", "public", "int", "match", "(", "Expression", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "findReferences", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "(", "node", "instanceof", "AllocationExpression", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "AllocationExpression", "allocation", "=", "(", "AllocationExpression", ")", "node", ";", "char", "[", "]", "[", "]", "typeName", "=", "allocation", ".", "type", ".", "getTypeName", "(", ")", ";", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "!=", "null", "&&", "!", "matchesName", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "typeName", "[", "typeName", ".", "length", "-", "1", "]", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "matchParametersCount", "(", "node", ",", "allocation", ".", "arguments", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "public", "int", "match", "(", "FieldDeclaration", "field", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "findReferences", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "field", ".", "type", "!=", "null", "||", "!", "(", "field", ".", "initialization", "instanceof", "AllocationExpression", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "AllocationExpression", "allocation", "=", "(", "AllocationExpression", ")", "field", ".", "initialization", ";", "if", "(", "field", ".", "binding", "!=", "null", "&&", "field", ".", "binding", ".", "declaringClass", "!=", "null", ")", "{", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "!=", "null", "&&", "!", "matchesName", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "field", ".", "binding", ".", "declaringClass", ".", "sourceName", "(", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "if", "(", "!", "matchParametersCount", "(", "field", ",", "allocation", ".", "arguments", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "field", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "public", "int", "match", "(", "MessageSend", "msgSend", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "(", "msgSend", ".", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "==", "0", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "==", "null", "||", "CharOperation", ".", "equals", "(", "msgSend", ".", "selector", ",", "this", ".", "pattern", ".", "declaringSimpleName", ")", ")", "{", "return", "nodeSet", ".", "addMatch", "(", "msgSend", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "TypeDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "this", ".", "pattern", ".", "findReferences", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "protected", "int", "matchConstructor", "(", "MethodBinding", "constructor", ")", "{", "if", "(", "!", "constructor", ".", "isConstructor", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "int", "level", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "constructor", ".", "declaringClass", ")", ";", "if", "(", "level", "==", "IMPOSSIBLE_MATCH", ")", "return", "IMPOSSIBLE_MATCH", ";", "int", "parameterCount", "=", "this", ".", "pattern", ".", "parameterCount", ";", "if", "(", "parameterCount", ">", "-", "1", ")", "{", "if", "(", "constructor", ".", "parameters", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "parameterCount", "!=", "constructor", ".", "parameters", ".", "length", ")", "return", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameterCount", ";", "i", "++", ")", "{", "int", "newLevel", "=", "resolveLevelForType", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "[", "i", "]", ",", "this", ".", "pattern", ".", "parameterQualifications", "[", "i", "]", ",", "constructor", ".", "parameters", "[", "i", "]", ")", ";", "if", "(", "level", ">", "newLevel", ")", "{", "if", "(", "newLevel", "==", "IMPOSSIBLE_MATCH", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "level", "=", "newLevel", ";", "}", "}", "}", "return", "level", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "return", "ALL_CONTAINER", ";", "return", "CLASS_CONTAINER", ";", "}", "protected", "int", "matchLevelForReferences", "(", "ConstructorDeclaration", "constructor", ")", "{", "ExplicitConstructorCall", "constructorCall", "=", "constructor", ".", "constructorCall", ";", "if", "(", "constructorCall", "==", "null", "||", "constructorCall", ".", "accessMode", "!=", "ExplicitConstructorCall", ".", "ImplicitSuper", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "!=", "null", ")", "{", "int", "length", "=", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ";", "Expression", "[", "]", "args", "=", "constructorCall", ".", "arguments", ";", "int", "argsLength", "=", "args", "==", "null", "?", "0", ":", "args", ".", "length", ";", "if", "(", "length", "!=", "argsLength", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "return", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "}", "protected", "int", "matchLevelForDeclarations", "(", "ConstructorDeclaration", "constructor", ")", "{", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "!=", "null", "&&", "!", "matchesName", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "constructor", ".", "selector", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "!=", "null", ")", "{", "int", "length", "=", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ";", "Argument", "[", "]", "args", "=", "constructor", ".", "arguments", ";", "int", "argsLength", "=", "args", "==", "null", "?", "0", ":", "args", ".", "length", ";", "if", "(", "length", "!=", "argsLength", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "if", "(", "this", ".", "pattern", ".", "hasConstructorArguments", "(", ")", ")", "{", "if", "(", "constructor", ".", "typeParameters", "==", "null", "||", "constructor", ".", "typeParameters", ".", "length", "!=", "this", ".", "pattern", ".", "constructorArguments", ".", "length", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "return", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "}", "boolean", "matchParametersCount", "(", "ASTNode", "node", ",", "Expression", "[", "]", "args", ")", "{", "if", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "!=", "null", "&&", "(", "!", "this", ".", "pattern", ".", "varargs", "||", "(", "(", "node", ".", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "!=", "0", ")", ")", ")", "{", "int", "length", "=", "this", ".", "pattern", ".", "parameterCount", ";", "if", "(", "length", "<", "0", ")", "length", "=", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ";", "int", "argsLength", "=", "args", "==", "null", "?", "0", ":", "args", ".", "length", ";", "if", "(", "length", "!=", "argsLength", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "MethodBinding", "constructorBinding", "=", "null", ";", "boolean", "isSynthetic", "=", "false", ";", "if", "(", "reference", "instanceof", "ExplicitConstructorCall", ")", "{", "ExplicitConstructorCall", "call", "=", "(", "ExplicitConstructorCall", ")", "reference", ";", "isSynthetic", "=", "call", ".", "isImplicitSuper", "(", ")", ";", "constructorBinding", "=", "call", ".", "binding", ";", "}", "else", "if", "(", "reference", "instanceof", "AllocationExpression", ")", "{", "AllocationExpression", "alloc", "=", "(", "AllocationExpression", ")", "reference", ";", "constructorBinding", "=", "alloc", ".", "binding", ";", "}", "else", "if", "(", "reference", "instanceof", "TypeDeclaration", "||", "reference", "instanceof", "FieldDeclaration", ")", "{", "super", ".", "matchReportReference", "(", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "if", "(", "this", ".", "match", "!=", "null", ")", "return", ";", "}", "this", ".", "match", "=", "locator", ".", "newMethodReferenceMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "-", "1", ",", "-", "1", ",", "true", ",", "isSynthetic", ",", "reference", ")", ";", "if", "(", "constructorBinding", "instanceof", "ParameterizedGenericMethodBinding", ")", "{", "ParameterizedGenericMethodBinding", "parameterizedMethodBinding", "=", "(", "ParameterizedGenericMethodBinding", ")", "constructorBinding", ";", "this", ".", "match", ".", "setRaw", "(", "parameterizedMethodBinding", ".", "isRaw", ")", ";", "TypeBinding", "[", "]", "typeBindings", "=", "parameterizedMethodBinding", ".", "isRaw", "?", "null", ":", "parameterizedMethodBinding", ".", "typeArguments", ";", "updateMatch", "(", "typeBindings", ",", "locator", ",", "this", ".", "pattern", ".", "constructorArguments", ",", "this", ".", "pattern", ".", "hasConstructorParameters", "(", ")", ")", ";", "if", "(", "constructorBinding", ".", "declaringClass", ".", "isParameterizedType", "(", ")", "||", "constructorBinding", ".", "declaringClass", ".", "isRawType", "(", ")", ")", "{", "ParameterizedTypeBinding", "parameterizedBinding", "=", "(", "ParameterizedTypeBinding", ")", "constructorBinding", ".", "declaringClass", ";", "if", "(", "!", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", "&&", "this", ".", "pattern", ".", "hasConstructorArguments", "(", ")", "||", "parameterizedBinding", ".", "isParameterizedWithOwnVariables", "(", ")", ")", "{", "}", "else", "if", "(", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", "&&", "!", "this", ".", "pattern", ".", "hasConstructorArguments", "(", ")", ")", "{", "updateMatch", "(", "parameterizedBinding", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "this", ".", "pattern", ".", "hasTypeParameters", "(", ")", ",", "0", ",", "locator", ")", ";", "}", "else", "{", "updateMatch", "(", "parameterizedBinding", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "this", ".", "pattern", ".", "hasTypeParameters", "(", ")", ",", "0", ",", "locator", ")", ";", "}", "}", "else", "if", "(", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "}", "else", "if", "(", "constructorBinding", "instanceof", "ParameterizedMethodBinding", ")", "{", "if", "(", "constructorBinding", ".", "declaringClass", ".", "isParameterizedType", "(", ")", "||", "constructorBinding", ".", "declaringClass", ".", "isRawType", "(", ")", ")", "{", "ParameterizedTypeBinding", "parameterizedBinding", "=", "(", "ParameterizedTypeBinding", ")", "constructorBinding", ".", "declaringClass", ";", "if", "(", "!", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", "&&", "this", ".", "pattern", ".", "hasConstructorArguments", "(", ")", ")", "{", "updateMatch", "(", "parameterizedBinding", ",", "new", "char", "[", "]", "[", "]", "[", "]", "{", "this", ".", "pattern", ".", "constructorArguments", "}", ",", "this", ".", "pattern", ".", "hasTypeParameters", "(", ")", ",", "0", ",", "locator", ")", ";", "}", "else", "if", "(", "!", "parameterizedBinding", ".", "isParameterizedWithOwnVariables", "(", ")", ")", "{", "updateMatch", "(", "parameterizedBinding", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "this", ".", "pattern", ".", "hasTypeParameters", "(", ")", ",", "0", ",", "locator", ")", ";", "}", "}", "else", "if", "(", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "}", "else", "if", "(", "this", ".", "pattern", ".", "hasConstructorArguments", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "if", "(", "this", ".", "match", ".", "getRule", "(", ")", "==", "0", ")", "return", ";", "boolean", "report", "=", "(", "this", ".", "isErasureMatch", "&&", "this", ".", "match", ".", "isErasure", "(", ")", ")", "||", "(", "this", ".", "isEquivalentMatch", "&&", "this", ".", "match", ".", "isEquivalent", "(", ")", ")", "||", "this", ".", "match", ".", "isExact", "(", ")", ";", "if", "(", "!", "report", ")", "return", ";", "int", "offset", "=", "reference", ".", "sourceStart", ";", "this", ".", "match", ".", "setOffset", "(", "offset", ")", ";", "this", ".", "match", ".", "setLength", "(", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ")", ";", "if", "(", "reference", "instanceof", "FieldDeclaration", ")", "{", "FieldDeclaration", "enumConstant", "=", "(", "FieldDeclaration", ")", "reference", ";", "if", "(", "enumConstant", ".", "initialization", "instanceof", "QualifiedAllocationExpression", ")", "{", "locator", ".", "reportAccurateEnumConstructorReference", "(", "this", ".", "match", ",", "enumConstant", ",", "(", "QualifiedAllocationExpression", ")", "enumConstant", ".", "initialization", ")", ";", "return", ";", "}", "}", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "public", "SearchMatch", "newDeclarationMatch", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "binding", ",", "int", "accuracy", ",", "int", "length", ",", "MatchLocator", "locator", ")", "{", "this", ".", "match", "=", "null", ";", "int", "offset", "=", "reference", ".", "sourceStart", ";", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "if", "(", "reference", "instanceof", "TypeDeclaration", ")", "{", "TypeDeclaration", "type", "=", "(", "TypeDeclaration", ")", "reference", ";", "AbstractMethodDeclaration", "[", "]", "methods", "=", "type", ".", "methods", ";", "if", "(", "methods", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "methods", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "AbstractMethodDeclaration", "method", "=", "methods", "[", "i", "]", ";", "boolean", "synthetic", "=", "method", ".", "isDefaultConstructor", "(", ")", "&&", "method", ".", "sourceStart", "<", "type", ".", "bodyStart", ";", "this", ".", "match", "=", "locator", ".", "newMethodReferenceMatch", "(", "element", ",", "binding", ",", "accuracy", ",", "offset", ",", "length", ",", "method", ".", "isConstructor", "(", ")", ",", "synthetic", ",", "method", ")", ";", "}", "}", "}", "else", "if", "(", "reference", "instanceof", "ConstructorDeclaration", ")", "{", "ConstructorDeclaration", "constructor", "=", "(", "ConstructorDeclaration", ")", "reference", ";", "ExplicitConstructorCall", "call", "=", "constructor", ".", "constructorCall", ";", "boolean", "synthetic", "=", "call", "!=", "null", "&&", "call", ".", "isImplicitSuper", "(", ")", ";", "this", ".", "match", "=", "locator", ".", "newMethodReferenceMatch", "(", "element", ",", "binding", ",", "accuracy", ",", "offset", ",", "length", ",", "constructor", ".", "isConstructor", "(", ")", ",", "synthetic", ",", "constructor", ")", ";", "}", "}", "if", "(", "this", ".", "match", "!=", "null", ")", "{", "return", "this", ".", "match", ";", "}", "return", "locator", ".", "newDeclarationMatch", "(", "element", ",", "binding", ",", "accuracy", ",", "reference", ".", "sourceStart", ",", "length", ")", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "node", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "if", "(", "node", "instanceof", "AllocationExpression", ")", "return", "resolveLevel", "(", "(", "AllocationExpression", ")", "node", ")", ";", "if", "(", "node", "instanceof", "ExplicitConstructorCall", ")", "return", "resolveLevel", "(", "(", "(", "ExplicitConstructorCall", ")", "node", ")", ".", "binding", ")", ";", "if", "(", "node", "instanceof", "TypeDeclaration", ")", "return", "resolveLevel", "(", "(", "TypeDeclaration", ")", "node", ")", ";", "if", "(", "node", "instanceof", "FieldDeclaration", ")", "return", "resolveLevel", "(", "(", "FieldDeclaration", ")", "node", ")", ";", "if", "(", "node", "instanceof", "JavadocMessageSend", ")", "{", "return", "resolveLevel", "(", "(", "(", "JavadocMessageSend", ")", "node", ")", ".", "binding", ")", ";", "}", "}", "if", "(", "node", "instanceof", "ConstructorDeclaration", ")", "return", "resolveLevel", "(", "(", "ConstructorDeclaration", ")", "node", ",", "true", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "IJavaElement", ".", "METHOD", ";", "}", "protected", "int", "resolveLevel", "(", "AllocationExpression", "allocation", ")", "{", "char", "[", "]", "[", "]", "typeName", "=", "allocation", ".", "type", ".", "getTypeName", "(", ")", ";", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "!=", "null", "&&", "!", "matchesName", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "typeName", "[", "typeName", ".", "length", "-", "1", "]", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "resolveLevel", "(", "allocation", ".", "binding", ")", ";", "}", "protected", "int", "resolveLevel", "(", "FieldDeclaration", "field", ")", "{", "if", "(", "field", ".", "type", "!=", "null", "||", "field", ".", "binding", "==", "null", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "declaringSimpleName", "!=", "null", "&&", "!", "matchesName", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "field", ".", "binding", ".", "type", ".", "sourceName", "(", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "!", "(", "field", ".", "initialization", "instanceof", "AllocationExpression", ")", "||", "field", ".", "initialization", ".", "resolvedType", ".", "isLocalType", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "resolveLevel", "(", "(", "(", "AllocationExpression", ")", "field", ".", "initialization", ")", ".", "binding", ")", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "!", "(", "binding", "instanceof", "MethodBinding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "MethodBinding", "constructor", "=", "(", "MethodBinding", ")", "binding", ";", "int", "level", "=", "matchConstructor", "(", "constructor", ")", ";", "if", "(", "level", "==", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "constructor", "!=", "constructor", ".", "original", "(", ")", ")", "{", "level", "=", "matchConstructor", "(", "constructor", ".", "original", "(", ")", ")", ";", "}", "}", "return", "level", ";", "}", "protected", "int", "resolveLevel", "(", "ConstructorDeclaration", "constructor", ",", "boolean", "checkDeclarations", ")", "{", "int", "referencesLevel", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "ExplicitConstructorCall", "constructorCall", "=", "constructor", ".", "constructorCall", ";", "if", "(", "constructorCall", "!=", "null", "&&", "constructorCall", ".", "accessMode", "==", "ExplicitConstructorCall", ".", "ImplicitSuper", ")", "{", "int", "callCount", "=", "(", "constructorCall", ".", "arguments", "==", "null", ")", "?", "0", ":", "constructorCall", ".", "arguments", ".", "length", ";", "int", "patternCount", "=", "(", "this", ".", "pattern", ".", "parameterSimpleNames", "==", "null", ")", "?", "0", ":", "this", ".", "pattern", ".", "parameterSimpleNames", ".", "length", ";", "if", "(", "patternCount", "!=", "callCount", ")", "{", "referencesLevel", "=", "IMPOSSIBLE_MATCH", ";", "}", "else", "{", "referencesLevel", "=", "resolveLevel", "(", "constructorCall", ".", "binding", ")", ";", "if", "(", "referencesLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "}", "}", "}", "if", "(", "!", "checkDeclarations", ")", "return", "referencesLevel", ";", "int", "declarationsLevel", "=", "this", ".", "pattern", ".", "findDeclarations", "?", "resolveLevel", "(", "constructor", ".", "binding", ")", ":", "IMPOSSIBLE_MATCH", ";", "return", "referencesLevel", ">=", "declarationsLevel", "?", "referencesLevel", ":", "declarationsLevel", ";", "}", "protected", "int", "resolveLevel", "(", "TypeDeclaration", "type", ")", "{", "AbstractMethodDeclaration", "[", "]", "methods", "=", "type", ".", "methods", ";", "if", "(", "methods", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "methods", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "AbstractMethodDeclaration", "method", "=", "methods", "[", "i", "]", ";", "if", "(", "method", ".", "isDefaultConstructor", "(", ")", "&&", "method", ".", "sourceStart", "<", "type", ".", "bodyStart", ")", "return", "resolveLevel", "(", "(", "ConstructorDeclaration", ")", "method", ",", "false", ")", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,564
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "public", "class", "DeclarationOfReferencedMethodsPattern", "extends", "MethodPattern", "{", "protected", "IJavaElement", "enclosingElement", ";", "protected", "SimpleSet", "knownMethods", ";", "public", "DeclarationOfReferencedMethodsPattern", "(", "IJavaElement", "enclosingElement", ")", "{", "super", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "IJavaSearchConstants", ".", "REFERENCES", ",", "R_PATTERN_MATCH", ")", ";", "this", ".", "enclosingElement", "=", "enclosingElement", ";", "this", ".", "knownMethods", "=", "new", "SimpleSet", "(", ")", ";", "this", ".", "mustResolve", "=", "true", ";", "}", "}", "</s>" ]
2,565
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "EntryResult", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "public", "class", "SecondaryTypeDeclarationPattern", "extends", "TypeDeclarationPattern", "{", "private", "final", "static", "char", "[", "]", "SECONDARY_PATTERN_KEY", "=", "\"*/S\"", ".", "toCharArray", "(", ")", ";", "public", "SecondaryTypeDeclarationPattern", "(", ")", "{", "super", "(", "null", ",", "null", ",", "null", ",", "IIndexConstants", ".", "SECONDARY_SUFFIX", ",", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "SecondaryTypeDeclarationPattern", "(", "int", "matchRule", ")", "{", "super", "(", "matchRule", ")", ";", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "SecondaryTypeDeclarationPattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "output", ".", "append", "(", "\"Secondary\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "public", "EntryResult", "[", "]", "queryIn", "(", "Index", "index", ")", "throws", "IOException", "{", "return", "index", ".", "query", "(", "CATEGORIES", ",", "SECONDARY_PATTERN_KEY", ",", "R_PATTERN_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "}", "</s>" ]
2,566
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "public", "class", "PackageReferencePattern", "extends", "IntersectingPattern", "{", "protected", "char", "[", "]", "pkgName", ";", "protected", "char", "[", "]", "[", "]", "segments", ";", "protected", "int", "currentSegment", ";", "protected", "static", "char", "[", "]", "[", "]", "CATEGORIES", "=", "{", "REF", "}", ";", "public", "PackageReferencePattern", "(", "char", "[", "]", "pkgName", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "if", "(", "pkgName", "==", "null", "||", "pkgName", ".", "length", "==", "0", ")", "{", "this", ".", "pkgName", "=", "null", ";", "this", ".", "segments", "=", "new", "char", "[", "]", "[", "]", "{", "CharOperation", ".", "NO_CHAR", "}", ";", "this", ".", "mustResolve", "=", "false", ";", "}", "else", "{", "this", ".", "pkgName", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "pkgName", ":", "CharOperation", ".", "toLowerCase", "(", "pkgName", ")", ";", "this", ".", "segments", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "this", ".", "pkgName", ")", ";", "this", ".", "mustResolve", "=", "true", ";", "}", "}", "PackageReferencePattern", "(", "int", "matchRule", ")", "{", "super", "(", "PKG_REF_PATTERN", ",", "matchRule", ")", ";", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "this", ".", "pkgName", "=", "key", ";", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "PackageReferencePattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "getIndexKey", "(", ")", "{", "if", "(", "this", ".", "currentSegment", ">=", "0", ")", "return", "this", ".", "segments", "[", "this", ".", "currentSegment", "]", ";", "return", "null", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "return", "CATEGORIES", ";", "}", "protected", "boolean", "hasNextQuery", "(", ")", "{", "return", "--", "this", ".", "currentSegment", ">=", "(", "this", ".", "segments", ".", "length", ">=", "4", "?", "2", ":", "0", ")", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "return", "true", ";", "}", "protected", "void", "resetQuery", "(", ")", "{", "this", ".", "currentSegment", "=", "this", ".", "segments", ".", "length", "-", "1", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "pkgName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "pkgName", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\">\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,567
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "FieldInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "MethodInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "public", "class", "ClassFileMatchLocator", "implements", "IIndexConstants", "{", "private", "static", "final", "long", "TARGET_ANNOTATION_BITS", "=", "TagBits", ".", "AnnotationForType", "|", "TagBits", ".", "AnnotationForParameter", "|", "TagBits", ".", "AnnotationForPackage", "|", "TagBits", ".", "AnnotationForMethod", "|", "TagBits", ".", "AnnotationForLocalVariable", "|", "TagBits", ".", "AnnotationForField", "|", "TagBits", ".", "AnnotationForConstructor", "|", "TagBits", ".", "AnnotationForAnnotationType", ";", "private", "static", "final", "char", "[", "]", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", "=", "CharOperation", ".", "concatWith", "(", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ",", "'.'", ")", ";", "public", "static", "char", "[", "]", "convertClassFileFormat", "(", "char", "[", "]", "name", ")", "{", "return", "CharOperation", ".", "replaceOnCopy", "(", "name", ",", "'/'", ",", "'.'", ")", ";", "}", "private", "boolean", "checkAnnotation", "(", "IBinaryAnnotation", "annotation", ",", "TypeReferencePattern", "pattern", ")", "{", "if", "(", "checkTypeName", "(", "pattern", ".", "simpleName", ",", "pattern", ".", "qualification", ",", "convertClassFileFormat", "(", "Signature", ".", "toCharArray", "(", "annotation", ".", "getTypeName", "(", ")", ")", ")", ",", "pattern", ".", "isCaseSensitive", ",", "pattern", ".", "isCamelCase", ")", ")", "{", "return", "true", ";", "}", "IBinaryElementValuePair", "[", "]", "valuePairs", "=", "annotation", ".", "getElementValuePairs", "(", ")", ";", "if", "(", "valuePairs", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ",", "vpLength", "=", "valuePairs", ".", "length", ";", "j", "<", "vpLength", ";", "j", "++", ")", "{", "IBinaryElementValuePair", "valuePair", "=", "valuePairs", "[", "j", "]", ";", "Object", "pairValue", "=", "valuePair", ".", "getValue", "(", ")", ";", "if", "(", "pairValue", "instanceof", "IBinaryAnnotation", ")", "{", "if", "(", "checkAnnotation", "(", "(", "IBinaryAnnotation", ")", "pairValue", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "}", "}", "return", "false", ";", "}", "private", "boolean", "checkAnnotations", "(", "TypeReferencePattern", "pattern", ",", "IBinaryAnnotation", "[", "]", "annotations", ",", "long", "tagBits", ")", "{", "if", "(", "annotations", "!=", "null", ")", "{", "for", "(", "int", "a", "=", "0", ",", "length", "=", "annotations", ".", "length", ";", "a", "<", "length", ";", "a", "++", ")", "{", "IBinaryAnnotation", "annotation", "=", "annotations", "[", "a", "]", ";", "if", "(", "checkAnnotation", "(", "annotation", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AllStandardAnnotationsMask", ")", "!=", "0", "&&", "checkStandardAnnotations", "(", "tagBits", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}", "private", "boolean", "checkAnnotationTypeReference", "(", "char", "[", "]", "fullyQualifiedName", ",", "TypeReferencePattern", "pattern", ")", "{", "return", "checkTypeName", "(", "pattern", ".", "simpleName", ",", "pattern", ".", "qualification", ",", "fullyQualifiedName", ",", "pattern", ".", "isCaseSensitive", ",", "pattern", ".", "isCamelCase", ")", ";", "}", "private", "boolean", "checkDeclaringType", "(", "IBinaryType", "enclosingBinaryType", ",", "char", "[", "]", "simpleName", ",", "char", "[", "]", "qualification", ",", "boolean", "isCaseSensitive", ",", "boolean", "isCamelCase", ")", "{", "if", "(", "simpleName", "==", "null", "&&", "qualification", "==", "null", ")", "return", "true", ";", "if", "(", "enclosingBinaryType", "==", "null", ")", "return", "true", ";", "char", "[", "]", "declaringTypeName", "=", "convertClassFileFormat", "(", "enclosingBinaryType", ".", "getName", "(", ")", ")", ";", "return", "checkTypeName", "(", "simpleName", ",", "qualification", ",", "declaringTypeName", ",", "isCaseSensitive", ",", "isCamelCase", ")", ";", "}", "private", "boolean", "checkParameters", "(", "char", "[", "]", "methodDescriptor", ",", "char", "[", "]", "[", "]", "parameterSimpleNames", ",", "char", "[", "]", "[", "]", "parameterQualifications", ",", "boolean", "isCaseSensitive", ",", "boolean", "isCamelCase", ")", "{", "char", "[", "]", "[", "]", "arguments", "=", "Signature", ".", "getParameterTypes", "(", "methodDescriptor", ")", ";", "int", "parameterCount", "=", "parameterSimpleNames", ".", "length", ";", "if", "(", "parameterCount", "!=", "arguments", ".", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameterCount", ";", "i", "++", ")", "if", "(", "!", "checkTypeName", "(", "parameterSimpleNames", "[", "i", "]", ",", "parameterQualifications", "[", "i", "]", ",", "Signature", ".", "toCharArray", "(", "arguments", "[", "i", "]", ")", ",", "isCaseSensitive", ",", "isCamelCase", ")", ")", "return", "false", ";", "return", "true", ";", "}", "private", "boolean", "checkStandardAnnotations", "(", "long", "annotationTagBits", ",", "TypeReferencePattern", "pattern", ")", "{", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AllStandardAnnotationsMask", ")", "==", "0", ")", "{", "return", "false", ";", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationTargetMASK", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_TARGET", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", "||", "(", "(", "annotationTagBits", "&", "TARGET_ANNOTATION_BITS", ")", "!=", "0", "&&", "checkAnnotationTypeReference", "(", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ",", "pattern", ")", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationRetentionMASK", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_RETENTION", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", "||", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_RETENTIONPOLICY", ",", "'.'", ")", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationDeprecated", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_DEPRECATED", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationDocumented", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_DOCUMENTED", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationInherited", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_INHERITED", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationOverride", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_OVERRIDE", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationSuppressWarnings", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_SUPPRESSWARNINGS", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationSafeVarargs", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_SAFEVARARGS", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "(", "annotationTagBits", "&", "TagBits", ".", "AnnotationPolymorphicSignature", ")", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "TypeConstants", ".", "JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE", ";", "if", "(", "checkAnnotationTypeReference", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ",", "pattern", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "private", "boolean", "checkTypeName", "(", "char", "[", "]", "simpleName", ",", "char", "[", "]", "qualification", ",", "char", "[", "]", "fullyQualifiedTypeName", ",", "boolean", "isCaseSensitive", ",", "boolean", "isCamelCase", ")", "{", "char", "[", "]", "wildcardPattern", "=", "PatternLocator", ".", "qualifiedPattern", "(", "simpleName", ",", "qualification", ")", ";", "if", "(", "wildcardPattern", "==", "null", ")", "return", "true", ";", "return", "CharOperation", ".", "match", "(", "wildcardPattern", ",", "fullyQualifiedTypeName", ",", "isCaseSensitive", ")", ";", "}", "public", "void", "locateMatches", "(", "MatchLocator", "locator", ",", "ClassFile", "classFile", ",", "IBinaryType", "info", ")", "throws", "CoreException", "{", "SearchPattern", "pattern", "=", "locator", ".", "pattern", ";", "matchAnnotations", "(", "pattern", ",", "locator", ",", "classFile", ",", "info", ")", ";", "BinaryType", "binaryType", "=", "(", "BinaryType", ")", "classFile", ".", "getType", "(", ")", ";", "if", "(", "matchBinary", "(", "pattern", ",", "info", ",", "null", ")", ")", "{", "binaryType", "=", "new", "ResolvedBinaryType", "(", "(", "JavaElement", ")", "binaryType", ".", "getParent", "(", ")", ",", "binaryType", ".", "getElementName", "(", ")", ",", "binaryType", ".", "getKey", "(", ")", ")", ";", "locator", ".", "reportBinaryMemberDeclaration", "(", "null", ",", "binaryType", ",", "null", ",", "info", ",", "SearchMatch", ".", "A_ACCURATE", ")", ";", "return", ";", "}", "IBinaryMethod", "[", "]", "binaryMethods", "=", "info", ".", "getMethods", "(", ")", ";", "int", "bMethodsLength", "=", "binaryMethods", "==", "null", "?", "0", ":", "binaryMethods", ".", "length", ";", "IBinaryMethod", "[", "]", "unresolvedMethods", "=", "null", ";", "char", "[", "]", "[", "]", "binaryMethodSignatures", "=", "null", ";", "boolean", "hasUnresolvedMethods", "=", "false", ";", "IBinaryField", "[", "]", "binaryFields", "=", "info", ".", "getFields", "(", ")", ";", "int", "bFieldsLength", "=", "binaryFields", "==", "null", "?", "0", ":", "binaryFields", ".", "length", ";", "IBinaryField", "[", "]", "unresolvedFields", "=", "null", ";", "boolean", "hasUnresolvedFields", "=", "false", ";", "int", "accuracy", "=", "SearchMatch", ".", "A_ACCURATE", ";", "boolean", "mustResolve", "=", "pattern", ".", "mustResolve", ";", "if", "(", "mustResolve", ")", "{", "BinaryTypeBinding", "binding", "=", "locator", ".", "cacheBinaryType", "(", "binaryType", ",", "info", ")", ";", "if", "(", "binding", "!=", "null", ")", "{", "if", "(", "!", "locator", ".", "typeInHierarchy", "(", "binding", ")", ")", "return", ";", "MethodBinding", "[", "]", "availableMethods", "=", "binding", ".", "availableMethods", "(", ")", ";", "int", "aMethodsLength", "=", "availableMethods", "==", "null", "?", "0", ":", "availableMethods", ".", "length", ";", "hasUnresolvedMethods", "=", "bMethodsLength", "!=", "aMethodsLength", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "aMethodsLength", ";", "i", "++", ")", "{", "MethodBinding", "method", "=", "availableMethods", "[", "i", "]", ";", "char", "[", "]", "methodSignature", "=", "method", ".", "genericSignature", "(", ")", ";", "if", "(", "methodSignature", "==", "null", ")", "methodSignature", "=", "method", ".", "signature", "(", ")", ";", "int", "level", "=", "locator", ".", "patternLocator", ".", "resolveLevel", "(", "method", ")", ";", "if", "(", "level", "!=", "PatternLocator", ".", "IMPOSSIBLE_MATCH", ")", "{", "IMethod", "methodHandle", "=", "binaryType", ".", "getMethod", "(", "new", "String", "(", "method", ".", "isConstructor", "(", ")", "?", "binding", ".", "compoundName", "[", "binding", ".", "compoundName", ".", "length", "-", "1", "]", ":", "method", ".", "selector", ")", ",", "CharOperation", ".", "toStrings", "(", "Signature", ".", "getParameterTypes", "(", "convertClassFileFormat", "(", "methodSignature", ")", ")", ")", ")", ";", "accuracy", "=", "level", "==", "PatternLocator", ".", "ACCURATE_MATCH", "?", "SearchMatch", ".", "A_ACCURATE", ":", "SearchMatch", ".", "A_INACCURATE", ";", "locator", ".", "reportBinaryMemberDeclaration", "(", "null", ",", "methodHandle", ",", "method", ",", "info", ",", "accuracy", ")", ";", "}", "if", "(", "hasUnresolvedMethods", ")", "{", "if", "(", "binaryMethodSignatures", "==", "null", ")", "{", "binaryMethodSignatures", "=", "new", "char", "[", "bMethodsLength", "]", "[", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "bMethodsLength", ";", "j", "++", ")", "{", "IBinaryMethod", "binaryMethod", "=", "binaryMethods", "[", "j", "]", ";", "char", "[", "]", "signature", "=", "binaryMethod", ".", "getGenericSignature", "(", ")", ";", "if", "(", "signature", "==", "null", ")", "signature", "=", "binaryMethod", ".", "getMethodDescriptor", "(", ")", ";", "binaryMethodSignatures", "[", "j", "]", "=", "signature", ";", "}", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "bMethodsLength", ";", "j", "++", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "binaryMethods", "[", "j", "]", ".", "getSelector", "(", ")", ",", "method", ".", "selector", ")", "&&", "CharOperation", ".", "equals", "(", "binaryMethodSignatures", "[", "j", "]", ",", "methodSignature", ")", ")", "{", "if", "(", "unresolvedMethods", "==", "null", ")", "{", "System", ".", "arraycopy", "(", "binaryMethods", ",", "0", ",", "unresolvedMethods", "=", "new", "IBinaryMethod", "[", "bMethodsLength", "]", ",", "0", ",", "bMethodsLength", ")", ";", "}", "unresolvedMethods", "[", "j", "]", "=", "null", ";", "break", ";", "}", "}", "}", "}", "FieldBinding", "[", "]", "availableFields", "=", "binding", ".", "availableFields", "(", ")", ";", "int", "aFieldsLength", "=", "availableFields", "==", "null", "?", "0", ":", "availableFields", ".", "length", ";", "hasUnresolvedFields", "=", "bFieldsLength", "!=", "aFieldsLength", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "aFieldsLength", ";", "i", "++", ")", "{", "FieldBinding", "field", "=", "availableFields", "[", "i", "]", ";", "int", "level", "=", "locator", ".", "patternLocator", ".", "resolveLevel", "(", "field", ")", ";", "if", "(", "level", "!=", "PatternLocator", ".", "IMPOSSIBLE_MATCH", ")", "{", "IField", "fieldHandle", "=", "binaryType", ".", "getField", "(", "new", "String", "(", "field", ".", "name", ")", ")", ";", "accuracy", "=", "level", "==", "PatternLocator", ".", "ACCURATE_MATCH", "?", "SearchMatch", ".", "A_ACCURATE", ":", "SearchMatch", ".", "A_INACCURATE", ";", "locator", ".", "reportBinaryMemberDeclaration", "(", "null", ",", "fieldHandle", ",", "field", ",", "info", ",", "accuracy", ")", ";", "}", "if", "(", "hasUnresolvedFields", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "bFieldsLength", ";", "j", "++", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "binaryFields", "[", "j", "]", ".", "getName", "(", ")", ",", "field", ".", "name", ")", ")", "{", "if", "(", "unresolvedFields", "==", "null", ")", "{", "System", ".", "arraycopy", "(", "binaryFields", ",", "0", ",", "unresolvedFields", "=", "new", "IBinaryField", "[", "bFieldsLength", "]", ",", "0", ",", "bFieldsLength", ")", ";", "}", "unresolvedFields", "[", "j", "]", "=", "null", ";", "break", ";", "}", "}", "}", "}", "if", "(", "!", "hasUnresolvedMethods", "&&", "!", "hasUnresolvedFields", ")", "{", "return", ";", "}", "}", "accuracy", "=", "SearchMatch", ".", "A_INACCURATE", ";", "}", "if", "(", "mustResolve", ")", "binaryMethods", "=", "unresolvedMethods", ";", "bMethodsLength", "=", "binaryMethods", "==", "null", "?", "0", ":", "binaryMethods", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bMethodsLength", ";", "i", "++", ")", "{", "IBinaryMethod", "method", "=", "binaryMethods", "[", "i", "]", ";", "if", "(", "method", "==", "null", ")", "continue", ";", "if", "(", "matchBinary", "(", "pattern", ",", "method", ",", "info", ")", ")", "{", "char", "[", "]", "name", ";", "if", "(", "method", ".", "isConstructor", "(", ")", ")", "{", "name", "=", "info", ".", "getSourceName", "(", ")", ";", "}", "else", "{", "name", "=", "method", ".", "getSelector", "(", ")", ";", "}", "String", "selector", "=", "new", "String", "(", "name", ")", ";", "char", "[", "]", "methodSignature", "=", "binaryMethodSignatures", "==", "null", "?", "null", ":", "binaryMethodSignatures", "[", "i", "]", ";", "if", "(", "methodSignature", "==", "null", ")", "{", "methodSignature", "=", "method", ".", "getGenericSignature", "(", ")", ";", "if", "(", "methodSignature", "==", "null", ")", "methodSignature", "=", "method", ".", "getMethodDescriptor", "(", ")", ";", "}", "String", "[", "]", "parameterTypes", "=", "CharOperation", ".", "toStrings", "(", "Signature", ".", "getParameterTypes", "(", "convertClassFileFormat", "(", "methodSignature", ")", ")", ")", ";", "IMethod", "methodHandle", "=", "binaryType", ".", "getMethod", "(", "selector", ",", "parameterTypes", ")", ";", "methodHandle", "=", "new", "ResolvedBinaryMethod", "(", "binaryType", ",", "selector", ",", "parameterTypes", ",", "methodHandle", ".", "getKey", "(", ")", ")", ";", "locator", ".", "reportBinaryMemberDeclaration", "(", "null", ",", "methodHandle", ",", "null", ",", "info", ",", "accuracy", ")", ";", "}", "}", "if", "(", "mustResolve", ")", "binaryFields", "=", "unresolvedFields", ";", "bFieldsLength", "=", "binaryFields", "==", "null", "?", "0", ":", "binaryFields", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bFieldsLength", ";", "i", "++", ")", "{", "IBinaryField", "field", "=", "binaryFields", "[", "i", "]", ";", "if", "(", "field", "==", "null", ")", "continue", ";", "if", "(", "matchBinary", "(", "pattern", ",", "field", ",", "info", ")", ")", "{", "String", "fieldName", "=", "new", "String", "(", "field", ".", "getName", "(", ")", ")", ";", "IField", "fieldHandle", "=", "binaryType", ".", "getField", "(", "fieldName", ")", ";", "fieldHandle", "=", "new", "ResolvedBinaryField", "(", "binaryType", ",", "fieldName", ",", "fieldHandle", ".", "getKey", "(", ")", ")", ";", "locator", ".", "reportBinaryMemberDeclaration", "(", "null", ",", "fieldHandle", ",", "null", ",", "info", ",", "accuracy", ")", ";", "}", "}", "}", "private", "void", "matchAnnotations", "(", "SearchPattern", "pattern", ",", "MatchLocator", "locator", ",", "ClassFile", "classFile", ",", "IBinaryType", "binaryType", ")", "throws", "CoreException", "{", "switch", "(", "pattern", ".", "kind", ")", "{", "case", "TYPE_REF_PATTERN", ":", "break", ";", "case", "OR_PATTERN", ":", "SearchPattern", "[", "]", "patterns", "=", "(", "(", "OrPattern", ")", "pattern", ")", ".", "patterns", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "patterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "matchAnnotations", "(", "patterns", "[", "i", "]", ",", "locator", ",", "classFile", ",", "binaryType", ")", ";", "}", "default", ":", "return", ";", "}", "TypeReferencePattern", "typeReferencePattern", "=", "(", "TypeReferencePattern", ")", "pattern", ";", "IBinaryAnnotation", "[", "]", "annotations", "=", "binaryType", ".", "getAnnotations", "(", ")", ";", "BinaryType", "classFileBinaryType", "=", "(", "BinaryType", ")", "classFile", ".", "getType", "(", ")", ";", "BinaryTypeBinding", "binaryTypeBinding", "=", "null", ";", "if", "(", "checkAnnotations", "(", "typeReferencePattern", ",", "annotations", ",", "binaryType", ".", "getTagBits", "(", ")", ")", ")", "{", "classFileBinaryType", "=", "new", "ResolvedBinaryType", "(", "(", "JavaElement", ")", "classFileBinaryType", ".", "getParent", "(", ")", ",", "classFileBinaryType", ".", "getElementName", "(", ")", ",", "classFileBinaryType", ".", "getKey", "(", ")", ")", ";", "TypeReferenceMatch", "match", "=", "new", "TypeReferenceMatch", "(", "classFileBinaryType", ",", "SearchMatch", ".", "A_ACCURATE", ",", "-", "1", ",", "0", ",", "false", ",", "locator", ".", "getParticipant", "(", ")", ",", "locator", ".", "currentPossibleMatch", ".", "resource", ")", ";", "match", ".", "setLocalElement", "(", "null", ")", ";", "locator", ".", "report", "(", "match", ")", ";", "}", "MethodInfo", "[", "]", "methods", "=", "(", "MethodInfo", "[", "]", ")", "binaryType", ".", "getMethods", "(", ")", ";", "if", "(", "methods", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "methods", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "MethodInfo", "method", "=", "methods", "[", "i", "]", ";", "if", "(", "checkAnnotations", "(", "typeReferencePattern", ",", "method", ".", "getAnnotations", "(", ")", ",", "method", ".", "getTagBits", "(", ")", ")", ")", "{", "binaryTypeBinding", "=", "locator", ".", "cacheBinaryType", "(", "classFileBinaryType", ",", "binaryType", ")", ";", "IMethod", "methodHandle", "=", "classFileBinaryType", ".", "getMethod", "(", "new", "String", "(", "method", ".", "isConstructor", "(", ")", "?", "binaryTypeBinding", ".", "compoundName", "[", "binaryTypeBinding", ".", "compoundName", ".", "length", "-", "1", "]", ":", "method", ".", "getSelector", "(", ")", ")", ",", "CharOperation", ".", "toStrings", "(", "Signature", ".", "getParameterTypes", "(", "convertClassFileFormat", "(", "method", ".", "getMethodDescriptor", "(", ")", ")", ")", ")", ")", ";", "TypeReferenceMatch", "match", "=", "new", "TypeReferenceMatch", "(", "methodHandle", ",", "SearchMatch", ".", "A_ACCURATE", ",", "-", "1", ",", "0", ",", "false", ",", "locator", ".", "getParticipant", "(", ")", ",", "locator", ".", "currentPossibleMatch", ".", "resource", ")", ";", "match", ".", "setLocalElement", "(", "null", ")", ";", "locator", ".", "report", "(", "match", ")", ";", "}", "}", "}", "FieldInfo", "[", "]", "fields", "=", "(", "FieldInfo", "[", "]", ")", "binaryType", ".", "getFields", "(", ")", ";", "if", "(", "fields", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "fields", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "FieldInfo", "field", "=", "fields", "[", "i", "]", ";", "if", "(", "checkAnnotations", "(", "typeReferencePattern", ",", "field", ".", "getAnnotations", "(", ")", ",", "field", ".", "getTagBits", "(", ")", ")", ")", "{", "IField", "fieldHandle", "=", "classFileBinaryType", ".", "getField", "(", "new", "String", "(", "field", ".", "getName", "(", ")", ")", ")", ";", "TypeReferenceMatch", "match", "=", "new", "TypeReferenceMatch", "(", "fieldHandle", ",", "SearchMatch", ".", "A_ACCURATE", ",", "-", "1", ",", "0", ",", "false", ",", "locator", ".", "getParticipant", "(", ")", ",", "locator", ".", "currentPossibleMatch", ".", "resource", ")", ";", "match", ".", "setLocalElement", "(", "null", ")", ";", "locator", ".", "report", "(", "match", ")", ";", "}", "}", "}", "}", "boolean", "matchBinary", "(", "SearchPattern", "pattern", ",", "Object", "binaryInfo", ",", "IBinaryType", "enclosingBinaryType", ")", "{", "switch", "(", "pattern", ".", "kind", ")", "{", "case", "CONSTRUCTOR_PATTERN", ":", "return", "matchConstructor", "(", "(", "ConstructorPattern", ")", "pattern", ",", "binaryInfo", ",", "enclosingBinaryType", ")", ";", "case", "FIELD_PATTERN", ":", "return", "matchField", "(", "(", "FieldPattern", ")", "pattern", ",", "binaryInfo", ",", "enclosingBinaryType", ")", ";", "case", "METHOD_PATTERN", ":", "return", "matchMethod", "(", "(", "MethodPattern", ")", "pattern", ",", "binaryInfo", ",", "enclosingBinaryType", ")", ";", "case", "SUPER_REF_PATTERN", ":", "return", "matchSuperTypeReference", "(", "(", "SuperTypeReferencePattern", ")", "pattern", ",", "binaryInfo", ",", "enclosingBinaryType", ")", ";", "case", "TYPE_DECL_PATTERN", ":", "return", "matchTypeDeclaration", "(", "(", "TypeDeclarationPattern", ")", "pattern", ",", "binaryInfo", ",", "enclosingBinaryType", ")", ";", "case", "OR_PATTERN", ":", "SearchPattern", "[", "]", "patterns", "=", "(", "(", "OrPattern", ")", "pattern", ")", ".", "patterns", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "patterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "if", "(", "matchBinary", "(", "patterns", "[", "i", "]", ",", "binaryInfo", ",", "enclosingBinaryType", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "boolean", "matchConstructor", "(", "ConstructorPattern", "pattern", ",", "Object", "binaryInfo", ",", "IBinaryType", "enclosingBinaryType", ")", "{", "if", "(", "!", "pattern", ".", "findDeclarations", ")", "return", "false", ";", "if", "(", "!", "(", "binaryInfo", "instanceof", "IBinaryMethod", ")", ")", "return", "false", ";", "IBinaryMethod", "method", "=", "(", "IBinaryMethod", ")", "binaryInfo", ";", "if", "(", "!", "method", ".", "isConstructor", "(", ")", ")", "return", "false", ";", "if", "(", "!", "checkDeclaringType", "(", "enclosingBinaryType", ",", "pattern", ".", "declaringSimpleName", ",", "pattern", ".", "declaringQualification", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "false", ";", "if", "(", "pattern", ".", "parameterSimpleNames", "!=", "null", ")", "{", "char", "[", "]", "methodDescriptor", "=", "convertClassFileFormat", "(", "method", ".", "getMethodDescriptor", "(", ")", ")", ";", "if", "(", "!", "checkParameters", "(", "methodDescriptor", ",", "pattern", ".", "parameterSimpleNames", ",", "pattern", ".", "parameterQualifications", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "boolean", "matchField", "(", "FieldPattern", "pattern", ",", "Object", "binaryInfo", ",", "IBinaryType", "enclosingBinaryType", ")", "{", "if", "(", "!", "pattern", ".", "findDeclarations", ")", "return", "false", ";", "if", "(", "!", "(", "binaryInfo", "instanceof", "IBinaryField", ")", ")", "return", "false", ";", "IBinaryField", "field", "=", "(", "IBinaryField", ")", "binaryInfo", ";", "if", "(", "!", "pattern", ".", "matchesName", "(", "pattern", ".", "name", ",", "field", ".", "getName", "(", ")", ")", ")", "return", "false", ";", "if", "(", "!", "checkDeclaringType", "(", "enclosingBinaryType", ",", "pattern", ".", "declaringSimpleName", ",", "pattern", ".", "declaringQualification", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "false", ";", "char", "[", "]", "fieldTypeSignature", "=", "Signature", ".", "toCharArray", "(", "convertClassFileFormat", "(", "field", ".", "getTypeName", "(", ")", ")", ")", ";", "return", "checkTypeName", "(", "pattern", ".", "typeSimpleName", ",", "pattern", ".", "typeQualification", ",", "fieldTypeSignature", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ";", "}", "boolean", "matchMethod", "(", "MethodPattern", "pattern", ",", "Object", "binaryInfo", ",", "IBinaryType", "enclosingBinaryType", ")", "{", "if", "(", "!", "pattern", ".", "findDeclarations", ")", "return", "false", ";", "if", "(", "!", "(", "binaryInfo", "instanceof", "IBinaryMethod", ")", ")", "return", "false", ";", "IBinaryMethod", "method", "=", "(", "IBinaryMethod", ")", "binaryInfo", ";", "if", "(", "!", "pattern", ".", "matchesName", "(", "pattern", ".", "selector", ",", "method", ".", "getSelector", "(", ")", ")", ")", "return", "false", ";", "if", "(", "!", "checkDeclaringType", "(", "enclosingBinaryType", ",", "pattern", ".", "declaringSimpleName", ",", "pattern", ".", "declaringQualification", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "false", ";", "boolean", "checkReturnType", "=", "pattern", ".", "declaringSimpleName", "==", "null", "&&", "(", "pattern", ".", "returnSimpleName", "!=", "null", "||", "pattern", ".", "returnQualification", "!=", "null", ")", ";", "boolean", "checkParameters", "=", "pattern", ".", "parameterSimpleNames", "!=", "null", ";", "if", "(", "checkReturnType", "||", "checkParameters", ")", "{", "char", "[", "]", "methodDescriptor", "=", "convertClassFileFormat", "(", "method", ".", "getMethodDescriptor", "(", ")", ")", ";", "if", "(", "checkReturnType", ")", "{", "char", "[", "]", "returnTypeSignature", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getReturnType", "(", "methodDescriptor", ")", ")", ";", "if", "(", "!", "checkTypeName", "(", "pattern", ".", "returnSimpleName", ",", "pattern", ".", "returnQualification", ",", "returnTypeSignature", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "false", ";", "}", "if", "(", "checkParameters", "&&", "!", "checkParameters", "(", "methodDescriptor", ",", "pattern", ".", "parameterSimpleNames", ",", "pattern", ".", "parameterQualifications", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "boolean", "matchSuperTypeReference", "(", "SuperTypeReferencePattern", "pattern", ",", "Object", "binaryInfo", ",", "IBinaryType", "enclosingBinaryType", ")", "{", "if", "(", "!", "(", "binaryInfo", "instanceof", "IBinaryType", ")", ")", "return", "false", ";", "IBinaryType", "type", "=", "(", "IBinaryType", ")", "binaryInfo", ";", "if", "(", "pattern", ".", "superRefKind", "!=", "SuperTypeReferencePattern", ".", "ONLY_SUPER_INTERFACES", ")", "{", "char", "[", "]", "vmName", "=", "type", ".", "getSuperclassName", "(", ")", ";", "if", "(", "vmName", "!=", "null", ")", "{", "char", "[", "]", "superclassName", "=", "convertClassFileFormat", "(", "vmName", ")", ";", "if", "(", "checkTypeName", "(", "pattern", ".", "superSimpleName", ",", "pattern", ".", "superQualification", ",", "superclassName", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "true", ";", "}", "}", "if", "(", "pattern", ".", "superRefKind", "!=", "SuperTypeReferencePattern", ".", "ONLY_SUPER_CLASSES", ")", "{", "char", "[", "]", "[", "]", "superInterfaces", "=", "type", ".", "getInterfaceNames", "(", ")", ";", "if", "(", "superInterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "superInterfaces", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "char", "[", "]", "superInterfaceName", "=", "convertClassFileFormat", "(", "superInterfaces", "[", "i", "]", ")", ";", "if", "(", "checkTypeName", "(", "pattern", ".", "superSimpleName", ",", "pattern", ".", "superQualification", ",", "superInterfaceName", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "boolean", "matchTypeDeclaration", "(", "TypeDeclarationPattern", "pattern", ",", "Object", "binaryInfo", ",", "IBinaryType", "enclosingBinaryType", ")", "{", "if", "(", "!", "(", "binaryInfo", "instanceof", "IBinaryType", ")", ")", "return", "false", ";", "IBinaryType", "type", "=", "(", "IBinaryType", ")", "binaryInfo", ";", "char", "[", "]", "fullyQualifiedTypeName", "=", "convertClassFileFormat", "(", "type", ".", "getName", "(", ")", ")", ";", "boolean", "qualifiedPattern", "=", "pattern", "instanceof", "QualifiedTypeDeclarationPattern", ";", "if", "(", "pattern", ".", "enclosingTypeNames", "==", "null", "||", "qualifiedPattern", ")", "{", "char", "[", "]", "simpleName", "=", "(", "pattern", ".", "getMatchMode", "(", ")", "==", "SearchPattern", ".", "R_PREFIX_MATCH", ")", "?", "CharOperation", ".", "concat", "(", "pattern", ".", "simpleName", ",", "IIndexConstants", ".", "ONE_STAR", ")", ":", "pattern", ".", "simpleName", ";", "char", "[", "]", "pkg", "=", "qualifiedPattern", "?", "(", "(", "QualifiedTypeDeclarationPattern", ")", "pattern", ")", ".", "qualification", ":", "pattern", ".", "pkg", ";", "if", "(", "!", "checkTypeName", "(", "simpleName", ",", "pkg", ",", "fullyQualifiedTypeName", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "false", ";", "}", "else", "{", "char", "[", "]", "enclosingTypeName", "=", "CharOperation", ".", "concatWith", "(", "pattern", ".", "enclosingTypeNames", ",", "'.'", ")", ";", "char", "[", "]", "patternString", "=", "pattern", ".", "pkg", "==", "null", "?", "enclosingTypeName", ":", "CharOperation", ".", "concat", "(", "pattern", ".", "pkg", ",", "enclosingTypeName", ",", "'.'", ")", ";", "if", "(", "!", "checkTypeName", "(", "pattern", ".", "simpleName", ",", "patternString", ",", "fullyQualifiedTypeName", ",", "pattern", ".", "isCaseSensitive", "(", ")", ",", "pattern", ".", "isCamelCase", "(", ")", ")", ")", "return", "false", ";", "}", "int", "kind", "=", "TypeDeclaration", ".", "kind", "(", "type", ".", "getModifiers", "(", ")", ")", ";", "switch", "(", "pattern", ".", "typeSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "return", "kind", "==", "TypeDeclaration", ".", "CLASS_DECL", ";", "case", "INTERFACE_SUFFIX", ":", "return", "kind", "==", "TypeDeclaration", ".", "INTERFACE_DECL", ";", "case", "ENUM_SUFFIX", ":", "return", "kind", "==", "TypeDeclaration", ".", "ENUM_DECL", ";", "case", "ANNOTATION_TYPE_SUFFIX", ":", "return", "kind", "==", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ";", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "return", "kind", "==", "TypeDeclaration", ".", "CLASS_DECL", "||", "kind", "==", "TypeDeclaration", ".", "INTERFACE_DECL", ";", "case", "CLASS_AND_ENUM_SUFFIX", ":", "return", "kind", "==", "TypeDeclaration", ".", "CLASS_DECL", "||", "kind", "==", "TypeDeclaration", ".", "ENUM_DECL", ";", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "return", "kind", "==", "TypeDeclaration", ".", "INTERFACE_DECL", "||", "kind", "==", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ";", "case", "TYPE_SUFFIX", ":", "}", "return", "true", ";", "}", "}", "</s>" ]
2,568
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "*", ";", "public", "class", "SuperTypeReferencePattern", "extends", "JavaSearchPattern", "{", "public", "char", "[", "]", "superQualification", ";", "public", "char", "[", "]", "superSimpleName", ";", "public", "char", "superClassOrInterface", ";", "public", "char", "typeSuffix", ";", "public", "char", "[", "]", "pkgName", ";", "public", "char", "[", "]", "simpleName", ";", "public", "char", "[", "]", "enclosingTypeName", ";", "public", "char", "classOrInterface", ";", "public", "int", "modifiers", ";", "public", "char", "[", "]", "[", "]", "typeParameterSignatures", ";", "protected", "int", "superRefKind", ";", "public", "static", "final", "int", "ALL_SUPER_TYPES", "=", "0", ";", "public", "static", "final", "int", "ONLY_SUPER_INTERFACES", "=", "1", ";", "public", "static", "final", "int", "ONLY_SUPER_CLASSES", "=", "2", ";", "protected", "static", "char", "[", "]", "[", "]", "CATEGORIES", "=", "{", "SUPER_REF", "}", ";", "public", "static", "char", "[", "]", "createIndexKey", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "char", "[", "]", "[", "]", "typeParameterSignatures", ",", "char", "classOrInterface", ",", "char", "[", "]", "superTypeName", ",", "char", "superClassOrInterface", ")", "{", "if", "(", "superTypeName", "==", "null", ")", "superTypeName", "=", "OBJECT", ";", "char", "[", "]", "superSimpleName", "=", "CharOperation", ".", "lastSegment", "(", "superTypeName", ",", "'.'", ")", ";", "char", "[", "]", "superQualification", "=", "null", ";", "if", "(", "superSimpleName", "!=", "superTypeName", ")", "{", "int", "length", "=", "superTypeName", ".", "length", "-", "superSimpleName", ".", "length", "-", "1", ";", "superQualification", "=", "new", "char", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "superTypeName", ",", "0", ",", "superQualification", ",", "0", ",", "length", ")", ";", "}", "char", "[", "]", "superTypeSourceName", "=", "CharOperation", ".", "lastSegment", "(", "superSimpleName", ",", "'$'", ")", ";", "if", "(", "superTypeSourceName", "!=", "superSimpleName", ")", "{", "int", "start", "=", "superQualification", "==", "null", "?", "0", ":", "superQualification", ".", "length", "+", "1", ";", "int", "prefixLength", "=", "superSimpleName", ".", "length", "-", "superTypeSourceName", ".", "length", ";", "char", "[", "]", "mangledQualification", "=", "new", "char", "[", "start", "+", "prefixLength", "]", ";", "if", "(", "superQualification", "!=", "null", ")", "{", "System", ".", "arraycopy", "(", "superQualification", ",", "0", ",", "mangledQualification", ",", "0", ",", "start", "-", "1", ")", ";", "mangledQualification", "[", "start", "-", "1", "]", "=", "'.'", ";", "}", "System", ".", "arraycopy", "(", "superSimpleName", ",", "0", ",", "mangledQualification", ",", "start", ",", "prefixLength", ")", ";", "superQualification", "=", "mangledQualification", ";", "superSimpleName", "=", "superTypeSourceName", ";", "}", "char", "[", "]", "simpleName", "=", "CharOperation", ".", "lastSegment", "(", "typeName", ",", "'.'", ")", ";", "char", "[", "]", "enclosingTypeName", "=", "CharOperation", ".", "concatWith", "(", "enclosingTypeNames", ",", "'$'", ")", ";", "if", "(", "superQualification", "!=", "null", "&&", "CharOperation", ".", "equals", "(", "superQualification", ",", "packageName", ")", ")", "packageName", "=", "ONE_ZERO", ";", "char", "[", "]", "typeParameters", "=", "CharOperation", ".", "NO_CHAR", ";", "int", "typeParametersLength", "=", "0", ";", "if", "(", "typeParameterSignatures", "!=", "null", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "typeParameterSignatures", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "[", "]", "typeParameter", "=", "typeParameterSignatures", "[", "i", "]", ";", "buffer", ".", "append", "(", "typeParameter", ")", ";", "typeParametersLength", "+=", "typeParameter", ".", "length", ";", "if", "(", "i", "!=", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "','", ")", ";", "typeParametersLength", "++", ";", "}", "}", "typeParameters", "=", "new", "char", "[", "typeParametersLength", "]", ";", "buffer", ".", "getChars", "(", "0", ",", "typeParametersLength", ",", "typeParameters", ",", "0", ")", ";", "}", "int", "superLength", "=", "superSimpleName", "==", "null", "?", "0", ":", "superSimpleName", ".", "length", ";", "int", "superQLength", "=", "superQualification", "==", "null", "?", "0", ":", "superQualification", ".", "length", ";", "int", "simpleLength", "=", "simpleName", "==", "null", "?", "0", ":", "simpleName", ".", "length", ";", "int", "enclosingLength", "=", "enclosingTypeName", "==", "null", "?", "0", ":", "enclosingTypeName", ".", "length", ";", "int", "packageLength", "=", "packageName", "==", "null", "?", "0", ":", "packageName", ".", "length", ";", "char", "[", "]", "result", "=", "new", "char", "[", "superLength", "+", "superQLength", "+", "simpleLength", "+", "enclosingLength", "+", "typeParametersLength", "+", "packageLength", "+", "9", "]", ";", "int", "pos", "=", "0", ";", "if", "(", "superLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "superSimpleName", ",", "0", ",", "result", ",", "pos", ",", "superLength", ")", ";", "pos", "+=", "superLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "superQLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "superQualification", ",", "0", ",", "result", ",", "pos", ",", "superQLength", ")", ";", "pos", "+=", "superQLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "simpleLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "simpleName", ",", "0", ",", "result", ",", "pos", ",", "simpleLength", ")", ";", "pos", "+=", "simpleLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "enclosingLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "enclosingTypeName", ",", "0", ",", "result", ",", "pos", ",", "enclosingLength", ")", ";", "pos", "+=", "enclosingLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "typeParametersLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "typeParameters", ",", "0", ",", "result", ",", "pos", ",", "typeParametersLength", ")", ";", "pos", "+=", "typeParametersLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "if", "(", "packageLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "packageName", ",", "0", ",", "result", ",", "pos", ",", "packageLength", ")", ";", "pos", "+=", "packageLength", ";", "}", "result", "[", "pos", "++", "]", "=", "SEPARATOR", ";", "result", "[", "pos", "++", "]", "=", "superClassOrInterface", ";", "result", "[", "pos", "++", "]", "=", "classOrInterface", ";", "result", "[", "pos", "]", "=", "(", "char", ")", "modifiers", ";", "return", "result", ";", "}", "public", "SuperTypeReferencePattern", "(", "char", "[", "]", "superQualification", ",", "char", "[", "]", "superSimpleName", ",", "int", "superRefKind", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "this", ".", "superQualification", "=", "this", ".", "isCaseSensitive", "?", "superQualification", ":", "CharOperation", ".", "toLowerCase", "(", "superQualification", ")", ";", "this", ".", "superSimpleName", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "superSimpleName", ":", "CharOperation", ".", "toLowerCase", "(", "superSimpleName", ")", ";", "this", ".", "mustResolve", "=", "superQualification", "!=", "null", ";", "this", ".", "superRefKind", "=", "superRefKind", ";", "}", "public", "SuperTypeReferencePattern", "(", "char", "[", "]", "superQualification", ",", "char", "[", "]", "superSimpleName", ",", "int", "superRefKind", ",", "char", "typeSuffix", ",", "int", "matchRule", ")", "{", "this", "(", "superQualification", ",", "superSimpleName", ",", "superRefKind", ",", "matchRule", ")", ";", "this", ".", "typeSuffix", "=", "typeSuffix", ";", "this", ".", "mustResolve", "=", "superQualification", "!=", "null", "||", "typeSuffix", "!=", "TYPE_SUFFIX", ";", "}", "SuperTypeReferencePattern", "(", "int", "matchRule", ")", "{", "super", "(", "SUPER_REF_PATTERN", ",", "matchRule", ")", ";", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "int", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "0", ")", ";", "this", ".", "superSimpleName", "=", "CharOperation", ".", "subarray", "(", "key", ",", "0", ",", "slash", ")", ";", "int", "start", "=", "slash", "+", "1", ";", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "this", ".", "superQualification", "=", "slash", "==", "start", "?", "null", ":", "CharOperation", ".", "subarray", "(", "key", ",", "start", ",", "slash", ")", ";", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", "=", "slash", "+", "1", ")", ";", "this", ".", "simpleName", "=", "CharOperation", ".", "subarray", "(", "key", ",", "start", ",", "slash", ")", ";", "start", "=", "++", "slash", ";", "if", "(", "key", "[", "start", "]", "==", "SEPARATOR", ")", "{", "this", ".", "enclosingTypeName", "=", "null", ";", "}", "else", "{", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "if", "(", "slash", "==", "(", "start", "+", "1", ")", "&&", "key", "[", "start", "]", "==", "ZERO_CHAR", ")", "{", "this", ".", "enclosingTypeName", "=", "ONE_ZERO", ";", "}", "else", "{", "char", "[", "]", "names", "=", "CharOperation", ".", "subarray", "(", "key", ",", "start", ",", "slash", ")", ";", "this", ".", "enclosingTypeName", "=", "names", ";", "}", "}", "start", "=", "++", "slash", ";", "if", "(", "key", "[", "start", "]", "==", "SEPARATOR", ")", "{", "this", ".", "typeParameterSignatures", "=", "null", ";", "}", "else", "{", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "this", ".", "typeParameterSignatures", "=", "CharOperation", ".", "splitOn", "(", "','", ",", "key", ",", "start", ",", "slash", ")", ";", "}", "start", "=", "++", "slash", ";", "if", "(", "key", "[", "start", "]", "==", "SEPARATOR", ")", "{", "this", ".", "pkgName", "=", "null", ";", "}", "else", "{", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "if", "(", "slash", "==", "(", "start", "+", "1", ")", "&&", "key", "[", "start", "]", "==", "ZERO_CHAR", ")", "{", "this", ".", "pkgName", "=", "this", ".", "superQualification", ";", "}", "else", "{", "char", "[", "]", "names", "=", "CharOperation", ".", "subarray", "(", "key", ",", "start", ",", "slash", ")", ";", "this", ".", "pkgName", "=", "names", ";", "}", "}", "this", ".", "superClassOrInterface", "=", "key", "[", "slash", "+", "1", "]", ";", "this", ".", "classOrInterface", "=", "key", "[", "slash", "+", "2", "]", ";", "this", ".", "modifiers", "=", "key", "[", "slash", "+", "3", "]", ";", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "SuperTypeReferencePattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "return", "CATEGORIES", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "SuperTypeReferencePattern", "pattern", "=", "(", "SuperTypeReferencePattern", ")", "decodedPattern", ";", "if", "(", "this", ".", "superRefKind", "==", "ONLY_SUPER_CLASSES", "&&", "pattern", ".", "enclosingTypeName", "!=", "ONE_ZERO", ")", "if", "(", "pattern", ".", "superClassOrInterface", "==", "INTERFACE_SUFFIX", "||", "pattern", ".", "superClassOrInterface", "==", "ANNOTATION_TYPE_SUFFIX", ")", "return", "false", ";", "if", "(", "pattern", ".", "superQualification", "!=", "null", ")", "if", "(", "!", "matchesName", "(", "this", ".", "superQualification", ",", "pattern", ".", "superQualification", ")", ")", "return", "false", ";", "return", "matchesName", "(", "this", ".", "superSimpleName", ",", "pattern", ".", "superSimpleName", ")", ";", "}", "public", "EntryResult", "[", "]", "queryIn", "(", "Index", "index", ")", "throws", "IOException", "{", "char", "[", "]", "key", "=", "this", ".", "superSimpleName", ";", "int", "matchRule", "=", "getMatchRule", "(", ")", ";", "switch", "(", "getMatchMode", "(", ")", ")", "{", "case", "R_EXACT_MATCH", ":", "matchRule", "&=", "~", "R_EXACT_MATCH", ";", "matchRule", "|=", "R_PREFIX_MATCH", ";", "if", "(", "this", ".", "superSimpleName", "!=", "null", ")", "key", "=", "CharOperation", ".", "append", "(", "this", ".", "superSimpleName", ",", "SEPARATOR", ")", ";", "break", ";", "case", "R_PREFIX_MATCH", ":", "break", ";", "case", "R_PATTERN_MATCH", ":", "break", ";", "case", "R_REGEXP_MATCH", ":", "break", ";", "case", "R_CAMELCASE_MATCH", ":", "case", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "break", ";", "}", "return", "index", ".", "query", "(", "getIndexCategories", "(", ")", ",", "key", ",", "matchRule", ")", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "switch", "(", "this", ".", "superRefKind", ")", "{", "case", "ALL_SUPER_TYPES", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "ONLY_SUPER_INTERFACES", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "ONLY_SUPER_CLASSES", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "if", "(", "this", ".", "superSimpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "superSimpleName", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\">\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,569
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "public", "class", "DeclarationOfReferencedTypesPattern", "extends", "TypeReferencePattern", "{", "protected", "SimpleSet", "knownTypes", ";", "protected", "IJavaElement", "enclosingElement", ";", "public", "DeclarationOfReferencedTypesPattern", "(", "IJavaElement", "enclosingElement", ")", "{", "super", "(", "null", ",", "null", ",", "R_PATTERN_MATCH", ")", ";", "this", ".", "enclosingElement", "=", "enclosingElement", ";", "this", ".", "knownTypes", "=", "new", "SimpleSet", "(", ")", ";", "this", ".", "mustResolve", "=", "true", ";", "}", "}", "</s>" ]
2,570
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "ProblemReporter", ";", "public", "class", "ImportMatchLocatorParser", "extends", "MatchLocatorParser", "{", "boolean", "reportImportMatch", ";", "public", "ImportMatchLocatorParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", "{", "super", "(", "problemReporter", ",", "locator", ")", ";", "this", ".", "reportImportMatch", "=", "this", ".", "patternFineGrain", "==", "0", "||", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "IMPORT_DECLARATION_TYPE_REFERENCE", ")", "!=", "0", ";", "}", "protected", "void", "consumeStaticImportOnDemandDeclarationName", "(", ")", "{", "super", ".", "consumeStaticImportOnDemandDeclarationName", "(", ")", ";", "if", "(", "this", ".", "reportImportMatch", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeSingleStaticImportDeclarationName", "(", ")", "{", "super", ".", "consumeSingleStaticImportDeclarationName", "(", ")", ";", "if", "(", "this", ".", "reportImportMatch", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeSingleTypeImportDeclarationName", "(", ")", "{", "super", ".", "consumeSingleTypeImportDeclarationName", "(", ")", ";", "if", "(", "this", ".", "reportImportMatch", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "protected", "void", "consumeTypeImportOnDemandDeclarationName", "(", ")", "{", "super", ".", "consumeTypeImportOnDemandDeclarationName", "(", ")", ";", "if", "(", "this", ".", "reportImportMatch", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "</s>" ]
2,571
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "PackageReferenceMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "public", "class", "PackageReferenceLocator", "extends", "PatternLocator", "{", "protected", "PackageReferencePattern", "pattern", ";", "public", "static", "boolean", "isDeclaringPackageFragment", "(", "IPackageFragment", "packageFragment", ",", "ReferenceBinding", "typeBinding", ")", "{", "char", "[", "]", "fileName", "=", "typeBinding", ".", "getFileName", "(", ")", ";", "if", "(", "fileName", "!=", "null", ")", "{", "fileName", "=", "CharOperation", ".", "replaceOnCopy", "(", "fileName", ",", "'/'", ",", "'\\\\'", ")", ";", "fileName", "=", "CharOperation", ".", "lastSegment", "(", "fileName", ",", "'\\\\'", ")", ";", "try", "{", "switch", "(", "packageFragment", ".", "getKind", "(", ")", ")", "{", "case", "IPackageFragmentRoot", ".", "K_SOURCE", ":", "if", "(", "!", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "fileName", ")", "||", "!", "packageFragment", ".", "getCompilationUnit", "(", "new", "String", "(", "fileName", ")", ")", ".", "exists", "(", ")", ")", "{", "return", "false", ";", "}", "break", ";", "case", "IPackageFragmentRoot", ".", "K_BINARY", ":", "if", "(", "!", "Util", ".", "isClassFileName", "(", "fileName", ")", "||", "!", "packageFragment", ".", "getClassFile", "(", "new", "String", "(", "fileName", ")", ")", ".", "exists", "(", ")", ")", "{", "return", "false", ";", "}", "break", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "return", "true", ";", "}", "public", "PackageReferenceLocator", "(", "PackageReferencePattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "}", "public", "int", "match", "(", "Annotation", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "match", "(", "node", ".", "type", ",", "nodeSet", ")", ";", "}", "public", "int", "match", "(", "ASTNode", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "(", "node", "instanceof", "ImportReference", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "matchLevel", "(", "(", "ImportReference", ")", "node", ")", ")", ";", "}", "public", "int", "match", "(", "Reference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "(", "node", "instanceof", "QualifiedNameReference", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "matchLevelForTokens", "(", "(", "(", "QualifiedNameReference", ")", "node", ")", ".", "tokens", ")", ")", ";", "}", "public", "int", "match", "(", "TypeReference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "node", "instanceof", "JavadocSingleTypeReference", ")", "{", "char", "[", "]", "[", "]", "tokens", "=", "new", "char", "[", "]", "[", "]", "{", "(", "(", "JavadocSingleTypeReference", ")", "node", ")", ".", "token", "}", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "matchLevelForTokens", "(", "tokens", ")", ")", ";", "}", "if", "(", "!", "(", "node", "instanceof", "QualifiedTypeReference", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "matchLevelForTokens", "(", "(", "(", "QualifiedTypeReference", ")", "node", ")", ".", "tokens", ")", ")", ";", "}", "protected", "int", "matchLevel", "(", "ImportReference", "importRef", ")", "{", "return", "matchLevelForTokens", "(", "importRef", ".", "tokens", ")", ";", "}", "protected", "int", "matchLevelForTokens", "(", "char", "[", "]", "[", "]", "tokens", ")", "{", "if", "(", "this", ".", "pattern", ".", "pkgName", "==", "null", ")", "return", "ACCURATE_MATCH", ";", "switch", "(", "this", ".", "matchMode", ")", "{", "case", "SearchPattern", ".", "R_EXACT_MATCH", ":", "case", "SearchPattern", ".", "R_PREFIX_MATCH", ":", "if", "(", "CharOperation", ".", "prefixEquals", "(", "this", ".", "pattern", ".", "pkgName", ",", "CharOperation", ".", "concatWith", "(", "tokens", ",", "'.'", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "char", "[", "]", "patternName", "=", "this", ".", "pattern", ".", "pkgName", "[", "this", ".", "pattern", ".", "pkgName", ".", "length", "-", "1", "]", "==", "'*'", "?", "this", ".", "pattern", ".", "pkgName", ":", "CharOperation", ".", "concat", "(", "this", ".", "pattern", ".", "pkgName", ",", "\".*\"", ".", "toCharArray", "(", ")", ")", ";", "if", "(", "CharOperation", ".", "match", "(", "patternName", ",", "CharOperation", ".", "concatWith", "(", "tokens", ",", "'.'", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_REGEXP_MATCH", ":", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "char", "[", "]", "packageName", "=", "CharOperation", ".", "concatWith", "(", "tokens", ",", "'.'", ")", ";", "if", "(", "CharOperation", ".", "camelCaseMatch", "(", "this", ".", "pattern", ".", "pkgName", ",", "packageName", ",", "false", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "if", "(", "!", "this", ".", "isCaseSensitive", "&&", "CharOperation", ".", "prefixEquals", "(", "this", ".", "pattern", ".", "pkgName", ",", "packageName", ",", "false", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "if", "(", "CharOperation", ".", "camelCaseMatch", "(", "this", ".", "pattern", ".", "pkgName", ",", "CharOperation", ".", "concatWith", "(", "tokens", ",", "'.'", ")", ",", "true", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "void", "matchLevelAndReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "Binding", "refBinding", "=", "binding", ";", "if", "(", "importRef", ".", "isStatic", "(", ")", ")", "{", "if", "(", "binding", "instanceof", "FieldBinding", ")", "{", "FieldBinding", "fieldBinding", "=", "(", "FieldBinding", ")", "binding", ";", "if", "(", "!", "fieldBinding", ".", "isStatic", "(", ")", ")", "return", ";", "refBinding", "=", "fieldBinding", ".", "declaringClass", ";", "}", "else", "if", "(", "binding", "instanceof", "MethodBinding", ")", "{", "MethodBinding", "methodBinding", "=", "(", "MethodBinding", ")", "binding", ";", "if", "(", "!", "methodBinding", ".", "isStatic", "(", ")", ")", "return", ";", "refBinding", "=", "methodBinding", ".", "declaringClass", ";", "}", "else", "if", "(", "binding", "instanceof", "MemberTypeBinding", ")", "{", "MemberTypeBinding", "memberBinding", "=", "(", "MemberTypeBinding", ")", "binding", ";", "if", "(", "!", "memberBinding", ".", "isStatic", "(", ")", ")", "return", ";", "}", "}", "super", ".", "matchLevelAndReportImportRef", "(", "importRef", ",", "refBinding", ",", "locator", ")", ";", "}", "protected", "void", "matchReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "IJavaElement", "element", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "binding", "==", "null", ")", "{", "this", ".", "matchReportReference", "(", "importRef", ",", "element", ",", "null", ",", "accuracy", ",", "locator", ")", ";", "}", "else", "{", "if", "(", "locator", ".", "encloses", "(", "element", ")", ")", "{", "long", "[", "]", "positions", "=", "importRef", ".", "sourcePositions", ";", "int", "last", "=", "positions", ".", "length", "-", "1", ";", "if", "(", "binding", "instanceof", "ProblemReferenceBinding", ")", "binding", "=", "(", "(", "ProblemReferenceBinding", ")", "binding", ")", ".", "closestMatch", "(", ")", ";", "if", "(", "binding", "instanceof", "ReferenceBinding", ")", "{", "PackageBinding", "pkgBinding", "=", "(", "(", "ReferenceBinding", ")", "binding", ")", ".", "fPackage", ";", "if", "(", "pkgBinding", "!=", "null", ")", "last", "=", "pkgBinding", ".", "compoundName", ".", "length", ";", "}", "if", "(", "binding", "instanceof", "PackageBinding", ")", "last", "=", "(", "(", "PackageBinding", ")", "binding", ")", ".", "compoundName", ".", "length", ";", "int", "start", "=", "(", "int", ")", "(", "positions", "[", "0", "]", ">>>", "32", ")", ";", "int", "end", "=", "(", "int", ")", "positions", "[", "last", "-", "1", "]", ";", "this", ".", "match", "=", "locator", ".", "newPackageReferenceMatch", "(", "element", ",", "accuracy", ",", "start", ",", "end", "-", "start", "+", "1", ",", "importRef", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "matchReportReference", "(", "reference", ",", "element", ",", "null", ",", "null", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "IJavaElement", "localElement", ",", "IJavaElement", "[", "]", "otherElements", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "long", "[", "]", "positions", "=", "null", ";", "int", "last", "=", "-", "1", ";", "if", "(", "reference", "instanceof", "ImportReference", ")", "{", "ImportReference", "importRef", "=", "(", "ImportReference", ")", "reference", ";", "positions", "=", "importRef", ".", "sourcePositions", ";", "last", "=", "(", "importRef", ".", "bits", "&", "ASTNode", ".", "OnDemand", ")", "!=", "0", "?", "positions", ".", "length", ":", "positions", ".", "length", "-", "1", ";", "}", "else", "{", "TypeBinding", "typeBinding", "=", "null", ";", "if", "(", "reference", "instanceof", "QualifiedNameReference", ")", "{", "QualifiedNameReference", "qNameRef", "=", "(", "QualifiedNameReference", ")", "reference", ";", "positions", "=", "qNameRef", ".", "sourcePositions", ";", "switch", "(", "qNameRef", ".", "bits", "&", "ASTNode", ".", "RestrictiveFlagMASK", ")", "{", "case", "Binding", ".", "FIELD", ":", "typeBinding", "=", "qNameRef", ".", "actualReceiverType", ";", "break", ";", "case", "Binding", ".", "TYPE", ":", "if", "(", "qNameRef", ".", "binding", "instanceof", "TypeBinding", ")", "typeBinding", "=", "(", "TypeBinding", ")", "qNameRef", ".", "binding", ";", "break", ";", "case", "Binding", ".", "VARIABLE", ":", "case", "Binding", ".", "TYPE", "|", "Binding", ".", "VARIABLE", ":", "Binding", "binding", "=", "qNameRef", ".", "binding", ";", "if", "(", "binding", "instanceof", "TypeBinding", ")", "{", "typeBinding", "=", "(", "TypeBinding", ")", "binding", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemFieldBinding", ")", "{", "typeBinding", "=", "qNameRef", ".", "actualReceiverType", ";", "last", "=", "qNameRef", ".", "tokens", ".", "length", "-", "(", "qNameRef", ".", "otherBindings", "==", "null", "?", "2", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "2", ")", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemBinding", ")", "{", "ProblemBinding", "pbBinding", "=", "(", "ProblemBinding", ")", "binding", ";", "typeBinding", "=", "pbBinding", ".", "searchType", ";", "last", "=", "CharOperation", ".", "occurencesOf", "(", "'.'", ",", "pbBinding", ".", "name", ")", ";", "}", "break", ";", "}", "}", "else", "if", "(", "reference", "instanceof", "QualifiedTypeReference", ")", "{", "QualifiedTypeReference", "qTypeRef", "=", "(", "QualifiedTypeReference", ")", "reference", ";", "positions", "=", "qTypeRef", ".", "sourcePositions", ";", "typeBinding", "=", "qTypeRef", ".", "resolvedType", ";", "}", "else", "if", "(", "reference", "instanceof", "JavadocSingleTypeReference", ")", "{", "JavadocSingleTypeReference", "jsTypeRef", "=", "(", "JavadocSingleTypeReference", ")", "reference", ";", "positions", "=", "new", "long", "[", "1", "]", ";", "positions", "[", "0", "]", "=", "(", "(", "(", "long", ")", "jsTypeRef", ".", "sourceStart", ")", "<<", "32", ")", "+", "jsTypeRef", ".", "sourceEnd", ";", "typeBinding", "=", "jsTypeRef", ".", "resolvedType", ";", "}", "if", "(", "positions", "==", "null", ")", "return", ";", "if", "(", "typeBinding", "instanceof", "ArrayBinding", ")", "typeBinding", "=", "(", "(", "ArrayBinding", ")", "typeBinding", ")", ".", "leafComponentType", ";", "if", "(", "typeBinding", "instanceof", "ProblemReferenceBinding", ")", "typeBinding", "=", "(", "(", "ProblemReferenceBinding", ")", "typeBinding", ")", ".", "closestMatch", "(", ")", ";", "if", "(", "typeBinding", "instanceof", "ReferenceBinding", ")", "{", "PackageBinding", "pkgBinding", "=", "(", "(", "ReferenceBinding", ")", "typeBinding", ")", ".", "fPackage", ";", "if", "(", "pkgBinding", "!=", "null", ")", "last", "=", "pkgBinding", ".", "compoundName", ".", "length", ";", "}", "ReferenceBinding", "enclosingType", "=", "typeBinding", "==", "null", "?", "null", ":", "typeBinding", ".", "enclosingType", "(", ")", ";", "if", "(", "enclosingType", "!=", "null", ")", "{", "int", "length", "=", "positions", ".", "length", ";", "while", "(", "enclosingType", "!=", "null", "&&", "length", ">", "0", ")", "{", "length", "--", ";", "enclosingType", "=", "enclosingType", ".", "enclosingType", "(", ")", ";", "}", "if", "(", "length", "<=", "1", ")", "return", ";", "}", "}", "if", "(", "last", "==", "-", "1", ")", "{", "last", "=", "this", ".", "pattern", ".", "segments", ".", "length", ";", "}", "if", "(", "last", "==", "0", ")", "return", ";", "if", "(", "last", ">", "positions", ".", "length", ")", "last", "=", "positions", ".", "length", ";", "int", "sourceStart", "=", "(", "int", ")", "(", "positions", "[", "0", "]", ">>>", "32", ")", ";", "int", "sourceEnd", "=", "(", "(", "int", ")", "positions", "[", "last", "-", "1", "]", ")", ";", "PackageReferenceMatch", "packageReferenceMatch", "=", "locator", ".", "newPackageReferenceMatch", "(", "element", ",", "accuracy", ",", "sourceStart", ",", "sourceEnd", "-", "sourceStart", "+", "1", ",", "reference", ")", ";", "packageReferenceMatch", ".", "setLocalElement", "(", "localElement", ")", ";", "this", ".", "match", "=", "packageReferenceMatch", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "IJavaElement", ".", "PACKAGE_FRAGMENT", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "node", ")", "{", "if", "(", "node", "instanceof", "JavadocQualifiedTypeReference", ")", "{", "JavadocQualifiedTypeReference", "qualifRef", "=", "(", "JavadocQualifiedTypeReference", ")", "node", ";", "if", "(", "qualifRef", ".", "packageBinding", "!=", "null", ")", "return", "resolveLevel", "(", "qualifRef", ".", "packageBinding", ")", ";", "return", "resolveLevel", "(", "qualifRef", ".", "resolvedType", ")", ";", "}", "if", "(", "node", "instanceof", "JavadocSingleTypeReference", ")", "{", "JavadocSingleTypeReference", "singleRef", "=", "(", "JavadocSingleTypeReference", ")", "node", ";", "if", "(", "singleRef", ".", "packageBinding", "!=", "null", ")", "return", "resolveLevel", "(", "singleRef", ".", "packageBinding", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "if", "(", "node", "instanceof", "QualifiedTypeReference", ")", "return", "resolveLevel", "(", "(", "(", "QualifiedTypeReference", ")", "node", ")", ".", "resolvedType", ")", ";", "if", "(", "node", "instanceof", "QualifiedNameReference", ")", "return", "this", ".", "resolveLevel", "(", "(", "QualifiedNameReference", ")", "node", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "char", "[", "]", "[", "]", "compoundName", "=", "null", ";", "if", "(", "binding", "instanceof", "ImportBinding", ")", "{", "compoundName", "=", "(", "(", "ImportBinding", ")", "binding", ")", ".", "compoundName", ";", "}", "else", "if", "(", "binding", "instanceof", "PackageBinding", ")", "{", "compoundName", "=", "(", "(", "PackageBinding", ")", "binding", ")", ".", "compoundName", ";", "}", "else", "{", "if", "(", "binding", "instanceof", "ArrayBinding", ")", "binding", "=", "(", "(", "ArrayBinding", ")", "binding", ")", ".", "leafComponentType", ";", "if", "(", "binding", "instanceof", "ProblemReferenceBinding", ")", "binding", "=", "(", "(", "ProblemReferenceBinding", ")", "binding", ")", ".", "closestMatch", "(", ")", ";", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "binding", "instanceof", "ReferenceBinding", ")", "{", "PackageBinding", "pkgBinding", "=", "(", "(", "ReferenceBinding", ")", "binding", ")", ".", "fPackage", ";", "if", "(", "pkgBinding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "compoundName", "=", "pkgBinding", ".", "compoundName", ";", "}", "}", "if", "(", "compoundName", "!=", "null", "&&", "matchesName", "(", "this", ".", "pattern", ".", "pkgName", ",", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ")", ")", "{", "if", "(", "this", ".", "pattern", ".", "focus", "instanceof", "IPackageFragment", "&&", "binding", "instanceof", "ReferenceBinding", ")", "{", "if", "(", "!", "isDeclaringPackageFragment", "(", "(", "IPackageFragment", ")", "this", ".", "pattern", ".", "focus", ",", "(", "ReferenceBinding", ")", "binding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "return", "ACCURATE_MATCH", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "resolveLevel", "(", "QualifiedNameReference", "qNameRef", ")", "{", "TypeBinding", "typeBinding", "=", "null", ";", "switch", "(", "qNameRef", ".", "bits", "&", "ASTNode", ".", "RestrictiveFlagMASK", ")", "{", "case", "Binding", ".", "FIELD", ":", "if", "(", "qNameRef", ".", "tokens", ".", "length", "<", "(", "qNameRef", ".", "otherBindings", "==", "null", "?", "3", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "3", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "typeBinding", "=", "qNameRef", ".", "actualReceiverType", ";", "break", ";", "case", "Binding", ".", "LOCAL", ":", "return", "IMPOSSIBLE_MATCH", ";", "case", "Binding", ".", "TYPE", ":", "if", "(", "qNameRef", ".", "binding", "instanceof", "TypeBinding", ")", "typeBinding", "=", "(", "TypeBinding", ")", "qNameRef", ".", "binding", ";", "break", ";", "case", "Binding", ".", "VARIABLE", ":", "case", "Binding", ".", "TYPE", "|", "Binding", ".", "VARIABLE", ":", "Binding", "binding", "=", "qNameRef", ".", "binding", ";", "if", "(", "binding", "instanceof", "ProblemReferenceBinding", ")", "{", "typeBinding", "=", "(", "TypeBinding", ")", "binding", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemFieldBinding", ")", "{", "if", "(", "qNameRef", ".", "tokens", ".", "length", "<", "(", "qNameRef", ".", "otherBindings", "==", "null", "?", "3", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "3", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "typeBinding", "=", "qNameRef", ".", "actualReceiverType", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemBinding", ")", "{", "ProblemBinding", "pbBinding", "=", "(", "ProblemBinding", ")", "binding", ";", "if", "(", "CharOperation", ".", "occurencesOf", "(", "'.'", ",", "pbBinding", ".", "name", ")", "<=", "0", ")", "return", "INACCURATE_MATCH", ";", "typeBinding", "=", "pbBinding", ".", "searchType", ";", "}", "break", ";", "}", "return", "resolveLevel", "(", "typeBinding", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,572
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMember", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeParameter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IndexQueryRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "TypeParameterPattern", "extends", "JavaSearchPattern", "{", "protected", "boolean", "findDeclarations", ";", "protected", "boolean", "findReferences", ";", "protected", "char", "[", "]", "name", ";", "protected", "ITypeParameter", "typeParameter", ";", "protected", "char", "[", "]", "declaringMemberName", ";", "protected", "char", "[", "]", "methodDeclaringClassName", ";", "protected", "char", "[", "]", "[", "]", "methodArgumentTypes", ";", "public", "TypeParameterPattern", "(", "boolean", "findDeclarations", ",", "boolean", "findReferences", ",", "ITypeParameter", "typeParameter", ",", "int", "matchRule", ")", "{", "super", "(", "TYPE_PARAM_PATTERN", ",", "matchRule", ")", ";", "this", ".", "findDeclarations", "=", "findDeclarations", ";", "this", ".", "findReferences", "=", "findReferences", ";", "this", ".", "typeParameter", "=", "typeParameter", ";", "this", ".", "name", "=", "typeParameter", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "IMember", "member", "=", "typeParameter", ".", "getDeclaringMember", "(", ")", ";", "this", ".", "declaringMemberName", "=", "member", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "if", "(", "member", "instanceof", "IMethod", ")", "{", "IMethod", "method", "=", "(", "IMethod", ")", "member", ";", "this", ".", "methodDeclaringClassName", "=", "method", ".", "getParent", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "String", "[", "]", "parameters", "=", "method", ".", "getParameterTypes", "(", ")", ";", "int", "length", "=", "parameters", ".", "length", ";", "this", ".", "methodArgumentTypes", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "methodArgumentTypes", "[", "i", "]", "=", "Signature", ".", "toCharArray", "(", "parameters", "[", "i", "]", ".", "toCharArray", "(", ")", ")", ";", "}", "}", "}", "public", "void", "findIndexMatches", "(", "Index", "index", ",", "IndexQueryRequestor", "requestor", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IProgressMonitor", "progressMonitor", ")", "{", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "this", ".", "typeParameter", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "String", "documentPath", ";", "String", "relativePath", ";", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "IType", "type", "=", "(", "IType", ")", "this", ".", "typeParameter", ".", "getAncestor", "(", "IJavaElement", ".", "TYPE", ")", ";", "relativePath", "=", "(", "type", ".", "getFullyQualifiedName", "(", "'$'", ")", ")", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "SuffixConstants", ".", "SUFFIX_STRING_class", ";", "documentPath", "=", "root", ".", "getPath", "(", ")", "+", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", "+", "relativePath", ";", "}", "else", "{", "IPath", "path", "=", "this", ".", "typeParameter", ".", "getPath", "(", ")", ";", "documentPath", "=", "path", ".", "toString", "(", ")", ";", "relativePath", "=", "Util", ".", "relativePath", "(", "path", ",", "1", ")", ";", "}", "if", "(", "scope", "instanceof", "JavaSearchScope", ")", "{", "JavaSearchScope", "javaSearchScope", "=", "(", "JavaSearchScope", ")", "scope", ";", "AccessRuleSet", "access", "=", "javaSearchScope", ".", "getAccessRuleSet", "(", "relativePath", ",", "index", ".", "containerPath", ")", ";", "if", "(", "access", "!=", "JavaSearchScope", ".", "NOT_ENCLOSED", ")", "{", "if", "(", "!", "requestor", ".", "acceptIndexMatch", "(", "documentPath", ",", "this", ",", "participant", ",", "access", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "}", "else", "if", "(", "scope", ".", "encloses", "(", "documentPath", ")", ")", "{", "if", "(", "!", "requestor", ".", "acceptIndexMatch", "(", "documentPath", ",", "this", ",", "participant", ",", "null", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "if", "(", "this", ".", "findDeclarations", ")", "{", "output", ".", "append", "(", "this", ".", "findReferences", "?", "\"\"", ":", "\"\"", ")", ";", "}", "else", "{", "output", ".", "append", "(", "\"\"", ")", ";", "}", "output", ".", "append", "(", "this", ".", "typeParameter", ".", "toString", "(", ")", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,573
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "public", "class", "DeclarationOfAccessedFieldsPattern", "extends", "FieldPattern", "{", "protected", "IJavaElement", "enclosingElement", ";", "protected", "SimpleSet", "knownFields", ";", "public", "DeclarationOfAccessedFieldsPattern", "(", "IJavaElement", "enclosingElement", ")", "{", "super", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "IJavaSearchConstants", ".", "REFERENCES", ",", "R_PATTERN_MATCH", ")", ";", "this", ".", "enclosingElement", "=", "enclosingElement", ";", "this", ".", "knownFields", "=", "new", "SimpleSet", "(", ")", ";", "this", ".", "mustResolve", "=", "true", ";", "}", "}", "</s>" ]
2,574
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "MethodPattern", "extends", "JavaSearchPattern", "{", "protected", "boolean", "findDeclarations", "=", "true", ";", "protected", "boolean", "findReferences", "=", "true", ";", "public", "char", "[", "]", "selector", ";", "public", "char", "[", "]", "declaringQualification", ";", "public", "char", "[", "]", "declaringSimpleName", ";", "public", "char", "[", "]", "declaringPackageName", ";", "public", "char", "[", "]", "returnQualification", ";", "public", "char", "[", "]", "returnSimpleName", ";", "public", "char", "[", "]", "[", "]", "parameterQualifications", ";", "public", "char", "[", "]", "[", "]", "parameterSimpleNames", ";", "public", "int", "parameterCount", ";", "public", "boolean", "varargs", "=", "false", ";", "protected", "IType", "declaringType", ";", "char", "[", "]", "[", "]", "returnTypeSignatures", ";", "char", "[", "]", "[", "]", "[", "]", "parametersTypeSignatures", ";", "char", "[", "]", "[", "]", "[", "]", "[", "]", "parametersTypeArguments", ";", "boolean", "methodParameters", "=", "false", ";", "char", "[", "]", "[", "]", "methodArguments", ";", "protected", "static", "char", "[", "]", "[", "]", "REF_CATEGORIES", "=", "{", "METHOD_REF", "}", ";", "protected", "static", "char", "[", "]", "[", "]", "REF_AND_DECL_CATEGORIES", "=", "{", "METHOD_REF", ",", "METHOD_DECL", "}", ";", "protected", "static", "char", "[", "]", "[", "]", "DECL_CATEGORIES", "=", "{", "METHOD_DECL", "}", ";", "public", "final", "static", "int", "FINE_GRAIN_MASK", "=", "IJavaSearchConstants", ".", "SUPER_REFERENCE", "|", "IJavaSearchConstants", ".", "QUALIFIED_REFERENCE", "|", "IJavaSearchConstants", ".", "THIS_REFERENCE", "|", "IJavaSearchConstants", ".", "IMPLICIT_THIS_REFERENCE", ";", "public", "static", "char", "[", "]", "createIndexKey", "(", "char", "[", "]", "selector", ",", "int", "argCount", ")", "{", "char", "[", "]", "countChars", "=", "argCount", "<", "10", "?", "COUNTS", "[", "argCount", "]", ":", "(", "\"/\"", "+", "String", ".", "valueOf", "(", "argCount", ")", ")", ".", "toCharArray", "(", ")", ";", "return", "CharOperation", ".", "concat", "(", "selector", ",", "countChars", ")", ";", "}", "MethodPattern", "(", "int", "matchRule", ")", "{", "super", "(", "METHOD_PATTERN", ",", "matchRule", ")", ";", "}", "public", "MethodPattern", "(", "char", "[", "]", "selector", ",", "char", "[", "]", "declaringQualification", ",", "char", "[", "]", "declaringSimpleName", ",", "char", "[", "]", "returnQualification", ",", "char", "[", "]", "returnSimpleName", ",", "char", "[", "]", "[", "]", "parameterQualifications", ",", "char", "[", "]", "[", "]", "parameterSimpleNames", ",", "IType", "declaringType", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "this", ".", "fineGrain", "=", "limitTo", "&", "FINE_GRAIN_MASK", ";", "if", "(", "this", ".", "fineGrain", "==", "0", ")", "{", "switch", "(", "limitTo", "&", "0xF", ")", "{", "case", "IJavaSearchConstants", ".", "DECLARATIONS", ":", "this", ".", "findReferences", "=", "false", ";", "break", ";", "case", "IJavaSearchConstants", ".", "REFERENCES", ":", "this", ".", "findDeclarations", "=", "false", ";", "break", ";", "case", "IJavaSearchConstants", ".", "ALL_OCCURRENCES", ":", "break", ";", "}", "}", "else", "{", "this", ".", "findDeclarations", "=", "false", ";", "}", "this", ".", "selector", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "selector", ":", "CharOperation", ".", "toLowerCase", "(", "selector", ")", ";", "this", ".", "declaringQualification", "=", "this", ".", "isCaseSensitive", "?", "declaringQualification", ":", "CharOperation", ".", "toLowerCase", "(", "declaringQualification", ")", ";", "this", ".", "declaringSimpleName", "=", "this", ".", "isCaseSensitive", "?", "declaringSimpleName", ":", "CharOperation", ".", "toLowerCase", "(", "declaringSimpleName", ")", ";", "this", ".", "returnQualification", "=", "this", ".", "isCaseSensitive", "?", "returnQualification", ":", "CharOperation", ".", "toLowerCase", "(", "returnQualification", ")", ";", "this", ".", "returnSimpleName", "=", "this", ".", "isCaseSensitive", "?", "returnSimpleName", ":", "CharOperation", ".", "toLowerCase", "(", "returnSimpleName", ")", ";", "if", "(", "parameterSimpleNames", "!=", "null", ")", "{", "this", ".", "parameterCount", "=", "parameterSimpleNames", ".", "length", ";", "this", ".", "parameterQualifications", "=", "new", "char", "[", "this", ".", "parameterCount", "]", "[", "]", ";", "this", ".", "parameterSimpleNames", "=", "new", "char", "[", "this", ".", "parameterCount", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "parameterCount", ";", "i", "++", ")", "{", "this", ".", "parameterQualifications", "[", "i", "]", "=", "this", ".", "isCaseSensitive", "?", "parameterQualifications", "[", "i", "]", ":", "CharOperation", ".", "toLowerCase", "(", "parameterQualifications", "[", "i", "]", ")", ";", "this", ".", "parameterSimpleNames", "[", "i", "]", "=", "this", ".", "isCaseSensitive", "?", "parameterSimpleNames", "[", "i", "]", ":", "CharOperation", ".", "toLowerCase", "(", "parameterSimpleNames", "[", "i", "]", ")", ";", "}", "}", "else", "{", "this", ".", "parameterCount", "=", "-", "1", ";", "}", "this", ".", "declaringType", "=", "declaringType", ";", "if", "(", "this", ".", "declaringType", "!=", "null", ")", "{", "this", ".", "declaringPackageName", "=", "this", ".", "declaringType", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "this", ".", "mustResolve", "=", "mustResolve", "(", ")", ";", "}", "public", "MethodPattern", "(", "char", "[", "]", "selector", ",", "char", "[", "]", "declaringQualification", ",", "char", "[", "]", "declaringSimpleName", ",", "char", "[", "]", "returnQualification", ",", "char", "[", "]", "returnSimpleName", ",", "String", "returnSignature", ",", "char", "[", "]", "[", "]", "parameterQualifications", ",", "char", "[", "]", "[", "]", "parameterSimpleNames", ",", "String", "[", "]", "parameterSignatures", ",", "IMethod", "method", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "this", "(", "selector", ",", "declaringQualification", ",", "declaringSimpleName", ",", "returnQualification", ",", "returnSimpleName", ",", "parameterQualifications", ",", "parameterSimpleNames", ",", "method", ".", "getDeclaringType", "(", ")", ",", "limitTo", ",", "matchRule", ")", ";", "try", "{", "this", ".", "varargs", "=", "(", "method", ".", "getFlags", "(", ")", "&", "Flags", ".", "AccVarargs", ")", "!=", "0", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "String", "genericDeclaringTypeSignature", "=", "null", ";", "if", "(", "method", ".", "isResolved", "(", ")", ")", "{", "String", "key", "=", "method", ".", "getKey", "(", ")", ";", "BindingKey", "bindingKey", "=", "new", "BindingKey", "(", "key", ")", ";", "if", "(", "bindingKey", ".", "isParameterizedType", "(", ")", ")", "{", "genericDeclaringTypeSignature", "=", "Util", ".", "getDeclaringTypeSignature", "(", "key", ")", ";", "if", "(", "genericDeclaringTypeSignature", "!=", "null", ")", "{", "this", ".", "typeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "genericDeclaringTypeSignature", ")", ";", "setTypeArguments", "(", "Util", ".", "getAllTypeArguments", "(", "this", ".", "typeSignatures", ")", ")", ";", "}", "}", "}", "else", "{", "this", ".", "methodParameters", "=", "true", ";", "storeTypeSignaturesAndArguments", "(", "this", ".", "declaringType", ")", ";", "}", "if", "(", "returnSignature", "!=", "null", ")", "{", "this", ".", "returnTypeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "returnSignature", ")", ";", "}", "if", "(", "parameterSignatures", "!=", "null", ")", "{", "int", "length", "=", "parameterSignatures", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "this", ".", "parametersTypeSignatures", "=", "new", "char", "[", "length", "]", "[", "]", "[", "]", ";", "this", ".", "parametersTypeArguments", "=", "new", "char", "[", "length", "]", "[", "]", "[", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "parametersTypeSignatures", "[", "i", "]", "=", "Util", ".", "splitTypeLevelsSignature", "(", "parameterSignatures", "[", "i", "]", ")", ";", "this", ".", "parametersTypeArguments", "[", "i", "]", "=", "Util", ".", "getAllTypeArguments", "(", "this", ".", "parametersTypeSignatures", "[", "i", "]", ")", ";", "}", "}", "}", "this", ".", "methodArguments", "=", "extractMethodArguments", "(", "method", ")", ";", "if", "(", "hasMethodArguments", "(", ")", ")", "this", ".", "mustResolve", "=", "true", ";", "}", "public", "MethodPattern", "(", "char", "[", "]", "selector", ",", "char", "[", "]", "declaringQualification", ",", "char", "[", "]", "declaringSimpleName", ",", "String", "declaringSignature", ",", "char", "[", "]", "returnQualification", ",", "char", "[", "]", "returnSimpleName", ",", "String", "returnSignature", ",", "char", "[", "]", "[", "]", "parameterQualifications", ",", "char", "[", "]", "[", "]", "parameterSimpleNames", ",", "String", "[", "]", "parameterSignatures", ",", "char", "[", "]", "[", "]", "arguments", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "this", "(", "selector", ",", "declaringQualification", ",", "declaringSimpleName", ",", "returnQualification", ",", "returnSimpleName", ",", "parameterQualifications", ",", "parameterSimpleNames", ",", "null", ",", "limitTo", ",", "matchRule", ")", ";", "if", "(", "declaringSignature", "!=", "null", ")", "{", "this", ".", "typeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "declaringSignature", ")", ";", "setTypeArguments", "(", "Util", ".", "getAllTypeArguments", "(", "this", ".", "typeSignatures", ")", ")", ";", "}", "if", "(", "returnSignature", "!=", "null", ")", "{", "this", ".", "returnTypeSignatures", "=", "Util", ".", "splitTypeLevelsSignature", "(", "returnSignature", ")", ";", "}", "if", "(", "parameterSignatures", "!=", "null", ")", "{", "int", "length", "=", "parameterSignatures", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "this", ".", "parametersTypeSignatures", "=", "new", "char", "[", "length", "]", "[", "]", "[", "]", ";", "this", ".", "parametersTypeArguments", "=", "new", "char", "[", "length", "]", "[", "]", "[", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "parametersTypeSignatures", "[", "i", "]", "=", "Util", ".", "splitTypeLevelsSignature", "(", "parameterSignatures", "[", "i", "]", ")", ";", "this", ".", "parametersTypeArguments", "[", "i", "]", "=", "Util", ".", "getAllTypeArguments", "(", "this", ".", "parametersTypeSignatures", "[", "i", "]", ")", ";", "}", "}", "}", "this", ".", "methodArguments", "=", "arguments", ";", "if", "(", "hasMethodArguments", "(", ")", ")", "this", ".", "mustResolve", "=", "true", ";", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "int", "last", "=", "key", ".", "length", "-", "1", ";", "this", ".", "parameterCount", "=", "0", ";", "this", ".", "selector", "=", "null", ";", "int", "power", "=", "1", ";", "for", "(", "int", "i", "=", "last", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "key", "[", "i", "]", "==", "SEPARATOR", ")", "{", "System", ".", "arraycopy", "(", "key", ",", "0", ",", "this", ".", "selector", "=", "new", "char", "[", "i", "]", ",", "0", ",", "i", ")", ";", "break", ";", "}", "if", "(", "i", "==", "last", ")", "{", "this", ".", "parameterCount", "=", "key", "[", "i", "]", "-", "'0'", ";", "}", "else", "{", "power", "*=", "10", ";", "this", ".", "parameterCount", "+=", "power", "*", "(", "key", "[", "i", "]", "-", "'0'", ")", ";", "}", "}", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "MethodPattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "if", "(", "this", ".", "findReferences", ")", "return", "this", ".", "findDeclarations", "?", "REF_AND_DECL_CATEGORIES", ":", "REF_CATEGORIES", ";", "if", "(", "this", ".", "findDeclarations", ")", "return", "DECL_CATEGORIES", ";", "return", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "boolean", "hasMethodArguments", "(", ")", "{", "return", "this", ".", "methodArguments", "!=", "null", "&&", "this", ".", "methodArguments", ".", "length", ">", "0", ";", "}", "boolean", "hasMethodParameters", "(", ")", "{", "return", "this", ".", "methodParameters", ";", "}", "public", "boolean", "isPolymorphicSearch", "(", ")", "{", "return", "this", ".", "findReferences", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "MethodPattern", "pattern", "=", "(", "MethodPattern", ")", "decodedPattern", ";", "return", "(", "this", ".", "parameterCount", "==", "pattern", ".", "parameterCount", "||", "this", ".", "parameterCount", "==", "-", "1", "||", "this", ".", "varargs", ")", "&&", "matchesName", "(", "this", ".", "selector", ",", "pattern", ".", "selector", ")", ";", "}", "protected", "boolean", "mustResolve", "(", ")", "{", "if", "(", "this", ".", "declaringSimpleName", "!=", "null", "||", "this", ".", "declaringQualification", "!=", "null", ")", "return", "true", ";", "if", "(", "this", ".", "returnSimpleName", "!=", "null", "||", "this", ".", "returnQualification", "!=", "null", ")", "return", "true", ";", "if", "(", "this", ".", "parameterSimpleNames", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "parameterSimpleNames", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "if", "(", "this", ".", "parameterQualifications", "[", "i", "]", "!=", "null", ")", "return", "true", ";", "return", "false", ";", "}", "public", "EntryResult", "[", "]", "queryIn", "(", "Index", "index", ")", "throws", "IOException", "{", "char", "[", "]", "key", "=", "this", ".", "selector", ";", "int", "matchRule", "=", "getMatchRule", "(", ")", ";", "switch", "(", "getMatchMode", "(", ")", ")", "{", "case", "R_EXACT_MATCH", ":", "if", "(", "this", ".", "selector", "!=", "null", "&&", "this", ".", "parameterCount", ">=", "0", "&&", "!", "this", ".", "varargs", ")", "key", "=", "createIndexKey", "(", "this", ".", "selector", ",", "this", ".", "parameterCount", ")", ";", "else", "{", "matchRule", "&=", "~", "R_EXACT_MATCH", ";", "matchRule", "|=", "R_PREFIX_MATCH", ";", "}", "break", ";", "case", "R_PREFIX_MATCH", ":", "break", ";", "case", "R_PATTERN_MATCH", ":", "if", "(", "this", ".", "parameterCount", ">=", "0", "&&", "!", "this", ".", "varargs", ")", "key", "=", "createIndexKey", "(", "this", ".", "selector", "==", "null", "?", "ONE_STAR", ":", "this", ".", "selector", ",", "this", ".", "parameterCount", ")", ";", "else", "if", "(", "this", ".", "selector", "!=", "null", "&&", "this", ".", "selector", "[", "this", ".", "selector", ".", "length", "-", "1", "]", "!=", "'*'", ")", "key", "=", "CharOperation", ".", "concat", "(", "this", ".", "selector", ",", "ONE_STAR", ",", "SEPARATOR", ")", ";", "break", ";", "case", "R_REGEXP_MATCH", ":", "break", ";", "case", "R_CAMELCASE_MATCH", ":", "case", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "break", ";", "}", "return", "index", ".", "query", "(", "getIndexCategories", "(", ")", ",", "key", ",", "matchRule", ")", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "if", "(", "this", ".", "findDeclarations", ")", "{", "output", ".", "append", "(", "this", ".", "findReferences", "?", "\"\"", ":", "\"\"", ")", ";", "}", "else", "{", "output", ".", "append", "(", "\"\"", ")", ";", "}", "if", "(", "this", ".", "declaringQualification", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "declaringQualification", ")", ".", "append", "(", "'.'", ")", ";", "if", "(", "this", ".", "declaringSimpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "declaringSimpleName", ")", ".", "append", "(", "'.'", ")", ";", "else", "if", "(", "this", ".", "declaringQualification", "!=", "null", ")", "output", ".", "append", "(", "\"*.\"", ")", ";", "if", "(", "this", ".", "selector", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "selector", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "'('", ")", ";", "if", "(", "this", ".", "parameterSimpleNames", "==", "null", ")", "{", "output", ".", "append", "(", "\"...\"", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "parameterSimpleNames", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "output", ".", "append", "(", "\",", "\"", ")", ";", "if", "(", "this", ".", "parameterQualifications", "[", "i", "]", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "parameterQualifications", "[", "i", "]", ")", ".", "append", "(", "'.'", ")", ";", "if", "(", "this", ".", "parameterSimpleNames", "[", "i", "]", "==", "null", ")", "output", ".", "append", "(", "'*'", ")", ";", "else", "output", ".", "append", "(", "this", ".", "parameterSimpleNames", "[", "i", "]", ")", ";", "}", "}", "output", ".", "append", "(", "')'", ")", ";", "if", "(", "this", ".", "returnQualification", "!=", "null", ")", "output", ".", "append", "(", "\"", "-->", "\"", ")", ".", "append", "(", "this", ".", "returnQualification", ")", ".", "append", "(", "'.'", ")", ";", "else", "if", "(", "this", ".", "returnSimpleName", "!=", "null", ")", "output", ".", "append", "(", "\"", "-->", "\"", ")", ";", "if", "(", "this", ".", "returnSimpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "returnSimpleName", ")", ";", "else", "if", "(", "this", ".", "returnQualification", "!=", "null", ")", "output", ".", "append", "(", "\"*\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,575
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IContainer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "NameEnvironmentAnswer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "ClasspathLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "ResourceCompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "ClasspathSourceDirectory", "extends", "ClasspathLocation", "{", "IContainer", "sourceFolder", ";", "SimpleLookupTable", "directoryCache", ";", "SimpleLookupTable", "missingPackageHolder", "=", "new", "SimpleLookupTable", "(", ")", ";", "char", "[", "]", "[", "]", "fullExclusionPatternChars", ";", "char", "[", "]", "[", "]", "fulInclusionPatternChars", ";", "ClasspathSourceDirectory", "(", "IContainer", "sourceFolder", ",", "char", "[", "]", "[", "]", "fullExclusionPatternChars", ",", "char", "[", "]", "[", "]", "fulInclusionPatternChars", ")", "{", "this", ".", "sourceFolder", "=", "sourceFolder", ";", "this", ".", "directoryCache", "=", "new", "SimpleLookupTable", "(", "5", ")", ";", "this", ".", "fullExclusionPatternChars", "=", "fullExclusionPatternChars", ";", "this", ".", "fulInclusionPatternChars", "=", "fulInclusionPatternChars", ";", "}", "public", "void", "cleanup", "(", ")", "{", "this", ".", "directoryCache", "=", "null", ";", "}", "SimpleLookupTable", "directoryTable", "(", "String", "qualifiedPackageName", ")", "{", "SimpleLookupTable", "dirTable", "=", "(", "SimpleLookupTable", ")", "this", ".", "directoryCache", ".", "get", "(", "qualifiedPackageName", ")", ";", "if", "(", "dirTable", "==", "this", ".", "missingPackageHolder", ")", "return", "null", ";", "if", "(", "dirTable", "!=", "null", ")", "return", "dirTable", ";", "try", "{", "IResource", "container", "=", "this", ".", "sourceFolder", ".", "findMember", "(", "qualifiedPackageName", ")", ";", "if", "(", "container", "instanceof", "IContainer", ")", "{", "IResource", "[", "]", "members", "=", "(", "(", "IContainer", ")", "container", ")", ".", "members", "(", ")", ";", "dirTable", "=", "new", "SimpleLookupTable", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "members", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "IResource", "m", "=", "members", "[", "i", "]", ";", "String", "name", ";", "if", "(", "m", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", ")", "{", "int", "index", "=", "Util", ".", "indexOfJavaLikeExtension", "(", "name", "=", "m", ".", "getName", "(", ")", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "String", "fullPath", "=", "m", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "!", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isExcluded", "(", "fullPath", ".", "toCharArray", "(", ")", ",", "this", ".", "fulInclusionPatternChars", ",", "this", ".", "fullExclusionPatternChars", ",", "false", ")", ")", "{", "dirTable", ".", "put", "(", "name", ".", "substring", "(", "0", ",", "index", ")", ",", "m", ")", ";", "}", "}", "}", "}", "this", ".", "directoryCache", ".", "put", "(", "qualifiedPackageName", ",", "dirTable", ")", ";", "return", "dirTable", ";", "}", "}", "catch", "(", "CoreException", "ignored", ")", "{", "}", "this", ".", "directoryCache", ".", "put", "(", "qualifiedPackageName", ",", "this", ".", "missingPackageHolder", ")", ";", "return", "null", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "this", "==", "o", ")", "return", "true", ";", "if", "(", "!", "(", "o", "instanceof", "ClasspathSourceDirectory", ")", ")", "return", "false", ";", "return", "this", ".", "sourceFolder", ".", "equals", "(", "(", "(", "ClasspathSourceDirectory", ")", "o", ")", ".", "sourceFolder", ")", ";", "}", "public", "NameEnvironmentAnswer", "findClass", "(", "String", "sourceFileWithoutExtension", ",", "String", "qualifiedPackageName", ",", "String", "qualifiedSourceFileWithoutExtension", ")", "{", "SimpleLookupTable", "dirTable", "=", "directoryTable", "(", "qualifiedPackageName", ")", ";", "if", "(", "dirTable", "!=", "null", "&&", "dirTable", ".", "elementSize", ">", "0", ")", "{", "IFile", "file", "=", "(", "IFile", ")", "dirTable", ".", "get", "(", "sourceFileWithoutExtension", ")", ";", "if", "(", "file", "!=", "null", ")", "{", "return", "new", "NameEnvironmentAnswer", "(", "new", "ResourceCompilationUnit", "(", "file", ",", "file", ".", "getLocationURI", "(", ")", ")", ",", "null", ")", ";", "}", "}", "return", "null", ";", "}", "public", "IPath", "getProjectRelativePath", "(", ")", "{", "return", "this", ".", "sourceFolder", ".", "getProjectRelativePath", "(", ")", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "this", ".", "sourceFolder", "==", "null", "?", "super", ".", "hashCode", "(", ")", ":", "this", ".", "sourceFolder", ".", "hashCode", "(", ")", ";", "}", "public", "boolean", "isPackage", "(", "String", "qualifiedPackageName", ")", "{", "return", "directoryTable", "(", "qualifiedPackageName", ")", "!=", "null", ";", "}", "public", "void", "reset", "(", ")", "{", "this", ".", "directoryCache", "=", "new", "SimpleLookupTable", "(", "5", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "this", ".", "sourceFolder", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ";", "}", "public", "String", "debugPathString", "(", ")", "{", "return", "this", ".", "sourceFolder", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,576
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "HashtableOfLong", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "MatchingNodeSet", "{", "SimpleLookupTable", "matchingNodes", "=", "new", "SimpleLookupTable", "(", "3", ")", ";", "private", "HashtableOfLong", "matchingNodesKeys", "=", "new", "HashtableOfLong", "(", "3", ")", ";", "static", "Integer", "EXACT_MATCH", "=", "new", "Integer", "(", "SearchMatch", ".", "A_ACCURATE", ")", ";", "static", "Integer", "POTENTIAL_MATCH", "=", "new", "Integer", "(", "SearchMatch", ".", "A_INACCURATE", ")", ";", "static", "Integer", "ERASURE_MATCH", "=", "new", "Integer", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "public", "boolean", "mustResolve", ";", "SimpleSet", "possibleMatchingNodesSet", "=", "new", "SimpleSet", "(", "7", ")", ";", "private", "HashtableOfLong", "possibleMatchingNodesKeys", "=", "new", "HashtableOfLong", "(", "7", ")", ";", "public", "MatchingNodeSet", "(", "boolean", "mustResolvePattern", ")", "{", "super", "(", ")", ";", "this", ".", "mustResolve", "=", "mustResolvePattern", ";", "}", "public", "int", "addMatch", "(", "ASTNode", "node", ",", "int", "matchLevel", ")", "{", "int", "maskedLevel", "=", "matchLevel", "&", "PatternLocator", ".", "MATCH_LEVEL_MASK", ";", "switch", "(", "maskedLevel", ")", "{", "case", "PatternLocator", ".", "INACCURATE_MATCH", ":", "if", "(", "matchLevel", "!=", "maskedLevel", ")", "{", "addTrustedMatch", "(", "node", ",", "new", "Integer", "(", "SearchMatch", ".", "A_INACCURATE", "+", "(", "matchLevel", "&", "PatternLocator", ".", "FLAVORS_MASK", ")", ")", ")", ";", "}", "else", "{", "addTrustedMatch", "(", "node", ",", "POTENTIAL_MATCH", ")", ";", "}", "break", ";", "case", "PatternLocator", ".", "POSSIBLE_MATCH", ":", "addPossibleMatch", "(", "node", ")", ";", "break", ";", "case", "PatternLocator", ".", "ERASURE_MATCH", ":", "if", "(", "matchLevel", "!=", "maskedLevel", ")", "{", "addTrustedMatch", "(", "node", ",", "new", "Integer", "(", "SearchPattern", ".", "R_ERASURE_MATCH", "+", "(", "matchLevel", "&", "PatternLocator", ".", "FLAVORS_MASK", ")", ")", ")", ";", "}", "else", "{", "addTrustedMatch", "(", "node", ",", "ERASURE_MATCH", ")", ";", "}", "break", ";", "case", "PatternLocator", ".", "ACCURATE_MATCH", ":", "if", "(", "matchLevel", "!=", "maskedLevel", ")", "{", "addTrustedMatch", "(", "node", ",", "new", "Integer", "(", "SearchMatch", ".", "A_ACCURATE", "+", "(", "matchLevel", "&", "PatternLocator", ".", "FLAVORS_MASK", ")", ")", ")", ";", "}", "else", "{", "addTrustedMatch", "(", "node", ",", "EXACT_MATCH", ")", ";", "}", "break", ";", "}", "return", "matchLevel", ";", "}", "public", "void", "addPossibleMatch", "(", "ASTNode", "node", ")", "{", "long", "key", "=", "(", "(", "(", "long", ")", "node", ".", "sourceStart", ")", "<<", "32", ")", "+", "node", ".", "sourceEnd", ";", "ASTNode", "existing", "=", "(", "ASTNode", ")", "this", ".", "possibleMatchingNodesKeys", ".", "get", "(", "key", ")", ";", "if", "(", "existing", "!=", "null", "&&", "existing", ".", "getClass", "(", ")", ".", "equals", "(", "node", ".", "getClass", "(", ")", ")", ")", "this", ".", "possibleMatchingNodesSet", ".", "remove", "(", "existing", ")", ";", "this", ".", "possibleMatchingNodesSet", ".", "add", "(", "node", ")", ";", "this", ".", "possibleMatchingNodesKeys", ".", "put", "(", "key", ",", "node", ")", ";", "}", "public", "void", "addTrustedMatch", "(", "ASTNode", "node", ",", "boolean", "isExact", ")", "{", "addTrustedMatch", "(", "node", ",", "isExact", "?", "EXACT_MATCH", ":", "POTENTIAL_MATCH", ")", ";", "}", "void", "addTrustedMatch", "(", "ASTNode", "node", ",", "Integer", "level", ")", "{", "long", "key", "=", "(", "(", "(", "long", ")", "node", ".", "sourceStart", ")", "<<", "32", ")", "+", "node", ".", "sourceEnd", ";", "ASTNode", "existing", "=", "(", "ASTNode", ")", "this", ".", "matchingNodesKeys", ".", "get", "(", "key", ")", ";", "if", "(", "existing", "!=", "null", "&&", "existing", ".", "getClass", "(", ")", ".", "equals", "(", "node", ".", "getClass", "(", ")", ")", ")", "this", ".", "matchingNodes", ".", "removeKey", "(", "existing", ")", ";", "this", ".", "matchingNodes", ".", "put", "(", "node", ",", "level", ")", ";", "this", ".", "matchingNodesKeys", ".", "put", "(", "key", ",", "node", ")", ";", "}", "protected", "boolean", "hasPossibleNodes", "(", "int", "start", ",", "int", "end", ")", "{", "Object", "[", "]", "nodes", "=", "this", ".", "possibleMatchingNodesSet", ".", "values", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "nodes", "[", "i", "]", ";", "if", "(", "node", "!=", "null", "&&", "start", "<=", "node", ".", "sourceStart", "&&", "node", ".", "sourceEnd", "<=", "end", ")", "return", "true", ";", "}", "nodes", "=", "this", ".", "matchingNodes", ".", "keyTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "nodes", "[", "i", "]", ";", "if", "(", "node", "!=", "null", "&&", "start", "<=", "node", ".", "sourceStart", "&&", "node", ".", "sourceEnd", "<=", "end", ")", "return", "true", ";", "}", "return", "false", ";", "}", "protected", "ASTNode", "[", "]", "matchingNodes", "(", "int", "start", ",", "int", "end", ")", "{", "ArrayList", "nodes", "=", "null", ";", "Object", "[", "]", "keyTable", "=", "this", ".", "matchingNodes", ".", "keyTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "keyTable", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "keyTable", "[", "i", "]", ";", "if", "(", "node", "!=", "null", "&&", "start", "<=", "node", ".", "sourceStart", "&&", "node", ".", "sourceEnd", "<=", "end", ")", "{", "if", "(", "nodes", "==", "null", ")", "nodes", "=", "new", "ArrayList", "(", ")", ";", "nodes", ".", "add", "(", "node", ")", ";", "}", "}", "if", "(", "nodes", "==", "null", ")", "return", "null", ";", "ASTNode", "[", "]", "result", "=", "new", "ASTNode", "[", "nodes", ".", "size", "(", ")", "]", ";", "nodes", ".", "toArray", "(", "result", ")", ";", "Util", ".", "Comparer", "comparer", "=", "new", "Util", ".", "Comparer", "(", ")", "{", "public", "int", "compare", "(", "Object", "o1", ",", "Object", "o2", ")", "{", "return", "(", "(", "ASTNode", ")", "o1", ")", ".", "sourceStart", "-", "(", "(", "ASTNode", ")", "o2", ")", ".", "sourceStart", ";", "}", "}", ";", "Util", ".", "sort", "(", "result", ",", "comparer", ")", ";", "return", "result", ";", "}", "public", "Object", "removePossibleMatch", "(", "ASTNode", "node", ")", "{", "long", "key", "=", "(", "(", "(", "long", ")", "node", ".", "sourceStart", ")", "<<", "32", ")", "+", "node", ".", "sourceEnd", ";", "ASTNode", "existing", "=", "(", "ASTNode", ")", "this", ".", "possibleMatchingNodesKeys", ".", "get", "(", "key", ")", ";", "if", "(", "existing", "==", "null", ")", "return", "null", ";", "this", ".", "possibleMatchingNodesKeys", ".", "put", "(", "key", ",", "null", ")", ";", "return", "this", ".", "possibleMatchingNodesSet", ".", "remove", "(", "node", ")", ";", "}", "public", "Object", "removeTrustedMatch", "(", "ASTNode", "node", ")", "{", "long", "key", "=", "(", "(", "(", "long", ")", "node", ".", "sourceStart", ")", "<<", "32", ")", "+", "node", ".", "sourceEnd", ";", "ASTNode", "existing", "=", "(", "ASTNode", ")", "this", ".", "matchingNodesKeys", ".", "get", "(", "key", ")", ";", "if", "(", "existing", "==", "null", ")", "return", "null", ";", "this", ".", "matchingNodesKeys", ".", "put", "(", "key", ",", "null", ")", ";", "return", "this", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", ")", ";", "result", ".", "append", "(", "\"\"", ")", ";", "Object", "[", "]", "keyTable", "=", "this", ".", "matchingNodes", ".", "keyTable", ";", "Object", "[", "]", "valueTable", "=", "this", ".", "matchingNodes", ".", "valueTable", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "keyTable", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "keyTable", "[", "i", "]", ";", "if", "(", "node", "==", "null", ")", "continue", ";", "result", ".", "append", "(", "\"nt\"", ")", ";", "switch", "(", "(", "(", "Integer", ")", "valueTable", "[", "i", "]", ")", ".", "intValue", "(", ")", ")", "{", "case", "SearchMatch", ".", "A_ACCURATE", ":", "result", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchMatch", ".", "A_INACCURATE", ":", "result", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "SearchPattern", ".", "R_ERASURE_MATCH", ":", "result", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "node", ".", "print", "(", "0", ",", "result", ")", ";", "}", "result", ".", "append", "(", "\"\"", ")", ";", "Object", "[", "]", "nodes", "=", "this", ".", "possibleMatchingNodesSet", ".", "values", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "nodes", "[", "i", "]", ";", "if", "(", "node", "==", "null", ")", "continue", ";", "result", ".", "append", "(", "\"\"", ")", ";", "node", ".", "print", "(", "0", ",", "result", ")", ";", "}", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,577
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IContainer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspaceRoot", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "INameEnvironment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "NameEnvironmentAnswer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModel", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "ClasspathJar", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "ClasspathLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "JavaSearchNameEnvironment", "implements", "INameEnvironment", ",", "SuffixConstants", "{", "ClasspathLocation", "[", "]", "locations", ";", "HashMap", "workingCopies", ";", "public", "JavaSearchNameEnvironment", "(", "IJavaProject", "javaProject", ",", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "copies", ")", "{", "computeClasspathLocations", "(", "javaProject", ".", "getProject", "(", ")", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ",", "(", "JavaProject", ")", "javaProject", ")", ";", "try", "{", "int", "length", "=", "copies", "==", "null", "?", "0", ":", "copies", ".", "length", ";", "this", ".", "workingCopies", "=", "new", "HashMap", "(", "length", ")", ";", "if", "(", "copies", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "IPackageDeclaration", "[", "]", "pkgs", "=", "workingCopy", ".", "getPackageDeclarations", "(", ")", ";", "String", "pkg", "=", "pkgs", ".", "length", ">", "0", "?", "pkgs", "[", "0", "]", ".", "getElementName", "(", ")", ":", "\"\"", ";", "String", "cuName", "=", "workingCopy", ".", "getElementName", "(", ")", ";", "String", "mainTypeName", "=", "Util", ".", "getNameWithoutJavaLikeExtension", "(", "cuName", ")", ";", "String", "qualifiedMainTypeName", "=", "pkg", ".", "length", "(", ")", "==", "0", "?", "mainTypeName", ":", "pkg", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "'/'", "+", "mainTypeName", ";", "this", ".", "workingCopies", ".", "put", "(", "qualifiedMainTypeName", ",", "workingCopy", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "public", "void", "cleanup", "(", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "locations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "locations", "[", "i", "]", ".", "cleanup", "(", ")", ";", "}", "}", "private", "void", "computeClasspathLocations", "(", "IWorkspaceRoot", "workspaceRoot", ",", "JavaProject", "javaProject", ")", "{", "IPackageFragmentRoot", "[", "]", "roots", "=", "null", ";", "try", "{", "roots", "=", "javaProject", ".", "getAllPackageFragmentRoots", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "this", ".", "locations", "=", "new", "ClasspathLocation", "[", "0", "]", ";", "return", ";", "}", "int", "length", "=", "roots", ".", "length", ";", "ClasspathLocation", "[", "]", "cpLocations", "=", "new", "ClasspathLocation", "[", "length", "]", ";", "int", "index", "=", "0", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "roots", "[", "i", "]", ";", "IPath", "path", "=", "root", ".", "getPath", "(", ")", ";", "try", "{", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "ZipFile", "zipFile", "=", "manager", ".", "getZipFile", "(", "path", ")", ";", "cpLocations", "[", "index", "++", "]", "=", "new", "ClasspathJar", "(", "zipFile", ",", "(", "(", "ClasspathEntry", ")", "root", ".", "getRawClasspathEntry", "(", ")", ")", ".", "getAccessRuleSet", "(", ")", ")", ";", "}", "else", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "true", ")", ";", "if", "(", "target", "==", "null", ")", "{", "System", ".", "arraycopy", "(", "cpLocations", ",", "0", ",", "cpLocations", "=", "new", "ClasspathLocation", "[", "cpLocations", ".", "length", "-", "1", "]", ",", "0", ",", "index", ")", ";", "}", "else", "if", "(", "root", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_SOURCE", ")", "{", "cpLocations", "[", "index", "++", "]", "=", "new", "ClasspathSourceDirectory", "(", "(", "IContainer", ")", "target", ",", "root", ".", "fullExclusionPatternChars", "(", ")", ",", "root", ".", "fullInclusionPatternChars", "(", ")", ")", ";", "}", "else", "{", "cpLocations", "[", "index", "++", "]", "=", "ClasspathLocation", ".", "forBinaryFolder", "(", "(", "IContainer", ")", "target", ",", "false", ",", "(", "(", "ClasspathEntry", ")", "root", ".", "getRawClasspathEntry", "(", ")", ")", ".", "getAccessRuleSet", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "CoreException", "e1", ")", "{", "System", ".", "arraycopy", "(", "cpLocations", ",", "0", ",", "cpLocations", "=", "new", "ClasspathLocation", "[", "cpLocations", ".", "length", "-", "1", "]", ",", "0", ",", "index", ")", ";", "}", "}", "this", ".", "locations", "=", "cpLocations", ";", "}", "private", "NameEnvironmentAnswer", "findClass", "(", "String", "qualifiedTypeName", ",", "char", "[", "]", "typeName", ")", "{", "String", "binaryFileName", "=", "null", ",", "qBinaryFileName", "=", "null", ",", "sourceFileName", "=", "null", ",", "qSourceFileName", "=", "null", ",", "qPackageName", "=", "null", ";", "NameEnvironmentAnswer", "suggestedAnswer", "=", "null", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "locations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ClasspathLocation", "location", "=", "this", ".", "locations", "[", "i", "]", ";", "NameEnvironmentAnswer", "answer", ";", "if", "(", "location", "instanceof", "ClasspathSourceDirectory", ")", "{", "if", "(", "sourceFileName", "==", "null", ")", "{", "qSourceFileName", "=", "qualifiedTypeName", ";", "sourceFileName", "=", "qSourceFileName", ";", "qPackageName", "=", "\"\"", ";", "if", "(", "qualifiedTypeName", ".", "length", "(", ")", ">", "typeName", ".", "length", ")", "{", "int", "typeNameStart", "=", "qSourceFileName", ".", "length", "(", ")", "-", "typeName", ".", "length", ";", "qPackageName", "=", "qSourceFileName", ".", "substring", "(", "0", ",", "typeNameStart", "-", "1", ")", ";", "sourceFileName", "=", "qSourceFileName", ".", "substring", "(", "typeNameStart", ")", ";", "}", "}", "ICompilationUnit", "workingCopy", "=", "(", "ICompilationUnit", ")", "this", ".", "workingCopies", ".", "get", "(", "qualifiedTypeName", ")", ";", "if", "(", "workingCopy", "!=", "null", ")", "{", "answer", "=", "new", "NameEnvironmentAnswer", "(", "workingCopy", ",", "null", ")", ";", "}", "else", "{", "answer", "=", "location", ".", "findClass", "(", "sourceFileName", ",", "qPackageName", ",", "qSourceFileName", ")", ";", "}", "}", "else", "{", "if", "(", "binaryFileName", "==", "null", ")", "{", "qBinaryFileName", "=", "qualifiedTypeName", "+", "SUFFIX_STRING_class", ";", "binaryFileName", "=", "qBinaryFileName", ";", "qPackageName", "=", "\"\"", ";", "if", "(", "qualifiedTypeName", ".", "length", "(", ")", ">", "typeName", ".", "length", ")", "{", "int", "typeNameStart", "=", "qBinaryFileName", ".", "length", "(", ")", "-", "typeName", ".", "length", "-", "6", ";", "qPackageName", "=", "qBinaryFileName", ".", "substring", "(", "0", ",", "typeNameStart", "-", "1", ")", ";", "binaryFileName", "=", "qBinaryFileName", ".", "substring", "(", "typeNameStart", ")", ";", "}", "}", "answer", "=", "location", ".", "findClass", "(", "binaryFileName", ",", "qPackageName", ",", "qBinaryFileName", ")", ";", "}", "if", "(", "answer", "!=", "null", ")", "{", "if", "(", "!", "answer", ".", "ignoreIfBetter", "(", ")", ")", "{", "if", "(", "answer", ".", "isBetter", "(", "suggestedAnswer", ")", ")", "return", "answer", ";", "}", "else", "if", "(", "answer", ".", "isBetter", "(", "suggestedAnswer", ")", ")", "suggestedAnswer", "=", "answer", ";", "}", "}", "if", "(", "suggestedAnswer", "!=", "null", ")", "return", "suggestedAnswer", ";", "return", "null", ";", "}", "public", "NameEnvironmentAnswer", "findType", "(", "char", "[", "]", "typeName", ",", "char", "[", "]", "[", "]", "packageName", ")", "{", "if", "(", "typeName", "!=", "null", ")", "return", "findClass", "(", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "packageName", ",", "typeName", ",", "'/'", ")", ")", ",", "typeName", ")", ";", "return", "null", ";", "}", "public", "NameEnvironmentAnswer", "findType", "(", "char", "[", "]", "[", "]", "compoundName", ")", "{", "if", "(", "compoundName", "!=", "null", ")", "return", "findClass", "(", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'/'", ")", ")", ",", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ")", ";", "return", "null", ";", "}", "public", "boolean", "isPackage", "(", "char", "[", "]", "[", "]", "compoundName", ",", "char", "[", "]", "packageName", ")", "{", "return", "isPackage", "(", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "packageName", ",", "'/'", ")", ")", ")", ";", "}", "public", "boolean", "isPackage", "(", "String", "qualifiedPackageName", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "locations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "if", "(", "this", ".", "locations", "[", "i", "]", ".", "isPackage", "(", "qualifiedPackageName", ")", ")", "return", "true", ";", "return", "false", ";", "}", "}", "</s>" ]
2,578
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ConstructorDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Expression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "FieldDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ImportReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "LocalDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MemberValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MessageSend", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MethodDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Reference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeParameter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "FieldBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MemberTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", ";", "public", "class", "OrLocator", "extends", "PatternLocator", "{", "protected", "PatternLocator", "[", "]", "patternLocators", ";", "public", "OrLocator", "(", "OrPattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "SearchPattern", "[", "]", "patterns", "=", "pattern", ".", "patterns", ";", "int", "length", "=", "patterns", ".", "length", ";", "this", ".", "patternLocators", "=", "new", "PatternLocator", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "this", ".", "patternLocators", "[", "i", "]", "=", "PatternLocator", ".", "patternLocator", "(", "patterns", "[", "i", "]", ")", ";", "}", "public", "void", "initializePolymorphicSearch", "(", "MatchLocator", "locator", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "this", ".", "patternLocators", "[", "i", "]", ".", "initializePolymorphicSearch", "(", "locator", ")", ";", "}", "public", "int", "match", "(", "Annotation", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "ASTNode", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "ConstructorDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "Expression", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "FieldDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "LocalDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "MethodDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "MemberValuePair", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "MessageSend", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "Reference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "TypeDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "TypeParameter", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "TypeReference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "int", "result", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "result", "|=", "this", ".", "patternLocators", "[", "i", "]", ".", "matchContainer", "(", ")", ";", "return", "result", ";", "}", "protected", "void", "matchLevelAndReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "Binding", "refBinding", "=", "binding", ";", "if", "(", "importRef", ".", "isStatic", "(", ")", ")", "{", "if", "(", "binding", "instanceof", "FieldBinding", ")", "{", "FieldBinding", "fieldBinding", "=", "(", "FieldBinding", ")", "binding", ";", "if", "(", "!", "fieldBinding", ".", "isStatic", "(", ")", ")", "return", ";", "refBinding", "=", "fieldBinding", ".", "declaringClass", ";", "}", "else", "if", "(", "binding", "instanceof", "MethodBinding", ")", "{", "MethodBinding", "methodBinding", "=", "(", "MethodBinding", ")", "binding", ";", "if", "(", "!", "methodBinding", ".", "isStatic", "(", ")", ")", "return", ";", "refBinding", "=", "methodBinding", ".", "declaringClass", ";", "}", "else", "if", "(", "binding", "instanceof", "MemberTypeBinding", ")", "{", "MemberTypeBinding", "memberBinding", "=", "(", "MemberTypeBinding", ")", "binding", ";", "if", "(", "!", "memberBinding", ".", "isStatic", "(", ")", ")", "return", ";", "}", "}", "PatternLocator", "closestPattern", "=", "null", ";", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "PatternLocator", "patternLocator", "=", "this", ".", "patternLocators", "[", "i", "]", ";", "int", "newLevel", "=", "patternLocator", ".", "referenceType", "(", ")", "==", "0", "?", "IMPOSSIBLE_MATCH", ":", "patternLocator", ".", "resolveLevel", "(", "refBinding", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "closestPattern", "=", "patternLocator", ";", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "break", ";", "level", "=", "newLevel", ";", "}", "}", "if", "(", "closestPattern", "!=", "null", ")", "{", "closestPattern", ".", "matchLevelAndReportImportRef", "(", "importRef", ",", "binding", ",", "locator", ")", ";", "}", "}", "protected", "void", "matchReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "IJavaElement", "element", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "PatternLocator", "closestPattern", "=", "null", ";", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "matchLevel", "(", "importRef", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "closestPattern", "=", "this", ".", "patternLocators", "[", "i", "]", ";", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "break", ";", "level", "=", "newLevel", ";", "}", "}", "if", "(", "closestPattern", "!=", "null", ")", "closestPattern", ".", "matchReportImportRef", "(", "importRef", ",", "binding", ",", "element", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "IJavaElement", "localElement", ",", "IJavaElement", "[", "]", "otherElements", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "PatternLocator", "closestPattern", "=", "null", ";", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "PatternLocator", "patternLocator", "=", "this", ".", "patternLocators", "[", "i", "]", ";", "int", "newLevel", "=", "patternLocator", ".", "referenceType", "(", ")", "==", "0", "?", "IMPOSSIBLE_MATCH", ":", "patternLocator", ".", "resolveLevel", "(", "reference", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "closestPattern", "=", "patternLocator", ";", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "break", ";", "level", "=", "newLevel", ";", "}", "}", "if", "(", "closestPattern", "!=", "null", ")", "closestPattern", ".", "matchReportReference", "(", "reference", ",", "element", ",", "localElement", ",", "otherElements", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "matchReportReference", "(", "reference", ",", "element", ",", "null", ",", "null", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "public", "SearchMatch", "newDeclarationMatch", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "int", "length", ",", "MatchLocator", "locator", ")", "{", "PatternLocator", "closestPattern", "=", "null", ";", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "pl", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "pl", ";", "i", "++", ")", "{", "PatternLocator", "patternLocator", "=", "this", ".", "patternLocators", "[", "i", "]", ";", "int", "newLevel", "=", "patternLocator", ".", "referenceType", "(", ")", "==", "0", "?", "IMPOSSIBLE_MATCH", ":", "patternLocator", ".", "resolveLevel", "(", "reference", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "closestPattern", "=", "patternLocator", ";", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "break", ";", "level", "=", "newLevel", ";", "}", "}", "if", "(", "closestPattern", "!=", "null", ")", "{", "return", "closestPattern", ".", "newDeclarationMatch", "(", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "length", ",", "locator", ")", ";", "}", "return", "locator", ".", "newDeclarationMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "reference", ".", "sourceStart", ",", "length", ")", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "node", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "resolveLevel", "(", "node", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "resolveLevel", "(", "binding", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "void", "setFlavors", "(", "int", "flavors", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "patternLocators", "[", "i", "]", ".", "setFlavors", "(", "flavors", ")", ";", "}", "}", "}", "</s>" ]
2,579
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "ObjectVector", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "public", "class", "PossibleMatchSet", "{", "private", "SimpleLookupTable", "rootsToPossibleMatches", "=", "new", "SimpleLookupTable", "(", "5", ")", ";", "private", "int", "elementCount", "=", "0", ";", "public", "void", "add", "(", "PossibleMatch", "possibleMatch", ")", "{", "IPath", "path", "=", "possibleMatch", ".", "openable", ".", "getPackageFragmentRoot", "(", ")", ".", "getPath", "(", ")", ";", "ObjectVector", "possibleMatches", "=", "(", "ObjectVector", ")", "this", ".", "rootsToPossibleMatches", ".", "get", "(", "path", ")", ";", "if", "(", "possibleMatches", "!=", "null", ")", "{", "PossibleMatch", "storedMatch", "=", "(", "PossibleMatch", ")", "possibleMatches", ".", "find", "(", "possibleMatch", ")", ";", "if", "(", "storedMatch", "!=", "null", ")", "{", "while", "(", "storedMatch", ".", "getSimilarMatch", "(", ")", "!=", "null", ")", "{", "storedMatch", "=", "storedMatch", ".", "getSimilarMatch", "(", ")", ";", "}", "storedMatch", ".", "setSimilarMatch", "(", "possibleMatch", ")", ";", "return", ";", "}", "}", "else", "{", "this", ".", "rootsToPossibleMatches", ".", "put", "(", "path", ",", "possibleMatches", "=", "new", "ObjectVector", "(", ")", ")", ";", "}", "possibleMatches", ".", "add", "(", "possibleMatch", ")", ";", "this", ".", "elementCount", "++", ";", "}", "public", "PossibleMatch", "[", "]", "getPossibleMatches", "(", "IPackageFragmentRoot", "[", "]", "roots", ")", "{", "PossibleMatch", "[", "]", "result", "=", "new", "PossibleMatch", "[", "this", ".", "elementCount", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "roots", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ObjectVector", "possibleMatches", "=", "(", "ObjectVector", ")", "this", ".", "rootsToPossibleMatches", ".", "get", "(", "roots", "[", "i", "]", ".", "getPath", "(", ")", ")", ";", "if", "(", "possibleMatches", "!=", "null", ")", "{", "possibleMatches", ".", "copyInto", "(", "result", ",", "index", ")", ";", "index", "+=", "possibleMatches", ".", "size", "(", ")", ";", "}", "}", "if", "(", "index", "<", "this", ".", "elementCount", ")", "System", ".", "arraycopy", "(", "result", ",", "0", ",", "result", "=", "new", "PossibleMatch", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "result", ";", "}", "public", "void", "reset", "(", ")", "{", "this", ".", "rootsToPossibleMatches", "=", "new", "SimpleLookupTable", "(", "5", ")", ";", "this", ".", "elementCount", "=", "0", ";", "}", "}", "</s>" ]
2,580
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "public", "class", "FieldLocator", "extends", "VariableLocator", "{", "protected", "boolean", "isDeclarationOfAccessedFieldsPattern", ";", "public", "FieldLocator", "(", "FieldPattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "isDeclarationOfAccessedFieldsPattern", "=", "this", ".", "pattern", "instanceof", "DeclarationOfAccessedFieldsPattern", ";", "}", "protected", "int", "fineGrain", "(", ")", "{", "return", "this", ".", "pattern", ".", "fineGrain", ";", "}", "public", "int", "match", "(", "ASTNode", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "declarationsLevel", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "{", "if", "(", "node", "instanceof", "ImportReference", ")", "{", "ImportReference", "importRef", "=", "(", "ImportReference", ")", "node", ";", "int", "length", "=", "importRef", ".", "tokens", ".", "length", "-", "1", ";", "if", "(", "importRef", ".", "isStatic", "(", ")", "&&", "(", "(", "importRef", ".", "bits", "&", "ASTNode", ".", "OnDemand", ")", "==", "0", ")", "&&", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "importRef", ".", "tokens", "[", "length", "]", ")", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "new", "char", "[", "length", "]", "[", "]", ";", "System", ".", "arraycopy", "(", "importRef", ".", "tokens", ",", "0", ",", "compoundName", ",", "0", ",", "length", ")", ";", "FieldPattern", "fieldPattern", "=", "(", "FieldPattern", ")", "this", ".", "pattern", ";", "char", "[", "]", "declaringType", "=", "CharOperation", ".", "concat", "(", "fieldPattern", ".", "declaringQualification", ",", "fieldPattern", ".", "declaringSimpleName", ",", "'.'", ")", ";", "if", "(", "matchesName", "(", "declaringType", ",", "CharOperation", ".", "concatWith", "(", "compoundName", ",", "'.'", ")", ")", ")", "{", "declarationsLevel", "=", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "}", "}", "}", "}", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "declarationsLevel", ")", ";", "}", "public", "int", "match", "(", "FieldDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "referencesLevel", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "findReferences", ")", "if", "(", "this", ".", "pattern", ".", "writeAccess", "&&", "!", "this", ".", "pattern", ".", "readAccess", "&&", "node", ".", "initialization", "!=", "null", ")", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "node", ".", "name", ")", ")", "referencesLevel", "=", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "int", "declarationsLevel", "=", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "findDeclarations", ")", "{", "switch", "(", "node", ".", "getKind", "(", ")", ")", "{", "case", "AbstractVariableDeclaration", ".", "FIELD", ":", "case", "AbstractVariableDeclaration", ".", "ENUM_CONSTANT", ":", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "node", ".", "name", ")", ")", "if", "(", "matchesTypeReference", "(", "(", "(", "FieldPattern", ")", "this", ".", "pattern", ")", ".", "typeSimpleName", ",", "node", ".", "type", ")", ")", "declarationsLevel", "=", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ";", "break", ";", "}", "}", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "referencesLevel", ">=", "declarationsLevel", "?", "referencesLevel", ":", "declarationsLevel", ")", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", "||", "this", ".", "pattern", ".", "fineGrain", "!=", "0", ")", "{", "return", "ALL_CONTAINER", ";", "}", "return", "CLASS_CONTAINER", ";", "}", "protected", "int", "matchField", "(", "FieldBinding", "field", ",", "boolean", "matchName", ")", "{", "if", "(", "field", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "matchName", "&&", "!", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "field", ".", "readableName", "(", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "FieldPattern", "fieldPattern", "=", "(", "FieldPattern", ")", "this", ".", "pattern", ";", "ReferenceBinding", "receiverBinding", "=", "field", ".", "declaringClass", ";", "if", "(", "receiverBinding", "==", "null", ")", "{", "if", "(", "field", "==", "ArrayBinding", ".", "ArrayLength", ")", "return", "fieldPattern", ".", "declaringQualification", "==", "null", "&&", "fieldPattern", ".", "declaringSimpleName", "==", "null", "?", "ACCURATE_MATCH", ":", "IMPOSSIBLE_MATCH", ";", "return", "INACCURATE_MATCH", ";", "}", "int", "declaringLevel", "=", "resolveLevelForType", "(", "fieldPattern", ".", "declaringSimpleName", ",", "fieldPattern", ".", "declaringQualification", ",", "receiverBinding", ")", ";", "if", "(", "declaringLevel", "==", "IMPOSSIBLE_MATCH", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "fieldPattern", ".", "declaringSimpleName", "==", "null", ")", "return", "declaringLevel", ";", "FieldBinding", "fieldBinding", "=", "field", ";", "if", "(", "field", "instanceof", "ParameterizedFieldBinding", ")", "{", "fieldBinding", "=", "(", "(", "ParameterizedFieldBinding", ")", "field", ")", ".", "originalField", ";", "}", "int", "typeLevel", "=", "resolveLevelForType", "(", "fieldBinding", ".", "type", ")", ";", "return", "declaringLevel", ">", "typeLevel", "?", "typeLevel", ":", "declaringLevel", ";", "}", "protected", "void", "matchLevelAndReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "importRef", ".", "isStatic", "(", ")", "&&", "binding", "instanceof", "FieldBinding", ")", "{", "super", ".", "matchLevelAndReportImportRef", "(", "importRef", ",", "binding", ",", "locator", ")", ";", "}", "}", "protected", "int", "matchReference", "(", "Reference", "node", ",", "MatchingNodeSet", "nodeSet", ",", "boolean", "writeOnlyAccess", ")", "{", "if", "(", "node", "instanceof", "FieldReference", ")", "{", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "(", "(", "FieldReference", ")", "node", ")", ".", "token", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "return", "super", ".", "matchReference", "(", "node", ",", "nodeSet", ",", "writeOnlyAccess", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "matchReportReference", "(", "reference", ",", "element", ",", "null", ",", "null", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "IJavaElement", "localElement", ",", "IJavaElement", "[", "]", "otherElements", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "isDeclarationOfAccessedFieldsPattern", ")", "{", "if", "(", "accuracy", "!=", "SearchMatch", ".", "A_ACCURATE", ")", "return", ";", "DeclarationOfAccessedFieldsPattern", "declPattern", "=", "(", "DeclarationOfAccessedFieldsPattern", ")", "this", ".", "pattern", ";", "while", "(", "element", "!=", "null", "&&", "!", "declPattern", ".", "enclosingElement", ".", "equals", "(", "element", ")", ")", "element", "=", "element", ".", "getParent", "(", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "if", "(", "reference", "instanceof", "FieldReference", ")", "{", "reportDeclaration", "(", "(", "(", "FieldReference", ")", "reference", ")", ".", "binding", ",", "locator", ",", "declPattern", ".", "knownFields", ")", ";", "}", "else", "if", "(", "reference", "instanceof", "QualifiedNameReference", ")", "{", "QualifiedNameReference", "qNameRef", "=", "(", "QualifiedNameReference", ")", "reference", ";", "Binding", "nameBinding", "=", "qNameRef", ".", "binding", ";", "if", "(", "nameBinding", "instanceof", "FieldBinding", ")", "reportDeclaration", "(", "(", "FieldBinding", ")", "nameBinding", ",", "locator", ",", "declPattern", ".", "knownFields", ")", ";", "int", "otherMax", "=", "qNameRef", ".", "otherBindings", "==", "null", "?", "0", ":", "qNameRef", ".", "otherBindings", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "otherMax", ";", "i", "++", ")", "reportDeclaration", "(", "qNameRef", ".", "otherBindings", "[", "i", "]", ",", "locator", ",", "declPattern", ".", "knownFields", ")", ";", "}", "else", "if", "(", "reference", "instanceof", "SingleNameReference", ")", "{", "reportDeclaration", "(", "(", "FieldBinding", ")", "(", "(", "SingleNameReference", ")", "reference", ")", ".", "binding", ",", "locator", ",", "declPattern", ".", "knownFields", ")", ";", "}", "}", "}", "else", "if", "(", "reference", "instanceof", "ImportReference", ")", "{", "ImportReference", "importRef", "=", "(", "ImportReference", ")", "reference", ";", "long", "[", "]", "positions", "=", "importRef", ".", "sourcePositions", ";", "int", "lastIndex", "=", "importRef", ".", "tokens", ".", "length", "-", "1", ";", "int", "start", "=", "(", "int", ")", "(", "(", "positions", "[", "lastIndex", "]", ")", ">>>", "32", ")", ";", "int", "end", "=", "(", "int", ")", "positions", "[", "lastIndex", "]", ";", "this", ".", "match", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "accuracy", ",", "start", ",", "end", "-", "start", "+", "1", ",", "importRef", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "else", "if", "(", "reference", "instanceof", "FieldReference", ")", "{", "FieldReference", "fieldReference", "=", "(", "FieldReference", ")", "reference", ";", "long", "position", "=", "fieldReference", ".", "nameSourcePosition", ";", "int", "start", "=", "(", "int", ")", "(", "position", ">>>", "32", ")", ";", "int", "end", "=", "(", "int", ")", "position", ";", "this", ".", "match", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "accuracy", ",", "start", ",", "end", "-", "start", "+", "1", ",", "fieldReference", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "else", "if", "(", "reference", "instanceof", "SingleNameReference", ")", "{", "int", "offset", "=", "reference", ".", "sourceStart", ";", "this", ".", "match", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "accuracy", ",", "offset", ",", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ",", "reference", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "else", "if", "(", "reference", "instanceof", "QualifiedNameReference", ")", "{", "QualifiedNameReference", "qNameRef", "=", "(", "QualifiedNameReference", ")", "reference", ";", "int", "length", "=", "qNameRef", ".", "tokens", ".", "length", ";", "SearchMatch", "[", "]", "matches", "=", "new", "SearchMatch", "[", "length", "]", ";", "Binding", "nameBinding", "=", "qNameRef", ".", "binding", ";", "int", "indexOfFirstFieldBinding", "=", "qNameRef", ".", "indexOfFirstFieldBinding", ">", "0", "?", "qNameRef", ".", "indexOfFirstFieldBinding", "-", "1", ":", "0", ";", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "qNameRef", ".", "tokens", "[", "indexOfFirstFieldBinding", "]", ")", "&&", "!", "(", "nameBinding", "instanceof", "LocalVariableBinding", ")", ")", "{", "FieldBinding", "fieldBinding", "=", "nameBinding", "instanceof", "FieldBinding", "?", "(", "FieldBinding", ")", "nameBinding", ":", "null", ";", "if", "(", "fieldBinding", "==", "null", ")", "{", "matches", "[", "indexOfFirstFieldBinding", "]", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "accuracy", ",", "-", "1", ",", "-", "1", ",", "reference", ")", ";", "}", "else", "{", "switch", "(", "matchField", "(", "fieldBinding", ",", "false", ")", ")", "{", "case", "ACCURATE_MATCH", ":", "matches", "[", "indexOfFirstFieldBinding", "]", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "SearchMatch", ".", "A_ACCURATE", ",", "-", "1", ",", "-", "1", ",", "reference", ")", ";", "break", ";", "case", "INACCURATE_MATCH", ":", "this", ".", "match", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "SearchMatch", ".", "A_INACCURATE", ",", "-", "1", ",", "-", "1", ",", "reference", ")", ";", "if", "(", "fieldBinding", ".", "type", "!=", "null", "&&", "fieldBinding", ".", "type", ".", "isParameterizedType", "(", ")", "&&", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "updateMatch", "(", "(", "ParameterizedTypeBinding", ")", "fieldBinding", ".", "type", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "locator", ")", ";", "}", "matches", "[", "indexOfFirstFieldBinding", "]", "=", "this", ".", "match", ";", "break", ";", "}", "}", "}", "for", "(", "int", "i", "=", "indexOfFirstFieldBinding", "+", "1", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "[", "]", "token", "=", "qNameRef", ".", "tokens", "[", "i", "]", ";", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "token", ")", ")", "{", "FieldBinding", "otherBinding", "=", "qNameRef", ".", "otherBindings", "==", "null", "?", "null", ":", "qNameRef", ".", "otherBindings", "[", "i", "-", "(", "indexOfFirstFieldBinding", "+", "1", ")", "]", ";", "if", "(", "otherBinding", "==", "null", ")", "{", "matches", "[", "i", "]", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "accuracy", ",", "-", "1", ",", "-", "1", ",", "reference", ")", ";", "}", "else", "{", "switch", "(", "matchField", "(", "otherBinding", ",", "false", ")", ")", "{", "case", "ACCURATE_MATCH", ":", "matches", "[", "i", "]", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "SearchMatch", ".", "A_ACCURATE", ",", "-", "1", ",", "-", "1", ",", "reference", ")", ";", "break", ";", "case", "INACCURATE_MATCH", ":", "this", ".", "match", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "localElement", ",", "elementBinding", ",", "SearchMatch", ".", "A_INACCURATE", ",", "-", "1", ",", "-", "1", ",", "reference", ")", ";", "if", "(", "otherBinding", ".", "type", "!=", "null", "&&", "otherBinding", ".", "type", ".", "isParameterizedType", "(", ")", "&&", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "updateMatch", "(", "(", "ParameterizedTypeBinding", ")", "otherBinding", ".", "type", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "locator", ")", ";", "}", "matches", "[", "i", "]", "=", "this", ".", "match", ";", "break", ";", "}", "}", "}", "}", "locator", ".", "reportAccurateFieldReference", "(", "matches", ",", "qNameRef", ")", ";", "}", "}", "protected", "void", "updateMatch", "(", "ParameterizedTypeBinding", "parameterizedBinding", ",", "char", "[", "]", "[", "]", "[", "]", "patternTypeArguments", ",", "MatchLocator", "locator", ")", "{", "if", "(", "locator", ".", "unitScope", "==", "null", ")", "return", ";", "updateMatch", "(", "parameterizedBinding", ",", "patternTypeArguments", ",", "false", ",", "0", ",", "locator", ")", ";", "if", "(", "!", "this", ".", "match", ".", "isExact", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "0", ")", ";", "}", "}", "protected", "void", "reportDeclaration", "(", "FieldBinding", "fieldBinding", ",", "MatchLocator", "locator", ",", "SimpleSet", "knownFields", ")", "throws", "CoreException", "{", "if", "(", "fieldBinding", "==", "ArrayBinding", ".", "ArrayLength", ")", "return", ";", "ReferenceBinding", "declaringClass", "=", "fieldBinding", ".", "declaringClass", ";", "IType", "type", "=", "locator", ".", "lookupType", "(", "declaringClass", ")", ";", "if", "(", "type", "==", "null", ")", "return", ";", "char", "[", "]", "bindingName", "=", "fieldBinding", ".", "name", ";", "IField", "field", "=", "type", ".", "getField", "(", "new", "String", "(", "bindingName", ")", ")", ";", "if", "(", "knownFields", ".", "addIfNotIncluded", "(", "field", ")", "==", "null", ")", "return", ";", "IResource", "resource", "=", "type", ".", "getResource", "(", ")", ";", "boolean", "isBinary", "=", "type", ".", "isBinary", "(", ")", ";", "IBinaryType", "info", "=", "null", ";", "if", "(", "isBinary", ")", "{", "if", "(", "resource", "==", "null", ")", "resource", "=", "type", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ";", "info", "=", "locator", ".", "getBinaryInfo", "(", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ClassFile", ")", "type", ".", "getClassFile", "(", ")", ",", "resource", ")", ";", "locator", ".", "reportBinaryMemberDeclaration", "(", "resource", ",", "field", ",", "fieldBinding", ",", "info", ",", "SearchMatch", ".", "A_ACCURATE", ")", ";", "}", "else", "{", "if", "(", "declaringClass", "instanceof", "ParameterizedTypeBinding", ")", "declaringClass", "=", "(", "(", "ParameterizedTypeBinding", ")", "declaringClass", ")", ".", "genericType", "(", ")", ";", "ClassScope", "scope", "=", "(", "(", "SourceTypeBinding", ")", "declaringClass", ")", ".", "scope", ";", "if", "(", "scope", "!=", "null", ")", "{", "TypeDeclaration", "typeDecl", "=", "scope", ".", "referenceContext", ";", "FieldDeclaration", "fieldDecl", "=", "null", ";", "FieldDeclaration", "[", "]", "fieldDecls", "=", "typeDecl", ".", "fields", ";", "int", "length", "=", "fieldDecls", "==", "null", "?", "0", ":", "fieldDecls", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "bindingName", ",", "fieldDecls", "[", "i", "]", ".", "name", ")", ")", "{", "fieldDecl", "=", "fieldDecls", "[", "i", "]", ";", "break", ";", "}", "}", "if", "(", "fieldDecl", "!=", "null", ")", "{", "int", "offset", "=", "fieldDecl", ".", "sourceStart", ";", "this", ".", "match", "=", "new", "FieldDeclarationMatch", "(", "(", "(", "JavaElement", ")", "field", ")", ".", "resolved", "(", "fieldBinding", ")", ",", "SearchMatch", ".", "A_ACCURATE", ",", "offset", ",", "fieldDecl", ".", "sourceEnd", "-", "offset", "+", "1", ",", "locator", ".", "getParticipant", "(", ")", ",", "resource", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "}", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "IJavaElement", ".", "FIELD", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "possiblelMatchingNode", ")", "{", "if", "(", "this", ".", "pattern", ".", "findReferences", "||", "this", ".", "pattern", ".", "fineGrain", "!=", "0", ")", "{", "if", "(", "possiblelMatchingNode", "instanceof", "FieldReference", ")", "return", "matchField", "(", "(", "(", "FieldReference", ")", "possiblelMatchingNode", ")", ".", "binding", ",", "true", ")", ";", "else", "if", "(", "possiblelMatchingNode", "instanceof", "NameReference", ")", "return", "resolveLevel", "(", "(", "NameReference", ")", "possiblelMatchingNode", ")", ";", "}", "if", "(", "possiblelMatchingNode", "instanceof", "FieldDeclaration", ")", "return", "matchField", "(", "(", "(", "FieldDeclaration", ")", "possiblelMatchingNode", ")", ".", "binding", ",", "true", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "!", "(", "binding", "instanceof", "FieldBinding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "matchField", "(", "(", "FieldBinding", ")", "binding", ",", "true", ")", ";", "}", "protected", "int", "resolveLevel", "(", "NameReference", "nameRef", ")", "{", "if", "(", "nameRef", "instanceof", "SingleNameReference", ")", "return", "resolveLevel", "(", "nameRef", ".", "binding", ")", ";", "Binding", "binding", "=", "nameRef", ".", "binding", ";", "QualifiedNameReference", "qNameRef", "=", "(", "QualifiedNameReference", ")", "nameRef", ";", "FieldBinding", "fieldBinding", "=", "null", ";", "if", "(", "binding", "instanceof", "FieldBinding", ")", "{", "fieldBinding", "=", "(", "FieldBinding", ")", "binding", ";", "char", "[", "]", "bindingName", "=", "fieldBinding", ".", "name", ";", "int", "lastDot", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "bindingName", ")", ";", "if", "(", "lastDot", ">", "-", "1", ")", "bindingName", "=", "CharOperation", ".", "subarray", "(", "bindingName", ",", "lastDot", "+", "1", ",", "bindingName", ".", "length", ")", ";", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "bindingName", ")", ")", "{", "int", "level", "=", "matchField", "(", "fieldBinding", ",", "false", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "return", "level", ";", "}", "}", "int", "otherMax", "=", "qNameRef", ".", "otherBindings", "==", "null", "?", "0", ":", "qNameRef", ".", "otherBindings", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "otherMax", ";", "i", "++", ")", "{", "char", "[", "]", "token", "=", "qNameRef", ".", "tokens", "[", "i", "+", "qNameRef", ".", "indexOfFirstFieldBinding", "]", ";", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "name", ",", "token", ")", ")", "{", "FieldBinding", "otherBinding", "=", "qNameRef", ".", "otherBindings", "[", "i", "]", ";", "int", "level", "=", "matchField", "(", "otherBinding", ",", "false", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "return", "level", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "resolveLevelForType", "(", "TypeBinding", "typeBinding", ")", "{", "FieldPattern", "fieldPattern", "=", "(", "FieldPattern", ")", "this", ".", "pattern", ";", "TypeBinding", "fieldTypeBinding", "=", "typeBinding", ";", "if", "(", "fieldTypeBinding", "!=", "null", "&&", "fieldTypeBinding", ".", "isParameterizedType", "(", ")", ")", "{", "fieldTypeBinding", "=", "typeBinding", ".", "erasure", "(", ")", ";", "}", "return", "resolveLevelForType", "(", "fieldPattern", ".", "typeSimpleName", ",", "fieldPattern", ".", "typeQualification", ",", "fieldPattern", ".", "getTypeArguments", "(", ")", ",", "0", ",", "fieldTypeBinding", ")", ";", "}", "}", "</s>" ]
2,581
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "public", "class", "QualifiedTypeDeclarationPattern", "extends", "TypeDeclarationPattern", "{", "public", "char", "[", "]", "qualification", ";", "PackageDeclarationPattern", "packagePattern", ";", "public", "int", "packageIndex", "=", "-", "1", ";", "public", "QualifiedTypeDeclarationPattern", "(", "char", "[", "]", "qualification", ",", "char", "[", "]", "simpleName", ",", "char", "typeSuffix", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "this", ".", "qualification", "=", "this", ".", "isCaseSensitive", "?", "qualification", ":", "CharOperation", ".", "toLowerCase", "(", "qualification", ")", ";", "this", ".", "simpleName", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "simpleName", ":", "CharOperation", ".", "toLowerCase", "(", "simpleName", ")", ";", "this", ".", "typeSuffix", "=", "typeSuffix", ";", "this", ".", "mustResolve", "=", "this", ".", "qualification", "!=", "null", "||", "typeSuffix", "!=", "TYPE_SUFFIX", ";", "}", "public", "QualifiedTypeDeclarationPattern", "(", "char", "[", "]", "qualification", ",", "int", "qualificationMatchRule", ",", "char", "[", "]", "simpleName", ",", "char", "typeSuffix", ",", "int", "matchRule", ")", "{", "this", "(", "qualification", ",", "simpleName", ",", "typeSuffix", ",", "matchRule", ")", ";", "this", ".", "packagePattern", "=", "new", "PackageDeclarationPattern", "(", "qualification", ",", "qualificationMatchRule", ")", ";", "}", "QualifiedTypeDeclarationPattern", "(", "int", "matchRule", ")", "{", "super", "(", "matchRule", ")", ";", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "int", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "0", ")", ";", "this", ".", "simpleName", "=", "CharOperation", ".", "subarray", "(", "key", ",", "0", ",", "slash", ")", ";", "int", "start", "=", "++", "slash", ";", "if", "(", "key", "[", "start", "]", "==", "SEPARATOR", ")", "{", "this", ".", "pkg", "=", "CharOperation", ".", "NO_CHAR", ";", "}", "else", "{", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "this", ".", "pkg", "=", "internedPackageNames", ".", "add", "(", "CharOperation", ".", "subarray", "(", "key", ",", "start", ",", "slash", ")", ")", ";", "}", "this", ".", "qualification", "=", "this", ".", "pkg", ";", "int", "last", "=", "key", ".", "length", "-", "1", ";", "this", ".", "secondary", "=", "key", "[", "last", "]", "==", "'S'", ";", "if", "(", "this", ".", "secondary", ")", "{", "last", "-=", "2", ";", "}", "this", ".", "modifiers", "=", "key", "[", "last", "-", "1", "]", "+", "(", "key", "[", "last", "]", "<<", "16", ")", ";", "decodeModifiers", "(", ")", ";", "start", "=", "slash", "+", "1", ";", "last", "-=", "2", ";", "if", "(", "start", "==", "last", ")", "{", "this", ".", "enclosingTypeNames", "=", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "else", "{", "int", "length", "=", "this", ".", "qualification", ".", "length", ";", "int", "size", "=", "last", "-", "start", ";", "System", ".", "arraycopy", "(", "this", ".", "qualification", ",", "0", ",", "this", ".", "qualification", "=", "new", "char", "[", "length", "+", "1", "+", "size", "]", ",", "0", ",", "length", ")", ";", "this", ".", "qualification", "[", "length", "]", "=", "'.'", ";", "if", "(", "last", "==", "(", "start", "+", "1", ")", "&&", "key", "[", "start", "]", "==", "ZERO_CHAR", ")", "{", "this", ".", "enclosingTypeNames", "=", "ONE_ZERO_CHAR", ";", "this", ".", "qualification", "[", "length", "+", "1", "]", "=", "ZERO_CHAR", ";", "}", "else", "{", "this", ".", "enclosingTypeNames", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "key", ",", "start", ",", "last", ")", ";", "System", ".", "arraycopy", "(", "key", ",", "start", ",", "this", ".", "qualification", ",", "length", "+", "1", ",", "size", ")", ";", "}", "}", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "QualifiedTypeDeclarationPattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "QualifiedTypeDeclarationPattern", "pattern", "=", "(", "QualifiedTypeDeclarationPattern", ")", "decodedPattern", ";", "if", "(", "this", ".", "typeSuffix", "!=", "pattern", ".", "typeSuffix", "&&", "this", ".", "typeSuffix", "!=", "TYPE_SUFFIX", ")", "{", "if", "(", "!", "matchDifferentTypeSuffixes", "(", "this", ".", "typeSuffix", ",", "pattern", ".", "typeSuffix", ")", ")", "{", "return", "false", ";", "}", "}", "return", "matchesName", "(", "this", ".", "simpleName", ",", "pattern", ".", "simpleName", ")", "&&", "(", "this", ".", "qualification", "==", "null", "||", "this", ".", "packagePattern", "==", "null", "||", "this", ".", "packagePattern", ".", "matchesName", "(", "this", ".", "qualification", ",", "pattern", ".", "qualification", ")", ")", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "switch", "(", "this", ".", "typeSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CLASS_AND_ENUM_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "INTERFACE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "ENUM_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "ANNOTATION_TYPE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "default", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "if", "(", "this", ".", "qualification", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "qualification", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\">,", "type<\"", ")", ";", "if", "(", "this", ".", "simpleName", "!=", "null", ")", "output", ".", "append", "(", "this", ".", "simpleName", ")", ";", "else", "output", ".", "append", "(", "\"*\"", ")", ";", "output", ".", "append", "(", "\">", "\"", ")", ";", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,582
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ConstructorDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Expression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "FieldDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ImportReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "LocalDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MemberValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MessageSend", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MethodDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Reference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeParameter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "public", "class", "AndLocator", "extends", "PatternLocator", "{", "final", "PatternLocator", "[", "]", "patternLocators", ";", "final", "int", "[", "]", "levels", ";", "public", "AndLocator", "(", "AndPattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "SearchPattern", "[", "]", "patterns", "=", "pattern", ".", "patterns", ";", "PatternLocator", "[", "]", "locators", "=", "new", "PatternLocator", "[", "patterns", ".", "length", "]", ";", "this", ".", "levels", "=", "new", "int", "[", "patterns", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "patterns", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "locators", "[", "i", "]", "=", "PatternLocator", ".", "patternLocator", "(", "patterns", "[", "i", "]", ")", ";", "this", ".", "levels", "[", "i", "]", "=", "IMPOSSIBLE_MATCH", ";", "}", "this", ".", "patternLocators", "=", "locators", ";", "}", "public", "void", "initializePolymorphicSearch", "(", "MatchLocator", "locator", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "patternLocators", "[", "i", "]", ".", "initializePolymorphicSearch", "(", "locator", ")", ";", "}", "}", "public", "int", "match", "(", "Annotation", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "ASTNode", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "ConstructorDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "Expression", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "FieldDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "LocalDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "MethodDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "MemberValuePair", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "MessageSend", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "Reference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "TypeDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "TypeParameter", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "match", "(", "TypeReference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "match", "(", "node", ",", "nodeSet", ")", ";", "if", "(", "newLevel", ">", "level", ")", "{", "if", "(", "newLevel", "==", "ACCURATE_MATCH", ")", "return", "ACCURATE_MATCH", ";", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "int", "result", "=", "ALL_CONTAINER", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "result", "&=", "this", ".", "patternLocators", "[", "i", "]", ".", "matchContainer", "(", ")", ";", "}", "return", "result", ";", "}", "protected", "void", "matchReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "IJavaElement", "element", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "PatternLocator", "weakestPattern", "=", "null", ";", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "matchLevel", "(", "importRef", ")", ";", "if", "(", "newLevel", "==", "IMPOSSIBLE_MATCH", ")", "return", ";", "if", "(", "weakestPattern", "==", "null", "||", "newLevel", "<", "level", ")", "{", "weakestPattern", "=", "this", ".", "patternLocators", "[", "i", "]", ";", "level", "=", "newLevel", ";", "}", "}", "weakestPattern", ".", "matchReportImportRef", "(", "importRef", ",", "binding", ",", "element", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "IJavaElement", "localElement", ",", "IJavaElement", "[", "]", "otherElements", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "PatternLocator", "weakestPattern", "=", "null", ";", "int", "level", "=", "IMPOSSIBLE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "patternLocators", "[", "i", "]", ".", "referenceType", "(", ")", "==", "0", ")", "return", ";", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "resolveLevel", "(", "reference", ")", ";", "if", "(", "newLevel", "==", "IMPOSSIBLE_MATCH", ")", "return", ";", "if", "(", "weakestPattern", "==", "null", "||", "newLevel", "<", "level", ")", "{", "weakestPattern", "=", "this", ".", "patternLocators", "[", "i", "]", ";", "level", "=", "newLevel", ";", "}", "}", "weakestPattern", ".", "matchReportReference", "(", "reference", ",", "element", ",", "localElement", ",", "otherElements", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "matchReportReference", "(", "reference", ",", "element", ",", "null", ",", "null", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "node", ")", "{", "int", "level", "=", "ACCURATE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "resolveLevel", "(", "node", ")", ";", "if", "(", "newLevel", "==", "IMPOSSIBLE_MATCH", ")", "return", "IMPOSSIBLE_MATCH", ";", "this", ".", "levels", "[", "i", "]", "=", "newLevel", ";", "if", "(", "newLevel", "<", "level", ")", "{", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "int", "level", "=", "ACCURATE_MATCH", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "newLevel", "=", "this", ".", "patternLocators", "[", "i", "]", ".", "resolveLevel", "(", "binding", ")", ";", "if", "(", "newLevel", "==", "IMPOSSIBLE_MATCH", ")", "return", "IMPOSSIBLE_MATCH", ";", "this", ".", "levels", "[", "i", "]", "=", "newLevel", ";", "if", "(", "newLevel", "<", "level", ")", "{", "level", "=", "newLevel", ";", "}", "}", "return", "level", ";", "}", "void", "setFlavors", "(", "int", "flavors", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "patternLocators", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "patternLocators", "[", "i", "]", ".", "setFlavors", "(", "flavors", ")", ";", "}", "}", "}", "</s>" ]
2,583
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAnnotatable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClassFile", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMember", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ISourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "CompilationResult", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "DefaultErrorHandlingPolicies", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileReader", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFormatException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "ITypeRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleLookupTable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ".", "HierarchyResolver", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "BinaryMember", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "BinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ClassFile", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JarPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "LocalVariable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "NameLookup", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "Openable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SearchableEnvironment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SourceMapper", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SourceMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SourceType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SourceTypeElementInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "ASTNodeFinder", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HandleFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "MatchLocator", "implements", "ITypeRequestor", "{", "public", "static", "final", "int", "MAX_AT_ONCE", ";", "static", "{", "long", "maxMemory", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "maxMemory", "(", ")", ";", "int", "ratio", "=", "(", "int", ")", "Math", ".", "round", "(", "(", "(", "double", ")", "maxMemory", ")", "/", "(", "64", "*", "0x100000", ")", ")", ";", "switch", "(", "ratio", ")", "{", "case", "0", ":", "case", "1", ":", "MAX_AT_ONCE", "=", "100", ";", "break", ";", "case", "2", ":", "MAX_AT_ONCE", "=", "200", ";", "break", ";", "case", "3", ":", "MAX_AT_ONCE", "=", "300", ";", "break", ";", "default", ":", "MAX_AT_ONCE", "=", "400", ";", "break", ";", "}", "}", "public", "SearchPattern", "pattern", ";", "public", "PatternLocator", "patternLocator", ";", "public", "int", "matchContainer", ";", "public", "SearchRequestor", "requestor", ";", "public", "IJavaSearchScope", "scope", ";", "public", "IProgressMonitor", "progressMonitor", ";", "public", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "workingCopies", ";", "public", "HandleFactory", "handleFactory", ";", "public", "char", "[", "]", "[", "]", "[", "]", "allSuperTypeNames", ";", "public", "MatchLocatorParser", "parser", ";", "private", "Parser", "basicParser", ";", "public", "INameEnvironment", "nameEnvironment", ";", "public", "NameLookup", "nameLookup", ";", "public", "LookupEnvironment", "lookupEnvironment", ";", "public", "HierarchyResolver", "hierarchyResolver", ";", "public", "CompilerOptions", "options", ";", "public", "int", "numberOfMatches", ";", "public", "PossibleMatch", "[", "]", "matchesToProcess", ";", "public", "PossibleMatch", "currentPossibleMatch", ";", "public", "long", "resultCollectorTime", "=", "0", ";", "int", "progressStep", ";", "int", "progressWorked", ";", "CompilationUnitScope", "unitScope", ";", "SimpleLookupTable", "bindings", ";", "HashSet", "methodHandles", ";", "private", "final", "boolean", "searchPackageDeclaration", ";", "private", "int", "sourceStartOfMethodToRetain", ";", "private", "int", "sourceEndOfMethodToRetain", ";", "public", "static", "class", "WorkingCopyDocument", "extends", "JavaSearchDocument", "{", "public", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "workingCopy", ";", "WorkingCopyDocument", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "workingCopy", ",", "SearchParticipant", "participant", ")", "{", "super", "(", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ",", "participant", ")", ";", "this", ".", "charContents", "=", "(", "(", "CompilationUnit", ")", "workingCopy", ")", ".", "getContents", "(", ")", ";", "this", ".", "workingCopy", "=", "workingCopy", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "getPath", "(", ")", ";", "}", "}", "public", "static", "class", "WrappedCoreException", "extends", "RuntimeException", "{", "private", "static", "final", "long", "serialVersionUID", "=", "8354329870126121212L", ";", "public", "CoreException", "coreException", ";", "public", "WrappedCoreException", "(", "CoreException", "coreException", ")", "{", "this", ".", "coreException", "=", "coreException", ";", "}", "}", "public", "static", "SearchDocument", "[", "]", "addWorkingCopies", "(", "SearchPattern", "pattern", ",", "SearchDocument", "[", "]", "indexMatches", ",", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "copies", ",", "SearchParticipant", "participant", ")", "{", "if", "(", "copies", "==", "null", ")", "return", "indexMatches", ";", "HashMap", "workingCopyDocuments", "=", "workingCopiesThatCanSeeFocus", "(", "copies", ",", "pattern", ",", "participant", ")", ";", "if", "(", "workingCopyDocuments", ".", "size", "(", ")", "==", "0", ")", "return", "indexMatches", ";", "SearchDocument", "[", "]", "matches", "=", "null", ";", "int", "length", "=", "indexMatches", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "SearchDocument", "searchDocument", "=", "indexMatches", "[", "i", "]", ";", "if", "(", "searchDocument", ".", "getParticipant", "(", ")", "==", "participant", ")", "{", "SearchDocument", "workingCopyDocument", "=", "(", "SearchDocument", ")", "workingCopyDocuments", ".", "remove", "(", "searchDocument", ".", "getPath", "(", ")", ")", ";", "if", "(", "workingCopyDocument", "!=", "null", ")", "{", "if", "(", "matches", "==", "null", ")", "{", "System", ".", "arraycopy", "(", "indexMatches", ",", "0", ",", "matches", "=", "new", "SearchDocument", "[", "length", "]", ",", "0", ",", "length", ")", ";", "}", "matches", "[", "i", "]", "=", "workingCopyDocument", ";", "}", "}", "}", "if", "(", "matches", "==", "null", ")", "{", "matches", "=", "indexMatches", ";", "}", "int", "remainingWorkingCopiesSize", "=", "workingCopyDocuments", ".", "size", "(", ")", ";", "if", "(", "remainingWorkingCopiesSize", "!=", "0", ")", "{", "System", ".", "arraycopy", "(", "matches", ",", "0", ",", "matches", "=", "new", "SearchDocument", "[", "length", "+", "remainingWorkingCopiesSize", "]", ",", "0", ",", "length", ")", ";", "Iterator", "iterator", "=", "workingCopyDocuments", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "int", "index", "=", "length", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "matches", "[", "index", "++", "]", "=", "(", "SearchDocument", ")", "iterator", ".", "next", "(", ")", ";", "}", "}", "return", "matches", ";", "}", "public", "static", "void", "setFocus", "(", "SearchPattern", "pattern", ",", "IJavaElement", "focus", ")", "{", "pattern", ".", "focus", "=", "focus", ";", "}", "private", "static", "HashMap", "workingCopiesThatCanSeeFocus", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "copies", ",", "SearchPattern", "pattern", ",", "SearchParticipant", "participant", ")", "{", "if", "(", "copies", "==", "null", ")", "return", "new", "HashMap", "(", ")", ";", "HashMap", "result", "=", "new", "HashMap", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "copies", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "workingCopy", "=", "copies", "[", "i", "]", ";", "IPath", "projectOrJar", "=", "MatchLocator", ".", "getProjectOrJar", "(", "workingCopy", ")", ".", "getPath", "(", ")", ";", "if", "(", "pattern", ".", "focus", "==", "null", "||", "IndexSelector", ".", "canSeeFocus", "(", "pattern", ",", "projectOrJar", ")", ")", "{", "result", ".", "put", "(", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ",", "new", "WorkingCopyDocument", "(", "workingCopy", ",", "participant", ")", ")", ";", "}", "}", "return", "result", ";", "}", "public", "static", "ClassFileReader", "classFileReader", "(", "IType", "type", ")", "{", "IClassFile", "classFile", "=", "type", ".", "getClassFile", "(", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "if", "(", "classFile", ".", "isOpen", "(", ")", ")", "return", "(", "ClassFileReader", ")", "manager", ".", "getInfo", "(", "type", ")", ";", "PackageFragment", "pkg", "=", "(", "PackageFragment", ")", "type", ".", "getPackageFragment", "(", ")", ";", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "pkg", ".", "getParent", "(", ")", ";", "try", "{", "if", "(", "!", "root", ".", "isArchive", "(", ")", ")", "return", "Util", ".", "newClassFileReader", "(", "(", "(", "JavaElement", ")", "type", ")", ".", "resource", "(", ")", ")", ";", "ZipFile", "zipFile", "=", "null", ";", "try", "{", "IPath", "zipPath", "=", "root", ".", "getPath", "(", ")", ";", "if", "(", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", ")", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "zipPath", ")", ";", "zipFile", "=", "manager", ".", "getZipFile", "(", "zipPath", ")", ";", "String", "classFileName", "=", "classFile", ".", "getElementName", "(", ")", ";", "String", "path", "=", "Util", ".", "concatWith", "(", "pkg", ".", "names", ",", "classFileName", ",", "'/'", ")", ";", "return", "ClassFileReader", ".", "read", "(", "zipFile", ",", "path", ")", ";", "}", "finally", "{", "manager", ".", "closeZipFile", "(", "zipFile", ")", ";", "}", "}", "catch", "(", "ClassFormatException", "e", ")", "{", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "catch", "(", "IOException", "e", ")", "{", "}", "return", "null", ";", "}", "public", "static", "void", "findIndexMatches", "(", "SearchPattern", "pattern", ",", "Index", "index", ",", "IndexQueryRequestor", "requestor", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IProgressMonitor", "monitor", ")", "throws", "IOException", "{", "pattern", ".", "findIndexMatches", "(", "index", ",", "requestor", ",", "participant", ",", "scope", ",", "monitor", ")", ";", "}", "public", "static", "IJavaElement", "getProjectOrJar", "(", "IJavaElement", "element", ")", "{", "while", "(", "!", "(", "element", "instanceof", "IJavaProject", ")", "&&", "!", "(", "element", "instanceof", "JarPackageFragmentRoot", ")", ")", "{", "element", "=", "element", ".", "getParent", "(", ")", ";", "}", "return", "element", ";", "}", "public", "static", "IJavaElement", "projectOrJarFocus", "(", "SearchPattern", "pattern", ")", "{", "return", "pattern", "==", "null", "||", "pattern", ".", "focus", "==", "null", "?", "null", ":", "getProjectOrJar", "(", "pattern", ".", "focus", ")", ";", "}", "public", "MatchLocator", "(", "SearchPattern", "pattern", ",", "SearchRequestor", "requestor", ",", "IJavaSearchScope", "scope", ",", "IProgressMonitor", "progressMonitor", ")", "{", "this", ".", "pattern", "=", "pattern", ";", "this", ".", "patternLocator", "=", "PatternLocator", ".", "patternLocator", "(", "this", ".", "pattern", ")", ";", "this", ".", "matchContainer", "=", "this", ".", "patternLocator", "==", "null", "?", "0", ":", "this", ".", "patternLocator", ".", "matchContainer", "(", ")", ";", "this", ".", "requestor", "=", "requestor", ";", "this", ".", "scope", "=", "scope", ";", "this", ".", "progressMonitor", "=", "progressMonitor", ";", "if", "(", "pattern", "instanceof", "PackageDeclarationPattern", ")", "{", "this", ".", "searchPackageDeclaration", "=", "true", ";", "}", "else", "if", "(", "pattern", "instanceof", "OrPattern", ")", "{", "this", ".", "searchPackageDeclaration", "=", "(", "(", "OrPattern", ")", "pattern", ")", ".", "hasPackageDeclaration", "(", ")", ";", "}", "else", "{", "this", ".", "searchPackageDeclaration", "=", "false", ";", "}", "if", "(", "pattern", "instanceof", "MethodPattern", ")", "{", "IType", "type", "=", "(", "(", "MethodPattern", ")", "pattern", ")", ".", "declaringType", ";", "if", "(", "type", "!=", "null", "&&", "!", "type", ".", "isBinary", "(", ")", ")", "{", "SourceType", "sourceType", "=", "(", "SourceType", ")", "type", ";", "IMember", "local", "=", "sourceType", ".", "getOuterMostLocalContext", "(", ")", ";", "if", "(", "local", "instanceof", "IMethod", ")", "{", "try", "{", "ISourceRange", "range", "=", "local", ".", "getSourceRange", "(", ")", ";", "this", ".", "sourceStartOfMethodToRetain", "=", "range", ".", "getOffset", "(", ")", ";", "this", ".", "sourceEndOfMethodToRetain", "=", "this", ".", "sourceStartOfMethodToRetain", "+", "range", ".", "getLength", "(", ")", "-", "1", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "}", "}", "public", "void", "accept", "(", "IBinaryType", "binaryType", ",", "PackageBinding", "packageBinding", ",", "AccessRestriction", "accessRestriction", ")", "{", "this", ".", "lookupEnvironment", ".", "createBinaryTypeFrom", "(", "binaryType", ",", "packageBinding", ",", "accessRestriction", ")", ";", "}", "public", "void", "accept", "(", "ICompilationUnit", "sourceUnit", ",", "AccessRestriction", "accessRestriction", ")", "{", "CompilationResult", "unitResult", "=", "new", "CompilationResult", "(", "sourceUnit", ",", "1", ",", "1", ",", "this", ".", "options", ".", "maxProblemsPerUnit", ")", ";", "try", "{", "CompilationUnitDeclaration", "parsedUnit", "=", "basicParser", "(", ")", ".", "dietParse", "(", "sourceUnit", ",", "unitResult", ")", ";", "this", ".", "lookupEnvironment", ".", "buildTypeBindings", "(", "parsedUnit", ",", "accessRestriction", ")", ";", "this", ".", "lookupEnvironment", ".", "completeTypeBindings", "(", "parsedUnit", ",", "true", ")", ";", "}", "catch", "(", "AbortCompilationUnit", "e", ")", "{", "if", "(", "unitResult", ".", "compilationUnit", "==", "sourceUnit", ")", "{", "}", "else", "{", "throw", "e", ";", "}", "}", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "if", "(", "unitResult", ".", "problemCount", ">", "0", ")", "{", "System", ".", "out", ".", "println", "(", "unitResult", ")", ";", "}", "}", "}", "public", "void", "accept", "(", "ISourceType", "[", "]", "sourceTypes", ",", "PackageBinding", "packageBinding", ",", "AccessRestriction", "accessRestriction", ")", "{", "ISourceType", "sourceType", "=", "sourceTypes", "[", "0", "]", ";", "while", "(", "sourceType", ".", "getEnclosingType", "(", ")", "!=", "null", ")", "sourceType", "=", "sourceType", ".", "getEnclosingType", "(", ")", ";", "if", "(", "sourceType", "instanceof", "SourceTypeElementInfo", ")", "{", "SourceTypeElementInfo", "elementInfo", "=", "(", "SourceTypeElementInfo", ")", "sourceType", ";", "IType", "type", "=", "elementInfo", ".", "getHandle", "(", ")", ";", "ICompilationUnit", "sourceUnit", "=", "(", "ICompilationUnit", ")", "type", ".", "getCompilationUnit", "(", ")", ";", "accept", "(", "sourceUnit", ",", "accessRestriction", ")", ";", "}", "else", "{", "CompilationResult", "result", "=", "new", "CompilationResult", "(", "sourceType", ".", "getFileName", "(", ")", ",", "1", ",", "1", ",", "0", ")", ";", "CompilationUnitDeclaration", "unit", "=", "SourceTypeConverter", ".", "buildCompilationUnit", "(", "sourceTypes", ",", "SourceTypeConverter", ".", "FIELD_AND_METHOD", "|", "SourceTypeConverter", ".", "MEMBER_TYPE", ",", "this", ".", "lookupEnvironment", ".", "problemReporter", ",", "result", ")", ";", "this", ".", "lookupEnvironment", ".", "buildTypeBindings", "(", "unit", ",", "accessRestriction", ")", ";", "this", ".", "lookupEnvironment", ".", "completeTypeBindings", "(", "unit", ",", "true", ")", ";", "}", "}", "protected", "Parser", "basicParser", "(", ")", "{", "if", "(", "this", ".", "basicParser", "==", "null", ")", "{", "ProblemReporter", "problemReporter", "=", "new", "ProblemReporter", "(", "DefaultErrorHandlingPolicies", ".", "proceedWithAllProblems", "(", ")", ",", "this", ".", "options", ",", "new", "DefaultProblemFactory", "(", ")", ")", ";", "this", ".", "basicParser", "=", "new", "Parser", "(", "problemReporter", ",", "false", ")", ";", "this", ".", "basicParser", ".", "reportOnlyOneSyntaxError", "=", "true", ";", "}", "return", "this", ".", "basicParser", ";", "}", "protected", "BinaryTypeBinding", "cacheBinaryType", "(", "IType", "type", ",", "IBinaryType", "binaryType", ")", "throws", "JavaModelException", "{", "IType", "enclosingType", "=", "type", ".", "getDeclaringType", "(", ")", ";", "if", "(", "enclosingType", "!=", "null", ")", "cacheBinaryType", "(", "enclosingType", ",", "null", ")", ";", "if", "(", "binaryType", "==", "null", ")", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "type", ".", "getClassFile", "(", ")", ";", "try", "{", "binaryType", "=", "getBinaryInfo", "(", "classFile", ",", "classFile", ".", "resource", "(", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "e", "instanceof", "JavaModelException", ")", "{", "throw", "(", "JavaModelException", ")", "e", ";", "}", "else", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "}", "BinaryTypeBinding", "binding", "=", "this", ".", "lookupEnvironment", ".", "cacheBinaryType", "(", "binaryType", ",", "null", ")", ";", "if", "(", "binding", "==", "null", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "type", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "ReferenceBinding", "referenceBinding", "=", "this", ".", "lookupEnvironment", ".", "getCachedType", "(", "compoundName", ")", ";", "if", "(", "referenceBinding", "!=", "null", "&&", "(", "referenceBinding", "instanceof", "BinaryTypeBinding", ")", ")", "binding", "=", "(", "BinaryTypeBinding", ")", "referenceBinding", ";", "}", "return", "binding", ";", "}", "protected", "char", "[", "]", "[", "]", "[", "]", "computeSuperTypeNames", "(", "IType", "focusType", ")", "{", "String", "fullyQualifiedName", "=", "focusType", ".", "getFullyQualifiedName", "(", ")", ";", "int", "lastDot", "=", "fullyQualifiedName", ".", "lastIndexOf", "(", "'.'", ")", ";", "char", "[", "]", "qualification", "=", "lastDot", "==", "-", "1", "?", "CharOperation", ".", "NO_CHAR", ":", "fullyQualifiedName", ".", "substring", "(", "0", ",", "lastDot", ")", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "simpleName", "=", "focusType", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "SuperTypeNamesCollector", "superTypeNamesCollector", "=", "new", "SuperTypeNamesCollector", "(", "this", ".", "pattern", ",", "simpleName", ",", "qualification", ",", "new", "MatchLocator", "(", "this", ".", "pattern", ",", "this", ".", "requestor", ",", "this", ".", "scope", ",", "this", ".", "progressMonitor", ")", ",", "focusType", ",", "this", ".", "progressMonitor", ")", ";", "try", "{", "this", ".", "allSuperTypeNames", "=", "superTypeNamesCollector", ".", "collect", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "return", "this", ".", "allSuperTypeNames", ";", "}", "protected", "IJavaElement", "createHandle", "(", "AbstractMethodDeclaration", "method", ",", "IJavaElement", "parent", ")", "{", "if", "(", "!", "(", "parent", "instanceof", "IType", ")", ")", "return", "parent", ";", "IType", "type", "=", "(", "IType", ")", "parent", ";", "Argument", "[", "]", "arguments", "=", "method", ".", "arguments", ";", "int", "argCount", "=", "arguments", "==", "null", "?", "0", ":", "arguments", ".", "length", ";", "if", "(", "type", ".", "isBinary", "(", ")", ")", "{", "ClassFileReader", "reader", "=", "classFileReader", "(", "type", ")", ";", "if", "(", "reader", "!=", "null", ")", "{", "boolean", "firstIsSynthetic", "=", "false", ";", "if", "(", "reader", ".", "isMember", "(", ")", "&&", "method", ".", "isConstructor", "(", ")", "&&", "!", "Flags", ".", "isStatic", "(", "reader", ".", "getModifiers", "(", ")", ")", ")", "{", "firstIsSynthetic", "=", "true", ";", "argCount", "++", ";", "}", "char", "[", "]", "[", "]", "argumentTypeNames", "=", "new", "char", "[", "argCount", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "argCount", ";", "i", "++", ")", "{", "char", "[", "]", "typeName", "=", "null", ";", "if", "(", "i", "==", "0", "&&", "firstIsSynthetic", ")", "{", "typeName", "=", "type", ".", "getDeclaringType", "(", ")", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "else", "if", "(", "arguments", "!=", "null", ")", "{", "TypeReference", "typeRef", "=", "arguments", "[", "firstIsSynthetic", "?", "i", "-", "1", ":", "i", "]", ".", "type", ";", "typeName", "=", "CharOperation", ".", "concatWith", "(", "typeRef", ".", "getTypeName", "(", ")", ",", "'.'", ")", ";", "for", "(", "int", "k", "=", "0", ",", "dim", "=", "typeRef", ".", "dimensions", "(", ")", ";", "k", "<", "dim", ";", "k", "++", ")", "typeName", "=", "CharOperation", ".", "concat", "(", "typeName", ",", "new", "char", "[", "]", "{", "'['", ",", "']'", "}", ")", ";", "}", "if", "(", "typeName", "==", "null", ")", "{", "return", "null", ";", "}", "argumentTypeNames", "[", "i", "]", "=", "typeName", ";", "}", "IMethod", "binaryMethod", "=", "createBinaryMethodHandle", "(", "type", ",", "method", ".", "selector", ",", "argumentTypeNames", ")", ";", "if", "(", "binaryMethod", "==", "null", ")", "{", "PossibleMatch", "similarMatch", "=", "this", ".", "currentPossibleMatch", ".", "getSimilarMatch", "(", ")", ";", "while", "(", "similarMatch", "!=", "null", ")", "{", "type", "=", "(", "(", "ClassFile", ")", "similarMatch", ".", "openable", ")", ".", "getType", "(", ")", ";", "binaryMethod", "=", "createBinaryMethodHandle", "(", "type", ",", "method", ".", "selector", ",", "argumentTypeNames", ")", ";", "if", "(", "binaryMethod", "!=", "null", ")", "{", "return", "binaryMethod", ";", "}", "similarMatch", "=", "similarMatch", ".", "getSimilarMatch", "(", ")", ";", "}", "}", "return", "binaryMethod", ";", "}", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "CharOperation", ".", "charToString", "(", "method", ".", "selector", ")", "+", "\"\"", ")", ";", "}", "return", "null", ";", "}", "String", "[", "]", "parameterTypeSignatures", "=", "new", "String", "[", "argCount", "]", ";", "if", "(", "arguments", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "argCount", ";", "i", "++", ")", "{", "TypeReference", "typeRef", "=", "arguments", "[", "i", "]", ".", "type", ";", "char", "[", "]", "typeName", "=", "CharOperation", ".", "concatWith", "(", "typeRef", ".", "getParameterizedTypeName", "(", ")", ",", "'.'", ")", ";", "parameterTypeSignatures", "[", "i", "]", "=", "Signature", ".", "createTypeSignature", "(", "typeName", ",", "false", ")", ";", "}", "}", "return", "createMethodHandle", "(", "type", ",", "new", "String", "(", "method", ".", "selector", ")", ",", "parameterTypeSignatures", ")", ";", "}", "IMethod", "createBinaryMethodHandle", "(", "IType", "type", ",", "char", "[", "]", "methodSelector", ",", "char", "[", "]", "[", "]", "argumentTypeNames", ")", "{", "ClassFileReader", "reader", "=", "MatchLocator", ".", "classFileReader", "(", "type", ")", ";", "if", "(", "reader", "!=", "null", ")", "{", "IBinaryMethod", "[", "]", "methods", "=", "reader", ".", "getMethods", "(", ")", ";", "if", "(", "methods", "!=", "null", ")", "{", "int", "argCount", "=", "argumentTypeNames", "==", "null", "?", "0", ":", "argumentTypeNames", ".", "length", ";", "nextMethod", ":", "for", "(", "int", "i", "=", "0", ",", "methodsLength", "=", "methods", ".", "length", ";", "i", "<", "methodsLength", ";", "i", "++", ")", "{", "IBinaryMethod", "binaryMethod", "=", "methods", "[", "i", "]", ";", "char", "[", "]", "selector", "=", "binaryMethod", ".", "isConstructor", "(", ")", "?", "type", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ":", "binaryMethod", ".", "getSelector", "(", ")", ";", "if", "(", "CharOperation", ".", "equals", "(", "selector", ",", "methodSelector", ")", ")", "{", "char", "[", "]", "signature", "=", "binaryMethod", ".", "getGenericSignature", "(", ")", ";", "if", "(", "signature", "==", "null", ")", "signature", "=", "binaryMethod", ".", "getMethodDescriptor", "(", ")", ";", "char", "[", "]", "[", "]", "parameterTypes", "=", "Signature", ".", "getParameterTypes", "(", "signature", ")", ";", "if", "(", "argCount", "!=", "parameterTypes", ".", "length", ")", "continue", "nextMethod", ";", "if", "(", "argumentTypeNames", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "argCount", ";", "j", "++", ")", "{", "char", "[", "]", "parameterTypeName", "=", "ClassFileMatchLocator", ".", "convertClassFileFormat", "(", "parameterTypes", "[", "j", "]", ")", ";", "if", "(", "!", "CharOperation", ".", "endsWith", "(", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "parameterTypeName", ")", ")", ",", "CharOperation", ".", "replaceOnCopy", "(", "argumentTypeNames", "[", "j", "]", ",", "'$'", ",", "'.'", ")", ")", ")", "continue", "nextMethod", ";", "parameterTypes", "[", "j", "]", "=", "parameterTypeName", ";", "}", "}", "return", "(", "IMethod", ")", "createMethodHandle", "(", "type", ",", "new", "String", "(", "selector", ")", ",", "CharOperation", ".", "toStrings", "(", "parameterTypes", ")", ")", ";", "}", "}", "}", "}", "return", "null", ";", "}", "private", "IJavaElement", "createMethodHandle", "(", "IType", "type", ",", "String", "methodName", ",", "String", "[", "]", "parameterTypeSignatures", ")", "{", "IMethod", "methodHandle", "=", "type", ".", "getMethod", "(", "methodName", ",", "parameterTypeSignatures", ")", ";", "if", "(", "methodHandle", "instanceof", "SourceMethod", ")", "{", "while", "(", "this", ".", "methodHandles", ".", "contains", "(", "methodHandle", ")", ")", "{", "(", "(", "SourceMethod", ")", "methodHandle", ")", ".", "occurrenceCount", "++", ";", "}", "}", "this", ".", "methodHandles", ".", "add", "(", "methodHandle", ")", ";", "return", "methodHandle", ";", "}", "protected", "IJavaElement", "createHandle", "(", "FieldDeclaration", "fieldDeclaration", ",", "TypeDeclaration", "typeDeclaration", ",", "IJavaElement", "parent", ")", "{", "if", "(", "!", "(", "parent", "instanceof", "IType", ")", ")", "return", "parent", ";", "IType", "type", "=", "(", "IType", ")", "parent", ";", "switch", "(", "fieldDeclaration", ".", "getKind", "(", ")", ")", "{", "case", "AbstractVariableDeclaration", ".", "FIELD", ":", "case", "AbstractVariableDeclaration", ".", "ENUM_CONSTANT", ":", "return", "(", "(", "IType", ")", "parent", ")", ".", "getField", "(", "new", "String", "(", "fieldDeclaration", ".", "name", ")", ")", ";", "}", "if", "(", "type", ".", "isBinary", "(", ")", ")", "{", "return", "type", ";", "}", "int", "occurrenceCount", "=", "0", ";", "FieldDeclaration", "[", "]", "fields", "=", "typeDeclaration", ".", "fields", ";", "int", "length", "=", "fields", "==", "null", "?", "0", ":", "fields", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "fields", "[", "i", "]", ".", "getKind", "(", ")", "==", "AbstractVariableDeclaration", ".", "INITIALIZER", ")", "{", "occurrenceCount", "++", ";", "if", "(", "fields", "[", "i", "]", ".", "equals", "(", "fieldDeclaration", ")", ")", "break", ";", "}", "}", "return", "(", "(", "IType", ")", "parent", ")", ".", "getInitializer", "(", "occurrenceCount", ")", ";", "}", "protected", "IJavaElement", "createHandle", "(", "AbstractVariableDeclaration", "variableDeclaration", ",", "IJavaElement", "parent", ")", "{", "switch", "(", "variableDeclaration", ".", "getKind", "(", ")", ")", "{", "case", "AbstractVariableDeclaration", ".", "LOCAL_VARIABLE", ":", "if", "(", "variableDeclaration", ".", "type", ".", "resolvedType", "!=", "null", ")", "{", "return", "new", "LocalVariable", "(", "(", "JavaElement", ")", "parent", ",", "new", "String", "(", "variableDeclaration", ".", "name", ")", ",", "variableDeclaration", ".", "declarationSourceStart", ",", "variableDeclaration", ".", "declarationSourceEnd", ",", "variableDeclaration", ".", "sourceStart", ",", "variableDeclaration", ".", "sourceEnd", ",", "new", "String", "(", "variableDeclaration", ".", "type", ".", "resolvedType", ".", "signature", "(", ")", ")", ",", "variableDeclaration", ".", "annotations", ",", "variableDeclaration", ".", "modifiers", ",", "false", ")", ";", "}", "break", ";", "case", "AbstractVariableDeclaration", ".", "PARAMETER", ":", "if", "(", "variableDeclaration", ".", "type", ".", "resolvedType", "!=", "null", ")", "{", "return", "new", "LocalVariable", "(", "(", "JavaElement", ")", "parent", ",", "new", "String", "(", "variableDeclaration", ".", "name", ")", ",", "variableDeclaration", ".", "declarationSourceStart", ",", "variableDeclaration", ".", "declarationSourceEnd", ",", "variableDeclaration", ".", "sourceStart", ",", "variableDeclaration", ".", "sourceEnd", ",", "new", "String", "(", "variableDeclaration", ".", "type", ".", "resolvedType", ".", "signature", "(", ")", ")", ",", "variableDeclaration", ".", "annotations", ",", "variableDeclaration", ".", "modifiers", ",", "true", ")", ";", "}", "break", ";", "case", "AbstractVariableDeclaration", ".", "TYPE_PARAMETER", ":", "return", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "TypeParameter", "(", "(", "JavaElement", ")", "parent", ",", "new", "String", "(", "variableDeclaration", ".", "name", ")", ")", ";", "}", "return", "null", ";", "}", "protected", "IJavaElement", "createHandle", "(", "Annotation", "annotation", ",", "IAnnotatable", "parent", ")", "{", "if", "(", "parent", "==", "null", ")", "return", "null", ";", "TypeReference", "typeRef", "=", "annotation", ".", "type", ";", "char", "[", "]", "[", "]", "typeName", "=", "typeRef", ".", "getTypeName", "(", ")", ";", "String", "name", "=", "new", "String", "(", "typeName", "[", "typeName", ".", "length", "-", "1", "]", ")", ";", "try", "{", "IAnnotation", "[", "]", "annotations", "=", "parent", ".", "getAnnotations", "(", ")", ";", "int", "length", "=", "annotations", "==", "null", "?", "0", ":", "annotations", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "annotations", "[", "i", "]", ".", "getElementName", "(", ")", ".", "equals", "(", "name", ")", ")", "{", "return", "annotations", "[", "i", "]", ";", "}", "}", "}", "catch", "(", "JavaModelException", "jme", ")", "{", "}", "return", "null", ";", "}", "private", "IJavaElement", "[", "]", "createHandles", "(", "FieldDeclaration", "[", "]", "fields", ",", "TypeDeclaration", "type", ",", "IJavaElement", "parent", ")", "{", "IJavaElement", "[", "]", "otherElements", "=", "null", ";", "if", "(", "fields", "!=", "null", ")", "{", "int", "length", "=", "fields", ".", "length", ";", "int", "size", "=", "0", ";", "while", "(", "size", "<", "length", "&&", "fields", "[", "size", "]", "!=", "null", ")", "{", "size", "++", ";", "}", "otherElements", "=", "new", "IJavaElement", "[", "size", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "size", ";", "j", "++", ")", "{", "otherElements", "[", "j", "]", "=", "createHandle", "(", "fields", "[", "j", "]", ",", "type", ",", "parent", ")", ";", "}", "}", "return", "otherElements", ";", "}", "protected", "boolean", "createHierarchyResolver", "(", "IType", "focusType", ",", "PossibleMatch", "[", "]", "possibleMatches", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "focusType", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "boolean", "isPossibleMatch", "=", "false", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "possibleMatches", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "possibleMatches", "[", "i", "]", ".", "compoundName", ",", "compoundName", ")", ")", "{", "isPossibleMatch", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "isPossibleMatch", ")", "{", "if", "(", "focusType", ".", "isBinary", "(", ")", ")", "{", "try", "{", "cacheBinaryType", "(", "focusType", ",", "null", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "else", "{", "accept", "(", "(", "ICompilationUnit", ")", "focusType", ".", "getCompilationUnit", "(", ")", ",", "null", ")", ";", "}", "}", "this", ".", "hierarchyResolver", "=", "new", "HierarchyResolver", "(", "this", ".", "lookupEnvironment", ",", "null", ")", ";", "ReferenceBinding", "binding", "=", "this", ".", "hierarchyResolver", ".", "setFocusType", "(", "compoundName", ")", ";", "return", "binding", "!=", "null", "&&", "binding", ".", "isValidBinding", "(", ")", "&&", "(", "binding", ".", "tagBits", "&", "TagBits", ".", "HierarchyHasProblems", ")", "==", "0", ";", "}", "protected", "IJavaElement", "createImportHandle", "(", "ImportReference", "importRef", ")", "{", "char", "[", "]", "importName", "=", "CharOperation", ".", "concatWith", "(", "importRef", ".", "getImportName", "(", ")", ",", "'.'", ")", ";", "if", "(", "(", "importRef", ".", "bits", "&", "ASTNode", ".", "OnDemand", ")", "!=", "0", ")", "importName", "=", "CharOperation", ".", "concat", "(", "importName", ",", "\".*\"", ".", "toCharArray", "(", ")", ")", ";", "Openable", "openable", "=", "this", ".", "currentPossibleMatch", ".", "openable", ";", "if", "(", "openable", "instanceof", "CompilationUnit", ")", "return", "(", "(", "CompilationUnit", ")", "openable", ")", ".", "getImport", "(", "new", "String", "(", "importName", ")", ")", ";", "IType", "binaryType", "=", "(", "(", "ClassFile", ")", "openable", ")", ".", "getType", "(", ")", ";", "String", "typeName", "=", "binaryType", ".", "getElementName", "(", ")", ";", "int", "lastDollar", "=", "typeName", ".", "lastIndexOf", "(", "'$'", ")", ";", "if", "(", "lastDollar", "==", "-", "1", ")", "return", "binaryType", ";", "return", "createTypeHandle", "(", "typeName", ".", "substring", "(", "0", ",", "lastDollar", ")", ")", ";", "}", "protected", "IJavaElement", "createPackageDeclarationHandle", "(", "CompilationUnitDeclaration", "unit", ")", "{", "if", "(", "unit", ".", "isPackageInfo", "(", ")", ")", "{", "char", "[", "]", "packName", "=", "CharOperation", ".", "concatWith", "(", "unit", ".", "currentPackage", ".", "getImportName", "(", ")", ",", "'.'", ")", ";", "Openable", "openable", "=", "this", ".", "currentPossibleMatch", ".", "openable", ";", "if", "(", "openable", "instanceof", "CompilationUnit", ")", "{", "return", "(", "(", "CompilationUnit", ")", "openable", ")", ".", "getPackageDeclaration", "(", "new", "String", "(", "packName", ")", ")", ";", "}", "}", "return", "createTypeHandle", "(", "new", "String", "(", "unit", ".", "getMainTypeName", "(", ")", ")", ")", ";", "}", "protected", "IType", "createTypeHandle", "(", "String", "simpleTypeName", ")", "{", "Openable", "openable", "=", "this", ".", "currentPossibleMatch", ".", "openable", ";", "if", "(", "openable", "instanceof", "CompilationUnit", ")", "return", "(", "(", "CompilationUnit", ")", "openable", ")", ".", "getType", "(", "simpleTypeName", ")", ";", "IType", "binaryType", "=", "(", "(", "ClassFile", ")", "openable", ")", ".", "getType", "(", ")", ";", "String", "binaryTypeQualifiedName", "=", "binaryType", ".", "getTypeQualifiedName", "(", ")", ";", "if", "(", "simpleTypeName", ".", "equals", "(", "binaryTypeQualifiedName", ")", ")", "return", "binaryType", ";", "String", "classFileName", "=", "simpleTypeName", ".", "length", "(", ")", "==", "0", "?", "binaryTypeQualifiedName", ":", "simpleTypeName", ";", "IClassFile", "classFile", "=", "binaryType", ".", "getPackageFragment", "(", ")", ".", "getClassFile", "(", "classFileName", "+", "SuffixConstants", ".", "SUFFIX_STRING_class", ")", ";", "return", "classFile", ".", "getType", "(", ")", ";", "}", "protected", "boolean", "encloses", "(", "IJavaElement", "element", ")", "{", "if", "(", "element", "!=", "null", ")", "{", "if", "(", "this", ".", "scope", "instanceof", "HierarchyScope", ")", "return", "(", "(", "HierarchyScope", ")", "this", ".", "scope", ")", ".", "encloses", "(", "element", ",", "this", ".", "progressMonitor", ")", ";", "else", "return", "this", ".", "scope", ".", "encloses", "(", "element", ")", ";", "}", "return", "false", ";", "}", "private", "boolean", "filterEnum", "(", "SearchMatch", "match", ")", "{", "IJavaElement", "element", "=", "(", "IJavaElement", ")", "match", ".", "getElement", "(", ")", ";", "PackageFragment", "pkg", "=", "(", "PackageFragment", ")", "element", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", ";", "if", "(", "pkg", "!=", "null", ")", "{", "if", "(", "pkg", ".", "names", ".", "length", "==", "5", "&&", "pkg", ".", "names", "[", "4", "]", ".", "equals", "(", "\"enum\"", ")", ")", "{", "if", "(", "this", ".", "options", "==", "null", ")", "{", "IJavaProject", "proj", "=", "(", "IJavaProject", ")", "pkg", ".", "getAncestor", "(", "IJavaElement", ".", "JAVA_PROJECT", ")", ";", "String", "complianceStr", "=", "proj", ".", "getOption", "(", "CompilerOptions", ".", "OPTION_Source", ",", "true", ")", ";", "if", "(", "CompilerOptions", ".", "versionToJdkLevel", "(", "complianceStr", ")", ">=", "ClassFileConstants", ".", "JDK1_5", ")", "return", "true", ";", "}", "else", "if", "(", "this", ".", "options", ".", "sourceLevel", ">=", "ClassFileConstants", ".", "JDK1_5", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "private", "long", "findLastTypeArgumentInfo", "(", "TypeReference", "typeRef", ")", "{", "TypeReference", "lastTypeArgument", "=", "typeRef", ";", "int", "depth", "=", "0", ";", "while", "(", "true", ")", "{", "TypeReference", "[", "]", "lastTypeArguments", "=", "null", ";", "if", "(", "lastTypeArgument", "instanceof", "ParameterizedQualifiedTypeReference", ")", "{", "ParameterizedQualifiedTypeReference", "pqtRef", "=", "(", "ParameterizedQualifiedTypeReference", ")", "lastTypeArgument", ";", "for", "(", "int", "i", "=", "pqtRef", ".", "typeArguments", ".", "length", "-", "1", ";", "i", ">=", "0", "&&", "lastTypeArguments", "==", "null", ";", "i", "--", ")", "{", "lastTypeArguments", "=", "pqtRef", ".", "typeArguments", "[", "i", "]", ";", "}", "}", "TypeReference", "last", "=", "null", ";", "if", "(", "lastTypeArgument", "instanceof", "ParameterizedSingleTypeReference", "||", "lastTypeArguments", "!=", "null", ")", "{", "if", "(", "lastTypeArguments", "==", "null", ")", "{", "lastTypeArguments", "=", "(", "(", "ParameterizedSingleTypeReference", ")", "lastTypeArgument", ")", ".", "typeArguments", ";", "}", "if", "(", "lastTypeArguments", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "lastTypeArguments", ".", "length", "-", "1", ";", "i", ">=", "0", "&&", "last", "==", "null", ";", "i", "++", ")", "{", "last", "=", "lastTypeArguments", "[", "i", "]", ";", "}", "}", "}", "if", "(", "last", "==", "null", ")", "break", ";", "depth", "++", ";", "lastTypeArgument", "=", "last", ";", "}", "return", "(", "(", "(", "long", ")", "depth", ")", "<<", "32", ")", "+", "lastTypeArgument", ".", "sourceEnd", ";", "}", "protected", "IBinaryType", "getBinaryInfo", "(", "ClassFile", "classFile", ",", "IResource", "resource", ")", "throws", "CoreException", "{", "BinaryType", "binaryType", "=", "(", "BinaryType", ")", "classFile", ".", "getType", "(", ")", ";", "if", "(", "classFile", ".", "isOpen", "(", ")", ")", "return", "(", "IBinaryType", ")", "binaryType", ".", "getElementInfo", "(", ")", ";", "IBinaryType", "info", ";", "try", "{", "PackageFragment", "pkg", "=", "(", "PackageFragment", ")", "classFile", ".", "getParent", "(", ")", ";", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "pkg", ".", "getParent", "(", ")", ";", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "String", "classFileName", "=", "classFile", ".", "getElementName", "(", ")", ";", "String", "classFilePath", "=", "Util", ".", "concatWith", "(", "pkg", ".", "names", ",", "classFileName", ",", "'/'", ")", ";", "ZipFile", "zipFile", "=", "null", ";", "try", "{", "zipFile", "=", "(", "(", "JarPackageFragmentRoot", ")", "root", ")", ".", "getJar", "(", ")", ";", "info", "=", "ClassFileReader", ".", "read", "(", "zipFile", ",", "classFilePath", ")", ";", "}", "finally", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "closeZipFile", "(", "zipFile", ")", ";", "}", "}", "else", "{", "info", "=", "Util", ".", "newClassFileReader", "(", "resource", ")", ";", "}", "if", "(", "info", "==", "null", ")", "throw", "binaryType", ".", "newNotPresentException", "(", ")", ";", "return", "info", ";", "}", "catch", "(", "ClassFormatException", "e", ")", "{", "return", "null", ";", "}", "catch", "(", "java", ".", "io", ".", "IOException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ",", "IJavaModelStatusConstants", ".", "IO_EXCEPTION", ")", ";", "}", "}", "protected", "IType", "getFocusType", "(", ")", "{", "return", "this", ".", "scope", "instanceof", "HierarchyScope", "?", "(", "(", "HierarchyScope", ")", "this", ".", "scope", ")", ".", "focusType", ":", "null", ";", "}", "protected", "void", "getMethodBodies", "(", "CompilationUnitDeclaration", "unit", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "unit", ".", "ignoreMethodBodies", ")", "{", "unit", ".", "ignoreFurtherInvestigation", "=", "true", ";", "return", ";", "}", "int", "[", "]", "oldLineEnds", "=", "this", ".", "parser", ".", "scanner", ".", "lineEnds", ";", "int", "oldLinePtr", "=", "this", ".", "parser", ".", "scanner", ".", "linePtr", ";", "try", "{", "CompilationResult", "compilationResult", "=", "unit", ".", "compilationResult", ";", "this", ".", "parser", ".", "scanner", ".", "setSource", "(", "compilationResult", ")", ";", "if", "(", "this", ".", "parser", ".", "javadocParser", ".", "checkDocComment", ")", "{", "char", "[", "]", "contents", "=", "compilationResult", ".", "compilationUnit", ".", "getContents", "(", ")", ";", "this", ".", "parser", ".", "javadocParser", ".", "scanner", ".", "setSource", "(", "contents", ")", ";", "}", "this", ".", "parser", ".", "nodeSet", "=", "nodeSet", ";", "this", ".", "parser", ".", "parseBodies", "(", "unit", ")", ";", "}", "finally", "{", "this", ".", "parser", ".", "nodeSet", "=", "null", ";", "this", ".", "parser", ".", "scanner", ".", "lineEnds", "=", "oldLineEnds", ";", "this", ".", "parser", ".", "scanner", ".", "linePtr", "=", "oldLinePtr", ";", "}", "}", "protected", "TypeBinding", "getType", "(", "Object", "typeKey", ",", "char", "[", "]", "typeName", ")", "{", "if", "(", "this", ".", "unitScope", "==", "null", "||", "typeName", "==", "null", "||", "typeName", ".", "length", "==", "0", ")", "return", "null", ";", "Binding", "binding", "=", "(", "Binding", ")", "this", ".", "bindings", ".", "get", "(", "typeKey", ")", ";", "if", "(", "binding", "!=", "null", ")", "{", "if", "(", "binding", "instanceof", "TypeBinding", "&&", "binding", ".", "isValidBinding", "(", ")", ")", "return", "(", "TypeBinding", ")", "binding", ";", "return", "null", ";", "}", "char", "[", "]", "[", "]", "compoundName", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "typeName", ")", ";", "TypeBinding", "typeBinding", "=", "this", ".", "unitScope", ".", "getType", "(", "compoundName", ",", "compoundName", ".", "length", ")", ";", "if", "(", "typeBinding", "==", "null", "||", "!", "typeBinding", ".", "isValidBinding", "(", ")", ")", "{", "typeBinding", "=", "this", ".", "lookupEnvironment", ".", "getType", "(", "compoundName", ")", ";", "}", "this", ".", "bindings", ".", "put", "(", "typeKey", ",", "typeBinding", ")", ";", "return", "typeBinding", "!=", "null", "&&", "typeBinding", ".", "isValidBinding", "(", ")", "?", "typeBinding", ":", "null", ";", "}", "public", "MethodBinding", "getMethodBinding", "(", "MethodPattern", "methodPattern", ")", "{", "MethodBinding", "methodBinding", "=", "getMethodBinding0", "(", "methodPattern", ")", ";", "if", "(", "methodBinding", "!=", "null", ")", "return", "methodBinding", ";", "if", "(", "methodPattern", ".", "focus", "instanceof", "SourceMethod", ")", "{", "char", "[", "]", "typeName", "=", "PatternLocator", ".", "qualifiedPattern", "(", "methodPattern", ".", "declaringSimpleName", ",", "methodPattern", ".", "declaringQualification", ")", ";", "if", "(", "CharOperation", ".", "indexOf", "(", "IIndexConstants", ".", "ONE_STAR", ",", "typeName", ",", "true", ")", ">=", "0", ")", "{", "IType", "type", "=", "methodPattern", ".", "declaringType", ";", "IType", "enclosingType", "=", "type", ".", "getDeclaringType", "(", ")", ";", "while", "(", "enclosingType", "!=", "null", ")", "{", "type", "=", "enclosingType", ";", "enclosingType", "=", "type", ".", "getDeclaringType", "(", ")", ";", "}", "typeName", "=", "type", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ";", "TypeBinding", "declaringTypeBinding", "=", "getType", "(", "typeName", ",", "typeName", ")", ";", "if", "(", "declaringTypeBinding", "instanceof", "SourceTypeBinding", ")", "{", "SourceTypeBinding", "sourceTypeBinding", "=", "(", "(", "SourceTypeBinding", ")", "declaringTypeBinding", ")", ";", "ClassScope", "skope", "=", "sourceTypeBinding", ".", "scope", ";", "if", "(", "skope", "!=", "null", ")", "{", "CompilationUnitDeclaration", "unit", "=", "skope", ".", "referenceCompilationUnit", "(", ")", ";", "if", "(", "unit", "!=", "null", ")", "{", "AbstractMethodDeclaration", "amd", "=", "new", "ASTNodeFinder", "(", "unit", ")", ".", "findMethod", "(", "(", "IMethod", ")", "methodPattern", ".", "focus", ")", ";", "if", "(", "amd", "!=", "null", "&&", "amd", ".", "binding", "!=", "null", "&&", "amd", ".", "binding", ".", "isValidBinding", "(", ")", ")", "{", "this", ".", "bindings", ".", "put", "(", "methodPattern", ",", "amd", ".", "binding", ")", ";", "return", "amd", ".", "binding", ";", "}", "}", "}", "}", "}", "}", "return", "null", ";", "}", "private", "MethodBinding", "getMethodBinding0", "(", "MethodPattern", "methodPattern", ")", "{", "if", "(", "this", ".", "unitScope", "==", "null", ")", "return", "null", ";", "Binding", "binding", "=", "(", "Binding", ")", "this", ".", "bindings", ".", "get", "(", "methodPattern", ")", ";", "if", "(", "binding", "!=", "null", ")", "{", "if", "(", "binding", "instanceof", "MethodBinding", "&&", "binding", ".", "isValidBinding", "(", ")", ")", "return", "(", "MethodBinding", ")", "binding", ";", "return", "null", ";", "}", "char", "[", "]", "typeName", "=", "PatternLocator", ".", "qualifiedPattern", "(", "methodPattern", ".", "declaringSimpleName", ",", "methodPattern", ".", "declaringQualification", ")", ";", "if", "(", "typeName", "==", "null", ")", "{", "if", "(", "methodPattern", ".", "declaringType", "==", "null", ")", "return", "null", ";", "typeName", "=", "methodPattern", ".", "declaringType", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "TypeBinding", "declaringTypeBinding", "=", "getType", "(", "typeName", ",", "typeName", ")", ";", "if", "(", "declaringTypeBinding", "!=", "null", ")", "{", "if", "(", "declaringTypeBinding", ".", "isArrayType", "(", ")", ")", "{", "declaringTypeBinding", "=", "declaringTypeBinding", ".", "leafComponentType", "(", ")", ";", "}", "if", "(", "!", "declaringTypeBinding", ".", "isBaseType", "(", ")", ")", "{", "char", "[", "]", "[", "]", "parameterTypes", "=", "methodPattern", ".", "parameterSimpleNames", ";", "if", "(", "parameterTypes", "==", "null", ")", "return", "null", ";", "int", "paramTypeslength", "=", "parameterTypes", ".", "length", ";", "ReferenceBinding", "referenceBinding", "=", "(", "ReferenceBinding", ")", "declaringTypeBinding", ";", "MethodBinding", "[", "]", "methods", "=", "referenceBinding", ".", "getMethods", "(", "methodPattern", ".", "selector", ")", ";", "int", "methodsLength", "=", "methods", ".", "length", ";", "TypeVariableBinding", "[", "]", "refTypeVariables", "=", "referenceBinding", ".", "typeVariables", "(", ")", ";", "int", "typeVarLength", "=", "refTypeVariables", "==", "null", "?", "0", ":", "refTypeVariables", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methodsLength", ";", "i", "++", ")", "{", "TypeBinding", "[", "]", "methodParameters", "=", "methods", "[", "i", "]", ".", "parameters", ";", "int", "paramLength", "=", "methodParameters", "==", "null", "?", "0", ":", "methodParameters", ".", "length", ";", "TypeVariableBinding", "[", "]", "methodTypeVariables", "=", "methods", "[", "i", "]", ".", "typeVariables", ";", "int", "methTypeVarLength", "=", "methodTypeVariables", "==", "null", "?", "0", ":", "methodTypeVariables", ".", "length", ";", "boolean", "found", "=", "false", ";", "if", "(", "methodParameters", "!=", "null", "&&", "paramLength", "==", "paramTypeslength", ")", "{", "for", "(", "int", "p", "=", "0", ";", "p", "<", "paramLength", ";", "p", "++", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "methodParameters", "[", "p", "]", ".", "sourceName", "(", ")", ",", "parameterTypes", "[", "p", "]", ")", ")", "{", "found", "=", "true", ";", "}", "else", "{", "found", "=", "false", ";", "if", "(", "refTypeVariables", "!=", "null", ")", "{", "for", "(", "int", "v", "=", "0", ";", "v", "<", "typeVarLength", ";", "v", "++", ")", "{", "if", "(", "!", "CharOperation", ".", "equals", "(", "refTypeVariables", "[", "v", "]", ".", "sourceName", ",", "parameterTypes", "[", "p", "]", ")", ")", "{", "found", "=", "false", ";", "break", ";", "}", "found", "=", "true", ";", "}", "}", "if", "(", "!", "found", "&&", "methodTypeVariables", "!=", "null", ")", "{", "for", "(", "int", "v", "=", "0", ";", "v", "<", "methTypeVarLength", ";", "v", "++", ")", "{", "if", "(", "!", "CharOperation", ".", "equals", "(", "methodTypeVariables", "[", "v", "]", ".", "sourceName", ",", "parameterTypes", "[", "p", "]", ")", ")", "{", "found", "=", "false", ";", "break", ";", "}", "found", "=", "true", ";", "}", "}", "if", "(", "!", "found", ")", "break", ";", "}", "}", "}", "if", "(", "found", ")", "{", "this", ".", "bindings", ".", "put", "(", "methodPattern", ",", "methods", "[", "i", "]", ")", ";", "return", "methods", "[", "i", "]", ";", "}", "}", "}", "}", "this", ".", "bindings", ".", "put", "(", "methodPattern", ",", "new", "ProblemMethodBinding", "(", "methodPattern", ".", "selector", ",", "null", ",", "ProblemReasons", ".", "NotFound", ")", ")", ";", "return", "null", ";", "}", "protected", "boolean", "hasAlreadyDefinedType", "(", "CompilationUnitDeclaration", "parsedUnit", ")", "{", "CompilationResult", "result", "=", "parsedUnit", ".", "compilationResult", ";", "if", "(", "result", "==", "null", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "problemCount", ";", "i", "++", ")", "if", "(", "result", ".", "problems", "[", "i", "]", ".", "getID", "(", ")", "==", "IProblem", ".", "DuplicateTypes", ")", "return", "true", ";", "return", "false", ";", "}", "public", "void", "initialize", "(", "JavaProject", "project", ",", "int", "possibleMatchSize", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "nameEnvironment", "!=", "null", "&&", "possibleMatchSize", "!=", "1", ")", "this", ".", "nameEnvironment", ".", "cleanup", "(", ")", ";", "SearchableEnvironment", "searchableEnvironment", "=", "project", ".", "newSearchableNameEnvironment", "(", "this", ".", "workingCopies", ")", ";", "this", ".", "nameEnvironment", "=", "possibleMatchSize", "==", "1", "?", "(", "INameEnvironment", ")", "searchableEnvironment", ":", "(", "INameEnvironment", ")", "new", "JavaSearchNameEnvironment", "(", "project", ",", "this", ".", "workingCopies", ")", ";", "Map", "map", "=", "project", ".", "getOptions", "(", "true", ")", ";", "map", ".", "put", "(", "CompilerOptions", ".", "OPTION_TaskTags", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "EMPTY_STRING", ")", ";", "this", ".", "options", "=", "new", "CompilerOptions", "(", "map", ")", ";", "ProblemReporter", "problemReporter", "=", "new", "ProblemReporter", "(", "DefaultErrorHandlingPolicies", ".", "proceedWithAllProblems", "(", ")", ",", "this", ".", "options", ",", "new", "DefaultProblemFactory", "(", ")", ")", ";", "this", ".", "lookupEnvironment", "=", "new", "LookupEnvironment", "(", "this", ",", "this", ".", "options", ",", "problemReporter", ",", "this", ".", "nameEnvironment", ")", ";", "this", ".", "lookupEnvironment", ".", "mayTolerateMissingType", "=", "true", ";", "this", ".", "parser", "=", "MatchLocatorParser", ".", "createParser", "(", "problemReporter", ",", "this", ")", ";", "this", ".", "basicParser", "=", "null", ";", "this", ".", "nameLookup", "=", "searchableEnvironment", ".", "nameLookup", ";", "this", ".", "numberOfMatches", "=", "0", ";", "this", ".", "matchesToProcess", "=", "new", "PossibleMatch", "[", "possibleMatchSize", "]", ";", "}", "protected", "void", "locateMatches", "(", "JavaProject", "javaProject", ",", "PossibleMatch", "[", "]", "possibleMatches", ",", "int", "start", ",", "int", "length", ")", "throws", "CoreException", "{", "initialize", "(", "javaProject", ",", "length", ")", ";", "boolean", "isInterestingProject", "=", "LanguageSupportFactory", ".", "isInterestingProject", "(", "javaProject", ".", "getProject", "(", ")", ")", ";", "Set", "alreadyMatched", "=", "new", "HashSet", "(", ")", ";", "boolean", "mustResolvePattern", "=", "this", ".", "pattern", ".", "mustResolve", ";", "boolean", "mustResolve", "=", "mustResolvePattern", ";", "this", ".", "patternLocator", ".", "mayBeGeneric", "=", "this", ".", "options", ".", "sourceLevel", ">=", "ClassFileConstants", ".", "JDK1_5", ";", "boolean", "bindingsWereCreated", "=", "mustResolve", ";", "try", "{", "for", "(", "int", "i", "=", "start", ",", "maxUnits", "=", "start", "+", "length", ";", "i", "<", "maxUnits", ";", "i", "++", ")", "{", "PossibleMatch", "possibleMatch", "=", "possibleMatches", "[", "i", "]", ";", "if", "(", "isInterestingProject", "&&", "LanguageSupportFactory", ".", "isInterestingSourceFile", "(", "possibleMatch", ".", "document", ".", "getPath", "(", ")", ")", ")", "{", "boolean", "matchPerformed", "=", "LanguageSupportFactory", ".", "maybePerformDelegatedSearch", "(", "possibleMatch", ",", "this", ".", "pattern", ",", "this", ".", "requestor", ")", ";", "if", "(", "matchPerformed", ")", "{", "alreadyMatched", ".", "add", "(", "possibleMatch", ")", ";", "}", "}", "try", "{", "if", "(", "!", "parseAndBuildBindings", "(", "possibleMatch", ",", "mustResolvePattern", ")", ")", "continue", ";", "if", "(", "this", ".", "patternLocator", ".", "mayBeGeneric", ")", "{", "if", "(", "!", "mustResolvePattern", "&&", "!", "mustResolve", ")", "{", "mustResolve", "=", "possibleMatch", ".", "nodeSet", ".", "mustResolve", ";", "bindingsWereCreated", "=", "mustResolve", ";", "}", "}", "else", "{", "possibleMatch", ".", "nodeSet", ".", "mustResolve", "=", "mustResolvePattern", ";", "}", "if", "(", "!", "possibleMatch", ".", "nodeSet", ".", "mustResolve", ")", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "{", "this", ".", "progressWorked", "++", ";", "if", "(", "(", "this", ".", "progressWorked", "%", "this", ".", "progressStep", ")", "==", "0", ")", "this", ".", "progressMonitor", ".", "worked", "(", "this", ".", "progressStep", ")", ";", "}", "process", "(", "possibleMatch", ",", "bindingsWereCreated", ")", ";", "if", "(", "this", ".", "numberOfMatches", ">", "0", "&&", "this", ".", "matchesToProcess", "[", "this", ".", "numberOfMatches", "-", "1", "]", "==", "possibleMatch", ")", "{", "this", ".", "numberOfMatches", "--", ";", "}", "}", "}", "finally", "{", "if", "(", "possibleMatch", ".", "hasSimilarMatch", "(", ")", ")", "{", "possibleMatches", "[", "i", "]", "=", "possibleMatch", ".", "getSimilarMatch", "(", ")", ";", "i", "--", ";", "}", "if", "(", "!", "possibleMatch", ".", "nodeSet", ".", "mustResolve", ")", "possibleMatch", ".", "cleanUp", "(", ")", ";", "}", "}", "if", "(", "mustResolve", ")", "this", ".", "lookupEnvironment", ".", "completeTypeBindings", "(", ")", ";", "IType", "focusType", "=", "getFocusType", "(", ")", ";", "if", "(", "focusType", "==", "null", ")", "{", "this", ".", "hierarchyResolver", "=", "null", ";", "}", "else", "if", "(", "!", "createHierarchyResolver", "(", "focusType", ",", "possibleMatches", ")", ")", "{", "if", "(", "computeSuperTypeNames", "(", "focusType", ")", "==", "null", ")", "return", ";", "}", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "bindingsWereCreated", "=", "false", ";", "}", "if", "(", "!", "mustResolve", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "numberOfMatches", ";", "i", "++", ")", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", "&&", "this", ".", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "PossibleMatch", "possibleMatch", "=", "this", ".", "matchesToProcess", "[", "i", "]", ";", "this", ".", "matchesToProcess", "[", "i", "]", "=", "null", ";", "try", "{", "process", "(", "possibleMatch", ",", "bindingsWereCreated", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "bindingsWereCreated", "=", "false", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "bindingsWereCreated", "=", "false", ";", "}", "finally", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "{", "this", ".", "progressWorked", "++", ";", "if", "(", "(", "this", ".", "progressWorked", "%", "this", ".", "progressStep", ")", "==", "0", ")", "this", ".", "progressMonitor", ".", "worked", "(", "this", ".", "progressStep", ")", ";", "}", "if", "(", "this", ".", "options", ".", "verbose", ")", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "compilation_done", ",", "new", "String", "[", "]", "{", "String", ".", "valueOf", "(", "i", "+", "1", ")", ",", "String", ".", "valueOf", "(", "this", ".", "numberOfMatches", ")", ",", "new", "String", "(", "possibleMatch", ".", "parsedUnit", ".", "getFileName", "(", ")", ")", "}", ")", ")", ";", "if", "(", "!", "alreadyMatched", ".", "contains", "(", "possibleMatch", ")", ")", "{", "possibleMatch", ".", "cleanUp", "(", ")", ";", "}", "}", "}", "for", "(", "Iterator", "iterator", "=", "alreadyMatched", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "PossibleMatch", "match", "=", "(", "PossibleMatch", ")", "iterator", ".", "next", "(", ")", ";", "match", ".", "cleanUp", "(", ")", ";", "}", "}", "protected", "void", "locateMatches", "(", "JavaProject", "javaProject", ",", "PossibleMatchSet", "matchSet", ",", "int", "expected", ")", "throws", "CoreException", "{", "PossibleMatch", "[", "]", "possibleMatches", "=", "matchSet", ".", "getPossibleMatches", "(", "javaProject", ".", "getPackageFragmentRoots", "(", ")", ")", ";", "int", "length", "=", "possibleMatches", ".", "length", ";", "if", "(", "this", ".", "progressMonitor", "!=", "null", "&&", "expected", ">", "length", ")", "{", "this", ".", "progressWorked", "+=", "expected", "-", "length", ";", "this", ".", "progressMonitor", ".", "worked", "(", "expected", "-", "length", ")", ";", "}", "for", "(", "int", "index", "=", "0", ";", "index", "<", "length", ";", ")", "{", "int", "max", "=", "Math", ".", "min", "(", "MAX_AT_ONCE", ",", "length", "-", "index", ")", ";", "locateMatches", "(", "javaProject", ",", "possibleMatches", ",", "index", ",", "max", ")", ";", "index", "+=", "max", ";", "}", "this", ".", "patternLocator", ".", "clear", "(", ")", ";", "}", "public", "void", "locateMatches", "(", "SearchDocument", "[", "]", "searchDocuments", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "patternLocator", "==", "null", ")", "return", ";", "int", "docsLength", "=", "searchDocuments", ".", "length", ";", "int", "progressLength", "=", "docsLength", ";", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "docsLength", ";", "i", "++", ")", "System", ".", "out", ".", "println", "(", "\"t\"", "+", "searchDocuments", "[", "i", "]", ")", ";", "System", ".", "out", ".", "println", "(", "\"]\"", ")", ";", "}", "IJavaProject", "[", "]", "javaModelProjects", "=", "null", ";", "if", "(", "this", ".", "searchPackageDeclaration", ")", "{", "javaModelProjects", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProjects", "(", ")", ";", "progressLength", "+=", "javaModelProjects", ".", "length", ";", "}", "int", "n", "=", "progressLength", "<", "1000", "?", "Math", ".", "min", "(", "Math", ".", "max", "(", "progressLength", "/", "200", "+", "1", ",", "2", ")", ",", "4", ")", ":", "5", "*", "(", "progressLength", "/", "1000", ")", ";", "this", ".", "progressStep", "=", "progressLength", "<", "n", "?", "1", ":", "progressLength", "/", "n", ";", "this", ".", "progressWorked", "=", "0", ";", "ArrayList", "copies", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "docsLength", ";", "i", "++", ")", "{", "SearchDocument", "document", "=", "searchDocuments", "[", "i", "]", ";", "if", "(", "document", "instanceof", "WorkingCopyDocument", ")", "{", "copies", ".", "add", "(", "(", "(", "WorkingCopyDocument", ")", "document", ")", ".", "workingCopy", ")", ";", "}", "}", "int", "copiesLength", "=", "copies", ".", "size", "(", ")", ";", "this", ".", "workingCopies", "=", "new", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "copiesLength", "]", ";", "copies", ".", "toArray", "(", "this", ".", "workingCopies", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "this", ".", "bindings", "=", "new", "SimpleLookupTable", "(", ")", ";", "try", "{", "manager", ".", "cacheZipFiles", "(", "this", ")", ";", "if", "(", "this", ".", "handleFactory", "==", "null", ")", "this", ".", "handleFactory", "=", "new", "HandleFactory", "(", ")", ";", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "{", "this", ".", "progressMonitor", ".", "beginTask", "(", "\"\"", ",", "searchDocuments", ".", "length", ")", ";", "}", "this", ".", "patternLocator", ".", "initializePolymorphicSearch", "(", "this", ")", ";", "JavaProject", "previousJavaProject", "=", "null", ";", "PossibleMatchSet", "matchSet", "=", "new", "PossibleMatchSet", "(", ")", ";", "Util", ".", "sort", "(", "searchDocuments", ",", "new", "Util", ".", "Comparer", "(", ")", "{", "public", "int", "compare", "(", "Object", "a", ",", "Object", "b", ")", "{", "return", "(", "(", "SearchDocument", ")", "a", ")", ".", "getPath", "(", ")", ".", "compareTo", "(", "(", "(", "SearchDocument", ")", "b", ")", ".", "getPath", "(", ")", ")", ";", "}", "}", ")", ";", "int", "displayed", "=", "0", ";", "String", "previousPath", "=", "null", ";", "SearchParticipant", "searchParticipant", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "docsLength", ";", "i", "++", ")", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", "&&", "this", ".", "progressMonitor", ".", "isCanceled", "(", ")", ")", "{", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "SearchDocument", "searchDocument", "=", "searchDocuments", "[", "i", "]", ";", "if", "(", "searchParticipant", "==", "null", ")", "{", "searchParticipant", "=", "searchDocument", ".", "getParticipant", "(", ")", ";", "}", "searchDocuments", "[", "i", "]", "=", "null", ";", "String", "pathString", "=", "searchDocument", ".", "getPath", "(", ")", ";", "if", "(", "i", ">", "0", "&&", "pathString", ".", "equals", "(", "previousPath", ")", ")", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "{", "this", ".", "progressWorked", "++", ";", "if", "(", "(", "this", ".", "progressWorked", "%", "this", ".", "progressStep", ")", "==", "0", ")", "this", ".", "progressMonitor", ".", "worked", "(", "this", ".", "progressStep", ")", ";", "}", "displayed", "++", ";", "continue", ";", "}", "previousPath", "=", "pathString", ";", "Openable", "openable", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "workingCopy", "=", "null", ";", "if", "(", "searchDocument", "instanceof", "WorkingCopyDocument", ")", "{", "workingCopy", "=", "(", "(", "WorkingCopyDocument", ")", "searchDocument", ")", ".", "workingCopy", ";", "openable", "=", "(", "Openable", ")", "workingCopy", ";", "}", "else", "{", "openable", "=", "this", ".", "handleFactory", ".", "createOpenable", "(", "pathString", ",", "this", ".", "scope", ")", ";", "}", "if", "(", "openable", "==", "null", ")", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "{", "this", ".", "progressWorked", "++", ";", "if", "(", "(", "this", ".", "progressWorked", "%", "this", ".", "progressStep", ")", "==", "0", ")", "this", ".", "progressMonitor", ".", "worked", "(", "this", ".", "progressStep", ")", ";", "}", "displayed", "++", ";", "continue", ";", "}", "IResource", "resource", "=", "null", ";", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "openable", ".", "getJavaProject", "(", ")", ";", "resource", "=", "workingCopy", "!=", "null", "?", "workingCopy", ".", "getResource", "(", ")", ":", "openable", ".", "getResource", "(", ")", ";", "if", "(", "resource", "==", "null", ")", "resource", "=", "javaProject", ".", "getProject", "(", ")", ";", "if", "(", "!", "javaProject", ".", "equals", "(", "previousJavaProject", ")", ")", "{", "if", "(", "previousJavaProject", "!=", "null", ")", "{", "try", "{", "locateMatches", "(", "previousJavaProject", ",", "matchSet", ",", "i", "-", "displayed", ")", ";", "displayed", "=", "i", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "matchSet", ".", "reset", "(", ")", ";", "}", "previousJavaProject", "=", "javaProject", ";", "}", "matchSet", ".", "add", "(", "new", "PossibleMatch", "(", "this", ",", "resource", ",", "openable", ",", "searchDocument", ",", "this", ".", "pattern", ".", "mustResolve", ")", ")", ";", "}", "if", "(", "previousJavaProject", "!=", "null", ")", "{", "try", "{", "locateMatches", "(", "previousJavaProject", ",", "matchSet", ",", "docsLength", "-", "displayed", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "if", "(", "this", ".", "searchPackageDeclaration", ")", "{", "locatePackageDeclarations", "(", "searchParticipant", ",", "javaModelProjects", ")", ";", "}", "}", "finally", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "this", ".", "progressMonitor", ".", "done", "(", ")", ";", "if", "(", "this", ".", "nameEnvironment", "!=", "null", ")", "this", ".", "nameEnvironment", ".", "cleanup", "(", ")", ";", "manager", ".", "flushZipFiles", "(", "this", ")", ";", "this", ".", "bindings", "=", "null", ";", "}", "}", "protected", "void", "locatePackageDeclarations", "(", "SearchParticipant", "participant", ",", "IJavaProject", "[", "]", "projects", ")", "throws", "CoreException", "{", "locatePackageDeclarations", "(", "this", ".", "pattern", ",", "participant", ",", "projects", ")", ";", "}", "protected", "void", "locatePackageDeclarations", "(", "SearchPattern", "searchPattern", ",", "SearchParticipant", "participant", ",", "IJavaProject", "[", "]", "projects", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", "&&", "this", ".", "progressMonitor", ".", "isCanceled", "(", ")", ")", "{", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "if", "(", "searchPattern", "instanceof", "OrPattern", ")", "{", "SearchPattern", "[", "]", "patterns", "=", "(", "(", "OrPattern", ")", "searchPattern", ")", ".", "patterns", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "patterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "locatePackageDeclarations", "(", "patterns", "[", "i", "]", ",", "participant", ",", "projects", ")", ";", "}", "}", "else", "if", "(", "searchPattern", "instanceof", "PackageDeclarationPattern", ")", "{", "IJavaElement", "focus", "=", "searchPattern", ".", "focus", ";", "if", "(", "focus", "!=", "null", ")", "{", "if", "(", "encloses", "(", "focus", ")", ")", "{", "SearchMatch", "match", "=", "new", "PackageDeclarationMatch", "(", "focus", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", ",", "SearchMatch", ".", "A_ACCURATE", ",", "-", "1", ",", "-", "1", ",", "participant", ",", "focus", ".", "getResource", "(", ")", ")", ";", "report", "(", "match", ")", ";", "}", "return", ";", "}", "PackageDeclarationPattern", "pkgPattern", "=", "(", "PackageDeclarationPattern", ")", "searchPattern", ";", "boolean", "isWorkspaceScope", "=", "this", ".", "scope", "==", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkspaceScope", "(", ")", ";", "IPath", "[", "]", "scopeProjectsAndJars", "=", "isWorkspaceScope", "?", "null", ":", "this", ".", "scope", ".", "enclosingProjectsAndJars", "(", ")", ";", "int", "scopeLength", "=", "isWorkspaceScope", "?", "0", ":", "scopeProjectsAndJars", ".", "length", ";", "SimpleSet", "packages", "=", "new", "SimpleSet", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaProject", "javaProject", "=", "projects", "[", "i", "]", ";", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "{", "if", "(", "this", ".", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "this", ".", "progressWorked", "++", ";", "if", "(", "(", "this", ".", "progressWorked", "%", "this", ".", "progressStep", ")", "==", "0", ")", "this", ".", "progressMonitor", ".", "worked", "(", "this", ".", "progressStep", ")", ";", "}", "if", "(", "!", "isWorkspaceScope", ")", "{", "boolean", "found", "=", "false", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "scopeLength", ";", "j", "++", ")", "{", "if", "(", "javaProject", ".", "getPath", "(", ")", ".", "equals", "(", "scopeProjectsAndJars", "[", "j", "]", ")", ")", "{", "found", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "found", ")", "continue", ";", "}", "this", ".", "nameLookup", "=", "(", "(", "JavaProject", ")", "projects", "[", "i", "]", ")", ".", "newNameLookup", "(", "this", ".", "workingCopies", ")", ";", "IPackageFragment", "[", "]", "packageFragments", "=", "this", ".", "nameLookup", ".", "findPackageFragments", "(", "new", "String", "(", "pkgPattern", ".", "pkgName", ")", ",", "false", ",", "true", ")", ";", "int", "pLength", "=", "packageFragments", "==", "null", "?", "0", ":", "packageFragments", ".", "length", ";", "for", "(", "int", "p", "=", "0", ";", "p", "<", "pLength", ";", "p", "++", ")", "{", "IPackageFragment", "fragment", "=", "packageFragments", "[", "p", "]", ";", "if", "(", "packages", ".", "addIfNotIncluded", "(", "fragment", ")", "==", "null", ")", "continue", ";", "if", "(", "encloses", "(", "fragment", ")", ")", "{", "IResource", "resource", "=", "fragment", ".", "getResource", "(", ")", ";", "if", "(", "resource", "==", "null", ")", "resource", "=", "javaProject", ".", "getProject", "(", ")", ";", "try", "{", "if", "(", "encloses", "(", "fragment", ")", ")", "{", "SearchMatch", "match", "=", "new", "PackageDeclarationMatch", "(", "fragment", ",", "SearchMatch", ".", "A_ACCURATE", ",", "-", "1", ",", "-", "1", ",", "participant", ",", "resource", ")", ";", "report", "(", "match", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "}", "}", "}", "}", "protected", "IType", "lookupType", "(", "ReferenceBinding", "typeBinding", ")", "{", "if", "(", "typeBinding", "==", "null", "||", "!", "typeBinding", ".", "isValidBinding", "(", ")", ")", "return", "null", ";", "char", "[", "]", "packageName", "=", "typeBinding", ".", "qualifiedPackageName", "(", ")", ";", "IPackageFragment", "[", "]", "pkgs", "=", "this", ".", "nameLookup", ".", "findPackageFragments", "(", "(", "packageName", "==", "null", "||", "packageName", ".", "length", "==", "0", ")", "?", "IPackageFragment", ".", "DEFAULT_PACKAGE_NAME", ":", "new", "String", "(", "packageName", ")", ",", "false", ")", ";", "char", "[", "]", "sourceName", "=", "typeBinding", ".", "qualifiedSourceName", "(", ")", ";", "String", "typeName", "=", "new", "String", "(", "sourceName", ")", ";", "int", "acceptFlag", "=", "0", ";", "if", "(", "typeBinding", ".", "isAnnotationType", "(", ")", ")", "{", "acceptFlag", "=", "NameLookup", ".", "ACCEPT_ANNOTATIONS", ";", "}", "else", "if", "(", "typeBinding", ".", "isEnum", "(", ")", ")", "{", "acceptFlag", "=", "NameLookup", ".", "ACCEPT_ENUMS", ";", "}", "else", "if", "(", "typeBinding", ".", "isInterface", "(", ")", ")", "{", "acceptFlag", "=", "NameLookup", ".", "ACCEPT_INTERFACES", ";", "}", "else", "if", "(", "typeBinding", ".", "isClass", "(", ")", ")", "{", "acceptFlag", "=", "NameLookup", ".", "ACCEPT_CLASSES", ";", "}", "if", "(", "pkgs", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "pkgs", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "this", ".", "nameLookup", ".", "findType", "(", "typeName", ",", "pkgs", "[", "i", "]", ",", "false", ",", "acceptFlag", ",", "true", ")", ";", "if", "(", "type", "!=", "null", ")", "return", "type", ";", "}", "}", "char", "[", "]", "[", "]", "qualifiedName", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "sourceName", ")", ";", "int", "length", "=", "qualifiedName", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "null", ";", "IType", "type", "=", "createTypeHandle", "(", "new", "String", "(", "qualifiedName", "[", "0", "]", ")", ")", ";", "if", "(", "type", "==", "null", ")", "return", "null", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "length", ";", "i", "++", ")", "{", "type", "=", "type", ".", "getType", "(", "new", "String", "(", "qualifiedName", "[", "i", "]", ")", ")", ";", "if", "(", "type", "==", "null", ")", "return", "null", ";", "}", "if", "(", "type", ".", "exists", "(", ")", ")", "return", "type", ";", "return", "null", ";", "}", "public", "SearchMatch", "newDeclarationMatch", "(", "IJavaElement", "element", ",", "Binding", "binding", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ")", "{", "SearchParticipant", "participant", "=", "getParticipant", "(", ")", ";", "IResource", "resource", "=", "this", ".", "currentPossibleMatch", ".", "resource", ";", "return", "newDeclarationMatch", "(", "element", ",", "binding", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "}", "public", "SearchMatch", "newDeclarationMatch", "(", "IJavaElement", "element", ",", "Binding", "binding", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "return", "new", "PackageDeclarationMatch", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "case", "IJavaElement", ".", "TYPE", ":", "return", "new", "TypeDeclarationMatch", "(", "binding", "==", "null", "?", "element", ":", "(", "(", "JavaElement", ")", "element", ")", ".", "resolved", "(", "binding", ")", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "case", "IJavaElement", ".", "FIELD", ":", "return", "new", "FieldDeclarationMatch", "(", "binding", "==", "null", "?", "element", ":", "(", "(", "JavaElement", ")", "element", ")", ".", "resolved", "(", "binding", ")", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "case", "IJavaElement", ".", "METHOD", ":", "return", "new", "MethodDeclarationMatch", "(", "binding", "==", "null", "?", "element", ":", "(", "(", "JavaElement", ")", "element", ")", ".", "resolved", "(", "binding", ")", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "case", "IJavaElement", ".", "LOCAL_VARIABLE", ":", "return", "new", "LocalVariableDeclarationMatch", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "case", "IJavaElement", ".", "PACKAGE_DECLARATION", ":", "return", "new", "PackageDeclarationMatch", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "case", "IJavaElement", ".", "TYPE_PARAMETER", ":", "return", "new", "TypeParameterDeclarationMatch", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "default", ":", "return", "null", ";", "}", "}", "public", "FieldReferenceMatch", "newFieldReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "IJavaElement", "localElement", ",", "Binding", "enclosingBinding", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "ASTNode", "reference", ")", "{", "int", "bits", "=", "reference", ".", "bits", ";", "boolean", "isCompoundAssigned", "=", "(", "bits", "&", "ASTNode", ".", "IsCompoundAssigned", ")", "!=", "0", ";", "boolean", "isReadAccess", "=", "isCompoundAssigned", "||", "(", "bits", "&", "ASTNode", ".", "IsStrictlyAssigned", ")", "==", "0", ";", "boolean", "isWriteAccess", "=", "isCompoundAssigned", "||", "(", "bits", "&", "ASTNode", ".", "IsStrictlyAssigned", ")", "!=", "0", ";", "if", "(", "isWriteAccess", ")", "{", "if", "(", "reference", "instanceof", "QualifiedNameReference", ")", "{", "char", "[", "]", "[", "]", "tokens", "=", "(", "(", "QualifiedNameReference", ")", "reference", ")", ".", "tokens", ";", "char", "[", "]", "lastToken", "=", "tokens", "[", "tokens", ".", "length", "-", "1", "]", ";", "if", "(", "this", ".", "pattern", "instanceof", "OrPattern", ")", "{", "SearchPattern", "[", "]", "patterns", "=", "(", "(", "OrPattern", ")", "this", ".", "pattern", ")", ".", "patterns", ";", "for", "(", "int", "i", "=", "0", ",", "pLength", "=", "patterns", ".", "length", ";", "i", "<", "pLength", ";", "i", "++", ")", "{", "if", "(", "!", "this", ".", "patternLocator", ".", "matchesName", "(", "(", "(", "VariablePattern", ")", "patterns", "[", "i", "]", ")", ".", "name", ",", "lastToken", ")", ")", "{", "isWriteAccess", "=", "false", ";", "isReadAccess", "=", "true", ";", "}", "}", "}", "else", "if", "(", "!", "this", ".", "patternLocator", ".", "matchesName", "(", "(", "(", "VariablePattern", ")", "this", ".", "pattern", ")", ".", "name", ",", "lastToken", ")", ")", "{", "isWriteAccess", "=", "false", ";", "isReadAccess", "=", "true", ";", "}", "}", "}", "boolean", "insideDocComment", "=", "(", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "!=", "0", ";", "SearchParticipant", "participant", "=", "getParticipant", "(", ")", ";", "IResource", "resource", "=", "this", ".", "currentPossibleMatch", ".", "resource", ";", "if", "(", "enclosingBinding", "!=", "null", ")", "{", "enclosingElement", "=", "(", "(", "JavaElement", ")", "enclosingElement", ")", ".", "resolved", "(", "enclosingBinding", ")", ";", "}", "FieldReferenceMatch", "match", "=", "new", "FieldReferenceMatch", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "isReadAccess", ",", "isWriteAccess", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "match", ".", "setLocalElement", "(", "localElement", ")", ";", "return", "match", ";", "}", "public", "SearchMatch", "newLocalVariableReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "ASTNode", "reference", ")", "{", "int", "bits", "=", "reference", ".", "bits", ";", "boolean", "isCompoundAssigned", "=", "(", "bits", "&", "ASTNode", ".", "IsCompoundAssigned", ")", "!=", "0", ";", "boolean", "isReadAccess", "=", "isCompoundAssigned", "||", "(", "bits", "&", "ASTNode", ".", "IsStrictlyAssigned", ")", "==", "0", ";", "boolean", "isWriteAccess", "=", "isCompoundAssigned", "||", "(", "bits", "&", "ASTNode", ".", "IsStrictlyAssigned", ")", "!=", "0", ";", "if", "(", "isWriteAccess", ")", "{", "if", "(", "reference", "instanceof", "QualifiedNameReference", ")", "{", "char", "[", "]", "[", "]", "tokens", "=", "(", "(", "QualifiedNameReference", ")", "reference", ")", ".", "tokens", ";", "char", "[", "]", "lastToken", "=", "tokens", "[", "tokens", ".", "length", "-", "1", "]", ";", "if", "(", "this", ".", "pattern", "instanceof", "OrPattern", ")", "{", "SearchPattern", "[", "]", "patterns", "=", "(", "(", "OrPattern", ")", "this", ".", "pattern", ")", ".", "patterns", ";", "for", "(", "int", "i", "=", "0", ",", "pLength", "=", "patterns", ".", "length", ";", "i", "<", "pLength", ";", "i", "++", ")", "{", "if", "(", "!", "this", ".", "patternLocator", ".", "matchesName", "(", "(", "(", "VariablePattern", ")", "patterns", "[", "i", "]", ")", ".", "name", ",", "lastToken", ")", ")", "{", "isWriteAccess", "=", "false", ";", "isReadAccess", "=", "true", ";", "}", "}", "}", "else", "if", "(", "!", "this", ".", "patternLocator", ".", "matchesName", "(", "(", "(", "VariablePattern", ")", "this", ".", "pattern", ")", ".", "name", ",", "lastToken", ")", ")", "{", "isWriteAccess", "=", "false", ";", "isReadAccess", "=", "true", ";", "}", "}", "}", "boolean", "insideDocComment", "=", "(", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "!=", "0", ";", "SearchParticipant", "participant", "=", "getParticipant", "(", ")", ";", "IResource", "resource", "=", "this", ".", "currentPossibleMatch", ".", "resource", ";", "return", "new", "LocalVariableReferenceMatch", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "isReadAccess", ",", "isWriteAccess", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "}", "public", "MethodReferenceMatch", "newMethodReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "Binding", "enclosingBinding", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "isConstructor", ",", "boolean", "isSynthetic", ",", "ASTNode", "reference", ")", "{", "SearchParticipant", "participant", "=", "getParticipant", "(", ")", ";", "IResource", "resource", "=", "this", ".", "currentPossibleMatch", ".", "resource", ";", "boolean", "insideDocComment", "=", "(", "reference", ".", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "!=", "0", ";", "if", "(", "enclosingBinding", "!=", "null", ")", "enclosingElement", "=", "(", "(", "JavaElement", ")", "enclosingElement", ")", ".", "resolved", "(", "enclosingBinding", ")", ";", "boolean", "isOverridden", "=", "(", "accuracy", "&", "PatternLocator", ".", "SUPER_INVOCATION_FLAVOR", ")", "!=", "0", ";", "return", "new", "MethodReferenceMatch", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "isConstructor", ",", "isSynthetic", ",", "isOverridden", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "}", "public", "PackageReferenceMatch", "newPackageReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "ASTNode", "reference", ")", "{", "SearchParticipant", "participant", "=", "getParticipant", "(", ")", ";", "IResource", "resource", "=", "this", ".", "currentPossibleMatch", ".", "resource", ";", "boolean", "insideDocComment", "=", "(", "reference", ".", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "!=", "0", ";", "return", "new", "PackageReferenceMatch", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "}", "public", "SearchMatch", "newTypeParameterReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "ASTNode", "reference", ")", "{", "int", "bits", "=", "reference", ".", "bits", ";", "boolean", "insideDocComment", "=", "(", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "!=", "0", ";", "SearchParticipant", "participant", "=", "getParticipant", "(", ")", ";", "IResource", "resource", "=", "this", ".", "currentPossibleMatch", ".", "resource", ";", "return", "new", "TypeParameterReferenceMatch", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "}", "public", "TypeReferenceMatch", "newTypeReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "Binding", "enclosingBinding", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "ASTNode", "reference", ")", "{", "SearchParticipant", "participant", "=", "getParticipant", "(", ")", ";", "IResource", "resource", "=", "this", ".", "currentPossibleMatch", ".", "resource", ";", "boolean", "insideDocComment", "=", "(", "reference", ".", "bits", "&", "ASTNode", ".", "InsideJavadoc", ")", "!=", "0", ";", "if", "(", "enclosingBinding", "!=", "null", ")", "enclosingElement", "=", "(", "(", "JavaElement", ")", "enclosingElement", ")", ".", "resolved", "(", "enclosingBinding", ")", ";", "return", "new", "TypeReferenceMatch", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "}", "public", "TypeReferenceMatch", "newTypeReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "Binding", "enclosingBinding", ",", "int", "accuracy", ",", "ASTNode", "reference", ")", "{", "return", "newTypeReferenceMatch", "(", "enclosingElement", ",", "enclosingBinding", ",", "accuracy", ",", "reference", ".", "sourceStart", ",", "reference", ".", "sourceEnd", "-", "reference", ".", "sourceStart", "+", "1", ",", "reference", ")", ";", "}", "protected", "boolean", "parseAndBuildBindings", "(", "PossibleMatch", "possibleMatch", ",", "boolean", "mustResolve", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", "&&", "this", ".", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "try", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "System", ".", "out", ".", "println", "(", "\"Parsing", "\"", "+", "possibleMatch", ".", "openable", ".", "toStringWithAncestors", "(", ")", ")", ";", "this", ".", "parser", ".", "nodeSet", "=", "possibleMatch", ".", "nodeSet", ";", "CompilationResult", "unitResult", "=", "new", "CompilationResult", "(", "possibleMatch", ",", "1", ",", "1", ",", "this", ".", "options", ".", "maxProblemsPerUnit", ")", ";", "CompilationUnitDeclaration", "parsedUnit", "=", "this", ".", "parser", ".", "dietParse", "(", "possibleMatch", ",", "unitResult", ")", ";", "if", "(", "parsedUnit", "!=", "null", ")", "{", "if", "(", "!", "parsedUnit", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "mustResolve", ")", "{", "this", ".", "lookupEnvironment", ".", "buildTypeBindings", "(", "parsedUnit", ",", "null", ")", ";", "}", "if", "(", "hasAlreadyDefinedType", "(", "parsedUnit", ")", ")", "return", "false", ";", "if", "(", "!", "LanguageSupportFactory", ".", "isInterestingSourceFile", "(", "new", "String", "(", "parsedUnit", ".", "getFileName", "(", ")", ")", ")", ")", "{", "getMethodBodies", "(", "parsedUnit", ",", "possibleMatch", ".", "nodeSet", ")", ";", "}", "if", "(", "this", ".", "patternLocator", ".", "mayBeGeneric", "&&", "!", "mustResolve", "&&", "possibleMatch", ".", "nodeSet", ".", "mustResolve", ")", "{", "this", ".", "lookupEnvironment", ".", "buildTypeBindings", "(", "parsedUnit", ",", "null", ")", ";", "}", "}", "possibleMatch", ".", "parsedUnit", "=", "parsedUnit", ";", "int", "size", "=", "this", ".", "matchesToProcess", ".", "length", ";", "if", "(", "this", ".", "numberOfMatches", "==", "size", ")", "System", ".", "arraycopy", "(", "this", ".", "matchesToProcess", ",", "0", ",", "this", ".", "matchesToProcess", "=", "new", "PossibleMatch", "[", "size", "==", "0", "?", "1", ":", "size", "*", "2", "]", ",", "0", ",", "this", ".", "numberOfMatches", ")", ";", "this", ".", "matchesToProcess", "[", "this", ".", "numberOfMatches", "++", "]", "=", "possibleMatch", ";", "}", "}", "finally", "{", "this", ".", "parser", ".", "nodeSet", "=", "null", ";", "}", "return", "true", ";", "}", "protected", "void", "process", "(", "PossibleMatch", "possibleMatch", ",", "boolean", "bindingsWereCreated", ")", "throws", "CoreException", "{", "if", "(", "LanguageSupportFactory", ".", "isInterestingSourceFile", "(", "new", "String", "(", "possibleMatch", ".", "getFileName", "(", ")", ")", ")", ")", "{", "try", "{", "this", ".", "lookupEnvironment", ".", "buildTypeBindings", "(", "possibleMatch", ".", "parsedUnit", ",", "null", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "t", ".", "printStackTrace", "(", ")", ";", "}", "possibleMatch", ".", "parsedUnit", ".", "resolve", "(", ")", ";", "return", ";", "}", "this", ".", "currentPossibleMatch", "=", "possibleMatch", ";", "CompilationUnitDeclaration", "unit", "=", "possibleMatch", ".", "parsedUnit", ";", "try", "{", "if", "(", "unit", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "this", ".", "currentPossibleMatch", ".", "openable", "instanceof", "ClassFile", ")", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "this", ".", "currentPossibleMatch", ".", "openable", ";", "IBinaryType", "info", "=", "null", ";", "try", "{", "info", "=", "getBinaryInfo", "(", "classFile", ",", "classFile", ".", "resource", "(", ")", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "}", "if", "(", "info", "!=", "null", ")", "{", "boolean", "mayBeGeneric", "=", "this", ".", "patternLocator", ".", "mayBeGeneric", ";", "this", ".", "patternLocator", ".", "mayBeGeneric", "=", "false", ";", "try", "{", "new", "ClassFileMatchLocator", "(", ")", ".", "locateMatches", "(", "this", ",", "classFile", ",", "info", ")", ";", "}", "finally", "{", "this", ".", "patternLocator", ".", "mayBeGeneric", "=", "mayBeGeneric", ";", "}", "}", "}", "return", ";", "}", "if", "(", "hasAlreadyDefinedType", "(", "unit", ")", ")", "return", ";", "boolean", "mustResolve", "=", "(", "this", ".", "pattern", ".", "mustResolve", "||", "possibleMatch", ".", "nodeSet", ".", "mustResolve", ")", ";", "if", "(", "bindingsWereCreated", "&&", "mustResolve", ")", "{", "if", "(", "unit", ".", "types", "!=", "null", ")", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "System", ".", "out", ".", "println", "(", "\"Resolving", "\"", "+", "this", ".", "currentPossibleMatch", ".", "openable", ".", "toStringWithAncestors", "(", ")", ")", ";", "this", ".", "lookupEnvironment", ".", "unitBeingCompleted", "=", "unit", ";", "reduceParseTree", "(", "unit", ")", ";", "if", "(", "unit", ".", "scope", "!=", "null", ")", "{", "unit", ".", "scope", ".", "faultInTypes", "(", ")", ";", "}", "unit", ".", "resolve", "(", ")", ";", "}", "else", "if", "(", "unit", ".", "isPackageInfo", "(", ")", ")", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "System", ".", "out", ".", "println", "(", "\"Resolving", "\"", "+", "this", ".", "currentPossibleMatch", ".", "openable", ".", "toStringWithAncestors", "(", ")", ")", ";", "unit", ".", "resolve", "(", ")", ";", "}", "}", "reportMatching", "(", "unit", ",", "mustResolve", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "String", ".", "valueOf", "(", "unit", ".", "getFileName", "(", ")", ")", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "reportMatching", "(", "unit", ",", "false", ")", ";", "if", "(", "!", "(", "e", "instanceof", "AbortCompilationUnit", ")", ")", "{", "throw", "e", ";", "}", "}", "finally", "{", "this", ".", "lookupEnvironment", ".", "unitBeingCompleted", "=", "null", ";", "this", ".", "currentPossibleMatch", "=", "null", ";", "}", "}", "protected", "void", "purgeMethodStatements", "(", "TypeDeclaration", "type", ",", "boolean", "checkEachMethod", ")", "{", "checkEachMethod", "=", "checkEachMethod", "&&", "this", ".", "currentPossibleMatch", ".", "nodeSet", ".", "hasPossibleNodes", "(", "type", ".", "declarationSourceStart", ",", "type", ".", "declarationSourceEnd", ")", ";", "AbstractMethodDeclaration", "[", "]", "methods", "=", "type", ".", "methods", ";", "if", "(", "methods", "!=", "null", ")", "{", "if", "(", "checkEachMethod", ")", "{", "for", "(", "int", "j", "=", "0", ",", "length", "=", "methods", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "AbstractMethodDeclaration", "method", "=", "methods", "[", "j", "]", ";", "if", "(", "!", "this", ".", "currentPossibleMatch", ".", "nodeSet", ".", "hasPossibleNodes", "(", "method", ".", "declarationSourceStart", ",", "method", ".", "declarationSourceEnd", ")", ")", "{", "if", "(", "this", ".", "sourceStartOfMethodToRetain", "!=", "method", ".", "declarationSourceStart", "||", "this", ".", "sourceEndOfMethodToRetain", "!=", "method", ".", "declarationSourceEnd", ")", "{", "method", ".", "statements", "=", "null", ";", "method", ".", "javadoc", "=", "null", ";", "}", "}", "}", "}", "else", "{", "for", "(", "int", "j", "=", "0", ",", "length", "=", "methods", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "AbstractMethodDeclaration", "method", "=", "methods", "[", "j", "]", ";", "if", "(", "this", ".", "sourceStartOfMethodToRetain", "!=", "method", ".", "declarationSourceStart", "||", "this", ".", "sourceEndOfMethodToRetain", "!=", "method", ".", "declarationSourceEnd", ")", "{", "method", ".", "statements", "=", "null", ";", "method", ".", "javadoc", "=", "null", ";", "}", "}", "}", "}", "TypeDeclaration", "[", "]", "memberTypes", "=", "type", ".", "memberTypes", ";", "if", "(", "memberTypes", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ",", "l", "=", "memberTypes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "purgeMethodStatements", "(", "memberTypes", "[", "i", "]", ",", "checkEachMethod", ")", ";", "}", "protected", "void", "reduceParseTree", "(", "CompilationUnitDeclaration", "unit", ")", "{", "TypeDeclaration", "[", "]", "types", "=", "unit", ".", "types", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "types", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "purgeMethodStatements", "(", "types", "[", "i", "]", ",", "true", ")", ";", "}", "public", "SearchParticipant", "getParticipant", "(", ")", "{", "return", "this", ".", "currentPossibleMatch", ".", "document", ".", "getParticipant", "(", ")", ";", "}", "protected", "void", "report", "(", "SearchMatch", "match", ")", "throws", "CoreException", "{", "if", "(", "match", "==", "null", ")", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "return", ";", "}", "if", "(", "filterEnum", "(", "match", ")", ")", "{", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "return", ";", "}", "long", "start", "=", "-", "1", ";", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"tResource:", "\"", "+", "match", ".", "getResource", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "match", ".", "getOffset", "(", ")", "+", "\",", "length=\"", "+", "match", ".", "getLength", "(", ")", "+", "\"]\"", ")", ";", "try", "{", "if", "(", "this", ".", "parser", "!=", "null", "&&", "match", ".", "getOffset", "(", ")", ">", "0", "&&", "match", ".", "getLength", "(", ")", ">", "0", "&&", "!", "(", "match", ".", "getElement", "(", ")", "instanceof", "BinaryMember", ")", ")", "{", "String", "selection", "=", "new", "String", "(", "this", ".", "parser", ".", "scanner", ".", "source", ",", "match", ".", "getOffset", "(", ")", ",", "match", ".", "getLength", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "selection", "+", "\"<--\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "try", "{", "JavaElement", "javaElement", "=", "(", "JavaElement", ")", "match", ".", "getElement", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "javaElement", ".", "toStringWithAncestors", "(", ")", ")", ";", "if", "(", "!", "javaElement", ".", "exists", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "if", "(", "match", "instanceof", "ReferenceMatch", ")", "{", "try", "{", "ReferenceMatch", "refMatch", "=", "(", "ReferenceMatch", ")", "match", ";", "JavaElement", "local", "=", "(", "JavaElement", ")", "refMatch", ".", "getLocalElement", "(", ")", ";", "if", "(", "local", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "local", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "if", "(", "match", "instanceof", "TypeReferenceMatch", ")", "{", "IJavaElement", "[", "]", "others", "=", "(", "(", "TypeReferenceMatch", ")", "refMatch", ")", ".", "getOtherElements", "(", ")", ";", "if", "(", "others", "!=", "null", ")", "{", "int", "length", "=", "others", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JavaElement", "other", "=", "(", "JavaElement", ")", "others", "[", "i", "]", ";", "System", ".", "out", ".", "println", "(", "\"tt-", "\"", "+", "other", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "System", ".", "out", ".", "println", "(", "match", ".", "getAccuracy", "(", ")", "==", "SearchMatch", ".", "A_ACCURATE", "?", "\"\"", ":", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "\"tRule:", "\"", ")", ";", "if", "(", "match", ".", "isExact", "(", ")", ")", "{", "System", ".", "out", ".", "print", "(", "\"EXACT\"", ")", ";", "}", "else", "if", "(", "match", ".", "isEquivalent", "(", ")", ")", "{", "System", ".", "out", ".", "print", "(", "\"EQUIVALENT\"", ")", ";", "}", "else", "if", "(", "match", ".", "isErasure", "(", ")", ")", "{", "System", ".", "out", ".", "print", "(", "\"ERASURE\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "print", "(", "\"INVALID", "RULE\"", ")", ";", "}", "if", "(", "match", "instanceof", "MethodReferenceMatch", ")", "{", "MethodReferenceMatch", "methodReferenceMatch", "=", "(", "MethodReferenceMatch", ")", "match", ";", "if", "(", "methodReferenceMatch", ".", "isSuperInvocation", "(", ")", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "}", "if", "(", "methodReferenceMatch", ".", "isImplicit", "(", ")", ")", "{", "System", ".", "out", ".", "print", "(", "\"+IMPLICIT\"", ")", ";", "}", "if", "(", "methodReferenceMatch", ".", "isSynthetic", "(", ")", ")", "{", "System", ".", "out", ".", "print", "(", "\"+SYNTHETIC\"", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", "\"ntRaw:", "\"", "+", "match", ".", "isRaw", "(", ")", ")", ";", "}", "this", ".", "requestor", ".", "acceptSearchMatch", "(", "match", ")", ";", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "this", ".", "resultCollectorTime", "+=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ";", "}", "protected", "void", "reportAccurateTypeReference", "(", "SearchMatch", "match", ",", "ASTNode", "typeRef", ",", "char", "[", "]", "name", ")", "throws", "CoreException", "{", "if", "(", "match", ".", "getRule", "(", ")", "==", "0", ")", "return", ";", "if", "(", "!", "encloses", "(", "(", "IJavaElement", ")", "match", ".", "getElement", "(", ")", ")", ")", "return", ";", "int", "sourceStart", "=", "typeRef", ".", "sourceStart", ";", "int", "sourceEnd", "=", "typeRef", ".", "sourceEnd", ";", "if", "(", "name", "!=", "null", ")", "{", "Scanner", "scanner", "=", "this", ".", "parser", ".", "scanner", ";", "scanner", ".", "setSource", "(", "this", ".", "currentPossibleMatch", ".", "getContents", "(", ")", ")", ";", "scanner", ".", "resetTo", "(", "sourceStart", ",", "sourceEnd", ")", ";", "int", "token", "=", "-", "1", ";", "int", "currentPosition", ";", "do", "{", "currentPosition", "=", "scanner", ".", "currentPosition", ";", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "}", "if", "(", "token", "==", "TerminalTokens", ".", "TokenNameIdentifier", "&&", "this", ".", "pattern", ".", "matchesName", "(", "name", ",", "scanner", ".", "getCurrentTokenSource", "(", ")", ")", ")", "{", "int", "length", "=", "scanner", ".", "currentPosition", "-", "currentPosition", ";", "match", ".", "setOffset", "(", "currentPosition", ")", ";", "match", ".", "setLength", "(", "length", ")", ";", "report", "(", "match", ")", ";", "return", ";", "}", "}", "while", "(", "token", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", ";", "}", "match", ".", "setOffset", "(", "sourceStart", ")", ";", "match", ".", "setLength", "(", "sourceEnd", "-", "sourceStart", "+", "1", ")", ";", "report", "(", "match", ")", ";", "}", "protected", "void", "reportAccurateParameterizedMethodReference", "(", "SearchMatch", "match", ",", "ASTNode", "statement", ",", "TypeReference", "[", "]", "typeArguments", ")", "throws", "CoreException", "{", "if", "(", "match", ".", "getRule", "(", ")", "==", "0", ")", "return", ";", "if", "(", "!", "encloses", "(", "(", "IJavaElement", ")", "match", ".", "getElement", "(", ")", ")", ")", "return", ";", "int", "start", "=", "match", ".", "getOffset", "(", ")", ";", "if", "(", "typeArguments", "!=", "null", "&&", "typeArguments", ".", "length", ">", "0", ")", "{", "boolean", "isErasureMatch", "=", "(", "this", ".", "pattern", "instanceof", "OrPattern", ")", "?", "(", "(", "OrPattern", ")", "this", ".", "pattern", ")", ".", "isErasureMatch", "(", ")", ":", "(", "(", "JavaSearchPattern", ")", "this", ".", "pattern", ")", ".", "isErasureMatch", "(", ")", ";", "if", "(", "!", "isErasureMatch", ")", "{", "Scanner", "scanner", "=", "this", ".", "parser", ".", "scanner", ";", "char", "[", "]", "source", "=", "this", ".", "currentPossibleMatch", ".", "getContents", "(", ")", ";", "scanner", ".", "setSource", "(", "source", ")", ";", "start", "=", "typeArguments", "[", "0", "]", ".", "sourceStart", ";", "int", "end", "=", "statement", ".", "sourceEnd", ";", "scanner", ".", "resetTo", "(", "start", ",", "end", ")", ";", "int", "lineStart", "=", "start", ";", "try", "{", "linesUp", ":", "while", "(", "true", ")", "{", "while", "(", "scanner", ".", "source", "[", "scanner", ".", "currentPosition", "]", "!=", "'\\n'", ")", "{", "scanner", ".", "currentPosition", "--", ";", "if", "(", "scanner", ".", "currentPosition", "==", "0", ")", "break", "linesUp", ";", "}", "lineStart", "=", "scanner", ".", "currentPosition", "+", "1", ";", "scanner", ".", "resetTo", "(", "lineStart", ",", "end", ")", ";", "while", "(", "!", "scanner", ".", "atEnd", "(", ")", ")", "{", "if", "(", "scanner", ".", "getNextToken", "(", ")", "==", "TerminalTokens", ".", "TokenNameLESS", ")", "{", "start", "=", "scanner", ".", "getCurrentTokenStartPosition", "(", ")", ";", "break", "linesUp", ";", "}", "}", "end", "=", "lineStart", "-", "2", ";", "scanner", ".", "currentPosition", "=", "end", ";", "}", "}", "catch", "(", "InvalidInputException", "ex", ")", "{", "}", "}", "}", "match", ".", "setOffset", "(", "start", ")", ";", "match", ".", "setLength", "(", "statement", ".", "sourceEnd", "-", "start", "+", "1", ")", ";", "report", "(", "match", ")", ";", "}", "protected", "void", "reportAccurateParameterizedTypeReference", "(", "SearchMatch", "match", ",", "TypeReference", "typeRef", ",", "int", "index", ",", "TypeReference", "[", "]", "typeArguments", ")", "throws", "CoreException", "{", "if", "(", "match", ".", "getRule", "(", ")", "==", "0", ")", "return", ";", "if", "(", "!", "encloses", "(", "(", "IJavaElement", ")", "match", ".", "getElement", "(", ")", ")", ")", "return", ";", "int", "end", "=", "typeRef", ".", "sourceEnd", ";", "if", "(", "typeArguments", "!=", "null", ")", "{", "boolean", "shouldMatchErasure", "=", "(", "this", ".", "pattern", "instanceof", "OrPattern", ")", "?", "(", "(", "OrPattern", ")", "this", ".", "pattern", ")", ".", "isErasureMatch", "(", ")", ":", "(", "(", "JavaSearchPattern", ")", "this", ".", "pattern", ")", ".", "isErasureMatch", "(", ")", ";", "boolean", "hasSignatures", "=", "(", "this", ".", "pattern", "instanceof", "OrPattern", ")", "?", "(", "(", "OrPattern", ")", "this", ".", "pattern", ")", ".", "hasSignatures", "(", ")", ":", "(", "(", "JavaSearchPattern", ")", "this", ".", "pattern", ")", ".", "hasSignatures", "(", ")", ";", "if", "(", "shouldMatchErasure", "||", "!", "hasSignatures", ")", "{", "if", "(", "typeRef", "instanceof", "QualifiedTypeReference", "&&", "index", ">=", "0", ")", "{", "long", "[", "]", "positions", "=", "(", "(", "QualifiedTypeReference", ")", "typeRef", ")", ".", "sourcePositions", ";", "end", "=", "(", "int", ")", "positions", "[", "index", "]", ";", "}", "else", "if", "(", "typeRef", "instanceof", "ArrayTypeReference", ")", "{", "end", "=", "(", "(", "ArrayTypeReference", ")", "typeRef", ")", ".", "originalSourceEnd", ";", "}", "}", "else", "{", "Scanner", "scanner", "=", "this", ".", "parser", ".", "scanner", ";", "char", "[", "]", "source", "=", "this", ".", "currentPossibleMatch", ".", "getContents", "(", ")", ";", "scanner", ".", "setSource", "(", "source", ")", ";", "scanner", ".", "resetTo", "(", "end", ",", "source", ".", "length", "-", "1", ")", ";", "int", "depth", "=", "0", ";", "for", "(", "int", "i", "=", "typeArguments", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "typeArguments", "[", "i", "]", "!=", "null", ")", "{", "long", "lastTypeArgInfo", "=", "findLastTypeArgumentInfo", "(", "typeArguments", "[", "i", "]", ")", ";", "depth", "=", "(", "int", ")", "(", "lastTypeArgInfo", ">>>", "32", ")", "+", "1", ";", "scanner", ".", "resetTo", "(", "(", "(", "int", ")", "lastTypeArgInfo", ")", "+", "1", ",", "scanner", ".", "eofPosition", "-", "1", ")", ";", "break", ";", "}", "}", "while", "(", "depth", "--", ">", "0", ")", "{", "while", "(", "!", "scanner", ".", "atEnd", "(", ")", ")", "{", "if", "(", "scanner", ".", "getNextChar", "(", ")", "==", "'>'", ")", "{", "end", "=", "scanner", ".", "currentPosition", "-", "1", ";", "break", ";", "}", "}", "}", "}", "}", "match", ".", "setLength", "(", "end", "-", "match", ".", "getOffset", "(", ")", "+", "1", ")", ";", "report", "(", "match", ")", ";", "}", "protected", "void", "reportAccurateEnumConstructorReference", "(", "SearchMatch", "match", ",", "FieldDeclaration", "field", ",", "AllocationExpression", "allocation", ")", "throws", "CoreException", "{", "if", "(", "allocation", "==", "null", "||", "allocation", ".", "enumConstant", "==", "null", ")", "{", "report", "(", "match", ")", ";", "return", ";", "}", "int", "sourceStart", "=", "match", ".", "getOffset", "(", ")", "+", "match", ".", "getLength", "(", ")", ";", "if", "(", "allocation", ".", "arguments", "!=", "null", "&&", "allocation", ".", "arguments", ".", "length", ">", "0", ")", "{", "sourceStart", "=", "allocation", ".", "arguments", "[", "allocation", ".", "arguments", ".", "length", "-", "1", "]", ".", "sourceEnd", "+", "1", ";", "}", "int", "sourceEnd", "=", "field", ".", "declarationSourceEnd", ";", "if", "(", "allocation", "instanceof", "QualifiedAllocationExpression", ")", "{", "QualifiedAllocationExpression", "qualifiedAllocation", "=", "(", "QualifiedAllocationExpression", ")", "allocation", ";", "if", "(", "qualifiedAllocation", ".", "anonymousType", "!=", "null", ")", "{", "sourceEnd", "=", "qualifiedAllocation", ".", "anonymousType", ".", "sourceStart", "-", "1", ";", "}", "}", "Scanner", "scanner", "=", "this", ".", "parser", ".", "scanner", ";", "scanner", ".", "setSource", "(", "this", ".", "currentPossibleMatch", ".", "getContents", "(", ")", ")", ";", "scanner", ".", "resetTo", "(", "sourceStart", ",", "sourceEnd", ")", ";", "try", "{", "int", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "while", "(", "token", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "if", "(", "token", "==", "TerminalTokens", ".", "TokenNameRPAREN", ")", "{", "sourceEnd", "=", "scanner", ".", "getCurrentTokenEndPosition", "(", ")", ";", "}", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "}", "catch", "(", "InvalidInputException", "iie", ")", "{", "}", "match", ".", "setLength", "(", "sourceEnd", "-", "match", ".", "getOffset", "(", ")", "+", "1", ")", ";", "report", "(", "match", ")", ";", "}", "protected", "void", "reportAccurateFieldReference", "(", "SearchMatch", "[", "]", "matches", ",", "QualifiedNameReference", "qNameRef", ")", "throws", "CoreException", "{", "if", "(", "matches", "==", "null", ")", "return", ";", "int", "matchesLength", "=", "matches", ".", "length", ";", "int", "sourceStart", "=", "qNameRef", ".", "sourceStart", ";", "int", "sourceEnd", "=", "qNameRef", ".", "sourceEnd", ";", "char", "[", "]", "[", "]", "tokens", "=", "qNameRef", ".", "tokens", ";", "Scanner", "scanner", "=", "this", ".", "parser", ".", "scanner", ";", "scanner", ".", "setSource", "(", "this", ".", "currentPossibleMatch", ".", "getContents", "(", ")", ")", ";", "scanner", ".", "resetTo", "(", "sourceStart", ",", "sourceEnd", ")", ";", "int", "sourceLength", "=", "sourceEnd", "-", "sourceStart", "+", "1", ";", "int", "refSourceStart", "=", "-", "1", ",", "refSourceEnd", "=", "-", "1", ";", "int", "length", "=", "tokens", ".", "length", ";", "int", "token", "=", "-", "1", ";", "int", "previousValid", "=", "-", "1", ";", "int", "i", "=", "0", ";", "int", "index", "=", "0", ";", "do", "{", "int", "currentPosition", "=", "scanner", ".", "currentPosition", ";", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "}", "if", "(", "token", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "char", "[", "]", "currentTokenSource", "=", "scanner", ".", "getCurrentTokenSource", "(", ")", ";", "boolean", "equals", "=", "false", ";", "while", "(", "i", "<", "length", "&&", "!", "(", "equals", "=", "this", ".", "pattern", ".", "matchesName", "(", "tokens", "[", "i", "++", "]", ",", "currentTokenSource", ")", ")", ")", "{", "}", "if", "(", "equals", "&&", "(", "previousValid", "==", "-", "1", "||", "previousValid", "==", "i", "-", "2", ")", ")", "{", "previousValid", "=", "i", "-", "1", ";", "if", "(", "refSourceStart", "==", "-", "1", ")", "refSourceStart", "=", "currentPosition", ";", "refSourceEnd", "=", "scanner", ".", "currentPosition", "-", "1", ";", "}", "else", "{", "i", "=", "0", ";", "refSourceStart", "=", "-", "1", ";", "previousValid", "=", "-", "1", ";", "}", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "}", "}", "SearchMatch", "match", "=", "matches", "[", "index", "]", ";", "if", "(", "match", "!=", "null", "&&", "match", ".", "getRule", "(", ")", "!=", "0", ")", "{", "if", "(", "!", "encloses", "(", "(", "IJavaElement", ")", "match", ".", "getElement", "(", ")", ")", ")", "return", ";", "if", "(", "refSourceStart", "!=", "-", "1", ")", "{", "match", ".", "setOffset", "(", "refSourceStart", ")", ";", "match", ".", "setLength", "(", "refSourceEnd", "-", "refSourceStart", "+", "1", ")", ";", "report", "(", "match", ")", ";", "}", "else", "{", "match", ".", "setOffset", "(", "sourceStart", ")", ";", "match", ".", "setLength", "(", "sourceLength", ")", ";", "report", "(", "match", ")", ";", "}", "i", "=", "0", ";", "}", "refSourceStart", "=", "-", "1", ";", "previousValid", "=", "-", "1", ";", "if", "(", "index", "<", "matchesLength", "-", "1", ")", "{", "index", "++", ";", "}", "}", "while", "(", "token", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", ";", "}", "protected", "void", "reportBinaryMemberDeclaration", "(", "IResource", "resource", ",", "IMember", "binaryMember", ",", "Binding", "binaryMemberBinding", ",", "IBinaryType", "info", ",", "int", "accuracy", ")", "throws", "CoreException", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "binaryMember", ".", "getClassFile", "(", ")", ";", "ISourceRange", "range", "=", "classFile", ".", "isOpen", "(", ")", "?", "binaryMember", ".", "getNameRange", "(", ")", ":", "SourceMapper", ".", "UNKNOWN_RANGE", ";", "if", "(", "range", ".", "getOffset", "(", ")", "==", "-", "1", ")", "{", "BinaryType", "type", "=", "(", "BinaryType", ")", "classFile", ".", "getType", "(", ")", ";", "String", "sourceFileName", "=", "type", ".", "sourceFileName", "(", "info", ")", ";", "if", "(", "sourceFileName", "!=", "null", ")", "{", "SourceMapper", "mapper", "=", "classFile", ".", "getSourceMapper", "(", ")", ";", "if", "(", "mapper", "!=", "null", ")", "{", "char", "[", "]", "contents", "=", "mapper", ".", "findSource", "(", "type", ",", "sourceFileName", ")", ";", "if", "(", "contents", "!=", "null", ")", "range", "=", "mapper", ".", "mapSource", "(", "type", ",", "contents", ",", "info", ",", "binaryMember", ")", ";", "}", "}", "}", "if", "(", "resource", "==", "null", ")", "resource", "=", "this", ".", "currentPossibleMatch", ".", "resource", ";", "SearchMatch", "match", "=", "newDeclarationMatch", "(", "binaryMember", ",", "binaryMemberBinding", ",", "accuracy", ",", "range", ".", "getOffset", "(", ")", ",", "range", ".", "getLength", "(", ")", ",", "getParticipant", "(", ")", ",", "resource", ")", ";", "report", "(", "match", ")", ";", "}", "protected", "void", "reportMatching", "(", "AbstractMethodDeclaration", "method", ",", "TypeDeclaration", "type", ",", "IJavaElement", "parent", ",", "int", "accuracy", ",", "boolean", "typeInHierarchy", ",", "MatchingNodeSet", "nodeSet", ")", "throws", "CoreException", "{", "IJavaElement", "enclosingElement", "=", "null", ";", "if", "(", "accuracy", ">", "-", "1", ")", "{", "enclosingElement", "=", "createHandle", "(", "method", ",", "parent", ")", ";", "if", "(", "enclosingElement", "!=", "null", ")", "{", "Scanner", "scanner", "=", "this", ".", "parser", ".", "scanner", ";", "int", "nameSourceStart", "=", "method", ".", "sourceStart", ";", "scanner", ".", "setSource", "(", "this", ".", "currentPossibleMatch", ".", "getContents", "(", ")", ")", ";", "scanner", ".", "resetTo", "(", "nameSourceStart", ",", "method", ".", "sourceEnd", ")", ";", "try", "{", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "}", "if", "(", "encloses", "(", "enclosingElement", ")", ")", "{", "SearchMatch", "match", "=", "null", ";", "if", "(", "method", ".", "isDefaultConstructor", "(", ")", ")", "{", "int", "offset", "=", "type", ".", "sourceStart", ";", "match", "=", "this", ".", "patternLocator", ".", "newDeclarationMatch", "(", "type", ",", "parent", ",", "type", ".", "binding", ",", "accuracy", ",", "type", ".", "sourceEnd", "-", "offset", "+", "1", ",", "this", ")", ";", "}", "else", "{", "int", "length", "=", "scanner", ".", "currentPosition", "-", "nameSourceStart", ";", "match", "=", "this", ".", "patternLocator", ".", "newDeclarationMatch", "(", "method", ",", "enclosingElement", ",", "method", ".", "binding", ",", "accuracy", ",", "length", ",", "this", ")", ";", "}", "if", "(", "match", "!=", "null", ")", "{", "report", "(", "match", ")", ";", "}", "}", "}", "}", "if", "(", "(", "method", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ")", "{", "if", "(", "enclosingElement", "==", "null", ")", "{", "enclosingElement", "=", "createHandle", "(", "method", ",", "parent", ")", ";", "}", "ASTNode", "[", "]", "nodes", "=", "typeInHierarchy", "?", "nodeSet", ".", "matchingNodes", "(", "method", ".", "declarationSourceStart", ",", "method", ".", "declarationSourceEnd", ")", ":", "null", ";", "boolean", "report", "=", "(", "this", ".", "matchContainer", "&", "PatternLocator", ".", "METHOD_CONTAINER", ")", "!=", "0", "&&", "encloses", "(", "enclosingElement", ")", ";", "MemberDeclarationVisitor", "declarationVisitor", "=", "new", "MemberDeclarationVisitor", "(", "enclosingElement", ",", "report", "?", "nodes", ":", "null", ",", "nodeSet", ",", "this", ")", ";", "try", "{", "method", ".", "traverse", "(", "declarationVisitor", ",", "(", "ClassScope", ")", "null", ")", ";", "}", "catch", "(", "WrappedCoreException", "e", ")", "{", "throw", "e", ".", "coreException", ";", "}", "if", "(", "nodes", "!=", "null", ")", "{", "int", "length", "=", "nodes", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "i", "]", ")", ";", "if", "(", "report", "&&", "level", "!=", "null", ")", "{", "this", ".", "patternLocator", ".", "matchReportReference", "(", "nodes", "[", "i", "]", ",", "enclosingElement", ",", "declarationVisitor", ".", "getLocalElement", "(", "i", ")", ",", "declarationVisitor", ".", "getOtherElements", "(", "i", ")", ",", "method", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "TypeParameter", "[", "]", "typeParameters", "=", "method", ".", "typeParameters", "(", ")", ";", "if", "(", "typeParameters", "!=", "null", ")", "{", "if", "(", "enclosingElement", "==", "null", ")", "{", "enclosingElement", "=", "createHandle", "(", "method", ",", "parent", ")", ";", "}", "if", "(", "enclosingElement", "!=", "null", ")", "{", "reportMatching", "(", "typeParameters", ",", "enclosingElement", ",", "parent", ",", "method", ".", "binding", ",", "nodeSet", ")", ";", "}", "}", "if", "(", "method", ".", "annotations", "!=", "null", ")", "{", "if", "(", "enclosingElement", "==", "null", ")", "{", "enclosingElement", "=", "createHandle", "(", "method", ",", "parent", ")", ";", "}", "if", "(", "enclosingElement", "!=", "null", ")", "{", "reportMatching", "(", "method", ".", "annotations", ",", "enclosingElement", ",", "null", ",", "method", ".", "binding", ",", "nodeSet", ",", "true", ",", "true", ")", ";", "}", "}", "if", "(", "typeInHierarchy", ")", "{", "ASTNode", "[", "]", "nodes", "=", "nodeSet", ".", "matchingNodes", "(", "method", ".", "declarationSourceStart", ",", "method", ".", "declarationSourceEnd", ")", ";", "if", "(", "nodes", "!=", "null", ")", "{", "if", "(", "(", "this", ".", "matchContainer", "&", "PatternLocator", ".", "METHOD_CONTAINER", ")", "!=", "0", ")", "{", "if", "(", "enclosingElement", "==", "null", ")", "{", "enclosingElement", "=", "createHandle", "(", "method", ",", "parent", ")", ";", "}", "if", "(", "encloses", "(", "enclosingElement", ")", ")", "{", "if", "(", "this", ".", "pattern", ".", "mustResolve", ")", "{", "MemberDeclarationVisitor", "declarationVisitor", "=", "new", "MemberDeclarationVisitor", "(", "enclosingElement", ",", "nodes", ",", "nodeSet", ",", "this", ")", ";", "method", ".", "traverse", "(", "declarationVisitor", ",", "(", "ClassScope", ")", "null", ")", ";", "int", "length", "=", "nodes", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "i", "]", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "this", ".", "patternLocator", ".", "matchReportReference", "(", "nodes", "[", "i", "]", ",", "enclosingElement", ",", "declarationVisitor", ".", "getLocalElement", "(", "i", ")", ",", "declarationVisitor", ".", "getOtherElements", "(", "i", ")", ",", "method", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "nodes", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "this", ".", "patternLocator", ".", "matchReportReference", "(", "node", ",", "enclosingElement", ",", "null", ",", "null", ",", "method", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "return", ";", "}", "}", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "i", "]", ")", ";", "}", "}", "}", "}", "protected", "void", "reportMatching", "(", "Annotation", "[", "]", "annotations", ",", "IJavaElement", "enclosingElement", ",", "IJavaElement", "[", "]", "otherElements", ",", "Binding", "elementBinding", ",", "MatchingNodeSet", "nodeSet", ",", "boolean", "matchedContainer", ",", "boolean", "enclosesElement", ")", "throws", "CoreException", "{", "for", "(", "int", "i", "=", "0", ",", "al", "=", "annotations", ".", "length", ";", "i", "<", "al", ";", "i", "++", ")", "{", "Annotation", "annotationType", "=", "annotations", "[", "i", "]", ";", "IJavaElement", "localAnnotation", "=", "null", ";", "IJavaElement", "[", "]", "otherAnnotations", "=", "null", ";", "int", "length", "=", "otherElements", "==", "null", "?", "0", ":", "otherElements", ".", "length", ";", "boolean", "handlesCreated", "=", "false", ";", "TypeReference", "typeRef", "=", "annotationType", ".", "type", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "typeRef", ")", ";", "if", "(", "level", "!=", "null", "&&", "enclosesElement", "&&", "matchedContainer", ")", "{", "localAnnotation", "=", "createHandle", "(", "annotationType", ",", "(", "IAnnotatable", ")", "enclosingElement", ")", ";", "if", "(", "length", ">", "0", ")", "{", "otherAnnotations", "=", "new", "IJavaElement", "[", "length", "]", ";", "for", "(", "int", "o", "=", "0", ";", "o", "<", "length", ";", "o", "++", ")", "{", "otherAnnotations", "[", "o", "]", "=", "createHandle", "(", "annotationType", ",", "(", "IAnnotatable", ")", "otherElements", "[", "o", "]", ")", ";", "}", "}", "handlesCreated", "=", "true", ";", "this", ".", "patternLocator", ".", "matchReportReference", "(", "typeRef", ",", "enclosingElement", ",", "localAnnotation", ",", "otherAnnotations", ",", "elementBinding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "MemberValuePair", "[", "]", "pairs", "=", "annotationType", ".", "memberValuePairs", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "pl", "=", "pairs", ".", "length", ";", "j", "<", "pl", ";", "j", "++", ")", "{", "MemberValuePair", "pair", "=", "pairs", "[", "j", "]", ";", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "pair", ")", ";", "if", "(", "level", "!=", "null", "&&", "enclosesElement", ")", "{", "ASTNode", "reference", "=", "(", "annotationType", "instanceof", "SingleMemberAnnotation", ")", "?", "(", "ASTNode", ")", "annotationType", ":", "pair", ";", "if", "(", "!", "handlesCreated", ")", "{", "localAnnotation", "=", "createHandle", "(", "annotationType", ",", "(", "IAnnotatable", ")", "enclosingElement", ")", ";", "if", "(", "length", ">", "0", ")", "{", "otherAnnotations", "=", "new", "IJavaElement", "[", "length", "]", ";", "for", "(", "int", "o", "=", "0", ";", "o", "<", "length", ";", "o", "++", ")", "{", "otherAnnotations", "[", "o", "]", "=", "createHandle", "(", "annotationType", ",", "(", "IAnnotatable", ")", "otherElements", "[", "o", "]", ")", ";", "}", "}", "handlesCreated", "=", "true", ";", "}", "this", ".", "patternLocator", ".", "matchReportReference", "(", "reference", ",", "enclosingElement", ",", "localAnnotation", ",", "otherAnnotations", ",", "pair", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "ASTNode", "[", "]", "nodes", "=", "nodeSet", ".", "matchingNodes", "(", "annotationType", ".", "sourceStart", ",", "annotationType", ".", "declarationSourceEnd", ")", ";", "if", "(", "nodes", "!=", "null", ")", "{", "if", "(", "!", "matchedContainer", ")", "{", "for", "(", "int", "j", "=", "0", ",", "nl", "=", "nodes", ".", "length", ";", "j", "<", "nl", ";", "j", "++", ")", "{", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "j", "]", ")", ";", "}", "}", "else", "{", "for", "(", "int", "j", "=", "0", ",", "nl", "=", "nodes", ".", "length", ";", "j", "<", "nl", ";", "j", "++", ")", "{", "ASTNode", "node", "=", "nodes", "[", "j", "]", ";", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "if", "(", "enclosesElement", ")", "{", "if", "(", "!", "handlesCreated", ")", "{", "localAnnotation", "=", "createHandle", "(", "annotationType", ",", "(", "IAnnotatable", ")", "enclosingElement", ")", ";", "if", "(", "length", ">", "0", ")", "{", "otherAnnotations", "=", "new", "IJavaElement", "[", "length", "]", ";", "for", "(", "int", "o", "=", "0", ";", "o", "<", "length", ";", "o", "++", ")", "{", "otherAnnotations", "[", "o", "]", "=", "createHandle", "(", "annotationType", ",", "(", "IAnnotatable", ")", "otherElements", "[", "o", "]", ")", ";", "}", "}", "handlesCreated", "=", "true", ";", "}", "this", ".", "patternLocator", ".", "matchReportReference", "(", "node", ",", "enclosingElement", ",", "localAnnotation", ",", "otherAnnotations", ",", "elementBinding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "}", "}", "protected", "void", "reportMatching", "(", "CompilationUnitDeclaration", "unit", ",", "boolean", "mustResolve", ")", "throws", "CoreException", "{", "MatchingNodeSet", "nodeSet", "=", "this", ".", "currentPossibleMatch", ".", "nodeSet", ";", "boolean", "locatorMustResolve", "=", "this", ".", "patternLocator", ".", "mustResolve", ";", "if", "(", "nodeSet", ".", "mustResolve", ")", "this", ".", "patternLocator", ".", "mustResolve", "=", "true", ";", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "int", "size", "=", "nodeSet", ".", "matchingNodes", "==", "null", "?", "0", ":", "nodeSet", ".", "matchingNodes", ".", "elementSize", ";", "System", ".", "out", ".", "print", "(", "\"\"", "+", "size", ")", ";", "size", "=", "nodeSet", ".", "possibleMatchingNodesSet", "==", "null", "?", "0", ":", "nodeSet", ".", "possibleMatchingNodesSet", ".", "elementSize", ";", "System", ".", "out", ".", "println", "(", "\",", "possible=\"", "+", "size", ")", ";", "System", ".", "out", ".", "print", "(", "\"\"", "+", "mustResolve", ")", ";", "System", ".", "out", ".", "print", "(", "\"", "(locator:", "\"", "+", "this", ".", "patternLocator", ".", "mustResolve", ")", ";", "System", ".", "out", ".", "println", "(", "\",", "nodeSet:", "\"", "+", "nodeSet", ".", "mustResolve", "+", "')'", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "JavaSearchPattern", ".", "getFineGrainFlagString", "(", "this", ".", "patternLocator", ".", "fineGrain", "(", ")", ")", ")", ";", "}", "if", "(", "mustResolve", ")", "{", "this", ".", "unitScope", "=", "unit", ".", "scope", ".", "compilationUnitScope", "(", ")", ";", "Object", "[", "]", "nodes", "=", "nodeSet", ".", "possibleMatchingNodesSet", ".", "values", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "(", "ASTNode", ")", "nodes", "[", "i", "]", ";", "if", "(", "node", "==", "null", ")", "continue", ";", "if", "(", "node", "instanceof", "ImportReference", ")", "{", "if", "(", "this", ".", "hierarchyResolver", "!=", "null", ")", "continue", ";", "ImportReference", "importRef", "=", "(", "ImportReference", ")", "node", ";", "Binding", "binding", "=", "(", "importRef", ".", "bits", "&", "ASTNode", ".", "OnDemand", ")", "!=", "0", "?", "this", ".", "unitScope", ".", "getImport", "(", "CharOperation", ".", "subarray", "(", "importRef", ".", "tokens", ",", "0", ",", "importRef", ".", "tokens", ".", "length", ")", ",", "true", ",", "importRef", ".", "isStatic", "(", ")", ")", ":", "this", ".", "unitScope", ".", "getImport", "(", "importRef", ".", "tokens", ",", "false", ",", "importRef", ".", "isStatic", "(", ")", ")", ";", "this", ".", "patternLocator", ".", "matchLevelAndReportImportRef", "(", "importRef", ",", "binding", ",", "this", ")", ";", "}", "else", "{", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "patternLocator", ".", "resolveLevel", "(", "node", ")", ")", ";", "}", "}", "nodeSet", ".", "possibleMatchingNodesSet", "=", "new", "SimpleSet", "(", "3", ")", ";", "if", "(", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "int", "size", "=", "nodeSet", ".", "matchingNodes", "==", "null", "?", "0", ":", "nodeSet", ".", "matchingNodes", ".", "elementSize", ";", "System", ".", "out", ".", "print", "(", "\"\"", "+", "size", ")", ";", "size", "=", "nodeSet", ".", "possibleMatchingNodesSet", "==", "null", "?", "0", ":", "nodeSet", ".", "possibleMatchingNodesSet", ".", "elementSize", ";", "System", ".", "out", ".", "println", "(", "\",", "possible=\"", "+", "size", ")", ";", "}", "}", "else", "{", "this", ".", "unitScope", "=", "null", ";", "}", "if", "(", "nodeSet", ".", "matchingNodes", ".", "elementSize", "==", "0", ")", "return", ";", "this", ".", "methodHandles", "=", "new", "HashSet", "(", ")", ";", "boolean", "matchedUnitContainer", "=", "(", "this", ".", "matchContainer", "&", "PatternLocator", ".", "COMPILATION_UNIT_CONTAINER", ")", "!=", "0", ";", "if", "(", "unit", ".", "javadoc", "!=", "null", ")", "{", "ASTNode", "[", "]", "nodes", "=", "nodeSet", ".", "matchingNodes", "(", "unit", ".", "javadoc", ".", "sourceStart", ",", "unit", ".", "javadoc", ".", "sourceEnd", ")", ";", "if", "(", "nodes", "!=", "null", ")", "{", "if", "(", "!", "matchedUnitContainer", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "i", "]", ")", ";", "}", "else", "{", "IJavaElement", "element", "=", "createPackageDeclarationHandle", "(", "unit", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "nodes", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "if", "(", "encloses", "(", "element", ")", ")", "{", "this", ".", "patternLocator", ".", "matchReportReference", "(", "node", ",", "element", ",", "null", ",", "null", ",", "null", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "}", "if", "(", "matchedUnitContainer", ")", "{", "ImportReference", "pkg", "=", "unit", ".", "currentPackage", ";", "if", "(", "pkg", "!=", "null", "&&", "pkg", ".", "annotations", "!=", "null", ")", "{", "IJavaElement", "element", "=", "createPackageDeclarationHandle", "(", "unit", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "reportMatching", "(", "pkg", ".", "annotations", ",", "element", ",", "null", ",", "null", ",", "nodeSet", ",", "true", ",", "encloses", "(", "element", ")", ")", ";", "}", "}", "ImportReference", "[", "]", "imports", "=", "unit", ".", "imports", ";", "if", "(", "imports", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "imports", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ImportReference", "importRef", "=", "imports", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "importRef", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "this", ".", "patternLocator", ".", "matchReportImportRef", "(", "importRef", ",", "null", ",", "createImportHandle", "(", "importRef", ")", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "TypeDeclaration", "[", "]", "types", "=", "unit", ".", "types", ";", "if", "(", "types", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "types", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "nodeSet", ".", "matchingNodes", ".", "elementSize", "==", "0", ")", "return", ";", "TypeDeclaration", "type", "=", "types", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "type", ")", ";", "int", "accuracy", "=", "(", "level", "!=", "null", "&&", "matchedUnitContainer", ")", "?", "level", ".", "intValue", "(", ")", ":", "-", "1", ";", "reportMatching", "(", "type", ",", "null", ",", "accuracy", ",", "nodeSet", ",", "1", ")", ";", "}", "}", "this", ".", "methodHandles", "=", "null", ";", "this", ".", "bindings", ".", "removeKey", "(", "this", ".", "pattern", ")", ";", "this", ".", "patternLocator", ".", "mustResolve", "=", "locatorMustResolve", ";", "}", "protected", "void", "reportMatching", "(", "FieldDeclaration", "field", ",", "FieldDeclaration", "[", "]", "otherFields", ",", "TypeDeclaration", "type", ",", "IJavaElement", "parent", ",", "int", "accuracy", ",", "boolean", "typeInHierarchy", ",", "MatchingNodeSet", "nodeSet", ")", "throws", "CoreException", "{", "IJavaElement", "enclosingElement", "=", "null", ";", "if", "(", "accuracy", ">", "-", "1", ")", "{", "enclosingElement", "=", "createHandle", "(", "field", ",", "type", ",", "parent", ")", ";", "if", "(", "encloses", "(", "enclosingElement", ")", ")", "{", "int", "offset", "=", "field", ".", "sourceStart", ";", "SearchMatch", "match", "=", "newDeclarationMatch", "(", "enclosingElement", ",", "field", ".", "binding", ",", "accuracy", ",", "offset", ",", "field", ".", "sourceEnd", "-", "offset", "+", "1", ")", ";", "if", "(", "field", ".", "initialization", "instanceof", "AllocationExpression", ")", "{", "reportAccurateEnumConstructorReference", "(", "match", ",", "field", ",", "(", "AllocationExpression", ")", "field", ".", "initialization", ")", ";", "}", "else", "{", "report", "(", "match", ")", ";", "}", "}", "}", "if", "(", "(", "field", ".", "bits", "&", "ASTNode", ".", "HasLocalType", ")", "!=", "0", ")", "{", "if", "(", "enclosingElement", "==", "null", ")", "{", "enclosingElement", "=", "createHandle", "(", "field", ",", "type", ",", "parent", ")", ";", "}", "int", "fieldEnd", "=", "field", ".", "endPart2Position", "==", "0", "?", "field", ".", "declarationSourceEnd", ":", "field", ".", "endPart2Position", ";", "ASTNode", "[", "]", "nodes", "=", "typeInHierarchy", "?", "nodeSet", ".", "matchingNodes", "(", "field", ".", "sourceStart", ",", "fieldEnd", ")", ":", "null", ";", "boolean", "report", "=", "(", "this", ".", "matchContainer", "&", "PatternLocator", ".", "FIELD_CONTAINER", ")", "!=", "0", "&&", "encloses", "(", "enclosingElement", ")", ";", "MemberDeclarationVisitor", "declarationVisitor", "=", "new", "MemberDeclarationVisitor", "(", "enclosingElement", ",", "report", "?", "nodes", ":", "null", ",", "nodeSet", ",", "this", ")", ";", "try", "{", "field", ".", "traverse", "(", "declarationVisitor", ",", "(", "MethodScope", ")", "null", ")", ";", "}", "catch", "(", "WrappedCoreException", "e", ")", "{", "throw", "e", ".", "coreException", ";", "}", "if", "(", "nodes", "!=", "null", ")", "{", "int", "length", "=", "nodes", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "nodes", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "if", "(", "report", "&&", "level", "!=", "null", ")", "{", "if", "(", "node", "instanceof", "TypeDeclaration", ")", "{", "AllocationExpression", "allocation", "=", "(", "(", "TypeDeclaration", ")", "node", ")", ".", "allocation", ";", "if", "(", "allocation", "!=", "null", "&&", "allocation", ".", "enumConstant", "!=", "null", ")", "{", "node", "=", "field", ";", "}", "}", "this", ".", "patternLocator", ".", "matchReportReference", "(", "node", ",", "enclosingElement", ",", "declarationVisitor", ".", "getLocalElement", "(", "i", ")", ",", "declarationVisitor", ".", "getOtherElements", "(", "i", ")", ",", "field", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "IJavaElement", "[", "]", "otherElements", "=", "null", ";", "if", "(", "field", ".", "annotations", "!=", "null", ")", "{", "if", "(", "enclosingElement", "==", "null", ")", "{", "enclosingElement", "=", "createHandle", "(", "field", ",", "type", ",", "parent", ")", ";", "}", "if", "(", "otherFields", "!=", "null", ")", "{", "otherElements", "=", "createHandles", "(", "otherFields", ",", "type", ",", "parent", ")", ";", "}", "reportMatching", "(", "field", ".", "annotations", ",", "enclosingElement", ",", "otherElements", ",", "field", ".", "binding", ",", "nodeSet", ",", "true", ",", "true", ")", ";", "}", "if", "(", "typeInHierarchy", ")", "{", "if", "(", "field", ".", "endPart1Position", "!=", "0", ")", "{", "ASTNode", "[", "]", "nodes", "=", "nodeSet", ".", "matchingNodes", "(", "field", ".", "declarationSourceStart", ",", "field", ".", "endPart1Position", ")", ";", "if", "(", "nodes", "!=", "null", ")", "{", "if", "(", "(", "this", ".", "matchContainer", "&", "PatternLocator", ".", "FIELD_CONTAINER", ")", "==", "0", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "i", "]", ")", ";", "}", "else", "{", "if", "(", "enclosingElement", "==", "null", ")", "enclosingElement", "=", "createHandle", "(", "field", ",", "type", ",", "parent", ")", ";", "if", "(", "encloses", "(", "enclosingElement", ")", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "nodes", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "if", "(", "otherFields", "!=", "null", "&&", "otherElements", "==", "null", ")", "{", "otherElements", "=", "createHandles", "(", "otherFields", ",", "type", ",", "parent", ")", ";", "}", "this", ".", "patternLocator", ".", "matchReportReference", "(", "node", ",", "enclosingElement", ",", "null", ",", "otherElements", ",", "field", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "}", "int", "fieldEnd", "=", "field", ".", "endPart2Position", "==", "0", "?", "field", ".", "declarationSourceEnd", ":", "field", ".", "endPart2Position", ";", "ASTNode", "[", "]", "nodes", "=", "nodeSet", ".", "matchingNodes", "(", "field", ".", "sourceStart", ",", "fieldEnd", ")", ";", "if", "(", "nodes", "!=", "null", ")", "{", "if", "(", "(", "this", ".", "matchContainer", "&", "PatternLocator", ".", "FIELD_CONTAINER", ")", "==", "0", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "i", "]", ")", ";", "}", "}", "else", "{", "if", "(", "enclosingElement", "==", "null", ")", "{", "enclosingElement", "=", "createHandle", "(", "field", ",", "type", ",", "parent", ")", ";", "}", "if", "(", "encloses", "(", "enclosingElement", ")", ")", "{", "MemberDeclarationVisitor", "declarationVisitor", "=", "new", "MemberDeclarationVisitor", "(", "enclosingElement", ",", "nodes", ",", "nodeSet", ",", "this", ")", ";", "field", ".", "traverse", "(", "declarationVisitor", ",", "(", "MethodScope", ")", "null", ")", ";", "int", "length", "=", "nodes", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "nodes", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "if", "(", "node", "instanceof", "TypeDeclaration", ")", "{", "AllocationExpression", "allocation", "=", "(", "(", "TypeDeclaration", ")", "node", ")", ".", "allocation", ";", "if", "(", "allocation", "!=", "null", "&&", "allocation", ".", "enumConstant", "!=", "null", ")", "{", "node", "=", "field", ";", "}", "}", "this", ".", "patternLocator", ".", "matchReportReference", "(", "node", ",", "enclosingElement", ",", "declarationVisitor", ".", "getLocalElement", "(", "i", ")", ",", "declarationVisitor", ".", "getOtherElements", "(", "i", ")", ",", "field", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "return", ";", "}", "}", "}", "}", "}", "protected", "void", "reportMatching", "(", "TypeDeclaration", "type", ",", "IJavaElement", "parent", ",", "int", "accuracy", ",", "MatchingNodeSet", "nodeSet", ",", "int", "occurrenceCount", ")", "throws", "CoreException", "{", "IJavaElement", "enclosingElement", "=", "parent", ";", "if", "(", "enclosingElement", "==", "null", ")", "{", "enclosingElement", "=", "createTypeHandle", "(", "new", "String", "(", "type", ".", "name", ")", ")", ";", "}", "else", "if", "(", "enclosingElement", "instanceof", "IType", ")", "{", "enclosingElement", "=", "(", "(", "IType", ")", "parent", ")", ".", "getType", "(", "new", "String", "(", "type", ".", "name", ")", ")", ";", "}", "else", "if", "(", "enclosingElement", "instanceof", "IMember", ")", "{", "IMember", "member", "=", "(", "IMember", ")", "parent", ";", "if", "(", "member", ".", "isBinary", "(", ")", ")", "{", "enclosingElement", "=", "(", "(", "IClassFile", ")", "this", ".", "currentPossibleMatch", ".", "openable", ")", ".", "getType", "(", ")", ";", "}", "else", "{", "enclosingElement", "=", "member", ".", "getType", "(", "new", "String", "(", "type", ".", "name", ")", ",", "occurrenceCount", ")", ";", "}", "}", "if", "(", "enclosingElement", "==", "null", ")", "return", ";", "boolean", "enclosesElement", "=", "encloses", "(", "enclosingElement", ")", ";", "if", "(", "accuracy", ">", "-", "1", "&&", "enclosesElement", ")", "{", "int", "offset", "=", "type", ".", "sourceStart", ";", "SearchMatch", "match", "=", "this", ".", "patternLocator", ".", "newDeclarationMatch", "(", "type", ",", "enclosingElement", ",", "type", ".", "binding", ",", "accuracy", ",", "type", ".", "sourceEnd", "-", "offset", "+", "1", ",", "this", ")", ";", "report", "(", "match", ")", ";", "}", "boolean", "matchedClassContainer", "=", "(", "this", ".", "matchContainer", "&", "PatternLocator", ".", "CLASS_CONTAINER", ")", "!=", "0", ";", "if", "(", "type", ".", "typeParameters", "!=", "null", ")", "{", "reportMatching", "(", "type", ".", "typeParameters", ",", "enclosingElement", ",", "parent", ",", "type", ".", "binding", ",", "nodeSet", ")", ";", "}", "if", "(", "type", ".", "annotations", "!=", "null", ")", "{", "reportMatching", "(", "type", ".", "annotations", ",", "enclosingElement", ",", "null", ",", "type", ".", "binding", ",", "nodeSet", ",", "matchedClassContainer", ",", "enclosesElement", ")", ";", "}", "if", "(", "type", ".", "javadoc", "!=", "null", ")", "{", "ASTNode", "[", "]", "nodes", "=", "nodeSet", ".", "matchingNodes", "(", "type", ".", "declarationSourceStart", ",", "type", ".", "sourceStart", ")", ";", "if", "(", "nodes", "!=", "null", ")", "{", "if", "(", "!", "matchedClassContainer", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "i", "]", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "nodes", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "if", "(", "enclosesElement", ")", "{", "this", ".", "patternLocator", ".", "matchReportReference", "(", "node", ",", "enclosingElement", ",", "null", ",", "null", ",", "type", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "}", "if", "(", "(", "type", ".", "bits", "&", "ASTNode", ".", "IsAnonymousType", ")", "!=", "0", ")", "{", "TypeReference", "superType", "=", "type", ".", "allocation", ".", "type", ";", "if", "(", "superType", "!=", "null", ")", "{", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "superType", ")", ";", "if", "(", "level", "!=", "null", "&&", "matchedClassContainer", ")", "this", ".", "patternLocator", ".", "matchReportReference", "(", "superType", ",", "enclosingElement", ",", "null", ",", "null", ",", "type", ".", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "else", "{", "TypeReference", "superClass", "=", "type", ".", "superclass", ";", "if", "(", "superClass", "!=", "null", ")", "{", "reportMatchingSuper", "(", "superClass", ",", "enclosingElement", ",", "type", ".", "binding", ",", "nodeSet", ",", "matchedClassContainer", ")", ";", "}", "TypeReference", "[", "]", "superInterfaces", "=", "type", ".", "superInterfaces", ";", "if", "(", "superInterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "superInterfaces", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "reportMatchingSuper", "(", "superInterfaces", "[", "i", "]", ",", "enclosingElement", ",", "type", ".", "binding", ",", "nodeSet", ",", "matchedClassContainer", ")", ";", "}", "}", "}", "boolean", "typeInHierarchy", "=", "type", ".", "binding", "==", "null", "||", "typeInHierarchy", "(", "type", ".", "binding", ")", ";", "matchedClassContainer", "=", "matchedClassContainer", "&&", "typeInHierarchy", ";", "FieldDeclaration", "[", "]", "fields", "=", "type", ".", "fields", ";", "if", "(", "fields", "!=", "null", ")", "{", "if", "(", "nodeSet", ".", "matchingNodes", ".", "elementSize", "==", "0", ")", "return", ";", "FieldDeclaration", "[", "]", "otherFields", "=", "null", ";", "int", "first", "=", "-", "1", ";", "int", "length", "=", "fields", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "FieldDeclaration", "field", "=", "fields", "[", "i", "]", ";", "boolean", "last", "=", "field", ".", "endPart2Position", "==", "0", "||", "field", ".", "declarationEnd", "==", "field", ".", "endPart2Position", ";", "if", "(", "!", "last", ")", "{", "if", "(", "first", "==", "-", "1", ")", "{", "first", "=", "i", ";", "}", "}", "if", "(", "first", ">=", "0", ")", "{", "if", "(", "i", ">", "first", ")", "{", "if", "(", "otherFields", "==", "null", ")", "{", "otherFields", "=", "new", "FieldDeclaration", "[", "length", "-", "i", "]", ";", "}", "otherFields", "[", "i", "-", "1", "-", "first", "]", "=", "field", ";", "}", "if", "(", "last", ")", "{", "for", "(", "int", "j", "=", "first", ";", "j", "<=", "i", ";", "j", "++", ")", "{", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "fields", "[", "j", "]", ")", ";", "int", "value", "=", "(", "level", "!=", "null", "&&", "matchedClassContainer", ")", "?", "level", ".", "intValue", "(", ")", ":", "-", "1", ";", "reportMatching", "(", "fields", "[", "j", "]", ",", "otherFields", ",", "type", ",", "enclosingElement", ",", "value", ",", "typeInHierarchy", ",", "nodeSet", ")", ";", "}", "first", "=", "-", "1", ";", "otherFields", "=", "null", ";", "}", "}", "else", "{", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "field", ")", ";", "int", "value", "=", "(", "level", "!=", "null", "&&", "matchedClassContainer", ")", "?", "level", ".", "intValue", "(", ")", ":", "-", "1", ";", "reportMatching", "(", "field", ",", "null", ",", "type", ",", "enclosingElement", ",", "value", ",", "typeInHierarchy", ",", "nodeSet", ")", ";", "}", "}", "}", "AbstractMethodDeclaration", "[", "]", "methods", "=", "type", ".", "methods", ";", "if", "(", "methods", "!=", "null", ")", "{", "if", "(", "nodeSet", ".", "matchingNodes", ".", "elementSize", "==", "0", ")", "return", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "methods", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "AbstractMethodDeclaration", "method", "=", "methods", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "method", ")", ";", "int", "value", "=", "(", "level", "!=", "null", "&&", "matchedClassContainer", ")", "?", "level", ".", "intValue", "(", ")", ":", "-", "1", ";", "reportMatching", "(", "method", ",", "type", ",", "enclosingElement", ",", "value", ",", "typeInHierarchy", ",", "nodeSet", ")", ";", "}", "}", "TypeDeclaration", "[", "]", "memberTypes", "=", "type", ".", "memberTypes", ";", "if", "(", "memberTypes", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "memberTypes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "nodeSet", ".", "matchingNodes", ".", "elementSize", "==", "0", ")", "return", ";", "TypeDeclaration", "memberType", "=", "memberTypes", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "memberType", ")", ";", "int", "value", "=", "(", "level", "!=", "null", "&&", "matchedClassContainer", ")", "?", "level", ".", "intValue", "(", ")", ":", "-", "1", ";", "reportMatching", "(", "memberType", ",", "enclosingElement", ",", "value", ",", "nodeSet", ",", "1", ")", ";", "}", "}", "}", "protected", "void", "reportMatching", "(", "TypeParameter", "[", "]", "typeParameters", ",", "IJavaElement", "enclosingElement", ",", "IJavaElement", "parent", ",", "Binding", "binding", ",", "MatchingNodeSet", "nodeSet", ")", "throws", "CoreException", "{", "if", "(", "typeParameters", "==", "null", ")", "return", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "typeParameters", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "TypeParameter", "typeParameter", "=", "typeParameters", "[", "i", "]", ";", "if", "(", "typeParameter", "!=", "null", ")", "{", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "typeParameter", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "if", "(", "level", ".", "intValue", "(", ")", ">", "-", "1", "&&", "encloses", "(", "enclosingElement", ")", ")", "{", "int", "offset", "=", "typeParameter", ".", "sourceStart", ";", "SearchMatch", "match", "=", "this", ".", "patternLocator", ".", "newDeclarationMatch", "(", "typeParameter", ",", "enclosingElement", ",", "binding", ",", "level", ".", "intValue", "(", ")", ",", "typeParameter", ".", "sourceEnd", "-", "offset", "+", "1", ",", "this", ")", ";", "report", "(", "match", ")", ";", "}", "}", "if", "(", "typeParameter", ".", "type", "!=", "null", ")", "{", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "typeParameter", ".", "type", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "IJavaElement", "localElement", "=", "createHandle", "(", "typeParameter", ",", "enclosingElement", ")", ";", "this", ".", "patternLocator", ".", "matchReportReference", "(", "typeParameter", ".", "type", ",", "enclosingElement", ",", "localElement", ",", "null", ",", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "if", "(", "typeParameter", ".", "type", "instanceof", "ParameterizedSingleTypeReference", ")", "{", "ParameterizedSingleTypeReference", "paramSTR", "=", "(", "ParameterizedSingleTypeReference", ")", "typeParameter", ".", "type", ";", "if", "(", "paramSTR", ".", "typeArguments", "!=", "null", ")", "{", "int", "length", "=", "paramSTR", ".", "typeArguments", ".", "length", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "length", ";", "k", "++", ")", "{", "TypeReference", "typeArgument", "=", "paramSTR", ".", "typeArguments", "[", "k", "]", ";", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "typeArgument", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "IJavaElement", "localElement", "=", "createHandle", "(", "typeParameter", ",", "enclosingElement", ")", ";", "this", ".", "patternLocator", ".", "matchReportReference", "(", "typeArgument", ",", "enclosingElement", ",", "localElement", ",", "null", ",", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "if", "(", "typeArgument", "instanceof", "Wildcard", ")", "{", "TypeReference", "wildcardBound", "=", "(", "(", "Wildcard", ")", "typeArgument", ")", ".", "bound", ";", "if", "(", "wildcardBound", "!=", "null", ")", "{", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "wildcardBound", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "IJavaElement", "localElement", "=", "createHandle", "(", "typeParameter", ",", "enclosingElement", ")", ";", "this", ".", "patternLocator", ".", "matchReportReference", "(", "wildcardBound", ",", "enclosingElement", ",", "localElement", ",", "null", ",", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "}", "}", "}", "if", "(", "typeParameter", ".", "bounds", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ",", "b", "=", "typeParameter", ".", "bounds", ".", "length", ";", "j", "<", "b", ";", "j", "++", ")", "{", "TypeReference", "typeParameterBound", "=", "typeParameter", ".", "bounds", "[", "j", "]", ";", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "typeParameterBound", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "IJavaElement", "localElement", "=", "createHandle", "(", "typeParameter", ",", "enclosingElement", ")", ";", "this", ".", "patternLocator", ".", "matchReportReference", "(", "typeParameterBound", ",", "enclosingElement", ",", "localElement", ",", "null", ",", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "if", "(", "typeParameterBound", "instanceof", "ParameterizedSingleTypeReference", ")", "{", "ParameterizedSingleTypeReference", "paramSTR", "=", "(", "ParameterizedSingleTypeReference", ")", "typeParameterBound", ";", "if", "(", "paramSTR", ".", "typeArguments", "!=", "null", ")", "{", "int", "length", "=", "paramSTR", ".", "typeArguments", ".", "length", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "length", ";", "k", "++", ")", "{", "TypeReference", "typeArgument", "=", "paramSTR", ".", "typeArguments", "[", "k", "]", ";", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "typeArgument", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "IJavaElement", "localElement", "=", "createHandle", "(", "typeParameter", ",", "enclosingElement", ")", ";", "this", ".", "patternLocator", ".", "matchReportReference", "(", "typeArgument", ",", "enclosingElement", ",", "localElement", ",", "null", ",", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "if", "(", "typeArgument", "instanceof", "Wildcard", ")", "{", "TypeReference", "wildcardBound", "=", "(", "(", "Wildcard", ")", "typeArgument", ")", ".", "bound", ";", "if", "(", "wildcardBound", "!=", "null", ")", "{", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "wildcardBound", ")", ";", "if", "(", "level", "!=", "null", ")", "{", "IJavaElement", "localElement", "=", "createHandle", "(", "typeParameter", ",", "enclosingElement", ")", ";", "this", ".", "patternLocator", ".", "matchReportReference", "(", "wildcardBound", ",", "enclosingElement", ",", "localElement", ",", "null", ",", "binding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "}", "}", "}", "}", "}", "}", "}", "}", "protected", "void", "reportMatchingSuper", "(", "TypeReference", "superReference", ",", "IJavaElement", "enclosingElement", ",", "Binding", "elementBinding", ",", "MatchingNodeSet", "nodeSet", ",", "boolean", "matchedClassContainer", ")", "throws", "CoreException", "{", "ASTNode", "[", "]", "nodes", "=", "null", ";", "if", "(", "superReference", "instanceof", "ParameterizedSingleTypeReference", "||", "superReference", "instanceof", "ParameterizedQualifiedTypeReference", ")", "{", "long", "lastTypeArgumentInfo", "=", "findLastTypeArgumentInfo", "(", "superReference", ")", ";", "nodes", "=", "nodeSet", ".", "matchingNodes", "(", "superReference", ".", "sourceStart", ",", "(", "int", ")", "lastTypeArgumentInfo", ")", ";", "}", "if", "(", "nodes", "!=", "null", ")", "{", "if", "(", "(", "this", ".", "matchContainer", "&", "PatternLocator", ".", "CLASS_CONTAINER", ")", "==", "0", ")", "{", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "nodes", "[", "i", "]", ")", ";", "}", "else", "{", "if", "(", "encloses", "(", "enclosingElement", ")", ")", "for", "(", "int", "i", "=", "0", ",", "l", "=", "nodes", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ASTNode", "node", "=", "nodes", "[", "i", "]", ";", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "node", ")", ";", "this", ".", "patternLocator", ".", "matchReportReference", "(", "node", ",", "enclosingElement", ",", "null", ",", "null", ",", "elementBinding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "}", "else", "if", "(", "encloses", "(", "enclosingElement", ")", ")", "{", "Integer", "level", "=", "(", "Integer", ")", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "superReference", ")", ";", "if", "(", "level", "!=", "null", "&&", "matchedClassContainer", ")", "this", ".", "patternLocator", ".", "matchReportReference", "(", "superReference", ",", "enclosingElement", ",", "null", ",", "null", ",", "elementBinding", ",", "level", ".", "intValue", "(", ")", ",", "this", ")", ";", "}", "}", "protected", "boolean", "typeInHierarchy", "(", "ReferenceBinding", "binding", ")", "{", "if", "(", "this", ".", "hierarchyResolver", "==", "null", ")", "return", "true", ";", "if", "(", "this", ".", "hierarchyResolver", ".", "subOrSuperOfFocus", "(", "binding", ")", ")", "return", "true", ";", "if", "(", "this", ".", "allSuperTypeNames", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "binding", ".", "compoundName", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "allSuperTypeNames", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "if", "(", "CharOperation", ".", "equals", "(", "compoundName", ",", "this", ".", "allSuperTypeNames", "[", "i", "]", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
2,584
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "public", "class", "TypeReferenceLocator", "extends", "PatternLocator", "{", "protected", "TypeReferencePattern", "pattern", ";", "protected", "boolean", "isDeclarationOfReferencedTypesPattern", ";", "private", "final", "int", "fineGrain", ";", "public", "TypeReferenceLocator", "(", "TypeReferencePattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "this", ".", "fineGrain", "=", "pattern", "==", "null", "?", "0", ":", "pattern", ".", "fineGrain", ";", "this", ".", "isDeclarationOfReferencedTypesPattern", "=", "this", ".", "pattern", "instanceof", "DeclarationOfReferencedTypesPattern", ";", "}", "protected", "IJavaElement", "findElement", "(", "IJavaElement", "element", ",", "int", "accuracy", ")", "{", "if", "(", "accuracy", "!=", "SearchMatch", ".", "A_ACCURATE", ")", "return", "null", ";", "DeclarationOfReferencedTypesPattern", "declPattern", "=", "(", "DeclarationOfReferencedTypesPattern", ")", "this", ".", "pattern", ";", "while", "(", "element", "!=", "null", "&&", "!", "declPattern", ".", "enclosingElement", ".", "equals", "(", "element", ")", ")", "element", "=", "element", ".", "getParent", "(", ")", ";", "return", "element", ";", "}", "protected", "int", "fineGrain", "(", ")", "{", "return", "this", ".", "fineGrain", ";", "}", "public", "int", "match", "(", "Annotation", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "match", "(", "node", ".", "type", ",", "nodeSet", ")", ";", "}", "public", "int", "match", "(", "ASTNode", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "(", "node", "instanceof", "ImportReference", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "matchLevel", "(", "(", "ImportReference", ")", "node", ")", ")", ";", "}", "public", "int", "match", "(", "Reference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "!", "(", "node", "instanceof", "NameReference", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "this", ".", "pattern", ".", "simpleName", "==", "null", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "if", "(", "node", "instanceof", "SingleNameReference", ")", "{", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "simpleName", ",", "(", "(", "SingleNameReference", ")", "node", ")", ".", "token", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "POSSIBLE_MATCH", ")", ";", "}", "else", "{", "char", "[", "]", "[", "]", "tokens", "=", "(", "(", "QualifiedNameReference", ")", "node", ")", ".", "tokens", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "tokens", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "simpleName", ",", "tokens", "[", "i", "]", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "POSSIBLE_MATCH", ")", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "TypeReference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "this", ".", "pattern", ".", "simpleName", "==", "null", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "if", "(", "node", "instanceof", "SingleTypeReference", ")", "{", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "simpleName", ",", "(", "(", "SingleTypeReference", ")", "node", ")", ".", "token", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "}", "else", "{", "char", "[", "]", "[", "]", "tokens", "=", "(", "(", "QualifiedTypeReference", ")", "node", ")", ".", "tokens", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "tokens", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "simpleName", ",", "tokens", "[", "i", "]", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "POSSIBLE_MATCH", ")", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "matchLevel", "(", "ImportReference", "importRef", ")", "{", "if", "(", "this", ".", "pattern", ".", "qualification", "==", "null", ")", "{", "if", "(", "this", ".", "pattern", ".", "simpleName", "==", "null", ")", "return", "ACCURATE_MATCH", ";", "char", "[", "]", "[", "]", "tokens", "=", "importRef", ".", "tokens", ";", "boolean", "onDemand", "=", "(", "importRef", ".", "bits", "&", "ASTNode", ".", "OnDemand", ")", "!=", "0", ";", "final", "boolean", "isStatic", "=", "importRef", ".", "isStatic", "(", ")", ";", "if", "(", "!", "isStatic", "&&", "onDemand", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "int", "length", "=", "tokens", ".", "length", ";", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "simpleName", ",", "tokens", "[", "length", "-", "1", "]", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "if", "(", "isStatic", "&&", "!", "onDemand", "&&", "length", ">", "1", ")", "{", "if", "(", "matchesName", "(", "this", ".", "pattern", ".", "simpleName", ",", "tokens", "[", "length", "-", "2", "]", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "}", "}", "else", "{", "char", "[", "]", "[", "]", "tokens", "=", "importRef", ".", "tokens", ";", "char", "[", "]", "qualifiedPattern", "=", "this", ".", "pattern", ".", "simpleName", "==", "null", "?", "this", ".", "pattern", ".", "qualification", ":", "CharOperation", ".", "concat", "(", "this", ".", "pattern", ".", "qualification", ",", "this", ".", "pattern", ".", "simpleName", ",", "'.'", ")", ";", "char", "[", "]", "qualifiedTypeName", "=", "CharOperation", ".", "concatWith", "(", "tokens", ",", "'.'", ")", ";", "if", "(", "qualifiedPattern", "==", "null", ")", "return", "ACCURATE_MATCH", ";", "if", "(", "qualifiedTypeName", "==", "null", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "qualifiedTypeName", ".", "length", "==", "0", ")", "{", "if", "(", "qualifiedPattern", ".", "length", "==", "0", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "boolean", "matchFirstChar", "=", "!", "this", ".", "isCaseSensitive", "||", "(", "qualifiedPattern", "[", "0", "]", "==", "qualifiedTypeName", "[", "0", "]", ")", ";", "switch", "(", "this", ".", "matchMode", ")", "{", "case", "SearchPattern", ".", "R_EXACT_MATCH", ":", "case", "SearchPattern", ".", "R_PREFIX_MATCH", ":", "if", "(", "CharOperation", ".", "prefixEquals", "(", "qualifiedPattern", ",", "qualifiedTypeName", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "if", "(", "CharOperation", ".", "match", "(", "qualifiedPattern", ",", "qualifiedTypeName", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_REGEXP_MATCH", ":", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "if", "(", "matchFirstChar", "&&", "CharOperation", ".", "camelCaseMatch", "(", "qualifiedPattern", ",", "qualifiedTypeName", ",", "false", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "if", "(", "!", "this", ".", "isCaseSensitive", "&&", "CharOperation", ".", "prefixEquals", "(", "qualifiedPattern", ",", "qualifiedTypeName", ",", "false", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "if", "(", "matchFirstChar", "&&", "CharOperation", ".", "camelCaseMatch", "(", "qualifiedPattern", ",", "qualifiedTypeName", ",", "true", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "void", "matchLevelAndReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "Binding", "refBinding", "=", "binding", ";", "if", "(", "importRef", ".", "isStatic", "(", ")", ")", "{", "if", "(", "binding", "instanceof", "FieldBinding", ")", "{", "FieldBinding", "fieldBinding", "=", "(", "FieldBinding", ")", "binding", ";", "if", "(", "!", "fieldBinding", ".", "isStatic", "(", ")", ")", "return", ";", "refBinding", "=", "fieldBinding", ".", "declaringClass", ";", "}", "else", "if", "(", "binding", "instanceof", "MethodBinding", ")", "{", "MethodBinding", "methodBinding", "=", "(", "MethodBinding", ")", "binding", ";", "if", "(", "!", "methodBinding", ".", "isStatic", "(", ")", ")", "return", ";", "refBinding", "=", "methodBinding", ".", "declaringClass", ";", "}", "else", "if", "(", "binding", "instanceof", "MemberTypeBinding", ")", "{", "MemberTypeBinding", "memberBinding", "=", "(", "MemberTypeBinding", ")", "binding", ";", "if", "(", "!", "memberBinding", ".", "isStatic", "(", ")", ")", "return", ";", "}", "int", "level", "=", "resolveLevel", "(", "refBinding", ")", ";", "if", "(", "level", ">=", "INACCURATE_MATCH", ")", "{", "matchReportImportRef", "(", "importRef", ",", "binding", ",", "locator", ".", "createImportHandle", "(", "importRef", ")", ",", "level", "==", "ACCURATE_MATCH", "?", "SearchMatch", ".", "A_ACCURATE", ":", "SearchMatch", ".", "A_INACCURATE", ",", "locator", ")", ";", "}", "return", ";", "}", "super", ".", "matchLevelAndReportImportRef", "(", "importRef", ",", "refBinding", ",", "locator", ")", ";", "}", "protected", "void", "matchReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "IJavaElement", "element", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "isDeclarationOfReferencedTypesPattern", ")", "{", "if", "(", "(", "element", "=", "findElement", "(", "element", ",", "accuracy", ")", ")", "!=", "null", ")", "{", "SimpleSet", "knownTypes", "=", "(", "(", "DeclarationOfReferencedTypesPattern", ")", "this", ".", "pattern", ")", ".", "knownTypes", ";", "while", "(", "binding", "instanceof", "ReferenceBinding", ")", "{", "ReferenceBinding", "typeBinding", "=", "(", "ReferenceBinding", ")", "binding", ";", "reportDeclaration", "(", "typeBinding", ",", "1", ",", "locator", ",", "knownTypes", ")", ";", "binding", "=", "typeBinding", ".", "enclosingType", "(", ")", ";", "}", "}", "return", ";", "}", "if", "(", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", "&&", "!", "this", ".", "isEquivalentMatch", "&&", "!", "this", ".", "isErasureMatch", ")", "{", "return", ";", "}", "if", "(", "(", "this", ".", "pattern", ".", "fineGrain", "!=", "0", "&&", "(", "this", ".", "pattern", ".", "fineGrain", "&", "IJavaSearchConstants", ".", "IMPORT_DECLARATION_TYPE_REFERENCE", ")", "==", "0", ")", ")", "{", "return", ";", "}", "this", ".", "match", "=", "locator", ".", "newTypeReferenceMatch", "(", "element", ",", "binding", ",", "accuracy", ",", "importRef", ")", ";", "this", ".", "match", ".", "setRaw", "(", "true", ")", ";", "if", "(", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "this", ".", "match", ".", "getRule", "(", ")", "&", "(", "~", "SearchPattern", ".", "R_FULL_MATCH", ")", ")", ";", "}", "TypeBinding", "typeBinding", "=", "null", ";", "boolean", "lastButOne", "=", "false", ";", "if", "(", "binding", "instanceof", "ReferenceBinding", ")", "{", "typeBinding", "=", "(", "ReferenceBinding", ")", "binding", ";", "}", "else", "if", "(", "binding", "instanceof", "FieldBinding", ")", "{", "typeBinding", "=", "(", "(", "FieldBinding", ")", "binding", ")", ".", "declaringClass", ";", "lastButOne", "=", "importRef", ".", "isStatic", "(", ")", "&&", "(", "(", "importRef", ".", "bits", "&", "ASTNode", ".", "OnDemand", ")", "==", "0", ")", ";", "}", "else", "if", "(", "binding", "instanceof", "MethodBinding", ")", "{", "typeBinding", "=", "(", "(", "MethodBinding", ")", "binding", ")", ".", "declaringClass", ";", "lastButOne", "=", "importRef", ".", "isStatic", "(", ")", "&&", "(", "(", "importRef", ".", "bits", "&", "ASTNode", ".", "OnDemand", ")", "==", "0", ")", ";", "}", "if", "(", "typeBinding", "!=", "null", ")", "{", "int", "lastIndex", "=", "importRef", ".", "tokens", ".", "length", "-", "1", ";", "if", "(", "lastButOne", ")", "{", "lastIndex", "--", ";", "}", "if", "(", "typeBinding", "instanceof", "ProblemReferenceBinding", ")", "{", "ProblemReferenceBinding", "pbBinding", "=", "(", "ProblemReferenceBinding", ")", "typeBinding", ";", "typeBinding", "=", "pbBinding", ".", "closestMatch", "(", ")", ";", "lastIndex", "=", "pbBinding", ".", "compoundName", ".", "length", "-", "1", ";", "}", "while", "(", "typeBinding", "!=", "null", "&&", "lastIndex", ">=", "0", ")", "{", "if", "(", "resolveLevelForType", "(", "typeBinding", ")", "!=", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "locator", ".", "encloses", "(", "element", ")", ")", "{", "long", "[", "]", "positions", "=", "importRef", ".", "sourcePositions", ";", "int", "index", "=", "lastIndex", ";", "if", "(", "this", ".", "pattern", ".", "qualification", "!=", "null", ")", "{", "index", "=", "lastIndex", "-", "this", ".", "pattern", ".", "segmentsSize", ";", "}", "if", "(", "index", "<", "0", ")", "index", "=", "0", ";", "int", "start", "=", "(", "int", ")", "(", "(", "positions", "[", "index", "]", ")", ">>>", "32", ")", ";", "int", "end", "=", "(", "int", ")", "positions", "[", "lastIndex", "]", ";", "this", ".", "match", ".", "setOffset", "(", "start", ")", ";", "this", ".", "match", ".", "setLength", "(", "end", "-", "start", "+", "1", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "return", ";", "}", "lastIndex", "--", ";", "typeBinding", "=", "typeBinding", ".", "enclosingType", "(", ")", ";", "}", "}", "locator", ".", "reportAccurateTypeReference", "(", "this", ".", "match", ",", "importRef", ",", "this", ".", "pattern", ".", "simpleName", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ArrayTypeReference", "arrayRef", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "pattern", ".", "simpleName", "==", "null", ")", "{", "if", "(", "locator", ".", "encloses", "(", "element", ")", ")", "{", "int", "offset", "=", "arrayRef", ".", "sourceStart", ";", "int", "length", "=", "arrayRef", ".", "sourceEnd", "-", "offset", "+", "1", ";", "if", "(", "this", ".", "match", "==", "null", ")", "{", "this", ".", "match", "=", "locator", ".", "newTypeReferenceMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "offset", ",", "length", ",", "arrayRef", ")", ";", "}", "else", "{", "this", ".", "match", ".", "setOffset", "(", "offset", ")", ";", "this", ".", "match", ".", "setLength", "(", "length", ")", ";", "}", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "return", ";", "}", "}", "this", ".", "match", "=", "locator", ".", "newTypeReferenceMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "arrayRef", ")", ";", "if", "(", "arrayRef", ".", "resolvedType", "!=", "null", ")", "{", "matchReportReference", "(", "arrayRef", ",", "-", "1", ",", "arrayRef", ".", "resolvedType", ".", "leafComponentType", "(", ")", ",", "locator", ")", ";", "return", ";", "}", "locator", ".", "reportAccurateTypeReference", "(", "this", ".", "match", ",", "arrayRef", ",", "this", ".", "pattern", ".", "simpleName", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "matchReportReference", "(", "reference", ",", "element", ",", "null", ",", "null", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "IJavaElement", "localElement", ",", "IJavaElement", "[", "]", "otherElements", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "isDeclarationOfReferencedTypesPattern", ")", "{", "if", "(", "(", "element", "=", "findElement", "(", "element", ",", "accuracy", ")", ")", "!=", "null", ")", "reportDeclaration", "(", "reference", ",", "element", ",", "locator", ",", "(", "(", "DeclarationOfReferencedTypesPattern", ")", "this", ".", "pattern", ")", ".", "knownTypes", ")", ";", "return", ";", "}", "TypeReferenceMatch", "refMatch", "=", "locator", ".", "newTypeReferenceMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "reference", ")", ";", "refMatch", ".", "setLocalElement", "(", "localElement", ")", ";", "refMatch", ".", "setOtherElements", "(", "otherElements", ")", ";", "this", ".", "match", "=", "refMatch", ";", "if", "(", "reference", "instanceof", "QualifiedNameReference", ")", "matchReportReference", "(", "(", "QualifiedNameReference", ")", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "else", "if", "(", "reference", "instanceof", "QualifiedTypeReference", ")", "matchReportReference", "(", "(", "QualifiedTypeReference", ")", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "else", "if", "(", "reference", "instanceof", "ArrayTypeReference", ")", "matchReportReference", "(", "(", "ArrayTypeReference", ")", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "else", "{", "TypeBinding", "typeBinding", "=", "reference", "instanceof", "Expression", "?", "(", "(", "Expression", ")", "reference", ")", ".", "resolvedType", ":", "null", ";", "if", "(", "typeBinding", "!=", "null", ")", "{", "matchReportReference", "(", "(", "Expression", ")", "reference", ",", "-", "1", ",", "typeBinding", ",", "locator", ")", ";", "return", ";", "}", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "protected", "void", "matchReportReference", "(", "QualifiedNameReference", "qNameRef", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "Binding", "binding", "=", "qNameRef", ".", "binding", ";", "TypeBinding", "typeBinding", "=", "null", ";", "int", "lastIndex", "=", "qNameRef", ".", "tokens", ".", "length", "-", "1", ";", "switch", "(", "qNameRef", ".", "bits", "&", "ASTNode", ".", "RestrictiveFlagMASK", ")", "{", "case", "Binding", ".", "FIELD", ":", "typeBinding", "=", "qNameRef", ".", "actualReceiverType", ";", "lastIndex", "-=", "qNameRef", ".", "otherBindings", "==", "null", "?", "1", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "1", ";", "break", ";", "case", "Binding", ".", "TYPE", ":", "if", "(", "binding", "instanceof", "TypeBinding", ")", "typeBinding", "=", "(", "TypeBinding", ")", "binding", ";", "break", ";", "case", "Binding", ".", "VARIABLE", ":", "case", "Binding", ".", "TYPE", "|", "Binding", ".", "VARIABLE", ":", "if", "(", "binding", "instanceof", "ProblemReferenceBinding", ")", "{", "typeBinding", "=", "(", "TypeBinding", ")", "binding", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemFieldBinding", ")", "{", "typeBinding", "=", "qNameRef", ".", "actualReceiverType", ";", "lastIndex", "-=", "qNameRef", ".", "otherBindings", "==", "null", "?", "1", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "1", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemBinding", ")", "{", "typeBinding", "=", "(", "(", "ProblemBinding", ")", "binding", ")", ".", "searchType", ";", "}", "break", ";", "}", "if", "(", "typeBinding", "instanceof", "ProblemReferenceBinding", ")", "{", "ProblemReferenceBinding", "pbBinding", "=", "(", "ProblemReferenceBinding", ")", "typeBinding", ";", "typeBinding", "=", "pbBinding", ".", "closestMatch", "(", ")", ";", "lastIndex", "=", "pbBinding", ".", "compoundName", ".", "length", "-", "1", ";", "}", "if", "(", "this", ".", "match", "==", "null", ")", "{", "this", ".", "match", "=", "locator", ".", "newTypeReferenceMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "qNameRef", ")", ";", "}", "if", "(", "typeBinding", "instanceof", "ReferenceBinding", ")", "{", "ReferenceBinding", "refBinding", "=", "(", "ReferenceBinding", ")", "typeBinding", ";", "while", "(", "refBinding", "!=", "null", "&&", "lastIndex", ">=", "0", ")", "{", "if", "(", "resolveLevelForType", "(", "refBinding", ")", "==", "ACCURATE_MATCH", ")", "{", "if", "(", "locator", ".", "encloses", "(", "element", ")", ")", "{", "long", "[", "]", "positions", "=", "qNameRef", ".", "sourcePositions", ";", "int", "index", "=", "lastIndex", ";", "if", "(", "this", ".", "pattern", ".", "qualification", "!=", "null", ")", "{", "index", "=", "lastIndex", "-", "this", ".", "pattern", ".", "segmentsSize", ";", "}", "if", "(", "index", "<", "0", ")", "index", "=", "0", ";", "int", "start", "=", "(", "int", ")", "(", "(", "positions", "[", "index", "]", ")", ">>>", "32", ")", ";", "int", "end", "=", "(", "int", ")", "positions", "[", "lastIndex", "]", ";", "this", ".", "match", ".", "setOffset", "(", "start", ")", ";", "this", ".", "match", ".", "setLength", "(", "end", "-", "start", "+", "1", ")", ";", "matchReportReference", "(", "qNameRef", ",", "lastIndex", ",", "refBinding", ",", "locator", ")", ";", "}", "return", ";", "}", "lastIndex", "--", ";", "refBinding", "=", "refBinding", ".", "enclosingType", "(", ")", ";", "}", "}", "locator", ".", "reportAccurateTypeReference", "(", "this", ".", "match", ",", "qNameRef", ",", "this", ".", "pattern", ".", "simpleName", ")", ";", "}", "protected", "void", "matchReportReference", "(", "QualifiedTypeReference", "qTypeRef", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "TypeBinding", "typeBinding", "=", "qTypeRef", ".", "resolvedType", ";", "int", "lastIndex", "=", "qTypeRef", ".", "tokens", ".", "length", "-", "1", ";", "if", "(", "typeBinding", "instanceof", "ArrayBinding", ")", "typeBinding", "=", "(", "(", "ArrayBinding", ")", "typeBinding", ")", ".", "leafComponentType", ";", "if", "(", "typeBinding", "instanceof", "ProblemReferenceBinding", ")", "{", "ProblemReferenceBinding", "pbBinding", "=", "(", "ProblemReferenceBinding", ")", "typeBinding", ";", "typeBinding", "=", "pbBinding", ".", "closestMatch", "(", ")", ";", "lastIndex", "=", "pbBinding", ".", "compoundName", ".", "length", "-", "1", ";", "}", "if", "(", "this", ".", "match", "==", "null", ")", "{", "this", ".", "match", "=", "locator", ".", "newTypeReferenceMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "qTypeRef", ")", ";", "}", "if", "(", "typeBinding", "instanceof", "ReferenceBinding", ")", "{", "ReferenceBinding", "refBinding", "=", "(", "ReferenceBinding", ")", "typeBinding", ";", "while", "(", "refBinding", "!=", "null", "&&", "lastIndex", ">=", "0", ")", "{", "if", "(", "resolveLevelForType", "(", "refBinding", ")", "!=", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "locator", ".", "encloses", "(", "element", ")", ")", "{", "long", "[", "]", "positions", "=", "qTypeRef", ".", "sourcePositions", ";", "int", "index", "=", "lastIndex", ";", "if", "(", "this", ".", "pattern", ".", "qualification", "!=", "null", ")", "{", "index", "=", "lastIndex", "-", "this", ".", "pattern", ".", "segmentsSize", ";", "}", "if", "(", "index", "<", "0", ")", "index", "=", "0", ";", "int", "start", "=", "(", "int", ")", "(", "(", "positions", "[", "index", "]", ")", ">>>", "32", ")", ";", "int", "end", "=", "(", "int", ")", "positions", "[", "lastIndex", "]", ";", "this", ".", "match", ".", "setOffset", "(", "start", ")", ";", "this", ".", "match", ".", "setLength", "(", "end", "-", "start", "+", "1", ")", ";", "matchReportReference", "(", "qTypeRef", ",", "lastIndex", ",", "refBinding", ",", "locator", ")", ";", "}", "return", ";", "}", "lastIndex", "--", ";", "refBinding", "=", "refBinding", ".", "enclosingType", "(", ")", ";", "}", "}", "locator", ".", "reportAccurateTypeReference", "(", "this", ".", "match", ",", "qTypeRef", ",", "this", ".", "pattern", ".", "simpleName", ")", ";", "}", "void", "matchReportReference", "(", "Expression", "expr", ",", "int", "lastIndex", ",", "TypeBinding", "refBinding", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "refBinding", ".", "isParameterizedType", "(", ")", "||", "refBinding", ".", "isRawType", "(", ")", ")", "{", "ParameterizedTypeBinding", "parameterizedBinding", "=", "(", "ParameterizedTypeBinding", ")", "refBinding", ";", "updateMatch", "(", "parameterizedBinding", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "this", ".", "pattern", ".", "hasTypeParameters", "(", ")", ",", "0", ",", "locator", ")", ";", "if", "(", "this", ".", "match", ".", "getRule", "(", ")", "==", "0", ")", "return", ";", "boolean", "report", "=", "(", "this", ".", "isErasureMatch", "&&", "this", ".", "match", ".", "isErasure", "(", ")", ")", "||", "(", "this", ".", "isEquivalentMatch", "&&", "this", ".", "match", ".", "isEquivalent", "(", ")", ")", "||", "this", ".", "match", ".", "isExact", "(", ")", ";", "if", "(", "!", "report", ")", "return", ";", "if", "(", "refBinding", ".", "isParameterizedType", "(", ")", "&&", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "TypeReference", "typeRef", "=", "null", ";", "TypeReference", "[", "]", "typeArguments", "=", "null", ";", "if", "(", "expr", "instanceof", "ParameterizedQualifiedTypeReference", ")", "{", "typeRef", "=", "(", "ParameterizedQualifiedTypeReference", ")", "expr", ";", "typeArguments", "=", "(", "(", "ParameterizedQualifiedTypeReference", ")", "expr", ")", ".", "typeArguments", "[", "lastIndex", "]", ";", "}", "else", "if", "(", "expr", "instanceof", "ParameterizedSingleTypeReference", ")", "{", "typeRef", "=", "(", "ParameterizedSingleTypeReference", ")", "expr", ";", "typeArguments", "=", "(", "(", "ParameterizedSingleTypeReference", ")", "expr", ")", ".", "typeArguments", ";", "}", "if", "(", "typeRef", "!=", "null", ")", "{", "locator", ".", "reportAccurateParameterizedTypeReference", "(", "this", ".", "match", ",", "typeRef", ",", "lastIndex", ",", "typeArguments", ")", ";", "return", ";", "}", "}", "}", "else", "if", "(", "this", ".", "pattern", ".", "hasTypeArguments", "(", ")", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "}", "if", "(", "expr", "instanceof", "ArrayTypeReference", ")", "{", "locator", ".", "reportAccurateTypeReference", "(", "this", ".", "match", ",", "expr", ",", "this", ".", "pattern", ".", "simpleName", ")", ";", "return", ";", "}", "if", "(", "refBinding", ".", "isLocalType", "(", ")", ")", "{", "LocalTypeBinding", "local", "=", "(", "LocalTypeBinding", ")", "refBinding", ".", "erasure", "(", ")", ";", "IJavaElement", "focus", "=", "this", ".", "pattern", ".", "focus", ";", "if", "(", "focus", "!=", "null", "&&", "local", ".", "enclosingMethod", "!=", "null", "&&", "focus", ".", "getParent", "(", ")", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "METHOD", ")", "{", "IMethod", "method", "=", "(", "IMethod", ")", "focus", ".", "getParent", "(", ")", ";", "if", "(", "!", "CharOperation", ".", "equals", "(", "local", ".", "enclosingMethod", ".", "selector", ",", "method", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ")", ")", "{", "return", ";", "}", "}", "}", "if", "(", "this", ".", "pattern", ".", "simpleName", "==", "null", ")", "{", "this", ".", "match", ".", "setOffset", "(", "expr", ".", "sourceStart", ")", ";", "this", ".", "match", ".", "setLength", "(", "expr", ".", "sourceEnd", "-", "expr", ".", "sourceStart", "+", "1", ")", ";", "}", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "IJavaElement", ".", "TYPE", ";", "}", "protected", "void", "reportDeclaration", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "MatchLocator", "locator", ",", "SimpleSet", "knownTypes", ")", "throws", "CoreException", "{", "int", "maxType", "=", "-", "1", ";", "TypeBinding", "typeBinding", "=", "null", ";", "if", "(", "reference", "instanceof", "TypeReference", ")", "{", "typeBinding", "=", "(", "(", "TypeReference", ")", "reference", ")", ".", "resolvedType", ";", "maxType", "=", "Integer", ".", "MAX_VALUE", ";", "}", "else", "if", "(", "reference", "instanceof", "QualifiedNameReference", ")", "{", "QualifiedNameReference", "qNameRef", "=", "(", "QualifiedNameReference", ")", "reference", ";", "Binding", "binding", "=", "qNameRef", ".", "binding", ";", "maxType", "=", "qNameRef", ".", "tokens", ".", "length", "-", "1", ";", "switch", "(", "qNameRef", ".", "bits", "&", "ASTNode", ".", "RestrictiveFlagMASK", ")", "{", "case", "Binding", ".", "FIELD", ":", "typeBinding", "=", "qNameRef", ".", "actualReceiverType", ";", "maxType", "-=", "qNameRef", ".", "otherBindings", "==", "null", "?", "1", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "1", ";", "break", ";", "case", "Binding", ".", "TYPE", ":", "if", "(", "binding", "instanceof", "TypeBinding", ")", "typeBinding", "=", "(", "TypeBinding", ")", "binding", ";", "break", ";", "case", "Binding", ".", "VARIABLE", ":", "case", "Binding", ".", "TYPE", "|", "Binding", ".", "VARIABLE", ":", "if", "(", "binding", "instanceof", "ProblemFieldBinding", ")", "{", "typeBinding", "=", "qNameRef", ".", "actualReceiverType", ";", "maxType", "-=", "qNameRef", ".", "otherBindings", "==", "null", "?", "1", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "1", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemBinding", ")", "{", "ProblemBinding", "pbBinding", "=", "(", "ProblemBinding", ")", "binding", ";", "typeBinding", "=", "pbBinding", ".", "searchType", ";", "char", "[", "]", "partialQualifiedName", "=", "pbBinding", ".", "name", ";", "maxType", "=", "CharOperation", ".", "occurencesOf", "(", "'.'", ",", "partialQualifiedName", ")", "-", "1", ";", "if", "(", "typeBinding", "==", "null", "||", "maxType", "<", "0", ")", "return", ";", "}", "break", ";", "}", "}", "else", "if", "(", "reference", "instanceof", "SingleNameReference", ")", "{", "typeBinding", "=", "(", "TypeBinding", ")", "(", "(", "SingleNameReference", ")", "reference", ")", ".", "binding", ";", "maxType", "=", "1", ";", "}", "if", "(", "typeBinding", "instanceof", "ArrayBinding", ")", "typeBinding", "=", "(", "(", "ArrayBinding", ")", "typeBinding", ")", ".", "leafComponentType", ";", "if", "(", "typeBinding", "==", "null", "||", "typeBinding", "instanceof", "BaseTypeBinding", ")", "return", ";", "if", "(", "typeBinding", "instanceof", "ProblemReferenceBinding", ")", "{", "TypeBinding", "original", "=", "typeBinding", ".", "closestMatch", "(", ")", ";", "if", "(", "original", "==", "null", ")", "return", ";", "typeBinding", "=", "original", ";", "}", "typeBinding", "=", "typeBinding", ".", "erasure", "(", ")", ";", "reportDeclaration", "(", "(", "ReferenceBinding", ")", "typeBinding", ",", "maxType", ",", "locator", ",", "knownTypes", ")", ";", "}", "protected", "void", "reportDeclaration", "(", "ReferenceBinding", "typeBinding", ",", "int", "maxType", ",", "MatchLocator", "locator", ",", "SimpleSet", "knownTypes", ")", "throws", "CoreException", "{", "IType", "type", "=", "locator", ".", "lookupType", "(", "typeBinding", ")", ";", "if", "(", "type", "==", "null", ")", "return", ";", "IResource", "resource", "=", "type", ".", "getResource", "(", ")", ";", "boolean", "isBinary", "=", "type", ".", "isBinary", "(", ")", ";", "IBinaryType", "info", "=", "null", ";", "if", "(", "isBinary", ")", "{", "if", "(", "resource", "==", "null", ")", "resource", "=", "type", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ";", "info", "=", "locator", ".", "getBinaryInfo", "(", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ClassFile", ")", "type", ".", "getClassFile", "(", ")", ",", "resource", ")", ";", "}", "while", "(", "maxType", ">=", "0", "&&", "type", "!=", "null", ")", "{", "if", "(", "!", "knownTypes", ".", "includes", "(", "type", ")", ")", "{", "if", "(", "isBinary", ")", "{", "locator", ".", "reportBinaryMemberDeclaration", "(", "resource", ",", "type", ",", "typeBinding", ",", "info", ",", "SearchMatch", ".", "A_ACCURATE", ")", ";", "}", "else", "{", "if", "(", "typeBinding", "instanceof", "ParameterizedTypeBinding", ")", "typeBinding", "=", "(", "(", "ParameterizedTypeBinding", ")", "typeBinding", ")", ".", "genericType", "(", ")", ";", "ClassScope", "scope", "=", "(", "(", "SourceTypeBinding", ")", "typeBinding", ")", ".", "scope", ";", "if", "(", "scope", "!=", "null", ")", "{", "TypeDeclaration", "typeDecl", "=", "scope", ".", "referenceContext", ";", "int", "offset", "=", "typeDecl", ".", "sourceStart", ";", "this", ".", "match", "=", "new", "TypeDeclarationMatch", "(", "(", "(", "JavaElement", ")", "type", ")", ".", "resolved", "(", "typeBinding", ")", ",", "SearchMatch", ".", "A_ACCURATE", ",", "offset", ",", "typeDecl", ".", "sourceEnd", "-", "offset", "+", "1", ",", "locator", ".", "getParticipant", "(", ")", ",", "resource", ")", ";", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "knownTypes", ".", "add", "(", "type", ")", ";", "}", "typeBinding", "=", "typeBinding", ".", "enclosingType", "(", ")", ";", "IJavaElement", "parent", "=", "type", ".", "getParent", "(", ")", ";", "if", "(", "parent", "instanceof", "IType", ")", "{", "type", "=", "(", "IType", ")", "parent", ";", "}", "else", "{", "type", "=", "null", ";", "}", "maxType", "--", ";", "}", "}", "public", "int", "resolveLevel", "(", "ASTNode", "node", ")", "{", "if", "(", "node", "instanceof", "TypeReference", ")", "return", "resolveLevel", "(", "(", "TypeReference", ")", "node", ")", ";", "if", "(", "node", "instanceof", "NameReference", ")", "return", "resolveLevel", "(", "(", "NameReference", ")", "node", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "!", "(", "binding", "instanceof", "TypeBinding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "TypeBinding", "typeBinding", "=", "(", "TypeBinding", ")", "binding", ";", "if", "(", "typeBinding", "instanceof", "ArrayBinding", ")", "typeBinding", "=", "(", "(", "ArrayBinding", ")", "typeBinding", ")", ".", "leafComponentType", ";", "if", "(", "typeBinding", "instanceof", "ProblemReferenceBinding", ")", "typeBinding", "=", "(", "(", "ProblemReferenceBinding", ")", "typeBinding", ")", ".", "closestMatch", "(", ")", ";", "return", "resolveLevelForTypeOrEnclosingTypes", "(", "this", ".", "pattern", ".", "simpleName", ",", "this", ".", "pattern", ".", "qualification", ",", "typeBinding", ")", ";", "}", "protected", "int", "resolveLevel", "(", "NameReference", "nameRef", ")", "{", "Binding", "binding", "=", "nameRef", ".", "binding", ";", "if", "(", "nameRef", "instanceof", "SingleNameReference", ")", "{", "if", "(", "binding", "instanceof", "ProblemReferenceBinding", ")", "binding", "=", "(", "(", "ProblemReferenceBinding", ")", "binding", ")", ".", "closestMatch", "(", ")", ";", "if", "(", "binding", "instanceof", "ReferenceBinding", ")", "return", "resolveLevelForType", "(", "(", "ReferenceBinding", ")", "binding", ")", ";", "return", "binding", "==", "null", "||", "binding", "instanceof", "ProblemBinding", "?", "INACCURATE_MATCH", ":", "IMPOSSIBLE_MATCH", ";", "}", "TypeBinding", "typeBinding", "=", "null", ";", "QualifiedNameReference", "qNameRef", "=", "(", "QualifiedNameReference", ")", "nameRef", ";", "switch", "(", "qNameRef", ".", "bits", "&", "ASTNode", ".", "RestrictiveFlagMASK", ")", "{", "case", "Binding", ".", "FIELD", ":", "if", "(", "qNameRef", ".", "tokens", ".", "length", "<", "(", "qNameRef", ".", "otherBindings", "==", "null", "?", "2", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "2", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "typeBinding", "=", "nameRef", ".", "actualReceiverType", ";", "break", ";", "case", "Binding", ".", "LOCAL", ":", "return", "IMPOSSIBLE_MATCH", ";", "case", "Binding", ".", "TYPE", ":", "if", "(", "binding", "instanceof", "TypeBinding", ")", "typeBinding", "=", "(", "TypeBinding", ")", "binding", ";", "break", ";", "case", "Binding", ".", "VARIABLE", ":", "case", "Binding", ".", "TYPE", "|", "Binding", ".", "VARIABLE", ":", "if", "(", "binding", "instanceof", "ProblemReferenceBinding", ")", "{", "typeBinding", "=", "(", "TypeBinding", ")", "binding", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemFieldBinding", ")", "{", "if", "(", "qNameRef", ".", "tokens", ".", "length", "<", "(", "qNameRef", ".", "otherBindings", "==", "null", "?", "2", ":", "qNameRef", ".", "otherBindings", ".", "length", "+", "2", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "typeBinding", "=", "nameRef", ".", "actualReceiverType", ";", "}", "else", "if", "(", "binding", "instanceof", "ProblemBinding", ")", "{", "ProblemBinding", "pbBinding", "=", "(", "ProblemBinding", ")", "binding", ";", "if", "(", "CharOperation", ".", "occurencesOf", "(", "'.'", ",", "pbBinding", ".", "name", ")", "<=", "0", ")", "return", "INACCURATE_MATCH", ";", "typeBinding", "=", "pbBinding", ".", "searchType", ";", "}", "break", ";", "}", "return", "resolveLevel", "(", "typeBinding", ")", ";", "}", "protected", "int", "resolveLevel", "(", "TypeReference", "typeRef", ")", "{", "TypeBinding", "typeBinding", "=", "typeRef", ".", "resolvedType", ";", "if", "(", "typeBinding", "instanceof", "ArrayBinding", ")", "typeBinding", "=", "(", "(", "ArrayBinding", ")", "typeBinding", ")", ".", "leafComponentType", ";", "if", "(", "typeBinding", "instanceof", "ProblemReferenceBinding", ")", "typeBinding", "=", "(", "(", "ProblemReferenceBinding", ")", "typeBinding", ")", ".", "closestMatch", "(", ")", ";", "if", "(", "typeRef", "instanceof", "SingleTypeReference", ")", "{", "return", "resolveLevelForType", "(", "typeBinding", ")", ";", "}", "else", "return", "resolveLevelForTypeOrEnclosingTypes", "(", "this", ".", "pattern", ".", "simpleName", ",", "this", ".", "pattern", ".", "qualification", ",", "typeBinding", ")", ";", "}", "protected", "int", "resolveLevelForType", "(", "TypeBinding", "typeBinding", ")", "{", "if", "(", "typeBinding", "==", "null", "||", "!", "typeBinding", ".", "isValidBinding", "(", ")", ")", "{", "if", "(", "this", ".", "pattern", ".", "typeSuffix", "!=", "TYPE_SUFFIX", ")", "return", "INACCURATE_MATCH", ";", "}", "else", "{", "switch", "(", "this", ".", "pattern", ".", "typeSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "if", "(", "!", "typeBinding", ".", "isClass", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "if", "(", "!", "(", "typeBinding", ".", "isClass", "(", ")", "||", "(", "typeBinding", ".", "isInterface", "(", ")", "&&", "!", "typeBinding", ".", "isAnnotationType", "(", ")", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "CLASS_AND_ENUM_SUFFIX", ":", "if", "(", "!", "(", "typeBinding", ".", "isClass", "(", ")", "||", "typeBinding", ".", "isEnum", "(", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "INTERFACE_SUFFIX", ":", "if", "(", "!", "typeBinding", ".", "isInterface", "(", ")", "||", "typeBinding", ".", "isAnnotationType", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "if", "(", "!", "(", "typeBinding", ".", "isInterface", "(", ")", "||", "typeBinding", ".", "isAnnotationType", "(", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "ENUM_SUFFIX", ":", "if", "(", "!", "typeBinding", ".", "isEnum", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "ANNOTATION_TYPE_SUFFIX", ":", "if", "(", "!", "typeBinding", ".", "isAnnotationType", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "TYPE_SUFFIX", ":", "}", "}", "return", "resolveLevelForType", "(", "this", ".", "pattern", ".", "simpleName", ",", "this", ".", "pattern", ".", "qualification", ",", "this", ".", "pattern", ".", "getTypeArguments", "(", ")", ",", "0", ",", "typeBinding", ")", ";", "}", "protected", "int", "resolveLevelForTypeOrEnclosingTypes", "(", "char", "[", "]", "simpleNamePattern", ",", "char", "[", "]", "qualificationPattern", ",", "TypeBinding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "binding", "instanceof", "ReferenceBinding", ")", "{", "ReferenceBinding", "type", "=", "(", "ReferenceBinding", ")", "binding", ";", "while", "(", "type", "!=", "null", ")", "{", "int", "level", "=", "resolveLevelForType", "(", "type", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "return", "level", ";", "type", "=", "type", ".", "enclosingType", "(", ")", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,585
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "*", ";", "public", "class", "MultiTypeDeclarationPattern", "extends", "JavaSearchPattern", "{", "public", "char", "[", "]", "[", "]", "simpleNames", ";", "public", "char", "[", "]", "[", "]", "qualifications", ";", "public", "char", "typeSuffix", ";", "protected", "static", "char", "[", "]", "[", "]", "CATEGORIES", "=", "{", "TYPE_DECL", "}", ";", "public", "MultiTypeDeclarationPattern", "(", "char", "[", "]", "[", "]", "qualifications", ",", "char", "[", "]", "[", "]", "simpleNames", ",", "char", "typeSuffix", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "if", "(", "this", ".", "isCaseSensitive", "||", "qualifications", "==", "null", ")", "{", "this", ".", "qualifications", "=", "qualifications", ";", "}", "else", "{", "int", "length", "=", "qualifications", ".", "length", ";", "this", ".", "qualifications", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "this", ".", "qualifications", "[", "i", "]", "=", "CharOperation", ".", "toLowerCase", "(", "qualifications", "[", "i", "]", ")", ";", "}", "if", "(", "simpleNames", "!=", "null", ")", "{", "if", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "{", "this", ".", "simpleNames", "=", "simpleNames", ";", "}", "else", "{", "int", "length", "=", "simpleNames", ".", "length", ";", "this", ".", "simpleNames", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "this", ".", "simpleNames", "[", "i", "]", "=", "CharOperation", ".", "toLowerCase", "(", "simpleNames", "[", "i", "]", ")", ";", "}", "}", "this", ".", "typeSuffix", "=", "typeSuffix", ";", "this", ".", "mustResolve", "=", "typeSuffix", "!=", "TYPE_SUFFIX", ";", "}", "MultiTypeDeclarationPattern", "(", "int", "matchRule", ")", "{", "super", "(", "TYPE_DECL_PATTERN", ",", "matchRule", ")", ";", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "QualifiedTypeDeclarationPattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "return", "CATEGORIES", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "QualifiedTypeDeclarationPattern", "pattern", "=", "(", "QualifiedTypeDeclarationPattern", ")", "decodedPattern", ";", "if", "(", "this", ".", "typeSuffix", "!=", "pattern", ".", "typeSuffix", "&&", "this", ".", "typeSuffix", "!=", "TYPE_SUFFIX", ")", "{", "if", "(", "!", "matchDifferentTypeSuffixes", "(", "this", ".", "typeSuffix", ",", "pattern", ".", "typeSuffix", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "this", ".", "qualifications", "!=", "null", ")", "{", "int", "count", "=", "0", ";", "int", "max", "=", "this", ".", "qualifications", ".", "length", ";", "if", "(", "max", "==", "0", "&&", "pattern", ".", "qualification", ".", "length", ">", "0", ")", "{", "return", "false", ";", "}", "if", "(", "max", ">", "0", ")", "{", "for", "(", ";", "count", "<", "max", ";", "count", "++", ")", "if", "(", "matchesName", "(", "this", ".", "qualifications", "[", "count", "]", ",", "pattern", ".", "qualification", ")", ")", "break", ";", "if", "(", "count", "==", "max", ")", "return", "false", ";", "}", "}", "if", "(", "this", ".", "simpleNames", "==", "null", ")", "return", "true", ";", "int", "count", "=", "0", ";", "int", "max", "=", "this", ".", "simpleNames", ".", "length", ";", "for", "(", ";", "count", "<", "max", ";", "count", "++", ")", "if", "(", "matchesName", "(", "this", ".", "simpleNames", "[", "count", "]", ",", "pattern", ".", "simpleName", ")", ")", "break", ";", "return", "count", "<", "max", ";", "}", "public", "EntryResult", "[", "]", "queryIn", "(", "Index", "index", ")", "throws", "IOException", "{", "if", "(", "this", ".", "simpleNames", "==", "null", ")", "{", "return", "index", ".", "query", "(", "getIndexCategories", "(", ")", ",", "null", ",", "-", "1", ")", ";", "}", "int", "count", "=", "-", "1", ";", "int", "numOfNames", "=", "this", ".", "simpleNames", ".", "length", ";", "EntryResult", "[", "]", "[", "]", "allResults", "=", "numOfNames", ">", "1", "?", "new", "EntryResult", "[", "numOfNames", "]", "[", "]", ":", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numOfNames", ";", "i", "++", ")", "{", "char", "[", "]", "key", "=", "this", ".", "simpleNames", "[", "i", "]", ";", "int", "matchRule", "=", "getMatchRule", "(", ")", ";", "switch", "(", "getMatchMode", "(", ")", ")", "{", "case", "R_PREFIX_MATCH", ":", "break", ";", "case", "R_EXACT_MATCH", ":", "matchRule", "&=", "~", "R_EXACT_MATCH", ";", "matchRule", "|=", "R_PREFIX_MATCH", ";", "key", "=", "CharOperation", ".", "append", "(", "key", ",", "SEPARATOR", ")", ";", "break", ";", "case", "R_PATTERN_MATCH", ":", "if", "(", "key", "[", "key", ".", "length", "-", "1", "]", "!=", "'*'", ")", "key", "=", "CharOperation", ".", "concat", "(", "key", ",", "ONE_STAR", ",", "SEPARATOR", ")", ";", "break", ";", "case", "R_REGEXP_MATCH", ":", "break", ";", "case", "R_CAMELCASE_MATCH", ":", "case", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "break", ";", "}", "EntryResult", "[", "]", "entries", "=", "index", ".", "query", "(", "getIndexCategories", "(", ")", ",", "key", ",", "matchRule", ")", ";", "if", "(", "entries", "!=", "null", ")", "{", "if", "(", "allResults", "==", "null", ")", "return", "entries", ";", "allResults", "[", "++", "count", "]", "=", "entries", ";", "}", "}", "if", "(", "count", "==", "-", "1", ")", "return", "null", ";", "int", "total", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "count", ";", "i", "++", ")", "total", "+=", "allResults", "[", "i", "]", ".", "length", ";", "EntryResult", "[", "]", "allEntries", "=", "new", "EntryResult", "[", "total", "]", ";", "int", "next", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "count", ";", "i", "++", ")", "{", "EntryResult", "[", "]", "entries", "=", "allResults", "[", "i", "]", ";", "System", ".", "arraycopy", "(", "entries", ",", "0", ",", "allEntries", ",", "next", ",", "entries", ".", "length", ")", ";", "next", "+=", "entries", ".", "length", ";", "}", "return", "allEntries", ";", "}", "protected", "StringBuffer", "print", "(", "StringBuffer", "output", ")", "{", "switch", "(", "this", ".", "typeSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CLASS_AND_ENUM_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "INTERFACE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "ENUM_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "ANNOTATION_TYPE_SUFFIX", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "default", ":", "output", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "if", "(", "this", ".", "qualifications", "!=", "null", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "qualifications", ".", "length", ";", "i", "++", ")", "{", "output", ".", "append", "(", "this", ".", "qualifications", "[", "i", "]", ")", ";", "if", "(", "i", "<", "this", ".", "qualifications", ".", "length", "-", "1", ")", "output", ".", "append", "(", "\",", "\"", ")", ";", "}", "output", ".", "append", "(", "\">", "\"", ")", ";", "}", "if", "(", "this", ".", "simpleNames", "!=", "null", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "simpleNames", ".", "length", ";", "i", "++", ")", "{", "output", ".", "append", "(", "this", ".", "simpleNames", "[", "i", "]", ")", ";", "if", "(", "i", "<", "this", ".", "simpleNames", ".", "length", "-", "1", ")", "output", ".", "append", "(", "\",", "\"", ")", ";", "}", "output", ".", "append", "(", "\">\"", ")", ";", "}", "return", "super", ".", "print", "(", "output", ")", ";", "}", "}", "</s>" ]
2,586
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ExtraFlags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "public", "class", "ConstructorDeclarationPattern", "extends", "ConstructorPattern", "{", "public", "int", "extraFlags", ";", "public", "int", "declaringTypeModifiers", ";", "public", "char", "[", "]", "declaringPackageName", ";", "public", "int", "modifiers", ";", "public", "char", "[", "]", "signature", ";", "public", "char", "[", "]", "[", "]", "parameterTypes", ";", "public", "char", "[", "]", "[", "]", "parameterNames", ";", "public", "ConstructorDeclarationPattern", "(", "char", "[", "]", "declaringPackageName", ",", "char", "[", "]", "declaringSimpleName", ",", "int", "matchRule", ")", "{", "this", "(", "matchRule", ")", ";", "this", ".", "declaringSimpleName", "=", "(", "this", ".", "isCaseSensitive", "||", "this", ".", "isCamelCase", ")", "?", "declaringSimpleName", ":", "CharOperation", ".", "toLowerCase", "(", "declaringSimpleName", ")", ";", "this", ".", "declaringPackageName", "=", "declaringPackageName", ";", "this", ".", "findDeclarations", "=", "true", ";", "this", ".", "findReferences", "=", "false", ";", "this", ".", "parameterCount", "=", "-", "1", ";", "this", ".", "mustResolve", "=", "false", ";", "}", "ConstructorDeclarationPattern", "(", "int", "matchRule", ")", "{", "super", "(", "matchRule", ")", ";", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "int", "last", "=", "key", ".", "length", "-", "1", ";", "int", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "0", ")", ";", "this", ".", "declaringSimpleName", "=", "CharOperation", ".", "subarray", "(", "key", ",", "0", ",", "slash", ")", ";", "int", "start", "=", "slash", "+", "1", ";", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "last", "=", "slash", "-", "1", ";", "boolean", "isDefaultConstructor", "=", "key", "[", "last", "]", "==", "'#'", ";", "if", "(", "isDefaultConstructor", ")", "{", "this", ".", "parameterCount", "=", "-", "1", ";", "}", "else", "{", "this", ".", "parameterCount", "=", "0", ";", "int", "power", "=", "1", ";", "for", "(", "int", "i", "=", "last", ";", "i", ">=", "start", ";", "i", "--", ")", "{", "if", "(", "i", "==", "last", ")", "{", "this", ".", "parameterCount", "=", "key", "[", "i", "]", "-", "'0'", ";", "}", "else", "{", "power", "*=", "10", ";", "this", ".", "parameterCount", "+=", "power", "*", "(", "key", "[", "i", "]", "-", "'0'", ")", ";", "}", "}", "}", "slash", "=", "slash", "+", "3", ";", "last", "=", "slash", "-", "1", ";", "int", "typeModifiersWithExtraFlags", "=", "key", "[", "last", "-", "1", "]", "+", "(", "key", "[", "last", "]", "<<", "16", ")", ";", "this", ".", "declaringTypeModifiers", "=", "decodeModifers", "(", "typeModifiersWithExtraFlags", ")", ";", "this", ".", "extraFlags", "=", "decodeExtraFlags", "(", "typeModifiersWithExtraFlags", ")", ";", "this", ".", "declaringPackageName", "=", "null", ";", "this", ".", "modifiers", "=", "0", ";", "this", ".", "signature", "=", "null", ";", "this", ".", "parameterTypes", "=", "null", ";", "this", ".", "parameterNames", "=", "null", ";", "boolean", "isMemberType", "=", "(", "this", ".", "extraFlags", "&", "ExtraFlags", ".", "IsMemberType", ")", "!=", "0", ";", "if", "(", "!", "isMemberType", ")", "{", "start", "=", "slash", "+", "1", ";", "if", "(", "this", ".", "parameterCount", "==", "-", "1", ")", "{", "slash", "=", "key", ".", "length", ";", "last", "=", "slash", "-", "1", ";", "}", "else", "{", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "}", "last", "=", "slash", "-", "1", ";", "this", ".", "declaringPackageName", "=", "CharOperation", ".", "subarray", "(", "key", ",", "start", ",", "slash", ")", ";", "start", "=", "slash", "+", "1", ";", "if", "(", "this", ".", "parameterCount", "==", "0", ")", "{", "slash", "=", "slash", "+", "3", ";", "last", "=", "slash", "-", "1", ";", "this", ".", "modifiers", "=", "key", "[", "last", "-", "1", "]", "+", "(", "key", "[", "last", "]", "<<", "16", ")", ";", "}", "else", "if", "(", "this", ".", "parameterCount", ">", "0", ")", "{", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "last", "=", "slash", "-", "1", ";", "boolean", "hasParameterStoredAsSignature", "=", "(", "this", ".", "extraFlags", "&", "ExtraFlags", ".", "ParameterTypesStoredAsSignature", ")", "!=", "0", ";", "if", "(", "hasParameterStoredAsSignature", ")", "{", "this", ".", "signature", "=", "CharOperation", ".", "subarray", "(", "key", ",", "start", ",", "slash", ")", ";", "CharOperation", ".", "replace", "(", "this", ".", "signature", ",", "'\\\\'", ",", "SEPARATOR", ")", ";", "}", "else", "{", "this", ".", "parameterTypes", "=", "CharOperation", ".", "splitOn", "(", "PARAMETER_SEPARATOR", ",", "key", ",", "start", ",", "slash", ")", ";", "}", "start", "=", "slash", "+", "1", ";", "slash", "=", "CharOperation", ".", "indexOf", "(", "SEPARATOR", ",", "key", ",", "start", ")", ";", "last", "=", "slash", "-", "1", ";", "if", "(", "slash", "!=", "start", ")", "{", "this", ".", "parameterNames", "=", "CharOperation", ".", "splitOn", "(", "PARAMETER_SEPARATOR", ",", "key", ",", "start", ",", "slash", ")", ";", "}", "slash", "=", "slash", "+", "3", ";", "last", "=", "slash", "-", "1", ";", "this", ".", "modifiers", "=", "key", "[", "last", "-", "1", "]", "+", "(", "key", "[", "last", "]", "<<", "16", ")", ";", "}", "else", "{", "this", ".", "modifiers", "=", "ClassFileConstants", ".", "AccPublic", ";", "}", "}", "removeInternalFlags", "(", ")", ";", "}", "public", "SearchPattern", "getBlankPattern", "(", ")", "{", "return", "new", "ConstructorDeclarationPattern", "(", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", ")", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "return", "DECL_CATEGORIES", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "ConstructorDeclarationPattern", "pattern", "=", "(", "ConstructorDeclarationPattern", ")", "decodedPattern", ";", "if", "(", "(", "pattern", ".", "extraFlags", "&", "ExtraFlags", ".", "IsMemberType", ")", "!=", "0", ")", "return", "false", ";", "if", "(", "this", ".", "declaringPackageName", "!=", "null", "&&", "!", "CharOperation", ".", "equals", "(", "this", ".", "declaringPackageName", ",", "pattern", ".", "declaringPackageName", ",", "true", ")", ")", "return", "false", ";", "return", "(", "this", ".", "parameterCount", "==", "pattern", ".", "parameterCount", "||", "this", ".", "parameterCount", "==", "-", "1", "||", "this", ".", "varargs", ")", "&&", "matchesName", "(", "this", ".", "declaringSimpleName", ",", "pattern", ".", "declaringSimpleName", ")", ";", "}", "private", "void", "removeInternalFlags", "(", ")", "{", "this", ".", "extraFlags", "=", "this", ".", "extraFlags", "&", "~", "ExtraFlags", ".", "ParameterTypesStoredAsSignature", ";", "}", "}", "</s>" ]
2,587
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SimpleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IndexQueryRequestor", ";", "public", "abstract", "class", "IntersectingPattern", "extends", "JavaSearchPattern", "{", "public", "IntersectingPattern", "(", "int", "patternKind", ",", "int", "matchRule", ")", "{", "super", "(", "patternKind", ",", "matchRule", ")", ";", "}", "public", "void", "findIndexMatches", "(", "Index", "index", ",", "IndexQueryRequestor", "requestor", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "IOException", "{", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "resetQuery", "(", ")", ";", "SimpleSet", "intersectedNames", "=", "null", ";", "try", "{", "index", ".", "startQuery", "(", ")", ";", "do", "{", "SearchPattern", "pattern", "=", "currentPattern", "(", ")", ";", "EntryResult", "[", "]", "entries", "=", "pattern", ".", "queryIn", "(", "index", ")", ";", "if", "(", "entries", "==", "null", ")", "return", ";", "SearchPattern", "decodedResult", "=", "pattern", ".", "getBlankPattern", "(", ")", ";", "SimpleSet", "newIntersectedNames", "=", "new", "SimpleSet", "(", "3", ")", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "entries", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "EntryResult", "entry", "=", "entries", "[", "i", "]", ";", "decodedResult", ".", "decodeIndexKey", "(", "entry", ".", "getWord", "(", ")", ")", ";", "if", "(", "pattern", ".", "matchesDecodedKey", "(", "decodedResult", ")", ")", "{", "String", "[", "]", "names", "=", "entry", ".", "getDocumentNames", "(", "index", ")", ";", "if", "(", "intersectedNames", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ",", "n", "=", "names", ".", "length", ";", "j", "<", "n", ";", "j", "++", ")", "if", "(", "intersectedNames", ".", "includes", "(", "names", "[", "j", "]", ")", ")", "newIntersectedNames", ".", "add", "(", "names", "[", "j", "]", ")", ";", "}", "else", "{", "for", "(", "int", "j", "=", "0", ",", "n", "=", "names", ".", "length", ";", "j", "<", "n", ";", "j", "++", ")", "newIntersectedNames", ".", "add", "(", "names", "[", "j", "]", ")", ";", "}", "}", "}", "if", "(", "newIntersectedNames", ".", "elementSize", "==", "0", ")", "return", ";", "intersectedNames", "=", "newIntersectedNames", ";", "}", "while", "(", "hasNextQuery", "(", ")", ")", ";", "}", "finally", "{", "index", ".", "stopQuery", "(", ")", ";", "}", "String", "containerPath", "=", "index", ".", "containerPath", ";", "char", "separator", "=", "index", ".", "separator", ";", "Object", "[", "]", "names", "=", "intersectedNames", ".", "values", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "names", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "if", "(", "names", "[", "i", "]", "!=", "null", ")", "acceptMatch", "(", "(", "String", ")", "names", "[", "i", "]", ",", "containerPath", ",", "separator", ",", "null", ",", "requestor", ",", "participant", ",", "scope", ",", "progressMonitor", ")", ";", "}", "protected", "abstract", "boolean", "hasNextQuery", "(", ")", ";", "protected", "abstract", "void", "resetQuery", "(", ")", ";", "}", "</s>" ]
2,588
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "public", "class", "TypeDeclarationLocator", "extends", "PatternLocator", "{", "protected", "TypeDeclarationPattern", "pattern", ";", "public", "TypeDeclarationLocator", "(", "TypeDeclarationPattern", "pattern", ")", "{", "super", "(", "pattern", ")", ";", "this", ".", "pattern", "=", "pattern", ";", "}", "public", "int", "match", "(", "TypeDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "if", "(", "this", ".", "pattern", ".", "simpleName", "==", "null", "||", "matchesName", "(", "this", ".", "pattern", ".", "simpleName", ",", "node", ".", "name", ")", ")", "return", "nodeSet", ".", "addMatch", "(", "node", ",", "this", ".", "pattern", ".", "mustResolve", "?", "POSSIBLE_MATCH", ":", "ACCURATE_MATCH", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "node", ")", "{", "if", "(", "!", "(", "node", "instanceof", "TypeDeclaration", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "return", "resolveLevel", "(", "(", "(", "TypeDeclaration", ")", "node", ")", ".", "binding", ")", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "if", "(", "binding", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "!", "(", "binding", "instanceof", "TypeBinding", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "TypeBinding", "type", "=", "(", "TypeBinding", ")", "binding", ";", "switch", "(", "this", ".", "pattern", ".", "typeSuffix", ")", "{", "case", "CLASS_SUFFIX", ":", "if", "(", "!", "type", ".", "isClass", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "CLASS_AND_INTERFACE_SUFFIX", ":", "if", "(", "!", "(", "type", ".", "isClass", "(", ")", "||", "(", "type", ".", "isInterface", "(", ")", "&&", "!", "type", ".", "isAnnotationType", "(", ")", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "CLASS_AND_ENUM_SUFFIX", ":", "if", "(", "!", "(", "type", ".", "isClass", "(", ")", "||", "type", ".", "isEnum", "(", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "INTERFACE_SUFFIX", ":", "if", "(", "!", "type", ".", "isInterface", "(", ")", "||", "type", ".", "isAnnotationType", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "INTERFACE_AND_ANNOTATION_SUFFIX", ":", "if", "(", "!", "(", "type", ".", "isInterface", "(", ")", "||", "type", ".", "isAnnotationType", "(", ")", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "ENUM_SUFFIX", ":", "if", "(", "!", "type", ".", "isEnum", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "ANNOTATION_TYPE_SUFFIX", ":", "if", "(", "!", "type", ".", "isAnnotationType", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "break", ";", "case", "TYPE_SUFFIX", ":", "}", "if", "(", "this", ".", "pattern", "instanceof", "QualifiedTypeDeclarationPattern", ")", "{", "QualifiedTypeDeclarationPattern", "qualifiedPattern", "=", "(", "QualifiedTypeDeclarationPattern", ")", "this", ".", "pattern", ";", "return", "resolveLevelForType", "(", "qualifiedPattern", ".", "simpleName", ",", "qualifiedPattern", ".", "qualification", ",", "type", ")", ";", "}", "else", "{", "char", "[", "]", "enclosingTypeName", "=", "this", ".", "pattern", ".", "enclosingTypeNames", "==", "null", "?", "null", ":", "CharOperation", ".", "concatWith", "(", "this", ".", "pattern", ".", "enclosingTypeNames", ",", "'.'", ")", ";", "return", "resolveLevelForType", "(", "this", ".", "pattern", ".", "simpleName", ",", "this", ".", "pattern", ".", "pkg", ",", "enclosingTypeName", ",", "type", ")", ";", "}", "}", "protected", "int", "resolveLevelForType", "(", "char", "[", "]", "simpleNamePattern", ",", "char", "[", "]", "qualificationPattern", ",", "char", "[", "]", "enclosingNamePattern", ",", "TypeBinding", "type", ")", "{", "if", "(", "enclosingNamePattern", "==", "null", ")", "return", "resolveLevelForType", "(", "simpleNamePattern", ",", "qualificationPattern", ",", "type", ")", ";", "if", "(", "qualificationPattern", "==", "null", ")", "return", "resolveLevelForType", "(", "simpleNamePattern", ",", "enclosingNamePattern", ",", "type", ")", ";", "if", "(", "type", "instanceof", "ProblemReferenceBinding", ")", "return", "IMPOSSIBLE_MATCH", ";", "char", "[", "]", "fullQualificationPattern", "=", "CharOperation", ".", "concat", "(", "qualificationPattern", ",", "enclosingNamePattern", ",", "'.'", ")", ";", "if", "(", "CharOperation", ".", "equals", "(", "this", ".", "pattern", ".", "pkg", ",", "CharOperation", ".", "concatWith", "(", "type", ".", "getPackage", "(", ")", ".", "compoundName", ",", "'.'", ")", ")", ")", "return", "resolveLevelForType", "(", "simpleNamePattern", ",", "fullQualificationPattern", ",", "type", ")", ";", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,589
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAnnotatable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ASTVisitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "BlockScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "HashtableOfIntValues", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocator", ".", "WrappedCoreException", ";", "class", "MemberDeclarationVisitor", "extends", "ASTVisitor", "{", "private", "final", "MatchLocator", "locator", ";", "private", "final", "IJavaElement", "enclosingElement", ";", "private", "final", "MatchingNodeSet", "nodeSet", ";", "private", "final", "ASTNode", "[", "]", "matchingNodes", ";", "private", "final", "ASTNode", "matchingNode", ";", "HashtableOfIntValues", "occurrencesCounts", "=", "new", "HashtableOfIntValues", "(", ")", ";", "int", "nodesCount", "=", "0", ";", "private", "Annotation", "annotation", ";", "private", "LocalDeclaration", "localDeclaration", ";", "IJavaElement", "localElement", ";", "IJavaElement", "[", "]", "localElements", ",", "otherElements", ";", "IJavaElement", "[", "]", "[", "]", "allOtherElements", ";", "int", "ptr", "=", "-", "1", ";", "int", "[", "]", "ptrs", ";", "public", "MemberDeclarationVisitor", "(", "IJavaElement", "element", ",", "ASTNode", "[", "]", "nodes", ",", "MatchingNodeSet", "set", ",", "MatchLocator", "locator", ")", "{", "this", ".", "enclosingElement", "=", "element", ";", "this", ".", "nodeSet", "=", "set", ";", "this", ".", "locator", "=", "locator", ";", "if", "(", "nodes", "==", "null", ")", "{", "this", ".", "matchingNode", "=", "null", ";", "this", ".", "matchingNodes", "=", "null", ";", "}", "else", "{", "this", ".", "nodesCount", "=", "nodes", ".", "length", ";", "if", "(", "nodes", ".", "length", "==", "1", ")", "{", "this", ".", "matchingNode", "=", "nodes", "[", "0", "]", ";", "this", ".", "matchingNodes", "=", "null", ";", "}", "else", "{", "this", ".", "matchingNode", "=", "null", ";", "this", ".", "matchingNodes", "=", "nodes", ";", "this", ".", "localElements", "=", "new", "IJavaElement", "[", "this", ".", "nodesCount", "]", ";", "this", ".", "ptrs", "=", "new", "int", "[", "this", ".", "nodesCount", "]", ";", "this", ".", "allOtherElements", "=", "new", "IJavaElement", "[", "this", ".", "nodesCount", "]", "[", "]", ";", "}", "}", "}", "public", "void", "endVisit", "(", "Argument", "argument", ",", "BlockScope", "scope", ")", "{", "this", ".", "localDeclaration", "=", "null", ";", "}", "public", "void", "endVisit", "(", "LocalDeclaration", "declaration", ",", "BlockScope", "scope", ")", "{", "this", ".", "localDeclaration", "=", "null", ";", "}", "public", "void", "endVisit", "(", "MarkerAnnotation", "markerAnnotation", ",", "BlockScope", "unused", ")", "{", "this", ".", "annotation", "=", "null", ";", "}", "public", "void", "endVisit", "(", "NormalAnnotation", "normalAnnotation", ",", "BlockScope", "unused", ")", "{", "this", ".", "annotation", "=", "null", ";", "}", "public", "void", "endVisit", "(", "SingleMemberAnnotation", "singleMemberAnnotation", ",", "BlockScope", "unused", ")", "{", "this", ".", "annotation", "=", "null", ";", "}", "IJavaElement", "getLocalElement", "(", "int", "idx", ")", "{", "if", "(", "this", ".", "nodesCount", "==", "1", ")", "{", "return", "this", ".", "localElement", ";", "}", "if", "(", "this", ".", "localElements", "!=", "null", ")", "{", "return", "this", ".", "localElements", "[", "idx", "]", ";", "}", "return", "null", ";", "}", "IJavaElement", "[", "]", "getOtherElements", "(", "int", "idx", ")", "{", "if", "(", "this", ".", "nodesCount", "==", "1", ")", "{", "if", "(", "this", ".", "otherElements", "!=", "null", ")", "{", "int", "length", "=", "this", ".", "otherElements", ".", "length", ";", "if", "(", "this", ".", "ptr", "<", "(", "length", "-", "1", ")", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "otherElements", ",", "0", ",", "this", ".", "otherElements", "=", "new", "IJavaElement", "[", "this", ".", "ptr", "+", "1", "]", ",", "0", ",", "this", ".", "ptr", "+", "1", ")", ";", "}", "}", "return", "this", ".", "otherElements", ";", "}", "IJavaElement", "[", "]", "elements", "=", "this", ".", "allOtherElements", "==", "null", "?", "null", ":", "this", ".", "allOtherElements", "[", "idx", "]", ";", "if", "(", "elements", "!=", "null", ")", "{", "int", "length", "=", "elements", ".", "length", ";", "if", "(", "this", ".", "ptrs", "[", "idx", "]", "<", "(", "length", "-", "1", ")", ")", "{", "System", ".", "arraycopy", "(", "elements", ",", "0", ",", "elements", "=", "this", ".", "allOtherElements", "[", "idx", "]", "=", "new", "IJavaElement", "[", "this", ".", "ptrs", "[", "idx", "]", "+", "1", "]", ",", "0", ",", "this", ".", "ptrs", "[", "idx", "]", "+", "1", ")", ";", "}", "}", "return", "elements", ";", "}", "private", "int", "matchNode", "(", "ASTNode", "reference", ")", "{", "if", "(", "this", ".", "matchingNode", "!=", "null", ")", "{", "if", "(", "this", ".", "matchingNode", "==", "reference", ")", "return", "0", ";", "}", "else", "{", "int", "length", "=", "this", ".", "matchingNodes", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "matchingNodes", "[", "i", "]", "==", "reference", ")", "{", "return", "i", ";", "}", "}", "}", "return", "-", "1", ";", "}", "private", "void", "storeHandle", "(", "int", "idx", ")", "{", "if", "(", "this", ".", "localDeclaration", "==", "null", ")", "return", ";", "IJavaElement", "handle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "localDeclaration", ",", "this", ".", "enclosingElement", ")", ";", "if", "(", "this", ".", "nodesCount", "==", "1", ")", "{", "if", "(", "this", ".", "localElement", "==", "null", ")", "{", "if", "(", "this", ".", "annotation", "==", "null", ")", "{", "this", ".", "localElement", "=", "handle", ";", "}", "else", "{", "IJavaElement", "annotHandle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "annotation", ",", "(", "IAnnotatable", ")", "handle", ")", ";", "if", "(", "annotHandle", "==", "null", ")", "{", "annotHandle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "annotation", ",", "(", "IAnnotatable", ")", "this", ".", "enclosingElement", ")", ";", "}", "this", ".", "localElement", "=", "annotHandle", "==", "null", "?", "handle", ":", "annotHandle", ";", "}", "}", "else", "{", "if", "(", "++", "this", ".", "ptr", "==", "0", ")", "{", "this", ".", "otherElements", "=", "new", "IJavaElement", "[", "10", "]", ";", "}", "else", "{", "int", "length", "=", "this", ".", "otherElements", ".", "length", ";", "if", "(", "this", ".", "ptr", "==", "length", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "otherElements", ",", "0", ",", "this", ".", "otherElements", "=", "new", "IJavaElement", "[", "length", "+", "10", "]", ",", "0", ",", "length", ")", ";", "}", "}", "if", "(", "this", ".", "annotation", "==", "null", ")", "{", "this", ".", "otherElements", "[", "this", ".", "ptr", "]", "=", "handle", ";", "}", "else", "{", "IJavaElement", "annotHandle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "annotation", ",", "(", "IAnnotatable", ")", "handle", ")", ";", "if", "(", "annotHandle", "==", "null", ")", "{", "annotHandle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "annotation", ",", "(", "IAnnotatable", ")", "this", ".", "enclosingElement", ")", ";", "}", "this", ".", "otherElements", "[", "this", ".", "ptr", "]", "=", "annotHandle", "==", "null", "?", "handle", ":", "annotHandle", ";", "}", "}", "}", "else", "{", "if", "(", "this", ".", "localElements", "[", "idx", "]", "==", "null", ")", "{", "if", "(", "this", ".", "annotation", "==", "null", ")", "{", "this", ".", "localElements", "[", "idx", "]", "=", "handle", ";", "}", "else", "{", "IJavaElement", "annotHandle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "annotation", ",", "(", "IAnnotatable", ")", "handle", ")", ";", "if", "(", "annotHandle", "==", "null", ")", "{", "annotHandle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "annotation", ",", "(", "IAnnotatable", ")", "this", ".", "enclosingElement", ")", ";", "}", "this", ".", "localElements", "[", "idx", "]", "=", "annotHandle", "==", "null", "?", "handle", ":", "annotHandle", ";", "}", "this", ".", "ptrs", "[", "idx", "]", "=", "-", "1", ";", "}", "else", "{", "int", "oPtr", "=", "++", "this", ".", "ptrs", "[", "idx", "]", ";", "if", "(", "oPtr", "==", "0", ")", "{", "this", ".", "allOtherElements", "[", "idx", "]", "=", "new", "IJavaElement", "[", "10", "]", ";", "}", "else", "{", "int", "length", "=", "this", ".", "allOtherElements", "[", "idx", "]", ".", "length", ";", "if", "(", "oPtr", "==", "length", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "allOtherElements", "[", "idx", "]", ",", "0", ",", "this", ".", "allOtherElements", "[", "idx", "]", "=", "new", "IJavaElement", "[", "length", "+", "10", "]", ",", "0", ",", "length", ")", ";", "}", "}", "if", "(", "this", ".", "annotation", "==", "null", ")", "{", "this", ".", "allOtherElements", "[", "idx", "]", "[", "oPtr", "]", "=", "handle", ";", "}", "else", "{", "IJavaElement", "annotHandle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "annotation", ",", "(", "IAnnotatable", ")", "handle", ")", ";", "if", "(", "annotHandle", "==", "null", ")", "{", "annotHandle", "=", "this", ".", "locator", ".", "createHandle", "(", "this", ".", "annotation", ",", "(", "IAnnotatable", ")", "this", ".", "enclosingElement", ")", ";", "}", "this", ".", "allOtherElements", "[", "idx", "]", "[", "oPtr", "]", "=", "annotHandle", "==", "null", "?", "handle", ":", "annotHandle", ";", "}", "}", "}", "}", "public", "boolean", "visit", "(", "Argument", "argument", ",", "BlockScope", "scope", ")", "{", "this", ".", "localDeclaration", "=", "argument", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "LocalDeclaration", "declaration", ",", "BlockScope", "scope", ")", "{", "this", ".", "localDeclaration", "=", "declaration", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "MarkerAnnotation", "markerAnnotation", ",", "BlockScope", "unused", ")", "{", "this", ".", "annotation", "=", "markerAnnotation", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "NormalAnnotation", "normalAnnotation", ",", "BlockScope", "unused", ")", "{", "this", ".", "annotation", "=", "normalAnnotation", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "QualifiedNameReference", "nameReference", ",", "BlockScope", "unused", ")", "{", "if", "(", "this", ".", "nodesCount", ">", "0", ")", "{", "int", "idx", "=", "matchNode", "(", "nameReference", ")", ";", "if", "(", "idx", ">=", "0", ")", "{", "storeHandle", "(", "idx", ")", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "QualifiedTypeReference", "typeReference", ",", "BlockScope", "unused", ")", "{", "if", "(", "this", ".", "nodesCount", ">", "0", ")", "{", "int", "idx", "=", "matchNode", "(", "typeReference", ")", ";", "if", "(", "idx", ">=", "0", ")", "{", "storeHandle", "(", "idx", ")", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SingleMemberAnnotation", "singleMemberAnnotation", ",", "BlockScope", "unused", ")", "{", "this", ".", "annotation", "=", "singleMemberAnnotation", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "SingleNameReference", "nameReference", ",", "BlockScope", "unused", ")", "{", "if", "(", "this", ".", "nodesCount", ">", "0", ")", "{", "int", "idx", "=", "matchNode", "(", "nameReference", ")", ";", "if", "(", "idx", ">=", "0", ")", "{", "storeHandle", "(", "idx", ")", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "SingleTypeReference", "typeReference", ",", "BlockScope", "unused", ")", "{", "if", "(", "this", ".", "nodesCount", ">", "0", ")", "{", "int", "idx", "=", "matchNode", "(", "typeReference", ")", ";", "if", "(", "idx", ">=", "0", ")", "{", "storeHandle", "(", "idx", ")", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "BlockScope", "unused", ")", "{", "try", "{", "char", "[", "]", "simpleName", ";", "if", "(", "(", "typeDeclaration", ".", "bits", "&", "ASTNode", ".", "IsAnonymousType", ")", "!=", "0", ")", "{", "simpleName", "=", "CharOperation", ".", "NO_CHAR", ";", "}", "else", "{", "simpleName", "=", "typeDeclaration", ".", "name", ";", "}", "int", "occurrenceCount", "=", "this", ".", "occurrencesCounts", ".", "get", "(", "simpleName", ")", ";", "if", "(", "occurrenceCount", "==", "HashtableOfIntValues", ".", "NO_VALUE", ")", "{", "occurrenceCount", "=", "1", ";", "}", "else", "{", "occurrenceCount", "=", "occurrenceCount", "+", "1", ";", "}", "this", ".", "occurrencesCounts", ".", "put", "(", "simpleName", ",", "occurrenceCount", ")", ";", "if", "(", "(", "typeDeclaration", ".", "bits", "&", "ASTNode", ".", "IsAnonymousType", ")", "!=", "0", ")", "{", "this", ".", "locator", ".", "reportMatching", "(", "typeDeclaration", ",", "this", ".", "enclosingElement", ",", "-", "1", ",", "this", ".", "nodeSet", ",", "occurrenceCount", ")", ";", "}", "else", "{", "Integer", "level", "=", "(", "Integer", ")", "this", ".", "nodeSet", ".", "matchingNodes", ".", "removeKey", "(", "typeDeclaration", ")", ";", "this", ".", "locator", ".", "reportMatching", "(", "typeDeclaration", ",", "this", ".", "enclosingElement", ",", "level", "!=", "null", "?", "level", ".", "intValue", "(", ")", ":", "-", "1", ",", "this", ".", "nodeSet", ",", "occurrenceCount", ")", ";", "}", "return", "false", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "throw", "new", "WrappedCoreException", "(", "e", ")", ";", "}", "}", "}", "</s>" ]
2,590
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "public", "abstract", "class", "PatternLocator", "implements", "IIndexConstants", "{", "protected", "int", "matchMode", ";", "protected", "boolean", "isCaseSensitive", ";", "protected", "boolean", "isEquivalentMatch", ";", "protected", "boolean", "isErasureMatch", ";", "protected", "boolean", "mustResolve", ";", "protected", "boolean", "mayBeGeneric", ";", "SearchMatch", "match", "=", "null", ";", "public", "static", "final", "int", "IMPOSSIBLE_MATCH", "=", "0", ";", "public", "static", "final", "int", "INACCURATE_MATCH", "=", "1", ";", "public", "static", "final", "int", "POSSIBLE_MATCH", "=", "2", ";", "public", "static", "final", "int", "ACCURATE_MATCH", "=", "3", ";", "public", "static", "final", "int", "ERASURE_MATCH", "=", "4", ";", "int", "flavors", "=", "0", ";", "public", "static", "final", "int", "NO_FLAVOR", "=", "0x0000", ";", "public", "static", "final", "int", "EXACT_FLAVOR", "=", "0x0010", ";", "public", "static", "final", "int", "PREFIX_FLAVOR", "=", "0x0020", ";", "public", "static", "final", "int", "PATTERN_FLAVOR", "=", "0x0040", ";", "public", "static", "final", "int", "REGEXP_FLAVOR", "=", "0x0080", ";", "public", "static", "final", "int", "CAMELCASE_FLAVOR", "=", "0x0100", ";", "public", "static", "final", "int", "SUPER_INVOCATION_FLAVOR", "=", "0x0200", ";", "public", "static", "final", "int", "SUB_INVOCATION_FLAVOR", "=", "0x0400", ";", "public", "static", "final", "int", "OVERRIDDEN_METHOD_FLAVOR", "=", "0x0800", ";", "public", "static", "final", "int", "SUPERTYPE_REF_FLAVOR", "=", "0x1000", ";", "public", "static", "final", "int", "MATCH_LEVEL_MASK", "=", "0x0F", ";", "public", "static", "final", "int", "FLAVORS_MASK", "=", "~", "MATCH_LEVEL_MASK", ";", "public", "static", "final", "int", "COMPILATION_UNIT_CONTAINER", "=", "1", ";", "public", "static", "final", "int", "CLASS_CONTAINER", "=", "2", ";", "public", "static", "final", "int", "METHOD_CONTAINER", "=", "4", ";", "public", "static", "final", "int", "FIELD_CONTAINER", "=", "8", ";", "public", "static", "final", "int", "ALL_CONTAINER", "=", "COMPILATION_UNIT_CONTAINER", "|", "CLASS_CONTAINER", "|", "METHOD_CONTAINER", "|", "FIELD_CONTAINER", ";", "public", "static", "final", "int", "RAW_MASK", "=", "SearchPattern", ".", "R_EQUIVALENT_MATCH", "|", "SearchPattern", ".", "R_ERASURE_MATCH", ";", "public", "static", "final", "int", "RULE_MASK", "=", "RAW_MASK", ";", "public", "static", "PatternLocator", "patternLocator", "(", "SearchPattern", "pattern", ")", "{", "switch", "(", "pattern", ".", "kind", ")", "{", "case", "IIndexConstants", ".", "PKG_REF_PATTERN", ":", "return", "new", "PackageReferenceLocator", "(", "(", "PackageReferencePattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "PKG_DECL_PATTERN", ":", "return", "new", "PackageDeclarationLocator", "(", "(", "PackageDeclarationPattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "TYPE_REF_PATTERN", ":", "return", "new", "TypeReferenceLocator", "(", "(", "TypeReferencePattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "TYPE_DECL_PATTERN", ":", "return", "new", "TypeDeclarationLocator", "(", "(", "TypeDeclarationPattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "SUPER_REF_PATTERN", ":", "return", "new", "SuperTypeReferenceLocator", "(", "(", "SuperTypeReferencePattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "CONSTRUCTOR_PATTERN", ":", "return", "new", "ConstructorLocator", "(", "(", "ConstructorPattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "FIELD_PATTERN", ":", "return", "new", "FieldLocator", "(", "(", "FieldPattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "METHOD_PATTERN", ":", "return", "new", "MethodLocator", "(", "(", "MethodPattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "OR_PATTERN", ":", "return", "new", "OrLocator", "(", "(", "OrPattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "AND_PATTERN", ":", "return", "new", "AndLocator", "(", "(", "AndPattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "LOCAL_VAR_PATTERN", ":", "return", "new", "LocalVariableLocator", "(", "(", "LocalVariablePattern", ")", "pattern", ")", ";", "case", "IIndexConstants", ".", "TYPE_PARAM_PATTERN", ":", "return", "new", "TypeParameterLocator", "(", "(", "TypeParameterPattern", ")", "pattern", ")", ";", "}", "return", "null", ";", "}", "public", "static", "char", "[", "]", "qualifiedPattern", "(", "char", "[", "]", "simpleNamePattern", ",", "char", "[", "]", "qualificationPattern", ")", "{", "if", "(", "simpleNamePattern", "==", "null", ")", "{", "if", "(", "qualificationPattern", "==", "null", ")", "return", "null", ";", "return", "CharOperation", ".", "concat", "(", "qualificationPattern", ",", "ONE_STAR", ",", "'.'", ")", ";", "}", "else", "{", "return", "qualificationPattern", "==", "null", "?", "CharOperation", ".", "concat", "(", "ONE_STAR", ",", "simpleNamePattern", ")", ":", "CharOperation", ".", "concat", "(", "qualificationPattern", ",", "simpleNamePattern", ",", "'.'", ")", ";", "}", "}", "public", "static", "char", "[", "]", "qualifiedSourceName", "(", "TypeBinding", "binding", ")", "{", "if", "(", "binding", "instanceof", "ReferenceBinding", ")", "{", "ReferenceBinding", "type", "=", "(", "ReferenceBinding", ")", "binding", ";", "if", "(", "type", ".", "isLocalType", "(", ")", ")", "return", "type", ".", "isMemberType", "(", ")", "?", "CharOperation", ".", "concat", "(", "qualifiedSourceName", "(", "type", ".", "enclosingType", "(", ")", ")", ",", "type", ".", "sourceName", "(", ")", ",", "'.'", ")", ":", "CharOperation", ".", "concat", "(", "qualifiedSourceName", "(", "type", ".", "enclosingType", "(", ")", ")", ",", "new", "char", "[", "]", "{", "'.'", ",", "'1'", ",", "'.'", "}", ",", "type", ".", "sourceName", "(", ")", ")", ";", "}", "return", "binding", "!=", "null", "?", "binding", ".", "qualifiedSourceName", "(", ")", ":", "null", ";", "}", "public", "PatternLocator", "(", "SearchPattern", "pattern", ")", "{", "int", "matchRule", "=", "pattern", ".", "getMatchRule", "(", ")", ";", "this", ".", "isCaseSensitive", "=", "(", "matchRule", "&", "SearchPattern", ".", "R_CASE_SENSITIVE", ")", "!=", "0", ";", "this", ".", "isErasureMatch", "=", "(", "matchRule", "&", "SearchPattern", ".", "R_ERASURE_MATCH", ")", "!=", "0", ";", "this", ".", "isEquivalentMatch", "=", "(", "matchRule", "&", "SearchPattern", ".", "R_EQUIVALENT_MATCH", ")", "!=", "0", ";", "this", ".", "matchMode", "=", "matchRule", "&", "JavaSearchPattern", ".", "MATCH_MODE_MASK", ";", "this", ".", "mustResolve", "=", "pattern", ".", "mustResolve", ";", "}", "protected", "void", "clear", "(", ")", "{", "}", "protected", "char", "[", "]", "getQualifiedPattern", "(", "char", "[", "]", "simpleNamePattern", ",", "char", "[", "]", "qualificationPattern", ")", "{", "if", "(", "simpleNamePattern", "==", "null", ")", "{", "if", "(", "qualificationPattern", "==", "null", ")", "return", "null", ";", "return", "CharOperation", ".", "concat", "(", "qualificationPattern", ",", "ONE_STAR", ",", "'.'", ")", ";", "}", "else", "if", "(", "qualificationPattern", "==", "null", ")", "{", "return", "simpleNamePattern", ";", "}", "else", "{", "return", "CharOperation", ".", "concat", "(", "qualificationPattern", ",", "simpleNamePattern", ",", "'.'", ")", ";", "}", "}", "protected", "char", "[", "]", "getQualifiedSourceName", "(", "TypeBinding", "binding", ")", "{", "TypeBinding", "type", "=", "binding", "instanceof", "ArrayBinding", "?", "(", "(", "ArrayBinding", ")", "binding", ")", ".", "leafComponentType", ":", "binding", ";", "if", "(", "type", "instanceof", "ReferenceBinding", ")", "{", "if", "(", "type", ".", "isLocalType", "(", ")", ")", "{", "return", "CharOperation", ".", "concat", "(", "qualifiedSourceName", "(", "type", ".", "enclosingType", "(", ")", ")", ",", "new", "char", "[", "]", "{", "'.'", ",", "'1'", ",", "'.'", "}", ",", "binding", ".", "sourceName", "(", ")", ")", ";", "}", "else", "if", "(", "type", ".", "isMemberType", "(", ")", ")", "{", "return", "CharOperation", ".", "concat", "(", "qualifiedSourceName", "(", "type", ".", "enclosingType", "(", ")", ")", ",", "binding", ".", "sourceName", "(", ")", ",", "'.'", ")", ";", "}", "}", "return", "binding", "!=", "null", "?", "binding", ".", "qualifiedSourceName", "(", ")", ":", "null", ";", "}", "protected", "TypeBinding", "getTypeNameBinding", "(", "int", "index", ")", "{", "return", "null", ";", "}", "public", "void", "initializePolymorphicSearch", "(", "MatchLocator", "locator", ")", "{", "}", "public", "int", "match", "(", "Annotation", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "ASTNode", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "ConstructorDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "Expression", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "FieldDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "LocalDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "MethodDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "MemberValuePair", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "MessageSend", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "Reference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "TypeDeclaration", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "TypeParameter", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "public", "int", "match", "(", "TypeReference", "node", ",", "MatchingNodeSet", "nodeSet", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "matchContainer", "(", ")", "{", "return", "ALL_CONTAINER", ";", "}", "protected", "int", "fineGrain", "(", ")", "{", "return", "0", ";", "}", "protected", "boolean", "matchesName", "(", "char", "[", "]", "pattern", ",", "char", "[", "]", "name", ")", "{", "if", "(", "pattern", "==", "null", ")", "return", "true", ";", "if", "(", "name", "==", "null", ")", "return", "false", ";", "return", "matchNameValue", "(", "pattern", ",", "name", ")", "!=", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "matchNameValue", "(", "char", "[", "]", "pattern", ",", "char", "[", "]", "name", ")", "{", "if", "(", "pattern", "==", "null", ")", "return", "ACCURATE_MATCH", ";", "if", "(", "name", "==", "null", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "name", ".", "length", "==", "0", ")", "{", "if", "(", "pattern", ".", "length", "==", "0", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "else", "if", "(", "pattern", ".", "length", "==", "0", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "boolean", "matchFirstChar", "=", "!", "this", ".", "isCaseSensitive", "||", "pattern", "[", "0", "]", "==", "name", "[", "0", "]", ";", "boolean", "sameLength", "=", "pattern", ".", "length", "==", "name", ".", "length", ";", "boolean", "canBePrefix", "=", "name", ".", "length", ">=", "pattern", ".", "length", ";", "switch", "(", "this", ".", "matchMode", ")", "{", "case", "SearchPattern", ".", "R_EXACT_MATCH", ":", "if", "(", "sameLength", "&&", "matchFirstChar", "&&", "CharOperation", ".", "equals", "(", "pattern", ",", "name", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "POSSIBLE_MATCH", "|", "EXACT_FLAVOR", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_PREFIX_MATCH", ":", "if", "(", "canBePrefix", "&&", "matchFirstChar", "&&", "CharOperation", ".", "prefixEquals", "(", "pattern", ",", "name", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "if", "(", "!", "this", ".", "isCaseSensitive", ")", "{", "pattern", "=", "CharOperation", ".", "toLowerCase", "(", "pattern", ")", ";", "}", "if", "(", "CharOperation", ".", "match", "(", "pattern", ",", "name", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_REGEXP_MATCH", ":", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "if", "(", "CharOperation", ".", "camelCaseMatch", "(", "pattern", ",", "name", ",", "false", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "if", "(", "!", "this", ".", "isCaseSensitive", "&&", "CharOperation", ".", "prefixEquals", "(", "pattern", ",", "name", ",", "false", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "if", "(", "CharOperation", ".", "camelCaseMatch", "(", "pattern", ",", "name", ",", "true", ")", ")", "{", "return", "POSSIBLE_MATCH", ";", "}", "break", ";", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "boolean", "matchesTypeReference", "(", "char", "[", "]", "pattern", ",", "TypeReference", "type", ")", "{", "if", "(", "pattern", "==", "null", ")", "return", "true", ";", "if", "(", "type", "==", "null", ")", "return", "true", ";", "char", "[", "]", "[", "]", "compoundName", "=", "type", ".", "getTypeName", "(", ")", ";", "char", "[", "]", "simpleName", "=", "compoundName", "[", "compoundName", ".", "length", "-", "1", "]", ";", "int", "dimensions", "=", "type", ".", "dimensions", "(", ")", "*", "2", ";", "if", "(", "dimensions", ">", "0", ")", "{", "int", "length", "=", "simpleName", ".", "length", ";", "char", "[", "]", "result", "=", "new", "char", "[", "length", "+", "dimensions", "]", ";", "System", ".", "arraycopy", "(", "simpleName", ",", "0", ",", "result", ",", "0", ",", "length", ")", ";", "for", "(", "int", "i", "=", "length", ",", "l", "=", "result", ".", "length", ";", "i", "<", "l", ";", ")", "{", "result", "[", "i", "++", "]", "=", "'['", ";", "result", "[", "i", "++", "]", "=", "']'", ";", "}", "simpleName", "=", "result", ";", "}", "return", "matchesName", "(", "pattern", ",", "simpleName", ")", ";", "}", "protected", "int", "matchLevel", "(", "ImportReference", "importRef", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "void", "matchLevelAndReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "int", "level", "=", "resolveLevel", "(", "binding", ")", ";", "if", "(", "level", ">=", "INACCURATE_MATCH", ")", "{", "matchReportImportRef", "(", "importRef", ",", "binding", ",", "locator", ".", "createImportHandle", "(", "importRef", ")", ",", "level", "==", "ACCURATE_MATCH", "?", "SearchMatch", ".", "A_ACCURATE", ":", "SearchMatch", ".", "A_INACCURATE", ",", "locator", ")", ";", "}", "}", "protected", "void", "matchReportImportRef", "(", "ImportReference", "importRef", ",", "Binding", "binding", ",", "IJavaElement", "element", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "if", "(", "locator", ".", "encloses", "(", "element", ")", ")", "{", "this", ".", "matchReportReference", "(", "importRef", ",", "element", ",", "null", ",", "accuracy", ",", "locator", ")", ";", "}", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "this", ".", "match", "=", "null", ";", "int", "referenceType", "=", "referenceType", "(", ")", ";", "int", "offset", "=", "reference", ".", "sourceStart", ";", "switch", "(", "referenceType", ")", "{", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "this", ".", "match", "=", "locator", ".", "newPackageReferenceMatch", "(", "element", ",", "accuracy", ",", "offset", ",", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ",", "reference", ")", ";", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "this", ".", "match", "=", "locator", ".", "newTypeReferenceMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "offset", ",", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ",", "reference", ")", ";", "break", ";", "case", "IJavaElement", ".", "FIELD", ":", "this", ".", "match", "=", "locator", ".", "newFieldReferenceMatch", "(", "element", ",", "null", ",", "elementBinding", ",", "accuracy", ",", "offset", ",", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ",", "reference", ")", ";", "break", ";", "case", "IJavaElement", ".", "LOCAL_VARIABLE", ":", "this", ".", "match", "=", "locator", ".", "newLocalVariableReferenceMatch", "(", "element", ",", "accuracy", ",", "offset", ",", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ",", "reference", ")", ";", "break", ";", "case", "IJavaElement", ".", "TYPE_PARAMETER", ":", "this", ".", "match", "=", "locator", ".", "newTypeParameterReferenceMatch", "(", "element", ",", "accuracy", ",", "offset", ",", "reference", ".", "sourceEnd", "-", "offset", "+", "1", ",", "reference", ")", ";", "break", ";", "}", "if", "(", "this", ".", "match", "!=", "null", ")", "{", "locator", ".", "report", "(", "this", ".", "match", ")", ";", "}", "}", "protected", "void", "matchReportReference", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "IJavaElement", "localElement", ",", "IJavaElement", "[", "]", "otherElements", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "MatchLocator", "locator", ")", "throws", "CoreException", "{", "matchReportReference", "(", "reference", ",", "element", ",", "elementBinding", ",", "accuracy", ",", "locator", ")", ";", "}", "public", "SearchMatch", "newDeclarationMatch", "(", "ASTNode", "reference", ",", "IJavaElement", "element", ",", "Binding", "elementBinding", ",", "int", "accuracy", ",", "int", "length", ",", "MatchLocator", "locator", ")", "{", "return", "locator", ".", "newDeclarationMatch", "(", "element", ",", "elementBinding", ",", "accuracy", ",", "reference", ".", "sourceStart", ",", "length", ")", ";", "}", "protected", "int", "referenceType", "(", ")", "{", "return", "0", ";", "}", "public", "int", "resolveLevel", "(", "ASTNode", "possibleMatchingNode", ")", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "void", "setFlavors", "(", "int", "flavors", ")", "{", "this", ".", "flavors", "=", "flavors", ";", "}", "protected", "void", "updateMatch", "(", "ParameterizedTypeBinding", "parameterizedBinding", ",", "char", "[", "]", "[", "]", "[", "]", "patternTypeArguments", ",", "MatchLocator", "locator", ")", "{", "if", "(", "locator", ".", "unitScope", "!=", "null", ")", "{", "updateMatch", "(", "parameterizedBinding", ",", "patternTypeArguments", ",", "false", ",", "0", ",", "locator", ")", ";", "}", "}", "protected", "void", "updateMatch", "(", "ParameterizedTypeBinding", "parameterizedBinding", ",", "char", "[", "]", "[", "]", "[", "]", "patternTypeArguments", ",", "boolean", "patternHasTypeParameters", ",", "int", "depth", ",", "MatchLocator", "locator", ")", "{", "if", "(", "locator", ".", "unitScope", "==", "null", ")", "return", ";", "boolean", "endPattern", "=", "patternTypeArguments", "==", "null", "?", "true", ":", "depth", ">=", "patternTypeArguments", ".", "length", ";", "TypeBinding", "[", "]", "argumentsBindings", "=", "parameterizedBinding", ".", "arguments", ";", "boolean", "isRaw", "=", "parameterizedBinding", ".", "isRawType", "(", ")", "||", "(", "argumentsBindings", "==", "null", "&&", "parameterizedBinding", ".", "genericType", "(", ")", ".", "isGenericType", "(", ")", ")", ";", "if", "(", "isRaw", "&&", "!", "this", ".", "match", ".", "isRaw", "(", ")", ")", "{", "this", ".", "match", ".", "setRaw", "(", "isRaw", ")", ";", "}", "if", "(", "!", "endPattern", "&&", "patternTypeArguments", "!=", "null", ")", "{", "if", "(", "!", "isRaw", "&&", "patternHasTypeParameters", "&&", "argumentsBindings", "!=", "null", ")", "{", "boolean", "needUpdate", "=", "false", ";", "TypeVariableBinding", "[", "]", "typeVariables", "=", "parameterizedBinding", ".", "genericType", "(", ")", ".", "typeVariables", "(", ")", ";", "int", "length", "=", "argumentsBindings", ".", "length", ";", "if", "(", "length", "==", "typeVariables", ".", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "argumentsBindings", "[", "i", "]", "!=", "typeVariables", "[", "i", "]", ")", "{", "needUpdate", "=", "true", ";", "break", ";", "}", "}", "}", "if", "(", "needUpdate", ")", "{", "char", "[", "]", "[", "]", "patternArguments", "=", "patternTypeArguments", "[", "depth", "]", ";", "updateMatch", "(", "argumentsBindings", ",", "locator", ",", "patternArguments", ",", "patternHasTypeParameters", ")", ";", "}", "}", "else", "{", "char", "[", "]", "[", "]", "patternArguments", "=", "patternTypeArguments", "[", "depth", "]", ";", "updateMatch", "(", "argumentsBindings", ",", "locator", ",", "patternArguments", ",", "patternHasTypeParameters", ")", ";", "}", "}", "TypeBinding", "enclosingType", "=", "parameterizedBinding", ".", "enclosingType", "(", ")", ";", "if", "(", "enclosingType", "!=", "null", "&&", "(", "enclosingType", ".", "isParameterizedType", "(", ")", "||", "enclosingType", ".", "isRawType", "(", ")", ")", ")", "{", "updateMatch", "(", "(", "ParameterizedTypeBinding", ")", "enclosingType", ",", "patternTypeArguments", ",", "patternHasTypeParameters", ",", "depth", "+", "1", ",", "locator", ")", ";", "}", "}", "protected", "void", "updateMatch", "(", "TypeBinding", "[", "]", "argumentsBinding", ",", "MatchLocator", "locator", ",", "char", "[", "]", "[", "]", "patternArguments", ",", "boolean", "hasTypeParameters", ")", "{", "if", "(", "locator", ".", "unitScope", "==", "null", ")", "return", ";", "int", "patternTypeArgsLength", "=", "patternArguments", "==", "null", "?", "0", ":", "patternArguments", ".", "length", ";", "int", "typeArgumentsLength", "=", "argumentsBinding", "==", "null", "?", "0", ":", "argumentsBinding", ".", "length", ";", "int", "matchRule", "=", "this", ".", "match", ".", "getRule", "(", ")", ";", "if", "(", "this", ".", "match", ".", "isRaw", "(", ")", ")", "{", "if", "(", "patternTypeArgsLength", "!=", "0", ")", "{", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "}", "}", "if", "(", "hasTypeParameters", ")", "{", "matchRule", "=", "SearchPattern", ".", "R_ERASURE_MATCH", ";", "}", "if", "(", "patternTypeArgsLength", "==", "typeArgumentsLength", ")", "{", "if", "(", "!", "this", ".", "match", ".", "isRaw", "(", ")", "&&", "hasTypeParameters", ")", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "return", ";", "}", "}", "else", "{", "if", "(", "patternTypeArgsLength", "==", "0", ")", "{", "if", "(", "!", "this", ".", "match", ".", "isRaw", "(", ")", "||", "hasTypeParameters", ")", "{", "this", ".", "match", ".", "setRule", "(", "matchRule", "&", "~", "SearchPattern", ".", "R_FULL_MATCH", ")", ";", "}", "}", "else", "if", "(", "typeArgumentsLength", "==", "0", ")", "{", "this", ".", "match", ".", "setRule", "(", "matchRule", "&", "~", "SearchPattern", ".", "R_FULL_MATCH", ")", ";", "}", "else", "{", "this", ".", "match", ".", "setRule", "(", "0", ")", ";", "}", "return", ";", "}", "if", "(", "argumentsBinding", "==", "null", "||", "patternArguments", "==", "null", ")", "{", "this", ".", "match", ".", "setRule", "(", "matchRule", ")", ";", "return", ";", "}", "if", "(", "!", "hasTypeParameters", "&&", "!", "this", ".", "match", ".", "isRaw", "(", ")", "&&", "(", "this", ".", "match", ".", "isEquivalent", "(", ")", "||", "this", ".", "match", ".", "isExact", "(", ")", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeArgumentsLength", ";", "i", "++", ")", "{", "TypeBinding", "argumentBinding", "=", "argumentsBinding", "[", "i", "]", ";", "if", "(", "argumentBinding", "instanceof", "CaptureBinding", ")", "{", "WildcardBinding", "capturedWildcard", "=", "(", "(", "CaptureBinding", ")", "argumentBinding", ")", ".", "wildcard", ";", "if", "(", "capturedWildcard", "!=", "null", ")", "argumentBinding", "=", "capturedWildcard", ";", "}", "char", "[", "]", "patternTypeArgument", "=", "patternArguments", "[", "i", "]", ";", "char", "patternWildcard", "=", "patternTypeArgument", "[", "0", "]", ";", "char", "[", "]", "patternTypeName", "=", "patternTypeArgument", ";", "int", "patternWildcardKind", "=", "-", "1", ";", "switch", "(", "patternWildcard", ")", "{", "case", "Signature", ".", "C_STAR", ":", "if", "(", "argumentBinding", ".", "isWildcard", "(", ")", ")", "{", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "argumentBinding", ";", "if", "(", "wildcardBinding", ".", "boundKind", "==", "Wildcard", ".", "UNBOUND", ")", "continue", ";", "}", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "case", "Signature", ".", "C_EXTENDS", ":", "patternWildcardKind", "=", "Wildcard", ".", "EXTENDS", ";", "patternTypeName", "=", "CharOperation", ".", "subarray", "(", "patternTypeArgument", ",", "1", ",", "patternTypeArgument", ".", "length", ")", ";", "break", ";", "case", "Signature", ".", "C_SUPER", ":", "patternWildcardKind", "=", "Wildcard", ".", "SUPER", ";", "patternTypeName", "=", "CharOperation", ".", "subarray", "(", "patternTypeArgument", ",", "1", ",", "patternTypeArgument", ".", "length", ")", ";", "break", ";", "default", ":", "break", ";", "}", "patternTypeName", "=", "Signature", ".", "toCharArray", "(", "patternTypeName", ")", ";", "TypeBinding", "patternBinding", "=", "locator", ".", "getType", "(", "patternTypeArgument", ",", "patternTypeName", ")", ";", "if", "(", "patternBinding", "==", "null", ")", "{", "if", "(", "argumentBinding", ".", "isWildcard", "(", ")", ")", "{", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "argumentBinding", ";", "if", "(", "wildcardBinding", ".", "boundKind", "==", "Wildcard", ".", "UNBOUND", ")", "{", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "}", "else", "{", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "return", ";", "}", "}", "continue", ";", "}", "switch", "(", "patternWildcard", ")", "{", "case", "Signature", ".", "C_STAR", ":", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "case", "Signature", ".", "C_EXTENDS", ":", "if", "(", "argumentBinding", ".", "isWildcard", "(", ")", ")", "{", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "argumentBinding", ";", "if", "(", "wildcardBinding", ".", "boundKind", "==", "patternWildcardKind", "&&", "wildcardBinding", ".", "bound", "==", "patternBinding", ")", "{", "continue", ";", "}", "switch", "(", "wildcardBinding", ".", "boundKind", ")", "{", "case", "Wildcard", ".", "EXTENDS", ":", "if", "(", "wildcardBinding", ".", "bound", "==", "null", "||", "wildcardBinding", ".", "bound", ".", "isCompatibleWith", "(", "patternBinding", ")", ")", "{", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "break", ";", "case", "Wildcard", ".", "SUPER", ":", "break", ";", "case", "Wildcard", ".", "UNBOUND", ":", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "}", "else", "if", "(", "argumentBinding", ".", "isCompatibleWith", "(", "patternBinding", ")", ")", "{", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "break", ";", "case", "Signature", ".", "C_SUPER", ":", "if", "(", "argumentBinding", ".", "isWildcard", "(", ")", ")", "{", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "argumentBinding", ";", "if", "(", "wildcardBinding", ".", "boundKind", "==", "patternWildcardKind", "&&", "wildcardBinding", ".", "bound", "==", "patternBinding", ")", "{", "continue", ";", "}", "switch", "(", "wildcardBinding", ".", "boundKind", ")", "{", "case", "Wildcard", ".", "EXTENDS", ":", "break", ";", "case", "Wildcard", ".", "SUPER", ":", "if", "(", "wildcardBinding", ".", "bound", "==", "null", "||", "patternBinding", ".", "isCompatibleWith", "(", "wildcardBinding", ".", "bound", ")", ")", "{", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "break", ";", "case", "Wildcard", ".", "UNBOUND", ":", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "}", "else", "if", "(", "patternBinding", ".", "isCompatibleWith", "(", "argumentBinding", ")", ")", "{", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "break", ";", "default", ":", "if", "(", "argumentBinding", ".", "isWildcard", "(", ")", ")", "{", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "argumentBinding", ";", "switch", "(", "wildcardBinding", ".", "boundKind", ")", "{", "case", "Wildcard", ".", "EXTENDS", ":", "if", "(", "wildcardBinding", ".", "bound", "==", "null", "||", "patternBinding", ".", "isCompatibleWith", "(", "wildcardBinding", ".", "bound", ")", ")", "{", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "break", ";", "case", "Wildcard", ".", "SUPER", ":", "if", "(", "wildcardBinding", ".", "bound", "==", "null", "||", "wildcardBinding", ".", "bound", ".", "isCompatibleWith", "(", "patternBinding", ")", ")", "{", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "break", ";", "case", "Wildcard", ".", "UNBOUND", ":", "matchRule", "&=", "~", "SearchPattern", ".", "R_FULL_MATCH", ";", "continue", ";", "}", "}", "else", "if", "(", "argumentBinding", "==", "patternBinding", ")", "continue", ";", "break", ";", "}", "this", ".", "match", ".", "setRule", "(", "SearchPattern", ".", "R_ERASURE_MATCH", ")", ";", "return", ";", "}", "}", "this", ".", "match", ".", "setRule", "(", "matchRule", ")", ";", "}", "public", "int", "resolveLevel", "(", "Binding", "binding", ")", "{", "return", "INACCURATE_MATCH", ";", "}", "protected", "int", "resolveLevelForType", "(", "char", "[", "]", "simpleNamePattern", ",", "char", "[", "]", "qualificationPattern", ",", "TypeBinding", "binding", ")", "{", "char", "[", "]", "qualifiedPattern", "=", "getQualifiedPattern", "(", "simpleNamePattern", ",", "qualificationPattern", ")", ";", "int", "level", "=", "resolveLevelForType", "(", "qualifiedPattern", ",", "binding", ")", ";", "if", "(", "level", "==", "ACCURATE_MATCH", "||", "binding", "==", "null", "||", "!", "binding", ".", "isValidBinding", "(", ")", ")", "return", "level", ";", "TypeBinding", "type", "=", "binding", "instanceof", "ArrayBinding", "?", "(", "(", "ArrayBinding", ")", "binding", ")", ".", "leafComponentType", ":", "binding", ";", "char", "[", "]", "sourceName", "=", "null", ";", "if", "(", "type", ".", "isMemberType", "(", ")", "||", "type", ".", "isLocalType", "(", ")", ")", "{", "if", "(", "qualificationPattern", "!=", "null", ")", "{", "sourceName", "=", "getQualifiedSourceName", "(", "binding", ")", ";", "}", "else", "{", "sourceName", "=", "binding", ".", "sourceName", "(", ")", ";", "}", "}", "else", "if", "(", "qualificationPattern", "==", "null", ")", "{", "sourceName", "=", "getQualifiedSourceName", "(", "binding", ")", ";", "}", "if", "(", "sourceName", "==", "null", ")", "return", "IMPOSSIBLE_MATCH", ";", "switch", "(", "this", ".", "matchMode", ")", "{", "case", "SearchPattern", ".", "R_PREFIX_MATCH", ":", "if", "(", "CharOperation", ".", "prefixEquals", "(", "qualifiedPattern", ",", "sourceName", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "if", "(", "(", "qualifiedPattern", ".", "length", ">", "0", "&&", "sourceName", ".", "length", ">", "0", "&&", "qualifiedPattern", "[", "0", "]", "==", "sourceName", "[", "0", "]", ")", ")", "{", "if", "(", "CharOperation", ".", "camelCaseMatch", "(", "qualifiedPattern", ",", "sourceName", ",", "false", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "if", "(", "!", "this", ".", "isCaseSensitive", "&&", "CharOperation", ".", "prefixEquals", "(", "qualifiedPattern", ",", "sourceName", ",", "false", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "}", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "if", "(", "(", "qualifiedPattern", ".", "length", ">", "0", "&&", "sourceName", ".", "length", ">", "0", "&&", "qualifiedPattern", "[", "0", "]", "==", "sourceName", "[", "0", "]", ")", ")", "{", "if", "(", "CharOperation", ".", "camelCaseMatch", "(", "qualifiedPattern", ",", "sourceName", ",", "true", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "}", "break", ";", "default", ":", "if", "(", "CharOperation", ".", "match", "(", "qualifiedPattern", ",", "sourceName", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "return", "ACCURATE_MATCH", ";", "}", "}", "return", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "resolveLevelForType", "(", "char", "[", "]", "qualifiedPattern", ",", "TypeBinding", "type", ")", "{", "if", "(", "qualifiedPattern", "==", "null", ")", "return", "ACCURATE_MATCH", ";", "if", "(", "type", "==", "null", "||", "!", "type", ".", "isValidBinding", "(", ")", ")", "return", "INACCURATE_MATCH", ";", "if", "(", "type", ".", "isTypeVariable", "(", ")", ")", "return", "IMPOSSIBLE_MATCH", ";", "char", "[", "]", "qualifiedPackageName", "=", "type", ".", "qualifiedPackageName", "(", ")", ";", "char", "[", "]", "qualifiedSourceName", "=", "qualifiedSourceName", "(", "type", ")", ";", "char", "[", "]", "fullyQualifiedTypeName", "=", "qualifiedPackageName", ".", "length", "==", "0", "?", "qualifiedSourceName", ":", "CharOperation", ".", "concat", "(", "qualifiedPackageName", ",", "qualifiedSourceName", ",", "'.'", ")", ";", "return", "CharOperation", ".", "match", "(", "qualifiedPattern", ",", "fullyQualifiedTypeName", ",", "this", ".", "isCaseSensitive", ")", "?", "ACCURATE_MATCH", ":", "IMPOSSIBLE_MATCH", ";", "}", "protected", "int", "resolveLevelForType", "(", "char", "[", "]", "simpleNamePattern", ",", "char", "[", "]", "qualificationPattern", ",", "char", "[", "]", "[", "]", "[", "]", "patternTypeArguments", ",", "int", "depth", ",", "TypeBinding", "type", ")", "{", "int", "level", "=", "resolveLevelForType", "(", "simpleNamePattern", ",", "qualificationPattern", ",", "type", ")", ";", "if", "(", "level", "==", "IMPOSSIBLE_MATCH", ")", "return", "IMPOSSIBLE_MATCH", ";", "if", "(", "type", "==", "null", "||", "patternTypeArguments", "==", "null", "||", "patternTypeArguments", ".", "length", "==", "0", "||", "depth", ">=", "patternTypeArguments", ".", "length", ")", "{", "return", "level", ";", "}", "int", "impossible", "=", "this", ".", "isErasureMatch", "?", "ERASURE_MATCH", ":", "IMPOSSIBLE_MATCH", ";", "if", "(", "type", ".", "isGenericType", "(", ")", ")", "{", "TypeVariableBinding", "[", "]", "typeVariables", "=", "null", ";", "if", "(", "type", "instanceof", "SourceTypeBinding", ")", "{", "SourceTypeBinding", "sourceTypeBinding", "=", "(", "SourceTypeBinding", ")", "type", ";", "typeVariables", "=", "sourceTypeBinding", ".", "typeVariables", ";", "}", "else", "if", "(", "type", "instanceof", "BinaryTypeBinding", ")", "{", "BinaryTypeBinding", "binaryTypeBinding", "=", "(", "BinaryTypeBinding", ")", "type", ";", "if", "(", "this", ".", "mustResolve", ")", "typeVariables", "=", "binaryTypeBinding", ".", "typeVariables", "(", ")", ";", "}", "if", "(", "patternTypeArguments", "[", "depth", "]", "!=", "null", "&&", "patternTypeArguments", "[", "depth", "]", ".", "length", ">", "0", "&&", "typeVariables", "!=", "null", "&&", "typeVariables", ".", "length", ">", "0", ")", "{", "if", "(", "typeVariables", ".", "length", "!=", "patternTypeArguments", "[", "depth", "]", ".", "length", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "return", "level", ";", "}", "if", "(", "type", ".", "isRawType", "(", ")", ")", "{", "return", "level", ";", "}", "TypeBinding", "leafType", "=", "type", ".", "leafComponentType", "(", ")", ";", "if", "(", "!", "leafType", ".", "isParameterizedType", "(", ")", ")", "{", "return", "(", "patternTypeArguments", "[", "depth", "]", "==", "null", "||", "patternTypeArguments", "[", "depth", "]", ".", "length", "==", "0", ")", "?", "level", ":", "IMPOSSIBLE_MATCH", ";", "}", "ParameterizedTypeBinding", "paramTypeBinding", "=", "(", "ParameterizedTypeBinding", ")", "leafType", ";", "if", "(", "patternTypeArguments", "[", "depth", "]", "!=", "null", "&&", "patternTypeArguments", "[", "depth", "]", ".", "length", ">", "0", "&&", "paramTypeBinding", ".", "arguments", "!=", "null", "&&", "paramTypeBinding", ".", "arguments", ".", "length", ">", "0", ")", "{", "int", "length", "=", "patternTypeArguments", "[", "depth", "]", ".", "length", ";", "if", "(", "paramTypeBinding", ".", "arguments", ".", "length", "!=", "length", ")", "return", "IMPOSSIBLE_MATCH", ";", "nextTypeArgument", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "[", "]", "patternTypeArgument", "=", "patternTypeArguments", "[", "depth", "]", "[", "i", "]", ";", "TypeBinding", "argTypeBinding", "=", "paramTypeBinding", ".", "arguments", "[", "i", "]", ";", "switch", "(", "patternTypeArgument", "[", "0", "]", ")", "{", "case", "Signature", ".", "C_STAR", ":", "case", "Signature", ".", "C_SUPER", ":", "continue", "nextTypeArgument", ";", "case", "Signature", ".", "C_EXTENDS", ":", "patternTypeArgument", "=", "CharOperation", ".", "subarray", "(", "patternTypeArgument", ",", "1", ",", "patternTypeArgument", ".", "length", ")", ";", "break", ";", "default", ":", "break", ";", "}", "patternTypeArgument", "=", "Signature", ".", "toCharArray", "(", "patternTypeArgument", ")", ";", "if", "(", "!", "this", ".", "isCaseSensitive", ")", "patternTypeArgument", "=", "CharOperation", ".", "toLowerCase", "(", "patternTypeArgument", ")", ";", "boolean", "patternTypeArgHasAnyChars", "=", "CharOperation", ".", "contains", "(", "new", "char", "[", "]", "{", "'*'", ",", "'?'", "}", ",", "patternTypeArgument", ")", ";", "if", "(", "argTypeBinding", "instanceof", "CaptureBinding", ")", "{", "WildcardBinding", "capturedWildcard", "=", "(", "(", "CaptureBinding", ")", "argTypeBinding", ")", ".", "wildcard", ";", "if", "(", "capturedWildcard", "!=", "null", ")", "argTypeBinding", "=", "capturedWildcard", ";", "}", "if", "(", "argTypeBinding", ".", "isWildcard", "(", ")", ")", "{", "WildcardBinding", "wildcardBinding", "=", "(", "WildcardBinding", ")", "argTypeBinding", ";", "switch", "(", "wildcardBinding", ".", "boundKind", ")", "{", "case", "Wildcard", ".", "EXTENDS", ":", "if", "(", "patternTypeArgHasAnyChars", ")", "return", "impossible", ";", "continue", "nextTypeArgument", ";", "case", "Wildcard", ".", "UNBOUND", ":", "continue", "nextTypeArgument", ";", "}", "ReferenceBinding", "boundBinding", "=", "(", "ReferenceBinding", ")", "wildcardBinding", ".", "bound", ";", "if", "(", "CharOperation", ".", "match", "(", "patternTypeArgument", ",", "boundBinding", ".", "shortReadableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", "||", "CharOperation", ".", "match", "(", "patternTypeArgument", ",", "boundBinding", ".", "readableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "continue", "nextTypeArgument", ";", "}", "if", "(", "patternTypeArgHasAnyChars", ")", "return", "impossible", ";", "boundBinding", "=", "boundBinding", ".", "superclass", "(", ")", ";", "while", "(", "boundBinding", "!=", "null", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "patternTypeArgument", ",", "boundBinding", ".", "shortReadableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", "||", "CharOperation", ".", "equals", "(", "patternTypeArgument", ",", "boundBinding", ".", "readableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "continue", "nextTypeArgument", ";", "}", "else", "if", "(", "boundBinding", ".", "isLocalType", "(", ")", "||", "boundBinding", ".", "isMemberType", "(", ")", ")", "{", "if", "(", "CharOperation", ".", "match", "(", "patternTypeArgument", ",", "boundBinding", ".", "sourceName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "continue", "nextTypeArgument", ";", "}", "boundBinding", "=", "boundBinding", ".", "superclass", "(", ")", ";", "}", "return", "impossible", ";", "}", "if", "(", "CharOperation", ".", "match", "(", "patternTypeArgument", ",", "argTypeBinding", ".", "shortReadableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", "||", "CharOperation", ".", "match", "(", "patternTypeArgument", ",", "argTypeBinding", ".", "readableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "continue", "nextTypeArgument", ";", "}", "else", "if", "(", "argTypeBinding", ".", "isLocalType", "(", ")", "||", "argTypeBinding", ".", "isMemberType", "(", ")", ")", "{", "if", "(", "CharOperation", ".", "match", "(", "patternTypeArgument", ",", "argTypeBinding", ".", "sourceName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "continue", "nextTypeArgument", ";", "}", "if", "(", "patternTypeArgHasAnyChars", ")", "return", "impossible", ";", "TypeBinding", "leafTypeBinding", "=", "argTypeBinding", ".", "leafComponentType", "(", ")", ";", "if", "(", "leafTypeBinding", ".", "isBaseType", "(", ")", ")", "return", "impossible", ";", "ReferenceBinding", "refBinding", "=", "(", "(", "ReferenceBinding", ")", "leafTypeBinding", ")", ".", "superclass", "(", ")", ";", "while", "(", "refBinding", "!=", "null", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "patternTypeArgument", ",", "refBinding", ".", "shortReadableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", "||", "CharOperation", ".", "equals", "(", "patternTypeArgument", ",", "refBinding", ".", "readableName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "{", "continue", "nextTypeArgument", ";", "}", "else", "if", "(", "refBinding", ".", "isLocalType", "(", ")", "||", "refBinding", ".", "isMemberType", "(", ")", ")", "{", "if", "(", "CharOperation", ".", "match", "(", "patternTypeArgument", ",", "refBinding", ".", "sourceName", "(", ")", ",", "this", ".", "isCaseSensitive", ")", ")", "continue", "nextTypeArgument", ";", "}", "refBinding", "=", "refBinding", ".", "superclass", "(", ")", ";", "}", "return", "impossible", ";", "}", "}", "TypeBinding", "enclosingType", "=", "paramTypeBinding", ".", "enclosingType", "(", ")", ";", "if", "(", "enclosingType", "!=", "null", "&&", "enclosingType", ".", "isParameterizedType", "(", ")", "&&", "depth", "<", "patternTypeArguments", ".", "length", "&&", "qualificationPattern", "!=", "null", ")", "{", "int", "lastDot", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "qualificationPattern", ")", ";", "char", "[", "]", "enclosingQualificationPattern", "=", "lastDot", "==", "-", "1", "?", "null", ":", "CharOperation", ".", "subarray", "(", "qualificationPattern", ",", "0", ",", "lastDot", ")", ";", "char", "[", "]", "enclosingSimpleNamePattern", "=", "lastDot", "==", "-", "1", "?", "qualificationPattern", ":", "CharOperation", ".", "subarray", "(", "qualificationPattern", ",", "lastDot", "+", "1", ",", "qualificationPattern", ".", "length", ")", ";", "int", "enclosingLevel", "=", "resolveLevelForType", "(", "enclosingSimpleNamePattern", ",", "enclosingQualificationPattern", ",", "patternTypeArguments", ",", "depth", "+", "1", ",", "enclosingType", ")", ";", "if", "(", "enclosingLevel", "==", "impossible", ")", "return", "impossible", ";", "if", "(", "enclosingLevel", "==", "IMPOSSIBLE_MATCH", ")", "return", "IMPOSSIBLE_MATCH", ";", "}", "return", "level", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", ";", "}", "}", "</s>" ]
2,591
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFolder", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathContainer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElementDelta", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModel", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMember", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "ExternalFoldersManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModel", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "JavaSearchScope", "extends", "AbstractJavaSearchScope", "{", "private", "ArrayList", "elements", ";", "private", "ArrayList", "projectPaths", "=", "new", "ArrayList", "(", ")", ";", "private", "int", "[", "]", "projectIndexes", ";", "private", "String", "[", "]", "containerPaths", ";", "private", "String", "[", "]", "relativePaths", ";", "private", "boolean", "[", "]", "isPkgPath", ";", "protected", "AccessRuleSet", "[", "]", "pathRestrictions", ";", "private", "int", "pathsCount", ";", "private", "int", "threshold", ";", "private", "IPath", "[", "]", "enclosingProjectsAndJars", ";", "public", "final", "static", "AccessRuleSet", "NOT_ENCLOSED", "=", "new", "AccessRuleSet", "(", "null", ",", "(", "byte", ")", "0", ",", "null", ")", ";", "public", "JavaSearchScope", "(", ")", "{", "this", "(", "5", ")", ";", "}", "private", "JavaSearchScope", "(", "int", "size", ")", "{", "initialize", "(", "size", ")", ";", "}", "private", "void", "addEnclosingProjectOrJar", "(", "IPath", "path", ")", "{", "int", "length", "=", "this", ".", "enclosingProjectsAndJars", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "enclosingProjectsAndJars", "[", "i", "]", ".", "equals", "(", "path", ")", ")", "return", ";", "}", "System", ".", "arraycopy", "(", "this", ".", "enclosingProjectsAndJars", ",", "0", ",", "this", ".", "enclosingProjectsAndJars", "=", "new", "IPath", "[", "length", "+", "1", "]", ",", "0", ",", "length", ")", ";", "this", ".", "enclosingProjectsAndJars", "[", "length", "]", "=", "path", ";", "}", "public", "void", "add", "(", "JavaProject", "project", ",", "int", "includeMask", ",", "HashSet", "projectsToBeAdded", ")", "throws", "JavaModelException", "{", "add", "(", "project", ",", "null", ",", "includeMask", ",", "projectsToBeAdded", ",", "new", "HashSet", "(", "2", ")", ",", "null", ")", ";", "}", "void", "add", "(", "JavaProject", "javaProject", ",", "IPath", "pathToAdd", ",", "int", "includeMask", ",", "HashSet", "projectsToBeAdded", ",", "HashSet", "visitedProjects", ",", "IClasspathEntry", "referringEntry", ")", "throws", "JavaModelException", "{", "IProject", "project", "=", "javaProject", ".", "getProject", "(", ")", ";", "if", "(", "!", "project", ".", "isAccessible", "(", ")", "||", "!", "visitedProjects", ".", "add", "(", "project", ")", ")", "return", ";", "IPath", "projectPath", "=", "project", ".", "getFullPath", "(", ")", ";", "String", "projectPathString", "=", "projectPath", ".", "toString", "(", ")", ";", "addEnclosingProjectOrJar", "(", "projectPath", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "javaProject", ".", "getResolvedClasspath", "(", ")", ";", "IJavaModel", "model", "=", "javaProject", ".", "getJavaModel", "(", ")", ";", "JavaModelManager", ".", "PerProjectInfo", "perProjectInfo", "=", "javaProject", ".", "getPerProjectInfo", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "entries", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "i", "]", ";", "AccessRuleSet", "access", "=", "null", ";", "ClasspathEntry", "cpEntry", "=", "(", "ClasspathEntry", ")", "entry", ";", "if", "(", "referringEntry", "!=", "null", ")", "{", "if", "(", "!", "entry", ".", "isExported", "(", ")", "&&", "entry", ".", "getEntryKind", "(", ")", "!=", "IClasspathEntry", ".", "CPE_SOURCE", ")", "{", "continue", ";", "}", "cpEntry", "=", "cpEntry", ".", "combineWith", "(", "(", "ClasspathEntry", ")", "referringEntry", ")", ";", "}", "access", "=", "cpEntry", ".", "getAccessRuleSet", "(", ")", ";", "switch", "(", "entry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "IClasspathEntry", "rawEntry", "=", "null", ";", "Map", "rootPathToRawEntries", "=", "perProjectInfo", ".", "rootPathToRawEntries", ";", "if", "(", "rootPathToRawEntries", "!=", "null", ")", "{", "rawEntry", "=", "(", "IClasspathEntry", ")", "rootPathToRawEntries", ".", "get", "(", "entry", ".", "getPath", "(", ")", ")", ";", "}", "if", "(", "rawEntry", "==", "null", ")", "break", ";", "rawKind", ":", "switch", "(", "rawEntry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "case", "IClasspathEntry", ".", "CPE_VARIABLE", ":", "if", "(", "(", "includeMask", "&", "APPLICATION_LIBRARIES", ")", "!=", "0", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "pathToAdd", "==", "null", "||", "pathToAdd", ".", "equals", "(", "path", ")", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "false", ")", ";", "if", "(", "target", "instanceof", "IFolder", ")", "path", "=", "(", "(", "IFolder", ")", "target", ")", ".", "getFullPath", "(", ")", ";", "String", "pathToString", "=", "path", ".", "getDevice", "(", ")", "==", "null", "?", "path", ".", "toString", "(", ")", ":", "path", ".", "toOSString", "(", ")", ";", "add", "(", "projectPath", ".", "toString", "(", ")", ",", "\"\"", ",", "pathToString", ",", "false", ",", "access", ")", ";", "addEnclosingProjectOrJar", "(", "entry", ".", "getPath", "(", ")", ")", ";", "}", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_CONTAINER", ":", "IClasspathContainer", "container", "=", "JavaCore", ".", "getClasspathContainer", "(", "rawEntry", ".", "getPath", "(", ")", ",", "javaProject", ")", ";", "if", "(", "container", "==", "null", ")", "break", ";", "switch", "(", "container", ".", "getKind", "(", ")", ")", "{", "case", "IClasspathContainer", ".", "K_APPLICATION", ":", "if", "(", "(", "includeMask", "&", "APPLICATION_LIBRARIES", ")", "==", "0", ")", "break", "rawKind", ";", "break", ";", "case", "IClasspathContainer", ".", "K_SYSTEM", ":", "case", "IClasspathContainer", ".", "K_DEFAULT_SYSTEM", ":", "if", "(", "(", "includeMask", "&", "SYSTEM_LIBRARIES", ")", "==", "0", ")", "break", "rawKind", ";", "break", ";", "default", ":", "break", "rawKind", ";", "}", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "pathToAdd", "==", "null", "||", "pathToAdd", ".", "equals", "(", "path", ")", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "false", ")", ";", "if", "(", "target", "instanceof", "IFolder", ")", "path", "=", "(", "(", "IFolder", ")", "target", ")", ".", "getFullPath", "(", ")", ";", "String", "pathToString", "=", "path", ".", "getDevice", "(", ")", "==", "null", "?", "path", ".", "toString", "(", ")", ":", "path", ".", "toOSString", "(", ")", ";", "add", "(", "projectPath", ".", "toString", "(", ")", ",", "\"\"", ",", "pathToString", ",", "false", ",", "access", ")", ";", "addEnclosingProjectOrJar", "(", "entry", ".", "getPath", "(", ")", ")", ";", "}", "break", ";", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "if", "(", "(", "includeMask", "&", "REFERENCED_PROJECTS", ")", "!=", "0", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "pathToAdd", "==", "null", "||", "pathToAdd", ".", "equals", "(", "path", ")", ")", "{", "JavaProject", "referencedProject", "=", "(", "JavaProject", ")", "model", ".", "getJavaProject", "(", "path", ".", "lastSegment", "(", ")", ")", ";", "if", "(", "!", "projectsToBeAdded", ".", "contains", "(", "referencedProject", ")", ")", "{", "add", "(", "referencedProject", ",", "null", ",", "includeMask", ",", "projectsToBeAdded", ",", "visitedProjects", ",", "cpEntry", ")", ";", "}", "}", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "if", "(", "(", "includeMask", "&", "SOURCES", ")", "!=", "0", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "pathToAdd", "==", "null", "||", "pathToAdd", ".", "equals", "(", "path", ")", ")", "{", "add", "(", "projectPath", ".", "toString", "(", ")", ",", "Util", ".", "relativePath", "(", "path", ",", "1", ")", ",", "projectPathString", ",", "false", ",", "access", ")", ";", "}", "}", "break", ";", "}", "}", "}", "public", "void", "add", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "IPath", "containerPath", "=", "null", ";", "String", "containerPathToString", "=", "null", ";", "PackageFragmentRoot", "root", "=", "null", ";", "int", "includeMask", "=", "SOURCES", "|", "APPLICATION_LIBRARIES", "|", "SYSTEM_LIBRARIES", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "break", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "add", "(", "(", "JavaProject", ")", "element", ",", "null", ",", "includeMask", ",", "new", "HashSet", "(", "2", ")", ",", "new", "HashSet", "(", "2", ")", ",", "null", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "root", "=", "(", "PackageFragmentRoot", ")", "element", ";", "IPath", "rootPath", "=", "root", ".", "internalPath", "(", ")", ";", "containerPath", "=", "root", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_SOURCE", "?", "root", ".", "getParent", "(", ")", ".", "getPath", "(", ")", ":", "rootPath", ";", "containerPathToString", "=", "containerPath", ".", "getDevice", "(", ")", "==", "null", "?", "containerPath", ".", "toString", "(", ")", ":", "containerPath", ".", "toOSString", "(", ")", ";", "IResource", "rootResource", "=", "root", ".", "resource", "(", ")", ";", "String", "projectPath", "=", "root", ".", "getJavaProject", "(", ")", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "rootResource", "!=", "null", "&&", "rootResource", ".", "isAccessible", "(", ")", ")", "{", "String", "relativePath", "=", "Util", ".", "relativePath", "(", "rootResource", ".", "getFullPath", "(", ")", ",", "containerPath", ".", "segmentCount", "(", ")", ")", ";", "add", "(", "projectPath", ",", "relativePath", ",", "containerPathToString", ",", "false", ",", "null", ")", ";", "}", "else", "{", "add", "(", "projectPath", ",", "\"\"", ",", "containerPathToString", ",", "false", ",", "null", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "root", "=", "(", "PackageFragmentRoot", ")", "element", ".", "getParent", "(", ")", ";", "projectPath", "=", "root", ".", "getJavaProject", "(", ")", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "String", "relativePath", "=", "Util", ".", "concatWith", "(", "(", "(", "PackageFragment", ")", "element", ")", ".", "names", ",", "'/'", ")", ";", "containerPath", "=", "root", ".", "getPath", "(", ")", ";", "containerPathToString", "=", "containerPath", ".", "getDevice", "(", ")", "==", "null", "?", "containerPath", ".", "toString", "(", ")", ":", "containerPath", ".", "toOSString", "(", ")", ";", "add", "(", "projectPath", ",", "relativePath", ",", "containerPathToString", ",", "true", ",", "null", ")", ";", "}", "else", "{", "IResource", "resource", "=", "(", "(", "JavaElement", ")", "element", ")", ".", "resource", "(", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "if", "(", "resource", ".", "isAccessible", "(", ")", ")", "{", "containerPath", "=", "root", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_SOURCE", "?", "root", ".", "getParent", "(", ")", ".", "getPath", "(", ")", ":", "root", ".", "internalPath", "(", ")", ";", "}", "else", "{", "containerPath", "=", "resource", ".", "getParent", "(", ")", ".", "getFullPath", "(", ")", ";", "}", "containerPathToString", "=", "containerPath", ".", "getDevice", "(", ")", "==", "null", "?", "containerPath", ".", "toString", "(", ")", ":", "containerPath", ".", "toOSString", "(", ")", ";", "String", "relativePath", "=", "Util", ".", "relativePath", "(", "resource", ".", "getFullPath", "(", ")", ",", "containerPath", ".", "segmentCount", "(", ")", ")", ";", "add", "(", "projectPath", ",", "relativePath", ",", "containerPathToString", ",", "true", ",", "null", ")", ";", "}", "}", "break", ";", "default", ":", "if", "(", "element", "instanceof", "IMember", ")", "{", "if", "(", "this", ".", "elements", "==", "null", ")", "{", "this", ".", "elements", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "elements", ".", "add", "(", "element", ")", ";", "}", "root", "=", "(", "PackageFragmentRoot", ")", "element", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "projectPath", "=", "root", ".", "getJavaProject", "(", ")", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "String", "relativePath", ";", "if", "(", "root", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_SOURCE", ")", "{", "containerPath", "=", "root", ".", "getParent", "(", ")", ".", "getPath", "(", ")", ";", "relativePath", "=", "Util", ".", "relativePath", "(", "getPath", "(", "element", ",", "false", ")", ",", "1", ")", ";", "}", "else", "{", "containerPath", "=", "root", ".", "internalPath", "(", ")", ";", "relativePath", "=", "getPath", "(", "element", ",", "true", ")", ".", "toString", "(", ")", ";", "}", "containerPathToString", "=", "containerPath", ".", "getDevice", "(", ")", "==", "null", "?", "containerPath", ".", "toString", "(", ")", ":", "containerPath", ".", "toOSString", "(", ")", ";", "add", "(", "projectPath", ",", "relativePath", ",", "containerPathToString", ",", "false", ",", "null", ")", ";", "}", "if", "(", "root", "!=", "null", ")", "addEnclosingProjectOrJar", "(", "root", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_SOURCE", "?", "root", ".", "getParent", "(", ")", ".", "getPath", "(", ")", ":", "root", ".", "getPath", "(", ")", ")", ";", "}", "private", "void", "add", "(", "String", "projectPath", ",", "String", "relativePath", ",", "String", "containerPath", ",", "boolean", "isPackage", ",", "AccessRuleSet", "access", ")", "{", "containerPath", "=", "normalize", "(", "containerPath", ")", ";", "relativePath", "=", "normalize", "(", "relativePath", ")", ";", "int", "length", "=", "this", ".", "containerPaths", ".", "length", ",", "index", "=", "(", "containerPath", ".", "hashCode", "(", ")", "&", "0x7FFFFFFF", ")", "%", "length", ";", "String", "currentRelativePath", ",", "currentContainerPath", ";", "while", "(", "(", "currentRelativePath", "=", "this", ".", "relativePaths", "[", "index", "]", ")", "!=", "null", "&&", "(", "currentContainerPath", "=", "this", ".", "containerPaths", "[", "index", "]", ")", "!=", "null", ")", "{", "if", "(", "currentRelativePath", ".", "equals", "(", "relativePath", ")", "&&", "currentContainerPath", ".", "equals", "(", "containerPath", ")", ")", "return", ";", "if", "(", "++", "index", "==", "length", ")", "{", "index", "=", "0", ";", "}", "}", "int", "idx", "=", "this", ".", "projectPaths", ".", "indexOf", "(", "projectPath", ")", ";", "if", "(", "idx", "==", "-", "1", ")", "{", "this", ".", "projectPaths", ".", "add", "(", "projectPath", ")", ";", "idx", "=", "this", ".", "projectPaths", ".", "indexOf", "(", "projectPath", ")", ";", "}", "this", ".", "projectIndexes", "[", "index", "]", "=", "idx", ";", "this", ".", "relativePaths", "[", "index", "]", "=", "relativePath", ";", "this", ".", "containerPaths", "[", "index", "]", "=", "containerPath", ";", "this", ".", "isPkgPath", "[", "index", "]", "=", "isPackage", ";", "if", "(", "this", ".", "pathRestrictions", "!=", "null", ")", "this", ".", "pathRestrictions", "[", "index", "]", "=", "access", ";", "else", "if", "(", "access", "!=", "null", ")", "{", "this", ".", "pathRestrictions", "=", "new", "AccessRuleSet", "[", "this", ".", "relativePaths", ".", "length", "]", ";", "this", ".", "pathRestrictions", "[", "index", "]", "=", "access", ";", "}", "if", "(", "++", "this", ".", "pathsCount", ">", "this", ".", "threshold", ")", "rehash", "(", ")", ";", "}", "public", "boolean", "encloses", "(", "String", "resourcePathString", ")", "{", "int", "separatorIndex", "=", "resourcePathString", ".", "indexOf", "(", "JAR_FILE_ENTRY_SEPARATOR", ")", ";", "if", "(", "separatorIndex", "!=", "-", "1", ")", "{", "String", "jarPath", "=", "resourcePathString", ".", "substring", "(", "0", ",", "separatorIndex", ")", ";", "String", "relativePath", "=", "resourcePathString", ".", "substring", "(", "separatorIndex", "+", "1", ")", ";", "return", "indexOf", "(", "jarPath", ",", "relativePath", ")", ">=", "0", ";", "}", "return", "indexOf", "(", "resourcePathString", ")", ">=", "0", ";", "}", "private", "int", "indexOf", "(", "String", "fullPath", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "relativePaths", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "currentRelativePath", "=", "this", ".", "relativePaths", "[", "i", "]", ";", "if", "(", "currentRelativePath", "==", "null", ")", "continue", ";", "String", "currentContainerPath", "=", "this", ".", "containerPaths", "[", "i", "]", ";", "String", "currentFullPath", "=", "currentRelativePath", ".", "length", "(", ")", "==", "0", "?", "currentContainerPath", ":", "(", "currentContainerPath", "+", "'/'", "+", "currentRelativePath", ")", ";", "if", "(", "encloses", "(", "currentFullPath", ",", "fullPath", ",", "i", ")", ")", "return", "i", ";", "}", "return", "-", "1", ";", "}", "private", "int", "indexOf", "(", "String", "containerPath", ",", "String", "relativePath", ")", "{", "int", "length", "=", "this", ".", "containerPaths", ".", "length", ",", "index", "=", "(", "containerPath", ".", "hashCode", "(", ")", "&", "0x7FFFFFFF", ")", "%", "length", ";", "String", "currentContainerPath", ";", "while", "(", "(", "currentContainerPath", "=", "this", ".", "containerPaths", "[", "index", "]", ")", "!=", "null", ")", "{", "if", "(", "currentContainerPath", ".", "equals", "(", "containerPath", ")", ")", "{", "String", "currentRelativePath", "=", "this", ".", "relativePaths", "[", "index", "]", ";", "if", "(", "encloses", "(", "currentRelativePath", ",", "relativePath", ",", "index", ")", ")", "return", "index", ";", "}", "if", "(", "++", "index", "==", "length", ")", "{", "index", "=", "0", ";", "}", "}", "return", "-", "1", ";", "}", "private", "boolean", "encloses", "(", "String", "enclosingPath", ",", "String", "path", ",", "int", "index", ")", "{", "path", "=", "normalize", "(", "path", ")", ";", "int", "pathLength", "=", "path", ".", "length", "(", ")", ";", "int", "enclosingLength", "=", "enclosingPath", ".", "length", "(", ")", ";", "if", "(", "pathLength", "<", "enclosingLength", ")", "{", "return", "false", ";", "}", "if", "(", "enclosingLength", "==", "0", ")", "{", "return", "true", ";", "}", "if", "(", "pathLength", "==", "enclosingLength", ")", "{", "return", "path", ".", "equals", "(", "enclosingPath", ")", ";", "}", "if", "(", "!", "this", ".", "isPkgPath", "[", "index", "]", ")", "{", "return", "path", ".", "startsWith", "(", "enclosingPath", ")", "&&", "path", ".", "charAt", "(", "enclosingLength", ")", "==", "'/'", ";", "}", "else", "{", "if", "(", "path", ".", "startsWith", "(", "enclosingPath", ")", "&&", "(", "(", "enclosingPath", ".", "length", "(", ")", "==", "path", ".", "lastIndexOf", "(", "'/'", ")", ")", "||", "(", "enclosingPath", ".", "length", "(", ")", "==", "path", ".", "length", "(", ")", ")", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "encloses", "(", "IJavaElement", "element", ")", "{", "if", "(", "this", ".", "elements", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "elements", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "scopeElement", "=", "(", "IJavaElement", ")", "this", ".", "elements", ".", "get", "(", "i", ")", ";", "IJavaElement", "searchedElement", "=", "element", ";", "while", "(", "searchedElement", "!=", "null", ")", "{", "if", "(", "searchedElement", ".", "equals", "(", "scopeElement", ")", ")", "return", "true", ";", "searchedElement", "=", "searchedElement", ".", "getParent", "(", ")", ";", "}", "}", "return", "false", ";", "}", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "element", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "if", "(", "root", "!=", "null", "&&", "root", ".", "isArchive", "(", ")", ")", "{", "IPath", "rootPath", "=", "root", ".", "getPath", "(", ")", ";", "String", "rootPathToString", "=", "rootPath", ".", "getDevice", "(", ")", "==", "null", "?", "rootPath", ".", "toString", "(", ")", ":", "rootPath", ".", "toOSString", "(", ")", ";", "IPath", "relativePath", "=", "getPath", "(", "element", ",", "true", ")", ";", "return", "indexOf", "(", "rootPathToString", ",", "relativePath", ".", "toString", "(", ")", ")", ">=", "0", ";", "}", "String", "fullResourcePathString", "=", "getPath", "(", "element", ",", "false", ")", ".", "toString", "(", ")", ";", "return", "indexOf", "(", "fullResourcePathString", ")", ">=", "0", ";", "}", "public", "IPath", "[", "]", "enclosingProjectsAndJars", "(", ")", "{", "return", "this", ".", "enclosingProjectsAndJars", ";", "}", "private", "IPath", "getPath", "(", "IJavaElement", "element", ",", "boolean", "relativeToRoot", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "return", "Path", ".", "EMPTY", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "return", "element", ".", "getPath", "(", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "if", "(", "relativeToRoot", ")", "return", "Path", ".", "EMPTY", ";", "return", "element", ".", "getPath", "(", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "String", "relativePath", "=", "Util", ".", "concatWith", "(", "(", "(", "PackageFragment", ")", "element", ")", ".", "names", ",", "'/'", ")", ";", "return", "getPath", "(", "element", ".", "getParent", "(", ")", ",", "relativeToRoot", ")", ".", "append", "(", "new", "Path", "(", "relativePath", ")", ")", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "case", "IJavaElement", ".", "CLASS_FILE", ":", "return", "getPath", "(", "element", ".", "getParent", "(", ")", ",", "relativeToRoot", ")", ".", "append", "(", "new", "Path", "(", "element", ".", "getElementName", "(", ")", ")", ")", ";", "default", ":", "return", "getPath", "(", "element", ".", "getParent", "(", ")", ",", "relativeToRoot", ")", ";", "}", "}", "public", "AccessRuleSet", "getAccessRuleSet", "(", "String", "relativePath", ",", "String", "containerPath", ")", "{", "int", "index", "=", "indexOf", "(", "containerPath", ",", "relativePath", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "return", "NOT_ENCLOSED", ";", "}", "if", "(", "this", ".", "pathRestrictions", "==", "null", ")", "return", "null", ";", "return", "this", ".", "pathRestrictions", "[", "index", "]", ";", "}", "protected", "void", "initialize", "(", "int", "size", ")", "{", "this", ".", "pathsCount", "=", "0", ";", "this", ".", "threshold", "=", "size", ";", "int", "extraRoom", "=", "(", "int", ")", "(", "size", "*", "1.75f", ")", ";", "if", "(", "this", ".", "threshold", "==", "extraRoom", ")", "extraRoom", "++", ";", "this", ".", "relativePaths", "=", "new", "String", "[", "extraRoom", "]", ";", "this", ".", "containerPaths", "=", "new", "String", "[", "extraRoom", "]", ";", "this", ".", "projectPaths", "=", "new", "ArrayList", "(", ")", ";", "this", ".", "projectIndexes", "=", "new", "int", "[", "extraRoom", "]", ";", "this", ".", "isPkgPath", "=", "new", "boolean", "[", "extraRoom", "]", ";", "this", ".", "pathRestrictions", "=", "null", ";", "this", ".", "enclosingProjectsAndJars", "=", "new", "IPath", "[", "0", "]", ";", "}", "private", "String", "normalize", "(", "String", "path", ")", "{", "int", "pathLength", "=", "path", ".", "length", "(", ")", ";", "int", "index", "=", "pathLength", "-", "1", ";", "while", "(", "index", ">=", "0", "&&", "path", ".", "charAt", "(", "index", ")", "==", "'/'", ")", "index", "--", ";", "if", "(", "index", "!=", "pathLength", "-", "1", ")", "return", "path", ".", "substring", "(", "0", ",", "index", "+", "1", ")", ";", "return", "path", ";", "}", "public", "void", "processDelta", "(", "IJavaElementDelta", "delta", ",", "int", "eventType", ")", "{", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "CHANGED", ":", "IJavaElementDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElementDelta", "child", "=", "children", "[", "i", "]", ";", "processDelta", "(", "child", ",", "eventType", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "IJavaElement", "element", "=", "delta", ".", "getElement", "(", ")", ";", "if", "(", "this", ".", "encloses", "(", "element", ")", ")", "{", "if", "(", "this", ".", "elements", "!=", "null", ")", "{", "this", ".", "elements", ".", "remove", "(", "element", ")", ";", "}", "String", "path", "=", "null", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "path", "=", "(", "(", "IJavaProject", ")", "element", ")", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "path", "=", "(", "(", "IPackageFragmentRoot", ")", "element", ")", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "break", ";", "default", ":", "return", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "pathsCount", ";", "i", "++", ")", "{", "if", "(", "this", ".", "relativePaths", "[", "i", "]", ".", "equals", "(", "path", ")", ")", "{", "this", ".", "relativePaths", "[", "i", "]", "=", "null", ";", "rehash", "(", ")", ";", "break", ";", "}", "}", "}", "break", ";", "}", "}", "public", "IPackageFragmentRoot", "packageFragmentRoot", "(", "String", "resourcePathString", ",", "int", "jarSeparatorIndex", ",", "String", "jarPath", ")", "{", "int", "index", "=", "-", "1", ";", "boolean", "isJarFile", "=", "jarSeparatorIndex", "!=", "-", "1", ";", "if", "(", "isJarFile", ")", "{", "String", "relativePath", "=", "resourcePathString", ".", "substring", "(", "jarSeparatorIndex", "+", "1", ")", ";", "index", "=", "indexOf", "(", "jarPath", ",", "relativePath", ")", ";", "}", "else", "{", "index", "=", "indexOf", "(", "resourcePathString", ")", ";", "}", "if", "(", "index", ">=", "0", ")", "{", "int", "idx", "=", "this", ".", "projectIndexes", "[", "index", "]", ";", "String", "projectPath", "=", "idx", "==", "-", "1", "?", "null", ":", "(", "String", ")", "this", ".", "projectPaths", ".", "get", "(", "idx", ")", ";", "if", "(", "projectPath", "!=", "null", ")", "{", "IJavaProject", "project", "=", "JavaCore", ".", "create", "(", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProject", "(", "projectPath", ")", ")", ";", "if", "(", "isJarFile", ")", "{", "IResource", "resource", "=", "JavaModel", ".", "getWorkspaceTarget", "(", "new", "Path", "(", "jarPath", ")", ")", ";", "if", "(", "resource", "!=", "null", ")", "return", "project", ".", "getPackageFragmentRoot", "(", "resource", ")", ";", "return", "project", ".", "getPackageFragmentRoot", "(", "jarPath", ")", ";", "}", "Object", "target", "=", "JavaModel", ".", "getWorkspaceTarget", "(", "new", "Path", "(", "this", ".", "containerPaths", "[", "index", "]", "+", "'/'", "+", "this", ".", "relativePaths", "[", "index", "]", ")", ")", ";", "if", "(", "target", "!=", "null", ")", "{", "if", "(", "target", "instanceof", "IProject", ")", "{", "return", "project", ".", "getPackageFragmentRoot", "(", "(", "IProject", ")", "target", ")", ";", "}", "IJavaElement", "element", "=", "JavaModelManager", ".", "create", "(", "(", "IResource", ")", "target", ",", "project", ")", ";", "return", "(", "IPackageFragmentRoot", ")", "element", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "}", "}", "}", "return", "null", ";", "}", "private", "void", "rehash", "(", ")", "{", "JavaSearchScope", "newScope", "=", "new", "JavaSearchScope", "(", "this", ".", "pathsCount", "*", "2", ")", ";", "newScope", ".", "projectPaths", ".", "ensureCapacity", "(", "this", ".", "projectPaths", ".", "size", "(", ")", ")", ";", "String", "currentPath", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "relativePaths", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "if", "(", "(", "currentPath", "=", "this", ".", "relativePaths", "[", "i", "]", ")", "!=", "null", ")", "{", "int", "idx", "=", "this", ".", "projectIndexes", "[", "i", "]", ";", "String", "projectPath", "=", "idx", "==", "-", "1", "?", "null", ":", "(", "String", ")", "this", ".", "projectPaths", ".", "get", "(", "idx", ")", ";", "newScope", ".", "add", "(", "projectPath", ",", "currentPath", ",", "this", ".", "containerPaths", "[", "i", "]", ",", "this", ".", "isPkgPath", "[", "i", "]", ",", "this", ".", "pathRestrictions", "==", "null", "?", "null", ":", "this", ".", "pathRestrictions", "[", "i", "]", ")", ";", "}", "this", ".", "relativePaths", "=", "newScope", ".", "relativePaths", ";", "this", ".", "containerPaths", "=", "newScope", ".", "containerPaths", ";", "this", ".", "projectPaths", "=", "newScope", ".", "projectPaths", ";", "this", ".", "projectIndexes", "=", "newScope", ".", "projectIndexes", ";", "this", ".", "isPkgPath", "=", "newScope", ".", "isPkgPath", ";", "this", ".", "pathRestrictions", "=", "newScope", ".", "pathRestrictions", ";", "this", ".", "threshold", "=", "newScope", ".", "threshold", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "if", "(", "this", ".", "elements", "!=", "null", ")", "{", "result", ".", "append", "(", "\"[\"", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "elements", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JavaElement", "element", "=", "(", "JavaElement", ")", "this", ".", "elements", ".", "get", "(", "i", ")", ";", "result", ".", "append", "(", "\"nt\"", ")", ";", "result", ".", "append", "(", "element", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "result", ".", "append", "(", "\"n]\"", ")", ";", "}", "else", "{", "if", "(", "this", ".", "pathsCount", "==", "0", ")", "{", "result", ".", "append", "(", "\"\"", ")", ";", "}", "else", "{", "result", ".", "append", "(", "\"[\"", ")", ";", "String", "[", "]", "paths", "=", "new", "String", "[", "this", ".", "relativePaths", ".", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "relativePaths", ".", "length", ";", "i", "++", ")", "{", "String", "path", "=", "this", ".", "relativePaths", "[", "i", "]", ";", "if", "(", "path", "==", "null", ")", "continue", ";", "String", "containerPath", ";", "if", "(", "ExternalFoldersManager", ".", "isInternalPathForExternalFolder", "(", "new", "Path", "(", "this", ".", "containerPaths", "[", "i", "]", ")", ")", ")", "{", "Object", "target", "=", "JavaModel", ".", "getWorkspaceTarget", "(", "new", "Path", "(", "this", ".", "containerPaths", "[", "i", "]", ")", ")", ";", "containerPath", "=", "(", "(", "IFolder", ")", "target", ")", ".", "getLocation", "(", ")", ".", "toOSString", "(", ")", ";", "}", "else", "{", "containerPath", "=", "this", ".", "containerPaths", "[", "i", "]", ";", "}", "if", "(", "path", ".", "length", "(", ")", ">", "0", ")", "{", "paths", "[", "index", "++", "]", "=", "containerPath", "+", "'/'", "+", "path", ";", "}", "else", "{", "paths", "[", "index", "++", "]", "=", "containerPath", ";", "}", "}", "System", ".", "arraycopy", "(", "paths", ",", "0", ",", "paths", "=", "new", "String", "[", "index", "]", ",", "0", ",", "index", ")", ";", "Util", ".", "sort", "(", "paths", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "index", ";", "i", "++", ")", "{", "result", ".", "append", "(", "\"nt\"", ")", ";", "result", ".", "append", "(", "paths", "[", "i", "]", ")", ";", "}", "result", ".", "append", "(", "\"n]\"", ")", ";", "}", "}", "return", "result", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
2,592
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "IndexLocation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "BinaryIndexer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "SourceIndexer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocator", ";", "public", "class", "JavaSearchParticipant", "extends", "SearchParticipant", "{", "private", "ThreadLocal", "indexSelector", "=", "new", "ThreadLocal", "(", ")", ";", "public", "void", "beginSearching", "(", ")", "{", "super", ".", "beginSearching", "(", ")", ";", "this", ".", "indexSelector", ".", "set", "(", "null", ")", ";", "}", "public", "void", "doneSearching", "(", ")", "{", "this", ".", "indexSelector", ".", "set", "(", "null", ")", ";", "super", ".", "doneSearching", "(", ")", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "\"Java\"", ";", "}", "public", "SearchDocument", "getDocument", "(", "String", "documentPath", ")", "{", "return", "new", "JavaSearchDocument", "(", "documentPath", ",", "this", ")", ";", "}", "public", "void", "indexDocument", "(", "SearchDocument", "document", ",", "IPath", "indexPath", ")", "{", "document", ".", "removeAllIndexEntries", "(", ")", ";", "String", "documentPath", "=", "document", ".", "getPath", "(", ")", ";", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "documentPath", ")", ")", "{", "new", "SourceIndexer", "(", "document", ")", ".", "indexDocument", "(", ")", ";", "}", "else", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "documentPath", ")", ")", "{", "new", "BinaryIndexer", "(", "document", ")", ".", "indexDocument", "(", ")", ";", "}", "}", "public", "void", "locateMatches", "(", "SearchDocument", "[", "]", "indexMatches", ",", "SearchPattern", "pattern", ",", "IJavaSearchScope", "scope", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "MatchLocator", "matchLocator", "=", "new", "MatchLocator", "(", "pattern", ",", "requestor", ",", "scope", ",", "monitor", ")", ";", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "matchLocator", ".", "locateMatches", "(", "indexMatches", ")", ";", "}", "public", "IPath", "[", "]", "selectIndexes", "(", "SearchPattern", "pattern", ",", "IJavaSearchScope", "scope", ")", "{", "IndexSelector", "selector", "=", "(", "IndexSelector", ")", "this", ".", "indexSelector", ".", "get", "(", ")", ";", "if", "(", "selector", "==", "null", ")", "{", "selector", "=", "new", "IndexSelector", "(", "scope", ",", "pattern", ")", ";", "this", ".", "indexSelector", ".", "set", "(", "selector", ")", ";", "}", "IndexLocation", "[", "]", "urls", "=", "selector", ".", "getIndexLocations", "(", ")", ";", "IPath", "[", "]", "paths", "=", "new", "IPath", "[", "urls", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "urls", ".", "length", ";", "i", "++", ")", "{", "paths", "[", "i", "]", "=", "new", "Path", "(", "urls", "[", "i", "]", ".", "getIndexFile", "(", ")", ".", "getPath", "(", ")", ")", ";", "}", "return", "paths", ";", "}", "public", "IndexLocation", "[", "]", "selectIndexURLs", "(", "SearchPattern", "pattern", ",", "IJavaSearchScope", "scope", ")", "{", "IndexSelector", "selector", "=", "(", "IndexSelector", ")", "this", ".", "indexSelector", ".", "get", "(", ")", ";", "if", "(", "selector", "==", "null", ")", "{", "selector", "=", "new", "IndexSelector", "(", "scope", ",", "pattern", ")", ";", "this", ".", "indexSelector", ".", "set", "(", "selector", ")", ";", "}", "return", "selector", ".", "getIndexLocations", "(", ")", ";", "}", "}", "</s>" ]
2,593
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElementDelta", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "public", "abstract", "class", "AbstractSearchScope", "implements", "IJavaSearchScope", "{", "public", "boolean", "includesBinaries", "(", ")", "{", "return", "true", ";", "}", "public", "boolean", "includesClasspaths", "(", ")", "{", "return", "true", ";", "}", "public", "abstract", "void", "processDelta", "(", "IJavaElementDelta", "delta", ",", "int", "eventType", ")", ";", "public", "void", "setIncludesBinaries", "(", "boolean", "includesBinaries", ")", "{", "}", "public", "void", "setIncludesClasspaths", "(", "boolean", "includesClasspaths", ")", "{", "}", "}", "</s>" ]
2,594
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ";", "public", "interface", "IExtendedCompletionRequestor", "extends", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompletionRequestor", "{", "void", "acceptPotentialMethodDeclaration", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", ";", "}", "</s>" ]
2,595
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CategorizedProblem", ";", "public", "interface", "ISelectionRequestor", "{", "void", "acceptType", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "annotationName", ",", "int", "modifiers", ",", "boolean", "isDeclaration", ",", "char", "[", "]", "genericTypeSignature", ",", "int", "start", ",", "int", "end", ")", ";", "void", "acceptError", "(", "CategorizedProblem", "error", ")", ";", "void", "acceptField", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "name", ",", "boolean", "isDeclaration", ",", "char", "[", "]", "uniqueKey", ",", "int", "start", ",", "int", "end", ")", ";", "void", "acceptMethod", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "String", "enclosingDeclaringTypeSignature", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "String", "[", "]", "parameterSignatures", ",", "char", "[", "]", "[", "]", "typeParameterNames", ",", "char", "[", "]", "[", "]", "[", "]", "typeParameterBoundNames", ",", "boolean", "isConstructor", ",", "boolean", "isDeclaration", ",", "char", "[", "]", "uniqueKey", ",", "int", "start", ",", "int", "end", ")", ";", "void", "acceptPackage", "(", "char", "[", "]", "packageName", ")", ";", "void", "acceptTypeParameter", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "typeParameterName", ",", "boolean", "isDeclaration", ",", "int", "start", ",", "int", "end", ")", ";", "void", "acceptMethodTypeParameter", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "int", "selectorStart", ",", "int", "selectorEnd", ",", "char", "[", "]", "typeParameterName", ",", "boolean", "isDeclaration", ",", "int", "start", ",", "int", "end", ")", ";", "}", "</s>" ]
2,596
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "complete", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "JavadocMessageSend", ";", "public", "class", "CompletionOnJavadocMessageSend", "extends", "JavadocMessageSend", "implements", "CompletionOnJavadoc", "{", "public", "int", "completionFlags", "=", "JAVADOC", ";", "public", "int", "separatorPosition", ";", "public", "CompletionOnJavadocMessageSend", "(", "JavadocMessageSend", "method", ",", "int", "position", ")", "{", "super", "(", "method", ".", "selector", ",", "method", ".", "nameSourcePosition", ")", ";", "this", ".", "arguments", "=", "method", ".", "arguments", ";", "this", ".", "receiver", "=", "method", ".", "receiver", ";", "this", ".", "sourceEnd", "=", "method", ".", "sourceEnd", ";", "this", ".", "tagValue", "=", "method", ".", "tagValue", ";", "this", ".", "separatorPosition", "=", "position", ";", "}", "public", "CompletionOnJavadocMessageSend", "(", "JavadocMessageSend", "method", ",", "int", "position", ",", "int", "flags", ")", "{", "this", "(", "method", ",", "position", ")", ";", "this", ".", "completionFlags", "|=", "flags", ";", "}", "public", "void", "addCompletionFlags", "(", "int", "flags", ")", "{", "this", ".", "completionFlags", "|=", "flags", ";", "}", "public", "boolean", "completeAnException", "(", ")", "{", "return", "(", "this", ".", "completionFlags", "&", "EXCEPTION", ")", "!=", "0", ";", "}", "public", "boolean", "completeInText", "(", ")", "{", "return", "(", "this", ".", "completionFlags", "&", "TEXT", ")", "!=", "0", ";", "}", "public", "boolean", "completeBaseTypes", "(", ")", "{", "return", "(", "this", ".", "completionFlags", "&", "BASE_TYPES", ")", "!=", "0", ";", "}", "public", "boolean", "completeFormalReference", "(", ")", "{", "return", "(", "this", ".", "completionFlags", "&", "FORMAL_REFERENCE", ")", "!=", "0", ";", "}", "public", "int", "getCompletionFlags", "(", ")", "{", "return", "this", ".", "completionFlags", ";", "}", "public", "StringBuffer", "printExpression", "(", "int", "indent", ",", "StringBuffer", "output", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "super", ".", "printExpression", "(", "indent", ",", "output", ")", ";", "indent", "++", ";", "if", "(", "this", ".", "completionFlags", ">", "0", ")", "{", "output", ".", "append", "(", "'\\n'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indent", ";", "i", "++", ")", "output", ".", "append", "(", "'\\t'", ")", ";", "output", ".", "append", "(", "\"infos:\"", ")", ";", "char", "separator", "=", "0", ";", "if", "(", "completeAnException", "(", ")", ")", "{", "output", ".", "append", "(", "\"exception\"", ")", ";", "separator", "=", "','", ";", "}", "if", "(", "completeInText", "(", ")", ")", "{", "if", "(", "separator", "!=", "0", ")", "output", ".", "append", "(", "separator", ")", ";", "output", ".", "append", "(", "\"text\"", ")", ";", "separator", "=", "','", ";", "}", "if", "(", "completeBaseTypes", "(", ")", ")", "{", "if", "(", "separator", "!=", "0", ")", "output", ".", "append", "(", "separator", ")", ";", "output", ".", "append", "(", "\"base", "types\"", ")", ";", "separator", "=", "','", ";", "}", "if", "(", "completeFormalReference", "(", ")", ")", "{", "if", "(", "separator", "!=", "0", ")", "output", ".", "append", "(", "separator", ")", ";", "output", ".", "append", "(", "\"\"", ")", ";", "separator", "=", "','", ";", "}", "output", ".", "append", "(", "'\\n'", ")", ";", "}", "indent", "--", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indent", ";", "i", "++", ")", "output", ".", "append", "(", "'\\t'", ")", ";", "return", "output", ".", "append", "(", "'>'", ")", ";", "}", "}", "</s>" ]
2,597
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "complete", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "public", "class", "CompletionOnSingleNameReference", "extends", "SingleNameReference", "{", "public", "char", "[", "]", "[", "]", "possibleKeywords", ";", "public", "boolean", "canBeExplicitConstructor", ";", "public", "boolean", "isInsideAnnotationAttribute", ";", "public", "boolean", "isPrecededByModifiers", ";", "public", "CompletionOnSingleNameReference", "(", "char", "[", "]", "source", ",", "long", "pos", ",", "boolean", "isInsideAnnotationAttribute", ")", "{", "this", "(", "source", ",", "pos", ",", "null", ",", "false", ",", "isInsideAnnotationAttribute", ")", ";", "}", "public", "CompletionOnSingleNameReference", "(", "char", "[", "]", "source", ",", "long", "pos", ",", "char", "[", "]", "[", "]", "possibleKeywords", ",", "boolean", "canBeExplicitConstructor", ",", "boolean", "isInsideAnnotationAttribute", ")", "{", "super", "(", "source", ",", "pos", ")", ";", "this", ".", "possibleKeywords", "=", "possibleKeywords", ";", "this", ".", "canBeExplicitConstructor", "=", "canBeExplicitConstructor", ";", "this", ".", "isInsideAnnotationAttribute", "=", "isInsideAnnotationAttribute", ";", "}", "public", "StringBuffer", "printExpression", "(", "int", "indent", ",", "StringBuffer", "output", ")", "{", "output", ".", "append", "(", "\"\"", ")", ";", "return", "super", ".", "printExpression", "(", "0", ",", "output", ")", ".", "append", "(", "'>'", ")", ";", "}", "public", "TypeBinding", "resolveType", "(", "BlockScope", "scope", ")", "{", "if", "(", "scope", "instanceof", "MethodScope", ")", "{", "throw", "new", "CompletionNodeFound", "(", "this", ",", "scope", ",", "(", "(", "MethodScope", ")", "scope", ")", ".", "insideTypeAnnotation", ")", ";", "}", "throw", "new", "CompletionNodeFound", "(", "this", ",", "scope", ")", ";", "}", "}", "</s>" ]
2,598
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "complete", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "CompilationResult", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "public", "class", "CompletionOnAnnotationOfType", "extends", "TypeDeclaration", "{", "public", "ASTNode", "potentialAnnotatedNode", ";", "public", "boolean", "isParameter", ";", "public", "CompletionOnAnnotationOfType", "(", "char", "[", "]", "typeName", ",", "CompilationResult", "compilationResult", ",", "Annotation", "annotation", ")", "{", "super", "(", "compilationResult", ")", ";", "this", ".", "sourceEnd", "=", "annotation", ".", "sourceEnd", ";", "this", ".", "sourceStart", "=", "annotation", ".", "sourceEnd", ";", "this", ".", "name", "=", "typeName", ";", "this", ".", "annotations", "=", "new", "Annotation", "[", "]", "{", "annotation", "}", ";", "}", "public", "StringBuffer", "print", "(", "int", "indent", ",", "StringBuffer", "output", ")", "{", "return", "this", ".", "annotations", "[", "0", "]", ".", "print", "(", "indent", ",", "output", ")", ";", "}", "}", "</s>" ]
2,599
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "complete", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "*", ";", "public", "class", "CompletionOnExplicitConstructorCall", "extends", "ExplicitConstructorCall", "{", "public", "CompletionOnExplicitConstructorCall", "(", "int", "accessMode", ")", "{", "super", "(", "accessMode", ")", ";", "}", "public", "StringBuffer", "printStatement", "(", "int", "tab", ",", "StringBuffer", "output", ")", "{", "printIndent", "(", "tab", ",", "output", ")", ";", "output", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "qualification", "!=", "null", ")", "this", ".", "qualification", ".", "printExpression", "(", "0", ",", "output", ")", ".", "append", "(", "'.'", ")", ";", "if", "(", "this", ".", "accessMode", "==", "This", ")", "{", "output", ".", "append", "(", "\"this(\"", ")", ";", "}", "else", "{", "output", ".", "append", "(", "\"super(\"", ")", ";", "}", "if", "(", "this", ".", "arguments", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "arguments", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "output", ".", "append", "(", "\",", "\"", ")", ";", "this", ".", "arguments", "[", "i", "]", ".", "printExpression", "(", "0", ",", "output", ")", ";", "}", "}", "return", "output", ".", "append", "(", "\")>;\"", ")", ";", "}", "public", "void", "resolve", "(", "BlockScope", "scope", ")", "{", "ReferenceBinding", "receiverType", "=", "scope", ".", "enclosingSourceType", "(", ")", ";", "if", "(", "this", ".", "arguments", "!=", "null", ")", "{", "int", "argsLength", "=", "this", ".", "arguments", ".", "length", ";", "for", "(", "int", "a", "=", "argsLength", ";", "--", "a", ">=", "0", ";", ")", "this", ".", "arguments", "[", "a", "]", ".", "resolveType", "(", "scope", ")", ";", "}", "if", "(", "this", ".", "accessMode", "!=", "This", "&&", "receiverType", "!=", "null", ")", "{", "if", "(", "receiverType", ".", "isHierarchyInconsistent", "(", ")", ")", "throw", "new", "CompletionNodeFound", "(", ")", ";", "receiverType", "=", "receiverType", ".", "superclass", "(", ")", ";", "}", "if", "(", "receiverType", "==", "null", ")", "throw", "new", "CompletionNodeFound", "(", ")", ";", "else", "throw", "new", "CompletionNodeFound", "(", "this", ",", "receiverType", ",", "scope", ")", ";", "}", "}", "</s>" ]