id
int32
0
12.9k
code
listlengths
2
264k
4,900
[ "<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>" ]
4,901
[ "<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>" ]
4,902
[ "<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", ".", "Index", ";", "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", ")", "{", "IPath", "[", "]", "indexLocations", "=", "this", ".", "participant", ".", "selectIndexes", "(", "this", ".", "pattern", ",", "this", ".", "scope", ")", ";", "int", "length", "=", "indexLocations", ".", "length", ";", "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>" ]
4,903
[ "<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", "(", ")", ")", "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>" ]
4,904
[ "<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>" ]
4,905
[ "<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>" ]
4,906
[ "<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>" ]
4,907
[ "<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", ".", "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", ")", ";", "}", "return", "selector", ".", "getIndexLocations", "(", ")", ";", "}", "}", "</s>" ]
4,908
[ "<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", ";", "}", "void", "setSimilarMatch", "(", "PossibleMatch", "possibleMatch", ")", "{", "possibleMatch", ".", "source", "=", "NO_SOURCE_FILE", ";", "this", ".", "similarMatch", "=", "possibleMatch", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "openable", "==", "null", "?", "\"\"", ":", "this", ".", "openable", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
4,909
[ "<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>" ]
4,910
[ "<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>" ]
4,911
[ "<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>" ]
4,912
[ "<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", ".", "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>" ]
4,913
[ "<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", "]", ";", "if", "(", "castExpression", ".", "type", "instanceof", "TypeReference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "TypeReference", ")", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "protected", "void", "consumeCastExpressionWithGenericsArray", "(", ")", "{", "super", ".", "consumeCastExpressionWithGenericsArray", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "if", "(", "castExpression", ".", "type", "instanceof", "Reference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "Reference", ")", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "protected", "void", "consumeCastExpressionWithNameArray", "(", ")", "{", "super", ".", "consumeCastExpressionWithNameArray", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "if", "(", "castExpression", ".", "type", "instanceof", "Reference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "Reference", ")", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "protected", "void", "consumeCastExpressionWithPrimitiveType", "(", ")", "{", "super", ".", "consumeCastExpressionWithPrimitiveType", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "if", "(", "castExpression", ".", "type", "instanceof", "Reference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "Reference", ")", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "protected", "void", "consumeCastExpressionWithQualifiedGenericsArray", "(", ")", "{", "super", ".", "consumeCastExpressionWithQualifiedGenericsArray", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "CAST_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "CastExpression", "castExpression", "=", "(", "CastExpression", ")", "this", ".", "expressionStack", "[", "this", ".", "expressionPtr", "]", ";", "if", "(", "castExpression", ".", "type", "instanceof", "Reference", ")", "{", "this", ".", "patternLocator", ".", "match", "(", "(", "Reference", ")", "castExpression", ".", "type", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "}", "protected", "void", "consumeClassHeaderExtends", "(", ")", "{", "super", ".", "consumeClassHeaderExtends", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "SUPERTYPE_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeDeclaration", "typeDeclaration", "=", "(", "TypeDeclaration", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeDeclaration", ".", "superclass", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "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", "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", "(", ")", "{", "super", ".", "consumeInterfaceType", "(", ")", ";", "if", "(", "(", "this", ".", "patternFineGrain", "&", "IJavaSearchConstants", ".", "SUPERTYPE_TYPE_REFERENCE", ")", "!=", "0", ")", "{", "TypeReference", "typeReference", "=", "(", "TypeReference", ")", "this", ".", "astStack", "[", "this", ".", "astPtr", "]", ";", "this", ".", "patternLocator", ".", "match", "(", "typeReference", ",", "this", ".", "nodeSet", ")", ";", "}", "}", "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", "]", ";", "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>" ]
4,914
[ "<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>" ]
4,915
[ "<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>" ]
4,916
[ "<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", "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", "MethodBinding", "getMethodBinding", "(", "ReferenceBinding", "type", ",", "TypeBinding", "[", "]", "argumentTypes", ")", "{", "MethodBinding", "[", "]", "methods", "=", "type", ".", "getMethods", "(", "this", ".", "pattern", ".", "selector", ")", ";", "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", "{", "this", ".", "allSuperDeclaringTypeNames", "=", "new", "SuperTypeNamesCollector", "(", "this", ".", "pattern", ",", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ",", "locator", ",", "this", ".", "pattern", ".", "declaringType", ",", "locator", ".", "progressMonitor", ")", ".", "collect", "(", ")", ";", "}", "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", "(", ")", ";", "}", "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", ";", "}", "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", "{", "return", "IMPOSSIBLE_MATCH", ";", "}", "}", "level", "=", "newLevel", ";", "}", "}", "}", "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", ",", "(", "(", "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", ",", "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", "(", ")", ")", "{", "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", "(", ")", ";", "}", "}", "char", "[", "]", "qualifiedPattern", "=", "qualifiedPattern", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ")", ";", "if", "(", "qualifiedPattern", "==", "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", "(", "qualifiedPattern", ",", "method", ".", "declaringClass", ",", "null", ")", ":", "resolveLevelForType", "(", "qualifiedPattern", ",", "method", ".", "declaringClass", ")", ";", "return", "methodLevel", ">", "declaringLevel", "?", "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", "(", ")", ";", "}", "char", "[", "]", "qualifiedPattern", "=", "qualifiedPattern", "(", "this", ".", "pattern", ".", "declaringSimpleName", ",", "this", ".", "pattern", ".", "declaringQualification", ")", ";", "if", "(", "qualifiedPattern", "==", "null", ")", "return", "methodLevel", ";", "int", "declaringLevel", ";", "if", "(", "isVirtualInvoke", "(", "method", ",", "messageSend", ")", "&&", "(", "messageSend", ".", "actualReceiverType", "instanceof", "ReferenceBinding", ")", ")", "{", "ReferenceBinding", "methodReceiverType", "=", "(", "ReferenceBinding", ")", "messageSend", ".", "actualReceiverType", ";", "declaringLevel", "=", "resolveLevelAsSubtype", "(", "qualifiedPattern", ",", "methodReceiverType", ",", "method", ".", "parameters", ")", ";", "if", "(", "declaringLevel", "==", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "method", ".", "declaringClass", "==", "null", "||", "this", ".", "allSuperDeclaringTypeNames", "==", "null", ")", "{", "declaringLevel", "=", "INACCURATE_MATCH", ";", "}", "else", "{", "if", "(", "resolveLevelAsSuperInvocation", "(", "methodReceiverType", ",", "method", ".", "parameters", ",", "true", ")", ")", "{", "declaringLevel", "=", "methodLevel", "|", "SUPER_INVOCATION_FLAVOR", ";", "}", "}", "}", "if", "(", "(", "declaringLevel", "&", "FLAVORS_MASK", ")", "!=", "0", ")", "{", "return", "declaringLevel", ";", "}", "}", "else", "{", "declaringLevel", "=", "resolveLevelForType", "(", "qualifiedPattern", ",", "method", ".", "declaringClass", ")", ";", "}", "return", "methodLevel", ">", "declaringLevel", "?", "declaringLevel", ":", "methodLevel", ";", "}", "protected", "int", "resolveLevelAsSubtype", "(", "char", "[", "]", "qualifiedPattern", ",", "ReferenceBinding", "type", ",", "TypeBinding", "[", "]", "argumentTypes", ")", "{", "if", "(", "type", "==", "null", ")", "return", "INACCURATE_MATCH", ";", "int", "level", "=", "resolveLevelForType", "(", "qualifiedPattern", ",", "type", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "{", "MethodBinding", "method", "=", "argumentTypes", "==", "null", "?", "null", ":", "getMethodBinding", "(", "type", ",", "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", "(", "qualifiedPattern", ",", "type", ".", "superclass", "(", ")", ",", "argumentTypes", ")", ";", "if", "(", "level", "!=", "IMPOSSIBLE_MATCH", ")", "{", "if", "(", "argumentTypes", "!=", "null", ")", "{", "MethodBinding", "method", "=", "getMethodBinding", "(", "type", ",", "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", "(", "qualifiedPattern", ",", "interfaces", "[", "i", "]", ",", "null", ")", ";", "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", ",", "boolean", "methodAlreadyVerified", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "type", ".", "compoundName", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "allSuperDeclaringTypeNames", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "CharOperation", ".", "equals", "(", "this", ".", "allSuperDeclaringTypeNames", "[", "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", ",", "false", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"Locator", "for", "\"", "+", "this", ".", "pattern", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
4,917
[ "<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>" ]
4,918
[ "<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>" ]
4,919
[ "<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", ".", "ICompilationUnit", ";", "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", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ",", "CompilationUnitScope", "scope", ")", "{", "ReferenceBinding", "binding", "=", "typeDeclaration", ".", "binding", ";", "if", "(", "SuperTypeNamesCollector", ".", "this", ".", "matches", "(", "binding", ")", ")", "collectSuperTypeNames", "(", "binding", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "memberTypeDeclaration", ",", "ClassScope", "scope", ")", "{", "ReferenceBinding", "binding", "=", "memberTypeDeclaration", ".", "binding", ";", "if", "(", "SuperTypeNamesCollector", ".", "this", ".", "matches", "(", "binding", ")", ")", "collectSuperTypeNames", "(", "binding", ")", ";", "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", ";", "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", ";", "}", "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", ")", ";", "}", "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", ")", ";", "}", "}", "}", "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", ".", "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", ")", ";", "}", "}", "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", ")", "{", "ReferenceBinding", "superclass", "=", "binding", ".", "superclass", "(", ")", ";", "if", "(", "superclass", "!=", "null", ")", "{", "addToResult", "(", "superclass", ".", "compoundName", ")", ";", "collectSuperTypeNames", "(", "superclass", ")", ";", "}", "ReferenceBinding", "[", "]", "interfaces", "=", "binding", ".", "superInterfaces", "(", ")", ";", "if", "(", "interfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "interfaces", ".", "length", ";", "i", "++", ")", "{", "ReferenceBinding", "interfaceBinding", "=", "interfaces", "[", "i", "]", ";", "addToResult", "(", "interfaceBinding", ".", "compoundName", ")", ";", "collectSuperTypeNames", "(", "interfaceBinding", ")", ";", "}", "}", "}", "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", "(", ")", ";", "}", "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>" ]
4,920
[ "<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>" ]
4,921
[ "<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>" ]
4,922
[ "<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>" ]
4,923
[ "<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>" ]
4,924
[ "<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>" ]
4,925
[ "<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>" ]
4,926
[ "<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>" ]
4,927
[ "<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>" ]
4,928
[ "<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>" ]
4,929
[ "<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>" ]
4,930
[ "<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", ".", "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", ";", "}", "}", "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", ".", "getName", "(", ")", ";", "int", "lastSlash", "=", "CharOperation", ".", "lastIndexOf", "(", "'/'", ",", "name", ")", ";", "if", "(", "lastSlash", "!=", "-", "1", ")", "{", "name", "=", "CharOperation", ".", "subarray", "(", "name", ",", "lastSlash", "+", "1", ",", "name", ".", "length", ")", ";", "}", "}", "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>" ]
4,931
[ "<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>" ]
4,932
[ "<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>" ]
4,933
[ "<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>" ]
4,934
[ "<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>" ]
4,935
[ "<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>" ]
4,936
[ "<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>" ]
4,937
[ "<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>" ]
4,938
[ "<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>" ]
4,939
[ "<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>" ]
4,940
[ "<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", ";", "}", "}", "</s>" ]
4,941
[ "<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", ";", "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", "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", ";", "}", "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>" ]
4,942
[ "<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", "[", "]", "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", ";", "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>" ]
4,943
[ "<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>" ]
4,944
[ "<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>" ]
4,945
[ "<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", ";", "}", "}", "</s>" ]
4,946
[ "<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>" ]
4,947
[ "<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>" ]
4,948
[ "<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>" ]
4,949
[ "<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>" ]
4,950
[ "<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", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "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", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "InvalidInputException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "FieldDeclarationMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "FieldReferenceMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "LocalVariableDeclarationMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "LocalVariableReferenceMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "MethodDeclarationMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "MethodReferenceMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "PackageDeclarationMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "PackageReferenceMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "ReferenceMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchDocument", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "TypeDeclarationMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "TypeParameterDeclarationMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "TypeParameterReferenceMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "TypeReferenceMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "CompilationResult", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "DefaultErrorHandlingPolicies", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "AbstractMethodDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "AbstractVariableDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "AllocationExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Argument", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ArrayTypeReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "CompilationUnitDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "FieldDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ImportReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MemberValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ParameterizedQualifiedTypeReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ParameterizedSingleTypeReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "QualifiedAllocationExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "QualifiedNameReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "QualifiedTypeReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "SingleMemberAnnotation", ";", "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", ".", "ast", ".", "Wildcard", ";", "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", ".", "AccessRestriction", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "INameEnvironment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ISourceType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "ITypeRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "BinaryTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ClassScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "CompilationUnitScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "LookupEnvironment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "PackageBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ProblemMethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ProblemReasons", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TagBits", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeVariableBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Parser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "SourceTypeConverter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "TerminalTokens", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "AbortCompilation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "AbortCompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "ProblemReporter", ";", "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", ".", "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", ".", "SourceTypeElementInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ".", "HierarchyResolver", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "BasicSearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "HierarchyScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IndexQueryRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IndexSelector", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaSearchDocument", ";", "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", ";", "public", "static", "boolean", "SHOULD_FILTER_ENUM", "=", "false", ";", "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", ";", "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", ";", "}", "}", "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", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "fields", ".", "length", ";", "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", ")", ";", "}", "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", ")", ";", "}", "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", ")", ";", "this", ".", "bindings", ".", "put", "(", "typeKey", ",", "typeBinding", ")", ";", "return", "typeBinding", ".", "isValidBinding", "(", ")", "?", "typeBinding", ":", "null", ";", "}", "public", "MethodBinding", "getMethodBinding", "(", "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", ".", "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", ")", "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", ")", "{", "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", ")", ")", "{", "method", ".", "statements", "=", "null", ";", "method", ".", "javadoc", "=", "null", ";", "}", "}", "}", "else", "{", "for", "(", "int", "j", "=", "0", ",", "length", "=", "methods", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "methods", "[", "j", "]", ".", "statements", "=", "null", ";", "methods", "[", "j", "]", ".", "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>" ]
4,951
[ "<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>" ]
4,952
[ "<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>" ]
4,953
[ "<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", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "fieldDecls", ".", "length", ";", "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>" ]
4,954
[ "<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>" ]
4,955
[ "<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>" ]
4,956
[ "<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>" ]
4,957
[ "<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>" ]
4,958
[ "<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>" ]
4,959
[ "<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>" ]
4,960
[ "<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>" ]
4,961
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ";", "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", ".", "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", ";", "IPath", "[", "]", "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", "(", ")", ";", "SimpleSet", "locations", "=", "new", "SimpleSet", "(", ")", ";", "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", ")", "{", "}", "}", "this", ".", "indexLocations", "=", "new", "IPath", "[", "locations", ".", "elementSize", "]", ";", "Object", "[", "]", "values", "=", "locations", ".", "values", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "values", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "if", "(", "values", "[", "i", "]", "!=", "null", ")", "this", ".", "indexLocations", "[", "count", "++", "]", "=", "(", "IPath", ")", "values", "[", "i", "]", ";", "}", "public", "IPath", "[", "]", "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", ";", "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", "[", "0", "]", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "primaryType", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "focusQualifiedNames", "[", "i", "+", "1", "]", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "(", "(", "IType", ")", "(", "types", ".", "elementAt", "(", "i", ")", ")", ")", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "}", "return", "focusQualifiedNames", "==", "null", "?", "null", ":", "ReferenceCollection", ".", "internQualifiedNames", "(", "focusQualifiedNames", ",", "true", ")", ";", "}", "}", "</s>" ]
4,962
[ "<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>" ]
4,963
[ "<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>" ]
4,964
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "ScannerHelper", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "TerminalTokens", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "LocalVariable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "EntryResult", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "HierarchyScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IndexQueryRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "StringOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "*", ";", "public", "abstract", "class", "SearchPattern", "{", "public", "static", "final", "int", "R_EXACT_MATCH", "=", "0", ";", "public", "static", "final", "int", "R_PREFIX_MATCH", "=", "0x0001", ";", "public", "static", "final", "int", "R_PATTERN_MATCH", "=", "0x0002", ";", "public", "static", "final", "int", "R_REGEXP_MATCH", "=", "0x0004", ";", "public", "static", "final", "int", "R_CASE_SENSITIVE", "=", "0x0008", ";", "public", "static", "final", "int", "R_ERASURE_MATCH", "=", "0x0010", ";", "public", "static", "final", "int", "R_EQUIVALENT_MATCH", "=", "0x0020", ";", "public", "static", "final", "int", "R_FULL_MATCH", "=", "0x0040", ";", "public", "static", "final", "int", "R_CAMELCASE_MATCH", "=", "0x0080", ";", "public", "static", "final", "int", "R_CAMELCASE_SAME_PART_COUNT_MATCH", "=", "0x0100", ";", "private", "static", "final", "int", "MODE_MASK", "=", "R_EXACT_MATCH", "|", "R_PREFIX_MATCH", "|", "R_PATTERN_MATCH", "|", "R_REGEXP_MATCH", "|", "R_CAMELCASE_MATCH", "|", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ";", "private", "int", "matchRule", ";", "public", "IJavaElement", "focus", ";", "public", "int", "kind", ";", "public", "boolean", "mustResolve", "=", "true", ";", "public", "SearchPattern", "(", "int", "matchRule", ")", "{", "this", ".", "matchRule", "=", "matchRule", ";", "if", "(", "(", "matchRule", "&", "(", "R_EQUIVALENT_MATCH", "|", "R_ERASURE_MATCH", ")", ")", "==", "0", ")", "{", "this", ".", "matchRule", "|=", "R_FULL_MATCH", ";", "}", "if", "(", "(", "matchRule", "&", "R_CAMELCASE_MATCH", ")", "!=", "0", ")", "{", "this", ".", "matchRule", "&=", "~", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ";", "this", ".", "matchRule", "&=", "~", "R_PREFIX_MATCH", ";", "}", "else", "if", "(", "(", "matchRule", "&", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ")", "!=", "0", ")", "{", "this", ".", "matchRule", "&=", "~", "R_PREFIX_MATCH", ";", "}", "}", "public", "void", "acceptMatch", "(", "String", "relativePath", ",", "String", "containerPath", ",", "char", "separator", ",", "SearchPattern", "pattern", ",", "IndexQueryRequestor", "requestor", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ")", "{", "acceptMatch", "(", "relativePath", ",", "containerPath", ",", "separator", ",", "pattern", ",", "requestor", ",", "participant", ",", "scope", ",", "null", ")", ";", "}", "public", "void", "acceptMatch", "(", "String", "relativePath", ",", "String", "containerPath", ",", "char", "separator", ",", "SearchPattern", "pattern", ",", "IndexQueryRequestor", "requestor", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IProgressMonitor", "monitor", ")", "{", "if", "(", "scope", "instanceof", "JavaSearchScope", ")", "{", "JavaSearchScope", "javaSearchScope", "=", "(", "JavaSearchScope", ")", "scope", ";", "AccessRuleSet", "access", "=", "javaSearchScope", ".", "getAccessRuleSet", "(", "relativePath", ",", "containerPath", ")", ";", "if", "(", "access", "!=", "JavaSearchScope", ".", "NOT_ENCLOSED", ")", "{", "StringBuffer", "documentPath", "=", "new", "StringBuffer", "(", "containerPath", ".", "length", "(", ")", "+", "1", "+", "relativePath", ".", "length", "(", ")", ")", ";", "documentPath", ".", "append", "(", "containerPath", ")", ";", "documentPath", ".", "append", "(", "separator", ")", ";", "documentPath", ".", "append", "(", "relativePath", ")", ";", "if", "(", "!", "requestor", ".", "acceptIndexMatch", "(", "documentPath", ".", "toString", "(", ")", ",", "pattern", ",", "participant", ",", "access", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "}", "else", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "containerPath", ".", "length", "(", ")", "+", "1", "+", "relativePath", ".", "length", "(", ")", ")", ";", "buffer", ".", "append", "(", "containerPath", ")", ";", "buffer", ".", "append", "(", "separator", ")", ";", "buffer", ".", "append", "(", "relativePath", ")", ";", "String", "documentPath", "=", "buffer", ".", "toString", "(", ")", ";", "boolean", "encloses", "=", "(", "scope", "instanceof", "HierarchyScope", ")", "?", "(", "(", "HierarchyScope", ")", "scope", ")", ".", "encloses", "(", "documentPath", ",", "monitor", ")", ":", "scope", ".", "encloses", "(", "documentPath", ")", ";", "if", "(", "encloses", ")", "if", "(", "!", "requestor", ".", "acceptIndexMatch", "(", "documentPath", ",", "pattern", ",", "participant", ",", "null", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "}", "public", "SearchPattern", "currentPattern", "(", ")", "{", "return", "this", ";", "}", "public", "static", "final", "boolean", "camelCaseMatch", "(", "String", "pattern", ",", "String", "name", ")", "{", "if", "(", "pattern", "==", "null", ")", "return", "true", ";", "if", "(", "name", "==", "null", ")", "return", "false", ";", "return", "camelCaseMatch", "(", "pattern", ",", "0", ",", "pattern", ".", "length", "(", ")", ",", "name", ",", "0", ",", "name", ".", "length", "(", ")", ",", "false", ")", ";", "}", "public", "static", "final", "boolean", "camelCaseMatch", "(", "String", "pattern", ",", "String", "name", ",", "boolean", "samePartCount", ")", "{", "if", "(", "pattern", "==", "null", ")", "return", "true", ";", "if", "(", "name", "==", "null", ")", "return", "false", ";", "return", "camelCaseMatch", "(", "pattern", ",", "0", ",", "pattern", ".", "length", "(", ")", ",", "name", ",", "0", ",", "name", ".", "length", "(", ")", ",", "samePartCount", ")", ";", "}", "public", "static", "final", "boolean", "camelCaseMatch", "(", "String", "pattern", ",", "int", "patternStart", ",", "int", "patternEnd", ",", "String", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ")", "{", "return", "camelCaseMatch", "(", "pattern", ",", "patternStart", ",", "patternEnd", ",", "name", ",", "nameStart", ",", "nameEnd", ",", "false", ")", ";", "}", "public", "static", "final", "boolean", "camelCaseMatch", "(", "String", "pattern", ",", "int", "patternStart", ",", "int", "patternEnd", ",", "String", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "boolean", "samePartCount", ")", "{", "return", "StringOperation", ".", "getCamelCaseMatchingRegions", "(", "pattern", ",", "patternStart", ",", "patternEnd", ",", "name", ",", "nameStart", ",", "nameEnd", ",", "samePartCount", ")", "!=", "null", ";", "}", "public", "static", "final", "int", "[", "]", "getMatchingRegions", "(", "String", "pattern", ",", "String", "name", ",", "int", "matchRule", ")", "{", "if", "(", "name", "==", "null", ")", "return", "null", ";", "final", "int", "nameLength", "=", "name", ".", "length", "(", ")", ";", "if", "(", "pattern", "==", "null", ")", "{", "return", "new", "int", "[", "]", "{", "0", ",", "nameLength", "}", ";", "}", "final", "int", "patternLength", "=", "pattern", ".", "length", "(", ")", ";", "boolean", "countMatch", "=", "false", ";", "switch", "(", "matchRule", ")", "{", "case", "SearchPattern", ".", "R_EXACT_MATCH", ":", "if", "(", "patternLength", "==", "nameLength", "&&", "pattern", ".", "equalsIgnoreCase", "(", "name", ")", ")", "{", "return", "new", "int", "[", "]", "{", "0", ",", "patternLength", "}", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "if", "(", "patternLength", "==", "nameLength", "&&", "pattern", ".", "equals", "(", "name", ")", ")", "{", "return", "new", "int", "[", "]", "{", "0", ",", "patternLength", "}", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_PREFIX_MATCH", ":", "if", "(", "patternLength", "<=", "nameLength", "&&", "name", ".", "substring", "(", "0", ",", "patternLength", ")", ".", "equalsIgnoreCase", "(", "pattern", ")", ")", "{", "return", "new", "int", "[", "]", "{", "0", ",", "patternLength", "}", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_PREFIX_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "if", "(", "name", ".", "startsWith", "(", "pattern", ")", ")", "{", "return", "new", "int", "[", "]", "{", "0", ",", "patternLength", "}", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "countMatch", "=", "true", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "if", "(", "patternLength", "<=", "nameLength", ")", "{", "int", "[", "]", "regions", "=", "StringOperation", ".", "getCamelCaseMatchingRegions", "(", "pattern", ",", "0", ",", "patternLength", ",", "name", ",", "0", ",", "nameLength", ",", "countMatch", ")", ";", "if", "(", "regions", "!=", "null", ")", "return", "regions", ";", "if", "(", "name", ".", "substring", "(", "0", ",", "patternLength", ")", ".", "equalsIgnoreCase", "(", "pattern", ")", ")", "{", "return", "new", "int", "[", "]", "{", "0", ",", "patternLength", "}", ";", "}", "}", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "countMatch", "=", "true", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "if", "(", "patternLength", "<=", "nameLength", ")", "{", "return", "StringOperation", ".", "getCamelCaseMatchingRegions", "(", "pattern", ",", "0", ",", "patternLength", ",", "name", ",", "0", ",", "nameLength", ",", "countMatch", ")", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "return", "StringOperation", ".", "getPatternMatchingRegions", "(", "pattern", ",", "0", ",", "patternLength", ",", "name", ",", "0", ",", "nameLength", ",", "false", ")", ";", "case", "SearchPattern", ".", "R_PATTERN_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "return", "StringOperation", ".", "getPatternMatchingRegions", "(", "pattern", ",", "0", ",", "patternLength", ",", "name", ",", "0", ",", "nameLength", ",", "true", ")", ";", "}", "return", "null", ";", "}", "public", "static", "SearchPattern", "createAndPattern", "(", "SearchPattern", "leftPattern", ",", "SearchPattern", "rightPattern", ")", "{", "return", "new", "AndPattern", "(", "leftPattern", ",", "rightPattern", ")", ";", "}", "private", "static", "SearchPattern", "createFieldPattern", "(", "String", "patternString", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "Scanner", "scanner", "=", "new", "Scanner", "(", "false", ",", "true", ",", "false", ",", "ClassFileConstants", ".", "JDK1_3", ",", "null", ",", "null", ",", "true", ")", ";", "scanner", ".", "setSource", "(", "patternString", ".", "toCharArray", "(", ")", ")", ";", "final", "int", "InsideDeclaringPart", "=", "1", ";", "final", "int", "InsideType", "=", "2", ";", "int", "lastToken", "=", "-", "1", ";", "String", "declaringType", "=", "null", ",", "fieldName", "=", "null", ";", "String", "type", "=", "null", ";", "int", "mode", "=", "InsideDeclaringPart", ";", "int", "token", ";", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "return", "null", ";", "}", "while", "(", "token", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "switch", "(", "mode", ")", "{", "case", "InsideDeclaringPart", ":", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameDOT", ":", "if", "(", "declaringType", "==", "null", ")", "{", "if", "(", "fieldName", "==", "null", ")", "return", "null", ";", "declaringType", "=", "fieldName", ";", "}", "else", "{", "String", "tokenSource", "=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "declaringType", "+=", "tokenSource", "+", "fieldName", ";", "}", "fieldName", "=", "null", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameWHITESPACE", ":", "if", "(", "!", "(", "TerminalTokens", ".", "TokenNameWHITESPACE", "==", "lastToken", "||", "TerminalTokens", ".", "TokenNameDOT", "==", "lastToken", ")", ")", "mode", "=", "InsideType", ";", "break", ";", "default", ":", "if", "(", "fieldName", "==", "null", ")", "fieldName", "=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "else", "fieldName", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "break", ";", "case", "InsideType", ":", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameWHITESPACE", ":", "break", ";", "default", ":", "if", "(", "type", "==", "null", ")", "type", "=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "else", "type", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "break", ";", "}", "lastToken", "=", "token", ";", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "return", "null", ";", "}", "}", "if", "(", "fieldName", "==", "null", ")", "return", "null", ";", "char", "[", "]", "fieldNameChars", "=", "fieldName", ".", "toCharArray", "(", ")", ";", "if", "(", "fieldNameChars", ".", "length", "==", "1", "&&", "fieldNameChars", "[", "0", "]", "==", "'*'", ")", "fieldNameChars", "=", "null", ";", "char", "[", "]", "declaringTypeQualification", "=", "null", ",", "declaringTypeSimpleName", "=", "null", ";", "char", "[", "]", "typeQualification", "=", "null", ",", "typeSimpleName", "=", "null", ";", "if", "(", "declaringType", "!=", "null", ")", "{", "char", "[", "]", "declaringTypePart", "=", "declaringType", ".", "toCharArray", "(", ")", ";", "int", "lastDotPosition", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "declaringTypePart", ")", ";", "if", "(", "lastDotPosition", ">=", "0", ")", "{", "declaringTypeQualification", "=", "CharOperation", ".", "subarray", "(", "declaringTypePart", ",", "0", ",", "lastDotPosition", ")", ";", "if", "(", "declaringTypeQualification", ".", "length", "==", "1", "&&", "declaringTypeQualification", "[", "0", "]", "==", "'*'", ")", "declaringTypeQualification", "=", "null", ";", "declaringTypeSimpleName", "=", "CharOperation", ".", "subarray", "(", "declaringTypePart", ",", "lastDotPosition", "+", "1", ",", "declaringTypePart", ".", "length", ")", ";", "}", "else", "{", "declaringTypeSimpleName", "=", "declaringTypePart", ";", "}", "if", "(", "declaringTypeSimpleName", ".", "length", "==", "1", "&&", "declaringTypeSimpleName", "[", "0", "]", "==", "'*'", ")", "declaringTypeSimpleName", "=", "null", ";", "}", "if", "(", "type", "!=", "null", ")", "{", "char", "[", "]", "typePart", "=", "type", ".", "toCharArray", "(", ")", ";", "int", "lastDotPosition", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "typePart", ")", ";", "if", "(", "lastDotPosition", ">=", "0", ")", "{", "typeQualification", "=", "CharOperation", ".", "subarray", "(", "typePart", ",", "0", ",", "lastDotPosition", ")", ";", "if", "(", "typeQualification", ".", "length", "==", "1", "&&", "typeQualification", "[", "0", "]", "==", "'*'", ")", "{", "typeQualification", "=", "null", ";", "}", "else", "{", "typeQualification", "=", "CharOperation", ".", "concat", "(", "IIndexConstants", ".", "ONE_STAR", ",", "typeQualification", ")", ";", "}", "typeSimpleName", "=", "CharOperation", ".", "subarray", "(", "typePart", ",", "lastDotPosition", "+", "1", ",", "typePart", ".", "length", ")", ";", "}", "else", "{", "typeSimpleName", "=", "typePart", ";", "}", "if", "(", "typeSimpleName", ".", "length", "==", "1", "&&", "typeSimpleName", "[", "0", "]", "==", "'*'", ")", "typeSimpleName", "=", "null", ";", "}", "return", "new", "FieldPattern", "(", "fieldNameChars", ",", "declaringTypeQualification", ",", "declaringTypeSimpleName", ",", "typeQualification", ",", "typeSimpleName", ",", "limitTo", ",", "matchRule", ")", ";", "}", "private", "static", "SearchPattern", "createMethodOrConstructorPattern", "(", "String", "patternString", ",", "int", "limitTo", ",", "int", "matchRule", ",", "boolean", "isConstructor", ")", "{", "Scanner", "scanner", "=", "new", "Scanner", "(", "false", ",", "true", ",", "false", ",", "ClassFileConstants", ".", "JDK1_3", ",", "null", ",", "null", ",", "true", ")", ";", "scanner", ".", "setSource", "(", "patternString", ".", "toCharArray", "(", ")", ")", ";", "final", "int", "InsideSelector", "=", "1", ";", "final", "int", "InsideTypeArguments", "=", "2", ";", "final", "int", "InsideParameter", "=", "3", ";", "final", "int", "InsideReturnType", "=", "4", ";", "int", "lastToken", "=", "-", "1", ";", "String", "declaringType", "=", "null", ",", "selector", "=", "null", ",", "parameterType", "=", "null", ";", "String", "[", "]", "parameterTypes", "=", "null", ";", "char", "[", "]", "[", "]", "typeArguments", "=", "null", ";", "String", "typeArgumentsString", "=", "null", ";", "int", "parameterCount", "=", "-", "1", ";", "String", "returnType", "=", "null", ";", "boolean", "foundClosingParenthesis", "=", "false", ";", "int", "mode", "=", "InsideSelector", ";", "int", "token", ",", "argCount", "=", "0", ";", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "return", "null", ";", "}", "while", "(", "token", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "switch", "(", "mode", ")", "{", "case", "InsideSelector", ":", "if", "(", "argCount", "==", "0", ")", "{", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "if", "(", "selector", "==", "null", "||", "lastToken", "==", "TerminalTokens", ".", "TokenNameDOT", ")", "{", "typeArgumentsString", "=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "mode", "=", "InsideTypeArguments", ";", "break", ";", "}", "if", "(", "declaringType", "==", "null", ")", "{", "declaringType", "=", "selector", ";", "}", "else", "{", "declaringType", "+=", "'.'", "+", "selector", ";", "}", "declaringType", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "selector", "=", "null", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameDOT", ":", "if", "(", "!", "isConstructor", "&&", "typeArgumentsString", "!=", "null", ")", "return", "null", ";", "if", "(", "declaringType", "==", "null", ")", "{", "if", "(", "selector", "==", "null", ")", "return", "null", ";", "declaringType", "=", "selector", ";", "}", "else", "if", "(", "selector", "!=", "null", ")", "{", "declaringType", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", "+", "selector", ";", "}", "selector", "=", "null", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameLPAREN", ":", "parameterTypes", "=", "new", "String", "[", "5", "]", ";", "parameterCount", "=", "0", ";", "mode", "=", "InsideParameter", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameWHITESPACE", ":", "switch", "(", "lastToken", ")", "{", "case", "TerminalTokens", ".", "TokenNameWHITESPACE", ":", "case", "TerminalTokens", ".", "TokenNameDOT", ":", "case", "TerminalTokens", ".", "TokenNameGREATER", ":", "case", "TerminalTokens", ".", "TokenNameRIGHT_SHIFT", ":", "case", "TerminalTokens", ".", "TokenNameUNSIGNED_RIGHT_SHIFT", ":", "break", ";", "default", ":", "mode", "=", "InsideReturnType", ";", "break", ";", "}", "break", ";", "default", ":", "if", "(", "selector", "==", "null", ")", "selector", "=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "else", "selector", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "break", ";", "}", "}", "else", "{", "if", "(", "declaringType", "==", "null", ")", "return", "null", ";", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameGREATER", ":", "case", "TerminalTokens", ".", "TokenNameRIGHT_SHIFT", ":", "case", "TerminalTokens", ".", "TokenNameUNSIGNED_RIGHT_SHIFT", ":", "argCount", "--", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "break", ";", "}", "declaringType", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "break", ";", "case", "InsideTypeArguments", ":", "if", "(", "typeArgumentsString", "==", "null", ")", "return", "null", ";", "typeArgumentsString", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameGREATER", ":", "case", "TerminalTokens", ".", "TokenNameRIGHT_SHIFT", ":", "case", "TerminalTokens", ".", "TokenNameUNSIGNED_RIGHT_SHIFT", ":", "argCount", "--", ";", "if", "(", "argCount", "==", "0", ")", "{", "String", "pseudoType", "=", "\"Type\"", "+", "typeArgumentsString", ";", "typeArguments", "=", "Signature", ".", "getTypeArguments", "(", "Signature", ".", "createTypeSignature", "(", "pseudoType", ",", "false", ")", ".", "toCharArray", "(", ")", ")", ";", "mode", "=", "InsideSelector", ";", "}", "break", ";", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "break", ";", "}", "break", ";", "case", "InsideParameter", ":", "if", "(", "argCount", "==", "0", ")", "{", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameWHITESPACE", ":", "break", ";", "case", "TerminalTokens", ".", "TokenNameCOMMA", ":", "if", "(", "parameterType", "==", "null", ")", "return", "null", ";", "if", "(", "parameterTypes", "!=", "null", ")", "{", "if", "(", "parameterTypes", ".", "length", "==", "parameterCount", ")", "System", ".", "arraycopy", "(", "parameterTypes", ",", "0", ",", "parameterTypes", "=", "new", "String", "[", "parameterCount", "*", "2", "]", ",", "0", ",", "parameterCount", ")", ";", "parameterTypes", "[", "parameterCount", "++", "]", "=", "parameterType", ";", "}", "parameterType", "=", "null", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameRPAREN", ":", "foundClosingParenthesis", "=", "true", ";", "if", "(", "parameterType", "!=", "null", "&&", "parameterTypes", "!=", "null", ")", "{", "if", "(", "parameterTypes", ".", "length", "==", "parameterCount", ")", "System", ".", "arraycopy", "(", "parameterTypes", ",", "0", ",", "parameterTypes", "=", "new", "String", "[", "parameterCount", "*", "2", "]", ",", "0", ",", "parameterCount", ")", ";", "parameterTypes", "[", "parameterCount", "++", "]", "=", "parameterType", ";", "}", "mode", "=", "isConstructor", "?", "InsideTypeArguments", ":", "InsideReturnType", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "if", "(", "parameterType", "==", "null", ")", "return", "null", ";", "default", ":", "if", "(", "parameterType", "==", "null", ")", "parameterType", "=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "else", "parameterType", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "}", "else", "{", "if", "(", "parameterType", "==", "null", ")", "return", "null", ";", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameGREATER", ":", "case", "TerminalTokens", ".", "TokenNameRIGHT_SHIFT", ":", "case", "TerminalTokens", ".", "TokenNameUNSIGNED_RIGHT_SHIFT", ":", "argCount", "--", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "break", ";", "}", "parameterType", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "break", ";", "case", "InsideReturnType", ":", "if", "(", "argCount", "==", "0", ")", "{", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameWHITESPACE", ":", "break", ";", "case", "TerminalTokens", ".", "TokenNameLPAREN", ":", "parameterTypes", "=", "new", "String", "[", "5", "]", ";", "parameterCount", "=", "0", ";", "mode", "=", "InsideParameter", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "if", "(", "returnType", "==", "null", ")", "return", "null", ";", "default", ":", "if", "(", "returnType", "==", "null", ")", "returnType", "=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "else", "returnType", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "}", "else", "{", "if", "(", "returnType", "==", "null", ")", "return", "null", ";", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameGREATER", ":", "case", "TerminalTokens", ".", "TokenNameRIGHT_SHIFT", ":", "case", "TerminalTokens", ".", "TokenNameUNSIGNED_RIGHT_SHIFT", ":", "argCount", "--", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "break", ";", "}", "returnType", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "break", ";", "}", "lastToken", "=", "token", ";", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "return", "null", ";", "}", "}", "if", "(", "parameterCount", ">", "0", "&&", "!", "foundClosingParenthesis", ")", "return", "null", ";", "if", "(", "argCount", ">", "0", ")", "return", "null", ";", "char", "[", "]", "selectorChars", "=", "null", ";", "if", "(", "isConstructor", ")", "{", "if", "(", "declaringType", "==", "null", ")", "declaringType", "=", "selector", ";", "else", "if", "(", "selector", "!=", "null", ")", "declaringType", "+=", "'.'", "+", "selector", ";", "}", "else", "{", "if", "(", "selector", "==", "null", ")", "return", "null", ";", "selectorChars", "=", "selector", ".", "toCharArray", "(", ")", ";", "if", "(", "selectorChars", ".", "length", "==", "1", "&&", "selectorChars", "[", "0", "]", "==", "'*'", ")", "selectorChars", "=", "null", ";", "}", "char", "[", "]", "declaringTypeQualification", "=", "null", ",", "declaringTypeSimpleName", "=", "null", ";", "char", "[", "]", "returnTypeQualification", "=", "null", ",", "returnTypeSimpleName", "=", "null", ";", "char", "[", "]", "[", "]", "parameterTypeQualifications", "=", "null", ",", "parameterTypeSimpleNames", "=", "null", ";", "String", "declaringTypeSignature", "=", "null", ";", "String", "returnTypeSignature", "=", "null", ";", "String", "[", "]", "parameterTypeSignatures", "=", "null", ";", "if", "(", "declaringType", "!=", "null", ")", "{", "char", "[", "]", "declaringTypePart", "=", "null", ";", "try", "{", "declaringTypeSignature", "=", "Signature", ".", "createTypeSignature", "(", "declaringType", ",", "false", ")", ";", "if", "(", "declaringTypeSignature", ".", "indexOf", "(", "Signature", ".", "C_GENERIC_START", ")", "<", "0", ")", "{", "declaringTypePart", "=", "declaringType", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "declaringTypePart", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "declaringTypeSignature", ".", "toCharArray", "(", ")", ")", ")", ";", "}", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "return", "null", ";", "}", "int", "lastDotPosition", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "declaringTypePart", ")", ";", "if", "(", "lastDotPosition", ">=", "0", ")", "{", "declaringTypeQualification", "=", "CharOperation", ".", "subarray", "(", "declaringTypePart", ",", "0", ",", "lastDotPosition", ")", ";", "if", "(", "declaringTypeQualification", ".", "length", "==", "1", "&&", "declaringTypeQualification", "[", "0", "]", "==", "'*'", ")", "declaringTypeQualification", "=", "null", ";", "declaringTypeSimpleName", "=", "CharOperation", ".", "subarray", "(", "declaringTypePart", ",", "lastDotPosition", "+", "1", ",", "declaringTypePart", ".", "length", ")", ";", "}", "else", "{", "declaringTypeSimpleName", "=", "declaringTypePart", ";", "}", "if", "(", "declaringTypeSimpleName", ".", "length", "==", "1", "&&", "declaringTypeSimpleName", "[", "0", "]", "==", "'*'", ")", "declaringTypeSimpleName", "=", "null", ";", "}", "if", "(", "parameterCount", ">=", "0", ")", "{", "parameterTypeQualifications", "=", "new", "char", "[", "parameterCount", "]", "[", "]", ";", "parameterTypeSimpleNames", "=", "new", "char", "[", "parameterCount", "]", "[", "]", ";", "parameterTypeSignatures", "=", "new", "String", "[", "parameterCount", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameterCount", ";", "i", "++", ")", "{", "char", "[", "]", "parameterTypePart", "=", "null", ";", "try", "{", "if", "(", "parameterTypes", "!=", "null", ")", "{", "parameterTypeSignatures", "[", "i", "]", "=", "Signature", ".", "createTypeSignature", "(", "parameterTypes", "[", "i", "]", ",", "false", ")", ";", "if", "(", "parameterTypeSignatures", "[", "i", "]", ".", "indexOf", "(", "Signature", ".", "C_GENERIC_START", ")", "<", "0", ")", "{", "parameterTypePart", "=", "parameterTypes", "[", "i", "]", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "parameterTypePart", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "parameterTypeSignatures", "[", "i", "]", ".", "toCharArray", "(", ")", ")", ")", ";", "}", "}", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "return", "null", ";", "}", "int", "lastDotPosition", "=", "parameterTypePart", "==", "null", "?", "-", "1", ":", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "parameterTypePart", ")", ";", "if", "(", "parameterTypePart", "!=", "null", "&&", "lastDotPosition", ">=", "0", ")", "{", "parameterTypeQualifications", "[", "i", "]", "=", "CharOperation", ".", "subarray", "(", "parameterTypePart", ",", "0", ",", "lastDotPosition", ")", ";", "if", "(", "parameterTypeQualifications", "[", "i", "]", ".", "length", "==", "1", "&&", "parameterTypeQualifications", "[", "i", "]", "[", "0", "]", "==", "'*'", ")", "{", "parameterTypeQualifications", "[", "i", "]", "=", "null", ";", "}", "else", "{", "parameterTypeQualifications", "[", "i", "]", "=", "CharOperation", ".", "concat", "(", "IIndexConstants", ".", "ONE_STAR", ",", "parameterTypeQualifications", "[", "i", "]", ")", ";", "}", "parameterTypeSimpleNames", "[", "i", "]", "=", "CharOperation", ".", "subarray", "(", "parameterTypePart", ",", "lastDotPosition", "+", "1", ",", "parameterTypePart", ".", "length", ")", ";", "}", "else", "{", "parameterTypeQualifications", "[", "i", "]", "=", "null", ";", "parameterTypeSimpleNames", "[", "i", "]", "=", "parameterTypePart", ";", "}", "if", "(", "parameterTypeSimpleNames", "[", "i", "]", ".", "length", "==", "1", "&&", "parameterTypeSimpleNames", "[", "i", "]", "[", "0", "]", "==", "'*'", ")", "parameterTypeSimpleNames", "[", "i", "]", "=", "null", ";", "}", "}", "if", "(", "returnType", "!=", "null", ")", "{", "char", "[", "]", "returnTypePart", "=", "null", ";", "try", "{", "returnTypeSignature", "=", "Signature", ".", "createTypeSignature", "(", "returnType", ",", "false", ")", ";", "if", "(", "returnTypeSignature", ".", "indexOf", "(", "Signature", ".", "C_GENERIC_START", ")", "<", "0", ")", "{", "returnTypePart", "=", "returnType", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "returnTypePart", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "returnTypeSignature", ".", "toCharArray", "(", ")", ")", ")", ";", "}", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "return", "null", ";", "}", "int", "lastDotPosition", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "returnTypePart", ")", ";", "if", "(", "lastDotPosition", ">=", "0", ")", "{", "returnTypeQualification", "=", "CharOperation", ".", "subarray", "(", "returnTypePart", ",", "0", ",", "lastDotPosition", ")", ";", "if", "(", "returnTypeQualification", ".", "length", "==", "1", "&&", "returnTypeQualification", "[", "0", "]", "==", "'*'", ")", "{", "returnTypeQualification", "=", "null", ";", "}", "else", "{", "returnTypeQualification", "=", "CharOperation", ".", "concat", "(", "IIndexConstants", ".", "ONE_STAR", ",", "returnTypeQualification", ")", ";", "}", "returnTypeSimpleName", "=", "CharOperation", ".", "subarray", "(", "returnTypePart", ",", "lastDotPosition", "+", "1", ",", "returnTypePart", ".", "length", ")", ";", "}", "else", "{", "returnTypeSimpleName", "=", "returnTypePart", ";", "}", "if", "(", "returnTypeSimpleName", ".", "length", "==", "1", "&&", "returnTypeSimpleName", "[", "0", "]", "==", "'*'", ")", "returnTypeSimpleName", "=", "null", ";", "}", "if", "(", "isConstructor", ")", "{", "return", "new", "ConstructorPattern", "(", "declaringTypeSimpleName", ",", "declaringTypeQualification", ",", "declaringTypeSignature", ",", "parameterTypeQualifications", ",", "parameterTypeSimpleNames", ",", "parameterTypeSignatures", ",", "typeArguments", ",", "limitTo", ",", "matchRule", ")", ";", "}", "else", "{", "return", "new", "MethodPattern", "(", "selectorChars", ",", "declaringTypeQualification", ",", "declaringTypeSimpleName", ",", "declaringTypeSignature", ",", "returnTypeQualification", ",", "returnTypeSimpleName", ",", "returnTypeSignature", ",", "parameterTypeQualifications", ",", "parameterTypeSimpleNames", ",", "parameterTypeSignatures", ",", "typeArguments", ",", "limitTo", ",", "matchRule", ")", ";", "}", "}", "public", "static", "SearchPattern", "createOrPattern", "(", "SearchPattern", "leftPattern", ",", "SearchPattern", "rightPattern", ")", "{", "return", "new", "OrPattern", "(", "leftPattern", ",", "rightPattern", ")", ";", "}", "private", "static", "SearchPattern", "createPackagePattern", "(", "String", "patternString", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "switch", "(", "limitTo", ")", "{", "case", "IJavaSearchConstants", ".", "DECLARATIONS", ":", "return", "new", "PackageDeclarationPattern", "(", "patternString", ".", "toCharArray", "(", ")", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "REFERENCES", ":", "return", "new", "PackageReferencePattern", "(", "patternString", ".", "toCharArray", "(", ")", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "ALL_OCCURRENCES", ":", "return", "new", "OrPattern", "(", "new", "PackageDeclarationPattern", "(", "patternString", ".", "toCharArray", "(", ")", ",", "matchRule", ")", ",", "new", "PackageReferencePattern", "(", "patternString", ".", "toCharArray", "(", ")", ",", "matchRule", ")", ")", ";", "}", "return", "null", ";", "}", "public", "static", "SearchPattern", "createPattern", "(", "String", "stringPattern", ",", "int", "searchFor", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "if", "(", "stringPattern", "==", "null", "||", "stringPattern", ".", "length", "(", ")", "==", "0", ")", "return", "null", ";", "if", "(", "(", "matchRule", "=", "validateMatchRule", "(", "stringPattern", ",", "matchRule", ")", ")", "==", "-", "1", ")", "{", "return", "null", ";", "}", "limitTo", "&=", "~", "(", "IJavaSearchConstants", ".", "IGNORE_DECLARING_TYPE", "+", "IJavaSearchConstants", ".", "IGNORE_RETURN_TYPE", ")", ";", "switch", "(", "searchFor", ")", "{", "case", "IJavaSearchConstants", ".", "CLASS", ":", "return", "createTypePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "IIndexConstants", ".", "CLASS_SUFFIX", ")", ";", "case", "IJavaSearchConstants", ".", "CLASS_AND_INTERFACE", ":", "return", "createTypePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "IIndexConstants", ".", "CLASS_AND_INTERFACE_SUFFIX", ")", ";", "case", "IJavaSearchConstants", ".", "CLASS_AND_ENUM", ":", "return", "createTypePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "IIndexConstants", ".", "CLASS_AND_ENUM_SUFFIX", ")", ";", "case", "IJavaSearchConstants", ".", "INTERFACE", ":", "return", "createTypePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "IIndexConstants", ".", "INTERFACE_SUFFIX", ")", ";", "case", "IJavaSearchConstants", ".", "INTERFACE_AND_ANNOTATION", ":", "return", "createTypePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "IIndexConstants", ".", "INTERFACE_AND_ANNOTATION_SUFFIX", ")", ";", "case", "IJavaSearchConstants", ".", "ENUM", ":", "return", "createTypePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "IIndexConstants", ".", "ENUM_SUFFIX", ")", ";", "case", "IJavaSearchConstants", ".", "ANNOTATION_TYPE", ":", "return", "createTypePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "IIndexConstants", ".", "ANNOTATION_TYPE_SUFFIX", ")", ";", "case", "IJavaSearchConstants", ".", "TYPE", ":", "return", "createTypePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "IIndexConstants", ".", "TYPE_SUFFIX", ")", ";", "case", "IJavaSearchConstants", ".", "METHOD", ":", "return", "createMethodOrConstructorPattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "false", ")", ";", "case", "IJavaSearchConstants", ".", "CONSTRUCTOR", ":", "return", "createMethodOrConstructorPattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ",", "true", ")", ";", "case", "IJavaSearchConstants", ".", "FIELD", ":", "return", "createFieldPattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "PACKAGE", ":", "return", "createPackagePattern", "(", "stringPattern", ",", "limitTo", ",", "matchRule", ")", ";", "}", "return", "null", ";", "}", "public", "static", "SearchPattern", "createPattern", "(", "IJavaElement", "element", ",", "int", "limitTo", ")", "{", "return", "createPattern", "(", "element", ",", "limitTo", ",", "R_EXACT_MATCH", "|", "R_CASE_SENSITIVE", "|", "R_ERASURE_MATCH", ")", ";", "}", "public", "static", "SearchPattern", "createPattern", "(", "IJavaElement", "element", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "SearchPattern", "searchPattern", "=", "null", ";", "int", "lastDot", ";", "boolean", "ignoreDeclaringType", "=", "false", ";", "boolean", "ignoreReturnType", "=", "false", ";", "int", "maskedLimitTo", "=", "limitTo", "&", "~", "(", "IJavaSearchConstants", ".", "IGNORE_DECLARING_TYPE", "+", "IJavaSearchConstants", ".", "IGNORE_RETURN_TYPE", ")", ";", "if", "(", "maskedLimitTo", "==", "IJavaSearchConstants", ".", "DECLARATIONS", "||", "maskedLimitTo", "==", "IJavaSearchConstants", ".", "ALL_OCCURRENCES", ")", "{", "ignoreDeclaringType", "=", "(", "limitTo", "&", "IJavaSearchConstants", ".", "IGNORE_DECLARING_TYPE", ")", "!=", "0", ";", "ignoreReturnType", "=", "(", "limitTo", "&", "IJavaSearchConstants", ".", "IGNORE_RETURN_TYPE", ")", "!=", "0", ";", "}", "if", "(", "(", "matchRule", "=", "validateMatchRule", "(", "null", ",", "matchRule", ")", ")", "==", "-", "1", ")", "{", "return", "null", ";", "}", "char", "[", "]", "declaringSimpleName", "=", "null", ";", "char", "[", "]", "declaringQualification", "=", "null", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "FIELD", ":", "IField", "field", "=", "(", "IField", ")", "element", ";", "if", "(", "!", "ignoreDeclaringType", ")", "{", "IType", "declaringClass", "=", "field", ".", "getDeclaringType", "(", ")", ";", "declaringSimpleName", "=", "declaringClass", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "declaringQualification", "=", "declaringClass", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "[", "]", "enclosingNames", "=", "enclosingTypeNames", "(", "declaringClass", ")", ";", "if", "(", "enclosingNames", ".", "length", ">", "0", ")", "{", "declaringQualification", "=", "CharOperation", ".", "concat", "(", "declaringQualification", ",", "CharOperation", ".", "concatWith", "(", "enclosingNames", ",", "'.'", ")", ",", "'.'", ")", ";", "}", "}", "char", "[", "]", "name", "=", "field", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "typeSimpleName", "=", "null", ";", "char", "[", "]", "typeQualification", "=", "null", ";", "String", "typeSignature", "=", "null", ";", "if", "(", "!", "ignoreReturnType", ")", "{", "try", "{", "typeSignature", "=", "field", ".", "getTypeSignature", "(", ")", ";", "char", "[", "]", "signature", "=", "typeSignature", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "typeErasure", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "signature", ")", ")", ";", "CharOperation", ".", "replace", "(", "typeErasure", ",", "'$'", ",", "'.'", ")", ";", "if", "(", "(", "lastDot", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "typeErasure", ")", ")", "==", "-", "1", ")", "{", "typeSimpleName", "=", "typeErasure", ";", "}", "else", "{", "typeSimpleName", "=", "CharOperation", ".", "subarray", "(", "typeErasure", ",", "lastDot", "+", "1", ",", "typeErasure", ".", "length", ")", ";", "typeQualification", "=", "CharOperation", ".", "subarray", "(", "typeErasure", ",", "0", ",", "lastDot", ")", ";", "if", "(", "!", "field", ".", "isBinary", "(", ")", ")", "{", "typeQualification", "=", "CharOperation", ".", "concat", "(", "IIndexConstants", ".", "ONE_STAR", ",", "typeQualification", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "searchPattern", "=", "new", "FieldPattern", "(", "name", ",", "declaringQualification", ",", "declaringSimpleName", ",", "typeQualification", ",", "typeSimpleName", ",", "typeSignature", ",", "limitTo", ",", "matchRule", ")", ";", "break", ";", "case", "IJavaElement", ".", "IMPORT_DECLARATION", ":", "String", "elementName", "=", "element", ".", "getElementName", "(", ")", ";", "lastDot", "=", "elementName", ".", "lastIndexOf", "(", "'.'", ")", ";", "if", "(", "lastDot", "==", "-", "1", ")", "return", "null", ";", "IImportDeclaration", "importDecl", "=", "(", "IImportDeclaration", ")", "element", ";", "if", "(", "importDecl", ".", "isOnDemand", "(", ")", ")", "{", "searchPattern", "=", "createPackagePattern", "(", "elementName", ".", "substring", "(", "0", ",", "lastDot", ")", ",", "maskedLimitTo", ",", "matchRule", ")", ";", "}", "else", "{", "searchPattern", "=", "createTypePattern", "(", "elementName", ".", "substring", "(", "lastDot", "+", "1", ")", ".", "toCharArray", "(", ")", ",", "elementName", ".", "substring", "(", "0", ",", "lastDot", ")", ".", "toCharArray", "(", ")", ",", "null", ",", "null", ",", "null", ",", "maskedLimitTo", ",", "matchRule", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "LOCAL_VARIABLE", ":", "LocalVariable", "localVar", "=", "(", "LocalVariable", ")", "element", ";", "searchPattern", "=", "new", "LocalVariablePattern", "(", "localVar", ",", "limitTo", ",", "matchRule", ")", ";", "break", ";", "case", "IJavaElement", ".", "TYPE_PARAMETER", ":", "ITypeParameter", "typeParam", "=", "(", "ITypeParameter", ")", "element", ";", "boolean", "findParamDeclarations", "=", "true", ";", "boolean", "findParamReferences", "=", "true", ";", "switch", "(", "maskedLimitTo", ")", "{", "case", "IJavaSearchConstants", ".", "DECLARATIONS", ":", "findParamReferences", "=", "false", ";", "break", ";", "case", "IJavaSearchConstants", ".", "REFERENCES", ":", "findParamDeclarations", "=", "false", ";", "break", ";", "}", "searchPattern", "=", "new", "TypeParameterPattern", "(", "findParamDeclarations", ",", "findParamReferences", ",", "typeParam", ",", "matchRule", ")", ";", "break", ";", "case", "IJavaElement", ".", "METHOD", ":", "IMethod", "method", "=", "(", "IMethod", ")", "element", ";", "boolean", "isConstructor", ";", "try", "{", "isConstructor", "=", "method", ".", "isConstructor", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "IType", "declaringClass", "=", "method", ".", "getDeclaringType", "(", ")", ";", "if", "(", "ignoreDeclaringType", ")", "{", "if", "(", "isConstructor", ")", "declaringSimpleName", "=", "declaringClass", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "declaringSimpleName", "=", "declaringClass", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "declaringQualification", "=", "declaringClass", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "[", "]", "enclosingNames", "=", "enclosingTypeNames", "(", "declaringClass", ")", ";", "if", "(", "enclosingNames", ".", "length", ">", "0", ")", "{", "declaringQualification", "=", "CharOperation", ".", "concat", "(", "declaringQualification", ",", "CharOperation", ".", "concatWith", "(", "enclosingNames", ",", "'.'", ")", ",", "'.'", ")", ";", "}", "}", "char", "[", "]", "selector", "=", "method", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "returnSimpleName", "=", "null", ";", "char", "[", "]", "returnQualification", "=", "null", ";", "String", "returnSignature", "=", "null", ";", "if", "(", "!", "ignoreReturnType", ")", "{", "try", "{", "returnSignature", "=", "method", ".", "getReturnType", "(", ")", ";", "char", "[", "]", "signature", "=", "returnSignature", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "returnErasure", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "signature", ")", ")", ";", "CharOperation", ".", "replace", "(", "returnErasure", ",", "'$'", ",", "'.'", ")", ";", "if", "(", "(", "lastDot", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "returnErasure", ")", ")", "==", "-", "1", ")", "{", "returnSimpleName", "=", "returnErasure", ";", "}", "else", "{", "returnSimpleName", "=", "CharOperation", ".", "subarray", "(", "returnErasure", ",", "lastDot", "+", "1", ",", "returnErasure", ".", "length", ")", ";", "returnQualification", "=", "CharOperation", ".", "subarray", "(", "returnErasure", ",", "0", ",", "lastDot", ")", ";", "if", "(", "!", "method", ".", "isBinary", "(", ")", ")", "{", "CharOperation", ".", "concat", "(", "IIndexConstants", ".", "ONE_STAR", ",", "returnQualification", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "String", "[", "]", "parameterTypes", "=", "method", ".", "getParameterTypes", "(", ")", ";", "int", "paramCount", "=", "parameterTypes", ".", "length", ";", "char", "[", "]", "[", "]", "parameterSimpleNames", "=", "new", "char", "[", "paramCount", "]", "[", "]", ";", "char", "[", "]", "[", "]", "parameterQualifications", "=", "new", "char", "[", "paramCount", "]", "[", "]", ";", "String", "[", "]", "parameterSignatures", "=", "new", "String", "[", "paramCount", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paramCount", ";", "i", "++", ")", "{", "parameterSignatures", "[", "i", "]", "=", "parameterTypes", "[", "i", "]", ";", "char", "[", "]", "signature", "=", "parameterSignatures", "[", "i", "]", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "paramErasure", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "signature", ")", ")", ";", "CharOperation", ".", "replace", "(", "paramErasure", ",", "'$'", ",", "'.'", ")", ";", "if", "(", "(", "lastDot", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "paramErasure", ")", ")", "==", "-", "1", ")", "{", "parameterSimpleNames", "[", "i", "]", "=", "paramErasure", ";", "parameterQualifications", "[", "i", "]", "=", "null", ";", "}", "else", "{", "parameterSimpleNames", "[", "i", "]", "=", "CharOperation", ".", "subarray", "(", "paramErasure", ",", "lastDot", "+", "1", ",", "paramErasure", ".", "length", ")", ";", "parameterQualifications", "[", "i", "]", "=", "CharOperation", ".", "subarray", "(", "paramErasure", ",", "0", ",", "lastDot", ")", ";", "if", "(", "!", "method", ".", "isBinary", "(", ")", ")", "{", "CharOperation", ".", "concat", "(", "IIndexConstants", ".", "ONE_STAR", ",", "parameterQualifications", "[", "i", "]", ")", ";", "}", "}", "}", "if", "(", "isConstructor", ")", "{", "searchPattern", "=", "new", "ConstructorPattern", "(", "declaringSimpleName", ",", "declaringQualification", ",", "parameterQualifications", ",", "parameterSimpleNames", ",", "parameterSignatures", ",", "method", ",", "limitTo", ",", "matchRule", ")", ";", "}", "else", "{", "searchPattern", "=", "new", "MethodPattern", "(", "selector", ",", "declaringQualification", ",", "declaringSimpleName", ",", "returnQualification", ",", "returnSimpleName", ",", "returnSignature", ",", "parameterQualifications", ",", "parameterSimpleNames", ",", "parameterSignatures", ",", "method", ",", "limitTo", ",", "matchRule", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "IType", "type", "=", "(", "IType", ")", "element", ";", "searchPattern", "=", "createTypePattern", "(", "type", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ",", "type", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ",", "ignoreDeclaringType", "?", "null", ":", "enclosingTypeNames", "(", "type", ")", ",", "null", ",", "type", ",", "maskedLimitTo", ",", "matchRule", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_DECLARATION", ":", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "searchPattern", "=", "createPackagePattern", "(", "element", ".", "getElementName", "(", ")", ",", "maskedLimitTo", ",", "matchRule", ")", ";", "break", ";", "}", "if", "(", "searchPattern", "!=", "null", ")", "MatchLocator", ".", "setFocus", "(", "searchPattern", ",", "element", ")", ";", "return", "searchPattern", ";", "}", "private", "static", "SearchPattern", "createTypePattern", "(", "char", "[", "]", "simpleName", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "typeSignature", ",", "IType", "type", ",", "int", "limitTo", ",", "int", "matchRule", ")", "{", "switch", "(", "limitTo", ")", "{", "case", "IJavaSearchConstants", ".", "DECLARATIONS", ":", "return", "new", "TypeDeclarationPattern", "(", "packageName", ",", "enclosingTypeNames", ",", "simpleName", ",", "IIndexConstants", ".", "TYPE_SUFFIX", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "REFERENCES", ":", "if", "(", "type", "!=", "null", ")", "{", "return", "new", "TypeReferencePattern", "(", "CharOperation", ".", "concatWith", "(", "packageName", ",", "enclosingTypeNames", ",", "'.'", ")", ",", "simpleName", ",", "type", ",", "matchRule", ")", ";", "}", "return", "new", "TypeReferencePattern", "(", "CharOperation", ".", "concatWith", "(", "packageName", ",", "enclosingTypeNames", ",", "'.'", ")", ",", "simpleName", ",", "typeSignature", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "IMPLEMENTORS", ":", "return", "new", "SuperTypeReferencePattern", "(", "CharOperation", ".", "concatWith", "(", "packageName", ",", "enclosingTypeNames", ",", "'.'", ")", ",", "simpleName", ",", "SuperTypeReferencePattern", ".", "ONLY_SUPER_INTERFACES", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "ALL_OCCURRENCES", ":", "return", "new", "OrPattern", "(", "new", "TypeDeclarationPattern", "(", "packageName", ",", "enclosingTypeNames", ",", "simpleName", ",", "IIndexConstants", ".", "TYPE_SUFFIX", ",", "matchRule", ")", ",", "(", "type", "!=", "null", ")", "?", "new", "TypeReferencePattern", "(", "CharOperation", ".", "concatWith", "(", "packageName", ",", "enclosingTypeNames", ",", "'.'", ")", ",", "simpleName", ",", "type", ",", "matchRule", ")", ":", "new", "TypeReferencePattern", "(", "CharOperation", ".", "concatWith", "(", "packageName", ",", "enclosingTypeNames", ",", "'.'", ")", ",", "simpleName", ",", "typeSignature", ",", "matchRule", ")", ")", ";", "default", ":", "if", "(", "type", "!=", "null", ")", "{", "return", "new", "TypeReferencePattern", "(", "CharOperation", ".", "concatWith", "(", "packageName", ",", "enclosingTypeNames", ",", "'.'", ")", ",", "simpleName", ",", "type", ",", "limitTo", ",", "matchRule", ")", ";", "}", "}", "return", "null", ";", "}", "private", "static", "SearchPattern", "createTypePattern", "(", "String", "patternString", ",", "int", "limitTo", ",", "int", "matchRule", ",", "char", "indexSuffix", ")", "{", "Scanner", "scanner", "=", "new", "Scanner", "(", "false", ",", "true", ",", "false", ",", "ClassFileConstants", ".", "JDK1_3", ",", "null", ",", "null", ",", "true", ")", ";", "scanner", ".", "setSource", "(", "patternString", ".", "toCharArray", "(", ")", ")", ";", "String", "type", "=", "null", ";", "int", "token", ";", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "return", "null", ";", "}", "int", "argCount", "=", "0", ";", "while", "(", "token", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "if", "(", "argCount", "==", "0", ")", "{", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameWHITESPACE", ":", "break", ";", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "default", ":", "if", "(", "type", "==", "null", ")", "type", "=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "else", "type", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "}", "else", "{", "switch", "(", "token", ")", "{", "case", "TerminalTokens", ".", "TokenNameGREATER", ":", "case", "TerminalTokens", ".", "TokenNameRIGHT_SHIFT", ":", "case", "TerminalTokens", ".", "TokenNameUNSIGNED_RIGHT_SHIFT", ":", "argCount", "--", ";", "break", ";", "case", "TerminalTokens", ".", "TokenNameLESS", ":", "argCount", "++", ";", "break", ";", "}", "if", "(", "type", "==", "null", ")", "return", "null", ";", "type", "+=", "scanner", ".", "getCurrentTokenString", "(", ")", ";", "}", "try", "{", "token", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "return", "null", ";", "}", "}", "if", "(", "type", "==", "null", ")", "return", "null", ";", "String", "typeSignature", "=", "null", ";", "char", "[", "]", "qualificationChars", "=", "null", ",", "typeChars", "=", "null", ";", "char", "[", "]", "typePart", "=", "null", ";", "try", "{", "typeSignature", "=", "Signature", ".", "createTypeSignature", "(", "type", ",", "false", ")", ";", "if", "(", "typeSignature", ".", "indexOf", "(", "Signature", ".", "C_GENERIC_START", ")", "<", "0", ")", "{", "typePart", "=", "type", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "typePart", "=", "Signature", ".", "toCharArray", "(", "Signature", ".", "getTypeErasure", "(", "typeSignature", ".", "toCharArray", "(", ")", ")", ")", ";", "}", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "return", "null", ";", "}", "int", "lastDotPosition", "=", "CharOperation", ".", "lastIndexOf", "(", "'.'", ",", "typePart", ")", ";", "if", "(", "lastDotPosition", ">=", "0", ")", "{", "qualificationChars", "=", "CharOperation", ".", "subarray", "(", "typePart", ",", "0", ",", "lastDotPosition", ")", ";", "if", "(", "qualificationChars", ".", "length", "==", "1", "&&", "qualificationChars", "[", "0", "]", "==", "'*'", ")", "qualificationChars", "=", "null", ";", "typeChars", "=", "CharOperation", ".", "subarray", "(", "typePart", ",", "lastDotPosition", "+", "1", ",", "typePart", ".", "length", ")", ";", "}", "else", "{", "typeChars", "=", "typePart", ";", "}", "if", "(", "typeChars", ".", "length", "==", "1", "&&", "typeChars", "[", "0", "]", "==", "'*'", ")", "{", "typeChars", "=", "null", ";", "}", "switch", "(", "limitTo", ")", "{", "case", "IJavaSearchConstants", ".", "DECLARATIONS", ":", "return", "new", "QualifiedTypeDeclarationPattern", "(", "qualificationChars", ",", "typeChars", ",", "indexSuffix", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "REFERENCES", ":", "return", "new", "TypeReferencePattern", "(", "qualificationChars", ",", "typeChars", ",", "typeSignature", ",", "indexSuffix", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "IMPLEMENTORS", ":", "return", "new", "SuperTypeReferencePattern", "(", "qualificationChars", ",", "typeChars", ",", "SuperTypeReferencePattern", ".", "ONLY_SUPER_INTERFACES", ",", "indexSuffix", ",", "matchRule", ")", ";", "case", "IJavaSearchConstants", ".", "ALL_OCCURRENCES", ":", "return", "new", "OrPattern", "(", "new", "QualifiedTypeDeclarationPattern", "(", "qualificationChars", ",", "typeChars", ",", "indexSuffix", ",", "matchRule", ")", ",", "new", "TypeReferencePattern", "(", "qualificationChars", ",", "typeChars", ",", "typeSignature", ",", "indexSuffix", ",", "matchRule", ")", ")", ";", "default", ":", "return", "new", "TypeReferencePattern", "(", "qualificationChars", ",", "typeChars", ",", "typeSignature", ",", "limitTo", ",", "indexSuffix", ",", "matchRule", ")", ";", "}", "}", "private", "static", "char", "[", "]", "[", "]", "enclosingTypeNames", "(", "IType", "type", ")", "{", "IJavaElement", "parent", "=", "type", ".", "getParent", "(", ")", ";", "switch", "(", "parent", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "CLASS_FILE", ":", "IType", "declaringType", "=", "type", ".", "getDeclaringType", "(", ")", ";", "if", "(", "declaringType", "==", "null", ")", "return", "CharOperation", ".", "NO_CHAR_CHAR", ";", "return", "CharOperation", ".", "arrayConcat", "(", "enclosingTypeNames", "(", "declaringType", ")", ",", "declaringType", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "return", "CharOperation", ".", "NO_CHAR_CHAR", ";", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "INITIALIZER", ":", "case", "IJavaElement", ".", "METHOD", ":", "IType", "declaringClass", "=", "(", "(", "IMember", ")", "parent", ")", ".", "getDeclaringType", "(", ")", ";", "return", "CharOperation", ".", "arrayConcat", "(", "enclosingTypeNames", "(", "declaringClass", ")", ",", "new", "char", "[", "]", "[", "]", "{", "declaringClass", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ",", "IIndexConstants", ".", "ONE_STAR", "}", ")", ";", "case", "IJavaElement", ".", "TYPE", ":", "return", "CharOperation", ".", "arrayConcat", "(", "enclosingTypeNames", "(", "(", "IType", ")", "parent", ")", ",", "parent", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "default", ":", "return", "null", ";", "}", "}", "public", "void", "decodeIndexKey", "(", "char", "[", "]", "key", ")", "{", "}", "public", "void", "findIndexMatches", "(", "Index", "index", ",", "IndexQueryRequestor", "requestor", ",", "SearchParticipant", "participant", ",", "IJavaSearchScope", "scope", ",", "IProgressMonitor", "monitor", ")", "throws", "IOException", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "try", "{", "index", ".", "startQuery", "(", ")", ";", "SearchPattern", "pattern", "=", "currentPattern", "(", ")", ";", "EntryResult", "[", "]", "entries", "=", "pattern", ".", "queryIn", "(", "index", ")", ";", "if", "(", "entries", "==", "null", ")", "return", ";", "SearchPattern", "decodedResult", "=", "pattern", ".", "getBlankPattern", "(", ")", ";", "String", "containerPath", "=", "index", ".", "containerPath", ";", "char", "separator", "=", "index", ".", "separator", ";", "for", "(", "int", "i", "=", "0", ",", "l", "=", "entries", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "EntryResult", "entry", "=", "entries", "[", "i", "]", ";", "decodedResult", ".", "decodeIndexKey", "(", "entry", ".", "getWord", "(", ")", ")", ";", "if", "(", "pattern", ".", "matchesDecodedKey", "(", "decodedResult", ")", ")", "{", "String", "[", "]", "names", "=", "entry", ".", "getDocumentNames", "(", "index", ")", ";", "for", "(", "int", "j", "=", "0", ",", "n", "=", "names", ".", "length", ";", "j", "<", "n", ";", "j", "++", ")", "acceptMatch", "(", "names", "[", "j", "]", ",", "containerPath", ",", "separator", ",", "decodedResult", ",", "requestor", ",", "participant", ",", "scope", ",", "monitor", ")", ";", "}", "}", "}", "finally", "{", "index", ".", "stopQuery", "(", ")", ";", "}", "}", "public", "abstract", "SearchPattern", "getBlankPattern", "(", ")", ";", "public", "char", "[", "]", "getIndexKey", "(", ")", "{", "return", "null", ";", "}", "public", "char", "[", "]", "[", "]", "getIndexCategories", "(", ")", "{", "return", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "public", "final", "int", "getMatchRule", "(", ")", "{", "return", "this", ".", "matchRule", ";", "}", "public", "boolean", "isPolymorphicSearch", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "matchesDecodedKey", "(", "SearchPattern", "decodedPattern", ")", "{", "return", "true", ";", "}", "public", "boolean", "matchesName", "(", "char", "[", "]", "pattern", ",", "char", "[", "]", "name", ")", "{", "if", "(", "pattern", "==", "null", ")", "return", "true", ";", "if", "(", "name", "!=", "null", ")", "{", "boolean", "isCaseSensitive", "=", "(", "this", ".", "matchRule", "&", "R_CASE_SENSITIVE", ")", "!=", "0", ";", "int", "matchMode", "=", "this", ".", "matchRule", "&", "MODE_MASK", ";", "boolean", "emptyPattern", "=", "pattern", ".", "length", "==", "0", ";", "if", "(", "emptyPattern", "&&", "(", "this", ".", "matchRule", "&", "R_PREFIX_MATCH", ")", "!=", "0", ")", "return", "true", ";", "boolean", "sameLength", "=", "pattern", ".", "length", "==", "name", ".", "length", ";", "boolean", "canBePrefix", "=", "name", ".", "length", ">=", "pattern", ".", "length", ";", "boolean", "matchFirstChar", "=", "!", "isCaseSensitive", "||", "emptyPattern", "||", "(", "name", ".", "length", ">", "0", "&&", "pattern", "[", "0", "]", "==", "name", "[", "0", "]", ")", ";", "switch", "(", "matchMode", ")", "{", "case", "R_EXACT_MATCH", ":", "if", "(", "sameLength", "&&", "matchFirstChar", ")", "{", "return", "CharOperation", ".", "equals", "(", "pattern", ",", "name", ",", "isCaseSensitive", ")", ";", "}", "break", ";", "case", "R_PREFIX_MATCH", ":", "if", "(", "canBePrefix", "&&", "matchFirstChar", ")", "{", "return", "CharOperation", ".", "prefixEquals", "(", "pattern", ",", "name", ",", "isCaseSensitive", ")", ";", "}", "break", ";", "case", "R_PATTERN_MATCH", ":", "if", "(", "!", "isCaseSensitive", ")", "pattern", "=", "CharOperation", ".", "toLowerCase", "(", "pattern", ")", ";", "return", "CharOperation", ".", "match", "(", "pattern", ",", "name", ",", "isCaseSensitive", ")", ";", "case", "SearchPattern", ".", "R_CAMELCASE_MATCH", ":", "if", "(", "matchFirstChar", "&&", "CharOperation", ".", "camelCaseMatch", "(", "pattern", ",", "name", ",", "false", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "isCaseSensitive", "&&", "matchFirstChar", "&&", "CharOperation", ".", "prefixEquals", "(", "pattern", ",", "name", ",", "false", ")", ")", "{", "return", "true", ";", "}", "break", ";", "case", "SearchPattern", ".", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ":", "return", "matchFirstChar", "&&", "CharOperation", ".", "camelCaseMatch", "(", "pattern", ",", "name", ",", "true", ")", ";", "case", "R_REGEXP_MATCH", ":", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "static", "int", "validateMatchRule", "(", "String", "stringPattern", ",", "int", "matchRule", ")", "{", "if", "(", "(", "matchRule", "&", "R_REGEXP_MATCH", ")", "!=", "0", ")", "{", "if", "(", "(", "matchRule", "&", "R_PATTERN_MATCH", ")", "!=", "0", "||", "(", "matchRule", "&", "R_PREFIX_MATCH", ")", "!=", "0", "||", "(", "matchRule", "&", "R_CAMELCASE_MATCH", ")", "!=", "0", "||", "(", "matchRule", "&", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ")", "!=", "0", ")", "{", "return", "-", "1", ";", "}", "}", "if", "(", "stringPattern", "!=", "null", ")", "{", "int", "starIndex", "=", "stringPattern", ".", "indexOf", "(", "'*'", ")", ";", "int", "questionIndex", "=", "stringPattern", ".", "indexOf", "(", "'?'", ")", ";", "if", "(", "starIndex", "<", "0", "&&", "questionIndex", "<", "0", ")", "{", "matchRule", "&=", "~", "R_PATTERN_MATCH", ";", "}", "else", "{", "matchRule", "|=", "R_PATTERN_MATCH", ";", "}", "}", "if", "(", "(", "matchRule", "&", "R_PATTERN_MATCH", ")", "!=", "0", ")", "{", "matchRule", "&=", "~", "R_CAMELCASE_MATCH", ";", "matchRule", "&=", "~", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ";", "matchRule", "&=", "~", "R_PREFIX_MATCH", ";", "return", "matchRule", ";", "}", "if", "(", "(", "matchRule", "&", "R_CAMELCASE_MATCH", ")", "!=", "0", ")", "{", "matchRule", "&=", "~", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ";", "matchRule", "&=", "~", "R_PREFIX_MATCH", ";", "boolean", "validCamelCase", "=", "validateCamelCasePattern", "(", "stringPattern", ")", ";", "if", "(", "!", "validCamelCase", ")", "{", "matchRule", "&=", "~", "R_CAMELCASE_MATCH", ";", "matchRule", "|=", "R_PREFIX_MATCH", ";", "}", "return", "matchRule", ";", "}", "if", "(", "(", "matchRule", "&", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ")", "!=", "0", ")", "{", "matchRule", "&=", "~", "R_PREFIX_MATCH", ";", "boolean", "validCamelCase", "=", "validateCamelCasePattern", "(", "stringPattern", ")", ";", "if", "(", "!", "validCamelCase", ")", "{", "matchRule", "&=", "~", "R_CAMELCASE_SAME_PART_COUNT_MATCH", ";", "}", "return", "matchRule", ";", "}", "return", "matchRule", ";", "}", "private", "static", "boolean", "validateCamelCasePattern", "(", "String", "stringPattern", ")", "{", "if", "(", "stringPattern", "==", "null", ")", "return", "true", ";", "int", "length", "=", "stringPattern", ".", "length", "(", ")", ";", "boolean", "validCamelCase", "=", "true", ";", "boolean", "lowerCamelCase", "=", "false", ";", "int", "uppercase", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", "&&", "validCamelCase", ";", "i", "++", ")", "{", "char", "ch", "=", "stringPattern", ".", "charAt", "(", "i", ")", ";", "validCamelCase", "=", "i", "==", "0", "?", "ScannerHelper", ".", "isJavaIdentifierStart", "(", "ch", ")", ":", "ScannerHelper", ".", "isJavaIdentifierPart", "(", "ch", ")", ";", "if", "(", "ScannerHelper", ".", "isUpperCase", "(", "ch", ")", ")", "uppercase", "++", ";", "if", "(", "i", "==", "0", ")", "lowerCamelCase", "=", "uppercase", "==", "0", ";", "}", "if", "(", "validCamelCase", ")", "{", "validCamelCase", "=", "lowerCamelCase", "?", "uppercase", ">", "0", ":", "uppercase", ">", "1", ";", "}", "return", "validCamelCase", ";", "}", "public", "EntryResult", "[", "]", "queryIn", "(", "Index", "index", ")", "throws", "IOException", "{", "return", "index", ".", "query", "(", "getIndexCategories", "(", ")", ",", "getIndexKey", "(", ")", ",", "getMatchRule", "(", ")", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", ";", "}", "}", "</s>" ]
4,965
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "public", "interface", "ITypeNameRequestor", "{", "void", "acceptClass", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ")", ";", "void", "acceptInterface", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ")", ";", "}", "</s>" ]
4,966
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "public", "class", "SearchMatch", "{", "public", "static", "final", "int", "A_ACCURATE", "=", "0", ";", "public", "static", "final", "int", "A_INACCURATE", "=", "1", ";", "private", "Object", "element", ";", "private", "int", "length", ";", "private", "int", "offset", ";", "private", "int", "accuracy", ";", "private", "SearchParticipant", "participant", ";", "private", "IResource", "resource", ";", "private", "boolean", "insideDocComment", "=", "false", ";", "private", "final", "static", "int", "ALL_GENERIC_FLAVORS", "=", "SearchPattern", ".", "R_FULL_MATCH", "|", "SearchPattern", ".", "R_EQUIVALENT_MATCH", "|", "SearchPattern", ".", "R_ERASURE_MATCH", ";", "private", "int", "rule", "=", "ALL_GENERIC_FLAVORS", ";", "private", "boolean", "raw", "=", "false", ";", "private", "boolean", "implicit", "=", "false", ";", "public", "SearchMatch", "(", "IJavaElement", "element", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "this", ".", "element", "=", "element", ";", "this", ".", "offset", "=", "offset", ";", "this", ".", "length", "=", "length", ";", "this", ".", "accuracy", "=", "accuracy", "&", "A_INACCURATE", ";", "if", "(", "accuracy", ">", "A_INACCURATE", ")", "{", "int", "genericFlavors", "=", "accuracy", "&", "ALL_GENERIC_FLAVORS", ";", "if", "(", "genericFlavors", ">", "0", ")", "{", "this", ".", "rule", "&=", "~", "ALL_GENERIC_FLAVORS", ";", "}", "this", ".", "rule", "|=", "accuracy", "&", "~", "A_INACCURATE", ";", "}", "this", ".", "participant", "=", "participant", ";", "this", ".", "resource", "=", "resource", ";", "}", "public", "final", "int", "getAccuracy", "(", ")", "{", "return", "this", ".", "accuracy", ";", "}", "public", "final", "Object", "getElement", "(", ")", "{", "return", "this", ".", "element", ";", "}", "public", "final", "int", "getLength", "(", ")", "{", "return", "this", ".", "length", ";", "}", "public", "final", "int", "getOffset", "(", ")", "{", "return", "this", ".", "offset", ";", "}", "public", "final", "SearchParticipant", "getParticipant", "(", ")", "{", "return", "this", ".", "participant", ";", "}", "public", "final", "IResource", "getResource", "(", ")", "{", "return", "this", ".", "resource", ";", "}", "public", "final", "int", "getRule", "(", ")", "{", "return", "this", ".", "rule", ";", "}", "public", "final", "boolean", "isEquivalent", "(", ")", "{", "return", "isErasure", "(", ")", "&&", "(", "this", ".", "rule", "&", "SearchPattern", ".", "R_EQUIVALENT_MATCH", ")", "!=", "0", ";", "}", "public", "final", "boolean", "isErasure", "(", ")", "{", "return", "(", "this", ".", "rule", "&", "SearchPattern", ".", "R_ERASURE_MATCH", ")", "!=", "0", ";", "}", "public", "final", "boolean", "isExact", "(", ")", "{", "return", "isEquivalent", "(", ")", "&&", "(", "this", ".", "rule", "&", "SearchPattern", ".", "R_FULL_MATCH", ")", "!=", "0", ";", "}", "public", "final", "boolean", "isImplicit", "(", ")", "{", "return", "this", ".", "implicit", ";", "}", "public", "final", "boolean", "isRaw", "(", ")", "{", "return", "this", ".", "raw", ";", "}", "public", "final", "boolean", "isInsideDocComment", "(", ")", "{", "return", "this", ".", "insideDocComment", ";", "}", "public", "final", "void", "setAccuracy", "(", "int", "accuracy", ")", "{", "this", ".", "accuracy", "=", "accuracy", ";", "}", "public", "final", "void", "setElement", "(", "Object", "element", ")", "{", "this", ".", "element", "=", "element", ";", "}", "public", "final", "void", "setInsideDocComment", "(", "boolean", "insideDoc", ")", "{", "this", ".", "insideDocComment", "=", "insideDoc", ";", "}", "public", "final", "void", "setImplicit", "(", "boolean", "implicit", ")", "{", "this", ".", "implicit", "=", "implicit", ";", "}", "public", "final", "void", "setLength", "(", "int", "length", ")", "{", "this", ".", "length", "=", "length", ";", "}", "public", "final", "void", "setOffset", "(", "int", "offset", ")", "{", "this", ".", "offset", "=", "offset", ";", "}", "public", "final", "void", "setParticipant", "(", "SearchParticipant", "participant", ")", "{", "this", ".", "participant", "=", "participant", ";", "}", "public", "final", "void", "setResource", "(", "IResource", "resource", ")", "{", "this", ".", "resource", "=", "resource", ";", "}", "public", "final", "void", "setRule", "(", "int", "rule", ")", "{", "this", ".", "rule", "=", "rule", ";", "}", "public", "final", "void", "setRaw", "(", "boolean", "raw", ")", "{", "this", ".", "raw", "=", "raw", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"Search", "match\"", ")", ";", "buffer", ".", "append", "(", "\"n", "accuracy=\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "accuracy", "==", "A_ACCURATE", "?", "\"ACCURATE\"", ":", "\"INACCURATE\"", ")", ";", "buffer", ".", "append", "(", "\"n", "rule=\"", ")", ";", "if", "(", "(", "this", ".", "rule", "&", "SearchPattern", ".", "R_FULL_MATCH", ")", "!=", "0", ")", "{", "buffer", ".", "append", "(", "\"EXACT\"", ")", ";", "}", "else", "if", "(", "(", "this", ".", "rule", "&", "SearchPattern", ".", "R_EQUIVALENT_MATCH", ")", "!=", "0", ")", "{", "buffer", ".", "append", "(", "\"EQUIVALENT\"", ")", ";", "}", "else", "if", "(", "(", "this", ".", "rule", "&", "SearchPattern", ".", "R_ERASURE_MATCH", ")", "!=", "0", ")", "{", "buffer", ".", "append", "(", "\"ERASURE\"", ")", ";", "}", "buffer", ".", "append", "(", "\"n", "raw=\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "raw", ")", ";", "buffer", ".", "append", "(", "\"n", "offset=\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "offset", ")", ";", "buffer", ".", "append", "(", "\"n", "length=\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "length", ")", ";", "if", "(", "this", ".", "element", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"n", "element=\"", ")", ";", "buffer", ".", "append", "(", "(", "(", "JavaElement", ")", "getElement", "(", ")", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "\"n\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
4,967
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "interface", "IJavaSearchScope", "{", "String", "JAR_FILE_ENTRY_SEPARATOR", "=", "\"|\"", ";", "int", "SOURCES", "=", "1", ";", "int", "APPLICATION_LIBRARIES", "=", "2", ";", "int", "SYSTEM_LIBRARIES", "=", "4", ";", "int", "REFERENCED_PROJECTS", "=", "8", ";", "public", "boolean", "encloses", "(", "String", "resourcePath", ")", ";", "public", "boolean", "encloses", "(", "IJavaElement", "element", ")", ";", "IPath", "[", "]", "enclosingProjectsAndJars", "(", ")", ";", "boolean", "includesBinaries", "(", ")", ";", "boolean", "includesClasspaths", "(", ")", ";", "public", "void", "setIncludesBinaries", "(", "boolean", "includesBinaries", ")", ";", "public", "void", "setIncludesClasspaths", "(", "boolean", "includesClasspaths", ")", ";", "}", "</s>" ]
4,968
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "*", ";", "public", "interface", "IJavaSearchConstants", "{", "int", "UNKNOWN", "=", "-", "1", ";", "int", "TYPE", "=", "0", ";", "int", "METHOD", "=", "1", ";", "int", "PACKAGE", "=", "2", ";", "int", "CONSTRUCTOR", "=", "3", ";", "int", "FIELD", "=", "4", ";", "int", "CLASS", "=", "5", ";", "int", "INTERFACE", "=", "6", ";", "int", "ENUM", "=", "7", ";", "int", "ANNOTATION_TYPE", "=", "8", ";", "int", "CLASS_AND_ENUM", "=", "9", ";", "int", "CLASS_AND_INTERFACE", "=", "10", ";", "int", "INTERFACE_AND_ANNOTATION", "=", "11", ";", "int", "DECLARATIONS", "=", "0", ";", "int", "IMPLEMENTORS", "=", "1", ";", "int", "REFERENCES", "=", "2", ";", "int", "ALL_OCCURRENCES", "=", "3", ";", "int", "READ_ACCESSES", "=", "4", ";", "int", "WRITE_ACCESSES", "=", "5", ";", "int", "IGNORE_DECLARING_TYPE", "=", "0x10", ";", "int", "IGNORE_RETURN_TYPE", "=", "0x20", ";", "int", "FIELD_DECLARATION_TYPE_REFERENCE", "=", "0x40", ";", "int", "LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE", "=", "0x80", ";", "int", "PARAMETER_DECLARATION_TYPE_REFERENCE", "=", "0x100", ";", "int", "SUPERTYPE_TYPE_REFERENCE", "=", "0x200", ";", "int", "THROWS_CLAUSE_TYPE_REFERENCE", "=", "0x400", ";", "int", "CAST_TYPE_REFERENCE", "=", "0x800", ";", "int", "CATCH_TYPE_REFERENCE", "=", "0x1000", ";", "int", "CLASS_INSTANCE_CREATION_TYPE_REFERENCE", "=", "0x2000", ";", "int", "RETURN_TYPE_REFERENCE", "=", "0x4000", ";", "int", "IMPORT_DECLARATION_TYPE_REFERENCE", "=", "0x8000", ";", "int", "ANNOTATION_TYPE_REFERENCE", "=", "0x10000", ";", "int", "TYPE_ARGUMENT_TYPE_REFERENCE", "=", "0x20000", ";", "int", "TYPE_VARIABLE_BOUND_TYPE_REFERENCE", "=", "0x40000", ";", "int", "WILDCARD_BOUND_TYPE_REFERENCE", "=", "0x80000", ";", "int", "INSTANCEOF_TYPE_REFERENCE", "=", "0x100000", ";", "int", "SUPER_REFERENCE", "=", "0x1000000", ";", "int", "QUALIFIED_REFERENCE", "=", "0x2000000", ";", "int", "THIS_REFERENCE", "=", "0x4000000", ";", "int", "IMPLICIT_THIS_REFERENCE", "=", "0x8000000", ";", "int", "EXACT_MATCH", "=", "0", ";", "int", "PREFIX_MATCH", "=", "1", ";", "int", "PATTERN_MATCH", "=", "2", ";", "boolean", "CASE_SENSITIVE", "=", "true", ";", "boolean", "CASE_INSENSITIVE", "=", "false", ";", "int", "FORCE_IMMEDIATE_SEARCH", "=", "IJob", ".", "ForceImmediate", ";", "int", "CANCEL_IF_NOT_READY_TO_SEARCH", "=", "IJob", ".", "CancelIfNotReady", ";", "int", "WAIT_UNTIL_READY_TO_SEARCH", "=", "IJob", ".", "WaitUntilReady", ";", "}", "</s>" ]
4,969
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "LocalVariableDeclarationMatch", "extends", "SearchMatch", "{", "public", "LocalVariableDeclarationMatch", "(", "IJavaElement", "element", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "}", "}", "</s>" ]
4,970
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "public", "abstract", "class", "TypeNameRequestor", "{", "public", "void", "acceptType", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ")", "{", "}", "}", "</s>" ]
4,971
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "public", "interface", "ISearchPattern", "{", "}", "</s>" ]
4,972
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "public", "abstract", "class", "ReferenceMatch", "extends", "SearchMatch", "{", "IJavaElement", "localElement", ";", "public", "ReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "setInsideDocComment", "(", "insideDocComment", ")", ";", "}", "final", "public", "IJavaElement", "getLocalElement", "(", ")", "{", "return", "this", ".", "localElement", ";", "}", "final", "public", "void", "setLocalElement", "(", "IJavaElement", "element", ")", "{", "this", ".", "localElement", "=", "element", ";", "}", "}", "</s>" ]
4,973
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModel", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IndexManager", ";", "public", "abstract", "class", "SearchParticipant", "{", "private", "IPath", "lastIndexLocation", ";", "protected", "SearchParticipant", "(", ")", "{", "}", "public", "void", "beginSearching", "(", ")", "{", "}", "public", "void", "doneSearching", "(", ")", "{", "}", "public", "String", "getDescription", "(", ")", "{", "return", "\"\"", ";", "}", "public", "abstract", "SearchDocument", "getDocument", "(", "String", "documentPath", ")", ";", "public", "abstract", "void", "indexDocument", "(", "SearchDocument", "document", ",", "IPath", "indexLocation", ")", ";", "public", "abstract", "void", "locateMatches", "(", "SearchDocument", "[", "]", "documents", ",", "SearchPattern", "pattern", ",", "IJavaSearchScope", "scope", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", ";", "public", "void", "removeIndex", "(", "IPath", "indexLocation", ")", "{", "IndexManager", "manager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "manager", ".", "removeIndexPath", "(", "indexLocation", ")", ";", "}", "public", "final", "void", "scheduleDocumentIndexing", "(", "SearchDocument", "document", ",", "IPath", "indexLocation", ")", "{", "IPath", "documentPath", "=", "new", "Path", "(", "document", ".", "getPath", "(", ")", ")", ";", "Object", "file", "=", "JavaModel", ".", "getTarget", "(", "documentPath", ",", "true", ")", ";", "IPath", "containerPath", "=", "documentPath", ";", "if", "(", "file", "instanceof", "IResource", ")", "{", "containerPath", "=", "(", "(", "IResource", ")", "file", ")", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ";", "}", "else", "if", "(", "file", "==", "null", ")", "{", "containerPath", "=", "documentPath", ".", "removeLastSegments", "(", "documentPath", ".", "segmentCount", "(", ")", "-", "1", ")", ";", "}", "IndexManager", "manager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "manager", ".", "ensureIndexExists", "(", "indexLocation", ",", "containerPath", ")", ";", "manager", ".", "scheduleDocumentIndexing", "(", "document", ",", "containerPath", ",", "indexLocation", ",", "this", ")", ";", "if", "(", "!", "indexLocation", ".", "equals", "(", "this", ".", "lastIndexLocation", ")", ")", "{", "manager", ".", "updateParticipant", "(", "indexLocation", ",", "containerPath", ")", ";", "this", ".", "lastIndexLocation", "=", "indexLocation", ";", "}", "}", "public", "abstract", "IPath", "[", "]", "selectIndexes", "(", "SearchPattern", "query", ",", "IJavaSearchScope", "scope", ")", ";", "}", "</s>" ]
4,974
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "PackageReferenceMatch", "extends", "ReferenceMatch", "{", "public", "PackageReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "}", "}", "</s>" ]
4,975
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "public", "abstract", "class", "TypeNameMatchRequestor", "{", "public", "abstract", "void", "acceptTypeNameMatch", "(", "TypeNameMatch", "match", ")", ";", "}", "</s>" ]
4,976
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRestriction", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "*", ";", "public", "class", "SearchEngine", "{", "static", "class", "SearchPatternAdapter", "implements", "ISearchPattern", "{", "SearchPattern", "pattern", ";", "SearchPatternAdapter", "(", "SearchPattern", "pattern", ")", "{", "this", ".", "pattern", "=", "pattern", ";", "}", "}", "static", "class", "ResultCollectorAdapter", "extends", "SearchRequestor", "{", "IJavaSearchResultCollector", "resultCollector", ";", "ResultCollectorAdapter", "(", "IJavaSearchResultCollector", "resultCollector", ")", "{", "this", ".", "resultCollector", "=", "resultCollector", ";", "}", "public", "void", "acceptSearchMatch", "(", "SearchMatch", "match", ")", "throws", "CoreException", "{", "this", ".", "resultCollector", ".", "accept", "(", "match", ".", "getResource", "(", ")", ",", "match", ".", "getOffset", "(", ")", ",", "match", ".", "getOffset", "(", ")", "+", "match", ".", "getLength", "(", ")", ",", "(", "IJavaElement", ")", "match", ".", "getElement", "(", ")", ",", "match", ".", "getAccuracy", "(", ")", ")", ";", "}", "public", "void", "beginReporting", "(", ")", "{", "this", ".", "resultCollector", ".", "aboutToStart", "(", ")", ";", "}", "public", "void", "endReporting", "(", ")", "{", "this", ".", "resultCollector", ".", "done", "(", ")", ";", "}", "}", "static", "class", "TypeNameRequestorAdapter", "implements", "IRestrictedAccessTypeRequestor", "{", "ITypeNameRequestor", "nameRequestor", ";", "TypeNameRequestorAdapter", "(", "ITypeNameRequestor", "requestor", ")", "{", "this", ".", "nameRequestor", "=", "requestor", ";", "}", "public", "void", "acceptType", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ",", "AccessRestriction", "access", ")", "{", "if", "(", "Flags", ".", "isInterface", "(", "modifiers", ")", ")", "{", "this", ".", "nameRequestor", ".", "acceptInterface", "(", "packageName", ",", "simpleTypeName", ",", "enclosingTypeNames", ",", "path", ")", ";", "}", "else", "{", "this", ".", "nameRequestor", ".", "acceptClass", "(", "packageName", ",", "simpleTypeName", ",", "enclosingTypeNames", ",", "path", ")", ";", "}", "}", "}", "private", "BasicSearchEngine", "basicEngine", ";", "public", "SearchEngine", "(", ")", "{", "this", ".", "basicEngine", "=", "new", "BasicSearchEngine", "(", ")", ";", "}", "public", "SearchEngine", "(", "ICompilationUnit", "[", "]", "workingCopies", ")", "{", "this", ".", "basicEngine", "=", "new", "BasicSearchEngine", "(", "workingCopies", ")", ";", "}", "public", "SearchEngine", "(", "IWorkingCopy", "[", "]", "workingCopies", ")", "{", "int", "length", "=", "workingCopies", ".", "length", ";", "ICompilationUnit", "[", "]", "units", "=", "new", "ICompilationUnit", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "workingCopies", ",", "0", ",", "units", ",", "0", ",", "length", ")", ";", "this", ".", "basicEngine", "=", "new", "BasicSearchEngine", "(", "units", ")", ";", "}", "public", "SearchEngine", "(", "WorkingCopyOwner", "workingCopyOwner", ")", "{", "this", ".", "basicEngine", "=", "new", "BasicSearchEngine", "(", "workingCopyOwner", ")", ";", "}", "public", "static", "IJavaSearchScope", "createHierarchyScope", "(", "IType", "type", ")", "throws", "JavaModelException", "{", "return", "BasicSearchEngine", ".", "createHierarchyScope", "(", "type", ")", ";", "}", "public", "static", "IJavaSearchScope", "createHierarchyScope", "(", "IType", "type", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "return", "BasicSearchEngine", ".", "createHierarchyScope", "(", "type", ",", "owner", ")", ";", "}", "public", "static", "IJavaSearchScope", "createStrictHierarchyScope", "(", "IJavaProject", "project", ",", "IType", "type", ",", "boolean", "onlySubtypes", ",", "boolean", "includeFocusType", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "return", "BasicSearchEngine", ".", "createStrictHierarchyScope", "(", "project", ",", "type", ",", "onlySubtypes", ",", "includeFocusType", ",", "owner", ")", ";", "}", "public", "static", "IJavaSearchScope", "createJavaSearchScope", "(", "IResource", "[", "]", "resources", ")", "{", "int", "length", "=", "resources", ".", "length", ";", "IJavaElement", "[", "]", "elements", "=", "new", "IJavaElement", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "elements", "[", "i", "]", "=", "JavaCore", ".", "create", "(", "resources", "[", "i", "]", ")", ";", "}", "return", "createJavaSearchScope", "(", "elements", ")", ";", "}", "public", "static", "IJavaSearchScope", "createJavaSearchScope", "(", "IJavaElement", "[", "]", "elements", ")", "{", "return", "BasicSearchEngine", ".", "createJavaSearchScope", "(", "elements", ")", ";", "}", "public", "static", "IJavaSearchScope", "createJavaSearchScope", "(", "IJavaElement", "[", "]", "elements", ",", "boolean", "includeReferencedProjects", ")", "{", "return", "BasicSearchEngine", ".", "createJavaSearchScope", "(", "elements", ",", "includeReferencedProjects", ")", ";", "}", "public", "static", "IJavaSearchScope", "createJavaSearchScope", "(", "IJavaElement", "[", "]", "elements", ",", "int", "includeMask", ")", "{", "return", "BasicSearchEngine", ".", "createJavaSearchScope", "(", "elements", ",", "includeMask", ")", ";", "}", "public", "static", "ISearchPattern", "createOrSearchPattern", "(", "ISearchPattern", "leftPattern", ",", "ISearchPattern", "rightPattern", ")", "{", "SearchPattern", "left", "=", "(", "(", "SearchPatternAdapter", ")", "leftPattern", ")", ".", "pattern", ";", "SearchPattern", "right", "=", "(", "(", "SearchPatternAdapter", ")", "rightPattern", ")", ".", "pattern", ";", "SearchPattern", "pattern", "=", "SearchPattern", ".", "createOrPattern", "(", "left", ",", "right", ")", ";", "return", "new", "SearchPatternAdapter", "(", "pattern", ")", ";", "}", "public", "static", "ISearchPattern", "createSearchPattern", "(", "String", "stringPattern", ",", "int", "searchFor", ",", "int", "limitTo", ",", "boolean", "isCaseSensitive", ")", "{", "int", "matchMode", "=", "stringPattern", ".", "indexOf", "(", "'*'", ")", "!=", "-", "1", "||", "stringPattern", ".", "indexOf", "(", "'?'", ")", "!=", "-", "1", "?", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "SearchPattern", ".", "R_EXACT_MATCH", ";", "int", "matchRule", "=", "isCaseSensitive", "?", "matchMode", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "matchMode", ";", "return", "new", "SearchPatternAdapter", "(", "SearchPattern", ".", "createPattern", "(", "stringPattern", ",", "searchFor", ",", "limitTo", ",", "matchRule", ")", ")", ";", "}", "public", "static", "ISearchPattern", "createSearchPattern", "(", "IJavaElement", "element", ",", "int", "limitTo", ")", "{", "return", "new", "SearchPatternAdapter", "(", "SearchPattern", ".", "createPattern", "(", "element", ",", "limitTo", ")", ")", ";", "}", "public", "static", "TypeNameMatch", "createTypeNameMatch", "(", "IType", "type", ",", "int", "modifiers", ")", "{", "return", "BasicSearchEngine", ".", "createTypeNameMatch", "(", "type", ",", "modifiers", ")", ";", "}", "public", "static", "IJavaSearchScope", "createWorkspaceScope", "(", ")", "{", "return", "BasicSearchEngine", ".", "createWorkspaceScope", "(", ")", ";", "}", "public", "static", "SearchParticipant", "getDefaultSearchParticipant", "(", ")", "{", "return", "BasicSearchEngine", ".", "getDefaultSearchParticipant", "(", ")", ";", "}", "public", "void", "search", "(", "IWorkspace", "workspace", ",", "String", "patternString", ",", "int", "searchFor", ",", "int", "limitTo", ",", "IJavaSearchScope", "scope", ",", "IJavaSearchResultCollector", "resultCollector", ")", "throws", "JavaModelException", "{", "try", "{", "int", "matchMode", "=", "patternString", ".", "indexOf", "(", "'*'", ")", "!=", "-", "1", "||", "patternString", ".", "indexOf", "(", "'?'", ")", "!=", "-", "1", "?", "SearchPattern", ".", "R_PATTERN_MATCH", ":", "SearchPattern", ".", "R_EXACT_MATCH", ";", "search", "(", "SearchPattern", ".", "createPattern", "(", "patternString", ",", "searchFor", ",", "limitTo", ",", "matchMode", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ")", ",", "new", "SearchParticipant", "[", "]", "{", "getDefaultSearchParticipant", "(", ")", "}", ",", "scope", ",", "new", "ResultCollectorAdapter", "(", "resultCollector", ")", ",", "resultCollector", ".", "getProgressMonitor", "(", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "e", "instanceof", "JavaModelException", ")", "throw", "(", "JavaModelException", ")", "e", ";", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "public", "void", "search", "(", "IWorkspace", "workspace", ",", "IJavaElement", "element", ",", "int", "limitTo", ",", "IJavaSearchScope", "scope", ",", "IJavaSearchResultCollector", "resultCollector", ")", "throws", "JavaModelException", "{", "search", "(", "workspace", ",", "createSearchPattern", "(", "element", ",", "limitTo", ")", ",", "scope", ",", "resultCollector", ")", ";", "}", "public", "void", "search", "(", "IWorkspace", "workspace", ",", "ISearchPattern", "searchPattern", ",", "IJavaSearchScope", "scope", ",", "IJavaSearchResultCollector", "resultCollector", ")", "throws", "JavaModelException", "{", "try", "{", "search", "(", "(", "(", "SearchPatternAdapter", ")", "searchPattern", ")", ".", "pattern", ",", "new", "SearchParticipant", "[", "]", "{", "getDefaultSearchParticipant", "(", ")", "}", ",", "scope", ",", "new", "ResultCollectorAdapter", "(", "resultCollector", ")", ",", "resultCollector", ".", "getProgressMonitor", "(", ")", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "e", "instanceof", "JavaModelException", ")", "throw", "(", "JavaModelException", ")", "e", ";", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "public", "void", "search", "(", "SearchPattern", "pattern", ",", "SearchParticipant", "[", "]", "participants", ",", "IJavaSearchScope", "scope", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "if", "(", "pattern", ".", "focus", "!=", "null", "&&", "LanguageSupportFactory", ".", "isInterestingProject", "(", "pattern", ".", "focus", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ")", ")", "{", "scope", "=", "LanguageSupportFactory", ".", "expandSearchScope", "(", "scope", ",", "pattern", ",", "requestor", ")", ";", "}", "this", ".", "basicEngine", ".", "search", "(", "pattern", ",", "participants", ",", "scope", ",", "requestor", ",", "monitor", ")", ";", "}", "public", "void", "searchAllTypeNames", "(", "final", "char", "[", "]", "packageExactName", ",", "final", "char", "[", "]", "typeName", ",", "final", "int", "matchRule", ",", "int", "searchFor", ",", "IJavaSearchScope", "scope", ",", "final", "TypeNameRequestor", "nameRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "searchAllTypeNames", "(", "packageExactName", ",", "SearchPattern", ".", "R_EXACT_MATCH", ",", "typeName", ",", "matchRule", ",", "searchFor", ",", "scope", ",", "nameRequestor", ",", "waitingPolicy", ",", "progressMonitor", ")", ";", "}", "public", "void", "searchAllTypeNames", "(", "final", "char", "[", "]", "packageName", ",", "final", "int", "packageMatchRule", ",", "final", "char", "[", "]", "typeName", ",", "final", "int", "typeMatchRule", ",", "int", "searchFor", ",", "IJavaSearchScope", "scope", ",", "final", "TypeNameRequestor", "nameRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "TypeNameRequestorWrapper", "requestorWrapper", "=", "new", "TypeNameRequestorWrapper", "(", "nameRequestor", ")", ";", "this", ".", "basicEngine", ".", "searchAllTypeNames", "(", "packageName", ",", "packageMatchRule", ",", "typeName", ",", "typeMatchRule", ",", "searchFor", ",", "scope", ",", "requestorWrapper", ",", "waitingPolicy", ",", "progressMonitor", ")", ";", "}", "public", "void", "searchAllTypeNames", "(", "final", "char", "[", "]", "packageName", ",", "final", "int", "packageMatchRule", ",", "final", "char", "[", "]", "typeName", ",", "final", "int", "typeMatchRule", ",", "int", "searchFor", ",", "IJavaSearchScope", "scope", ",", "final", "TypeNameMatchRequestor", "nameMatchRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "TypeNameMatchRequestorWrapper", "requestorWrapper", "=", "new", "TypeNameMatchRequestorWrapper", "(", "nameMatchRequestor", ",", "scope", ")", ";", "this", ".", "basicEngine", ".", "searchAllTypeNames", "(", "packageName", ",", "packageMatchRule", ",", "typeName", ",", "typeMatchRule", ",", "searchFor", ",", "scope", ",", "requestorWrapper", ",", "waitingPolicy", ",", "progressMonitor", ")", ";", "}", "public", "void", "searchAllTypeNames", "(", "final", "char", "[", "]", "[", "]", "qualifications", ",", "final", "char", "[", "]", "[", "]", "typeNames", ",", "IJavaSearchScope", "scope", ",", "final", "TypeNameRequestor", "nameRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "TypeNameRequestorWrapper", "requestorWrapper", "=", "new", "TypeNameRequestorWrapper", "(", "nameRequestor", ")", ";", "this", ".", "basicEngine", ".", "searchAllTypeNames", "(", "qualifications", ",", "typeNames", ",", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ",", "IJavaSearchConstants", ".", "TYPE", ",", "scope", ",", "requestorWrapper", ",", "waitingPolicy", ",", "progressMonitor", ")", ";", "}", "public", "void", "searchAllTypeNames", "(", "final", "char", "[", "]", "[", "]", "qualifications", ",", "final", "char", "[", "]", "[", "]", "typeNames", ",", "IJavaSearchScope", "scope", ",", "final", "TypeNameMatchRequestor", "nameMatchRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "TypeNameMatchRequestorWrapper", "requestorWrapper", "=", "new", "TypeNameMatchRequestorWrapper", "(", "nameMatchRequestor", ",", "scope", ")", ";", "this", ".", "basicEngine", ".", "searchAllTypeNames", "(", "qualifications", ",", "typeNames", ",", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ",", "IJavaSearchConstants", ".", "TYPE", ",", "scope", ",", "requestorWrapper", ",", "waitingPolicy", ",", "progressMonitor", ")", ";", "}", "public", "void", "searchAllTypeNames", "(", "final", "char", "[", "]", "packageName", ",", "final", "char", "[", "]", "typeName", ",", "final", "int", "matchRule", ",", "int", "searchFor", ",", "IJavaSearchScope", "scope", ",", "final", "ITypeNameRequestor", "nameRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "TypeNameRequestorAdapter", "requestorAdapter", "=", "new", "TypeNameRequestorAdapter", "(", "nameRequestor", ")", ";", "this", ".", "basicEngine", ".", "searchAllTypeNames", "(", "packageName", ",", "SearchPattern", ".", "R_EXACT_MATCH", ",", "typeName", ",", "matchRule", ",", "searchFor", ",", "scope", ",", "requestorAdapter", ",", "waitingPolicy", ",", "progressMonitor", ")", ";", "}", "public", "void", "searchAllTypeNames", "(", "IWorkspace", "workspace", ",", "final", "char", "[", "]", "packageName", ",", "final", "char", "[", "]", "typeName", ",", "final", "int", "matchMode", ",", "final", "boolean", "isCaseSensitive", ",", "int", "searchFor", ",", "IJavaSearchScope", "scope", ",", "final", "ITypeNameRequestor", "nameRequestor", ",", "int", "waitingPolicy", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "searchAllTypeNames", "(", "packageName", ",", "typeName", ",", "isCaseSensitive", "?", "matchMode", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ":", "matchMode", ",", "searchFor", ",", "scope", ",", "nameRequestor", ",", "waitingPolicy", ",", "progressMonitor", ")", ";", "}", "public", "void", "searchDeclarationsOfAccessedFields", "(", "IJavaElement", "enclosingElement", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "this", ".", "basicEngine", ".", "searchDeclarationsOfAccessedFields", "(", "enclosingElement", ",", "requestor", ",", "monitor", ")", ";", "}", "public", "void", "searchDeclarationsOfAccessedFields", "(", "IWorkspace", "workspace", ",", "IJavaElement", "enclosingElement", ",", "IJavaSearchResultCollector", "resultCollector", ")", "throws", "JavaModelException", "{", "SearchPattern", "pattern", "=", "new", "DeclarationOfAccessedFieldsPattern", "(", "enclosingElement", ")", ";", "this", ".", "basicEngine", ".", "searchDeclarations", "(", "enclosingElement", ",", "new", "ResultCollectorAdapter", "(", "resultCollector", ")", ",", "pattern", ",", "resultCollector", ".", "getProgressMonitor", "(", ")", ")", ";", "}", "public", "void", "searchDeclarationsOfReferencedTypes", "(", "IJavaElement", "enclosingElement", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "this", ".", "basicEngine", ".", "searchDeclarationsOfReferencedTypes", "(", "enclosingElement", ",", "requestor", ",", "monitor", ")", ";", "}", "public", "void", "searchDeclarationsOfReferencedTypes", "(", "IWorkspace", "workspace", ",", "IJavaElement", "enclosingElement", ",", "IJavaSearchResultCollector", "resultCollector", ")", "throws", "JavaModelException", "{", "SearchPattern", "pattern", "=", "new", "DeclarationOfReferencedTypesPattern", "(", "enclosingElement", ")", ";", "this", ".", "basicEngine", ".", "searchDeclarations", "(", "enclosingElement", ",", "new", "ResultCollectorAdapter", "(", "resultCollector", ")", ",", "pattern", ",", "resultCollector", ".", "getProgressMonitor", "(", ")", ")", ";", "}", "public", "void", "searchDeclarationsOfSentMessages", "(", "IJavaElement", "enclosingElement", ",", "SearchRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "this", ".", "basicEngine", ".", "searchDeclarationsOfSentMessages", "(", "enclosingElement", ",", "requestor", ",", "monitor", ")", ";", "}", "public", "void", "searchDeclarationsOfSentMessages", "(", "IWorkspace", "workspace", ",", "IJavaElement", "enclosingElement", ",", "IJavaSearchResultCollector", "resultCollector", ")", "throws", "JavaModelException", "{", "SearchPattern", "pattern", "=", "new", "DeclarationOfReferencedMethodsPattern", "(", "enclosingElement", ")", ";", "this", ".", "basicEngine", ".", "searchDeclarations", "(", "enclosingElement", ",", "new", "ResultCollectorAdapter", "(", "resultCollector", ")", ",", "pattern", ",", "resultCollector", ".", "getProgressMonitor", "(", ")", ")", ";", "}", "}", "</s>" ]
4,977
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "LocalVariableReferenceMatch", "extends", "SearchMatch", "{", "private", "boolean", "isReadAccess", ";", "private", "boolean", "isWriteAccess", ";", "public", "LocalVariableReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "isReadAccess", ",", "boolean", "isWriteAccess", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "this", ".", "isReadAccess", "=", "isReadAccess", ";", "this", ".", "isWriteAccess", "=", "isWriteAccess", ";", "setInsideDocComment", "(", "insideDocComment", ")", ";", "}", "public", "final", "boolean", "isReadAccess", "(", ")", "{", "return", "this", ".", "isReadAccess", ";", "}", "public", "final", "boolean", "isWriteAccess", "(", ")", "{", "return", "this", ".", "isWriteAccess", ";", "}", "}", "</s>" ]
4,978
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "TypeParameterReferenceMatch", "extends", "SearchMatch", "{", "public", "TypeParameterReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "setInsideDocComment", "(", "insideDocComment", ")", ";", "}", "}", "</s>" ]
4,979
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "FieldDeclarationMatch", "extends", "SearchMatch", "{", "public", "FieldDeclarationMatch", "(", "IJavaElement", "element", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "}", "}", "</s>" ]
4,980
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "public", "abstract", "class", "TypeNameMatch", "{", "public", "abstract", "int", "getAccessibility", "(", ")", ";", "public", "String", "getFullyQualifiedName", "(", ")", "{", "return", "getType", "(", ")", ".", "getFullyQualifiedName", "(", "'.'", ")", ";", "}", "public", "abstract", "int", "getModifiers", "(", ")", ";", "public", "IPackageFragmentRoot", "getPackageFragmentRoot", "(", ")", "{", "return", "(", "IPackageFragmentRoot", ")", "getType", "(", ")", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "}", "public", "String", "getPackageName", "(", ")", "{", "return", "getType", "(", ")", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ";", "}", "public", "String", "getSimpleTypeName", "(", ")", "{", "return", "getType", "(", ")", ".", "getElementName", "(", ")", ";", "}", "public", "abstract", "IType", "getType", "(", ")", ";", "public", "String", "getTypeContainerName", "(", ")", "{", "IType", "outerType", "=", "getType", "(", ")", ".", "getDeclaringType", "(", ")", ";", "if", "(", "outerType", "!=", "null", ")", "{", "return", "outerType", ".", "getFullyQualifiedName", "(", "'.'", ")", ";", "}", "else", "{", "return", "getType", "(", ")", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ";", "}", "}", "public", "String", "getTypeQualifiedName", "(", ")", "{", "return", "getType", "(", ")", ".", "getTypeQualifiedName", "(", "'.'", ")", ";", "}", "}", "</s>" ]
4,981
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "FieldReferenceMatch", "extends", "ReferenceMatch", "{", "private", "boolean", "isReadAccess", ";", "private", "boolean", "isWriteAccess", ";", "public", "FieldReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "isReadAccess", ",", "boolean", "isWriteAccess", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "this", ".", "isReadAccess", "=", "isReadAccess", ";", "this", ".", "isWriteAccess", "=", "isWriteAccess", ";", "}", "public", "final", "boolean", "isReadAccess", "(", ")", "{", "return", "this", ".", "isReadAccess", ";", "}", "public", "final", "boolean", "isWriteAccess", "(", ")", "{", "return", "this", ".", "isWriteAccess", ";", "}", "}", "</s>" ]
4,982
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "index", ".", "Index", ";", "public", "abstract", "class", "SearchDocument", "{", "private", "Index", "index", ";", "private", "String", "containerRelativePath", ";", "private", "SourceElementParser", "parser", ";", "private", "String", "documentPath", ";", "private", "SearchParticipant", "participant", ";", "protected", "SearchDocument", "(", "String", "documentPath", ",", "SearchParticipant", "participant", ")", "{", "this", ".", "documentPath", "=", "documentPath", ";", "this", ".", "participant", "=", "participant", ";", "}", "public", "void", "addIndexEntry", "(", "char", "[", "]", "category", ",", "char", "[", "]", "key", ")", "{", "if", "(", "this", ".", "index", "!=", "null", ")", "this", ".", "index", ".", "addIndexEntry", "(", "category", ",", "key", ",", "getContainerRelativePath", "(", ")", ")", ";", "}", "public", "abstract", "byte", "[", "]", "getByteContents", "(", ")", ";", "public", "abstract", "char", "[", "]", "getCharContents", "(", ")", ";", "private", "String", "getContainerRelativePath", "(", ")", "{", "if", "(", "this", ".", "containerRelativePath", "==", "null", ")", "this", ".", "containerRelativePath", "=", "this", ".", "index", ".", "containerRelativePath", "(", "getPath", "(", ")", ")", ";", "return", "this", ".", "containerRelativePath", ";", "}", "public", "abstract", "String", "getEncoding", "(", ")", ";", "public", "SourceElementParser", "getParser", "(", ")", "{", "return", "this", ".", "parser", ";", "}", "public", "final", "SearchParticipant", "getParticipant", "(", ")", "{", "return", "this", ".", "participant", ";", "}", "public", "final", "String", "getPath", "(", ")", "{", "return", "this", ".", "documentPath", ";", "}", "public", "void", "removeAllIndexEntries", "(", ")", "{", "if", "(", "this", ".", "index", "!=", "null", ")", "this", ".", "index", ".", "remove", "(", "getContainerRelativePath", "(", ")", ")", ";", "}", "public", "void", "setIndex", "(", "Index", "indexToSet", ")", "{", "this", ".", "index", "=", "indexToSet", ";", "}", "public", "void", "setParser", "(", "SourceElementParser", "sourceElementParser", ")", "{", "this", ".", "parser", "=", "sourceElementParser", ";", "}", "}", "</s>" ]
4,983
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "public", "abstract", "class", "SearchRequestor", "{", "public", "abstract", "void", "acceptSearchMatch", "(", "SearchMatch", "match", ")", "throws", "CoreException", ";", "public", "void", "beginReporting", "(", ")", "{", "}", "public", "void", "endReporting", "(", ")", "{", "}", "public", "void", "enterParticipant", "(", "SearchParticipant", "participant", ")", "{", "}", "public", "void", "exitParticipant", "(", "SearchParticipant", "participant", ")", "{", "}", "}", "</s>" ]
4,984
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "interface", "IJavaSearchResultCollector", "{", "int", "EXACT_MATCH", "=", "0", ";", "int", "POTENTIAL_MATCH", "=", "1", ";", "public", "void", "aboutToStart", "(", ")", ";", "public", "void", "accept", "(", "IResource", "resource", ",", "int", "start", ",", "int", "end", ",", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ")", "throws", "CoreException", ";", "public", "void", "done", "(", ")", ";", "public", "IProgressMonitor", "getProgressMonitor", "(", ")", ";", "}", "</s>" ]
4,985
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "PackageDeclarationMatch", "extends", "SearchMatch", "{", "public", "PackageDeclarationMatch", "(", "IJavaElement", "element", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "}", "}", "</s>" ]
4,986
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "TypeDeclarationMatch", "extends", "SearchMatch", "{", "public", "TypeDeclarationMatch", "(", "IJavaElement", "element", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "}", "}", "</s>" ]
4,987
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "public", "class", "TypeReferenceMatch", "extends", "ReferenceMatch", "{", "private", "IJavaElement", "[", "]", "otherElements", ";", "public", "TypeReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "}", "public", "final", "IJavaElement", "[", "]", "getOtherElements", "(", ")", "{", "return", "this", ".", "otherElements", ";", "}", "public", "final", "void", "setOtherElements", "(", "IJavaElement", "[", "]", "otherElements", ")", "{", "this", ".", "otherElements", "=", "otherElements", ";", "}", "}", "</s>" ]
4,988
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "TypeParameterDeclarationMatch", "extends", "SearchMatch", "{", "public", "TypeParameterDeclarationMatch", "(", "IJavaElement", "element", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "}", "}", "</s>" ]
4,989
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "MethodDeclarationMatch", "extends", "SearchMatch", "{", "public", "MethodDeclarationMatch", "(", "IJavaElement", "element", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "element", ",", "accuracy", ",", "offset", ",", "length", ",", "participant", ",", "resource", ")", ";", "}", "}", "</s>" ]
4,990
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "MethodReferenceMatch", "extends", "ReferenceMatch", "{", "private", "boolean", "constructor", ";", "private", "boolean", "synthetic", ";", "private", "boolean", "superInvocation", ";", "public", "MethodReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "super", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "}", "public", "MethodReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "constructor", ",", "boolean", "synthetic", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "this", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "this", ".", "constructor", "=", "constructor", ";", "this", ".", "synthetic", "=", "synthetic", ";", "}", "public", "MethodReferenceMatch", "(", "IJavaElement", "enclosingElement", ",", "int", "accuracy", ",", "int", "offset", ",", "int", "length", ",", "boolean", "constructor", ",", "boolean", "synthetic", ",", "boolean", "superInvocation", ",", "boolean", "insideDocComment", ",", "SearchParticipant", "participant", ",", "IResource", "resource", ")", "{", "this", "(", "enclosingElement", ",", "accuracy", ",", "offset", ",", "length", ",", "constructor", ",", "synthetic", ",", "insideDocComment", ",", "participant", ",", "resource", ")", ";", "this", ".", "superInvocation", "=", "superInvocation", ";", "}", "public", "final", "boolean", "isConstructor", "(", ")", "{", "return", "this", ".", "constructor", ";", "}", "public", "final", "boolean", "isSynthetic", "(", ")", "{", "return", "this", ".", "synthetic", ";", "}", "public", "boolean", "isSuperInvocation", "(", ")", "{", "return", "this", ".", "superInvocation", ";", "}", "}", "</s>" ]
4,991
[ "<s>", "package", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "WorkingCopyOwner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "CompilationResult", ";", "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", ".", "CompilationUnitDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Parser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "ProblemReporter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "BinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IndexingParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "ImportMatchLocatorParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocator", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocatorParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "PossibleMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CommentRecorderParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "DefaultLanguageSupport", "implements", "LanguageSupport", "{", "public", "Parser", "getParser", "(", "Object", "requestor", ",", "CompilerOptions", "compilerOptions", ",", "ProblemReporter", "problemReporter", ",", "boolean", "parseLiteralExpressionsAsConstants", ",", "int", "variant", ")", "{", "if", "(", "variant", "==", "1", ")", "{", "return", "new", "Parser", "(", "problemReporter", ",", "parseLiteralExpressionsAsConstants", ")", ";", "}", "else", "{", "return", "new", "CommentRecorderParser", "(", "problemReporter", ",", "parseLiteralExpressionsAsConstants", ")", ";", "}", "}", "public", "IndexingParser", "getIndexingParser", "(", "ISourceElementRequestor", "requestor", ",", "IProblemFactory", "problemFactory", ",", "CompilerOptions", "options", ",", "boolean", "reportLocalDeclarations", ",", "boolean", "optimizeStringLiterals", ",", "boolean", "useSourceJavadocParser", ")", "{", "return", "new", "IndexingParser", "(", "requestor", ",", "problemFactory", ",", "options", ",", "reportLocalDeclarations", ",", "optimizeStringLiterals", ",", "useSourceJavadocParser", ")", ";", "}", "public", "ImportMatchLocatorParser", "getImportMatchLocatorParserParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", "{", "return", "new", "ImportMatchLocatorParser", "(", "problemReporter", ",", "locator", ")", ";", "}", "public", "SourceElementParser", "getSourceElementParser", "(", "ISourceElementRequestor", "requestor", ",", "IProblemFactory", "problemFactory", ",", "CompilerOptions", "options", ",", "boolean", "reportLocalDeclarations", ",", "boolean", "optimizeStringLiterals", ",", "boolean", "useSourceJavadocParser", ")", "{", "return", "new", "SourceElementParser", "(", "requestor", ",", "problemFactory", ",", "options", ",", "reportLocalDeclarations", ",", "optimizeStringLiterals", ",", "useSourceJavadocParser", ")", ";", "}", "public", "MatchLocatorParser", "getMatchLocatorParserParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", "{", "return", "new", "MatchLocatorParser", "(", "problemReporter", ",", "locator", ")", ";", "}", "public", "CompilationUnit", "newCompilationUnit", "(", "PackageFragment", "parent", ",", "String", "name", ",", "WorkingCopyOwner", "owner", ")", "{", "return", "new", "CompilationUnit", "(", "parent", ",", "name", ",", "owner", ")", ";", "}", "public", "CompilationUnitDeclaration", "newCompilationUnitDeclaration", "(", "ICompilationUnit", "unit", ",", "ProblemReporter", "problemReporter", ",", "CompilationResult", "compilationResult", ",", "int", "sourceLength", ")", "{", "return", "new", "CompilationUnitDeclaration", "(", "problemReporter", ",", "compilationResult", ",", "sourceLength", ")", ";", "}", "public", "boolean", "isInterestingProject", "(", "IProject", "project", ")", "{", "return", "true", ";", "}", "public", "boolean", "isSourceFile", "(", "String", "fileName", ",", "boolean", "isInterestingProject", ")", "{", "return", "Util", ".", "isJavaLikeFileName", "(", "fileName", ")", ";", "}", "public", "boolean", "isInterestingSourceFile", "(", "String", "fileName", ")", "{", "return", "false", ";", "}", "public", "boolean", "maybePerformDelegatedSearch", "(", "PossibleMatch", "possibleMatch", ",", "SearchPattern", "pattern", ",", "SearchRequestor", "requestor", ")", "{", "return", "false", ";", "}", "public", "EventHandler", "getEventHandler", "(", ")", "{", "return", "DefaultEventHandler", ".", "instance", ";", "}", "static", "class", "DefaultEventHandler", "implements", "EventHandler", "{", "static", "DefaultEventHandler", "instance", "=", "new", "DefaultEventHandler", "(", ")", ";", "private", "DefaultEventHandler", "(", ")", "{", "}", "public", "void", "handle", "(", "JavaProject", "javaProject", ",", "String", "string", ")", "{", "}", "}", "public", "void", "filterNonSourceMembers", "(", "BinaryType", "binaryType", ")", "{", "}", "public", "IJavaSearchScope", "expandSearchScope", "(", "IJavaSearchScope", "scope", ",", "SearchPattern", "pattern", ",", "SearchRequestor", "requestor", ")", "{", "return", "scope", ";", "}", "}", "</s>" ]
4,992
[ "<s>", "package", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "public", "interface", "EventHandler", "{", "void", "handle", "(", "JavaProject", "javaProject", ",", "String", "string", ")", ";", "}", "</s>" ]
4,993
[ "<s>", "package", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Platform", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "WorkingCopyOwner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "CompilationResult", ";", "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", ".", "CompilationUnitDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Parser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "ProblemReporter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "BinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IndexingParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "ImportMatchLocatorParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocator", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocatorParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "PossibleMatch", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "osgi", ".", "framework", ".", "Bundle", ";", "public", "class", "LanguageSupportFactory", "{", "private", "static", "LanguageSupport", "languageSupport", ";", "public", "static", "final", "int", "CommentRecorderParserVariant", "=", "2", ";", "public", "static", "Parser", "getParser", "(", "Object", "requestor", ",", "CompilerOptions", "compilerOptions", ",", "ProblemReporter", "problemReporter", ",", "boolean", "parseLiteralExpressionsAsConstants", ",", "int", "variant", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "getParser", "(", "requestor", ",", "compilerOptions", ",", "problemReporter", ",", "parseLiteralExpressionsAsConstants", ",", "variant", ")", ";", "}", "public", "static", "IndexingParser", "getIndexingParser", "(", "ISourceElementRequestor", "requestor", ",", "IProblemFactory", "problemFactory", ",", "CompilerOptions", "options", ",", "boolean", "reportLocalDeclarations", ",", "boolean", "optimizeStringLiterals", ",", "boolean", "useSourceJavadocParser", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "getIndexingParser", "(", "requestor", ",", "problemFactory", ",", "options", ",", "reportLocalDeclarations", ",", "optimizeStringLiterals", ",", "useSourceJavadocParser", ")", ";", "}", "public", "static", "SourceElementParser", "getSourceElementParser", "(", "ISourceElementRequestor", "requestor", ",", "IProblemFactory", "problemFactory", ",", "CompilerOptions", "options", ",", "boolean", "reportLocalDeclarations", ",", "boolean", "optimizeStringLiterals", ",", "boolean", "useSourceJavadocParser", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "getSourceElementParser", "(", "requestor", ",", "problemFactory", ",", "options", ",", "reportLocalDeclarations", ",", "optimizeStringLiterals", ",", "useSourceJavadocParser", ")", ";", "}", "public", "static", "MatchLocatorParser", "getMatchLocatorParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "getMatchLocatorParserParser", "(", "problemReporter", ",", "locator", ")", ";", "}", "public", "static", "ImportMatchLocatorParser", "getImportMatchLocatorParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "getImportMatchLocatorParserParser", "(", "problemReporter", ",", "locator", ")", ";", "}", "public", "static", "CompilationUnit", "newCompilationUnit", "(", "PackageFragment", "parent", ",", "String", "name", ",", "WorkingCopyOwner", "owner", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "newCompilationUnit", "(", "parent", ",", "name", ",", "owner", ")", ";", "}", "public", "static", "CompilationUnitDeclaration", "newCompilationUnitDeclaration", "(", "ICompilationUnit", "unit", ",", "ProblemReporter", "problemReporter", ",", "CompilationResult", "compilationResult", ",", "int", "sourceLength", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "newCompilationUnitDeclaration", "(", "unit", ",", "problemReporter", ",", "compilationResult", ",", "sourceLength", ")", ";", "}", "public", "static", "boolean", "isInterestingProject", "(", "IProject", "project", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "isInterestingProject", "(", "project", ")", ";", "}", "public", "static", "boolean", "isSourceFile", "(", "String", "fileName", ",", "boolean", "isInterestingProject", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "isSourceFile", "(", "fileName", ",", "isInterestingProject", ")", ";", "}", "public", "static", "boolean", "isInterestingSourceFile", "(", "String", "fileName", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "isInterestingSourceFile", "(", "fileName", ")", ";", "}", "public", "static", "boolean", "maybePerformDelegatedSearch", "(", "PossibleMatch", "possibleMatch", ",", "SearchPattern", "pattern", ",", "SearchRequestor", "requestor", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "maybePerformDelegatedSearch", "(", "possibleMatch", ",", "pattern", ",", "requestor", ")", ";", "}", "public", "static", "void", "filterNonSourceMembers", "(", "BinaryType", "binaryType", ")", "{", "getLanguageSupport", "(", ")", ".", "filterNonSourceMembers", "(", "binaryType", ")", ";", "}", "private", "static", "LanguageSupport", "getLanguageSupport", "(", ")", "{", "if", "(", "languageSupport", "==", "null", ")", "{", "languageSupport", "=", "tryInstantiate", "(", "\"\"", ")", ";", "if", "(", "languageSupport", "==", "null", ")", "{", "languageSupport", "=", "new", "DefaultLanguageSupport", "(", ")", ";", "}", "}", "return", "languageSupport", ";", "}", "private", "static", "LanguageSupport", "tryInstantiate", "(", "String", "className", ")", "{", "LanguageSupport", "instance", "=", "null", ";", "if", "(", "className", "!=", "null", "&&", "className", ".", "length", "(", ")", ">", "0", ")", "{", "try", "{", "int", "separator", "=", "className", ".", "indexOf", "(", "':'", ")", ";", "Bundle", "bundle", "=", "null", ";", "if", "(", "separator", "==", "-", "1", ")", "{", "JavaCore", "javaCore", "=", "JavaCore", ".", "getJavaCore", "(", ")", ";", "if", "(", "javaCore", "==", "null", ")", "{", "Class", "clazz", "=", "Class", ".", "forName", "(", "className", ")", ";", "return", "(", "LanguageSupport", ")", "clazz", ".", "newInstance", "(", ")", ";", "}", "else", "{", "bundle", "=", "javaCore", ".", "getBundle", "(", ")", ";", "}", "}", "else", "{", "String", "bundleName", "=", "className", ".", "substring", "(", "0", ",", "separator", ")", ";", "className", "=", "className", ".", "substring", "(", "separator", "+", "1", ")", ";", "bundle", "=", "Platform", ".", "getBundle", "(", "bundleName", ")", ";", "}", "Class", "c", "=", "bundle", ".", "loadClass", "(", "className", ")", ";", "instance", "=", "(", "LanguageSupport", ")", "c", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "log", "(", "e", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "log", "(", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "log", "(", "e", ")", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "log", "(", "e", ")", ";", "}", "}", "return", "instance", ";", "}", "private", "static", "void", "log", "(", "Exception", "e", ")", "{", "if", "(", "JavaCore", ".", "getPlugin", "(", ")", "==", "null", "||", "JavaCore", ".", "getPlugin", "(", ")", ".", "getLog", "(", ")", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "e", ".", "printStackTrace", "(", "System", ".", "err", ")", ";", "}", "else", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "}", "public", "static", "EventHandler", "getEventHandler", "(", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "getEventHandler", "(", ")", ";", "}", "public", "static", "IJavaSearchScope", "expandSearchScope", "(", "IJavaSearchScope", "scope", ",", "SearchPattern", "pattern", ",", "SearchRequestor", "requestor", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "expandSearchScope", "(", "scope", ",", "pattern", ",", "requestor", ")", ";", "}", "public", "static", "boolean", "isGroovyLanguageSupportInstalled", "(", ")", "{", "return", "getLanguageSupport", "(", ")", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "endsWith", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
4,994
[ "<s>", "package", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "WorkingCopyOwner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchPattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "CompilationResult", ";", "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", ".", "CompilationUnitDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Parser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "ProblemReporter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "BinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "PackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IndexingParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "ImportMatchLocatorParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocator", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "MatchLocatorParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "matching", ".", "PossibleMatch", ";", "public", "interface", "LanguageSupport", "{", "Parser", "getParser", "(", "Object", "requestor", ",", "CompilerOptions", "compilerOptions", ",", "ProblemReporter", "problemReporter", ",", "boolean", "parseLiteralExpressionsAsConstants", ",", "int", "variant", ")", ";", "IndexingParser", "getIndexingParser", "(", "ISourceElementRequestor", "requestor", ",", "IProblemFactory", "problemFactory", ",", "CompilerOptions", "options", ",", "boolean", "reportLocalDeclarations", ",", "boolean", "optimizeStringLiterals", ",", "boolean", "useSourceJavadocParser", ")", ";", "MatchLocatorParser", "getMatchLocatorParserParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", ";", "SourceElementParser", "getSourceElementParser", "(", "ISourceElementRequestor", "requestor", ",", "IProblemFactory", "problemFactory", ",", "CompilerOptions", "options", ",", "boolean", "reportLocalDeclarations", ",", "boolean", "optimizeStringLiterals", ",", "boolean", "useSourceJavadocParser", ")", ";", "ImportMatchLocatorParser", "getImportMatchLocatorParserParser", "(", "ProblemReporter", "problemReporter", ",", "MatchLocator", "locator", ")", ";", "CompilationUnit", "newCompilationUnit", "(", "PackageFragment", "parent", ",", "String", "name", ",", "WorkingCopyOwner", "owner", ")", ";", "CompilationUnitDeclaration", "newCompilationUnitDeclaration", "(", "ICompilationUnit", "unit", ",", "ProblemReporter", "problemReporter", ",", "CompilationResult", "compilationResult", ",", "int", "sourceLength", ")", ";", "boolean", "isInterestingProject", "(", "IProject", "project", ")", ";", "boolean", "isSourceFile", "(", "String", "fileName", ",", "boolean", "isInterestingProject", ")", ";", "boolean", "isInterestingSourceFile", "(", "String", "fileName", ")", ";", "boolean", "maybePerformDelegatedSearch", "(", "PossibleMatch", "possibleMatch", ",", "SearchPattern", "pattern", ",", "SearchRequestor", "requestor", ")", ";", "EventHandler", "getEventHandler", "(", ")", ";", "void", "filterNonSourceMembers", "(", "BinaryType", "binaryType", ")", ";", "IJavaSearchScope", "expandSearchScope", "(", "IJavaSearchScope", "scope", ",", "SearchPattern", "pattern", ",", "SearchRequestor", "requestor", ")", ";", "}", "</s>" ]
4,995
[ "<s>", "package", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "internal", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "InternalExtendedCompletionContext", ";", "public", "class", "SimplifiedExtendedCompletionContext", "extends", "InternalExtendedCompletionContext", "{", "public", "SimplifiedExtendedCompletionContext", "(", ")", "{", "super", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "}", "}", "</s>" ]
4,996
[ "<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>" ]
4,997
[ "<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>" ]
4,998
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "CompletionFlags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "CompletionProposal", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "CompletionRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAccessRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICodeAssist", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "BinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "NameLookup", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SourceMapper", ";", "public", "class", "InternalCompletionProposal", "extends", "CompletionProposal", "{", "private", "static", "Object", "NO_ATTACHED_SOURCE", "=", "new", "Object", "(", ")", ";", "protected", "CompletionEngine", "completionEngine", ";", "protected", "NameLookup", "nameLookup", ";", "protected", "char", "[", "]", "declarationPackageName", ";", "protected", "char", "[", "]", "declarationTypeName", ";", "protected", "char", "[", "]", "packageName", ";", "protected", "char", "[", "]", "typeName", ";", "protected", "char", "[", "]", "[", "]", "parameterPackageNames", ";", "protected", "char", "[", "]", "[", "]", "parameterTypeNames", ";", "protected", "char", "[", "]", "originalSignature", ";", "private", "boolean", "hasNoParameterNamesFromIndex", "=", "false", ";", "private", "boolean", "updateCompletion", "=", "false", ";", "protected", "int", "accessibility", "=", "IAccessRule", ".", "K_ACCESSIBLE", ";", "protected", "boolean", "isConstructor", "=", "false", ";", "private", "int", "completionKind", ";", "private", "int", "completionLocation", ";", "private", "int", "tokenStart", "=", "0", ";", "private", "int", "tokenEnd", "=", "0", ";", "private", "char", "[", "]", "completion", "=", "CharOperation", ".", "NO_CHAR", ";", "private", "int", "replaceStart", "=", "0", ";", "private", "int", "replaceEnd", "=", "0", ";", "private", "int", "relevance", "=", "1", ";", "private", "char", "[", "]", "declarationSignature", "=", "null", ";", "private", "char", "[", "]", "declarationKey", "=", "null", ";", "private", "char", "[", "]", "name", "=", "null", ";", "private", "char", "[", "]", "signature", "=", "null", ";", "private", "char", "[", "]", "key", "=", "null", ";", "private", "CompletionProposal", "[", "]", "requiredProposals", ";", "private", "int", "flags", "=", "Flags", ".", "AccDefault", ";", "private", "int", "additionalFlags", "=", "CompletionFlags", ".", "Default", ";", "private", "char", "[", "]", "[", "]", "parameterNames", "=", "null", ";", "private", "boolean", "parameterNamesComputed", "=", "false", ";", "protected", "char", "[", "]", "[", "]", "findConstructorParameterNames", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "paramTypeNames", ")", "{", "if", "(", "paramTypeNames", "==", "null", "||", "declaringTypeName", "==", "null", ")", "return", "null", ";", "char", "[", "]", "[", "]", "parameters", "=", "null", ";", "int", "length", "=", "paramTypeNames", ".", "length", ";", "char", "[", "]", "tName", "=", "CharOperation", ".", "concat", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "'.'", ")", ";", "Object", "cachedType", "=", "this", ".", "completionEngine", ".", "typeCache", ".", "get", "(", "tName", ")", ";", "IType", "type", "=", "null", ";", "if", "(", "cachedType", "!=", "null", ")", "{", "if", "(", "cachedType", "!=", "NO_ATTACHED_SOURCE", "&&", "cachedType", "instanceof", "BinaryType", ")", "{", "type", "=", "(", "BinaryType", ")", "cachedType", ";", "}", "}", "else", "{", "NameLookup", ".", "Answer", "answer", "=", "this", ".", "nameLookup", ".", "findType", "(", "new", "String", "(", "tName", ")", ",", "false", ",", "NameLookup", ".", "ACCEPT_CLASSES", "&", "NameLookup", ".", "ACCEPT_INTERFACES", ",", "true", ",", "false", ",", "false", ",", "null", ")", ";", "type", "=", "answer", "==", "null", "?", "null", ":", "answer", ".", "type", ";", "if", "(", "type", "instanceof", "BinaryType", ")", "{", "this", ".", "completionEngine", ".", "typeCache", ".", "put", "(", "tName", ",", "type", ")", ";", "}", "else", "{", "type", "=", "null", ";", "}", "}", "if", "(", "type", "!=", "null", ")", "{", "String", "[", "]", "args", "=", "new", "String", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "args", "[", "i", "]", "=", "new", "String", "(", "paramTypeNames", "[", "i", "]", ")", ";", "}", "IMethod", "method", "=", "type", ".", "getMethod", "(", "new", "String", "(", "selector", ")", ",", "args", ")", ";", "if", "(", "this", ".", "hasNoParameterNamesFromIndex", ")", "{", "IPackageFragmentRoot", "packageFragmentRoot", "=", "(", "IPackageFragmentRoot", ")", "type", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "if", "(", "packageFragmentRoot", ".", "isArchive", "(", ")", "||", "this", ".", "completionEngine", ".", "openedBinaryTypes", "<", "getOpenedBinaryTypesThreshold", "(", ")", ")", "{", "SourceMapper", "mapper", "=", "(", "(", "JavaElement", ")", "method", ")", ".", "getSourceMapper", "(", ")", ";", "if", "(", "mapper", "!=", "null", ")", "{", "try", "{", "char", "[", "]", "[", "]", "paramNames", "=", "mapper", ".", "getMethodParameterNames", "(", "method", ")", ";", "if", "(", "paramNames", "==", "null", ")", "{", "if", "(", "!", "packageFragmentRoot", ".", "isArchive", "(", ")", ")", "this", ".", "completionEngine", ".", "openedBinaryTypes", "++", ";", "IBinaryType", "info", "=", "(", "IBinaryType", ")", "(", "(", "BinaryType", ")", "type", ")", ".", "getElementInfo", "(", ")", ";", "char", "[", "]", "source", "=", "mapper", ".", "findSource", "(", "type", ",", "info", ")", ";", "if", "(", "source", "!=", "null", ")", "{", "mapper", ".", "mapSource", "(", "type", ",", "source", ",", "info", ")", ";", "}", "paramNames", "=", "mapper", ".", "getMethodParameterNames", "(", "method", ")", ";", "}", "if", "(", "paramNames", "!=", "null", ")", "{", "parameters", "=", "paramNames", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "}", "else", "{", "try", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "(", "(", "JavaElement", ")", "method", ")", ".", "getElementInfo", "(", ")", ";", "char", "[", "]", "[", "]", "argumentNames", "=", "info", ".", "getArgumentNames", "(", ")", ";", "if", "(", "argumentNames", "!=", "null", "&&", "argumentNames", ".", "length", "==", "length", ")", "{", "parameters", "=", "argumentNames", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "try", "{", "parameters", "=", "new", "char", "[", "length", "]", "[", "]", ";", "String", "[", "]", "params", "=", "method", ".", "getParameterNames", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "parameters", "[", "i", "]", "=", "params", "[", "i", "]", ".", "toCharArray", "(", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "parameters", "=", "null", ";", "}", "}", "}", "if", "(", "parameters", "==", "null", ")", "{", "parameters", "=", "CompletionEngine", ".", "createDefaultParameterNames", "(", "length", ")", ";", "}", "return", "parameters", ";", "}", "protected", "char", "[", "]", "[", "]", "findMethodParameterNames", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "paramTypeNames", ")", "{", "if", "(", "paramTypeNames", "==", "null", "||", "declaringTypeName", "==", "null", ")", "return", "null", ";", "char", "[", "]", "[", "]", "parameters", "=", "null", ";", "int", "length", "=", "paramTypeNames", ".", "length", ";", "char", "[", "]", "tName", "=", "CharOperation", ".", "concat", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "'.'", ")", ";", "Object", "cachedType", "=", "this", ".", "completionEngine", ".", "typeCache", ".", "get", "(", "tName", ")", ";", "IType", "type", "=", "null", ";", "if", "(", "cachedType", "!=", "null", ")", "{", "if", "(", "cachedType", "!=", "NO_ATTACHED_SOURCE", "&&", "cachedType", "instanceof", "BinaryType", ")", "{", "type", "=", "(", "BinaryType", ")", "cachedType", ";", "}", "}", "else", "{", "NameLookup", ".", "Answer", "answer", "=", "this", ".", "nameLookup", ".", "findType", "(", "new", "String", "(", "tName", ")", ",", "false", ",", "NameLookup", ".", "ACCEPT_CLASSES", "&", "NameLookup", ".", "ACCEPT_INTERFACES", ",", "true", ",", "false", ",", "false", ",", "null", ")", ";", "type", "=", "answer", "==", "null", "?", "null", ":", "answer", ".", "type", ";", "if", "(", "type", "instanceof", "BinaryType", ")", "{", "this", ".", "completionEngine", ".", "typeCache", ".", "put", "(", "tName", ",", "type", ")", ";", "}", "else", "{", "type", "=", "null", ";", "}", "}", "if", "(", "type", "!=", "null", ")", "{", "String", "[", "]", "args", "=", "new", "String", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "args", "[", "i", "]", "=", "new", "String", "(", "paramTypeNames", "[", "i", "]", ")", ";", "}", "IMethod", "method", "=", "type", ".", "getMethod", "(", "new", "String", "(", "selector", ")", ",", "args", ")", ";", "try", "{", "parameters", "=", "new", "char", "[", "length", "]", "[", "]", ";", "String", "[", "]", "params", "=", "method", ".", "getParameterNames", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "parameters", "[", "i", "]", "=", "params", "[", "i", "]", ".", "toCharArray", "(", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "parameters", "=", "null", ";", "}", "}", "if", "(", "parameters", "==", "null", ")", "{", "parameters", "=", "CompletionEngine", ".", "createDefaultParameterNames", "(", "length", ")", ";", "}", "return", "parameters", ";", "}", "protected", "char", "[", "]", "getDeclarationPackageName", "(", ")", "{", "return", "this", ".", "declarationPackageName", ";", "}", "protected", "char", "[", "]", "getDeclarationTypeName", "(", ")", "{", "return", "this", ".", "declarationTypeName", ";", "}", "private", "int", "getOpenedBinaryTypesThreshold", "(", ")", "{", "return", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getOpenableCacheSize", "(", ")", "/", "10", ";", "}", "protected", "char", "[", "]", "getPackageName", "(", ")", "{", "return", "this", ".", "packageName", ";", "}", "protected", "char", "[", "]", "getTypeName", "(", ")", "{", "return", "this", ".", "typeName", ";", "}", "protected", "char", "[", "]", "[", "]", "getParameterPackageNames", "(", ")", "{", "return", "this", ".", "parameterPackageNames", ";", "}", "protected", "char", "[", "]", "[", "]", "getParameterTypeNames", "(", ")", "{", "return", "this", ".", "parameterTypeNames", ";", "}", "protected", "void", "setDeclarationPackageName", "(", "char", "[", "]", "declarationPackageName", ")", "{", "this", ".", "declarationPackageName", "=", "declarationPackageName", ";", "}", "protected", "void", "setDeclarationTypeName", "(", "char", "[", "]", "declarationTypeName", ")", "{", "this", ".", "declarationTypeName", "=", "declarationTypeName", ";", "}", "protected", "void", "setPackageName", "(", "char", "[", "]", "packageName", ")", "{", "this", ".", "packageName", "=", "packageName", ";", "}", "protected", "void", "setTypeName", "(", "char", "[", "]", "typeName", ")", "{", "this", ".", "typeName", "=", "typeName", ";", "}", "protected", "void", "setParameterPackageNames", "(", "char", "[", "]", "[", "]", "parameterPackageNames", ")", "{", "this", ".", "parameterPackageNames", "=", "parameterPackageNames", ";", "}", "protected", "void", "setParameterTypeNames", "(", "char", "[", "]", "[", "]", "parameterTypeNames", ")", "{", "this", ".", "parameterTypeNames", "=", "parameterTypeNames", ";", "}", "protected", "void", "setAccessibility", "(", "int", "kind", ")", "{", "this", ".", "accessibility", "=", "kind", ";", "}", "protected", "void", "setIsContructor", "(", "boolean", "isConstructor", ")", "{", "this", ".", "isConstructor", "=", "isConstructor", ";", "}", "public", "void", "setOriginalSignature", "(", "char", "[", "]", "originalSignature", ")", "{", "this", ".", "originalSignature", "=", "originalSignature", ";", "}", "public", "InternalCompletionProposal", "(", "int", "kind", ",", "int", "completionLocation", ")", "{", "if", "(", "(", "kind", "<", "FIRST_KIND", ")", "||", "(", "kind", ">", "LAST_KIND", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "this", ".", "completion", "==", "null", "||", "completionLocation", "<", "0", ")", "{", "if", "(", "this", ".", "completion", "==", "null", "||", "completionLocation", "!=", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "completionLocation", "=", "0", ";", "}", "this", ".", "completionKind", "=", "kind", ";", "this", ".", "completionLocation", "=", "completionLocation", ";", "}", "public", "int", "getAdditionalFlags", "(", ")", "{", "return", "this", ".", "additionalFlags", ";", "}", "public", "void", "setAdditionalFlags", "(", "int", "additionalFlags", ")", "{", "this", ".", "additionalFlags", "=", "additionalFlags", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "this", ".", "completionKind", ";", "}", "public", "int", "getCompletionLocation", "(", ")", "{", "return", "this", ".", "completionLocation", ";", "}", "public", "int", "getTokenStart", "(", ")", "{", "return", "this", ".", "tokenStart", ";", "}", "public", "int", "getTokenEnd", "(", ")", "{", "return", "this", ".", "tokenEnd", ";", "}", "public", "void", "setTokenRange", "(", "int", "startIndex", ",", "int", "endIndex", ")", "{", "if", "(", "startIndex", "<", "0", "||", "endIndex", "<", "startIndex", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "tokenStart", "=", "startIndex", ";", "this", ".", "tokenEnd", "=", "endIndex", ";", "}", "public", "char", "[", "]", "getCompletion", "(", ")", "{", "if", "(", "this", ".", "completionKind", "==", "METHOD_DECLARATION", ")", "{", "findParameterNames", "(", "null", ")", ";", "if", "(", "this", ".", "updateCompletion", ")", "{", "this", ".", "updateCompletion", "=", "false", ";", "if", "(", "this", ".", "parameterNames", "!=", "null", ")", "{", "int", "length", "=", "this", ".", "parameterNames", ".", "length", ";", "StringBuffer", "completionBuffer", "=", "new", "StringBuffer", "(", "this", ".", "completion", ".", "length", ")", ";", "int", "start", "=", "0", ";", "int", "end", "=", "CharOperation", ".", "indexOf", "(", "'%'", ",", "this", ".", "completion", ")", ";", "completionBuffer", ".", "append", "(", "this", ".", "completion", ",", "start", ",", "end", "-", "start", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "completionBuffer", ".", "append", "(", "this", ".", "parameterNames", "[", "i", "]", ")", ";", "start", "=", "end", "+", "1", ";", "end", "=", "CharOperation", ".", "indexOf", "(", "'%'", ",", "this", ".", "completion", ",", "start", ")", ";", "if", "(", "end", ">", "-", "1", ")", "{", "completionBuffer", ".", "append", "(", "this", ".", "completion", ",", "start", ",", "end", "-", "start", ")", ";", "}", "else", "{", "completionBuffer", ".", "append", "(", "this", ".", "completion", ",", "start", ",", "this", ".", "completion", ".", "length", "-", "start", ")", ";", "}", "}", "int", "nameLength", "=", "completionBuffer", ".", "length", "(", ")", ";", "this", ".", "completion", "=", "new", "char", "[", "nameLength", "]", ";", "completionBuffer", ".", "getChars", "(", "0", ",", "nameLength", ",", "this", ".", "completion", ",", "0", ")", ";", "}", "}", "}", "return", "this", ".", "completion", ";", "}", "public", "void", "setCompletion", "(", "char", "[", "]", "completion", ")", "{", "this", ".", "completion", "=", "completion", ";", "}", "public", "int", "getReplaceStart", "(", ")", "{", "return", "this", ".", "replaceStart", ";", "}", "public", "int", "getReplaceEnd", "(", ")", "{", "return", "this", ".", "replaceEnd", ";", "}", "public", "void", "setReplaceRange", "(", "int", "startIndex", ",", "int", "endIndex", ")", "{", "if", "(", "startIndex", "<", "0", "||", "endIndex", "<", "startIndex", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "replaceStart", "=", "startIndex", ";", "this", ".", "replaceEnd", "=", "endIndex", ";", "}", "public", "int", "getRelevance", "(", ")", "{", "return", "this", ".", "relevance", ";", "}", "public", "void", "setRelevance", "(", "int", "rating", ")", "{", "if", "(", "rating", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "relevance", "=", "rating", ";", "}", "public", "char", "[", "]", "getDeclarationSignature", "(", ")", "{", "return", "this", ".", "declarationSignature", ";", "}", "public", "char", "[", "]", "getDeclarationKey", "(", ")", "{", "return", "this", ".", "declarationKey", ";", "}", "public", "void", "setDeclarationSignature", "(", "char", "[", "]", "signature", ")", "{", "this", ".", "declarationSignature", "=", "signature", ";", "}", "public", "void", "setDeclarationKey", "(", "char", "[", "]", "key", ")", "{", "this", ".", "declarationKey", "=", "key", ";", "}", "public", "char", "[", "]", "getName", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "void", "setName", "(", "char", "[", "]", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "char", "[", "]", "getSignature", "(", ")", "{", "return", "this", ".", "signature", ";", "}", "public", "char", "[", "]", "getKey", "(", ")", "{", "return", "this", ".", "key", ";", "}", "public", "void", "setSignature", "(", "char", "[", "]", "signature", ")", "{", "this", ".", "signature", "=", "signature", ";", "}", "public", "void", "setKey", "(", "char", "[", "]", "key", ")", "{", "this", ".", "key", "=", "key", ";", "}", "public", "int", "getFlags", "(", ")", "{", "return", "this", ".", "flags", ";", "}", "public", "void", "setFlags", "(", "int", "flags", ")", "{", "this", ".", "flags", "=", "flags", ";", "}", "public", "void", "setHasNoParameterNamesFromIndex", "(", "boolean", "hasNoParameterNamesFromIndex", ")", "{", "this", ".", "hasNoParameterNamesFromIndex", "=", "hasNoParameterNamesFromIndex", ";", "}", "public", "CompletionProposal", "[", "]", "getRequiredProposals", "(", ")", "{", "return", "this", ".", "requiredProposals", ";", "}", "public", "void", "setRequiredProposals", "(", "CompletionProposal", "[", "]", "proposals", ")", "{", "this", ".", "requiredProposals", "=", "proposals", ";", "}", "public", "char", "[", "]", "[", "]", "findParameterNames", "(", "IProgressMonitor", "monitor", ")", "{", "if", "(", "!", "this", ".", "parameterNamesComputed", ")", "{", "this", ".", "parameterNamesComputed", "=", "true", ";", "switch", "(", "this", ".", "completionKind", ")", "{", "case", "ANONYMOUS_CLASS_DECLARATION", ":", "try", "{", "this", ".", "parameterNames", "=", "findMethodParameterNames", "(", "this", ".", "declarationPackageName", ",", "this", ".", "declarationTypeName", ",", "CharOperation", ".", "lastSegment", "(", "this", ".", "declarationTypeName", ",", "'.'", ")", ",", "Signature", ".", "getParameterTypes", "(", "this", ".", "originalSignature", "==", "null", "?", "this", ".", "signature", ":", "this", ".", "originalSignature", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "if", "(", "this", ".", "parameterTypeNames", "!=", "null", ")", "{", "this", ".", "parameterNames", "=", "CompletionEngine", ".", "createDefaultParameterNames", "(", "this", ".", "parameterTypeNames", ".", "length", ")", ";", "}", "else", "{", "this", ".", "parameterNames", "=", "null", ";", "}", "}", "break", ";", "case", "ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION", ":", "try", "{", "this", ".", "parameterNames", "=", "findConstructorParameterNames", "(", "this", ".", "declarationPackageName", ",", "this", ".", "declarationTypeName", ",", "CharOperation", ".", "lastSegment", "(", "this", ".", "declarationTypeName", ",", "'.'", ")", ",", "Signature", ".", "getParameterTypes", "(", "this", ".", "originalSignature", "==", "null", "?", "this", ".", "signature", ":", "this", ".", "originalSignature", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "if", "(", "this", ".", "parameterTypeNames", "!=", "null", ")", "{", "this", ".", "parameterNames", "=", "CompletionEngine", ".", "createDefaultParameterNames", "(", "this", ".", "parameterTypeNames", ".", "length", ")", ";", "}", "else", "{", "this", ".", "parameterNames", "=", "null", ";", "}", "}", "break", ";", "case", "METHOD_REF", ":", "case", "METHOD_REF_WITH_CASTED_RECEIVER", ":", "try", "{", "this", ".", "parameterNames", "=", "findMethodParameterNames", "(", "this", ".", "declarationPackageName", ",", "this", ".", "declarationTypeName", ",", "this", ".", "name", ",", "Signature", ".", "getParameterTypes", "(", "this", ".", "originalSignature", "==", "null", "?", "this", ".", "signature", ":", "this", ".", "originalSignature", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "if", "(", "this", ".", "parameterTypeNames", "!=", "null", ")", "{", "this", ".", "parameterNames", "=", "CompletionEngine", ".", "createDefaultParameterNames", "(", "this", ".", "parameterTypeNames", ".", "length", ")", ";", "}", "else", "{", "this", ".", "parameterNames", "=", "null", ";", "}", "}", "break", ";", "case", "CONSTRUCTOR_INVOCATION", ":", "try", "{", "this", ".", "parameterNames", "=", "findConstructorParameterNames", "(", "this", ".", "declarationPackageName", ",", "this", ".", "declarationTypeName", ",", "this", ".", "name", ",", "Signature", ".", "getParameterTypes", "(", "this", ".", "originalSignature", "==", "null", "?", "this", ".", "signature", ":", "this", ".", "originalSignature", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "if", "(", "this", ".", "parameterTypeNames", "!=", "null", ")", "{", "this", ".", "parameterNames", "=", "CompletionEngine", ".", "createDefaultParameterNames", "(", "this", ".", "parameterTypeNames", ".", "length", ")", ";", "}", "else", "{", "this", ".", "parameterNames", "=", "null", ";", "}", "}", "break", ";", "case", "METHOD_DECLARATION", ":", "try", "{", "this", ".", "parameterNames", "=", "findMethodParameterNames", "(", "this", ".", "declarationPackageName", ",", "this", ".", "declarationTypeName", ",", "this", ".", "name", ",", "Signature", ".", "getParameterTypes", "(", "this", ".", "originalSignature", "==", "null", "?", "this", ".", "signature", ":", "this", ".", "originalSignature", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "if", "(", "this", ".", "parameterTypeNames", "!=", "null", ")", "{", "this", ".", "parameterNames", "=", "CompletionEngine", ".", "createDefaultParameterNames", "(", "this", ".", "parameterTypeNames", ".", "length", ")", ";", "}", "else", "{", "this", ".", "parameterNames", "=", "null", ";", "}", "}", "if", "(", "this", ".", "parameterNames", "!=", "null", ")", "{", "this", ".", "updateCompletion", "=", "true", ";", "}", "break", ";", "}", "}", "return", "this", ".", "parameterNames", ";", "}", "public", "void", "setParameterNames", "(", "char", "[", "]", "[", "]", "parameterNames", ")", "{", "this", ".", "parameterNames", "=", "parameterNames", ";", "this", ".", "parameterNamesComputed", "=", "true", ";", "}", "public", "int", "getAccessibility", "(", ")", "{", "return", "this", ".", "accessibility", ";", "}", "public", "boolean", "isConstructor", "(", ")", "{", "return", "this", ".", "isConstructor", ";", "}", "private", "int", "receiverStart", ";", "private", "int", "receiverEnd", ";", "private", "char", "[", "]", "receiverSignature", ";", "public", "char", "[", "]", "getReceiverSignature", "(", ")", "{", "return", "this", ".", "receiverSignature", ";", "}", "public", "int", "getReceiverStart", "(", ")", "{", "return", "this", ".", "receiverStart", ";", "}", "public", "int", "getReceiverEnd", "(", ")", "{", "return", "this", ".", "receiverEnd", ";", "}", "public", "void", "setReceiverSignature", "(", "char", "[", "]", "signature", ")", "{", "this", ".", "receiverSignature", "=", "signature", ";", "}", "public", "void", "setReceiverRange", "(", "int", "startIndex", ",", "int", "endIndex", ")", "{", "this", ".", "receiverStart", "=", "startIndex", ";", "this", ".", "receiverEnd", "=", "endIndex", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "'['", ")", ";", "switch", "(", "this", ".", "completionKind", ")", "{", "case", "CompletionProposal", ".", "ANONYMOUS_CLASS_DECLARATION", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "FIELD_REF", ":", "buffer", ".", "append", "(", "\"FIELD_REF\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "KEYWORD", ":", "buffer", ".", "append", "(", "\"KEYWORD\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "LABEL_REF", ":", "buffer", ".", "append", "(", "\"LABEL_REF\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "LOCAL_VARIABLE_REF", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "METHOD_DECLARATION", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "isConstructor", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "METHOD_REF", ":", "buffer", ".", "append", "(", "\"METHOD_REF\"", ")", ";", "if", "(", "this", ".", "isConstructor", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "PACKAGE_REF", ":", "buffer", ".", "append", "(", "\"PACKAGE_REF\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "TYPE_REF", ":", "buffer", ".", "append", "(", "\"TYPE_REF\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "VARIABLE_DECLARATION", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "POTENTIAL_METHOD_DECLARATION", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "METHOD_NAME_REFERENCE", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "ANNOTATION_ATTRIBUTE_REF", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "JAVADOC_BLOCK_TAG", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "JAVADOC_INLINE_TAG", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "JAVADOC_FIELD_REF", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "JAVADOC_METHOD_REF", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "JAVADOC_TYPE_REF", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "JAVADOC_PARAM_REF", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "JAVADOC_VALUE_REF", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "FIELD_IMPORT", ":", "buffer", ".", "append", "(", "\"FIELD_IMPORT\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "METHOD_IMPORT", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "TYPE_IMPORT", ":", "buffer", ".", "append", "(", "\"TYPE_IMPORT\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "METHOD_REF_WITH_CASTED_RECEIVER", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "FIELD_REF_WITH_CASTED_RECEIVER", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "CONSTRUCTOR_INVOCATION", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "case", "CompletionProposal", ".", "ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "default", ":", "buffer", ".", "append", "(", "\"PROPOSAL\"", ")", ";", "break", ";", "}", "buffer", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "completion", "!=", "null", ")", "buffer", ".", "append", "(", "this", ".", "completion", ")", ";", "buffer", ".", "append", "(", "\",", "declSign:\"", ")", ";", "if", "(", "this", ".", "declarationSignature", "!=", "null", ")", "buffer", ".", "append", "(", "this", ".", "declarationSignature", ")", ";", "buffer", ".", "append", "(", "\",", "sign:\"", ")", ";", "if", "(", "this", ".", "signature", "!=", "null", ")", "buffer", ".", "append", "(", "this", ".", "signature", ")", ";", "buffer", ".", "append", "(", "\",", "declKey:\"", ")", ";", "if", "(", "this", ".", "declarationKey", "!=", "null", ")", "buffer", ".", "append", "(", "this", ".", "declarationKey", ")", ";", "buffer", ".", "append", "(", "\",", "key:\"", ")", ";", "if", "(", "this", ".", "key", "!=", "null", ")", "buffer", ".", "append", "(", "this", ".", "key", ")", ";", "buffer", ".", "append", "(", "\",", "name:\"", ")", ";", "if", "(", "this", ".", "name", "!=", "null", ")", "buffer", ".", "append", "(", "this", ".", "name", ")", ";", "buffer", ".", "append", "(", "\",", "replace:[\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "replaceStart", ")", ";", "buffer", ".", "append", "(", "','", ")", ";", "buffer", ".", "append", "(", "this", ".", "replaceEnd", ")", ";", "buffer", ".", "append", "(", "\"],", "token:[\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "tokenStart", ")", ";", "buffer", ".", "append", "(", "','", ")", ";", "buffer", ".", "append", "(", "this", ".", "tokenEnd", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "relevance", ")", ";", "buffer", ".", "append", "(", "'}'", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
4,999
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "CompletionProposal", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "CompletionRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IProblem", ";", "public", "class", "CompletionRequestorWrapper", "extends", "CompletionRequestor", "{", "private", "static", "boolean", "DECODE_SIGNATURE", "=", "false", ";", "private", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompletionRequestor", "requestor", ";", "public", "CompletionRequestorWrapper", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompletionRequestor", "requestor", ")", "{", "this", ".", "requestor", "=", "requestor", ";", "}", "public", "void", "accept", "(", "CompletionProposal", "proposal", ")", "{", "InternalCompletionProposal", "internalCompletionProposal", "=", "(", "InternalCompletionProposal", ")", "proposal", ";", "switch", "(", "internalCompletionProposal", ".", "getKind", "(", ")", ")", "{", "case", "CompletionProposal", ".", "KEYWORD", ":", "this", ".", "requestor", ".", "acceptKeyword", "(", "internalCompletionProposal", ".", "getName", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "break", ";", "case", "CompletionProposal", ".", "PACKAGE_REF", ":", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptPackage", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptPackage", "(", "internalCompletionProposal", ".", "getPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "TYPE_REF", ":", "if", "(", "(", "internalCompletionProposal", ".", "getFlags", "(", ")", "&", "Flags", ".", "AccEnum", ")", "!=", "0", ")", "{", "}", "else", "if", "(", "(", "internalCompletionProposal", ".", "getFlags", "(", ")", "&", "Flags", ".", "AccInterface", ")", "!=", "0", ")", "{", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptInterface", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", "&", "~", "Flags", ".", "AccInterface", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptInterface", "(", "internalCompletionProposal", ".", "getPackageName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", "&", "~", "Flags", ".", "AccInterface", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "}", "else", "{", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptClass", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptClass", "(", "internalCompletionProposal", ".", "getPackageName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "}", "break", ";", "case", "CompletionProposal", ".", "FIELD_REF", ":", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptField", "(", "Signature", ".", "getSignatureQualifier", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getName", "(", ")", ",", "Signature", ".", "getSignatureQualifier", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptField", "(", "internalCompletionProposal", ".", "getDeclarationPackageName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getDeclarationPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getDeclarationTypeName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getDeclarationTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getName", "(", ")", ",", "internalCompletionProposal", ".", "getPackageName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getTypeName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "METHOD_REF", ":", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptMethod", "(", "Signature", ".", "getSignatureQualifier", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getName", "(", ")", ",", "getParameterPackages", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "getParameterTypes", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", ",", "Signature", ".", "getSignatureQualifier", "(", "Signature", ".", "getReturnType", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "Signature", ".", "getReturnType", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptMethod", "(", "internalCompletionProposal", ".", "getDeclarationPackageName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getDeclarationPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getDeclarationTypeName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getDeclarationTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getName", "(", ")", ",", "internalCompletionProposal", ".", "getParameterPackageNames", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "getParameterPackageNames", "(", ")", ",", "internalCompletionProposal", ".", "getParameterTypeNames", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "getParameterTypeNames", "(", ")", ",", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", ",", "internalCompletionProposal", ".", "getPackageName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getTypeName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "METHOD_DECLARATION", ":", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptMethodDeclaration", "(", "Signature", ".", "getSignatureQualifier", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getName", "(", ")", ",", "getParameterPackages", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "getParameterTypes", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", ",", "Signature", ".", "getSignatureQualifier", "(", "Signature", ".", "getReturnType", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "Signature", ".", "getReturnType", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptMethodDeclaration", "(", "internalCompletionProposal", ".", "getDeclarationPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getDeclarationTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getName", "(", ")", ",", "internalCompletionProposal", ".", "getParameterPackageNames", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "getParameterPackageNames", "(", ")", ",", "internalCompletionProposal", ".", "getParameterTypeNames", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "getParameterTypeNames", "(", ")", ",", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", ",", "internalCompletionProposal", ".", "getPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "ANONYMOUS_CLASS_DECLARATION", ":", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptAnonymousType", "(", "Signature", ".", "getSignatureQualifier", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "getParameterPackages", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "getParameterTypes", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptAnonymousType", "(", "internalCompletionProposal", ".", "getDeclarationPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getDeclarationTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getParameterPackageNames", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "getParameterPackageNames", "(", ")", ",", "internalCompletionProposal", ".", "getParameterTypeNames", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "getParameterTypeNames", "(", ")", ",", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR_CHAR", ":", "internalCompletionProposal", ".", "findParameterNames", "(", "null", ")", ",", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "LABEL_REF", ":", "this", ".", "requestor", ".", "acceptLabel", "(", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "break", ";", "case", "CompletionProposal", ".", "LOCAL_VARIABLE_REF", ":", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptLocalVariable", "(", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "Signature", ".", "getSignatureQualifier", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptLocalVariable", "(", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getPackageName", "(", ")", "==", "null", "?", "CharOperation", ".", "NO_CHAR", ":", "internalCompletionProposal", ".", "getPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "VARIABLE_DECLARATION", ":", "if", "(", "DECODE_SIGNATURE", ")", "{", "this", ".", "requestor", ".", "acceptLocalVariable", "(", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "Signature", ".", "getSignatureQualifier", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "this", ".", "requestor", ".", "acceptLocalVariable", "(", "internalCompletionProposal", ".", "getCompletion", "(", ")", ",", "internalCompletionProposal", ".", "getPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getFlags", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "break", ";", "case", "CompletionProposal", ".", "POTENTIAL_METHOD_DECLARATION", ":", "if", "(", "this", ".", "requestor", "instanceof", "IExtendedCompletionRequestor", ")", "{", "IExtendedCompletionRequestor", "r", "=", "(", "IExtendedCompletionRequestor", ")", "this", ".", "requestor", ";", "if", "(", "DECODE_SIGNATURE", ")", "{", "r", ".", "acceptPotentialMethodDeclaration", "(", "Signature", ".", "getSignatureQualifier", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "Signature", ".", "getSignatureSimpleName", "(", "internalCompletionProposal", ".", "getDeclarationSignature", "(", ")", ")", ",", "internalCompletionProposal", ".", "getName", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "else", "{", "r", ".", "acceptPotentialMethodDeclaration", "(", "internalCompletionProposal", ".", "getDeclarationPackageName", "(", ")", ",", "internalCompletionProposal", ".", "getDeclarationTypeName", "(", ")", ",", "internalCompletionProposal", ".", "getName", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceStart", "(", ")", ",", "internalCompletionProposal", ".", "getReplaceEnd", "(", ")", ",", "internalCompletionProposal", ".", "getRelevance", "(", ")", ")", ";", "}", "}", "break", ";", "}", "}", "public", "void", "completionFailure", "(", "IProblem", "problem", ")", "{", "this", ".", "requestor", ".", "acceptError", "(", "problem", ")", ";", "}", "private", "char", "[", "]", "[", "]", "getParameterPackages", "(", "char", "[", "]", "methodSignature", ")", "{", "char", "[", "]", "[", "]", "parameterQualifiedTypes", "=", "Signature", ".", "getParameterTypes", "(", "methodSignature", ")", ";", "int", "length", "=", "parameterQualifiedTypes", "==", "null", "?", "0", ":", "parameterQualifiedTypes", ".", "length", ";", "char", "[", "]", "[", "]", "parameterPackages", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "parameterPackages", "[", "i", "]", "=", "Signature", ".", "getSignatureQualifier", "(", "parameterQualifiedTypes", "[", "i", "]", ")", ";", "}", "return", "parameterPackages", ";", "}", "private", "char", "[", "]", "[", "]", "getParameterTypes", "(", "char", "[", "]", "methodSignature", ")", "{", "char", "[", "]", "[", "]", "parameterQualifiedTypes", "=", "Signature", ".", "getParameterTypes", "(", "methodSignature", ")", ";", "int", "length", "=", "parameterQualifiedTypes", "==", "null", "?", "0", ":", "parameterQualifiedTypes", ".", "length", ";", "char", "[", "]", "[", "]", "parameterPackages", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "parameterPackages", "[", "i", "]", "=", "Signature", ".", "getSignatureSimpleName", "(", "parameterQualifiedTypes", "[", "i", "]", ")", ";", "}", "return", "parameterPackages", ";", "}", "}", "</s>" ]