id
int32
0
12.9k
code
sequencelengths
2
264k
3,700
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "public", "class", "SourceMethodInfo", "extends", "SourceMethodElementInfo", "{", "protected", "char", "[", "]", "returnType", ";", "public", "boolean", "isAnnotationMethod", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isConstructor", "(", ")", "{", "return", "false", ";", "}", "public", "char", "[", "]", "getReturnTypeName", "(", ")", "{", "return", "this", ".", "returnType", ";", "}", "protected", "void", "setReturnType", "(", "char", "[", "]", "type", ")", "{", "this", ".", "returnType", "=", "type", ";", "}", "}", "</s>" ]
3,701
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "*", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Hashtable", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "LinkedHashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilder", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilderFactory", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "ParserConfigurationException", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ICommand", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFolder", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IMarker", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectNature", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspaceRoot", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ProjectScope", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Platform", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "QualifiedName", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "content", ".", "IContentDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "IEclipsePreferences", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "IScopeContext", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathAttribute", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathContainer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelMarker", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IRegion", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeHierarchy", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "WorkingCopyOwner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CategorizedProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "eval", ".", "IEvaluationContext", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "ObjectVector", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ".", "PerProjectInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProjectElementInfo", ".", "ProjectCache", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "JavaBuilder", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "eval", ".", "EvaluationContextWrapper", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "JavaElementFinder", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "MementoTokenizer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "eval", ".", "EvaluationContext", ";", "import", "org", ".", "osgi", ".", "service", ".", "prefs", ".", "BackingStoreException", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Element", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Node", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "import", "org", ".", "xml", ".", "sax", ".", "InputSource", ";", "import", "org", ".", "xml", ".", "sax", ".", "SAXException", ";", "public", "class", "JavaProject", "extends", "Openable", "implements", "IJavaProject", ",", "IProjectNature", ",", "SuffixConstants", "{", "public", "static", "final", "String", "CLASSPATH_FILENAME", "=", "IJavaProject", ".", "CLASSPATH_FILE_NAME", ";", "public", "static", "final", "IClasspathEntry", "[", "]", "INVALID_CLASSPATH", "=", "new", "IClasspathEntry", "[", "0", "]", ";", "protected", "static", "final", "boolean", "IS_CASE_SENSITIVE", "=", "!", "new", "File", "(", "\"Temp\"", ")", ".", "equals", "(", "new", "File", "(", "\"temp\"", ")", ")", ";", "protected", "static", "final", "String", "[", "]", "NO_PREREQUISITES", "=", "CharOperation", ".", "NO_STRINGS", ";", "private", "static", "final", "String", "PREF_FILENAME", "=", "\".jprefs\"", ";", "public", "static", "final", "String", "DEFAULT_PREFERENCES_DIRNAME", "=", "\".settings\"", ";", "public", "static", "final", "String", "JAVA_CORE_PREFS_FILE", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\".prefs\"", ";", "private", "static", "final", "IClasspathEntry", "[", "]", "RESOLUTION_IN_PROGRESS", "=", "new", "IClasspathEntry", "[", "0", "]", ";", "private", "static", "ArrayList", "CP_RESOLUTION_BP_LISTENERS", ";", "public", "static", "class", "ClasspathResolutionBreakpointListener", "{", "public", "void", "breakpoint", "(", "int", "bp", ")", "{", "}", "}", "protected", "IProject", "project", ";", "private", "IEclipsePreferences", ".", "INodeChangeListener", "preferencesNodeListener", ";", "private", "IEclipsePreferences", ".", "IPreferenceChangeListener", "preferencesChangeListener", ";", "public", "JavaProject", "(", ")", "{", "super", "(", "null", ")", ";", "}", "public", "JavaProject", "(", "IProject", "project", ",", "JavaElement", "parent", ")", "{", "super", "(", "parent", ")", ";", "this", ".", "project", "=", "project", ";", "}", "public", "static", "synchronized", "void", "addCPResolutionBPListener", "(", "ClasspathResolutionBreakpointListener", "listener", ")", "{", "if", "(", "CP_RESOLUTION_BP_LISTENERS", "==", "null", ")", "CP_RESOLUTION_BP_LISTENERS", "=", "new", "ArrayList", "(", ")", ";", "CP_RESOLUTION_BP_LISTENERS", ".", "add", "(", "listener", ")", ";", "}", "public", "static", "synchronized", "void", "removeCPResolutionBPListener", "(", "ClasspathResolutionBreakpointListener", "listener", ")", "{", "if", "(", "CP_RESOLUTION_BP_LISTENERS", "==", "null", ")", "return", ";", "CP_RESOLUTION_BP_LISTENERS", ".", "remove", "(", "listener", ")", ";", "if", "(", "CP_RESOLUTION_BP_LISTENERS", ".", "size", "(", ")", "==", "0", ")", "CP_RESOLUTION_BP_LISTENERS", "=", "null", ";", "}", "private", "static", "synchronized", "ClasspathResolutionBreakpointListener", "[", "]", "getBPListeners", "(", ")", "{", "if", "(", "CP_RESOLUTION_BP_LISTENERS", "==", "null", ")", "return", "null", ";", "return", "(", "ClasspathResolutionBreakpointListener", "[", "]", ")", "CP_RESOLUTION_BP_LISTENERS", ".", "toArray", "(", "new", "ClasspathResolutionBreakpointListener", "[", "CP_RESOLUTION_BP_LISTENERS", ".", "size", "(", ")", "]", ")", ";", "}", "private", "static", "void", "breakpoint", "(", "int", "bp", ",", "JavaProject", "project", ")", "{", "ClasspathResolutionBreakpointListener", "[", "]", "listeners", "=", "getBPListeners", "(", ")", ";", "if", "(", "listeners", "==", "null", ")", "return", ";", "for", "(", "int", "j", "=", "0", ",", "length", "=", "listeners", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "listeners", "[", "j", "]", ".", "breakpoint", "(", "bp", ")", ";", "}", "}", "public", "static", "boolean", "areClasspathsEqual", "(", "IClasspathEntry", "[", "]", "firstClasspath", ",", "IClasspathEntry", "[", "]", "secondClasspath", ",", "IPath", "firstOutputLocation", ",", "IPath", "secondOutputLocation", ")", "{", "int", "length", "=", "firstClasspath", ".", "length", ";", "if", "(", "length", "!=", "secondClasspath", ".", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "firstClasspath", "[", "i", "]", ".", "equals", "(", "secondClasspath", "[", "i", "]", ")", ")", "return", "false", ";", "}", "if", "(", "firstOutputLocation", "==", "null", ")", "return", "secondOutputLocation", "==", "null", ";", "return", "firstOutputLocation", ".", "equals", "(", "secondOutputLocation", ")", ";", "}", "private", "static", "boolean", "areClasspathsEqual", "(", "IClasspathEntry", "[", "]", "newClasspath", ",", "IPath", "newOutputLocation", ",", "IClasspathEntry", "[", "]", "otherClasspathWithOutput", ")", "{", "if", "(", "otherClasspathWithOutput", "==", "null", "||", "otherClasspathWithOutput", ".", "length", "==", "0", ")", "return", "false", ";", "int", "length", "=", "otherClasspathWithOutput", ".", "length", ";", "if", "(", "length", "!=", "newClasspath", ".", "length", "+", "1", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", "-", "1", ";", "i", "++", ")", "{", "if", "(", "!", "otherClasspathWithOutput", "[", "i", "]", ".", "equals", "(", "newClasspath", "[", "i", "]", ")", ")", "return", "false", ";", "}", "IClasspathEntry", "output", "=", "otherClasspathWithOutput", "[", "length", "-", "1", "]", ";", "if", "(", "output", ".", "getContentKind", "(", ")", "!=", "ClasspathEntry", ".", "K_OUTPUT", "||", "!", "output", ".", "getPath", "(", ")", ".", "equals", "(", "newOutputLocation", ")", ")", "return", "false", ";", "return", "true", ";", "}", "private", "static", "boolean", "areClasspathsEqual", "(", "IClasspathEntry", "[", "]", "first", ",", "IClasspathEntry", "[", "]", "second", ")", "{", "if", "(", "first", "!=", "second", ")", "{", "if", "(", "first", "==", "null", ")", "return", "false", ";", "int", "length", "=", "first", ".", "length", ";", "if", "(", "second", "==", "null", "||", "second", ".", "length", "!=", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "first", "[", "i", "]", ".", "equals", "(", "second", "[", "i", "]", ")", ")", "return", "false", ";", "}", "}", "return", "true", ";", "}", "public", "static", "IPath", "canonicalizedPath", "(", "IPath", "externalPath", ")", "{", "if", "(", "externalPath", "==", "null", ")", "return", "null", ";", "if", "(", "IS_CASE_SENSITIVE", ")", "{", "return", "externalPath", ";", "}", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "if", "(", "workspace", "==", "null", ")", "return", "externalPath", ";", "if", "(", "workspace", ".", "getRoot", "(", ")", ".", "findMember", "(", "externalPath", ")", "!=", "null", ")", "{", "return", "externalPath", ";", "}", "IPath", "canonicalPath", "=", "null", ";", "try", "{", "canonicalPath", "=", "new", "Path", "(", "new", "File", "(", "externalPath", ".", "toOSString", "(", ")", ")", ".", "getCanonicalPath", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "externalPath", ";", "}", "IPath", "result", ";", "int", "canonicalLength", "=", "canonicalPath", ".", "segmentCount", "(", ")", ";", "if", "(", "canonicalLength", "==", "0", ")", "{", "return", "externalPath", ";", "}", "else", "if", "(", "externalPath", ".", "isAbsolute", "(", ")", ")", "{", "result", "=", "canonicalPath", ";", "}", "else", "{", "int", "externalLength", "=", "externalPath", ".", "segmentCount", "(", ")", ";", "if", "(", "canonicalLength", ">=", "externalLength", ")", "{", "result", "=", "canonicalPath", ".", "removeFirstSegments", "(", "canonicalLength", "-", "externalLength", ")", ";", "}", "else", "{", "return", "externalPath", ";", "}", "}", "if", "(", "externalPath", ".", "getDevice", "(", ")", "==", "null", ")", "{", "result", "=", "result", ".", "setDevice", "(", "null", ")", ";", "}", "if", "(", "externalPath", ".", "hasTrailingSeparator", "(", ")", ")", "{", "result", "=", "result", ".", "addTrailingSeparator", "(", ")", ";", "}", "return", "result", ";", "}", "public", "static", "boolean", "hasJavaNature", "(", "IProject", "project", ")", "{", "try", "{", "return", "project", ".", "hasNature", "(", "JavaCore", ".", "NATURE_ID", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "ExternalJavaProject", ".", "EXTERNAL_PROJECT_NAME", ".", "equals", "(", "project", ".", "getName", "(", ")", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "public", "static", "void", "validateCycles", "(", "Map", "preferredClasspaths", ")", "throws", "JavaModelException", "{", "IWorkspaceRoot", "workspaceRoot", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "IProject", "[", "]", "rscProjects", "=", "workspaceRoot", ".", "getProjects", "(", ")", ";", "int", "length", "=", "rscProjects", ".", "length", ";", "JavaProject", "[", "]", "projects", "=", "new", "JavaProject", "[", "length", "]", ";", "LinkedHashSet", "cycleParticipants", "=", "new", "LinkedHashSet", "(", ")", ";", "HashSet", "traversed", "=", "new", "HashSet", "(", ")", ";", "ArrayList", "prereqChain", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "hasJavaNature", "(", "rscProjects", "[", "i", "]", ")", ")", "{", "JavaProject", "project", "=", "(", "projects", "[", "i", "]", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "rscProjects", "[", "i", "]", ")", ")", ";", "if", "(", "!", "traversed", ".", "contains", "(", "project", ".", "getPath", "(", ")", ")", ")", "{", "prereqChain", ".", "clear", "(", ")", ";", "project", ".", "updateCycleParticipants", "(", "prereqChain", ",", "cycleParticipants", ",", "workspaceRoot", ",", "traversed", ",", "preferredClasspaths", ")", ";", "}", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JavaProject", "project", "=", "projects", "[", "i", "]", ";", "if", "(", "project", "!=", "null", ")", "{", "if", "(", "cycleParticipants", ".", "contains", "(", "project", ".", "getPath", "(", ")", ")", ")", "{", "IMarker", "cycleMarker", "=", "project", ".", "getCycleMarker", "(", ")", ";", "String", "circularCPOption", "=", "project", ".", "getOption", "(", "JavaCore", ".", "CORE_CIRCULAR_CLASSPATH", ",", "true", ")", ";", "int", "circularCPSeverity", "=", "JavaCore", ".", "ERROR", ".", "equals", "(", "circularCPOption", ")", "?", "IMarker", ".", "SEVERITY_ERROR", ":", "IMarker", ".", "SEVERITY_WARNING", ";", "if", "(", "cycleMarker", "!=", "null", ")", "{", "try", "{", "int", "existingSeverity", "=", "(", "(", "Integer", ")", "cycleMarker", ".", "getAttribute", "(", "IMarker", ".", "SEVERITY", ")", ")", ".", "intValue", "(", ")", ";", "if", "(", "existingSeverity", "!=", "circularCPSeverity", ")", "{", "cycleMarker", ".", "setAttribute", "(", "IMarker", ".", "SEVERITY", ",", "circularCPSeverity", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "else", "{", "IJavaProject", "[", "]", "projectsInCycle", ";", "String", "cycleString", "=", "\"\"", ";", "if", "(", "cycleParticipants", ".", "isEmpty", "(", ")", ")", "{", "projectsInCycle", "=", "null", ";", "}", "else", "{", "projectsInCycle", "=", "new", "IJavaProject", "[", "cycleParticipants", ".", "size", "(", ")", "]", ";", "Iterator", "it", "=", "cycleParticipants", ".", "iterator", "(", ")", ";", "int", "k", "=", "0", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "IResource", "member", "=", "workspaceRoot", ".", "findMember", "(", "(", "IPath", ")", "it", ".", "next", "(", ")", ")", ";", "if", "(", "member", "!=", "null", "&&", "member", ".", "getType", "(", ")", "==", "IResource", ".", "PROJECT", ")", "{", "projectsInCycle", "[", "k", "]", "=", "JavaCore", ".", "create", "(", "(", "IProject", ")", "member", ")", ";", "if", "(", "projectsInCycle", "[", "k", "]", "!=", "null", ")", "{", "if", "(", "k", "!=", "0", ")", "cycleString", "+=", "\",", "\"", ";", "cycleString", "+=", "projectsInCycle", "[", "k", "++", "]", ".", "getElementName", "(", ")", ";", "}", "}", "}", "}", "project", ".", "createClasspathProblemMarker", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "CLASSPATH_CYCLE", ",", "project", ",", "cycleString", ")", ")", ";", "}", "}", "else", "{", "project", ".", "flushClasspathProblemMarkers", "(", "true", ",", "false", ",", "false", ")", ";", "}", "}", "}", "}", "protected", "void", "addToBuildSpec", "(", "String", "builderID", ")", "throws", "CoreException", "{", "IProjectDescription", "description", "=", "this", ".", "project", ".", "getDescription", "(", ")", ";", "int", "javaCommandIndex", "=", "getJavaCommandIndex", "(", "description", ".", "getBuildSpec", "(", ")", ")", ";", "if", "(", "javaCommandIndex", "==", "-", "1", ")", "{", "ICommand", "command", "=", "description", ".", "newCommand", "(", ")", ";", "command", ".", "setBuilderName", "(", "builderID", ")", ";", "setJavaCommand", "(", "description", ",", "command", ")", ";", "}", "}", "protected", "boolean", "buildStructure", "(", "OpenableElementInfo", "info", ",", "IProgressMonitor", "pm", ",", "Map", "newElements", ",", "IResource", "underlyingResource", ")", "throws", "JavaModelException", "{", "IClasspathEntry", "[", "]", "resolvedClasspath", "=", "getResolvedClasspath", "(", ")", ";", "info", ".", "setChildren", "(", "computePackageFragmentRoots", "(", "resolvedClasspath", ",", "false", ",", "null", ")", ")", ";", "return", "true", ";", "}", "public", "void", "close", "(", ")", "throws", "JavaModelException", "{", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "this", ".", "project", ")", ")", "{", "JavaModelManager", ".", "PerProjectInfo", "perProjectInfo", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getPerProjectInfo", "(", "this", ".", "project", ",", "false", ")", ";", "if", "(", "perProjectInfo", "!=", "null", "&&", "perProjectInfo", ".", "preferences", "!=", "null", ")", "{", "IEclipsePreferences", "eclipseParentPreferences", "=", "(", "IEclipsePreferences", ")", "perProjectInfo", ".", "preferences", ".", "parent", "(", ")", ";", "if", "(", "this", ".", "preferencesNodeListener", "!=", "null", ")", "{", "eclipseParentPreferences", ".", "removeNodeChangeListener", "(", "this", ".", "preferencesNodeListener", ")", ";", "this", ".", "preferencesNodeListener", "=", "null", ";", "}", "if", "(", "this", ".", "preferencesChangeListener", "!=", "null", ")", "{", "perProjectInfo", ".", "preferences", ".", "removePreferenceChangeListener", "(", "this", ".", "preferencesChangeListener", ")", ";", "this", ".", "preferencesChangeListener", "=", "null", ";", "}", "}", "}", "LanguageSupportFactory", ".", "getEventHandler", "(", ")", ".", "handle", "(", "this", ",", "\"close\"", ")", ";", "super", ".", "close", "(", ")", ";", "}", "private", "void", "computeExpandedClasspath", "(", "ClasspathEntry", "referringEntry", ",", "HashSet", "rootIDs", ",", "ObjectVector", "accumulatedEntries", ")", "throws", "JavaModelException", "{", "String", "projectRootId", "=", "rootID", "(", ")", ";", "if", "(", "rootIDs", ".", "contains", "(", "projectRootId", ")", ")", "{", "return", ";", "}", "rootIDs", ".", "add", "(", "projectRootId", ")", ";", "IClasspathEntry", "[", "]", "resolvedClasspath", "=", "getResolvedClasspath", "(", ")", ";", "IWorkspaceRoot", "workspaceRoot", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "boolean", "isInitialProject", "=", "referringEntry", "==", "null", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "resolvedClasspath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ClasspathEntry", "entry", "=", "(", "ClasspathEntry", ")", "resolvedClasspath", "[", "i", "]", ";", "if", "(", "isInitialProject", "||", "entry", ".", "isExported", "(", ")", ")", "{", "String", "rootID", "=", "entry", ".", "rootID", "(", ")", ";", "if", "(", "rootIDs", ".", "contains", "(", "rootID", ")", ")", "{", "continue", ";", "}", "ClasspathEntry", "combinedEntry", "=", "entry", ".", "combineWith", "(", "referringEntry", ")", ";", "accumulatedEntries", ".", "add", "(", "combinedEntry", ")", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_PROJECT", ")", "{", "IResource", "member", "=", "workspaceRoot", ".", "findMember", "(", "entry", ".", "getPath", "(", ")", ")", ";", "if", "(", "member", "!=", "null", "&&", "member", ".", "getType", "(", ")", "==", "IResource", ".", "PROJECT", ")", "{", "IProject", "projRsc", "=", "(", "IProject", ")", "member", ";", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "projRsc", ")", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "projRsc", ")", ";", "javaProject", ".", "computeExpandedClasspath", "(", "combinedEntry", ",", "rootIDs", ",", "accumulatedEntries", ")", ";", "}", "}", "}", "else", "{", "rootIDs", ".", "add", "(", "rootID", ")", ";", "}", "}", "}", "}", "public", "IPackageFragmentRoot", "[", "]", "computePackageFragmentRoots", "(", "IClasspathEntry", "resolvedEntry", ")", "{", "try", "{", "return", "computePackageFragmentRoots", "(", "new", "IClasspathEntry", "[", "]", "{", "resolvedEntry", "}", ",", "false", ",", "null", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "new", "IPackageFragmentRoot", "[", "]", "{", "}", ";", "}", "}", "public", "void", "computePackageFragmentRoots", "(", "IClasspathEntry", "resolvedEntry", ",", "ObjectVector", "accumulatedRoots", ",", "HashSet", "rootIDs", ",", "IClasspathEntry", "referringEntry", ",", "boolean", "retrieveExportedRoots", ",", "Map", "rootToResolvedEntries", ")", "throws", "JavaModelException", "{", "String", "rootID", "=", "(", "(", "ClasspathEntry", ")", "resolvedEntry", ")", ".", "rootID", "(", ")", ";", "if", "(", "rootIDs", ".", "contains", "(", "rootID", ")", ")", "return", ";", "IPath", "projectPath", "=", "this", ".", "project", ".", "getFullPath", "(", ")", ";", "IPath", "entryPath", "=", "resolvedEntry", ".", "getPath", "(", ")", ";", "IWorkspaceRoot", "workspaceRoot", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "IPackageFragmentRoot", "root", "=", "null", ";", "switch", "(", "resolvedEntry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "if", "(", "projectPath", ".", "isPrefixOf", "(", "entryPath", ")", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "entryPath", ",", "true", ")", ";", "if", "(", "target", "==", "null", ")", "return", ";", "if", "(", "target", "instanceof", "IFolder", "||", "target", "instanceof", "IProject", ")", "{", "root", "=", "getPackageFragmentRoot", "(", "(", "IResource", ")", "target", ")", ";", "}", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "if", "(", "referringEntry", "!=", "null", "&&", "!", "resolvedEntry", ".", "isExported", "(", ")", ")", "return", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "entryPath", ",", "true", ")", ";", "if", "(", "target", "==", "null", ")", "return", ";", "if", "(", "target", "instanceof", "IResource", ")", "{", "root", "=", "getPackageFragmentRoot", "(", "(", "IResource", ")", "target", ",", "entryPath", ")", ";", "}", "else", "if", "(", "target", "instanceof", "File", ")", "{", "if", "(", "JavaModel", ".", "isFile", "(", "target", ")", ")", "{", "root", "=", "new", "JarPackageFragmentRoot", "(", "entryPath", ",", "this", ")", ";", "}", "else", "if", "(", "(", "(", "File", ")", "target", ")", ".", "isDirectory", "(", ")", ")", "{", "root", "=", "new", "ExternalPackageFragmentRoot", "(", "entryPath", ",", "this", ")", ";", "}", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "if", "(", "!", "retrieveExportedRoots", ")", "return", ";", "if", "(", "referringEntry", "!=", "null", "&&", "!", "resolvedEntry", ".", "isExported", "(", ")", ")", "return", ";", "IResource", "member", "=", "workspaceRoot", ".", "findMember", "(", "entryPath", ")", ";", "if", "(", "member", "!=", "null", "&&", "member", ".", "getType", "(", ")", "==", "IResource", ".", "PROJECT", ")", "{", "IProject", "requiredProjectRsc", "=", "(", "IProject", ")", "member", ";", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "requiredProjectRsc", ")", ")", "{", "rootIDs", ".", "add", "(", "rootID", ")", ";", "JavaProject", "requiredProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "requiredProjectRsc", ")", ";", "requiredProject", ".", "computePackageFragmentRoots", "(", "requiredProject", ".", "getResolvedClasspath", "(", ")", ",", "accumulatedRoots", ",", "rootIDs", ",", "rootToResolvedEntries", "==", "null", "?", "resolvedEntry", ":", "(", "(", "ClasspathEntry", ")", "resolvedEntry", ")", ".", "combineWith", "(", "(", "ClasspathEntry", ")", "referringEntry", ")", ",", "retrieveExportedRoots", ",", "rootToResolvedEntries", ")", ";", "}", "break", ";", "}", "}", "if", "(", "root", "!=", "null", ")", "{", "accumulatedRoots", ".", "add", "(", "root", ")", ";", "rootIDs", ".", "add", "(", "rootID", ")", ";", "if", "(", "rootToResolvedEntries", "!=", "null", ")", "rootToResolvedEntries", ".", "put", "(", "root", ",", "(", "(", "ClasspathEntry", ")", "resolvedEntry", ")", ".", "combineWith", "(", "(", "ClasspathEntry", ")", "referringEntry", ")", ")", ";", "}", "}", "public", "IPackageFragmentRoot", "[", "]", "computePackageFragmentRoots", "(", "IClasspathEntry", "[", "]", "resolvedClasspath", ",", "boolean", "retrieveExportedRoots", ",", "Map", "rootToResolvedEntries", ")", "throws", "JavaModelException", "{", "ObjectVector", "accumulatedRoots", "=", "new", "ObjectVector", "(", ")", ";", "computePackageFragmentRoots", "(", "resolvedClasspath", ",", "accumulatedRoots", ",", "new", "HashSet", "(", "5", ")", ",", "null", ",", "retrieveExportedRoots", ",", "rootToResolvedEntries", ")", ";", "IPackageFragmentRoot", "[", "]", "rootArray", "=", "new", "IPackageFragmentRoot", "[", "accumulatedRoots", ".", "size", "(", ")", "]", ";", "accumulatedRoots", ".", "copyInto", "(", "rootArray", ")", ";", "return", "rootArray", ";", "}", "public", "void", "computePackageFragmentRoots", "(", "IClasspathEntry", "[", "]", "resolvedClasspath", ",", "ObjectVector", "accumulatedRoots", ",", "HashSet", "rootIDs", ",", "IClasspathEntry", "referringEntry", ",", "boolean", "retrieveExportedRoots", ",", "Map", "rootToResolvedEntries", ")", "throws", "JavaModelException", "{", "if", "(", "referringEntry", "==", "null", ")", "{", "rootIDs", ".", "add", "(", "rootID", "(", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "resolvedClasspath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "computePackageFragmentRoots", "(", "resolvedClasspath", "[", "i", "]", ",", "accumulatedRoots", ",", "rootIDs", ",", "referringEntry", ",", "retrieveExportedRoots", ",", "rootToResolvedEntries", ")", ";", "}", "}", "public", "String", "computeSharedPropertyFileName", "(", "QualifiedName", "qName", ")", "{", "return", "'.'", "+", "qName", ".", "getLocalName", "(", ")", ";", "}", "public", "void", "configure", "(", ")", "throws", "CoreException", "{", "addToBuildSpec", "(", "JavaCore", ".", "BUILDER_ID", ")", ";", "}", "public", "boolean", "contains", "(", "IResource", "resource", ")", "{", "IClasspathEntry", "[", "]", "classpath", ";", "IPath", "output", ";", "try", "{", "classpath", "=", "getResolvedClasspath", "(", ")", ";", "output", "=", "getOutputLocation", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "IPath", "fullPath", "=", "resource", ".", "getFullPath", "(", ")", ";", "IPath", "innerMostOutput", "=", "output", ".", "isPrefixOf", "(", "fullPath", ")", "?", "output", ":", "null", ";", "IClasspathEntry", "innerMostEntry", "=", "null", ";", "ExternalFoldersManager", "foldersManager", "=", "JavaModelManager", ".", "getExternalManager", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "cpLength", "=", "classpath", ".", "length", ";", "j", "<", "cpLength", ";", "j", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "j", "]", ";", "IPath", "entryPath", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "IResource", "linkedFolder", "=", "foldersManager", ".", "getFolder", "(", "entryPath", ")", ";", "if", "(", "linkedFolder", "!=", "null", ")", "entryPath", "=", "linkedFolder", ".", "getFullPath", "(", ")", ";", "}", "if", "(", "(", "innerMostEntry", "==", "null", "||", "innerMostEntry", ".", "getPath", "(", ")", ".", "isPrefixOf", "(", "entryPath", ")", ")", "&&", "entryPath", ".", "isPrefixOf", "(", "fullPath", ")", ")", "{", "innerMostEntry", "=", "entry", ";", "}", "IPath", "entryOutput", "=", "classpath", "[", "j", "]", ".", "getOutputLocation", "(", ")", ";", "if", "(", "entryOutput", "!=", "null", "&&", "entryOutput", ".", "isPrefixOf", "(", "fullPath", ")", ")", "{", "innerMostOutput", "=", "entryOutput", ";", "}", "}", "if", "(", "innerMostEntry", "!=", "null", ")", "{", "if", "(", "innerMostOutput", "!=", "null", "&&", "innerMostOutput", ".", "segmentCount", "(", ")", ">", "1", "&&", "innerMostEntry", ".", "getPath", "(", ")", ".", "segmentCount", "(", ")", "==", "1", ")", "{", "return", "false", ";", "}", "if", "(", "resource", "instanceof", "IFolder", ")", "{", "return", "true", ";", "}", "switch", "(", "innerMostEntry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "return", "!", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "fullPath", ".", "lastSegment", "(", ")", ")", ";", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "return", "!", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "fullPath", ".", "lastSegment", "(", ")", ")", ";", "}", "}", "if", "(", "innerMostOutput", "!=", "null", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "public", "void", "createClasspathProblemMarker", "(", "IJavaModelStatus", "status", ")", "{", "IMarker", "marker", "=", "null", ";", "int", "severity", ";", "String", "[", "]", "arguments", "=", "CharOperation", ".", "NO_STRINGS", ";", "boolean", "isCycleProblem", "=", "false", ",", "isClasspathFileFormatProblem", "=", "false", ",", "isOutputOverlapping", "=", "false", ";", "switch", "(", "status", ".", "getCode", "(", ")", ")", "{", "case", "IJavaModelStatusConstants", ".", "CLASSPATH_CYCLE", ":", "isCycleProblem", "=", "true", ";", "if", "(", "JavaCore", ".", "ERROR", ".", "equals", "(", "getOption", "(", "JavaCore", ".", "CORE_CIRCULAR_CLASSPATH", ",", "true", ")", ")", ")", "{", "severity", "=", "IMarker", ".", "SEVERITY_ERROR", ";", "}", "else", "{", "severity", "=", "IMarker", ".", "SEVERITY_WARNING", ";", "}", "break", ";", "case", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH_FILE_FORMAT", ":", "isClasspathFileFormatProblem", "=", "true", ";", "severity", "=", "IMarker", ".", "SEVERITY_ERROR", ";", "break", ";", "case", "IJavaModelStatusConstants", ".", "INCOMPATIBLE_JDK_LEVEL", ":", "String", "setting", "=", "getOption", "(", "JavaCore", ".", "CORE_INCOMPATIBLE_JDK_LEVEL", ",", "true", ")", ";", "if", "(", "JavaCore", ".", "ERROR", ".", "equals", "(", "setting", ")", ")", "{", "severity", "=", "IMarker", ".", "SEVERITY_ERROR", ";", "}", "else", "if", "(", "JavaCore", ".", "WARNING", ".", "equals", "(", "setting", ")", ")", "{", "severity", "=", "IMarker", ".", "SEVERITY_WARNING", ";", "}", "else", "{", "return", ";", "}", "break", ";", "case", "IJavaModelStatusConstants", ".", "OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ":", "isOutputOverlapping", "=", "true", ";", "setting", "=", "getOption", "(", "JavaCore", ".", "CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ",", "true", ")", ";", "if", "(", "JavaCore", ".", "ERROR", ".", "equals", "(", "setting", ")", ")", "{", "severity", "=", "IMarker", ".", "SEVERITY_ERROR", ";", "}", "else", "if", "(", "JavaCore", ".", "WARNING", ".", "equals", "(", "setting", ")", ")", "{", "severity", "=", "IMarker", ".", "SEVERITY_WARNING", ";", "}", "else", "{", "return", ";", "}", "break", ";", "default", ":", "IPath", "path", "=", "status", ".", "getPath", "(", ")", ";", "if", "(", "path", "!=", "null", ")", "arguments", "=", "new", "String", "[", "]", "{", "path", ".", "toString", "(", ")", "}", ";", "if", "(", "JavaCore", ".", "ERROR", ".", "equals", "(", "getOption", "(", "JavaCore", ".", "CORE_INCOMPLETE_CLASSPATH", ",", "true", ")", ")", "&&", "status", ".", "getSeverity", "(", ")", "!=", "IStatus", ".", "WARNING", ")", "{", "severity", "=", "IMarker", ".", "SEVERITY_ERROR", ";", "}", "else", "{", "severity", "=", "IMarker", ".", "SEVERITY_WARNING", ";", "}", "break", ";", "}", "try", "{", "marker", "=", "this", ".", "project", ".", "createMarker", "(", "IJavaModelMarker", ".", "BUILDPATH_PROBLEM_MARKER", ")", ";", "marker", ".", "setAttributes", "(", "new", "String", "[", "]", "{", "IMarker", ".", "MESSAGE", ",", "IMarker", ".", "SEVERITY", ",", "IMarker", ".", "LOCATION", ",", "IJavaModelMarker", ".", "CYCLE_DETECTED", ",", "IJavaModelMarker", ".", "CLASSPATH_FILE_FORMAT", ",", "IJavaModelMarker", ".", "OUTPUT_OVERLAPPING_SOURCE", ",", "IJavaModelMarker", ".", "ID", ",", "IJavaModelMarker", ".", "ARGUMENTS", ",", "IJavaModelMarker", ".", "CATEGORY_ID", ",", "IMarker", ".", "SOURCE_ID", ",", "}", ",", "new", "Object", "[", "]", "{", "status", ".", "getMessage", "(", ")", ",", "new", "Integer", "(", "severity", ")", ",", "Messages", ".", "classpath_buildPath", ",", "isCycleProblem", "?", "\"true\"", ":", "\"false\"", ",", "isClasspathFileFormatProblem", "?", "\"true\"", ":", "\"false\"", ",", "isOutputOverlapping", "?", "\"true\"", ":", "\"false\"", ",", "new", "Integer", "(", "status", ".", "getCode", "(", ")", ")", ",", "Util", ".", "getProblemArgumentsForMarker", "(", "arguments", ")", ",", "new", "Integer", "(", "CategorizedProblem", ".", "CAT_BUILDPATH", ")", ",", "JavaBuilder", ".", "SOURCE_ID", ",", "}", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "JavaModelManager", ".", "VERBOSE", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "protected", "Object", "createElementInfo", "(", ")", "{", "return", "new", "JavaProjectElementInfo", "(", ")", ";", "}", "public", "IClasspathEntry", "[", "]", "[", "]", "decodeClasspath", "(", "String", "xmlClasspath", ",", "Map", "unknownElements", ")", "throws", "IOException", ",", "ClasspathEntry", ".", "AssertionFailedException", "{", "ArrayList", "paths", "=", "new", "ArrayList", "(", ")", ";", "IClasspathEntry", "defaultOutput", "=", "null", ";", "StringReader", "reader", "=", "new", "StringReader", "(", "xmlClasspath", ")", ";", "Element", "cpElement", ";", "try", "{", "DocumentBuilder", "parser", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ".", "newDocumentBuilder", "(", ")", ";", "cpElement", "=", "parser", ".", "parse", "(", "new", "InputSource", "(", "reader", ")", ")", ".", "getDocumentElement", "(", ")", ";", "}", "catch", "(", "SAXException", "e", ")", "{", "throw", "new", "IOException", "(", "Messages", ".", "file_badFormat", ")", ";", "}", "catch", "(", "ParserConfigurationException", "e", ")", "{", "throw", "new", "IOException", "(", "Messages", ".", "file_badFormat", ")", ";", "}", "finally", "{", "reader", ".", "close", "(", ")", ";", "}", "if", "(", "!", "cpElement", ".", "getNodeName", "(", ")", ".", "equalsIgnoreCase", "(", "\"classpath\"", ")", ")", "{", "throw", "new", "IOException", "(", "Messages", ".", "file_badFormat", ")", ";", "}", "NodeList", "list", "=", "cpElement", ".", "getElementsByTagName", "(", "ClasspathEntry", ".", "TAG_CLASSPATHENTRY", ")", ";", "int", "length", "=", "list", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "++", "i", ")", "{", "Node", "node", "=", "list", ".", "item", "(", "i", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "IClasspathEntry", "entry", "=", "ClasspathEntry", ".", "elementDecode", "(", "(", "Element", ")", "node", ",", "this", ",", "unknownElements", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "if", "(", "entry", ".", "getContentKind", "(", ")", "==", "ClasspathEntry", ".", "K_OUTPUT", ")", "{", "defaultOutput", "=", "entry", ";", "}", "else", "{", "paths", ".", "add", "(", "entry", ")", ";", "}", "}", "}", "}", "int", "pathSize", "=", "paths", ".", "size", "(", ")", ";", "IClasspathEntry", "[", "]", "[", "]", "entries", "=", "new", "IClasspathEntry", "[", "2", "]", "[", "]", ";", "entries", "[", "0", "]", "=", "new", "IClasspathEntry", "[", "pathSize", "+", "(", "defaultOutput", "==", "null", "?", "0", ":", "1", ")", "]", ";", "paths", ".", "toArray", "(", "entries", "[", "0", "]", ")", ";", "if", "(", "defaultOutput", "!=", "null", ")", "entries", "[", "0", "]", "[", "pathSize", "]", "=", "defaultOutput", ";", "paths", ".", "clear", "(", ")", ";", "list", "=", "cpElement", ".", "getElementsByTagName", "(", "ClasspathEntry", ".", "TAG_REFERENCED_ENTRY", ")", ";", "length", "=", "list", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "++", "i", ")", "{", "Node", "node", "=", "list", ".", "item", "(", "i", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "IClasspathEntry", "entry", "=", "ClasspathEntry", ".", "elementDecode", "(", "(", "Element", ")", "node", ",", "this", ",", "unknownElements", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "paths", ".", "add", "(", "entry", ")", ";", "}", "}", "}", "entries", "[", "1", "]", "=", "new", "IClasspathEntry", "[", "paths", ".", "size", "(", ")", "]", ";", "paths", ".", "toArray", "(", "entries", "[", "1", "]", ")", ";", "return", "entries", ";", "}", "public", "IClasspathEntry", "decodeClasspathEntry", "(", "String", "encodedEntry", ")", "{", "try", "{", "if", "(", "encodedEntry", "==", "null", ")", "return", "null", ";", "StringReader", "reader", "=", "new", "StringReader", "(", "encodedEntry", ")", ";", "Element", "node", ";", "try", "{", "DocumentBuilder", "parser", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ".", "newDocumentBuilder", "(", ")", ";", "node", "=", "parser", ".", "parse", "(", "new", "InputSource", "(", "reader", ")", ")", ".", "getDocumentElement", "(", ")", ";", "}", "catch", "(", "SAXException", "e", ")", "{", "return", "null", ";", "}", "catch", "(", "ParserConfigurationException", "e", ")", "{", "return", "null", ";", "}", "finally", "{", "reader", ".", "close", "(", ")", ";", "}", "if", "(", "!", "node", ".", "getNodeName", "(", ")", ".", "equalsIgnoreCase", "(", "ClasspathEntry", ".", "TAG_CLASSPATHENTRY", ")", "||", "node", ".", "getNodeType", "(", ")", "!=", "Node", ".", "ELEMENT_NODE", ")", "{", "return", "null", ";", "}", "return", "ClasspathEntry", ".", "elementDecode", "(", "node", ",", "this", ",", "null", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "void", "deconfigure", "(", ")", "throws", "CoreException", "{", "removeFromBuildSpec", "(", "JavaCore", ".", "BUILDER_ID", ")", ";", "}", "protected", "IClasspathEntry", "[", "]", "defaultClasspath", "(", ")", "{", "return", "new", "IClasspathEntry", "[", "]", "{", "JavaCore", ".", "newSourceEntry", "(", "this", ".", "project", ".", "getFullPath", "(", ")", ")", "}", ";", "}", "protected", "IPath", "defaultOutputLocation", "(", ")", "{", "return", "this", ".", "project", ".", "getFullPath", "(", ")", ".", "append", "(", "\"bin\"", ")", ";", "}", "protected", "String", "encodeClasspath", "(", "IClasspathEntry", "[", "]", "classpath", ",", "IClasspathEntry", "[", "]", "referencedEntries", ",", "IPath", "outputLocation", ",", "boolean", "indent", ",", "Map", "unknownElements", ")", "throws", "JavaModelException", "{", "try", "{", "ByteArrayOutputStream", "s", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "OutputStreamWriter", "writer", "=", "new", "OutputStreamWriter", "(", "s", ",", "\"UTF8\"", ")", ";", "XMLWriter", "xmlWriter", "=", "new", "XMLWriter", "(", "writer", ",", "this", ",", "true", ")", ";", "xmlWriter", ".", "startTag", "(", "ClasspathEntry", ".", "TAG_CLASSPATH", ",", "indent", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "classpath", ".", "length", ";", "++", "i", ")", "{", "(", "(", "ClasspathEntry", ")", "classpath", "[", "i", "]", ")", ".", "elementEncode", "(", "xmlWriter", ",", "this", ".", "project", ".", "getFullPath", "(", ")", ",", "indent", ",", "true", ",", "unknownElements", ",", "false", ")", ";", "}", "if", "(", "outputLocation", "!=", "null", ")", "{", "outputLocation", "=", "outputLocation", ".", "removeFirstSegments", "(", "1", ")", ";", "outputLocation", "=", "outputLocation", ".", "makeRelative", "(", ")", ";", "HashMap", "parameters", "=", "new", "HashMap", "(", ")", ";", "parameters", ".", "put", "(", "ClasspathEntry", ".", "TAG_KIND", ",", "ClasspathEntry", ".", "kindToString", "(", "ClasspathEntry", ".", "K_OUTPUT", ")", ")", ";", "parameters", ".", "put", "(", "ClasspathEntry", ".", "TAG_PATH", ",", "String", ".", "valueOf", "(", "outputLocation", ")", ")", ";", "xmlWriter", ".", "printTag", "(", "ClasspathEntry", ".", "TAG_CLASSPATHENTRY", ",", "parameters", ",", "indent", ",", "true", ",", "true", ")", ";", "}", "if", "(", "referencedEntries", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "referencedEntries", ".", "length", ";", "++", "i", ")", "{", "(", "(", "ClasspathEntry", ")", "referencedEntries", "[", "i", "]", ")", ".", "elementEncode", "(", "xmlWriter", ",", "this", ".", "project", ".", "getFullPath", "(", ")", ",", "indent", ",", "true", ",", "unknownElements", ",", "true", ")", ";", "}", "}", "xmlWriter", ".", "endTag", "(", "ClasspathEntry", ".", "TAG_CLASSPATH", ",", "indent", ",", "true", ")", ";", "writer", ".", "flush", "(", ")", ";", "writer", ".", "close", "(", ")", ";", "return", "s", ".", "toString", "(", "\"UTF8\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ",", "IJavaModelStatusConstants", ".", "IO_EXCEPTION", ")", ";", "}", "}", "public", "String", "encodeClasspathEntry", "(", "IClasspathEntry", "classpathEntry", ")", "{", "try", "{", "ByteArrayOutputStream", "s", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "OutputStreamWriter", "writer", "=", "new", "OutputStreamWriter", "(", "s", ",", "\"UTF8\"", ")", ";", "XMLWriter", "xmlWriter", "=", "new", "XMLWriter", "(", "writer", ",", "this", ",", "false", ")", ";", "(", "(", "ClasspathEntry", ")", "classpathEntry", ")", ".", "elementEncode", "(", "xmlWriter", ",", "this", ".", "project", ".", "getFullPath", "(", ")", ",", "true", ",", "true", ",", "null", ",", "(", "classpathEntry", ".", "getReferencingEntry", "(", ")", "!=", "null", ")", ")", ";", "writer", ".", "flush", "(", ")", ";", "writer", ".", "close", "(", ")", ";", "return", "s", ".", "toString", "(", "\"UTF8\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "this", "==", "o", ")", "return", "true", ";", "if", "(", "!", "(", "o", "instanceof", "JavaProject", ")", ")", "return", "false", ";", "JavaProject", "other", "=", "(", "JavaProject", ")", "o", ";", "return", "this", ".", "project", ".", "equals", "(", "other", ".", "getProject", "(", ")", ")", ";", "}", "public", "IJavaElement", "findElement", "(", "IPath", "path", ")", "throws", "JavaModelException", "{", "return", "findElement", "(", "path", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "IJavaElement", "findElement", "(", "IPath", "path", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "if", "(", "path", "==", "null", "||", "path", ".", "isAbsolute", "(", ")", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_PATH", ",", "path", ")", ")", ";", "}", "try", "{", "String", "extension", "=", "path", ".", "getFileExtension", "(", ")", ";", "if", "(", "extension", "==", "null", ")", "{", "String", "packageName", "=", "path", ".", "toString", "(", ")", ".", "replace", "(", "IPath", ".", "SEPARATOR", ",", "'.'", ")", ";", "return", "findPackageFragment", "(", "packageName", ")", ";", "}", "else", "if", "(", "Util", ".", "isJavaLikeFileName", "(", "path", ".", "lastSegment", "(", ")", ")", "||", "extension", ".", "equalsIgnoreCase", "(", "EXTENSION_class", ")", ")", "{", "IPath", "packagePath", "=", "path", ".", "removeLastSegments", "(", "1", ")", ";", "String", "packageName", "=", "packagePath", ".", "toString", "(", ")", ".", "replace", "(", "IPath", ".", "SEPARATOR", ",", "'.'", ")", ";", "String", "typeName", "=", "path", ".", "lastSegment", "(", ")", ";", "typeName", "=", "typeName", ".", "substring", "(", "0", ",", "typeName", ".", "length", "(", ")", "-", "extension", ".", "length", "(", ")", "-", "1", ")", ";", "String", "qualifiedName", "=", "null", ";", "if", "(", "packageName", ".", "length", "(", ")", ">", "0", ")", "{", "qualifiedName", "=", "packageName", "+", "\".\"", "+", "typeName", ";", "}", "else", "{", "qualifiedName", "=", "typeName", ";", "}", "NameLookup", "lookup", "=", "newNameLookup", "(", "owner", ")", ";", "NameLookup", ".", "Answer", "answer", "=", "lookup", ".", "findType", "(", "qualifiedName", ",", "false", ",", "NameLookup", ".", "ACCEPT_ALL", ",", "true", ",", "false", ",", "false", ",", "null", ")", ";", "if", "(", "answer", "!=", "null", ")", "{", "return", "answer", ".", "type", ".", "getParent", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "e", ".", "getStatus", "(", ")", ".", "getCode", "(", ")", "==", "IJavaModelStatusConstants", ".", "ELEMENT_DOES_NOT_EXIST", ")", "{", "return", "null", ";", "}", "else", "{", "throw", "e", ";", "}", "}", "}", "public", "IJavaElement", "findPackageFragment", "(", "String", "packageName", ")", "throws", "JavaModelException", "{", "NameLookup", "lookup", "=", "newNameLookup", "(", "(", "WorkingCopyOwner", ")", "null", ")", ";", "IPackageFragment", "[", "]", "pkgFragments", "=", "lookup", ".", "findPackageFragments", "(", "packageName", ",", "false", ")", ";", "if", "(", "pkgFragments", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "pkgFragments", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IPackageFragment", "pkgFragment", "=", "pkgFragments", "[", "i", "]", ";", "if", "(", "equals", "(", "pkgFragment", ".", "getParent", "(", ")", ".", "getParent", "(", ")", ")", ")", "{", "return", "pkgFragment", ";", "}", "}", "return", "pkgFragments", "[", "0", "]", ";", "}", "}", "public", "IJavaElement", "findElement", "(", "String", "bindingKey", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "JavaElementFinder", "elementFinder", "=", "new", "JavaElementFinder", "(", "bindingKey", ",", "this", ",", "owner", ")", ";", "elementFinder", ".", "parse", "(", ")", ";", "if", "(", "elementFinder", ".", "exception", "!=", "null", ")", "throw", "elementFinder", ".", "exception", ";", "return", "elementFinder", ".", "element", ";", "}", "public", "IPackageFragment", "findPackageFragment", "(", "IPath", "path", ")", "throws", "JavaModelException", "{", "return", "findPackageFragment0", "(", "JavaProject", ".", "canonicalizedPath", "(", "path", ")", ")", ";", "}", "private", "IPackageFragment", "findPackageFragment0", "(", "IPath", "path", ")", "throws", "JavaModelException", "{", "NameLookup", "lookup", "=", "newNameLookup", "(", "(", "WorkingCopyOwner", ")", "null", ")", ";", "return", "lookup", ".", "findPackageFragment", "(", "path", ")", ";", "}", "public", "IPackageFragmentRoot", "findPackageFragmentRoot", "(", "IPath", "path", ")", "throws", "JavaModelException", "{", "return", "findPackageFragmentRoot0", "(", "JavaProject", ".", "canonicalizedPath", "(", "path", ")", ")", ";", "}", "public", "IPackageFragmentRoot", "findPackageFragmentRoot0", "(", "IPath", "path", ")", "throws", "JavaModelException", "{", "IPackageFragmentRoot", "[", "]", "allRoots", "=", "this", ".", "getAllPackageFragmentRoots", "(", ")", ";", "if", "(", "!", "path", ".", "isAbsolute", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "path_mustBeAbsolute", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "allRoots", ".", "length", ";", "i", "++", ")", "{", "IPackageFragmentRoot", "classpathRoot", "=", "allRoots", "[", "i", "]", ";", "if", "(", "classpathRoot", ".", "getPath", "(", ")", ".", "equals", "(", "path", ")", ")", "{", "return", "classpathRoot", ";", "}", "}", "return", "null", ";", "}", "public", "IPackageFragmentRoot", "[", "]", "findPackageFragmentRoots", "(", "IClasspathEntry", "entry", ")", "{", "try", "{", "IClasspathEntry", "[", "]", "classpath", "=", "getRawClasspath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "classpath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "classpath", "[", "i", "]", ".", "equals", "(", "entry", ")", ")", "{", "return", "computePackageFragmentRoots", "(", "resolveClasspath", "(", "new", "IClasspathEntry", "[", "]", "{", "entry", "}", ")", ",", "false", ",", "null", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "return", "new", "IPackageFragmentRoot", "[", "]", "{", "}", ";", "}", "public", "IType", "findType", "(", "String", "fullyQualifiedName", ")", "throws", "JavaModelException", "{", "return", "findType", "(", "fullyQualifiedName", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "IType", "findType", "(", "String", "fullyQualifiedName", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "return", "findType", "(", "fullyQualifiedName", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "progressMonitor", ")", ";", "}", "IType", "findType", "(", "String", "fullyQualifiedName", ",", "NameLookup", "lookup", ",", "boolean", "considerSecondaryTypes", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "NameLookup", ".", "Answer", "answer", "=", "lookup", ".", "findType", "(", "fullyQualifiedName", ",", "false", ",", "NameLookup", ".", "ACCEPT_ALL", ",", "considerSecondaryTypes", ",", "true", ",", "false", ",", "progressMonitor", ")", ";", "if", "(", "answer", "==", "null", ")", "{", "int", "lastDot", "=", "fullyQualifiedName", ".", "lastIndexOf", "(", "'.'", ")", ";", "if", "(", "lastDot", "==", "-", "1", ")", "return", "null", ";", "IType", "type", "=", "findType", "(", "fullyQualifiedName", ".", "substring", "(", "0", ",", "lastDot", ")", ",", "lookup", ",", "considerSecondaryTypes", ",", "progressMonitor", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "type", "=", "type", ".", "getType", "(", "fullyQualifiedName", ".", "substring", "(", "lastDot", "+", "1", ")", ")", ";", "if", "(", "!", "type", ".", "exists", "(", ")", ")", "{", "return", "null", ";", "}", "}", "return", "type", ";", "}", "return", "answer", ".", "type", ";", "}", "public", "IType", "findType", "(", "String", "packageName", ",", "String", "typeQualifiedName", ")", "throws", "JavaModelException", "{", "return", "findType", "(", "packageName", ",", "typeQualifiedName", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "IType", "findType", "(", "String", "packageName", ",", "String", "typeQualifiedName", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "return", "findType", "(", "packageName", ",", "typeQualifiedName", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "progressMonitor", ")", ";", "}", "IType", "findType", "(", "String", "packageName", ",", "String", "typeQualifiedName", ",", "NameLookup", "lookup", ",", "boolean", "considerSecondaryTypes", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "NameLookup", ".", "Answer", "answer", "=", "lookup", ".", "findType", "(", "typeQualifiedName", ",", "packageName", ",", "false", ",", "NameLookup", ".", "ACCEPT_ALL", ",", "considerSecondaryTypes", ",", "true", ",", "false", ",", "progressMonitor", ")", ";", "return", "answer", "==", "null", "?", "null", ":", "answer", ".", "type", ";", "}", "public", "IType", "findType", "(", "String", "packageName", ",", "String", "typeQualifiedName", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "NameLookup", "lookup", "=", "newNameLookup", "(", "owner", ")", ";", "return", "findType", "(", "packageName", ",", "typeQualifiedName", ",", "lookup", ",", "false", ",", "null", ")", ";", "}", "public", "IType", "findType", "(", "String", "packageName", ",", "String", "typeQualifiedName", ",", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "NameLookup", "lookup", "=", "newNameLookup", "(", "owner", ")", ";", "return", "findType", "(", "packageName", ",", "typeQualifiedName", ",", "lookup", ",", "true", ",", "progressMonitor", ")", ";", "}", "public", "IType", "findType", "(", "String", "fullyQualifiedName", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "NameLookup", "lookup", "=", "newNameLookup", "(", "owner", ")", ";", "return", "findType", "(", "fullyQualifiedName", ",", "lookup", ",", "false", ",", "null", ")", ";", "}", "public", "IType", "findType", "(", "String", "fullyQualifiedName", ",", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "NameLookup", "lookup", "=", "newNameLookup", "(", "owner", ")", ";", "return", "findType", "(", "fullyQualifiedName", ",", "lookup", ",", "true", ",", "progressMonitor", ")", ";", "}", "protected", "void", "flushClasspathProblemMarkers", "(", "boolean", "flushCycleMarkers", ",", "boolean", "flushClasspathFormatMarkers", ",", "boolean", "flushOverlappingOutputMarkers", ")", "{", "try", "{", "if", "(", "this", ".", "project", ".", "isAccessible", "(", ")", ")", "{", "IMarker", "[", "]", "markers", "=", "this", ".", "project", ".", "findMarkers", "(", "IJavaModelMarker", ".", "BUILDPATH_PROBLEM_MARKER", ",", "false", ",", "IResource", ".", "DEPTH_ZERO", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "markers", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IMarker", "marker", "=", "markers", "[", "i", "]", ";", "if", "(", "flushCycleMarkers", "&&", "flushClasspathFormatMarkers", "&&", "flushOverlappingOutputMarkers", ")", "{", "marker", ".", "delete", "(", ")", ";", "}", "else", "{", "String", "cycleAttr", "=", "(", "String", ")", "marker", ".", "getAttribute", "(", "IJavaModelMarker", ".", "CYCLE_DETECTED", ")", ";", "String", "classpathFileFormatAttr", "=", "(", "String", ")", "marker", ".", "getAttribute", "(", "IJavaModelMarker", ".", "CLASSPATH_FILE_FORMAT", ")", ";", "String", "overlappingOutputAttr", "=", "(", "String", ")", "marker", ".", "getAttribute", "(", "IJavaModelMarker", ".", "OUTPUT_OVERLAPPING_SOURCE", ")", ";", "if", "(", "(", "flushCycleMarkers", "==", "(", "cycleAttr", "!=", "null", "&&", "cycleAttr", ".", "equals", "(", "\"true\"", ")", ")", ")", "&&", "(", "flushOverlappingOutputMarkers", "==", "(", "overlappingOutputAttr", "!=", "null", "&&", "overlappingOutputAttr", ".", "equals", "(", "\"true\"", ")", ")", ")", "&&", "(", "flushClasspathFormatMarkers", "==", "(", "classpathFileFormatAttr", "!=", "null", "&&", "classpathFileFormatAttr", ".", "equals", "(", "\"true\"", ")", ")", ")", ")", "{", "marker", ".", "delete", "(", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "JavaModelManager", ".", "VERBOSE", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "public", "IPath", "[", "]", "getAccessRestrictions", "(", "String", "optionName", ")", "{", "String", "sequence", "=", "getOption", "(", "optionName", ",", "true", ")", ";", "if", "(", "sequence", "==", "null", "||", "sequence", ".", "length", "(", ")", "==", "0", ")", "return", "null", ";", "IPath", "[", "]", "rules", "=", "null", ";", "char", "[", "]", "[", "]", "patterns", "=", "CharOperation", ".", "splitOn", "(", "'|'", ",", "sequence", ".", "toCharArray", "(", ")", ")", ";", "int", "patternCount", ";", "if", "(", "(", "patternCount", "=", "patterns", ".", "length", ")", ">", "0", ")", "{", "rules", "=", "new", "IPath", "[", "patternCount", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "patterns", ".", "length", ";", "j", "++", ")", "{", "rules", "[", "j", "]", "=", "new", "Path", "(", "new", "String", "(", "patterns", "[", "j", "]", ")", ")", ";", "}", "}", "return", "rules", ";", "}", "public", "IPackageFragmentRoot", "[", "]", "getAllPackageFragmentRoots", "(", ")", "throws", "JavaModelException", "{", "return", "getAllPackageFragmentRoots", "(", "null", ")", ";", "}", "public", "IPackageFragmentRoot", "[", "]", "getAllPackageFragmentRoots", "(", "Map", "rootToResolvedEntries", ")", "throws", "JavaModelException", "{", "return", "computePackageFragmentRoots", "(", "getResolvedClasspath", "(", ")", ",", "true", ",", "rootToResolvedEntries", ")", ";", "}", "public", "IClasspathEntry", "getClasspathEntryFor", "(", "IPath", "path", ")", "throws", "JavaModelException", "{", "getResolvedClasspath", "(", ")", ";", "PerProjectInfo", "perProjectInfo", "=", "getPerProjectInfo", "(", ")", ";", "if", "(", "perProjectInfo", "==", "null", ")", "return", "null", ";", "Map", "rootPathToResolvedEntries", "=", "perProjectInfo", ".", "rootPathToResolvedEntries", ";", "if", "(", "rootPathToResolvedEntries", "==", "null", ")", "return", "null", ";", "IClasspathEntry", "classpathEntry", "=", "(", "IClasspathEntry", ")", "rootPathToResolvedEntries", ".", "get", "(", "path", ")", ";", "if", "(", "classpathEntry", "==", "null", ")", "{", "path", "=", "getProject", "(", ")", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getLocation", "(", ")", ".", "append", "(", "path", ")", ";", "classpathEntry", "=", "(", "IClasspathEntry", ")", "rootPathToResolvedEntries", ".", "get", "(", "path", ")", ";", "}", "return", "classpathEntry", ";", "}", "public", "IMarker", "getCycleMarker", "(", ")", "{", "try", "{", "if", "(", "this", ".", "project", ".", "isAccessible", "(", ")", ")", "{", "IMarker", "[", "]", "markers", "=", "this", ".", "project", ".", "findMarkers", "(", "IJavaModelMarker", ".", "BUILDPATH_PROBLEM_MARKER", ",", "false", ",", "IResource", ".", "DEPTH_ZERO", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "markers", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IMarker", "marker", "=", "markers", "[", "i", "]", ";", "String", "cycleAttr", "=", "(", "String", ")", "marker", ".", "getAttribute", "(", "IJavaModelMarker", ".", "CYCLE_DETECTED", ")", ";", "if", "(", "cycleAttr", "!=", "null", "&&", "cycleAttr", ".", "equals", "(", "\"true\"", ")", ")", "{", "return", "marker", ";", "}", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "return", "null", ";", "}", "public", "IEclipsePreferences", "getEclipsePreferences", "(", ")", "{", "if", "(", "!", "JavaProject", ".", "hasJavaNature", "(", "this", ".", "project", ")", ")", "return", "null", ";", "JavaModelManager", ".", "PerProjectInfo", "perProjectInfo", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getPerProjectInfo", "(", "this", ".", "project", ",", "true", ")", ";", "if", "(", "perProjectInfo", ".", "preferences", "!=", "null", ")", "return", "perProjectInfo", ".", "preferences", ";", "IScopeContext", "context", "=", "new", "ProjectScope", "(", "getProject", "(", ")", ")", ";", "final", "IEclipsePreferences", "eclipsePreferences", "=", "context", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "updatePreferences", "(", "eclipsePreferences", ")", ";", "perProjectInfo", ".", "preferences", "=", "eclipsePreferences", ";", "final", "IEclipsePreferences", "eclipseParentPreferences", "=", "(", "IEclipsePreferences", ")", "eclipsePreferences", ".", "parent", "(", ")", ";", "if", "(", "eclipseParentPreferences", "!=", "null", ")", "{", "if", "(", "this", ".", "preferencesNodeListener", "!=", "null", ")", "{", "eclipseParentPreferences", ".", "removeNodeChangeListener", "(", "this", ".", "preferencesNodeListener", ")", ";", "}", "this", ".", "preferencesNodeListener", "=", "new", "IEclipsePreferences", ".", "INodeChangeListener", "(", ")", "{", "public", "void", "added", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "}", "public", "void", "removed", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "if", "(", "event", ".", "getChild", "(", ")", "==", "eclipsePreferences", ")", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "resetProjectPreferences", "(", "JavaProject", ".", "this", ")", ";", "}", "}", "}", ";", "eclipseParentPreferences", ".", "addNodeChangeListener", "(", "this", ".", "preferencesNodeListener", ")", ";", "}", "if", "(", "this", ".", "preferencesChangeListener", "!=", "null", ")", "{", "eclipsePreferences", ".", "removePreferenceChangeListener", "(", "this", ".", "preferencesChangeListener", ")", ";", "}", "this", ".", "preferencesChangeListener", "=", "new", "IEclipsePreferences", ".", "IPreferenceChangeListener", "(", ")", "{", "public", "void", "preferenceChange", "(", "IEclipsePreferences", ".", "PreferenceChangeEvent", "event", ")", "{", "String", "propertyName", "=", "event", ".", "getKey", "(", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "if", "(", "propertyName", ".", "startsWith", "(", "JavaCore", ".", "PLUGIN_ID", ")", ")", "{", "if", "(", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_RESOURCE_COPY_FILTER", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_DUPLICATE_RESOURCE", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_INVALID_CLASSPATH", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_INCOMPLETE_CLASSPATH", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_CIRCULAR_CLASSPATH", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_INCOMPATIBLE_JDK_LEVEL", ")", ")", "{", "manager", ".", "deltaState", ".", "addClasspathValidation", "(", "JavaProject", ".", "this", ")", ";", "}", "manager", ".", "resetProjectOptions", "(", "JavaProject", ".", "this", ")", ";", "JavaProject", ".", "this", ".", "resetCaches", "(", ")", ";", "}", "}", "}", ";", "eclipsePreferences", ".", "addPreferenceChangeListener", "(", "this", ".", "preferencesChangeListener", ")", ";", "return", "eclipsePreferences", ";", "}", "public", "String", "getElementName", "(", ")", "{", "return", "this", ".", "project", ".", "getName", "(", ")", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "JAVA_PROJECT", ";", "}", "public", "IClasspathEntry", "[", "]", "getExpandedClasspath", "(", ")", "throws", "JavaModelException", "{", "ObjectVector", "accumulatedEntries", "=", "new", "ObjectVector", "(", ")", ";", "computeExpandedClasspath", "(", "null", ",", "new", "HashSet", "(", "5", ")", ",", "accumulatedEntries", ")", ";", "IClasspathEntry", "[", "]", "expandedPath", "=", "new", "IClasspathEntry", "[", "accumulatedEntries", ".", "size", "(", ")", "]", ";", "accumulatedEntries", ".", "copyInto", "(", "expandedPath", ")", ";", "return", "expandedPath", ";", "}", "public", "IPackageFragmentRoot", "getFolderPackageFragmentRoot", "(", "IPath", "path", ")", "{", "if", "(", "path", ".", "segmentCount", "(", ")", "==", "1", ")", "{", "return", "getPackageFragmentRoot", "(", "this", ".", "project", ")", ";", "}", "return", "getPackageFragmentRoot", "(", "this", ".", "project", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getFolder", "(", "path", ")", ")", ";", "}", "public", "IJavaElement", "getHandleFromMemento", "(", "String", "token", ",", "MementoTokenizer", "memento", ",", "WorkingCopyOwner", "owner", ")", "{", "switch", "(", "token", ".", "charAt", "(", "0", ")", ")", "{", "case", "JEM_PACKAGEFRAGMENTROOT", ":", "String", "rootPath", "=", "IPackageFragmentRoot", ".", "DEFAULT_PACKAGEROOT_PATH", ";", "token", "=", "null", ";", "while", "(", "memento", ".", "hasMoreTokens", "(", ")", ")", "{", "token", "=", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "token", "==", "MementoTokenizer", ".", "PACKAGEFRAGMENT", "||", "token", "==", "MementoTokenizer", ".", "COUNT", ")", "{", "break", ";", "}", "rootPath", "+=", "token", ";", "}", "JavaElement", "root", "=", "(", "JavaElement", ")", "getPackageFragmentRoot", "(", "new", "Path", "(", "rootPath", ")", ")", ";", "if", "(", "token", "!=", "null", "&&", "token", ".", "charAt", "(", "0", ")", "==", "JEM_PACKAGEFRAGMENT", ")", "{", "return", "root", ".", "getHandleFromMemento", "(", "token", ",", "memento", ",", "owner", ")", ";", "}", "else", "{", "return", "root", ".", "getHandleFromMemento", "(", "memento", ",", "owner", ")", ";", "}", "}", "return", "null", ";", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JEM_JAVAPROJECT", ";", "}", "private", "int", "getJavaCommandIndex", "(", "ICommand", "[", "]", "buildSpec", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buildSpec", ".", "length", ";", "++", "i", ")", "{", "if", "(", "buildSpec", "[", "i", "]", ".", "getBuilderName", "(", ")", ".", "equals", "(", "JavaCore", ".", "BUILDER_ID", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}", "protected", "JavaProjectElementInfo", "getJavaProjectElementInfo", "(", ")", "throws", "JavaModelException", "{", "return", "(", "JavaProjectElementInfo", ")", "getElementInfo", "(", ")", ";", "}", "public", "Object", "[", "]", "getNonJavaResources", "(", ")", "throws", "JavaModelException", "{", "return", "(", "(", "JavaProjectElementInfo", ")", "getElementInfo", "(", ")", ")", ".", "getNonJavaResources", "(", "this", ")", ";", "}", "public", "String", "getOption", "(", "String", "optionName", ",", "boolean", "inheritJavaCoreOptions", ")", "{", "return", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getOption", "(", "optionName", ",", "inheritJavaCoreOptions", ",", "getEclipsePreferences", "(", ")", ")", ";", "}", "public", "Map", "getOptions", "(", "boolean", "inheritJavaCoreOptions", ")", "{", "Map", "options", "=", "inheritJavaCoreOptions", "?", "JavaCore", ".", "getOptions", "(", ")", ":", "new", "Hashtable", "(", "5", ")", ";", "JavaModelManager", ".", "PerProjectInfo", "perProjectInfo", "=", "null", ";", "Hashtable", "projectOptions", "=", "null", ";", "JavaModelManager", "javaModelManager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "HashSet", "optionNames", "=", "javaModelManager", ".", "optionNames", ";", "try", "{", "perProjectInfo", "=", "getPerProjectInfo", "(", ")", ";", "projectOptions", "=", "perProjectInfo", ".", "options", ";", "if", "(", "projectOptions", "==", "null", ")", "{", "IEclipsePreferences", "projectPreferences", "=", "getEclipsePreferences", "(", ")", ";", "if", "(", "projectPreferences", "==", "null", ")", "return", "options", ";", "String", "[", "]", "propertyNames", "=", "projectPreferences", ".", "keys", "(", ")", ";", "projectOptions", "=", "new", "Hashtable", "(", "propertyNames", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "propertyNames", ".", "length", ";", "i", "++", ")", "{", "String", "propertyName", "=", "propertyNames", "[", "i", "]", ";", "String", "value", "=", "projectPreferences", ".", "get", "(", "propertyName", ",", "null", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "value", "=", "value", ".", "trim", "(", ")", ";", "projectOptions", ".", "put", "(", "propertyName", ",", "value", ")", ";", "if", "(", "!", "optionNames", ".", "contains", "(", "propertyName", ")", ")", "{", "String", "[", "]", "compatibleOptions", "=", "(", "String", "[", "]", ")", "javaModelManager", ".", "deprecatedOptions", ".", "get", "(", "propertyName", ")", ";", "if", "(", "compatibleOptions", "!=", "null", ")", "{", "for", "(", "int", "co", "=", "0", ",", "length", "=", "compatibleOptions", ".", "length", ";", "co", "<", "length", ";", "co", "++", ")", "{", "String", "compatibleOption", "=", "compatibleOptions", "[", "co", "]", ";", "if", "(", "!", "projectOptions", ".", "containsKey", "(", "compatibleOption", ")", ")", "projectOptions", ".", "put", "(", "compatibleOption", ",", "value", ")", ";", "}", "}", "}", "}", "}", "perProjectInfo", ".", "options", "=", "projectOptions", ";", "}", "}", "catch", "(", "JavaModelException", "jme", ")", "{", "projectOptions", "=", "new", "Hashtable", "(", ")", ";", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "projectOptions", "=", "new", "Hashtable", "(", ")", ";", "}", "if", "(", "inheritJavaCoreOptions", ")", "{", "Iterator", "propertyNames", "=", "projectOptions", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "propertyNames", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "propertyNames", ".", "next", "(", ")", ";", "String", "propertyName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "String", "propertyValue", "=", "(", "String", ")", "entry", ".", "getValue", "(", ")", ";", "if", "(", "propertyValue", "!=", "null", "&&", "javaModelManager", ".", "knowsOption", "(", "propertyName", ")", ")", "{", "options", ".", "put", "(", "propertyName", ",", "propertyValue", ".", "trim", "(", ")", ")", ";", "}", "}", "Util", ".", "fixTaskTags", "(", "options", ")", ";", "return", "options", ";", "}", "Util", ".", "fixTaskTags", "(", "projectOptions", ")", ";", "return", "projectOptions", ";", "}", "public", "IPath", "getOutputLocation", "(", ")", "throws", "JavaModelException", "{", "JavaModelManager", ".", "PerProjectInfo", "perProjectInfo", "=", "getPerProjectInfo", "(", ")", ";", "IPath", "outputLocation", "=", "perProjectInfo", ".", "outputLocation", ";", "if", "(", "outputLocation", "!=", "null", ")", "return", "outputLocation", ";", "getRawClasspath", "(", ")", ";", "outputLocation", "=", "perProjectInfo", ".", "outputLocation", ";", "if", "(", "outputLocation", "==", "null", ")", "{", "return", "defaultOutputLocation", "(", ")", ";", "}", "return", "outputLocation", ";", "}", "public", "IPackageFragmentRoot", "getPackageFragmentRoot", "(", "IPath", "path", ")", "{", "if", "(", "!", "path", ".", "isAbsolute", "(", ")", ")", "{", "path", "=", "getPath", "(", ")", ".", "append", "(", "path", ")", ";", "}", "int", "segmentCount", "=", "path", ".", "segmentCount", "(", ")", ";", "if", "(", "segmentCount", "==", "0", ")", "{", "return", "null", ";", "}", "if", "(", "path", ".", "getDevice", "(", ")", "!=", "null", "||", "JavaModel", ".", "getExternalTarget", "(", "path", ",", "true", ")", "!=", "null", ")", "{", "return", "getPackageFragmentRoot0", "(", "path", ")", ";", "}", "IWorkspaceRoot", "workspaceRoot", "=", "this", ".", "project", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "IResource", "resource", "=", "workspaceRoot", ".", "findMember", "(", "path", ")", ";", "if", "(", "resource", "==", "null", ")", "{", "if", "(", "path", ".", "getFileExtension", "(", ")", "!=", "null", ")", "{", "if", "(", "!", "workspaceRoot", ".", "getProject", "(", "path", ".", "segment", "(", "0", ")", ")", ".", "exists", "(", ")", ")", "{", "return", "getPackageFragmentRoot0", "(", "path", ")", ";", "}", "else", "{", "resource", "=", "workspaceRoot", ".", "getFile", "(", "path", ")", ";", "}", "}", "else", "if", "(", "segmentCount", "==", "1", ")", "{", "String", "projectName", "=", "path", ".", "segment", "(", "0", ")", ";", "if", "(", "getElementName", "(", ")", ".", "equals", "(", "projectName", ")", ")", "{", "resource", "=", "this", ".", "project", ";", "}", "else", "{", "resource", "=", "workspaceRoot", ".", "getProject", "(", "projectName", ")", ";", "}", "}", "else", "{", "resource", "=", "workspaceRoot", ".", "getFolder", "(", "path", ")", ";", "}", "}", "return", "getPackageFragmentRoot", "(", "resource", ")", ";", "}", "public", "IPackageFragmentRoot", "getPackageFragmentRoot", "(", "IResource", "resource", ")", "{", "return", "getPackageFragmentRoot", "(", "resource", ",", "null", ")", ";", "}", "private", "IPackageFragmentRoot", "getPackageFragmentRoot", "(", "IResource", "resource", ",", "IPath", "entryPath", ")", "{", "switch", "(", "resource", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "FILE", ":", "return", "new", "JarPackageFragmentRoot", "(", "resource", ",", "this", ")", ";", "case", "IResource", ".", "FOLDER", ":", "if", "(", "ExternalFoldersManager", ".", "isInternalPathForExternalFolder", "(", "resource", ".", "getFullPath", "(", ")", ")", ")", "return", "new", "ExternalPackageFragmentRoot", "(", "resource", ",", "entryPath", ",", "this", ")", ";", "return", "new", "PackageFragmentRoot", "(", "resource", ",", "this", ")", ";", "case", "IResource", ".", "PROJECT", ":", "return", "new", "PackageFragmentRoot", "(", "resource", ",", "this", ")", ";", "default", ":", "return", "null", ";", "}", "}", "public", "IPackageFragmentRoot", "getPackageFragmentRoot", "(", "String", "externalLibraryPath", ")", "{", "return", "getPackageFragmentRoot0", "(", "JavaProject", ".", "canonicalizedPath", "(", "new", "Path", "(", "externalLibraryPath", ")", ")", ")", ";", "}", "public", "IPackageFragmentRoot", "getPackageFragmentRoot0", "(", "IPath", "externalLibraryPath", ")", "{", "IFolder", "linkedFolder", "=", "JavaModelManager", ".", "getExternalManager", "(", ")", ".", "getFolder", "(", "externalLibraryPath", ")", ";", "if", "(", "linkedFolder", "!=", "null", ")", "return", "new", "ExternalPackageFragmentRoot", "(", "linkedFolder", ",", "externalLibraryPath", ",", "this", ")", ";", "return", "new", "JarPackageFragmentRoot", "(", "externalLibraryPath", ",", "this", ")", ";", "}", "public", "IPackageFragmentRoot", "[", "]", "getPackageFragmentRoots", "(", ")", "throws", "JavaModelException", "{", "Object", "[", "]", "children", ";", "int", "length", ";", "IPackageFragmentRoot", "[", "]", "roots", ";", "System", ".", "arraycopy", "(", "children", "=", "getChildren", "(", ")", ",", "0", ",", "roots", "=", "new", "IPackageFragmentRoot", "[", "length", "=", "children", ".", "length", "]", ",", "0", ",", "length", ")", ";", "return", "roots", ";", "}", "public", "IPackageFragmentRoot", "[", "]", "getPackageFragmentRoots", "(", "IClasspathEntry", "entry", ")", "{", "return", "findPackageFragmentRoots", "(", "entry", ")", ";", "}", "public", "IPackageFragment", "[", "]", "getPackageFragments", "(", ")", "throws", "JavaModelException", "{", "IPackageFragmentRoot", "[", "]", "roots", "=", "getPackageFragmentRoots", "(", ")", ";", "return", "getPackageFragmentsInRoots", "(", "roots", ")", ";", "}", "public", "IPackageFragment", "[", "]", "getPackageFragmentsInRoots", "(", "IPackageFragmentRoot", "[", "]", "roots", ")", "{", "ArrayList", "frags", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "roots", ".", "length", ";", "i", "++", ")", "{", "IPackageFragmentRoot", "root", "=", "roots", "[", "i", "]", ";", "try", "{", "IJavaElement", "[", "]", "rootFragments", "=", "root", ".", "getChildren", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "rootFragments", ".", "length", ";", "j", "++", ")", "{", "frags", ".", "add", "(", "rootFragments", "[", "j", "]", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "IPackageFragment", "[", "]", "fragments", "=", "new", "IPackageFragment", "[", "frags", ".", "size", "(", ")", "]", ";", "frags", ".", "toArray", "(", "fragments", ")", ";", "return", "fragments", ";", "}", "public", "IPath", "getPath", "(", ")", "{", "return", "this", ".", "project", ".", "getFullPath", "(", ")", ";", "}", "public", "JavaModelManager", ".", "PerProjectInfo", "getPerProjectInfo", "(", ")", "throws", "JavaModelException", "{", "return", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getPerProjectInfoCheckExistence", "(", "this", ".", "project", ")", ";", "}", "private", "IPath", "getPluginWorkingLocation", "(", ")", "{", "return", "this", ".", "project", ".", "getWorkingLocation", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "}", "public", "IProject", "getProject", "(", ")", "{", "return", "this", ".", "project", ";", "}", "public", "ProjectCache", "getProjectCache", "(", ")", "throws", "JavaModelException", "{", "return", "(", "(", "JavaProjectElementInfo", ")", "getElementInfo", "(", ")", ")", ".", "getProjectCache", "(", "this", ")", ";", "}", "public", "IClasspathEntry", "[", "]", "getRawClasspath", "(", ")", "throws", "JavaModelException", "{", "JavaModelManager", ".", "PerProjectInfo", "perProjectInfo", "=", "getPerProjectInfo", "(", ")", ";", "IClasspathEntry", "[", "]", "classpath", "=", "perProjectInfo", ".", "rawClasspath", ";", "if", "(", "classpath", "!=", "null", ")", "return", "classpath", ";", "classpath", "=", "perProjectInfo", ".", "readAndCacheClasspath", "(", "this", ")", "[", "0", "]", ";", "if", "(", "classpath", "==", "JavaProject", ".", "INVALID_CLASSPATH", ")", "return", "defaultClasspath", "(", ")", ";", "return", "classpath", ";", "}", "public", "IClasspathEntry", "[", "]", "getReferencedClasspathEntries", "(", ")", "throws", "JavaModelException", "{", "return", "getPerProjectInfo", "(", ")", ".", "referencedEntries", ";", "}", "public", "String", "[", "]", "getRequiredProjectNames", "(", ")", "throws", "JavaModelException", "{", "return", "projectPrerequisites", "(", "getResolvedClasspath", "(", ")", ")", ";", "}", "public", "IClasspathEntry", "[", "]", "getResolvedClasspath", "(", ")", "throws", "JavaModelException", "{", "PerProjectInfo", "perProjectInfo", "=", "getPerProjectInfo", "(", ")", ";", "IClasspathEntry", "[", "]", "resolvedClasspath", "=", "perProjectInfo", ".", "getResolvedClasspath", "(", ")", ";", "if", "(", "resolvedClasspath", "==", "null", ")", "{", "resolveClasspath", "(", "perProjectInfo", ",", "false", ",", "true", ")", ";", "resolvedClasspath", "=", "perProjectInfo", ".", "getResolvedClasspath", "(", ")", ";", "if", "(", "resolvedClasspath", "==", "null", ")", "{", "PerProjectInfo", "temporaryInfo", "=", "newTemporaryInfo", "(", ")", ";", "resolveClasspath", "(", "temporaryInfo", ",", "false", ",", "true", ")", ";", "resolvedClasspath", "=", "temporaryInfo", ".", "getResolvedClasspath", "(", ")", ";", "}", "}", "return", "resolvedClasspath", ";", "}", "public", "IClasspathEntry", "[", "]", "getResolvedClasspath", "(", "boolean", "ignoreUnresolvedEntry", ")", "throws", "JavaModelException", "{", "if", "(", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "isClasspathBeingResolved", "(", "this", ")", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_ADVANCED", ")", "verbose_reentering_classpath_resolution", "(", ")", ";", "return", "RESOLUTION_IN_PROGRESS", ";", "}", "PerProjectInfo", "perProjectInfo", "=", "getPerProjectInfo", "(", ")", ";", "IClasspathEntry", "[", "]", "resolvedClasspath", ";", "IJavaModelStatus", "unresolvedEntryStatus", ";", "synchronized", "(", "perProjectInfo", ")", "{", "resolvedClasspath", "=", "perProjectInfo", ".", "getResolvedClasspath", "(", ")", ";", "unresolvedEntryStatus", "=", "perProjectInfo", ".", "unresolvedEntryStatus", ";", "}", "if", "(", "resolvedClasspath", "==", "null", "||", "(", "unresolvedEntryStatus", "!=", "null", "&&", "!", "unresolvedEntryStatus", ".", "isOK", "(", ")", ")", ")", "{", "resolveClasspath", "(", "perProjectInfo", ",", "false", ",", "true", ")", ";", "synchronized", "(", "perProjectInfo", ")", "{", "resolvedClasspath", "=", "perProjectInfo", ".", "getResolvedClasspath", "(", ")", ";", "unresolvedEntryStatus", "=", "perProjectInfo", ".", "unresolvedEntryStatus", ";", "}", "if", "(", "resolvedClasspath", "==", "null", ")", "{", "PerProjectInfo", "temporaryInfo", "=", "newTemporaryInfo", "(", ")", ";", "resolveClasspath", "(", "temporaryInfo", ",", "false", ",", "true", ")", ";", "resolvedClasspath", "=", "temporaryInfo", ".", "getResolvedClasspath", "(", ")", ";", "unresolvedEntryStatus", "=", "temporaryInfo", ".", "unresolvedEntryStatus", ";", "}", "}", "if", "(", "!", "ignoreUnresolvedEntry", "&&", "unresolvedEntryStatus", "!=", "null", "&&", "!", "unresolvedEntryStatus", ".", "isOK", "(", ")", ")", "throw", "new", "JavaModelException", "(", "unresolvedEntryStatus", ")", ";", "return", "resolvedClasspath", ";", "}", "private", "void", "verbose_reentering_classpath_resolution", "(", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", ")", ";", "new", "Exception", "(", "\"\"", ")", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "public", "IResource", "resource", "(", "PackageFragmentRoot", "root", ")", "{", "return", "this", ".", "project", ";", "}", "public", "String", "getSharedProperty", "(", "String", "key", ")", "throws", "CoreException", "{", "String", "property", "=", "null", ";", "IFile", "rscFile", "=", "this", ".", "project", ".", "getFile", "(", "key", ")", ";", "if", "(", "rscFile", ".", "exists", "(", ")", ")", "{", "byte", "[", "]", "bytes", "=", "Util", ".", "getResourceContentsAsByteArray", "(", "rscFile", ")", ";", "try", "{", "property", "=", "new", "String", "(", "bytes", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "UTF_8", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "property", "=", "new", "String", "(", "bytes", ")", ";", "}", "}", "else", "{", "URI", "location", "=", "rscFile", ".", "getLocationURI", "(", ")", ";", "if", "(", "location", "!=", "null", ")", "{", "File", "file", "=", "Util", ".", "toLocalFile", "(", "location", ",", "null", ")", ";", "if", "(", "file", "!=", "null", "&&", "file", ".", "exists", "(", ")", ")", "{", "byte", "[", "]", "bytes", ";", "try", "{", "bytes", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "getFileByteContent", "(", "file", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "try", "{", "property", "=", "new", "String", "(", "bytes", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "UTF_8", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "property", "=", "new", "String", "(", "bytes", ")", ";", "}", "}", "}", "}", "return", "property", ";", "}", "public", "SourceMapper", "getSourceMapper", "(", ")", "{", "return", "null", ";", "}", "public", "IResource", "getUnderlyingResource", "(", ")", "throws", "JavaModelException", "{", "if", "(", "!", "exists", "(", ")", ")", "throw", "newNotPresentException", "(", ")", ";", "return", "this", ".", "project", ";", "}", "public", "boolean", "hasBuildState", "(", ")", "{", "return", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getLastBuiltState", "(", "this", ".", "project", ",", "null", ")", "!=", "null", ";", "}", "public", "boolean", "hasClasspathCycle", "(", "IClasspathEntry", "[", "]", "preferredClasspath", ")", "{", "LinkedHashSet", "cycleParticipants", "=", "new", "LinkedHashSet", "(", ")", ";", "HashMap", "preferredClasspaths", "=", "new", "HashMap", "(", "1", ")", ";", "preferredClasspaths", ".", "put", "(", "this", ",", "preferredClasspath", ")", ";", "updateCycleParticipants", "(", "new", "ArrayList", "(", "2", ")", ",", "cycleParticipants", ",", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ",", "new", "HashSet", "(", "2", ")", ",", "preferredClasspaths", ")", ";", "return", "!", "cycleParticipants", ".", "isEmpty", "(", ")", ";", "}", "public", "boolean", "hasCycleMarker", "(", ")", "{", "return", "getCycleMarker", "(", ")", "!=", "null", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "this", ".", "project", ".", "hashCode", "(", ")", ";", "}", "private", "boolean", "hasUTF8BOM", "(", "byte", "[", "]", "bytes", ")", "{", "if", "(", "bytes", ".", "length", ">", "IContentDescription", ".", "BOM_UTF_8", ".", "length", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "IContentDescription", ".", "BOM_UTF_8", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "IContentDescription", ".", "BOM_UTF_8", "[", "i", "]", "!=", "bytes", "[", "i", "]", ")", "return", "false", ";", "}", "return", "true", ";", "}", "return", "false", ";", "}", "public", "boolean", "hasSource", "(", ")", "{", "IClasspathEntry", "[", "]", "entries", ";", "try", "{", "entries", "=", "getRawClasspath", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "true", ";", "}", "for", "(", "int", "i", "=", "0", ",", "max", "=", "entries", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "entries", "[", "i", "]", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_SOURCE", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "boolean", "isOnClasspath", "(", "IJavaElement", "element", ")", "{", "IClasspathEntry", "[", "]", "rawClasspath", ";", "try", "{", "rawClasspath", "=", "getRawClasspath", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "int", "elementType", "=", "element", ".", "getElementType", "(", ")", ";", "boolean", "isPackageFragmentRoot", "=", "false", ";", "boolean", "isFolderPath", "=", "false", ";", "boolean", "isSource", "=", "false", ";", "switch", "(", "elementType", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "return", "false", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "isPackageFragmentRoot", "=", "true", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "isFolderPath", "=", "!", "(", "(", "IPackageFragmentRoot", ")", "element", ".", "getParent", "(", ")", ")", ".", "isArchive", "(", ")", ";", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "isSource", "=", "true", ";", "break", ";", "default", ":", "isSource", "=", "element", ".", "getAncestor", "(", "IJavaElement", ".", "COMPILATION_UNIT", ")", "!=", "null", ";", "break", ";", "}", "IPath", "elementPath", "=", "element", ".", "getPath", "(", ")", ";", "int", "length", "=", "rawClasspath", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "rawClasspath", "[", "i", "]", ";", "switch", "(", "entry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "if", "(", "isOnClasspathEntry", "(", "elementPath", ",", "isFolderPath", ",", "isPackageFragmentRoot", ",", "entry", ")", ")", "return", "true", ";", "break", ";", "}", "}", "if", "(", "isSource", ")", "return", "false", ";", "IClasspathEntry", "[", "]", "resolvedClasspath", "=", "null", ";", "try", "{", "resolvedClasspath", "=", "getResolvedClasspath", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "for", "(", "int", "index", "=", "0", ";", "index", "<", "resolvedClasspath", ".", "length", ";", "index", "++", ")", "{", "if", "(", "isOnClasspathEntry", "(", "elementPath", ",", "isFolderPath", ",", "isPackageFragmentRoot", ",", "resolvedClasspath", "[", "index", "]", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "public", "boolean", "isOnClasspath", "(", "IResource", "resource", ")", "{", "IPath", "exactPath", "=", "resource", ".", "getFullPath", "(", ")", ";", "IPath", "path", "=", "exactPath", ";", "int", "resourceType", "=", "resource", ".", "getType", "(", ")", ";", "boolean", "isFolderPath", "=", "resourceType", "==", "IResource", ".", "FOLDER", "||", "resourceType", "==", "IResource", ".", "PROJECT", ";", "IClasspathEntry", "[", "]", "classpath", ";", "try", "{", "classpath", "=", "this", ".", "getResolvedClasspath", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "classpath", ".", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "i", "]", ";", "IPath", "entryPath", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "entryPath", ".", "equals", "(", "exactPath", ")", ")", "{", "return", "true", ";", "}", "if", "(", "entryPath", ".", "isAbsolute", "(", ")", "&&", "entryPath", ".", "equals", "(", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getLocation", "(", ")", ".", "append", "(", "exactPath", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "entryPath", ".", "isPrefixOf", "(", "path", ")", "&&", "!", "Util", ".", "isExcluded", "(", "path", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullInclusionPatternChars", "(", ")", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullExclusionPatternChars", "(", ")", ",", "isFolderPath", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "private", "boolean", "isOnClasspathEntry", "(", "IPath", "elementPath", ",", "boolean", "isFolderPath", ",", "boolean", "isPackageFragmentRoot", ",", "IClasspathEntry", "entry", ")", "{", "IPath", "entryPath", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "isPackageFragmentRoot", ")", "{", "if", "(", "entryPath", ".", "equals", "(", "elementPath", ")", ")", "return", "true", ";", "}", "else", "{", "if", "(", "entryPath", ".", "isPrefixOf", "(", "elementPath", ")", "&&", "!", "Util", ".", "isExcluded", "(", "elementPath", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullInclusionPatternChars", "(", ")", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullExclusionPatternChars", "(", ")", ",", "isFolderPath", ")", ")", "return", "true", ";", "}", "if", "(", "entryPath", ".", "isAbsolute", "(", ")", "&&", "entryPath", ".", "equals", "(", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getLocation", "(", ")", ".", "append", "(", "elementPath", ")", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}", "private", "IEclipsePreferences", "loadPreferences", "(", ")", "{", "IEclipsePreferences", "preferences", "=", "null", ";", "IPath", "projectMetaLocation", "=", "getPluginWorkingLocation", "(", ")", ";", "if", "(", "projectMetaLocation", "!=", "null", ")", "{", "File", "prefFile", "=", "projectMetaLocation", ".", "append", "(", "PREF_FILENAME", ")", ".", "toFile", "(", ")", ";", "if", "(", "prefFile", ".", "exists", "(", ")", ")", "{", "InputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "prefFile", ")", ")", ";", "preferences", "=", "Platform", ".", "getPreferencesService", "(", ")", ".", "readPreferences", "(", "in", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "catch", "(", "IOException", "e", ")", "{", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "try", "{", "in", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "prefFile", ".", "delete", "(", ")", ";", "return", "preferences", ";", "}", "}", "return", "null", ";", "}", "public", "IEvaluationContext", "newEvaluationContext", "(", ")", "{", "EvaluationContext", "context", "=", "new", "EvaluationContext", "(", ")", ";", "context", ".", "setLineSeparator", "(", "Util", ".", "getLineSeparator", "(", "null", ",", "this", ")", ")", ";", "return", "new", "EvaluationContextWrapper", "(", "context", ",", "this", ")", ";", "}", "public", "NameLookup", "newNameLookup", "(", "ICompilationUnit", "[", "]", "workingCopies", ")", "throws", "JavaModelException", "{", "return", "getJavaProjectElementInfo", "(", ")", ".", "newNameLookup", "(", "this", ",", "workingCopies", ")", ";", "}", "public", "NameLookup", "newNameLookup", "(", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "ICompilationUnit", "[", "]", "workingCopies", "=", "owner", "==", "null", "?", "null", ":", "manager", ".", "getWorkingCopies", "(", "owner", ",", "true", ")", ";", "return", "newNameLookup", "(", "workingCopies", ")", ";", "}", "public", "SearchableEnvironment", "newSearchableNameEnvironment", "(", "ICompilationUnit", "[", "]", "workingCopies", ")", "throws", "JavaModelException", "{", "return", "new", "SearchableEnvironment", "(", "this", ",", "workingCopies", ")", ";", "}", "public", "SearchableEnvironment", "newSearchableNameEnvironment", "(", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "return", "new", "SearchableEnvironment", "(", "this", ",", "owner", ")", ";", "}", "public", "PerProjectInfo", "newTemporaryInfo", "(", ")", "{", "return", "new", "PerProjectInfo", "(", "this", ".", "project", ".", "getProject", "(", ")", ")", "{", "protected", "ClasspathChange", "addClasspathChange", "(", ")", "{", "return", "null", ";", "}", "}", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "IRegion", "region", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "newTypeHierarchy", "(", "region", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "monitor", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "IRegion", "region", ",", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "region", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "hierarchy_nullRegion", ")", ";", "}", "ICompilationUnit", "[", "]", "workingCopies", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkingCopies", "(", "owner", ",", "true", ")", ";", "CreateTypeHierarchyOperation", "op", "=", "new", "CreateTypeHierarchyOperation", "(", "region", ",", "workingCopies", ",", "null", ",", "true", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "op", ".", "getResult", "(", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "IType", "type", ",", "IRegion", "region", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "newTypeHierarchy", "(", "type", ",", "region", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "monitor", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "IType", "type", ",", "IRegion", "region", ",", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "hierarchy_nullFocusType", ")", ";", "}", "if", "(", "region", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "hierarchy_nullRegion", ")", ";", "}", "ICompilationUnit", "[", "]", "workingCopies", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkingCopies", "(", "owner", ",", "true", ")", ";", "CreateTypeHierarchyOperation", "op", "=", "new", "CreateTypeHierarchyOperation", "(", "region", ",", "workingCopies", ",", "type", ",", "true", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "op", ".", "getResult", "(", ")", ";", "}", "public", "String", "[", "]", "projectPrerequisites", "(", "IClasspathEntry", "[", "]", "resolvedClasspath", ")", "throws", "JavaModelException", "{", "ArrayList", "prerequisites", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "resolvedClasspath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "resolvedClasspath", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_PROJECT", ")", "{", "prerequisites", ".", "add", "(", "entry", ".", "getPath", "(", ")", ".", "lastSegment", "(", ")", ")", ";", "}", "}", "int", "size", "=", "prerequisites", ".", "size", "(", ")", ";", "if", "(", "size", "==", "0", ")", "{", "return", "NO_PREREQUISITES", ";", "}", "else", "{", "String", "[", "]", "result", "=", "new", "String", "[", "size", "]", ";", "prerequisites", ".", "toArray", "(", "result", ")", ";", "return", "result", ";", "}", "}", "public", "IClasspathEntry", "[", "]", "[", "]", "readFileEntriesWithException", "(", "Map", "unknownElements", ")", "throws", "CoreException", ",", "IOException", ",", "ClasspathEntry", ".", "AssertionFailedException", "{", "IFile", "rscFile", "=", "this", ".", "project", ".", "getFile", "(", "JavaProject", ".", "CLASSPATH_FILENAME", ")", ";", "byte", "[", "]", "bytes", ";", "if", "(", "rscFile", ".", "exists", "(", ")", ")", "{", "bytes", "=", "Util", ".", "getResourceContentsAsByteArray", "(", "rscFile", ")", ";", "}", "else", "{", "URI", "location", "=", "rscFile", ".", "getLocationURI", "(", ")", ";", "if", "(", "location", "==", "null", ")", "throw", "new", "IOException", "(", "\"\"", "+", "rscFile", ")", ";", "File", "file", "=", "Util", ".", "toLocalFile", "(", "location", ",", "null", ")", ";", "if", "(", "file", "==", "null", ")", "throw", "new", "IOException", "(", "\"\"", "+", "location", ")", ";", "try", "{", "bytes", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "getFileByteContent", "(", "file", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "return", "new", "IClasspathEntry", "[", "]", "[", "]", "{", "defaultClasspath", "(", ")", ",", "ClasspathEntry", ".", "NO_ENTRIES", "}", ";", "throw", "e", ";", "}", "}", "if", "(", "hasUTF8BOM", "(", "bytes", ")", ")", "{", "int", "length", "=", "bytes", ".", "length", "-", "IContentDescription", ".", "BOM_UTF_8", ".", "length", ";", "System", ".", "arraycopy", "(", "bytes", ",", "IContentDescription", ".", "BOM_UTF_8", ".", "length", ",", "bytes", "=", "new", "byte", "[", "length", "]", ",", "0", ",", "length", ")", ";", "}", "String", "xmlClasspath", ";", "try", "{", "xmlClasspath", "=", "new", "String", "(", "bytes", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "UTF_8", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "xmlClasspath", "=", "new", "String", "(", "bytes", ")", ";", "}", "return", "decodeClasspath", "(", "xmlClasspath", ",", "unknownElements", ")", ";", "}", "private", "IClasspathEntry", "[", "]", "[", "]", "readFileEntries", "(", "Map", "unkwownElements", ")", "{", "try", "{", "return", "readFileEntriesWithException", "(", "unkwownElements", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", "+", "getPath", "(", ")", ".", "append", "(", "JavaProject", ".", "CLASSPATH_FILENAME", ")", ")", ";", "return", "new", "IClasspathEntry", "[", "]", "[", "]", "{", "JavaProject", ".", "INVALID_CLASSPATH", ",", "ClasspathEntry", ".", "NO_ENTRIES", "}", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", "+", "getPath", "(", ")", ".", "append", "(", "JavaProject", ".", "CLASSPATH_FILENAME", ")", ")", ";", "return", "new", "IClasspathEntry", "[", "]", "[", "]", "{", "JavaProject", ".", "INVALID_CLASSPATH", ",", "ClasspathEntry", ".", "NO_ENTRIES", "}", ";", "}", "catch", "(", "ClasspathEntry", ".", "AssertionFailedException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", "+", "getPath", "(", ")", ".", "append", "(", "JavaProject", ".", "CLASSPATH_FILENAME", ")", ")", ";", "return", "new", "IClasspathEntry", "[", "]", "[", "]", "{", "JavaProject", ".", "INVALID_CLASSPATH", ",", "ClasspathEntry", ".", "NO_ENTRIES", "}", ";", "}", "}", "public", "IPath", "readOutputLocation", "(", ")", "{", "IClasspathEntry", "[", "]", "[", "]", "classpath", "=", "readFileEntries", "(", "null", ")", ";", "if", "(", "classpath", "[", "0", "]", "==", "JavaProject", ".", "INVALID_CLASSPATH", ")", "return", "defaultOutputLocation", "(", ")", ";", "IPath", "outputLocation", "=", "null", ";", "if", "(", "classpath", "[", "0", "]", ".", "length", ">", "0", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "0", "]", "[", "classpath", "[", "0", "]", ".", "length", "-", "1", "]", ";", "if", "(", "entry", ".", "getContentKind", "(", ")", "==", "ClasspathEntry", ".", "K_OUTPUT", ")", "{", "outputLocation", "=", "entry", ".", "getPath", "(", ")", ";", "}", "}", "return", "outputLocation", ";", "}", "public", "IClasspathEntry", "[", "]", "readRawClasspath", "(", ")", "{", "IClasspathEntry", "[", "]", "[", "]", "classpath", "=", "readFileEntries", "(", "null", ")", ";", "if", "(", "classpath", "[", "0", "]", "==", "JavaProject", ".", "INVALID_CLASSPATH", ")", "return", "defaultClasspath", "(", ")", ";", "if", "(", "classpath", "[", "0", "]", ".", "length", ">", "0", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "0", "]", "[", "classpath", "[", "0", "]", ".", "length", "-", "1", "]", ";", "if", "(", "entry", ".", "getContentKind", "(", ")", "==", "ClasspathEntry", ".", "K_OUTPUT", ")", "{", "IClasspathEntry", "[", "]", "copy", "=", "new", "IClasspathEntry", "[", "classpath", "[", "0", "]", ".", "length", "-", "1", "]", ";", "System", ".", "arraycopy", "(", "classpath", "[", "0", "]", ",", "0", ",", "copy", ",", "0", ",", "copy", ".", "length", ")", ";", "classpath", "[", "0", "]", "=", "copy", ";", "}", "}", "return", "classpath", "[", "0", "]", ";", "}", "protected", "void", "removeFromBuildSpec", "(", "String", "builderID", ")", "throws", "CoreException", "{", "IProjectDescription", "description", "=", "this", ".", "project", ".", "getDescription", "(", ")", ";", "ICommand", "[", "]", "commands", "=", "description", ".", "getBuildSpec", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "commands", ".", "length", ";", "++", "i", ")", "{", "if", "(", "commands", "[", "i", "]", ".", "getBuilderName", "(", ")", ".", "equals", "(", "builderID", ")", ")", "{", "ICommand", "[", "]", "newCommands", "=", "new", "ICommand", "[", "commands", ".", "length", "-", "1", "]", ";", "System", ".", "arraycopy", "(", "commands", ",", "0", ",", "newCommands", ",", "0", ",", "i", ")", ";", "System", ".", "arraycopy", "(", "commands", ",", "i", "+", "1", ",", "newCommands", ",", "i", ",", "commands", ".", "length", "-", "i", "-", "1", ")", ";", "description", ".", "setBuildSpec", "(", "newCommands", ")", ";", "this", ".", "project", ".", "setDescription", "(", "description", ",", "null", ")", ";", "return", ";", "}", "}", "}", "public", "void", "resetCaches", "(", ")", "{", "JavaProjectElementInfo", "info", "=", "(", "JavaProjectElementInfo", ")", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "peekAtInfo", "(", "this", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "info", ".", "resetCaches", "(", ")", ";", "}", "}", "public", "ClasspathChange", "resetResolvedClasspath", "(", ")", "{", "try", "{", "return", "getPerProjectInfo", "(", ")", ".", "resetResolvedClasspath", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "IClasspathEntry", "[", "]", "resolveClasspath", "(", "IClasspathEntry", "[", "]", "rawClasspath", ")", "throws", "JavaModelException", "{", "return", "resolveClasspath", "(", "rawClasspath", ",", "false", ",", "true", ")", ".", "resolvedClasspath", ";", "}", "static", "class", "ResolvedClasspath", "{", "IClasspathEntry", "[", "]", "resolvedClasspath", ";", "IJavaModelStatus", "unresolvedEntryStatus", "=", "JavaModelStatus", ".", "VERIFIED_OK", ";", "HashMap", "rawReverseMap", "=", "new", "HashMap", "(", ")", ";", "Map", "rootPathToResolvedEntries", "=", "new", "HashMap", "(", ")", ";", "IClasspathEntry", "[", "]", "referencedEntries", "=", "null", ";", "}", "public", "ResolvedClasspath", "resolveClasspath", "(", "IClasspathEntry", "[", "]", "rawClasspath", ",", "boolean", "usePreviousSession", ",", "boolean", "resolveChainedLibraries", ")", "throws", "JavaModelException", "{", "return", "resolveClasspath", "(", "rawClasspath", ",", "null", ",", "usePreviousSession", ",", "resolveChainedLibraries", ")", ";", "}", "public", "ResolvedClasspath", "resolveClasspath", "(", "IClasspathEntry", "[", "]", "rawClasspath", ",", "IClasspathEntry", "[", "]", "referencedEntries", ",", "boolean", "usePreviousSession", ",", "boolean", "resolveChainedLibraries", ")", "throws", "JavaModelException", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "ExternalFoldersManager", "externalFoldersManager", "=", "JavaModelManager", ".", "getExternalManager", "(", ")", ";", "ResolvedClasspath", "result", "=", "new", "ResolvedClasspath", "(", ")", ";", "Map", "knownDrives", "=", "new", "HashMap", "(", ")", ";", "Map", "referencedEntriesMap", "=", "new", "HashMap", "(", ")", ";", "List", "rawLibrariesPath", "=", "new", "ArrayList", "(", ")", ";", "LinkedHashSet", "resolvedEntries", "=", "new", "LinkedHashSet", "(", ")", ";", "if", "(", "resolveChainedLibraries", ")", "{", "for", "(", "int", "index", "=", "0", ";", "index", "<", "rawClasspath", ".", "length", ";", "index", "++", ")", "{", "IClasspathEntry", "currentEntry", "=", "rawClasspath", "[", "index", "]", ";", "if", "(", "currentEntry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "rawLibrariesPath", ".", "add", "(", "ClasspathEntry", ".", "resolveDotDot", "(", "getProject", "(", ")", ".", "getLocation", "(", ")", ",", "currentEntry", ".", "getPath", "(", ")", ")", ")", ";", "}", "}", "if", "(", "referencedEntries", "!=", "null", ")", "{", "LinkedHashSet", "referencedEntriesSet", "=", "new", "LinkedHashSet", "(", ")", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "referencedEntries", ".", "length", ";", "index", "++", ")", "{", "IPath", "path", "=", "referencedEntries", "[", "index", "]", ".", "getPath", "(", ")", ";", "if", "(", "!", "rawLibrariesPath", ".", "contains", "(", "path", ")", "&&", "referencedEntriesMap", ".", "get", "(", "path", ")", "==", "null", ")", "{", "referencedEntriesMap", ".", "put", "(", "path", ",", "referencedEntries", "[", "index", "]", ")", ";", "referencedEntriesSet", ".", "add", "(", "referencedEntries", "[", "index", "]", ")", ";", "}", "}", "if", "(", "referencedEntriesSet", ".", "size", "(", ")", ">", "0", ")", "{", "result", ".", "referencedEntries", "=", "new", "IClasspathEntry", "[", "referencedEntriesSet", ".", "size", "(", ")", "]", ";", "referencedEntriesSet", ".", "toArray", "(", "result", ".", "referencedEntries", ")", ";", "}", "}", "}", "int", "length", "=", "rawClasspath", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "rawEntry", "=", "rawClasspath", "[", "i", "]", ";", "IClasspathEntry", "resolvedEntry", "=", "rawEntry", ";", "switch", "(", "rawEntry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_VARIABLE", ":", "try", "{", "resolvedEntry", "=", "manager", ".", "resolveVariableEntry", "(", "rawEntry", ",", "usePreviousSession", ")", ";", "}", "catch", "(", "ClasspathEntry", ".", "AssertionFailedException", "e", ")", "{", "result", ".", "unresolvedEntryStatus", "=", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_PATH", ",", "e", ".", "getMessage", "(", ")", ")", ";", "break", ";", "}", "if", "(", "resolvedEntry", "==", "null", ")", "{", "result", ".", "unresolvedEntryStatus", "=", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "CP_VARIABLE_PATH_UNBOUND", ",", "this", ",", "rawEntry", ".", "getPath", "(", ")", ")", ";", "}", "else", "{", "if", "(", "resolveChainedLibraries", "&&", "resolvedEntry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", "&&", "result", ".", "rawReverseMap", ".", "get", "(", "resolvedEntry", ".", "getPath", "(", ")", ")", "==", "null", ")", "{", "ClasspathEntry", "[", "]", "extraEntries", "=", "(", "(", "ClasspathEntry", ")", "resolvedEntry", ")", ".", "resolvedChainedLibraries", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "length2", "=", "extraEntries", ".", "length", ";", "j", "<", "length2", ";", "j", "++", ")", "{", "if", "(", "!", "rawLibrariesPath", ".", "contains", "(", "extraEntries", "[", "j", "]", ".", "getPath", "(", ")", ")", ")", "{", "addToResult", "(", "rawEntry", ",", "extraEntries", "[", "j", "]", ",", "result", ",", "resolvedEntries", ",", "externalFoldersManager", ",", "referencedEntriesMap", ",", "true", ",", "knownDrives", ")", ";", "}", "}", "}", "addToResult", "(", "rawEntry", ",", "resolvedEntry", ",", "result", ",", "resolvedEntries", ",", "externalFoldersManager", ",", "referencedEntriesMap", ",", "false", ",", "knownDrives", ")", ";", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_CONTAINER", ":", "IClasspathContainer", "container", "=", "usePreviousSession", "?", "manager", ".", "getPreviousSessionContainer", "(", "rawEntry", ".", "getPath", "(", ")", ",", "this", ")", ":", "JavaCore", ".", "getClasspathContainer", "(", "rawEntry", ".", "getPath", "(", ")", ",", "this", ")", ";", "if", "(", "container", "==", "null", ")", "{", "result", ".", "unresolvedEntryStatus", "=", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "CP_CONTAINER_PATH_UNBOUND", ",", "this", ",", "rawEntry", ".", "getPath", "(", ")", ")", ";", "break", ";", "}", "IClasspathEntry", "[", "]", "containerEntries", "=", "container", ".", "getClasspathEntries", "(", ")", ";", "if", "(", "containerEntries", "==", "null", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", "||", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "verbose_missbehaving_container_null_entries", "(", "this", ",", "rawEntry", ".", "getPath", "(", ")", ")", ";", "}", "break", ";", "}", "for", "(", "int", "j", "=", "0", ",", "containerLength", "=", "containerEntries", ".", "length", ";", "j", "<", "containerLength", ";", "j", "++", ")", "{", "ClasspathEntry", "cEntry", "=", "(", "ClasspathEntry", ")", "containerEntries", "[", "j", "]", ";", "if", "(", "cEntry", "==", "null", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", "||", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "verbose_missbehaving_container", "(", "this", ",", "rawEntry", ".", "getPath", "(", ")", ",", "containerEntries", ")", ";", "}", "break", ";", "}", "cEntry", "=", "cEntry", ".", "combineWith", "(", "(", "ClasspathEntry", ")", "rawEntry", ")", ";", "if", "(", "cEntry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "cEntry", "=", "cEntry", ".", "resolvedDotDot", "(", "getProject", "(", ")", ".", "getLocation", "(", ")", ")", ";", "if", "(", "resolveChainedLibraries", "&&", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "resolveReferencedLibrariesForContainers", "&&", "result", ".", "rawReverseMap", ".", "get", "(", "cEntry", ".", "getPath", "(", ")", ")", "==", "null", ")", "{", "ClasspathEntry", "[", "]", "extraEntries", "=", "cEntry", ".", "resolvedChainedLibraries", "(", ")", ";", "for", "(", "int", "k", "=", "0", ",", "length2", "=", "extraEntries", ".", "length", ";", "k", "<", "length2", ";", "k", "++", ")", "{", "if", "(", "!", "rawLibrariesPath", ".", "contains", "(", "extraEntries", "[", "k", "]", ".", "getPath", "(", ")", ")", ")", "{", "addToResult", "(", "rawEntry", ",", "extraEntries", "[", "k", "]", ",", "result", ",", "resolvedEntries", ",", "externalFoldersManager", ",", "referencedEntriesMap", ",", "false", ",", "knownDrives", ")", ";", "}", "}", "}", "}", "addToResult", "(", "rawEntry", ",", "cEntry", ",", "result", ",", "resolvedEntries", ",", "externalFoldersManager", ",", "referencedEntriesMap", ",", "false", ",", "knownDrives", ")", ";", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "resolvedEntry", "=", "(", "(", "ClasspathEntry", ")", "rawEntry", ")", ".", "resolvedDotDot", "(", "getProject", "(", ")", ".", "getLocation", "(", ")", ")", ";", "if", "(", "resolveChainedLibraries", "&&", "result", ".", "rawReverseMap", ".", "get", "(", "resolvedEntry", ".", "getPath", "(", ")", ")", "==", "null", ")", "{", "ClasspathEntry", "[", "]", "extraEntries", "=", "(", "(", "ClasspathEntry", ")", "resolvedEntry", ")", ".", "resolvedChainedLibraries", "(", ")", ";", "for", "(", "int", "k", "=", "0", ",", "length2", "=", "extraEntries", ".", "length", ";", "k", "<", "length2", ";", "k", "++", ")", "{", "if", "(", "!", "rawLibrariesPath", ".", "contains", "(", "extraEntries", "[", "k", "]", ".", "getPath", "(", ")", ")", ")", "{", "addToResult", "(", "rawEntry", ",", "extraEntries", "[", "k", "]", ",", "result", ",", "resolvedEntries", ",", "externalFoldersManager", ",", "referencedEntriesMap", ",", "true", ",", "knownDrives", ")", ";", "}", "}", "}", "addToResult", "(", "rawEntry", ",", "resolvedEntry", ",", "result", ",", "resolvedEntries", ",", "externalFoldersManager", ",", "referencedEntriesMap", ",", "false", ",", "knownDrives", ")", ";", "break", ";", "default", ":", "addToResult", "(", "rawEntry", ",", "resolvedEntry", ",", "result", ",", "resolvedEntries", ",", "externalFoldersManager", ",", "referencedEntriesMap", ",", "false", ",", "knownDrives", ")", ";", "break", ";", "}", "}", "result", ".", "resolvedClasspath", "=", "new", "IClasspathEntry", "[", "resolvedEntries", ".", "size", "(", ")", "]", ";", "resolvedEntries", ".", "toArray", "(", "result", ".", "resolvedClasspath", ")", ";", "return", "result", ";", "}", "private", "void", "addToResult", "(", "IClasspathEntry", "rawEntry", ",", "IClasspathEntry", "resolvedEntry", ",", "ResolvedClasspath", "result", ",", "LinkedHashSet", "resolvedEntries", ",", "ExternalFoldersManager", "externalFoldersManager", ",", "Map", "oldChainedEntriesMap", ",", "boolean", "addAsChainedEntry", ",", "Map", "knownDrives", ")", "{", "IPath", "resolvedPath", ";", "if", "(", "result", ".", "rawReverseMap", ".", "get", "(", "resolvedPath", "=", "resolvedEntry", ".", "getPath", "(", ")", ")", "==", "null", ")", "{", "result", ".", "rawReverseMap", ".", "put", "(", "resolvedPath", ",", "rawEntry", ")", ";", "result", ".", "rootPathToResolvedEntries", ".", "put", "(", "resolvedPath", ",", "resolvedEntry", ")", ";", "resolvedEntries", ".", "add", "(", "resolvedEntry", ")", ";", "if", "(", "addAsChainedEntry", ")", "{", "IClasspathEntry", "chainedEntry", "=", "null", ";", "chainedEntry", "=", "(", "ClasspathEntry", ")", "oldChainedEntriesMap", ".", "get", "(", "resolvedPath", ")", ";", "if", "(", "chainedEntry", "!=", "null", ")", "{", "copyFromOldChainedEntry", "(", "(", "ClasspathEntry", ")", "resolvedEntry", ",", "(", "ClasspathEntry", ")", "chainedEntry", ")", ";", "}", "}", "}", "if", "(", "resolvedEntry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", "&&", "ExternalFoldersManager", ".", "isExternalFolderPath", "(", "resolvedPath", ")", ")", "{", "externalFoldersManager", ".", "addFolder", "(", "resolvedPath", ",", "true", ")", ";", "}", "IPath", "sourcePath", "=", "resolvedEntry", ".", "getSourceAttachmentPath", "(", ")", ";", "if", "(", "sourcePath", "!=", "null", "&&", "driveExists", "(", "sourcePath", ",", "knownDrives", ")", "&&", "ExternalFoldersManager", ".", "isExternalFolderPath", "(", "sourcePath", ")", ")", "{", "externalFoldersManager", ".", "addFolder", "(", "sourcePath", ",", "true", ")", ";", "}", "}", "private", "void", "copyFromOldChainedEntry", "(", "ClasspathEntry", "resolvedEntry", ",", "ClasspathEntry", "chainedEntry", ")", "{", "IPath", "path", "=", "chainedEntry", ".", "getSourceAttachmentPath", "(", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "resolvedEntry", ".", "sourceAttachmentPath", "=", "path", ";", "}", "path", "=", "chainedEntry", ".", "getSourceAttachmentRootPath", "(", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "resolvedEntry", ".", "sourceAttachmentRootPath", "=", "path", ";", "}", "IClasspathAttribute", "[", "]", "attributes", "=", "chainedEntry", ".", "getExtraAttributes", "(", ")", ";", "if", "(", "attributes", "!=", "null", ")", "{", "resolvedEntry", ".", "extraAttributes", "=", "attributes", ";", "}", "}", "private", "boolean", "driveExists", "(", "IPath", "sourcePath", ",", "Map", "knownDrives", ")", "{", "String", "drive", "=", "sourcePath", ".", "getDevice", "(", ")", ";", "if", "(", "drive", "==", "null", ")", "return", "true", ";", "Boolean", "good", "=", "(", "Boolean", ")", "knownDrives", ".", "get", "(", "drive", ")", ";", "if", "(", "good", "==", "null", ")", "{", "if", "(", "new", "File", "(", "drive", ")", ".", "exists", "(", ")", ")", "{", "knownDrives", ".", "put", "(", "drive", ",", "Boolean", ".", "TRUE", ")", ";", "return", "true", ";", "}", "else", "{", "knownDrives", ".", "put", "(", "drive", ",", "Boolean", ".", "FALSE", ")", ";", "return", "false", ";", "}", "}", "return", "good", ".", "booleanValue", "(", ")", ";", "}", "public", "void", "resolveClasspath", "(", "PerProjectInfo", "perProjectInfo", ",", "boolean", "usePreviousSession", ",", "boolean", "addClasspathChange", ")", "throws", "JavaModelException", "{", "if", "(", "CP_RESOLUTION_BP_LISTENERS", "!=", "null", ")", "breakpoint", "(", "1", ",", "this", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "boolean", "isClasspathBeingResolved", "=", "manager", ".", "isClasspathBeingResolved", "(", "this", ")", ";", "try", "{", "if", "(", "!", "isClasspathBeingResolved", ")", "{", "manager", ".", "setClasspathBeingResolved", "(", "this", ",", "true", ")", ";", "}", "IClasspathEntry", "[", "]", "[", "]", "classpath", "=", "new", "IClasspathEntry", "[", "2", "]", "[", "]", ";", "int", "timeStamp", ";", "synchronized", "(", "perProjectInfo", ")", "{", "classpath", "[", "0", "]", "=", "perProjectInfo", ".", "rawClasspath", ";", "classpath", "[", "1", "]", "=", "perProjectInfo", ".", "referencedEntries", ";", "if", "(", "classpath", "[", "0", "]", "==", "null", ")", "classpath", "=", "perProjectInfo", ".", "readAndCacheClasspath", "(", "this", ")", ";", "timeStamp", "=", "perProjectInfo", ".", "rawTimeStamp", ";", "}", "ResolvedClasspath", "result", "=", "resolveClasspath", "(", "classpath", "[", "0", "]", ",", "classpath", "[", "1", "]", ",", "usePreviousSession", ",", "true", ")", ";", "if", "(", "CP_RESOLUTION_BP_LISTENERS", "!=", "null", ")", "breakpoint", "(", "2", ",", "this", ")", ";", "perProjectInfo", ".", "setResolvedClasspath", "(", "result", ".", "resolvedClasspath", ",", "result", ".", "referencedEntries", ",", "result", ".", "rawReverseMap", ",", "result", ".", "rootPathToResolvedEntries", ",", "usePreviousSession", "?", "PerProjectInfo", ".", "NEED_RESOLUTION", ":", "result", ".", "unresolvedEntryStatus", ",", "timeStamp", ",", "addClasspathChange", ")", ";", "}", "finally", "{", "if", "(", "!", "isClasspathBeingResolved", ")", "{", "manager", ".", "setClasspathBeingResolved", "(", "this", ",", "false", ")", ";", "}", "if", "(", "CP_RESOLUTION_BP_LISTENERS", "!=", "null", ")", "breakpoint", "(", "3", ",", "this", ")", ";", "}", "}", "public", "String", "rootID", "(", ")", "{", "return", "\"[PRJ]\"", "+", "this", ".", "project", ".", "getFullPath", "(", ")", ";", "}", "public", "boolean", "writeFileEntries", "(", "IClasspathEntry", "[", "]", "newClasspath", ",", "IClasspathEntry", "[", "]", "referencedEntries", ",", "IPath", "newOutputLocation", ")", "throws", "JavaModelException", "{", "if", "(", "!", "this", ".", "project", ".", "isAccessible", "(", ")", ")", "return", "false", ";", "Map", "unknownElements", "=", "new", "HashMap", "(", ")", ";", "IClasspathEntry", "[", "]", "[", "]", "fileEntries", "=", "readFileEntries", "(", "unknownElements", ")", ";", "if", "(", "fileEntries", "[", "0", "]", "!=", "JavaProject", ".", "INVALID_CLASSPATH", "&&", "areClasspathsEqual", "(", "newClasspath", ",", "newOutputLocation", ",", "fileEntries", "[", "0", "]", ")", "&&", "(", "referencedEntries", "==", "null", "||", "areClasspathsEqual", "(", "referencedEntries", ",", "fileEntries", "[", "1", "]", ")", ")", ")", "{", "return", "false", ";", "}", "try", "{", "setSharedProperty", "(", "JavaProject", ".", "CLASSPATH_FILENAME", ",", "encodeClasspath", "(", "newClasspath", ",", "referencedEntries", ",", "newOutputLocation", ",", "true", ",", "unknownElements", ")", ")", ";", "return", "true", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "public", "boolean", "writeFileEntries", "(", "IClasspathEntry", "[", "]", "newClasspath", ",", "IPath", "newOutputLocation", ")", "throws", "JavaModelException", "{", "return", "writeFileEntries", "(", "newClasspath", ",", "ClasspathEntry", ".", "NO_ENTRIES", ",", "newOutputLocation", ")", ";", "}", "private", "void", "setJavaCommand", "(", "IProjectDescription", "description", ",", "ICommand", "newCommand", ")", "throws", "CoreException", "{", "ICommand", "[", "]", "oldBuildSpec", "=", "description", ".", "getBuildSpec", "(", ")", ";", "int", "oldJavaCommandIndex", "=", "getJavaCommandIndex", "(", "oldBuildSpec", ")", ";", "ICommand", "[", "]", "newCommands", ";", "if", "(", "oldJavaCommandIndex", "==", "-", "1", ")", "{", "newCommands", "=", "new", "ICommand", "[", "oldBuildSpec", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "oldBuildSpec", ",", "0", ",", "newCommands", ",", "1", ",", "oldBuildSpec", ".", "length", ")", ";", "newCommands", "[", "0", "]", "=", "newCommand", ";", "}", "else", "{", "oldBuildSpec", "[", "oldJavaCommandIndex", "]", "=", "newCommand", ";", "newCommands", "=", "oldBuildSpec", ";", "}", "description", ".", "setBuildSpec", "(", "newCommands", ")", ";", "this", ".", "project", ".", "setDescription", "(", "description", ",", "null", ")", ";", "}", "public", "void", "setOption", "(", "String", "optionName", ",", "String", "optionValue", ")", "{", "IEclipsePreferences", "projectPreferences", "=", "getEclipsePreferences", "(", ")", ";", "boolean", "modified", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "storePreference", "(", "optionName", ",", "optionValue", ",", "projectPreferences", ")", ";", "if", "(", "modified", ")", "{", "try", "{", "projectPreferences", ".", "flush", "(", ")", ";", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "}", "}", "}", "public", "void", "setOptions", "(", "Map", "newOptions", ")", "{", "IEclipsePreferences", "projectPreferences", "=", "getEclipsePreferences", "(", ")", ";", "if", "(", "projectPreferences", "==", "null", ")", "return", ";", "try", "{", "if", "(", "newOptions", "==", "null", ")", "{", "projectPreferences", ".", "clear", "(", ")", ";", "}", "else", "{", "Iterator", "entries", "=", "newOptions", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "JavaModelManager", "javaModelManager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "String", "key", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "String", "value", "=", "(", "String", ")", "entry", ".", "getValue", "(", ")", ";", "javaModelManager", ".", "storePreference", "(", "key", ",", "value", ",", "projectPreferences", ")", ";", "}", "String", "[", "]", "pNames", "=", "projectPreferences", ".", "keys", "(", ")", ";", "int", "ln", "=", "pNames", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ln", ";", "i", "++", ")", "{", "String", "key", "=", "pNames", "[", "i", "]", ";", "if", "(", "!", "newOptions", ".", "containsKey", "(", "key", ")", ")", "{", "projectPreferences", ".", "remove", "(", "key", ")", ";", "}", "}", "}", "projectPreferences", ".", "flush", "(", ")", ";", "try", "{", "getPerProjectInfo", "(", ")", ".", "options", "=", "null", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "}", "}", "public", "void", "setOutputLocation", "(", "IPath", "path", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "path", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "path_nullPath", ")", ";", "}", "if", "(", "path", ".", "equals", "(", "getOutputLocation", "(", ")", ")", ")", "{", "return", ";", "}", "setRawClasspath", "(", "getRawClasspath", "(", ")", ",", "path", ",", "monitor", ")", ";", "}", "public", "void", "setProject", "(", "IProject", "project", ")", "{", "this", ".", "project", "=", "project", ";", "this", ".", "parent", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ";", "}", "public", "void", "setRawClasspath", "(", "IClasspathEntry", "[", "]", "entries", ",", "boolean", "canModifyResources", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "setRawClasspath", "(", "entries", ",", "getOutputLocation", "(", ")", ",", "canModifyResources", ",", "monitor", ")", ";", "}", "public", "void", "setRawClasspath", "(", "IClasspathEntry", "[", "]", "newRawClasspath", ",", "IPath", "newOutputLocation", ",", "boolean", "canModifyResources", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "setRawClasspath", "(", "newRawClasspath", ",", "null", ",", "newOutputLocation", ",", "canModifyResources", ",", "monitor", ")", ";", "}", "public", "void", "setRawClasspath", "(", "IClasspathEntry", "[", "]", "entries", ",", "IPath", "outputLocation", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "setRawClasspath", "(", "entries", ",", "outputLocation", ",", "true", ",", "monitor", ")", ";", "}", "public", "void", "setRawClasspath", "(", "IClasspathEntry", "[", "]", "entries", ",", "IClasspathEntry", "[", "]", "referencedEntries", ",", "IPath", "outputLocation", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "setRawClasspath", "(", "entries", ",", "referencedEntries", ",", "outputLocation", ",", "true", ",", "monitor", ")", ";", "}", "protected", "void", "setRawClasspath", "(", "IClasspathEntry", "[", "]", "newRawClasspath", ",", "IClasspathEntry", "[", "]", "referencedEntries", ",", "IPath", "newOutputLocation", ",", "boolean", "canModifyResources", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "try", "{", "if", "(", "newRawClasspath", "==", "null", ")", "newRawClasspath", "=", "defaultClasspath", "(", ")", ";", "SetClasspathOperation", "op", "=", "new", "SetClasspathOperation", "(", "this", ",", "newRawClasspath", ",", "referencedEntries", ",", "newOutputLocation", ",", "canModifyResources", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getDeltaProcessor", "(", ")", ".", "flush", "(", ")", ";", "throw", "e", ";", "}", "}", "public", "void", "setRawClasspath", "(", "IClasspathEntry", "[", "]", "entries", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "setRawClasspath", "(", "entries", ",", "getOutputLocation", "(", ")", ",", "true", ",", "monitor", ")", ";", "}", "public", "void", "setSharedProperty", "(", "String", "key", ",", "String", "value", ")", "throws", "CoreException", "{", "IFile", "rscFile", "=", "this", ".", "project", ".", "getFile", "(", "key", ")", ";", "byte", "[", "]", "bytes", "=", "null", ";", "try", "{", "bytes", "=", "value", ".", "getBytes", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "UTF_8", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "bytes", "=", "value", ".", "getBytes", "(", ")", ";", "}", "InputStream", "inputStream", "=", "new", "ByteArrayInputStream", "(", "bytes", ")", ";", "if", "(", "rscFile", ".", "exists", "(", ")", ")", "{", "if", "(", "rscFile", ".", "isReadOnly", "(", ")", ")", "{", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "validateEdit", "(", "new", "IFile", "[", "]", "{", "rscFile", "}", ",", "null", ")", ";", "}", "rscFile", ".", "setContents", "(", "inputStream", ",", "IResource", ".", "FORCE", ",", "null", ")", ";", "}", "else", "{", "rscFile", ".", "create", "(", "inputStream", ",", "IResource", ".", "FORCE", ",", "null", ")", ";", "}", "}", "public", "void", "updateCycleParticipants", "(", "ArrayList", "prereqChain", ",", "LinkedHashSet", "cycleParticipants", ",", "IWorkspaceRoot", "workspaceRoot", ",", "HashSet", "traversed", ",", "Map", "preferredClasspaths", ")", "{", "IPath", "path", "=", "getPath", "(", ")", ";", "prereqChain", ".", "add", "(", "path", ")", ";", "traversed", ".", "add", "(", "path", ")", ";", "try", "{", "IClasspathEntry", "[", "]", "classpath", "=", "null", ";", "if", "(", "preferredClasspaths", "!=", "null", ")", "classpath", "=", "(", "IClasspathEntry", "[", "]", ")", "preferredClasspaths", ".", "get", "(", "this", ")", ";", "if", "(", "classpath", "==", "null", ")", "classpath", "=", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "classpath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_PROJECT", ")", "{", "IPath", "prereqProjectPath", "=", "entry", ".", "getPath", "(", ")", ";", "int", "index", "=", "cycleParticipants", ".", "contains", "(", "prereqProjectPath", ")", "?", "0", ":", "prereqChain", ".", "indexOf", "(", "prereqProjectPath", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "for", "(", "int", "size", "=", "prereqChain", ".", "size", "(", ")", ";", "index", "<", "size", ";", "index", "++", ")", "{", "cycleParticipants", ".", "add", "(", "prereqChain", ".", "get", "(", "index", ")", ")", ";", "}", "}", "else", "{", "if", "(", "!", "traversed", ".", "contains", "(", "prereqProjectPath", ")", ")", "{", "IResource", "member", "=", "workspaceRoot", ".", "findMember", "(", "prereqProjectPath", ")", ";", "if", "(", "member", "!=", "null", "&&", "member", ".", "getType", "(", ")", "==", "IResource", ".", "PROJECT", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "(", "IProject", ")", "member", ")", ";", "javaProject", ".", "updateCycleParticipants", "(", "prereqChain", ",", "cycleParticipants", ",", "workspaceRoot", ",", "traversed", ",", "preferredClasspaths", ")", ";", "}", "}", "}", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "prereqChain", ".", "remove", "(", "path", ")", ";", "}", "private", "void", "updatePreferences", "(", "IEclipsePreferences", "preferences", ")", "{", "IEclipsePreferences", "oldPreferences", "=", "loadPreferences", "(", ")", ";", "if", "(", "oldPreferences", "!=", "null", ")", "{", "try", "{", "String", "[", "]", "propertyNames", "=", "oldPreferences", ".", "childrenNames", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "propertyNames", ".", "length", ";", "i", "++", ")", "{", "String", "propertyName", "=", "propertyNames", "[", "i", "]", ";", "String", "propertyValue", "=", "oldPreferences", ".", "get", "(", "propertyName", ",", "\"\"", ")", ";", "if", "(", "!", "\"\"", ".", "equals", "(", "propertyValue", ")", ")", "{", "preferences", ".", "put", "(", "propertyName", ",", "propertyValue", ")", ";", "}", "}", "preferences", ".", "flush", "(", ")", ";", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "}", "}", "}", "protected", "IStatus", "validateExistence", "(", "IResource", "underlyingResource", ")", "{", "try", "{", "if", "(", "!", "(", "(", "IProject", ")", "underlyingResource", ")", ".", "hasNature", "(", "JavaCore", ".", "NATURE_ID", ")", ")", "return", "newDoesNotExistStatus", "(", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "return", "newDoesNotExistStatus", "(", ")", ";", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "}", "</s>" ]
3,702
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Assert", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "CompletionEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ".", "TypeHierarchy", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "MementoTokenizer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "SourceType", "extends", "NamedMember", "implements", "IType", "{", "protected", "SourceType", "(", "JavaElement", "parent", ",", "String", "name", ")", "{", "super", "(", "parent", ",", "name", ")", ";", "}", "protected", "void", "closing", "(", "Object", "info", ")", "throws", "JavaModelException", "{", "super", ".", "closing", "(", "info", ")", ";", "SourceTypeElementInfo", "elementInfo", "=", "(", "SourceTypeElementInfo", ")", "info", ";", "ITypeParameter", "[", "]", "typeParameters", "=", "elementInfo", ".", "typeParameters", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "typeParameters", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "(", "(", "TypeParameter", ")", "typeParameters", "[", "i", "]", ")", ".", "close", "(", ")", ";", "}", "}", "public", "void", "codeComplete", "(", "char", "[", "]", "snippet", ",", "int", "insertion", ",", "int", "position", ",", "char", "[", "]", "[", "]", "localVariableTypeNames", ",", "char", "[", "]", "[", "]", "localVariableNames", ",", "int", "[", "]", "localVariableModifiers", ",", "boolean", "isStatic", ",", "ICompletionRequestor", "requestor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "snippet", ",", "insertion", ",", "position", ",", "localVariableTypeNames", ",", "localVariableNames", ",", "localVariableModifiers", ",", "isStatic", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "void", "codeComplete", "(", "char", "[", "]", "snippet", ",", "int", "insertion", ",", "int", "position", ",", "char", "[", "]", "[", "]", "localVariableTypeNames", ",", "char", "[", "]", "[", "]", "localVariableNames", ",", "int", "[", "]", "localVariableModifiers", ",", "boolean", "isStatic", ",", "ICompletionRequestor", "requestor", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "if", "(", "requestor", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "codeComplete", "(", "snippet", ",", "insertion", ",", "position", ",", "localVariableTypeNames", ",", "localVariableNames", ",", "localVariableModifiers", ",", "isStatic", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "CompletionRequestorWrapper", "(", "requestor", ")", ",", "owner", ")", ";", "}", "public", "void", "codeComplete", "(", "char", "[", "]", "snippet", ",", "int", "insertion", ",", "int", "position", ",", "char", "[", "]", "[", "]", "localVariableTypeNames", ",", "char", "[", "]", "[", "]", "localVariableNames", ",", "int", "[", "]", "localVariableModifiers", ",", "boolean", "isStatic", ",", "CompletionRequestor", "requestor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "snippet", ",", "insertion", ",", "position", ",", "localVariableTypeNames", ",", "localVariableNames", ",", "localVariableModifiers", ",", "isStatic", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "void", "codeComplete", "(", "char", "[", "]", "snippet", ",", "int", "insertion", ",", "int", "position", ",", "char", "[", "]", "[", "]", "localVariableTypeNames", ",", "char", "[", "]", "[", "]", "localVariableNames", ",", "int", "[", "]", "localVariableModifiers", ",", "boolean", "isStatic", ",", "CompletionRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "snippet", ",", "insertion", ",", "position", ",", "localVariableTypeNames", ",", "localVariableNames", ",", "localVariableModifiers", ",", "isStatic", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "monitor", ")", ";", "}", "public", "void", "codeComplete", "(", "char", "[", "]", "snippet", ",", "int", "insertion", ",", "int", "position", ",", "char", "[", "]", "[", "]", "localVariableTypeNames", ",", "char", "[", "]", "[", "]", "localVariableNames", ",", "int", "[", "]", "localVariableModifiers", ",", "boolean", "isStatic", ",", "CompletionRequestor", "requestor", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "snippet", ",", "insertion", ",", "position", ",", "localVariableTypeNames", ",", "localVariableNames", ",", "localVariableModifiers", ",", "isStatic", ",", "requestor", ",", "owner", ",", "null", ")", ";", "}", "public", "void", "codeComplete", "(", "char", "[", "]", "snippet", ",", "int", "insertion", ",", "int", "position", ",", "char", "[", "]", "[", "]", "localVariableTypeNames", ",", "char", "[", "]", "[", "]", "localVariableNames", ",", "int", "[", "]", "localVariableModifiers", ",", "boolean", "isStatic", ",", "CompletionRequestor", "requestor", ",", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "requestor", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "JavaProject", "project", "=", "(", "JavaProject", ")", "getJavaProject", "(", ")", ";", "SearchableEnvironment", "environment", "=", "project", ".", "newSearchableNameEnvironment", "(", "owner", ")", ";", "CompletionEngine", "engine", "=", "new", "CompletionEngine", "(", "environment", ",", "requestor", ",", "project", ".", "getOptions", "(", "true", ")", ",", "project", ",", "owner", ",", "monitor", ")", ";", "String", "source", "=", "getCompilationUnit", "(", ")", ".", "getSource", "(", ")", ";", "if", "(", "source", "!=", "null", "&&", "insertion", ">", "-", "1", "&&", "insertion", "<", "source", ".", "length", "(", ")", ")", "{", "char", "[", "]", "prefix", "=", "CharOperation", ".", "concat", "(", "source", ".", "substring", "(", "0", ",", "insertion", ")", ".", "toCharArray", "(", ")", ",", "new", "char", "[", "]", "{", "'{'", "}", ")", ";", "char", "[", "]", "suffix", "=", "CharOperation", ".", "concat", "(", "new", "char", "[", "]", "{", "'}'", "}", ",", "source", ".", "substring", "(", "insertion", ")", ".", "toCharArray", "(", ")", ")", ";", "char", "[", "]", "fakeSource", "=", "CharOperation", ".", "concat", "(", "prefix", ",", "snippet", ",", "suffix", ")", ";", "BasicCompilationUnit", "cu", "=", "new", "BasicCompilationUnit", "(", "fakeSource", ",", "null", ",", "getElementName", "(", ")", ",", "getParent", "(", ")", ")", ";", "engine", ".", "complete", "(", "cu", ",", "prefix", ".", "length", "+", "position", ",", "prefix", ".", "length", ",", "null", ")", ";", "}", "else", "{", "engine", ".", "complete", "(", "this", ",", "snippet", ",", "position", ",", "localVariableTypeNames", ",", "localVariableNames", ",", "localVariableModifiers", ",", "isStatic", ")", ";", "}", "if", "(", "NameLookup", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "environment", ".", "nameLookup", ".", "timeSpentInSeekTypesInSourcePackage", "+", "\"ms\"", ")", ";", "System", ".", "out", ".", "println", "(", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "environment", ".", "nameLookup", ".", "timeSpentInSeekTypesInBinaryPackage", "+", "\"ms\"", ")", ";", "}", "}", "public", "IField", "createField", "(", "String", "contents", ",", "IJavaElement", "sibling", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CreateFieldOperation", "op", "=", "new", "CreateFieldOperation", "(", "this", ",", "contents", ",", "force", ")", ";", "if", "(", "sibling", "!=", "null", ")", "{", "op", ".", "createBefore", "(", "sibling", ")", ";", "}", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "(", "IField", ")", "op", ".", "getResultElements", "(", ")", "[", "0", "]", ";", "}", "public", "IInitializer", "createInitializer", "(", "String", "contents", ",", "IJavaElement", "sibling", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CreateInitializerOperation", "op", "=", "new", "CreateInitializerOperation", "(", "this", ",", "contents", ")", ";", "if", "(", "sibling", "!=", "null", ")", "{", "op", ".", "createBefore", "(", "sibling", ")", ";", "}", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "(", "IInitializer", ")", "op", ".", "getResultElements", "(", ")", "[", "0", "]", ";", "}", "public", "IMethod", "createMethod", "(", "String", "contents", ",", "IJavaElement", "sibling", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CreateMethodOperation", "op", "=", "new", "CreateMethodOperation", "(", "this", ",", "contents", ",", "force", ")", ";", "if", "(", "sibling", "!=", "null", ")", "{", "op", ".", "createBefore", "(", "sibling", ")", ";", "}", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "(", "IMethod", ")", "op", ".", "getResultElements", "(", ")", "[", "0", "]", ";", "}", "public", "IType", "createType", "(", "String", "contents", ",", "IJavaElement", "sibling", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CreateTypeOperation", "op", "=", "new", "CreateTypeOperation", "(", "this", ",", "contents", ",", "force", ")", ";", "if", "(", "sibling", "!=", "null", ")", "{", "op", ".", "createBefore", "(", "sibling", ")", ";", "}", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "(", "IType", ")", "op", ".", "getResultElements", "(", ")", "[", "0", "]", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "SourceType", ")", ")", "return", "false", ";", "return", "super", ".", "equals", "(", "o", ")", ";", "}", "public", "IMethod", "[", "]", "findMethods", "(", "IMethod", "method", ")", "{", "try", "{", "return", "findMethods", "(", "method", ",", "getMethods", "(", ")", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "IAnnotation", "[", "]", "getAnnotations", "(", ")", "throws", "JavaModelException", "{", "AnnotatableInfo", "info", "=", "(", "AnnotatableInfo", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "annotations", ";", "}", "public", "IJavaElement", "[", "]", "getChildrenForCategory", "(", "String", "category", ")", "throws", "JavaModelException", "{", "IJavaElement", "[", "]", "children", "=", "getChildren", "(", ")", ";", "int", "length", "=", "children", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "NO_ELEMENTS", ";", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "HashMap", "categories", "=", "info", ".", "getCategories", "(", ")", ";", "if", "(", "categories", "==", "null", ")", "return", "NO_ELEMENTS", ";", "IJavaElement", "[", "]", "result", "=", "new", "IJavaElement", "[", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "child", "=", "children", "[", "i", "]", ";", "String", "[", "]", "elementCategories", "=", "(", "String", "[", "]", ")", "categories", ".", "get", "(", "child", ")", ";", "if", "(", "elementCategories", "!=", "null", ")", "for", "(", "int", "j", "=", "0", ",", "length2", "=", "elementCategories", ".", "length", ";", "j", "<", "length2", ";", "j", "++", ")", "{", "if", "(", "elementCategories", "[", "j", "]", ".", "equals", "(", "category", ")", ")", "result", "[", "index", "++", "]", "=", "child", ";", "}", "}", "if", "(", "index", "==", "0", ")", "return", "NO_ELEMENTS", ";", "if", "(", "index", "<", "length", ")", "System", ".", "arraycopy", "(", "result", ",", "0", ",", "result", "=", "new", "IJavaElement", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "result", ";", "}", "public", "IType", "getDeclaringType", "(", ")", "{", "IJavaElement", "parentElement", "=", "getParent", "(", ")", ";", "while", "(", "parentElement", "!=", "null", ")", "{", "if", "(", "parentElement", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "return", "(", "IType", ")", "parentElement", ";", "}", "else", "if", "(", "parentElement", "instanceof", "IMember", ")", "{", "parentElement", "=", "parentElement", ".", "getParent", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "return", "null", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "TYPE", ";", "}", "public", "IField", "getField", "(", "String", "fieldName", ")", "{", "return", "new", "SourceField", "(", "this", ",", "fieldName", ")", ";", "}", "public", "IField", "[", "]", "getFields", "(", ")", "throws", "JavaModelException", "{", "ArrayList", "list", "=", "getChildrenOfType", "(", "FIELD", ")", ";", "IField", "[", "]", "array", "=", "new", "IField", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "array", ")", ";", "return", "array", ";", "}", "public", "String", "getFullyQualifiedName", "(", ")", "{", "return", "this", ".", "getFullyQualifiedName", "(", "'$'", ")", ";", "}", "public", "String", "getFullyQualifiedName", "(", "char", "enclosingTypeSeparator", ")", "{", "try", "{", "return", "getFullyQualifiedName", "(", "enclosingTypeSeparator", ",", "false", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "String", "getFullyQualifiedParameterizedName", "(", ")", "throws", "JavaModelException", "{", "return", "getFullyQualifiedName", "(", "'.'", ",", "true", ")", ";", "}", "public", "IJavaElement", "getHandleFromMemento", "(", "String", "token", ",", "MementoTokenizer", "memento", ",", "WorkingCopyOwner", "workingCopyOwner", ")", "{", "switch", "(", "token", ".", "charAt", "(", "0", ")", ")", "{", "case", "JEM_COUNT", ":", "return", "getHandleUpdatingCountFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "case", "JEM_FIELD", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "fieldName", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "field", "=", "(", "JavaElement", ")", "getField", "(", "fieldName", ")", ";", "return", "field", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "case", "JEM_INITIALIZER", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "count", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "initializer", "=", "(", "JavaElement", ")", "getInitializer", "(", "Integer", ".", "parseInt", "(", "count", ")", ")", ";", "return", "initializer", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "case", "JEM_METHOD", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "selector", "=", "memento", ".", "nextToken", "(", ")", ";", "ArrayList", "params", "=", "new", "ArrayList", "(", ")", ";", "nextParam", ":", "while", "(", "memento", ".", "hasMoreTokens", "(", ")", ")", "{", "token", "=", "memento", ".", "nextToken", "(", ")", ";", "switch", "(", "token", ".", "charAt", "(", "0", ")", ")", "{", "case", "JEM_TYPE", ":", "case", "JEM_TYPE_PARAMETER", ":", "case", "JEM_ANNOTATION", ":", "break", "nextParam", ";", "case", "JEM_METHOD", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "param", "=", "memento", ".", "nextToken", "(", ")", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "while", "(", "param", ".", "length", "(", ")", "==", "1", "&&", "Signature", ".", "C_ARRAY", "==", "param", ".", "charAt", "(", "0", ")", ")", "{", "buffer", ".", "append", "(", "Signature", ".", "C_ARRAY", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "param", "=", "memento", ".", "nextToken", "(", ")", ";", "}", "params", ".", "add", "(", "buffer", ".", "toString", "(", ")", "+", "param", ")", ";", "break", ";", "default", ":", "break", "nextParam", ";", "}", "}", "String", "[", "]", "parameters", "=", "new", "String", "[", "params", ".", "size", "(", ")", "]", ";", "params", ".", "toArray", "(", "parameters", ")", ";", "JavaElement", "method", "=", "(", "JavaElement", ")", "getMethod", "(", "selector", ",", "parameters", ")", ";", "switch", "(", "token", ".", "charAt", "(", "0", ")", ")", "{", "case", "JEM_TYPE", ":", "case", "JEM_TYPE_PARAMETER", ":", "case", "JEM_LOCALVARIABLE", ":", "case", "JEM_ANNOTATION", ":", "return", "method", ".", "getHandleFromMemento", "(", "token", ",", "memento", ",", "workingCopyOwner", ")", ";", "default", ":", "return", "method", ";", "}", "case", "JEM_TYPE", ":", "String", "typeName", ";", "if", "(", "memento", ".", "hasMoreTokens", "(", ")", ")", "{", "typeName", "=", "memento", ".", "nextToken", "(", ")", ";", "char", "firstChar", "=", "typeName", ".", "charAt", "(", "0", ")", ";", "if", "(", "firstChar", "==", "JEM_FIELD", "||", "firstChar", "==", "JEM_INITIALIZER", "||", "firstChar", "==", "JEM_METHOD", "||", "firstChar", "==", "JEM_TYPE", "||", "firstChar", "==", "JEM_COUNT", ")", "{", "token", "=", "typeName", ";", "typeName", "=", "\"\"", ";", "}", "else", "{", "token", "=", "null", ";", "}", "}", "else", "{", "typeName", "=", "\"\"", ";", "token", "=", "null", ";", "}", "JavaElement", "type", "=", "(", "JavaElement", ")", "getType", "(", "typeName", ")", ";", "if", "(", "token", "==", "null", ")", "{", "return", "type", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "}", "else", "{", "return", "type", ".", "getHandleFromMemento", "(", "token", ",", "memento", ",", "workingCopyOwner", ")", ";", "}", "case", "JEM_TYPE_PARAMETER", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "typeParameterName", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "typeParameter", "=", "new", "TypeParameter", "(", "this", ",", "typeParameterName", ")", ";", "return", "typeParameter", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "case", "JEM_ANNOTATION", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "annotationName", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "annotation", "=", "new", "Annotation", "(", "this", ",", "annotationName", ")", ";", "return", "annotation", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "}", "return", "null", ";", "}", "public", "IInitializer", "getInitializer", "(", "int", "count", ")", "{", "return", "new", "Initializer", "(", "this", ",", "count", ")", ";", "}", "public", "IInitializer", "[", "]", "getInitializers", "(", ")", "throws", "JavaModelException", "{", "ArrayList", "list", "=", "getChildrenOfType", "(", "INITIALIZER", ")", ";", "IInitializer", "[", "]", "array", "=", "new", "IInitializer", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "array", ")", ";", "return", "array", ";", "}", "public", "String", "getKey", "(", ")", "{", "try", "{", "return", "getKey", "(", "this", ",", "false", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "IMethod", "getMethod", "(", "String", "selector", ",", "String", "[", "]", "parameterTypeSignatures", ")", "{", "return", "new", "SourceMethod", "(", "this", ",", "selector", ",", "parameterTypeSignatures", ")", ";", "}", "public", "IMethod", "[", "]", "getMethods", "(", ")", "throws", "JavaModelException", "{", "ArrayList", "list", "=", "getChildrenOfType", "(", "METHOD", ")", ";", "IMethod", "[", "]", "array", "=", "new", "IMethod", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "array", ")", ";", "return", "array", ";", "}", "public", "IPackageFragment", "getPackageFragment", "(", ")", "{", "IJavaElement", "parentElement", "=", "this", ".", "parent", ";", "while", "(", "parentElement", "!=", "null", ")", "{", "if", "(", "parentElement", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", "{", "return", "(", "IPackageFragment", ")", "parentElement", ";", "}", "else", "{", "parentElement", "=", "parentElement", ".", "getParent", "(", ")", ";", "}", "}", "Assert", ".", "isTrue", "(", "false", ")", ";", "return", "null", ";", "}", "public", "IJavaElement", "getPrimaryElement", "(", "boolean", "checkOwner", ")", "{", "if", "(", "checkOwner", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "getAncestor", "(", "COMPILATION_UNIT", ")", ";", "if", "(", "cu", ".", "isPrimary", "(", ")", ")", "return", "this", ";", "}", "IJavaElement", "primaryParent", "=", "this", ".", "parent", ".", "getPrimaryElement", "(", "false", ")", ";", "switch", "(", "primaryParent", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "return", "(", "(", "ICompilationUnit", ")", "primaryParent", ")", ".", "getType", "(", "this", ".", "name", ")", ";", "case", "IJavaElement", ".", "TYPE", ":", "return", "(", "(", "IType", ")", "primaryParent", ")", ".", "getType", "(", "this", ".", "name", ")", ";", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "INITIALIZER", ":", "case", "IJavaElement", ".", "METHOD", ":", "return", "(", "(", "IMember", ")", "primaryParent", ")", ".", "getType", "(", "this", ".", "name", ",", "this", ".", "occurrenceCount", ")", ";", "}", "return", "this", ";", "}", "public", "String", "getSuperclassName", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "char", "[", "]", "superclassName", "=", "info", ".", "getSuperclassName", "(", ")", ";", "if", "(", "superclassName", "==", "null", ")", "{", "return", "null", ";", "}", "return", "new", "String", "(", "superclassName", ")", ";", "}", "public", "String", "getSuperclassTypeSignature", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "char", "[", "]", "superclassName", "=", "info", ".", "getSuperclassName", "(", ")", ";", "if", "(", "superclassName", "==", "null", ")", "{", "return", "null", ";", "}", "return", "new", "String", "(", "Signature", ".", "createTypeSignature", "(", "superclassName", ",", "false", ")", ")", ";", "}", "public", "String", "[", "]", "getSuperInterfaceNames", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "char", "[", "]", "[", "]", "names", "=", "info", ".", "getInterfaceNames", "(", ")", ";", "return", "CharOperation", ".", "toStrings", "(", "names", ")", ";", "}", "public", "String", "[", "]", "getSuperInterfaceTypeSignatures", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "char", "[", "]", "[", "]", "names", "=", "info", ".", "getInterfaceNames", "(", ")", ";", "if", "(", "names", "==", "null", ")", "{", "return", "CharOperation", ".", "NO_STRINGS", ";", "}", "String", "[", "]", "strings", "=", "new", "String", "[", "names", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "names", ".", "length", ";", "i", "++", ")", "{", "strings", "[", "i", "]", "=", "new", "String", "(", "Signature", ".", "createTypeSignature", "(", "names", "[", "i", "]", ",", "false", ")", ")", ";", "}", "return", "strings", ";", "}", "public", "ITypeParameter", "[", "]", "getTypeParameters", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "typeParameters", ";", "}", "public", "String", "[", "]", "getTypeParameterSignatures", "(", ")", "throws", "JavaModelException", "{", "ITypeParameter", "[", "]", "typeParameters", "=", "getTypeParameters", "(", ")", ";", "int", "length", "=", "typeParameters", ".", "length", ";", "String", "[", "]", "typeParameterSignatures", "=", "new", "String", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "TypeParameter", "typeParameter", "=", "(", "TypeParameter", ")", "typeParameters", "[", "i", "]", ";", "TypeParameterElementInfo", "info", "=", "(", "TypeParameterElementInfo", ")", "typeParameter", ".", "getElementInfo", "(", ")", ";", "char", "[", "]", "[", "]", "bounds", "=", "info", ".", "bounds", ";", "if", "(", "bounds", "==", "null", ")", "{", "typeParameterSignatures", "[", "i", "]", "=", "Signature", ".", "createTypeParameterSignature", "(", "typeParameter", ".", "getElementName", "(", ")", ",", "CharOperation", ".", "NO_STRINGS", ")", ";", "}", "else", "{", "int", "boundsLength", "=", "bounds", ".", "length", ";", "char", "[", "]", "[", "]", "boundSignatures", "=", "new", "char", "[", "boundsLength", "]", "[", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "boundsLength", ";", "j", "++", ")", "{", "boundSignatures", "[", "j", "]", "=", "Signature", ".", "createCharArrayTypeSignature", "(", "bounds", "[", "j", "]", ",", "false", ")", ";", "}", "typeParameterSignatures", "[", "i", "]", "=", "new", "String", "(", "Signature", ".", "createTypeParameterSignature", "(", "typeParameter", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ",", "boundSignatures", ")", ")", ";", "}", "}", "return", "typeParameterSignatures", ";", "}", "public", "IType", "getType", "(", "String", "typeName", ")", "{", "return", "new", "SourceType", "(", "this", ",", "typeName", ")", ";", "}", "public", "ITypeParameter", "getTypeParameter", "(", "String", "typeParameterName", ")", "{", "return", "new", "TypeParameter", "(", "this", ",", "typeParameterName", ")", ";", "}", "public", "String", "getTypeQualifiedName", "(", ")", "{", "return", "this", ".", "getTypeQualifiedName", "(", "'$'", ")", ";", "}", "public", "String", "getTypeQualifiedName", "(", "char", "enclosingTypeSeparator", ")", "{", "try", "{", "return", "getTypeQualifiedName", "(", "enclosingTypeSeparator", ",", "false", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "IType", "[", "]", "getTypes", "(", ")", "throws", "JavaModelException", "{", "ArrayList", "list", "=", "getChildrenOfType", "(", "TYPE", ")", ";", "IType", "[", "]", "array", "=", "new", "IType", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "array", ")", ";", "return", "array", ";", "}", "public", "boolean", "isAnonymous", "(", ")", "{", "return", "this", ".", "name", ".", "length", "(", ")", "==", "0", ";", "}", "public", "boolean", "isClass", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "TypeDeclaration", ".", "kind", "(", "info", ".", "getModifiers", "(", ")", ")", "==", "TypeDeclaration", ".", "CLASS_DECL", ";", "}", "public", "boolean", "isEnum", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "TypeDeclaration", ".", "kind", "(", "info", ".", "getModifiers", "(", ")", ")", "==", "TypeDeclaration", ".", "ENUM_DECL", ";", "}", "public", "boolean", "isInterface", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "switch", "(", "TypeDeclaration", ".", "kind", "(", "info", ".", "getModifiers", "(", ")", ")", ")", "{", "case", "TypeDeclaration", ".", "INTERFACE_DECL", ":", "case", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ":", "return", "true", ";", "}", "return", "false", ";", "}", "public", "boolean", "isAnnotation", "(", ")", "throws", "JavaModelException", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "TypeDeclaration", ".", "kind", "(", "info", ".", "getModifiers", "(", ")", ")", "==", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ";", "}", "public", "boolean", "isLocal", "(", ")", "{", "switch", "(", "this", ".", "parent", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "METHOD", ":", "case", "IJavaElement", ".", "INITIALIZER", ":", "case", "IJavaElement", ".", "FIELD", ":", "return", "true", ";", "default", ":", "return", "false", ";", "}", "}", "public", "boolean", "isMember", "(", ")", "{", "return", "getDeclaringType", "(", ")", "!=", "null", ";", "}", "public", "boolean", "isResolved", "(", ")", "{", "return", "false", ";", "}", "public", "ITypeHierarchy", "loadTypeHierachy", "(", "InputStream", "input", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "loadTypeHierachy", "(", "input", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "monitor", ")", ";", "}", "public", "ITypeHierarchy", "loadTypeHierachy", "(", "InputStream", "input", ",", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "TypeHierarchy", ".", "load", "(", "this", ",", "input", ",", "owner", ")", ";", "}", "public", "ITypeHierarchy", "newSupertypeHierarchy", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "this", ".", "newSupertypeHierarchy", "(", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "monitor", ")", ";", "}", "public", "ITypeHierarchy", "newSupertypeHierarchy", "(", "ICompilationUnit", "[", "]", "workingCopies", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CreateTypeHierarchyOperation", "op", "=", "new", "CreateTypeHierarchyOperation", "(", "this", ",", "workingCopies", ",", "SearchEngine", ".", "createWorkspaceScope", "(", ")", ",", "false", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "op", ".", "getResult", "(", ")", ";", "}", "public", "ITypeHierarchy", "newSupertypeHierarchy", "(", "IWorkingCopy", "[", "]", "workingCopies", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "ICompilationUnit", "[", "]", "copies", ";", "if", "(", "workingCopies", "==", "null", ")", "{", "copies", "=", "null", ";", "}", "else", "{", "int", "length", "=", "workingCopies", ".", "length", ";", "System", ".", "arraycopy", "(", "workingCopies", ",", "0", ",", "copies", "=", "new", "ICompilationUnit", "[", "length", "]", ",", "0", ",", "length", ")", ";", "}", "return", "newSupertypeHierarchy", "(", "copies", ",", "monitor", ")", ";", "}", "public", "ITypeHierarchy", "newSupertypeHierarchy", "(", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "ICompilationUnit", "[", "]", "workingCopies", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkingCopies", "(", "owner", ",", "true", ")", ";", "CreateTypeHierarchyOperation", "op", "=", "new", "CreateTypeHierarchyOperation", "(", "this", ",", "workingCopies", ",", "SearchEngine", ".", "createWorkspaceScope", "(", ")", ",", "false", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "op", ".", "getResult", "(", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "IJavaProject", "project", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "newTypeHierarchy", "(", "project", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "monitor", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "IJavaProject", "project", ",", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "project", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "hierarchy_nullProject", ")", ";", "}", "ICompilationUnit", "[", "]", "workingCopies", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkingCopies", "(", "owner", ",", "true", ")", ";", "ICompilationUnit", "[", "]", "projectWCs", "=", "null", ";", "if", "(", "workingCopies", "!=", "null", ")", "{", "int", "length", "=", "workingCopies", ".", "length", ";", "projectWCs", "=", "new", "ICompilationUnit", "[", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ICompilationUnit", "wc", "=", "workingCopies", "[", "i", "]", ";", "if", "(", "project", ".", "equals", "(", "wc", ".", "getJavaProject", "(", ")", ")", ")", "{", "projectWCs", "[", "index", "++", "]", "=", "wc", ";", "}", "}", "if", "(", "index", "!=", "length", ")", "{", "System", ".", "arraycopy", "(", "projectWCs", ",", "0", ",", "projectWCs", "=", "new", "ICompilationUnit", "[", "index", "]", ",", "0", ",", "index", ")", ";", "}", "}", "CreateTypeHierarchyOperation", "op", "=", "new", "CreateTypeHierarchyOperation", "(", "this", ",", "projectWCs", ",", "project", ",", "true", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "op", ".", "getResult", "(", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "newTypeHierarchy", "(", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "monitor", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "ICompilationUnit", "[", "]", "workingCopies", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CreateTypeHierarchyOperation", "op", "=", "new", "CreateTypeHierarchyOperation", "(", "this", ",", "workingCopies", ",", "SearchEngine", ".", "createWorkspaceScope", "(", ")", ",", "true", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "op", ".", "getResult", "(", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "IWorkingCopy", "[", "]", "workingCopies", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "ICompilationUnit", "[", "]", "copies", ";", "if", "(", "workingCopies", "==", "null", ")", "{", "copies", "=", "null", ";", "}", "else", "{", "int", "length", "=", "workingCopies", ".", "length", ";", "System", ".", "arraycopy", "(", "workingCopies", ",", "0", ",", "copies", "=", "new", "ICompilationUnit", "[", "length", "]", ",", "0", ",", "length", ")", ";", "}", "return", "newTypeHierarchy", "(", "copies", ",", "monitor", ")", ";", "}", "public", "ITypeHierarchy", "newTypeHierarchy", "(", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "ICompilationUnit", "[", "]", "workingCopies", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getWorkingCopies", "(", "owner", ",", "true", ")", ";", "CreateTypeHierarchyOperation", "op", "=", "new", "CreateTypeHierarchyOperation", "(", "this", ",", "workingCopies", ",", "SearchEngine", ".", "createWorkspaceScope", "(", ")", ",", "true", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "op", ".", "getResult", "(", ")", ";", "}", "public", "JavaElement", "resolved", "(", "Binding", "binding", ")", "{", "SourceRefElement", "resolvedHandle", "=", "new", "ResolvedSourceType", "(", "this", ".", "parent", ",", "this", ".", "name", ",", "new", "String", "(", "binding", ".", "computeUniqueKey", "(", ")", ")", ")", ";", "resolvedHandle", ".", "occurrenceCount", "=", "this", ".", "occurrenceCount", ";", "return", "resolvedHandle", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "if", "(", "info", "==", "null", ")", "{", "String", "elementName", "=", "getElementName", "(", ")", ";", "if", "(", "elementName", ".", "length", "(", ")", "==", "0", ")", "{", "buffer", ".", "append", "(", "\"<anonymous", "#\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "else", "{", "toStringName", "(", "buffer", ")", ";", "}", "buffer", ".", "append", "(", "\"", "(not", "open)\"", ")", ";", "}", "else", "if", "(", "info", "==", "NO_INFO", ")", "{", "String", "elementName", "=", "getElementName", "(", ")", ";", "if", "(", "elementName", ".", "length", "(", ")", "==", "0", ")", "{", "buffer", ".", "append", "(", "\"<anonymous", "#\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "else", "{", "toStringName", "(", "buffer", ")", ";", "}", "}", "else", "{", "try", "{", "if", "(", "isEnum", "(", ")", ")", "{", "buffer", ".", "append", "(", "\"enum", "\"", ")", ";", "}", "else", "if", "(", "isAnnotation", "(", ")", ")", "{", "buffer", ".", "append", "(", "\"@interface", "\"", ")", ";", "}", "else", "if", "(", "isInterface", "(", ")", ")", "{", "buffer", ".", "append", "(", "\"interface", "\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "\"class", "\"", ")", ";", "}", "String", "elementName", "=", "getElementName", "(", ")", ";", "if", "(", "elementName", ".", "length", "(", ")", "==", "0", ")", "{", "buffer", ".", "append", "(", "\"<anonymous", "#\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "else", "{", "toStringName", "(", "buffer", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "buffer", ".", "append", "(", "\"\"", "+", "getElementName", "(", ")", ")", ";", "}", "}", "}", "}", "</s>" ]
3,703
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ISourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "SourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ISourceImport", ";", "public", "class", "ImportDeclarationElementInfo", "extends", "MemberElementInfo", "implements", "ISourceImport", "{", "protected", "int", "nameStart", "=", "-", "1", ";", "protected", "int", "nameEnd", "=", "-", "1", ";", "protected", "void", "setNameSourceEnd", "(", "int", "end", ")", "{", "this", ".", "nameEnd", "=", "end", ";", "}", "protected", "void", "setNameSourceStart", "(", "int", "start", ")", "{", "this", ".", "nameStart", "=", "start", ";", "}", "protected", "ISourceRange", "getNameRange", "(", ")", "{", "return", "new", "SourceRange", "(", "this", ".", "nameStart", ",", "this", ".", "nameEnd", "-", "this", ".", "nameStart", "+", "1", ")", ";", "}", "}", "</s>" ]
3,704
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "DefaultCodeFormatterConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "public", "class", "JavaCorePreferenceInitializer", "extends", "AbstractPreferenceInitializer", "{", "public", "void", "initializeDefaultPreferences", "(", ")", "{", "HashSet", "optionNames", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "optionNames", ";", "Map", "defaultOptionsMap", "=", "new", "CompilerOptions", "(", ")", ".", "getMap", "(", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_LOCAL_VARIABLE_ATTR", ",", "JavaCore", ".", "GENERATE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_CODEGEN_UNUSED_LOCAL", ",", "JavaCore", ".", "PRESERVE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_TAGS", ",", "JavaCore", ".", "DEFAULT_TASK_TAGS", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_PRIORITIES", ",", "JavaCore", ".", "DEFAULT_TASK_PRIORITIES", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_CASE_SENSITIVE", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_DOC_COMMENT_SUPPORT", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_PB_FORBIDDEN_REFERENCE", ",", "JavaCore", ".", "ERROR", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_RESOURCE_COPY_FILTER", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_INVALID_CLASSPATH", ",", "JavaCore", ".", "ABORT", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_DUPLICATE_RESOURCE", ",", "JavaCore", ".", "WARNING", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER", ",", "JavaCore", ".", "CLEAN", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER", ",", "JavaCore", ".", "IGNORE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_ORDER", ",", "JavaCore", ".", "IGNORE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_INCOMPLETE_CLASSPATH", ",", "JavaCore", ".", "ERROR", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_CIRCULAR_CLASSPATH", ",", "JavaCore", ".", "ERROR", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_INCOMPATIBLE_JDK_LEVEL", ",", "JavaCore", ".", "IGNORE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ",", "JavaCore", ".", "WARNING", ")", ";", "optionNames", ".", "add", "(", "JavaCore", ".", "CORE_ENCODING", ")", ";", "Map", "codeFormatterOptionsMap", "=", "DefaultCodeFormatterConstants", ".", "getEclipseDefaultSettings", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "codeFormatterOptionsMap", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iter", ".", "next", "(", ")", ";", "String", "optionName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "defaultOptionsMap", ".", "put", "(", "optionName", ",", "entry", ".", "getValue", "(", ")", ")", ";", "optionNames", ".", "add", "(", "optionName", ")", ";", "}", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_VISIBILITY_CHECK", ",", "JavaCore", ".", "DISABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_DEPRECATION_CHECK", ",", "JavaCore", ".", "DISABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_IMPLICIT_QUALIFICATION", ",", "JavaCore", ".", "DISABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_FIELD_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_STATIC_FIELD_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_STATIC_FINAL_FIELD_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_LOCAL_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_ARGUMENT_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_FIELD_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_STATIC_FIELD_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_LOCAL_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_ARGUMENT_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_FORBIDDEN_REFERENCE_CHECK", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_DISCOURAGED_REFERENCE_CHECK", ",", "JavaCore", ".", "DISABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_CAMEL_CASE_MATCH", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_SUGGEST_STATIC_IMPORTS", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC", ",", "\"50\"", ")", ";", "IEclipsePreferences", "defaultPreferences", "=", "DefaultScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "for", "(", "Iterator", "iter", "=", "defaultOptionsMap", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iter", ".", "next", "(", ")", ";", "String", "optionName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "defaultPreferences", ".", "put", "(", "optionName", ",", "(", "String", ")", "entry", ".", "getValue", "(", ")", ")", ";", "optionNames", ".", "add", "(", "optionName", ")", ";", "}", "initializeDeprecatedOptions", "(", ")", ";", "}", "private", "void", "initializeDeprecatedOptions", "(", ")", "{", "Map", "deprecatedOptions", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "deprecatedOptions", ";", "deprecatedOptions", ".", "put", "(", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER", ",", "new", "String", "[", "]", "{", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD", ",", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD", ",", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE", ",", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE", "}", ")", ";", "deprecatedOptions", ".", "put", "(", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION", ",", "new", "String", "[", "]", "{", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD", ",", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD", ",", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE", ",", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE", ",", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE", ",", "DefaultCodeFormatterConstants", ".", "FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER", "}", ")", ";", "}", "}", "</s>" ]
3,705
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "SourceMethod", "extends", "NamedMember", "implements", "IMethod", "{", "protected", "String", "[", "]", "parameterTypes", ";", "protected", "SourceMethod", "(", "JavaElement", "parent", ",", "String", "name", ",", "String", "[", "]", "parameterTypes", ")", "{", "super", "(", "parent", ",", "name", ")", ";", "if", "(", "parameterTypes", "==", "null", ")", "{", "this", ".", "parameterTypes", "=", "CharOperation", ".", "NO_STRINGS", ";", "}", "else", "{", "this", ".", "parameterTypes", "=", "parameterTypes", ";", "}", "}", "protected", "void", "closing", "(", "Object", "info", ")", "throws", "JavaModelException", "{", "super", ".", "closing", "(", "info", ")", ";", "SourceMethodElementInfo", "elementInfo", "=", "(", "SourceMethodElementInfo", ")", "info", ";", "ITypeParameter", "[", "]", "typeParameters", "=", "elementInfo", ".", "typeParameters", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "typeParameters", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "(", "(", "TypeParameter", ")", "typeParameters", "[", "i", "]", ")", ".", "close", "(", ")", ";", "}", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "SourceMethod", ")", ")", "return", "false", ";", "return", "super", ".", "equals", "(", "o", ")", "&&", "Util", ".", "equalArraysOrNull", "(", "this", ".", "parameterTypes", ",", "(", "(", "SourceMethod", ")", "o", ")", ".", "parameterTypes", ")", ";", "}", "public", "IMemberValuePair", "getDefaultValue", "(", ")", "throws", "JavaModelException", "{", "SourceMethodElementInfo", "sourceMethodInfo", "=", "(", "SourceMethodElementInfo", ")", "getElementInfo", "(", ")", ";", "if", "(", "sourceMethodInfo", ".", "isAnnotationMethod", "(", ")", ")", "{", "return", "(", "(", "SourceAnnotationMethodInfo", ")", "sourceMethodInfo", ")", ".", "defaultValue", ";", "}", "return", "null", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "METHOD", ";", "}", "public", "String", "[", "]", "getExceptionTypes", "(", ")", "throws", "JavaModelException", "{", "SourceMethodElementInfo", "info", "=", "(", "SourceMethodElementInfo", ")", "getElementInfo", "(", ")", ";", "char", "[", "]", "[", "]", "exs", "=", "info", ".", "getExceptionTypeNames", "(", ")", ";", "return", "CompilationUnitStructureRequestor", ".", "convertTypeNamesToSigs", "(", "exs", ")", ";", "}", "protected", "void", "getHandleMemento", "(", "StringBuffer", "buff", ")", "{", "(", "(", "JavaElement", ")", "getParent", "(", ")", ")", ".", "getHandleMemento", "(", "buff", ")", ";", "char", "delimiter", "=", "getHandleMementoDelimiter", "(", ")", ";", "buff", ".", "append", "(", "delimiter", ")", ";", "escapeMementoName", "(", "buff", ",", "getElementName", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "parameterTypes", ".", "length", ";", "i", "++", ")", "{", "buff", ".", "append", "(", "delimiter", ")", ";", "escapeMementoName", "(", "buff", ",", "this", ".", "parameterTypes", "[", "i", "]", ")", ";", "}", "if", "(", "this", ".", "occurrenceCount", ">", "1", ")", "{", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "}", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JavaElement", ".", "JEM_METHOD", ";", "}", "public", "String", "getKey", "(", ")", "{", "try", "{", "return", "getKey", "(", "this", ",", "false", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "int", "getNumberOfParameters", "(", ")", "{", "return", "this", ".", "parameterTypes", "==", "null", "?", "0", ":", "this", ".", "parameterTypes", ".", "length", ";", "}", "public", "String", "[", "]", "getParameterNames", "(", ")", "throws", "JavaModelException", "{", "SourceMethodElementInfo", "info", "=", "(", "SourceMethodElementInfo", ")", "getElementInfo", "(", ")", ";", "char", "[", "]", "[", "]", "names", "=", "info", ".", "getArgumentNames", "(", ")", ";", "return", "CharOperation", ".", "toStrings", "(", "names", ")", ";", "}", "public", "String", "[", "]", "getParameterTypes", "(", ")", "{", "return", "this", ".", "parameterTypes", ";", "}", "public", "ITypeParameter", "getTypeParameter", "(", "String", "typeParameterName", ")", "{", "return", "new", "TypeParameter", "(", "this", ",", "typeParameterName", ")", ";", "}", "public", "ITypeParameter", "[", "]", "getTypeParameters", "(", ")", "throws", "JavaModelException", "{", "SourceMethodElementInfo", "info", "=", "(", "SourceMethodElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "typeParameters", ";", "}", "public", "ILocalVariable", "[", "]", "getParameters", "(", ")", "throws", "JavaModelException", "{", "ILocalVariable", "[", "]", "arguments", "=", "(", "(", "SourceMethodElementInfo", ")", "getElementInfo", "(", ")", ")", ".", "arguments", ";", "if", "(", "arguments", "==", "null", ")", "return", "LocalVariable", ".", "NO_LOCAL_VARIABLES", ";", "return", "arguments", ";", "}", "public", "String", "[", "]", "getTypeParameterSignatures", "(", ")", "throws", "JavaModelException", "{", "ITypeParameter", "[", "]", "typeParameters", "=", "getTypeParameters", "(", ")", ";", "int", "length", "=", "typeParameters", ".", "length", ";", "String", "[", "]", "typeParameterSignatures", "=", "new", "String", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "TypeParameter", "typeParameter", "=", "(", "TypeParameter", ")", "typeParameters", "[", "i", "]", ";", "TypeParameterElementInfo", "info", "=", "(", "TypeParameterElementInfo", ")", "typeParameter", ".", "getElementInfo", "(", ")", ";", "char", "[", "]", "[", "]", "bounds", "=", "info", ".", "bounds", ";", "if", "(", "bounds", "==", "null", ")", "{", "typeParameterSignatures", "[", "i", "]", "=", "Signature", ".", "createTypeParameterSignature", "(", "typeParameter", ".", "getElementName", "(", ")", ",", "CharOperation", ".", "NO_STRINGS", ")", ";", "}", "else", "{", "int", "boundsLength", "=", "bounds", ".", "length", ";", "char", "[", "]", "[", "]", "boundSignatures", "=", "new", "char", "[", "boundsLength", "]", "[", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "boundsLength", ";", "j", "++", ")", "{", "boundSignatures", "[", "j", "]", "=", "Signature", ".", "createCharArrayTypeSignature", "(", "bounds", "[", "j", "]", ",", "false", ")", ";", "}", "typeParameterSignatures", "[", "i", "]", "=", "new", "String", "(", "Signature", ".", "createTypeParameterSignature", "(", "typeParameter", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ",", "boundSignatures", ")", ")", ";", "}", "}", "return", "typeParameterSignatures", ";", "}", "public", "IJavaElement", "getPrimaryElement", "(", "boolean", "checkOwner", ")", "{", "if", "(", "checkOwner", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "getAncestor", "(", "COMPILATION_UNIT", ")", ";", "if", "(", "cu", ".", "isPrimary", "(", ")", ")", "return", "this", ";", "}", "IJavaElement", "primaryParent", "=", "this", ".", "parent", ".", "getPrimaryElement", "(", "false", ")", ";", "return", "(", "(", "IType", ")", "primaryParent", ")", ".", "getMethod", "(", "this", ".", "name", ",", "this", ".", "parameterTypes", ")", ";", "}", "public", "String", "[", "]", "getRawParameterNames", "(", ")", "throws", "JavaModelException", "{", "return", "getParameterNames", "(", ")", ";", "}", "public", "String", "getReturnType", "(", ")", "throws", "JavaModelException", "{", "SourceMethodElementInfo", "info", "=", "(", "SourceMethodElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "Signature", ".", "createTypeSignature", "(", "info", ".", "getReturnTypeName", "(", ")", ",", "false", ")", ";", "}", "public", "String", "getSignature", "(", ")", "throws", "JavaModelException", "{", "SourceMethodElementInfo", "info", "=", "(", "SourceMethodElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "Signature", ".", "createMethodSignature", "(", "this", ".", "parameterTypes", ",", "Signature", ".", "createTypeSignature", "(", "info", ".", "getReturnTypeName", "(", ")", ",", "false", ")", ")", ";", "}", "public", "int", "hashCode", "(", ")", "{", "int", "hash", "=", "super", ".", "hashCode", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "parameterTypes", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "hash", "=", "Util", ".", "combineHashCodes", "(", "hash", ",", "this", ".", "parameterTypes", "[", "i", "]", ".", "hashCode", "(", ")", ")", ";", "}", "return", "hash", ";", "}", "public", "boolean", "isConstructor", "(", ")", "throws", "JavaModelException", "{", "if", "(", "!", "getElementName", "(", ")", ".", "equals", "(", "this", ".", "parent", ".", "getElementName", "(", ")", ")", ")", "{", "return", "false", ";", "}", "SourceMethodElementInfo", "info", "=", "(", "SourceMethodElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "isConstructor", "(", ")", ";", "}", "public", "boolean", "isMainMethod", "(", ")", "throws", "JavaModelException", "{", "return", "this", ".", "isMainMethod", "(", "this", ")", ";", "}", "public", "boolean", "isResolved", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isSimilar", "(", "IMethod", "method", ")", "{", "return", "areSimilarMethods", "(", "getElementName", "(", ")", ",", "getParameterTypes", "(", ")", ",", "method", ".", "getElementName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ",", "null", ")", ";", "}", "public", "String", "readableName", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "super", ".", "readableName", "(", ")", ")", ";", "buffer", ".", "append", "(", "'('", ")", ";", "int", "length", ";", "if", "(", "this", ".", "parameterTypes", "!=", "null", "&&", "(", "length", "=", "this", ".", "parameterTypes", ".", "length", ")", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "this", ".", "parameterTypes", "[", "i", "]", ")", ")", ";", "if", "(", "i", "<", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "}", "buffer", ".", "append", "(", "')'", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "public", "JavaElement", "resolved", "(", "Binding", "binding", ")", "{", "SourceRefElement", "resolvedHandle", "=", "new", "ResolvedSourceMethod", "(", "this", ".", "parent", ",", "this", ".", "name", ",", "this", ".", "parameterTypes", ",", "new", "String", "(", "binding", ".", "computeUniqueKey", "(", ")", ")", ")", ";", "resolvedHandle", ".", "occurrenceCount", "=", "this", ".", "occurrenceCount", ";", "return", "resolvedHandle", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "if", "(", "info", "==", "null", ")", "{", "toStringName", "(", "buffer", ")", ";", "buffer", ".", "append", "(", "\"", "(not", "open)\"", ")", ";", "}", "else", "if", "(", "info", "==", "NO_INFO", ")", "{", "toStringName", "(", "buffer", ")", ";", "}", "else", "{", "SourceMethodElementInfo", "methodInfo", "=", "(", "SourceMethodElementInfo", ")", "info", ";", "int", "flags", "=", "methodInfo", ".", "getModifiers", "(", ")", ";", "if", "(", "Flags", ".", "isStatic", "(", "flags", ")", ")", "{", "buffer", ".", "append", "(", "\"static", "\"", ")", ";", "}", "if", "(", "!", "methodInfo", ".", "isConstructor", "(", ")", ")", "{", "buffer", ".", "append", "(", "methodInfo", ".", "getReturnTypeName", "(", ")", ")", ";", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "toStringName", "(", "buffer", ",", "flags", ")", ";", "}", "}", "protected", "void", "toStringName", "(", "StringBuffer", "buffer", ")", "{", "toStringName", "(", "buffer", ",", "0", ")", ";", "}", "protected", "void", "toStringName", "(", "StringBuffer", "buffer", ",", "int", "flags", ")", "{", "buffer", ".", "append", "(", "getElementName", "(", ")", ")", ";", "buffer", ".", "append", "(", "'('", ")", ";", "String", "[", "]", "parameters", "=", "getParameterTypes", "(", ")", ";", "int", "length", ";", "if", "(", "parameters", "!=", "null", "&&", "(", "length", "=", "parameters", ".", "length", ")", ">", "0", ")", "{", "boolean", "isVarargs", "=", "Flags", ".", "isVarargs", "(", "flags", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "try", "{", "if", "(", "i", "<", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "parameters", "[", "i", "]", ")", ")", ";", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "else", "if", "(", "isVarargs", ")", "{", "String", "parameter", "=", "parameters", "[", "i", "]", ".", "substring", "(", "1", ")", ";", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "parameter", ")", ")", ";", "buffer", ".", "append", "(", "\"", "...\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "parameters", "[", "i", "]", ")", ")", ";", "}", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "parameters", "[", "i", "]", ")", ";", "}", "}", "}", "buffer", ".", "append", "(", "')'", ")", ";", "if", "(", "this", ".", "occurrenceCount", ">", "1", ")", "{", "buffer", ".", "append", "(", "\"#\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "}", "}", "}", "</s>" ]
3,706
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProjectDescription", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspaceRoot", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspaceRunnable", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "ISchedulingRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "ProjectReferenceChange", "{", "private", "JavaProject", "project", ";", "private", "IClasspathEntry", "[", "]", "oldResolvedClasspath", ";", "public", "ProjectReferenceChange", "(", "JavaProject", "project", ",", "IClasspathEntry", "[", "]", "oldResolvedClasspath", ")", "{", "this", ".", "project", "=", "project", ";", "this", ".", "oldResolvedClasspath", "=", "oldResolvedClasspath", ";", "}", "public", "void", "updateProjectReferencesIfNecessary", "(", ")", "throws", "JavaModelException", "{", "String", "[", "]", "oldRequired", "=", "this", ".", "oldResolvedClasspath", "==", "null", "?", "CharOperation", ".", "NO_STRINGS", ":", "this", ".", "project", ".", "projectPrerequisites", "(", "this", ".", "oldResolvedClasspath", ")", ";", "IClasspathEntry", "[", "]", "newResolvedClasspath", "=", "this", ".", "project", ".", "getResolvedClasspath", "(", ")", ";", "String", "[", "]", "newRequired", "=", "this", ".", "project", ".", "projectPrerequisites", "(", "newResolvedClasspath", ")", ";", "final", "IProject", "projectResource", "=", "this", ".", "project", ".", "getProject", "(", ")", ";", "try", "{", "IProject", "[", "]", "projectReferences", "=", "projectResource", ".", "getDescription", "(", ")", ".", "getDynamicReferences", "(", ")", ";", "HashSet", "oldReferences", "=", "new", "HashSet", "(", "projectReferences", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projectReferences", ".", "length", ";", "i", "++", ")", "{", "String", "projectName", "=", "projectReferences", "[", "i", "]", ".", "getName", "(", ")", ";", "oldReferences", ".", "add", "(", "projectName", ")", ";", "}", "HashSet", "newReferences", "=", "(", "HashSet", ")", "oldReferences", ".", "clone", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "oldRequired", ".", "length", ";", "i", "++", ")", "{", "String", "projectName", "=", "oldRequired", "[", "i", "]", ";", "newReferences", ".", "remove", "(", "projectName", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newRequired", ".", "length", ";", "i", "++", ")", "{", "String", "projectName", "=", "newRequired", "[", "i", "]", ";", "newReferences", ".", "add", "(", "projectName", ")", ";", "}", "Iterator", "iter", ";", "int", "newSize", "=", "newReferences", ".", "size", "(", ")", ";", "checkIdentity", ":", "{", "if", "(", "oldReferences", ".", "size", "(", ")", "==", "newSize", ")", "{", "iter", "=", "newReferences", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "if", "(", "!", "oldReferences", ".", "contains", "(", "iter", ".", "next", "(", ")", ")", ")", "{", "break", "checkIdentity", ";", "}", "}", "return", ";", "}", "}", "String", "[", "]", "requiredProjectNames", "=", "new", "String", "[", "newSize", "]", ";", "int", "index", "=", "0", ";", "iter", "=", "newReferences", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "requiredProjectNames", "[", "index", "++", "]", "=", "(", "String", ")", "iter", ".", "next", "(", ")", ";", "}", "Util", ".", "sort", "(", "requiredProjectNames", ")", ";", "final", "IProject", "[", "]", "requiredProjectArray", "=", "new", "IProject", "[", "newSize", "]", ";", "IWorkspaceRoot", "wksRoot", "=", "projectResource", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newSize", ";", "i", "++", ")", "{", "requiredProjectArray", "[", "i", "]", "=", "wksRoot", ".", "getProject", "(", "requiredProjectNames", "[", "i", "]", ")", ";", "}", "IWorkspace", "workspace", "=", "projectResource", ".", "getWorkspace", "(", ")", ";", "ISchedulingRule", "rule", "=", "workspace", ".", "getRuleFactory", "(", ")", ".", "modifyRule", "(", "projectResource", ")", ";", "IWorkspaceRunnable", "runnable", "=", "new", "IWorkspaceRunnable", "(", ")", "{", "public", "void", "run", "(", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "IProjectDescription", "description", "=", "projectResource", ".", "getDescription", "(", ")", ";", "description", ".", "setDynamicReferences", "(", "requiredProjectArray", ")", ";", "projectResource", ".", "setDescription", "(", "description", ",", "IResource", ".", "AVOID_NATURE_CONFIG", ",", "null", ")", ";", "}", "}", ";", "workspace", ".", "run", "(", "runnable", ",", "rule", ",", "IWorkspace", ".", "AVOID_UPDATE", ",", "null", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "!", "ExternalJavaProject", ".", "EXTERNAL_PROJECT_NAME", ".", "equals", "(", "this", ".", "project", ".", "getElementName", "(", ")", ")", ")", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "this", ".", "project", ".", "getElementName", "(", ")", ";", "}", "}", "</s>" ]
3,707
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "OutputStreamWriter", ";", "import", "java", ".", "io", ".", "UnsupportedEncodingException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipEntry", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IContainer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspaceRoot", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAccessRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathAttribute", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathContainer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRestriction", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "ManifestAnalyzer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "w3c", ".", "dom", ".", "DOMException", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Element", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NamedNodeMap", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Node", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Text", ";", "public", "class", "ClasspathEntry", "implements", "IClasspathEntry", "{", "public", "static", "class", "AssertionFailedException", "extends", "RuntimeException", "{", "private", "static", "final", "long", "serialVersionUID", "=", "-", "171699380721189572L", ";", "public", "AssertionFailedException", "(", "String", "message", ")", "{", "super", "(", "message", ")", ";", "}", "}", "public", "static", "final", "String", "TAG_CLASSPATH", "=", "\"classpath\"", ";", "public", "static", "final", "String", "TAG_CLASSPATHENTRY", "=", "\"\"", ";", "public", "static", "final", "String", "TAG_REFERENCED_ENTRY", "=", "\"\"", ";", "public", "static", "final", "String", "TAG_OUTPUT", "=", "\"output\"", ";", "public", "static", "final", "String", "TAG_KIND", "=", "\"kind\"", ";", "public", "static", "final", "String", "TAG_PATH", "=", "\"path\"", ";", "public", "static", "final", "String", "TAG_SOURCEPATH", "=", "\"sourcepath\"", ";", "public", "static", "final", "String", "TAG_ROOTPATH", "=", "\"rootpath\"", ";", "public", "static", "final", "String", "TAG_EXPORTED", "=", "\"exported\"", ";", "public", "static", "final", "String", "TAG_INCLUDING", "=", "\"including\"", ";", "public", "static", "final", "String", "TAG_EXCLUDING", "=", "\"excluding\"", ";", "public", "static", "final", "String", "TAG_ATTRIBUTES", "=", "\"attributes\"", ";", "public", "static", "final", "String", "TAG_ATTRIBUTE", "=", "\"attribute\"", ";", "public", "static", "final", "String", "TAG_ATTRIBUTE_NAME", "=", "\"name\"", ";", "public", "static", "final", "String", "TAG_ATTRIBUTE_VALUE", "=", "\"value\"", ";", "public", "static", "final", "String", "TAG_COMBINE_ACCESS_RULES", "=", "\"\"", ";", "public", "static", "final", "String", "TAG_ACCESS_RULES", "=", "\"accessrules\"", ";", "public", "static", "final", "String", "TAG_ACCESS_RULE", "=", "\"accessrule\"", ";", "public", "static", "final", "String", "TAG_PATTERN", "=", "\"pattern\"", ";", "public", "static", "final", "String", "TAG_ACCESSIBLE", "=", "\"accessible\"", ";", "public", "static", "final", "String", "TAG_NON_ACCESSIBLE", "=", "\"\"", ";", "public", "static", "final", "String", "TAG_DISCOURAGED", "=", "\"discouraged\"", ";", "public", "static", "final", "String", "TAG_IGNORE_IF_BETTER", "=", "\"\"", ";", "public", "int", "entryKind", ";", "public", "int", "contentKind", ";", "public", "IPath", "path", ";", "private", "IPath", "[", "]", "inclusionPatterns", ";", "private", "char", "[", "]", "[", "]", "fullInclusionPatternChars", ";", "private", "IPath", "[", "]", "exclusionPatterns", ";", "private", "char", "[", "]", "[", "]", "fullExclusionPatternChars", ";", "private", "final", "static", "char", "[", "]", "[", "]", "UNINIT_PATTERNS", "=", "new", "char", "[", "]", "[", "]", "{", "\"\"", ".", "toCharArray", "(", ")", "}", ";", "public", "final", "static", "ClasspathEntry", "[", "]", "NO_ENTRIES", "=", "new", "ClasspathEntry", "[", "0", "]", ";", "private", "final", "static", "IPath", "[", "]", "NO_PATHS", "=", "new", "IPath", "[", "0", "]", ";", "private", "final", "static", "IWorkspaceRoot", "workspaceRoot", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "private", "boolean", "combineAccessRules", ";", "private", "String", "rootID", ";", "private", "AccessRuleSet", "accessRuleSet", ";", "static", "class", "UnknownXmlElements", "{", "String", "[", "]", "attributes", ";", "ArrayList", "children", ";", "}", "public", "final", "static", "IPath", "[", "]", "INCLUDE_ALL", "=", "{", "}", ";", "public", "final", "static", "IPath", "[", "]", "EXCLUDE_NONE", "=", "{", "}", ";", "public", "final", "static", "IClasspathAttribute", "[", "]", "NO_EXTRA_ATTRIBUTES", "=", "{", "}", ";", "public", "final", "static", "IAccessRule", "[", "]", "NO_ACCESS_RULES", "=", "{", "}", ";", "public", "IPath", "sourceAttachmentPath", ";", "public", "IPath", "sourceAttachmentRootPath", ";", "public", "IClasspathEntry", "referencingEntry", ";", "public", "IPath", "specificOutputLocation", ";", "public", "static", "final", "int", "K_OUTPUT", "=", "10", ";", "public", "static", "final", "String", "DOT_DOT", "=", "\"..\"", ";", "public", "boolean", "isExported", ";", "public", "IClasspathAttribute", "[", "]", "extraAttributes", ";", "public", "ClasspathEntry", "(", "int", "contentKind", ",", "int", "entryKind", ",", "IPath", "path", ",", "IPath", "[", "]", "inclusionPatterns", ",", "IPath", "[", "]", "exclusionPatterns", ",", "IPath", "sourceAttachmentPath", ",", "IPath", "sourceAttachmentRootPath", ",", "IPath", "specificOutputLocation", ",", "boolean", "isExported", ",", "IAccessRule", "[", "]", "accessRules", ",", "boolean", "combineAccessRules", ",", "IClasspathAttribute", "[", "]", "extraAttributes", ")", "{", "this", "(", "contentKind", ",", "entryKind", ",", "path", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "sourceAttachmentPath", ",", "sourceAttachmentRootPath", ",", "specificOutputLocation", ",", "null", ",", "isExported", ",", "accessRules", ",", "combineAccessRules", ",", "extraAttributes", ")", ";", "}", "public", "ClasspathEntry", "(", "int", "contentKind", ",", "int", "entryKind", ",", "IPath", "path", ",", "IPath", "[", "]", "inclusionPatterns", ",", "IPath", "[", "]", "exclusionPatterns", ",", "IPath", "sourceAttachmentPath", ",", "IPath", "sourceAttachmentRootPath", ",", "IPath", "specificOutputLocation", ",", "IClasspathEntry", "referencingEntry", ",", "boolean", "isExported", ",", "IAccessRule", "[", "]", "accessRules", ",", "boolean", "combineAccessRules", ",", "IClasspathAttribute", "[", "]", "extraAttributes", ")", "{", "this", ".", "contentKind", "=", "contentKind", ";", "this", ".", "entryKind", "=", "entryKind", ";", "this", ".", "path", "=", "path", ";", "this", ".", "inclusionPatterns", "=", "inclusionPatterns", ";", "this", ".", "exclusionPatterns", "=", "exclusionPatterns", ";", "this", ".", "referencingEntry", "=", "referencingEntry", ";", "int", "length", ";", "if", "(", "accessRules", "!=", "null", "&&", "(", "length", "=", "accessRules", ".", "length", ")", ">", "0", ")", "{", "AccessRule", "[", "]", "rules", "=", "new", "AccessRule", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "accessRules", ",", "0", ",", "rules", ",", "0", ",", "length", ")", ";", "byte", "classpathEntryType", ";", "String", "classpathEntryName", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "if", "(", "this", ".", "entryKind", "==", "CPE_PROJECT", "||", "this", ".", "entryKind", "==", "CPE_SOURCE", ")", "{", "classpathEntryType", "=", "AccessRestriction", ".", "PROJECT", ";", "classpathEntryName", "=", "manager", ".", "intern", "(", "getPath", "(", ")", ".", "segment", "(", "0", ")", ")", ";", "}", "else", "{", "classpathEntryType", "=", "AccessRestriction", ".", "LIBRARY", ";", "Object", "target", "=", "JavaModel", ".", "getWorkspaceTarget", "(", "path", ")", ";", "if", "(", "target", "==", "null", ")", "{", "classpathEntryName", "=", "manager", ".", "intern", "(", "path", ".", "toOSString", "(", ")", ")", ";", "}", "else", "{", "classpathEntryName", "=", "manager", ".", "intern", "(", "path", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "this", ".", "accessRuleSet", "=", "new", "AccessRuleSet", "(", "rules", ",", "classpathEntryType", ",", "classpathEntryName", ")", ";", "}", "this", ".", "combineAccessRules", "=", "combineAccessRules", ";", "this", ".", "extraAttributes", "=", "extraAttributes", ";", "if", "(", "inclusionPatterns", "!=", "INCLUDE_ALL", "&&", "inclusionPatterns", ".", "length", ">", "0", ")", "{", "this", ".", "fullInclusionPatternChars", "=", "UNINIT_PATTERNS", ";", "}", "if", "(", "exclusionPatterns", ".", "length", ">", "0", ")", "{", "this", ".", "fullExclusionPatternChars", "=", "UNINIT_PATTERNS", ";", "}", "this", ".", "sourceAttachmentPath", "=", "sourceAttachmentPath", ";", "this", ".", "sourceAttachmentRootPath", "=", "sourceAttachmentRootPath", ";", "this", ".", "specificOutputLocation", "=", "specificOutputLocation", ";", "this", ".", "isExported", "=", "isExported", ";", "}", "public", "boolean", "combineAccessRules", "(", ")", "{", "return", "this", ".", "combineAccessRules", ";", "}", "public", "ClasspathEntry", "combineWith", "(", "ClasspathEntry", "referringEntry", ")", "{", "if", "(", "referringEntry", "==", "null", ")", "return", "this", ";", "if", "(", "referringEntry", ".", "isExported", "(", ")", "||", "referringEntry", ".", "getAccessRuleSet", "(", ")", "!=", "null", ")", "{", "boolean", "combine", "=", "this", ".", "entryKind", "==", "CPE_SOURCE", "||", "referringEntry", ".", "combineAccessRules", "(", ")", ";", "return", "new", "ClasspathEntry", "(", "getContentKind", "(", ")", ",", "getEntryKind", "(", ")", ",", "getPath", "(", ")", ",", "this", ".", "inclusionPatterns", ",", "this", ".", "exclusionPatterns", ",", "getSourceAttachmentPath", "(", ")", ",", "getSourceAttachmentRootPath", "(", ")", ",", "getOutputLocation", "(", ")", ",", "referringEntry", ".", "isExported", "(", ")", "||", "this", ".", "isExported", ",", "combine", "(", "referringEntry", ".", "getAccessRules", "(", ")", ",", "getAccessRules", "(", ")", ",", "combine", ")", ",", "this", ".", "combineAccessRules", ",", "this", ".", "extraAttributes", ")", ";", "}", "return", "this", ";", "}", "private", "IAccessRule", "[", "]", "combine", "(", "IAccessRule", "[", "]", "referringRules", ",", "IAccessRule", "[", "]", "rules", ",", "boolean", "combine", ")", "{", "if", "(", "!", "combine", ")", "return", "rules", ";", "if", "(", "rules", "==", "null", "||", "rules", ".", "length", "==", "0", ")", "return", "referringRules", ";", "int", "referringRulesLength", "=", "referringRules", ".", "length", ";", "int", "accessRulesLength", "=", "rules", ".", "length", ";", "int", "rulesLength", "=", "referringRulesLength", "+", "accessRulesLength", ";", "IAccessRule", "[", "]", "result", "=", "new", "IAccessRule", "[", "rulesLength", "]", ";", "System", ".", "arraycopy", "(", "referringRules", ",", "0", ",", "result", ",", "0", ",", "referringRulesLength", ")", ";", "System", ".", "arraycopy", "(", "rules", ",", "0", ",", "result", ",", "referringRulesLength", ",", "accessRulesLength", ")", ";", "return", "result", ";", "}", "static", "IClasspathAttribute", "[", "]", "decodeExtraAttributes", "(", "NodeList", "attributes", ")", "{", "if", "(", "attributes", "==", "null", ")", "return", "NO_EXTRA_ATTRIBUTES", ";", "int", "length", "=", "attributes", ".", "getLength", "(", ")", ";", "if", "(", "length", "==", "0", ")", "return", "NO_EXTRA_ATTRIBUTES", ";", "IClasspathAttribute", "[", "]", "result", "=", "new", "IClasspathAttribute", "[", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "++", "i", ")", "{", "Node", "node", "=", "attributes", ".", "item", "(", "i", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "Element", "attribute", "=", "(", "Element", ")", "node", ";", "String", "name", "=", "attribute", ".", "getAttribute", "(", "TAG_ATTRIBUTE_NAME", ")", ";", "if", "(", "name", "==", "null", ")", "continue", ";", "String", "value", "=", "attribute", ".", "getAttribute", "(", "TAG_ATTRIBUTE_VALUE", ")", ";", "if", "(", "value", "==", "null", ")", "continue", ";", "result", "[", "index", "++", "]", "=", "new", "ClasspathAttribute", "(", "name", ",", "value", ")", ";", "}", "}", "if", "(", "index", "!=", "length", ")", "System", ".", "arraycopy", "(", "result", ",", "0", ",", "result", "=", "new", "IClasspathAttribute", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "result", ";", "}", "static", "IAccessRule", "[", "]", "decodeAccessRules", "(", "NodeList", "list", ")", "{", "if", "(", "list", "==", "null", ")", "return", "null", ";", "int", "length", "=", "list", ".", "getLength", "(", ")", ";", "if", "(", "length", "==", "0", ")", "return", "null", ";", "IAccessRule", "[", "]", "result", "=", "new", "IAccessRule", "[", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Node", "accessRule", "=", "list", ".", "item", "(", "i", ")", ";", "if", "(", "accessRule", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "Element", "elementAccessRule", "=", "(", "Element", ")", "accessRule", ";", "String", "pattern", "=", "elementAccessRule", ".", "getAttribute", "(", "TAG_PATTERN", ")", ";", "if", "(", "pattern", "==", "null", ")", "continue", ";", "String", "tagKind", "=", "elementAccessRule", ".", "getAttribute", "(", "TAG_KIND", ")", ";", "int", "kind", ";", "if", "(", "TAG_ACCESSIBLE", ".", "equals", "(", "tagKind", ")", ")", "kind", "=", "IAccessRule", ".", "K_ACCESSIBLE", ";", "else", "if", "(", "TAG_NON_ACCESSIBLE", ".", "equals", "(", "tagKind", ")", ")", "kind", "=", "IAccessRule", ".", "K_NON_ACCESSIBLE", ";", "else", "if", "(", "TAG_DISCOURAGED", ".", "equals", "(", "tagKind", ")", ")", "kind", "=", "IAccessRule", ".", "K_DISCOURAGED", ";", "else", "continue", ";", "boolean", "ignoreIfBetter", "=", "\"true\"", ".", "equals", "(", "elementAccessRule", ".", "getAttribute", "(", "TAG_IGNORE_IF_BETTER", ")", ")", ";", "result", "[", "index", "++", "]", "=", "new", "ClasspathAccessRule", "(", "new", "Path", "(", "pattern", ")", ",", "ignoreIfBetter", "?", "kind", "|", "IAccessRule", ".", "IGNORE_IF_BETTER", ":", "kind", ")", ";", "}", "}", "if", "(", "index", "!=", "length", ")", "System", ".", "arraycopy", "(", "result", ",", "0", ",", "result", "=", "new", "IAccessRule", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "result", ";", "}", "private", "static", "IPath", "[", "]", "decodePatterns", "(", "NamedNodeMap", "nodeMap", ",", "String", "tag", ")", "{", "String", "sequence", "=", "removeAttribute", "(", "tag", ",", "nodeMap", ")", ";", "if", "(", "!", "sequence", ".", "equals", "(", "\"\"", ")", ")", "{", "char", "[", "]", "[", "]", "patterns", "=", "CharOperation", ".", "splitOn", "(", "'|'", ",", "sequence", ".", "toCharArray", "(", ")", ")", ";", "int", "patternCount", ";", "if", "(", "(", "patternCount", "=", "patterns", ".", "length", ")", ">", "0", ")", "{", "IPath", "[", "]", "paths", "=", "new", "IPath", "[", "patternCount", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "patternCount", ";", "j", "++", ")", "{", "char", "[", "]", "pattern", "=", "patterns", "[", "j", "]", ";", "if", "(", "pattern", ".", "length", "==", "0", ")", "continue", ";", "paths", "[", "index", "++", "]", "=", "new", "Path", "(", "new", "String", "(", "pattern", ")", ")", ";", "}", "if", "(", "index", "<", "patternCount", ")", "System", ".", "arraycopy", "(", "paths", ",", "0", ",", "paths", "=", "new", "IPath", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "paths", ";", "}", "}", "return", "null", ";", "}", "private", "static", "void", "decodeUnknownNode", "(", "Node", "node", ",", "StringBuffer", "buffer", ",", "IJavaProject", "project", ")", "{", "ByteArrayOutputStream", "s", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "OutputStreamWriter", "writer", ";", "try", "{", "writer", "=", "new", "OutputStreamWriter", "(", "s", ",", "\"UTF8\"", ")", ";", "XMLWriter", "xmlWriter", "=", "new", "XMLWriter", "(", "writer", ",", "project", ",", "false", ")", ";", "decodeUnknownNode", "(", "node", ",", "xmlWriter", ",", "true", ")", ";", "xmlWriter", ".", "flush", "(", ")", ";", "xmlWriter", ".", "close", "(", ")", ";", "buffer", ".", "append", "(", "s", ".", "toString", "(", "\"UTF8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "}", "}", "private", "static", "void", "decodeUnknownNode", "(", "Node", "node", ",", "XMLWriter", "xmlWriter", ",", "boolean", "insertNewLine", ")", "{", "switch", "(", "node", ".", "getNodeType", "(", ")", ")", "{", "case", "Node", ".", "ELEMENT_NODE", ":", "NamedNodeMap", "attributes", ";", "HashMap", "parameters", "=", "null", ";", "if", "(", "(", "attributes", "=", "node", ".", "getAttributes", "(", ")", ")", "!=", "null", ")", "{", "int", "length", "=", "attributes", ".", "getLength", "(", ")", ";", "if", "(", "length", ">", "0", ")", "{", "parameters", "=", "new", "HashMap", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Node", "attribute", "=", "attributes", ".", "item", "(", "i", ")", ";", "parameters", ".", "put", "(", "attribute", ".", "getNodeName", "(", ")", ",", "attribute", ".", "getNodeValue", "(", ")", ")", ";", "}", "}", "}", "NodeList", "children", "=", "node", ".", "getChildNodes", "(", ")", ";", "int", "childrenLength", "=", "children", ".", "getLength", "(", ")", ";", "String", "nodeName", "=", "node", ".", "getNodeName", "(", ")", ";", "xmlWriter", ".", "printTag", "(", "nodeName", ",", "parameters", ",", "false", ",", "false", ",", "childrenLength", "==", "0", ")", ";", "if", "(", "childrenLength", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childrenLength", ";", "i", "++", ")", "{", "decodeUnknownNode", "(", "children", ".", "item", "(", "i", ")", ",", "xmlWriter", ",", "false", ")", ";", "}", "xmlWriter", ".", "endTag", "(", "nodeName", ",", "false", ",", "insertNewLine", ")", ";", "}", "break", ";", "case", "Node", ".", "TEXT_NODE", ":", "String", "data", "=", "(", "(", "Text", ")", "node", ")", ".", "getData", "(", ")", ";", "xmlWriter", ".", "printString", "(", "data", ",", "false", ",", "false", ")", ";", "break", ";", "}", "}", "public", "char", "[", "]", "[", "]", "fullExclusionPatternChars", "(", ")", "{", "if", "(", "this", ".", "fullExclusionPatternChars", "==", "UNINIT_PATTERNS", ")", "{", "int", "length", "=", "this", ".", "exclusionPatterns", ".", "length", ";", "this", ".", "fullExclusionPatternChars", "=", "new", "char", "[", "length", "]", "[", "]", ";", "IPath", "prefixPath", "=", "this", ".", "path", ".", "removeTrailingSeparator", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "fullExclusionPatternChars", "[", "i", "]", "=", "prefixPath", ".", "append", "(", "this", ".", "exclusionPatterns", "[", "i", "]", ")", ".", "toString", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "}", "return", "this", ".", "fullExclusionPatternChars", ";", "}", "public", "char", "[", "]", "[", "]", "fullInclusionPatternChars", "(", ")", "{", "if", "(", "this", ".", "fullInclusionPatternChars", "==", "UNINIT_PATTERNS", ")", "{", "int", "length", "=", "this", ".", "inclusionPatterns", ".", "length", ";", "this", ".", "fullInclusionPatternChars", "=", "new", "char", "[", "length", "]", "[", "]", ";", "IPath", "prefixPath", "=", "this", ".", "path", ".", "removeTrailingSeparator", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "fullInclusionPatternChars", "[", "i", "]", "=", "prefixPath", ".", "append", "(", "this", ".", "inclusionPatterns", "[", "i", "]", ")", ".", "toString", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "}", "return", "this", ".", "fullInclusionPatternChars", ";", "}", "public", "void", "elementEncode", "(", "XMLWriter", "writer", ",", "IPath", "projectPath", ",", "boolean", "indent", ",", "boolean", "newLine", ",", "Map", "unknownElements", ",", "boolean", "isReferencedEntry", ")", "{", "HashMap", "parameters", "=", "new", "HashMap", "(", ")", ";", "parameters", ".", "put", "(", "TAG_KIND", ",", "ClasspathEntry", ".", "kindToString", "(", "this", ".", "entryKind", ")", ")", ";", "IPath", "xmlPath", "=", "this", ".", "path", ";", "if", "(", "this", ".", "entryKind", "!=", "IClasspathEntry", ".", "CPE_VARIABLE", "&&", "this", ".", "entryKind", "!=", "IClasspathEntry", ".", "CPE_CONTAINER", ")", "{", "if", "(", "xmlPath", ".", "isAbsolute", "(", ")", ")", "{", "if", "(", "projectPath", "!=", "null", "&&", "projectPath", ".", "isPrefixOf", "(", "xmlPath", ")", ")", "{", "if", "(", "xmlPath", ".", "segment", "(", "0", ")", ".", "equals", "(", "projectPath", ".", "segment", "(", "0", ")", ")", ")", "{", "xmlPath", "=", "xmlPath", ".", "removeFirstSegments", "(", "1", ")", ";", "xmlPath", "=", "xmlPath", ".", "makeRelative", "(", ")", ";", "}", "else", "{", "xmlPath", "=", "xmlPath", ".", "makeAbsolute", "(", ")", ";", "}", "}", "}", "}", "parameters", ".", "put", "(", "TAG_PATH", ",", "String", ".", "valueOf", "(", "xmlPath", ")", ")", ";", "if", "(", "this", ".", "sourceAttachmentPath", "!=", "null", ")", "{", "xmlPath", "=", "this", ".", "sourceAttachmentPath", ";", "if", "(", "this", ".", "entryKind", "!=", "IClasspathEntry", ".", "CPE_VARIABLE", "&&", "projectPath", "!=", "null", "&&", "projectPath", ".", "isPrefixOf", "(", "xmlPath", ")", ")", "{", "if", "(", "xmlPath", ".", "segment", "(", "0", ")", ".", "equals", "(", "projectPath", ".", "segment", "(", "0", ")", ")", ")", "{", "xmlPath", "=", "xmlPath", ".", "removeFirstSegments", "(", "1", ")", ";", "xmlPath", "=", "xmlPath", ".", "makeRelative", "(", ")", ";", "}", "}", "parameters", ".", "put", "(", "TAG_SOURCEPATH", ",", "String", ".", "valueOf", "(", "xmlPath", ")", ")", ";", "}", "if", "(", "this", ".", "sourceAttachmentRootPath", "!=", "null", ")", "{", "parameters", ".", "put", "(", "TAG_ROOTPATH", ",", "String", ".", "valueOf", "(", "this", ".", "sourceAttachmentRootPath", ")", ")", ";", "}", "if", "(", "this", ".", "isExported", ")", "{", "parameters", ".", "put", "(", "TAG_EXPORTED", ",", "\"true\"", ")", ";", "}", "encodePatterns", "(", "this", ".", "inclusionPatterns", ",", "TAG_INCLUDING", ",", "parameters", ")", ";", "encodePatterns", "(", "this", ".", "exclusionPatterns", ",", "TAG_EXCLUDING", ",", "parameters", ")", ";", "if", "(", "this", ".", "entryKind", "==", "CPE_PROJECT", "&&", "!", "this", ".", "combineAccessRules", ")", "parameters", ".", "put", "(", "TAG_COMBINE_ACCESS_RULES", ",", "\"false\"", ")", ";", "UnknownXmlElements", "unknownXmlElements", "=", "unknownElements", "==", "null", "?", "null", ":", "(", "UnknownXmlElements", ")", "unknownElements", ".", "get", "(", "this", ".", "path", ")", ";", "String", "[", "]", "unknownAttributes", ";", "if", "(", "unknownXmlElements", "!=", "null", "&&", "(", "unknownAttributes", "=", "unknownXmlElements", ".", "attributes", ")", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ",", "length", "=", "unknownAttributes", ".", "length", ";", "i", "<", "length", ";", "i", "+=", "2", ")", "{", "String", "tagName", "=", "unknownAttributes", "[", "i", "]", ";", "String", "tagValue", "=", "unknownAttributes", "[", "i", "+", "1", "]", ";", "parameters", ".", "put", "(", "tagName", ",", "tagValue", ")", ";", "}", "if", "(", "this", ".", "specificOutputLocation", "!=", "null", ")", "{", "IPath", "outputLocation", "=", "this", ".", "specificOutputLocation", ".", "removeFirstSegments", "(", "1", ")", ";", "outputLocation", "=", "outputLocation", ".", "makeRelative", "(", ")", ";", "parameters", ".", "put", "(", "TAG_OUTPUT", ",", "String", ".", "valueOf", "(", "outputLocation", ")", ")", ";", "}", "boolean", "hasExtraAttributes", "=", "this", ".", "extraAttributes", ".", "length", "!=", "0", ";", "boolean", "hasRestrictions", "=", "getAccessRuleSet", "(", ")", "!=", "null", ";", "ArrayList", "unknownChildren", "=", "unknownXmlElements", "!=", "null", "?", "unknownXmlElements", ".", "children", ":", "null", ";", "boolean", "hasUnknownChildren", "=", "unknownChildren", "!=", "null", ";", "String", "tagName", "=", "isReferencedEntry", "?", "TAG_REFERENCED_ENTRY", ":", "TAG_CLASSPATHENTRY", ";", "writer", ".", "printTag", "(", "tagName", ",", "parameters", ",", "indent", ",", "newLine", ",", "!", "hasExtraAttributes", "&&", "!", "hasRestrictions", "&&", "!", "hasUnknownChildren", ")", ";", "if", "(", "hasExtraAttributes", ")", "encodeExtraAttributes", "(", "writer", ",", "indent", ",", "newLine", ")", ";", "if", "(", "hasRestrictions", ")", "encodeAccessRules", "(", "writer", ",", "indent", ",", "newLine", ")", ";", "if", "(", "hasUnknownChildren", ")", "encodeUnknownChildren", "(", "writer", ",", "indent", ",", "newLine", ",", "unknownChildren", ")", ";", "if", "(", "hasExtraAttributes", "||", "hasRestrictions", "||", "hasUnknownChildren", ")", "writer", ".", "endTag", "(", "tagName", ",", "indent", ",", "true", ")", ";", "}", "void", "encodeExtraAttributes", "(", "XMLWriter", "writer", ",", "boolean", "indent", ",", "boolean", "newLine", ")", "{", "writer", ".", "startTag", "(", "TAG_ATTRIBUTES", ",", "indent", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "extraAttributes", ".", "length", ";", "i", "++", ")", "{", "IClasspathAttribute", "attribute", "=", "this", ".", "extraAttributes", "[", "i", "]", ";", "HashMap", "parameters", "=", "new", "HashMap", "(", ")", ";", "parameters", ".", "put", "(", "TAG_ATTRIBUTE_NAME", ",", "attribute", ".", "getName", "(", ")", ")", ";", "parameters", ".", "put", "(", "TAG_ATTRIBUTE_VALUE", ",", "attribute", ".", "getValue", "(", ")", ")", ";", "writer", ".", "printTag", "(", "TAG_ATTRIBUTE", ",", "parameters", ",", "indent", ",", "newLine", ",", "true", ")", ";", "}", "writer", ".", "endTag", "(", "TAG_ATTRIBUTES", ",", "indent", ",", "true", ")", ";", "}", "void", "encodeAccessRules", "(", "XMLWriter", "writer", ",", "boolean", "indent", ",", "boolean", "newLine", ")", "{", "writer", ".", "startTag", "(", "TAG_ACCESS_RULES", ",", "indent", ")", ";", "AccessRule", "[", "]", "rules", "=", "getAccessRuleSet", "(", ")", ".", "getAccessRules", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "rules", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "encodeAccessRule", "(", "rules", "[", "i", "]", ",", "writer", ",", "indent", ",", "newLine", ")", ";", "}", "writer", ".", "endTag", "(", "TAG_ACCESS_RULES", ",", "indent", ",", "true", ")", ";", "}", "private", "void", "encodeAccessRule", "(", "AccessRule", "accessRule", ",", "XMLWriter", "writer", ",", "boolean", "indent", ",", "boolean", "newLine", ")", "{", "HashMap", "parameters", "=", "new", "HashMap", "(", ")", ";", "parameters", ".", "put", "(", "TAG_PATTERN", ",", "new", "String", "(", "accessRule", ".", "pattern", ")", ")", ";", "switch", "(", "accessRule", ".", "getProblemId", "(", ")", ")", "{", "case", "IProblem", ".", "ForbiddenReference", ":", "parameters", ".", "put", "(", "TAG_KIND", ",", "TAG_NON_ACCESSIBLE", ")", ";", "break", ";", "case", "IProblem", ".", "DiscouragedReference", ":", "parameters", ".", "put", "(", "TAG_KIND", ",", "TAG_DISCOURAGED", ")", ";", "break", ";", "default", ":", "parameters", ".", "put", "(", "TAG_KIND", ",", "TAG_ACCESSIBLE", ")", ";", "break", ";", "}", "if", "(", "accessRule", ".", "ignoreIfBetter", "(", ")", ")", "parameters", ".", "put", "(", "TAG_IGNORE_IF_BETTER", ",", "\"true\"", ")", ";", "writer", ".", "printTag", "(", "TAG_ACCESS_RULE", ",", "parameters", ",", "indent", ",", "newLine", ",", "true", ")", ";", "}", "private", "void", "encodeUnknownChildren", "(", "XMLWriter", "writer", ",", "boolean", "indent", ",", "boolean", "newLine", ",", "ArrayList", "unknownChildren", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "unknownChildren", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "child", "=", "(", "String", ")", "unknownChildren", ".", "get", "(", "i", ")", ";", "writer", ".", "printString", "(", "child", ",", "indent", ",", "false", ")", ";", "}", "}", "public", "static", "IClasspathEntry", "elementDecode", "(", "Element", "element", ",", "IJavaProject", "project", ",", "Map", "unknownElements", ")", "{", "IPath", "projectPath", "=", "project", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ";", "NamedNodeMap", "attributes", "=", "element", ".", "getAttributes", "(", ")", ";", "NodeList", "children", "=", "element", ".", "getChildNodes", "(", ")", ";", "boolean", "[", "]", "foundChildren", "=", "new", "boolean", "[", "children", ".", "getLength", "(", ")", "]", ";", "String", "kindAttr", "=", "removeAttribute", "(", "TAG_KIND", ",", "attributes", ")", ";", "String", "pathAttr", "=", "removeAttribute", "(", "TAG_PATH", ",", "attributes", ")", ";", "IPath", "path", "=", "new", "Path", "(", "pathAttr", ")", ";", "int", "kind", "=", "kindFromString", "(", "kindAttr", ")", ";", "if", "(", "kind", "!=", "IClasspathEntry", ".", "CPE_VARIABLE", "&&", "kind", "!=", "IClasspathEntry", ".", "CPE_CONTAINER", "&&", "!", "path", ".", "isAbsolute", "(", ")", ")", "{", "if", "(", "!", "(", "path", ".", "segmentCount", "(", ")", ">", "0", "&&", "path", ".", "segment", "(", "0", ")", ".", "equals", "(", "ClasspathEntry", ".", "DOT_DOT", ")", ")", ")", "{", "path", "=", "projectPath", ".", "append", "(", "path", ")", ";", "}", "}", "IPath", "sourceAttachmentPath", "=", "element", ".", "hasAttribute", "(", "TAG_SOURCEPATH", ")", "?", "new", "Path", "(", "removeAttribute", "(", "TAG_SOURCEPATH", ",", "attributes", ")", ")", ":", "null", ";", "if", "(", "kind", "!=", "IClasspathEntry", ".", "CPE_VARIABLE", "&&", "sourceAttachmentPath", "!=", "null", "&&", "!", "sourceAttachmentPath", ".", "isAbsolute", "(", ")", ")", "{", "sourceAttachmentPath", "=", "projectPath", ".", "append", "(", "sourceAttachmentPath", ")", ";", "}", "IPath", "sourceAttachmentRootPath", "=", "element", ".", "hasAttribute", "(", "TAG_ROOTPATH", ")", "?", "new", "Path", "(", "removeAttribute", "(", "TAG_ROOTPATH", ",", "attributes", ")", ")", ":", "null", ";", "boolean", "isExported", "=", "removeAttribute", "(", "TAG_EXPORTED", ",", "attributes", ")", ".", "equals", "(", "\"true\"", ")", ";", "IPath", "[", "]", "inclusionPatterns", "=", "decodePatterns", "(", "attributes", ",", "TAG_INCLUDING", ")", ";", "if", "(", "inclusionPatterns", "==", "null", ")", "inclusionPatterns", "=", "INCLUDE_ALL", ";", "IPath", "[", "]", "exclusionPatterns", "=", "decodePatterns", "(", "attributes", ",", "TAG_EXCLUDING", ")", ";", "if", "(", "exclusionPatterns", "==", "null", ")", "exclusionPatterns", "=", "EXCLUDE_NONE", ";", "NodeList", "attributeList", "=", "getChildAttributes", "(", "TAG_ACCESS_RULES", ",", "children", ",", "foundChildren", ")", ";", "IAccessRule", "[", "]", "accessRules", "=", "decodeAccessRules", "(", "attributeList", ")", ";", "if", "(", "accessRules", "==", "null", ")", "{", "accessRules", "=", "getAccessRules", "(", "inclusionPatterns", ",", "exclusionPatterns", ")", ";", "}", "boolean", "combineAccessRestrictions", "=", "!", "removeAttribute", "(", "TAG_COMBINE_ACCESS_RULES", ",", "attributes", ")", ".", "equals", "(", "\"false\"", ")", ";", "attributeList", "=", "getChildAttributes", "(", "TAG_ATTRIBUTES", ",", "children", ",", "foundChildren", ")", ";", "IClasspathAttribute", "[", "]", "extraAttributes", "=", "decodeExtraAttributes", "(", "attributeList", ")", ";", "IPath", "outputLocation", "=", "element", ".", "hasAttribute", "(", "TAG_OUTPUT", ")", "?", "projectPath", ".", "append", "(", "removeAttribute", "(", "TAG_OUTPUT", ",", "attributes", ")", ")", ":", "null", ";", "String", "[", "]", "unknownAttributes", "=", "null", ";", "ArrayList", "unknownChildren", "=", "null", ";", "if", "(", "unknownElements", "!=", "null", ")", "{", "int", "unknownAttributeLength", "=", "attributes", ".", "getLength", "(", ")", ";", "if", "(", "unknownAttributeLength", "!=", "0", ")", "{", "unknownAttributes", "=", "new", "String", "[", "unknownAttributeLength", "*", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "unknownAttributeLength", ";", "i", "++", ")", "{", "Node", "attribute", "=", "attributes", ".", "item", "(", "i", ")", ";", "unknownAttributes", "[", "i", "*", "2", "]", "=", "attribute", ".", "getNodeName", "(", ")", ";", "unknownAttributes", "[", "i", "*", "2", "+", "1", "]", "=", "attribute", ".", "getNodeValue", "(", ")", ";", "}", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "foundChildren", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "foundChildren", "[", "i", "]", ")", "{", "Node", "node", "=", "children", ".", "item", "(", "i", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "!=", "Node", ".", "ELEMENT_NODE", ")", "continue", ";", "if", "(", "unknownChildren", "==", "null", ")", "unknownChildren", "=", "new", "ArrayList", "(", ")", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "decodeUnknownNode", "(", "node", ",", "buffer", ",", "project", ")", ";", "unknownChildren", ".", "add", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "IClasspathEntry", "entry", "=", "null", ";", "switch", "(", "kind", ")", "{", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "entry", "=", "new", "ClasspathEntry", "(", "IPackageFragmentRoot", ".", "K_SOURCE", ",", "IClasspathEntry", ".", "CPE_PROJECT", ",", "path", ",", "ClasspathEntry", ".", "INCLUDE_ALL", ",", "ClasspathEntry", ".", "EXCLUDE_NONE", ",", "null", ",", "null", ",", "null", ",", "isExported", ",", "accessRules", ",", "combineAccessRestrictions", ",", "extraAttributes", ")", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "entry", "=", "JavaCore", ".", "newLibraryEntry", "(", "path", ",", "sourceAttachmentPath", ",", "sourceAttachmentRootPath", ",", "accessRules", ",", "extraAttributes", ",", "isExported", ")", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "String", "projSegment", "=", "path", ".", "segment", "(", "0", ")", ";", "if", "(", "projSegment", "!=", "null", "&&", "projSegment", ".", "equals", "(", "project", ".", "getElementName", "(", ")", ")", ")", "{", "entry", "=", "JavaCore", ".", "newSourceEntry", "(", "path", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "outputLocation", ",", "extraAttributes", ")", ";", "}", "else", "{", "if", "(", "path", ".", "segmentCount", "(", ")", "==", "1", ")", "{", "entry", "=", "JavaCore", ".", "newProjectEntry", "(", "path", ",", "accessRules", ",", "combineAccessRestrictions", ",", "extraAttributes", ",", "isExported", ")", ";", "}", "else", "{", "entry", "=", "JavaCore", ".", "newSourceEntry", "(", "path", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "outputLocation", ",", "extraAttributes", ")", ";", "}", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_VARIABLE", ":", "entry", "=", "JavaCore", ".", "newVariableEntry", "(", "path", ",", "sourceAttachmentPath", ",", "sourceAttachmentRootPath", ",", "accessRules", ",", "extraAttributes", ",", "isExported", ")", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_CONTAINER", ":", "entry", "=", "JavaCore", ".", "newContainerEntry", "(", "path", ",", "accessRules", ",", "extraAttributes", ",", "isExported", ")", ";", "break", ";", "case", "ClasspathEntry", ".", "K_OUTPUT", ":", "if", "(", "!", "path", ".", "isAbsolute", "(", ")", ")", "return", "null", ";", "entry", "=", "new", "ClasspathEntry", "(", "ClasspathEntry", ".", "K_OUTPUT", ",", "IClasspathEntry", ".", "CPE_LIBRARY", ",", "path", ",", "INCLUDE_ALL", ",", "EXCLUDE_NONE", ",", "null", ",", "null", ",", "null", ",", "false", ",", "null", ",", "false", ",", "NO_EXTRA_ATTRIBUTES", ")", ";", "break", ";", "default", ":", "throw", "new", "AssertionFailedException", "(", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unknownKind", ",", "kindAttr", ")", ")", ";", "}", "if", "(", "unknownAttributes", "!=", "null", "||", "unknownChildren", "!=", "null", ")", "{", "UnknownXmlElements", "unknownXmlElements", "=", "new", "UnknownXmlElements", "(", ")", ";", "unknownXmlElements", ".", "attributes", "=", "unknownAttributes", ";", "unknownXmlElements", ".", "children", "=", "unknownChildren", ";", "unknownElements", ".", "put", "(", "path", ",", "unknownXmlElements", ")", ";", "}", "return", "entry", ";", "}", "public", "static", "boolean", "hasDotDot", "(", "IPath", "path", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "path", ".", "segmentCount", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "DOT_DOT", ".", "equals", "(", "path", ".", "segment", "(", "i", ")", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "public", "static", "NodeList", "getChildAttributes", "(", "String", "childName", ",", "NodeList", "children", ",", "boolean", "[", "]", "foundChildren", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "foundChildren", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Node", "node", "=", "children", ".", "item", "(", "i", ")", ";", "if", "(", "childName", ".", "equals", "(", "node", ".", "getNodeName", "(", ")", ")", ")", "{", "foundChildren", "[", "i", "]", "=", "true", ";", "return", "node", ".", "getChildNodes", "(", ")", ";", "}", "}", "return", "null", ";", "}", "private", "static", "String", "removeAttribute", "(", "String", "nodeName", ",", "NamedNodeMap", "nodeMap", ")", "{", "Node", "node", "=", "removeNode", "(", "nodeName", ",", "nodeMap", ")", ";", "if", "(", "node", "==", "null", ")", "return", "\"\"", ";", "return", "node", ".", "getNodeValue", "(", ")", ";", "}", "private", "static", "Node", "removeNode", "(", "String", "nodeName", ",", "NamedNodeMap", "nodeMap", ")", "{", "try", "{", "return", "nodeMap", ".", "removeNamedItem", "(", "nodeName", ")", ";", "}", "catch", "(", "DOMException", "e", ")", "{", "if", "(", "e", ".", "code", "!=", "DOMException", ".", "NOT_FOUND_ERR", ")", "throw", "e", ";", "return", "null", ";", "}", "}", "public", "static", "IPath", "[", "]", "resolvedChainedLibraries", "(", "IPath", "jarPath", ")", "{", "ArrayList", "result", "=", "new", "ArrayList", "(", ")", ";", "resolvedChainedLibraries", "(", "jarPath", ",", "new", "HashSet", "(", ")", ",", "result", ")", ";", "if", "(", "result", ".", "size", "(", ")", "==", "0", ")", "return", "NO_PATHS", ";", "return", "(", "IPath", "[", "]", ")", "result", ".", "toArray", "(", "new", "IPath", "[", "result", ".", "size", "(", ")", "]", ")", ";", "}", "private", "static", "void", "resolvedChainedLibraries", "(", "IPath", "jarPath", ",", "HashSet", "visited", ",", "ArrayList", "result", ")", "{", "if", "(", "visited", ".", "contains", "(", "jarPath", ")", ")", "return", ";", "visited", ".", "add", "(", "jarPath", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "if", "(", "manager", ".", "isNonChainingJar", "(", "jarPath", ")", ")", "return", ";", "List", "calledFileNames", "=", "getCalledFileNames", "(", "jarPath", ")", ";", "if", "(", "calledFileNames", "==", "null", ")", "{", "manager", ".", "addNonChainingJar", "(", "jarPath", ")", ";", "}", "else", "{", "Iterator", "calledFilesIterator", "=", "calledFileNames", ".", "iterator", "(", ")", ";", "IPath", "directoryPath", "=", "jarPath", ".", "removeLastSegments", "(", "1", ")", ";", "while", "(", "calledFilesIterator", ".", "hasNext", "(", ")", ")", "{", "String", "calledFileName", "=", "(", "String", ")", "calledFilesIterator", ".", "next", "(", ")", ";", "if", "(", "!", "directoryPath", ".", "isValidPath", "(", "calledFileName", ")", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "calledFileName", "+", "\"\"", "+", "jarPath", ".", "toOSString", "(", ")", ")", ";", "}", "}", "else", "{", "IPath", "calledJar", "=", "directoryPath", ".", "append", "(", "new", "Path", "(", "calledFileName", ")", ")", ";", "if", "(", "calledJar", ".", "segmentCount", "(", ")", "==", "0", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "calledFileName", "+", "\"\"", "+", "jarPath", ".", "toOSString", "(", ")", ")", ";", "}", "continue", ";", "}", "resolvedChainedLibraries", "(", "calledJar", ",", "visited", ",", "result", ")", ";", "result", ".", "add", "(", "calledJar", ")", ";", "}", "}", "}", "}", "private", "static", "List", "getCalledFileNames", "(", "IPath", "jarPath", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "jarPath", ",", "true", ")", ";", "if", "(", "!", "(", "target", "instanceof", "IFile", "||", "target", "instanceof", "File", ")", ")", "return", "null", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "ZipFile", "zip", "=", "null", ";", "InputStream", "inputStream", "=", "null", ";", "List", "calledFileNames", "=", "null", ";", "try", "{", "zip", "=", "manager", ".", "getZipFile", "(", "jarPath", ")", ";", "ZipEntry", "manifest", "=", "zip", ".", "getEntry", "(", "\"\"", ")", ";", "if", "(", "manifest", "==", "null", ")", "return", "null", ";", "ManifestAnalyzer", "analyzer", "=", "new", "ManifestAnalyzer", "(", ")", ";", "inputStream", "=", "zip", ".", "getInputStream", "(", "manifest", ")", ";", "boolean", "success", "=", "analyzer", ".", "analyzeManifestContents", "(", "inputStream", ")", ";", "calledFileNames", "=", "analyzer", ".", "getCalledFileNames", "(", ")", ";", "if", "(", "!", "success", "||", "analyzer", ".", "getClasspathSectionsCount", "(", ")", "==", "1", "&&", "calledFileNames", "==", "null", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "jarPath", ".", "toOSString", "(", ")", ")", ";", "}", "return", "null", ";", "}", "else", "if", "(", "analyzer", ".", "getClasspathSectionsCount", "(", ")", ">", "1", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "jarPath", ".", "toOSString", "(", ")", ")", ";", "}", "return", "null", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "jarPath", ".", "toOSString", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "jarPath", ".", "toOSString", "(", ")", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "finally", "{", "if", "(", "inputStream", "!=", "null", ")", "{", "try", "{", "inputStream", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "manager", ".", "closeZipFile", "(", "zip", ")", ";", "}", "return", "calledFileNames", ";", "}", "public", "static", "IPath", "resolveDotDot", "(", "IPath", "reference", ",", "IPath", "path", ")", "{", "IPath", "newPath", "=", "null", ";", "IPath", "workspaceLocation", "=", "workspaceRoot", ".", "getLocation", "(", ")", ";", "if", "(", "reference", "==", "null", "||", "workspaceLocation", ".", "isPrefixOf", "(", "reference", ")", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "path", ".", "segmentCount", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "segment", "=", "path", ".", "segment", "(", "i", ")", ";", "if", "(", "DOT_DOT", ".", "equals", "(", "segment", ")", ")", "{", "if", "(", "newPath", "==", "null", ")", "{", "if", "(", "i", "==", "0", ")", "{", "newPath", "=", "workspaceLocation", ";", "}", "else", "{", "newPath", "=", "path", ".", "removeFirstSegments", "(", "i", ")", ";", "}", "}", "else", "{", "if", "(", "newPath", ".", "segmentCount", "(", ")", ">", "0", ")", "{", "newPath", "=", "newPath", ".", "removeLastSegments", "(", "1", ")", ";", "}", "else", "{", "newPath", "=", "workspaceLocation", ";", "}", "}", "}", "else", "if", "(", "newPath", "!=", "null", ")", "{", "if", "(", "newPath", ".", "equals", "(", "workspaceLocation", ")", "&&", "workspaceRoot", ".", "getProject", "(", "segment", ")", ".", "isAccessible", "(", ")", ")", "{", "newPath", "=", "new", "Path", "(", "segment", ")", ".", "makeAbsolute", "(", ")", ";", "}", "else", "{", "newPath", "=", "newPath", ".", "append", "(", "segment", ")", ";", "}", "}", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "path", ".", "segmentCount", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "segment", "=", "path", ".", "segment", "(", "i", ")", ";", "if", "(", "DOT_DOT", ".", "equals", "(", "segment", ")", ")", "{", "if", "(", "newPath", "==", "null", ")", "{", "newPath", "=", "reference", ";", "}", "if", "(", "newPath", ".", "segmentCount", "(", ")", ">", "0", ")", "{", "newPath", "=", "newPath", ".", "removeLastSegments", "(", "1", ")", ";", "}", "}", "else", "if", "(", "newPath", "!=", "null", ")", "{", "newPath", "=", "newPath", ".", "append", "(", "segment", ")", ";", "}", "}", "}", "if", "(", "newPath", "==", "null", ")", "return", "path", ";", "return", "newPath", ";", "}", "private", "static", "void", "encodePatterns", "(", "IPath", "[", "]", "patterns", ",", "String", "tag", ",", "Map", "parameters", ")", "{", "if", "(", "patterns", "!=", "null", "&&", "patterns", ".", "length", ">", "0", ")", "{", "StringBuffer", "rule", "=", "new", "StringBuffer", "(", "10", ")", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "patterns", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "rule", ".", "append", "(", "'|'", ")", ";", "rule", ".", "append", "(", "patterns", "[", "i", "]", ")", ";", "}", "parameters", ".", "put", "(", "tag", ",", "String", ".", "valueOf", "(", "rule", ")", ")", ";", "}", "}", "public", "boolean", "equals", "(", "Object", "object", ")", "{", "if", "(", "this", "==", "object", ")", "return", "true", ";", "if", "(", "object", "instanceof", "ClasspathEntry", ")", "{", "ClasspathEntry", "otherEntry", "=", "(", "ClasspathEntry", ")", "object", ";", "if", "(", "this", ".", "contentKind", "!=", "otherEntry", ".", "getContentKind", "(", ")", ")", "return", "false", ";", "if", "(", "this", ".", "entryKind", "!=", "otherEntry", ".", "getEntryKind", "(", ")", ")", "return", "false", ";", "if", "(", "this", ".", "isExported", "!=", "otherEntry", ".", "isExported", "(", ")", ")", "return", "false", ";", "if", "(", "!", "this", ".", "path", ".", "equals", "(", "otherEntry", ".", "getPath", "(", ")", ")", ")", "return", "false", ";", "IPath", "otherPath", "=", "otherEntry", ".", "getSourceAttachmentPath", "(", ")", ";", "if", "(", "this", ".", "sourceAttachmentPath", "==", "null", ")", "{", "if", "(", "otherPath", "!=", "null", ")", "return", "false", ";", "}", "else", "{", "if", "(", "!", "this", ".", "sourceAttachmentPath", ".", "equals", "(", "otherPath", ")", ")", "return", "false", ";", "}", "otherPath", "=", "otherEntry", ".", "getSourceAttachmentRootPath", "(", ")", ";", "if", "(", "this", ".", "sourceAttachmentRootPath", "==", "null", ")", "{", "if", "(", "otherPath", "!=", "null", ")", "return", "false", ";", "}", "else", "{", "if", "(", "!", "this", ".", "sourceAttachmentRootPath", ".", "equals", "(", "otherPath", ")", ")", "return", "false", ";", "}", "if", "(", "!", "equalPatterns", "(", "this", ".", "inclusionPatterns", ",", "otherEntry", ".", "getInclusionPatterns", "(", ")", ")", ")", "return", "false", ";", "if", "(", "!", "equalPatterns", "(", "this", ".", "exclusionPatterns", ",", "otherEntry", ".", "getExclusionPatterns", "(", ")", ")", ")", "return", "false", ";", "AccessRuleSet", "otherRuleSet", "=", "otherEntry", ".", "getAccessRuleSet", "(", ")", ";", "if", "(", "getAccessRuleSet", "(", ")", "!=", "null", ")", "{", "if", "(", "!", "getAccessRuleSet", "(", ")", ".", "equals", "(", "otherRuleSet", ")", ")", "return", "false", ";", "}", "else", "if", "(", "otherRuleSet", "!=", "null", ")", "return", "false", ";", "if", "(", "this", ".", "combineAccessRules", "!=", "otherEntry", ".", "combineAccessRules", "(", ")", ")", "return", "false", ";", "otherPath", "=", "otherEntry", ".", "getOutputLocation", "(", ")", ";", "if", "(", "this", ".", "specificOutputLocation", "==", "null", ")", "{", "if", "(", "otherPath", "!=", "null", ")", "return", "false", ";", "}", "else", "{", "if", "(", "!", "this", ".", "specificOutputLocation", ".", "equals", "(", "otherPath", ")", ")", "return", "false", ";", "}", "if", "(", "!", "equalAttributes", "(", "this", ".", "extraAttributes", ",", "otherEntry", ".", "getExtraAttributes", "(", ")", ")", ")", "return", "false", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "private", "static", "boolean", "equalAttributes", "(", "IClasspathAttribute", "[", "]", "firstAttributes", ",", "IClasspathAttribute", "[", "]", "secondAttributes", ")", "{", "if", "(", "firstAttributes", "!=", "secondAttributes", ")", "{", "if", "(", "firstAttributes", "==", "null", ")", "return", "false", ";", "int", "length", "=", "firstAttributes", ".", "length", ";", "if", "(", "secondAttributes", "==", "null", "||", "secondAttributes", ".", "length", "!=", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "firstAttributes", "[", "i", "]", ".", "equals", "(", "secondAttributes", "[", "i", "]", ")", ")", "return", "false", ";", "}", "}", "return", "true", ";", "}", "private", "static", "boolean", "equalPatterns", "(", "IPath", "[", "]", "firstPatterns", ",", "IPath", "[", "]", "secondPatterns", ")", "{", "if", "(", "firstPatterns", "!=", "secondPatterns", ")", "{", "if", "(", "firstPatterns", "==", "null", ")", "return", "false", ";", "int", "length", "=", "firstPatterns", ".", "length", ";", "if", "(", "secondPatterns", "==", "null", "||", "secondPatterns", ".", "length", "!=", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "!", "firstPatterns", "[", "i", "]", ".", "toString", "(", ")", ".", "equals", "(", "secondPatterns", "[", "i", "]", ".", "toString", "(", ")", ")", ")", "return", "false", ";", "}", "}", "return", "true", ";", "}", "public", "IAccessRule", "[", "]", "getAccessRules", "(", ")", "{", "if", "(", "this", ".", "accessRuleSet", "==", "null", ")", "return", "NO_ACCESS_RULES", ";", "AccessRule", "[", "]", "rules", "=", "this", ".", "accessRuleSet", ".", "getAccessRules", "(", ")", ";", "int", "length", "=", "rules", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "NO_ACCESS_RULES", ";", "IAccessRule", "[", "]", "result", "=", "new", "IAccessRule", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "rules", ",", "0", ",", "result", ",", "0", ",", "length", ")", ";", "return", "result", ";", "}", "public", "AccessRuleSet", "getAccessRuleSet", "(", ")", "{", "return", "this", ".", "accessRuleSet", ";", "}", "public", "int", "getContentKind", "(", ")", "{", "return", "this", ".", "contentKind", ";", "}", "public", "int", "getEntryKind", "(", ")", "{", "return", "this", ".", "entryKind", ";", "}", "public", "IPath", "[", "]", "getExclusionPatterns", "(", ")", "{", "return", "this", ".", "exclusionPatterns", ";", "}", "public", "IClasspathAttribute", "[", "]", "getExtraAttributes", "(", ")", "{", "return", "this", ".", "extraAttributes", ";", "}", "public", "IPath", "[", "]", "getInclusionPatterns", "(", ")", "{", "return", "this", ".", "inclusionPatterns", ";", "}", "public", "IPath", "getOutputLocation", "(", ")", "{", "return", "this", ".", "specificOutputLocation", ";", "}", "public", "IPath", "getPath", "(", ")", "{", "return", "this", ".", "path", ";", "}", "public", "IPath", "getSourceAttachmentPath", "(", ")", "{", "return", "this", ".", "sourceAttachmentPath", ";", "}", "public", "IPath", "getSourceAttachmentRootPath", "(", ")", "{", "return", "this", ".", "sourceAttachmentRootPath", ";", "}", "public", "IClasspathEntry", "getReferencingEntry", "(", ")", "{", "return", "this", ".", "referencingEntry", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "this", ".", "path", ".", "hashCode", "(", ")", ";", "}", "public", "boolean", "isExported", "(", ")", "{", "return", "this", ".", "isExported", ";", "}", "public", "boolean", "isOptional", "(", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "extraAttributes", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathAttribute", "attribute", "=", "this", ".", "extraAttributes", "[", "i", "]", ";", "if", "(", "IClasspathAttribute", ".", "OPTIONAL", ".", "equals", "(", "attribute", ".", "getName", "(", ")", ")", "&&", "\"true\"", ".", "equals", "(", "attribute", ".", "getValue", "(", ")", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "static", "int", "kindFromString", "(", "String", "kindStr", ")", "{", "if", "(", "kindStr", ".", "equalsIgnoreCase", "(", "\"prj\"", ")", ")", "return", "IClasspathEntry", ".", "CPE_PROJECT", ";", "if", "(", "kindStr", ".", "equalsIgnoreCase", "(", "\"var\"", ")", ")", "return", "IClasspathEntry", ".", "CPE_VARIABLE", ";", "if", "(", "kindStr", ".", "equalsIgnoreCase", "(", "\"con\"", ")", ")", "return", "IClasspathEntry", ".", "CPE_CONTAINER", ";", "if", "(", "kindStr", ".", "equalsIgnoreCase", "(", "\"src\"", ")", ")", "return", "IClasspathEntry", ".", "CPE_SOURCE", ";", "if", "(", "kindStr", ".", "equalsIgnoreCase", "(", "\"lib\"", ")", ")", "return", "IClasspathEntry", ".", "CPE_LIBRARY", ";", "if", "(", "kindStr", ".", "equalsIgnoreCase", "(", "\"output\"", ")", ")", "return", "ClasspathEntry", ".", "K_OUTPUT", ";", "return", "-", "1", ";", "}", "static", "String", "kindToString", "(", "int", "kind", ")", "{", "switch", "(", "kind", ")", "{", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "return", "\"src\"", ";", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "return", "\"src\"", ";", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "return", "\"lib\"", ";", "case", "IClasspathEntry", ".", "CPE_VARIABLE", ":", "return", "\"var\"", ";", "case", "IClasspathEntry", ".", "CPE_CONTAINER", ":", "return", "\"con\"", ";", "case", "ClasspathEntry", ".", "K_OUTPUT", ":", "return", "\"output\"", ";", "default", ":", "return", "\"unknown\"", ";", "}", "}", "public", "static", "IAccessRule", "[", "]", "getAccessRules", "(", "IPath", "[", "]", "accessibleFiles", ",", "IPath", "[", "]", "nonAccessibleFiles", ")", "{", "int", "accessibleFilesLength", "=", "accessibleFiles", "==", "null", "?", "0", ":", "accessibleFiles", ".", "length", ";", "int", "nonAccessibleFilesLength", "=", "nonAccessibleFiles", "==", "null", "?", "0", ":", "nonAccessibleFiles", ".", "length", ";", "int", "length", "=", "accessibleFilesLength", "+", "nonAccessibleFilesLength", ";", "if", "(", "length", "==", "0", ")", "return", "null", ";", "IAccessRule", "[", "]", "accessRules", "=", "new", "IAccessRule", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "accessibleFilesLength", ";", "i", "++", ")", "{", "accessRules", "[", "i", "]", "=", "JavaCore", ".", "newAccessRule", "(", "accessibleFiles", "[", "i", "]", ",", "IAccessRule", ".", "K_ACCESSIBLE", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nonAccessibleFilesLength", ";", "i", "++", ")", "{", "accessRules", "[", "accessibleFilesLength", "+", "i", "]", "=", "JavaCore", ".", "newAccessRule", "(", "nonAccessibleFiles", "[", "i", "]", ",", "IAccessRule", ".", "K_NON_ACCESSIBLE", ")", ";", "}", "return", "accessRules", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "getPath", "(", ")", ",", "true", ")", ";", "if", "(", "target", "instanceof", "File", ")", "buffer", ".", "append", "(", "getPath", "(", ")", ".", "toOSString", "(", ")", ")", ";", "else", "buffer", ".", "append", "(", "String", ".", "valueOf", "(", "getPath", "(", ")", ")", ")", ";", "buffer", ".", "append", "(", "'['", ")", ";", "switch", "(", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "buffer", ".", "append", "(", "\"CPE_LIBRARY\"", ")", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "buffer", ".", "append", "(", "\"CPE_PROJECT\"", ")", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "buffer", ".", "append", "(", "\"CPE_SOURCE\"", ")", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_VARIABLE", ":", "buffer", ".", "append", "(", "\"CPE_VARIABLE\"", ")", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_CONTAINER", ":", "buffer", ".", "append", "(", "\"\"", ")", ";", "break", ";", "}", "buffer", ".", "append", "(", "\"][\"", ")", ";", "switch", "(", "getContentKind", "(", ")", ")", "{", "case", "IPackageFragmentRoot", ".", "K_BINARY", ":", "buffer", ".", "append", "(", "\"K_BINARY\"", ")", ";", "break", ";", "case", "IPackageFragmentRoot", ".", "K_SOURCE", ":", "buffer", ".", "append", "(", "\"K_SOURCE\"", ")", ";", "break", ";", "case", "ClasspathEntry", ".", "K_OUTPUT", ":", "buffer", ".", "append", "(", "\"K_OUTPUT\"", ")", ";", "break", ";", "}", "buffer", ".", "append", "(", "']'", ")", ";", "if", "(", "getSourceAttachmentPath", "(", ")", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"[sourcePath:\"", ")", ";", "buffer", ".", "append", "(", "getSourceAttachmentPath", "(", ")", ")", ";", "buffer", ".", "append", "(", "']'", ")", ";", "}", "if", "(", "getSourceAttachmentRootPath", "(", ")", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"[rootPath:\"", ")", ";", "buffer", ".", "append", "(", "getSourceAttachmentRootPath", "(", ")", ")", ";", "buffer", ".", "append", "(", "']'", ")", ";", "}", "buffer", ".", "append", "(", "\"[isExported:\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "isExported", ")", ";", "buffer", ".", "append", "(", "']'", ")", ";", "IPath", "[", "]", "patterns", "=", "this", ".", "inclusionPatterns", ";", "int", "length", ";", "if", "(", "(", "length", "=", "patterns", "==", "null", "?", "0", ":", "patterns", ".", "length", ")", ">", "0", ")", "{", "buffer", ".", "append", "(", "\"[including:\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "patterns", "[", "i", "]", ")", ";", "if", "(", "i", "!=", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "'|'", ")", ";", "}", "}", "buffer", ".", "append", "(", "']'", ")", ";", "}", "patterns", "=", "this", ".", "exclusionPatterns", ";", "if", "(", "(", "length", "=", "patterns", "==", "null", "?", "0", ":", "patterns", ".", "length", ")", ">", "0", ")", "{", "buffer", ".", "append", "(", "\"[excluding:\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "patterns", "[", "i", "]", ")", ";", "if", "(", "i", "!=", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "'|'", ")", ";", "}", "}", "buffer", ".", "append", "(", "']'", ")", ";", "}", "if", "(", "this", ".", "accessRuleSet", "!=", "null", ")", "{", "buffer", ".", "append", "(", "'['", ")", ";", "buffer", ".", "append", "(", "this", ".", "accessRuleSet", ".", "toString", "(", "false", ")", ")", ";", "buffer", ".", "append", "(", "']'", ")", ";", "}", "if", "(", "this", ".", "entryKind", "==", "CPE_PROJECT", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "combineAccessRules", ")", ";", "buffer", ".", "append", "(", "']'", ")", ";", "}", "if", "(", "getOutputLocation", "(", ")", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"[output:\"", ")", ";", "buffer", ".", "append", "(", "getOutputLocation", "(", ")", ")", ";", "buffer", ".", "append", "(", "']'", ")", ";", "}", "if", "(", "(", "length", "=", "this", ".", "extraAttributes", "==", "null", "?", "0", ":", "this", ".", "extraAttributes", ".", "length", ")", ">", "0", ")", "{", "buffer", ".", "append", "(", "\"[attributes:\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "this", ".", "extraAttributes", "[", "i", "]", ")", ";", "if", "(", "i", "!=", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "','", ")", ";", "}", "}", "buffer", ".", "append", "(", "']'", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "public", "ClasspathEntry", "resolvedDotDot", "(", "IPath", "reference", ")", "{", "IPath", "resolvedPath", "=", "resolveDotDot", "(", "reference", ",", "this", ".", "path", ")", ";", "if", "(", "resolvedPath", "==", "this", ".", "path", ")", "return", "this", ";", "return", "new", "ClasspathEntry", "(", "getContentKind", "(", ")", ",", "getEntryKind", "(", ")", ",", "resolvedPath", ",", "this", ".", "inclusionPatterns", ",", "this", ".", "exclusionPatterns", ",", "getSourceAttachmentPath", "(", ")", ",", "getSourceAttachmentRootPath", "(", ")", ",", "getOutputLocation", "(", ")", ",", "this", ".", "getReferencingEntry", "(", ")", ",", "this", ".", "isExported", ",", "getAccessRules", "(", ")", ",", "this", ".", "combineAccessRules", ",", "this", ".", "extraAttributes", ")", ";", "}", "public", "ClasspathEntry", "[", "]", "resolvedChainedLibraries", "(", ")", "{", "IPath", "[", "]", "paths", "=", "resolvedChainedLibraries", "(", "getPath", "(", ")", ")", ";", "int", "length", "=", "paths", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "NO_ENTRIES", ";", "ClasspathEntry", "[", "]", "result", "=", "new", "ClasspathEntry", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "new", "ClasspathEntry", "(", "getContentKind", "(", ")", ",", "getEntryKind", "(", ")", ",", "paths", "[", "i", "]", ",", "this", ".", "inclusionPatterns", ",", "this", ".", "exclusionPatterns", ",", "null", ",", "null", ",", "getOutputLocation", "(", ")", ",", "this", ",", "this", ".", "isExported", ",", "getAccessRules", "(", ")", ",", "this", ".", "combineAccessRules", ",", "NO_EXTRA_ATTRIBUTES", ")", ";", "}", "return", "result", ";", "}", "public", "String", "rootID", "(", ")", "{", "if", "(", "this", ".", "rootID", "==", "null", ")", "{", "switch", "(", "this", ".", "entryKind", ")", "{", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "this", ".", "rootID", "=", "\"[LIB]\"", "+", "this", ".", "path", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "this", ".", "rootID", "=", "\"[PRJ]\"", "+", "this", ".", "path", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "this", ".", "rootID", "=", "\"[SRC]\"", "+", "this", ".", "path", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_VARIABLE", ":", "this", ".", "rootID", "=", "\"[VAR]\"", "+", "this", ".", "path", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_CONTAINER", ":", "this", ".", "rootID", "=", "\"[CON]\"", "+", "this", ".", "path", ";", "break", ";", "default", ":", "this", ".", "rootID", "=", "\"\"", ";", "break", ";", "}", "}", "return", "this", ".", "rootID", ";", "}", "public", "IClasspathEntry", "getResolvedEntry", "(", ")", "{", "return", "JavaCore", ".", "getResolvedClasspathEntry", "(", "this", ")", ";", "}", "public", "static", "IJavaModelStatus", "validateClasspath", "(", "IJavaProject", "javaProject", ",", "IClasspathEntry", "[", "]", "rawClasspath", ",", "IPath", "projectOutputLocation", ")", "{", "IProject", "project", "=", "javaProject", ".", "getProject", "(", ")", ";", "IPath", "projectPath", "=", "project", ".", "getFullPath", "(", ")", ";", "String", "projectName", "=", "javaProject", ".", "getElementName", "(", ")", ";", "if", "(", "projectOutputLocation", "==", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NULL_PATH", ")", ";", "}", "if", "(", "projectOutputLocation", ".", "isAbsolute", "(", ")", ")", "{", "if", "(", "!", "projectPath", ".", "isPrefixOf", "(", "projectOutputLocation", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "PATH_OUTSIDE_PROJECT", ",", "javaProject", ",", "projectOutputLocation", ".", "toString", "(", ")", ")", ";", "}", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "RELATIVE_PATH", ",", "projectOutputLocation", ")", ";", "}", "boolean", "hasSource", "=", "false", ";", "boolean", "hasLibFolder", "=", "false", ";", "if", "(", "rawClasspath", "==", "null", ")", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "int", "rawLength", "=", "rawClasspath", ".", "length", ";", "HashSet", "pathes", "=", "new", "HashSet", "(", "rawLength", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rawLength", ";", "i", "++", ")", "{", "IPath", "entryPath", "=", "rawClasspath", "[", "i", "]", ".", "getPath", "(", ")", ";", "if", "(", "!", "pathes", ".", "add", "(", "entryPath", ")", ")", "{", "String", "entryPathMsg", "=", "projectName", ".", "equals", "(", "entryPath", ".", "segment", "(", "0", ")", ")", "?", "entryPath", ".", "removeFirstSegments", "(", "1", ")", ".", "toString", "(", ")", ":", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ";", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_duplicateEntryPath", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "projectName", "}", ")", ")", ";", "}", "}", "IClasspathEntry", "[", "]", "classpath", ";", "try", "{", "classpath", "=", "(", "(", "JavaProject", ")", "javaProject", ")", ".", "resolveClasspath", "(", "rawClasspath", ",", "false", ",", "false", ")", ".", "resolvedClasspath", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "e", ".", "getJavaModelStatus", "(", ")", ";", "}", "int", "length", "=", "classpath", ".", "length", ";", "int", "outputCount", "=", "1", ";", "IPath", "[", "]", "outputLocations", "=", "new", "IPath", "[", "length", "+", "1", "]", ";", "boolean", "[", "]", "allowNestingInOutputLocations", "=", "new", "boolean", "[", "length", "+", "1", "]", ";", "outputLocations", "[", "0", "]", "=", "projectOutputLocation", ";", "IPath", "potentialNestedOutput", "=", "null", ";", "int", "sourceEntryCount", "=", "0", ";", "boolean", "disableExclusionPatterns", "=", "JavaCore", ".", "DISABLED", ".", "equals", "(", "javaProject", ".", "getOption", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS", ",", "true", ")", ")", ";", "boolean", "disableCustomOutputLocations", "=", "JavaCore", ".", "DISABLED", ".", "equals", "(", "javaProject", ".", "getOption", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS", ",", "true", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "resolvedEntry", "=", "classpath", "[", "i", "]", ";", "if", "(", "disableExclusionPatterns", "&&", "(", "(", "resolvedEntry", ".", "getInclusionPatterns", "(", ")", "!=", "null", "&&", "resolvedEntry", ".", "getInclusionPatterns", "(", ")", ".", "length", ">", "0", ")", "||", "(", "resolvedEntry", ".", "getExclusionPatterns", "(", ")", "!=", "null", "&&", "resolvedEntry", ".", "getExclusionPatterns", "(", ")", ".", "length", ">", "0", ")", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "DISABLED_CP_EXCLUSION_PATTERNS", ",", "javaProject", ",", "resolvedEntry", ".", "getPath", "(", ")", ")", ";", "}", "switch", "(", "resolvedEntry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "sourceEntryCount", "++", ";", "IPath", "customOutput", ";", "if", "(", "(", "customOutput", "=", "resolvedEntry", ".", "getOutputLocation", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "disableCustomOutputLocations", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS", ",", "javaProject", ",", "resolvedEntry", ".", "getPath", "(", ")", ")", ";", "}", "if", "(", "customOutput", ".", "isAbsolute", "(", ")", ")", "{", "if", "(", "!", "javaProject", ".", "getPath", "(", ")", ".", "isPrefixOf", "(", "customOutput", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "PATH_OUTSIDE_PROJECT", ",", "javaProject", ",", "customOutput", ".", "toString", "(", ")", ")", ";", "}", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "RELATIVE_PATH", ",", "customOutput", ")", ";", "}", "if", "(", "Util", ".", "indexOfMatchingPath", "(", "customOutput", ",", "outputLocations", ",", "outputCount", ")", "!=", "-", "1", ")", "{", "continue", ";", "}", "outputLocations", "[", "outputCount", "++", "]", "=", "customOutput", ";", "}", "}", "}", "for", "(", "int", "i", "=", "1", ";", "i", "<", "outputCount", ";", "i", "++", ")", "{", "IPath", "customOutput", "=", "outputLocations", "[", "i", "]", ";", "int", "index", ";", "if", "(", "(", "index", "=", "Util", ".", "indexOfEnclosingPath", "(", "customOutput", ",", "outputLocations", ",", "outputCount", ")", ")", "!=", "-", "1", "&&", "index", "!=", "i", ")", "{", "if", "(", "index", "==", "0", ")", "{", "if", "(", "potentialNestedOutput", "==", "null", ")", "potentialNestedOutput", "=", "customOutput", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotNestOutputInOutput", ",", "new", "String", "[", "]", "{", "customOutput", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "outputLocations", "[", "index", "]", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", "}", ")", ")", ";", "}", "}", "}", "if", "(", "sourceEntryCount", "<=", "outputCount", "-", "1", ")", "{", "allowNestingInOutputLocations", "[", "0", "]", "=", "true", ";", "}", "else", "if", "(", "potentialNestedOutput", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotNestOutputInOutput", ",", "new", "String", "[", "]", "{", "potentialNestedOutput", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "outputLocations", "[", "0", "]", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", "}", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "resolvedEntry", "=", "classpath", "[", "i", "]", ";", "IPath", "path", "=", "resolvedEntry", ".", "getPath", "(", ")", ";", "int", "index", ";", "switch", "(", "resolvedEntry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "hasSource", "=", "true", ";", "if", "(", "(", "index", "=", "Util", ".", "indexOfMatchingPath", "(", "path", ",", "outputLocations", ",", "outputCount", ")", ")", "!=", "-", "1", ")", "{", "allowNestingInOutputLocations", "[", "index", "]", "=", "true", ";", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "false", ")", ";", "hasLibFolder", "|=", "target", "instanceof", "IContainer", ";", "if", "(", "(", "index", "=", "Util", ".", "indexOfMatchingPath", "(", "path", ",", "outputLocations", ",", "outputCount", ")", ")", "!=", "-", "1", ")", "{", "allowNestingInOutputLocations", "[", "index", "]", "=", "true", ";", "}", "break", ";", "}", "}", "if", "(", "!", "hasSource", "&&", "!", "hasLibFolder", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "outputCount", ";", "i", "++", ")", "allowNestingInOutputLocations", "[", "i", "]", "=", "true", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "i", "]", ";", "if", "(", "entry", "==", "null", ")", "continue", ";", "IPath", "entryPath", "=", "entry", ".", "getPath", "(", ")", ";", "int", "kind", "=", "entry", ".", "getEntryKind", "(", ")", ";", "if", "(", "entryPath", ".", "equals", "(", "projectPath", ")", ")", "{", "if", "(", "kind", "==", "IClasspathEntry", ".", "CPE_PROJECT", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_PATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotReferToItself", ",", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ")", ")", ";", "}", "continue", ";", "}", "if", "(", "kind", "==", "IClasspathEntry", ".", "CPE_SOURCE", "||", "(", "kind", "==", "IClasspathEntry", ".", "CPE_LIBRARY", "&&", "(", "JavaModel", ".", "getTarget", "(", "entryPath", ",", "false", ")", "instanceof", "IContainer", ")", ")", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "classpath", ".", "length", ";", "j", "++", ")", "{", "IClasspathEntry", "otherEntry", "=", "classpath", "[", "j", "]", ";", "if", "(", "otherEntry", "==", "null", ")", "continue", ";", "int", "otherKind", "=", "otherEntry", ".", "getEntryKind", "(", ")", ";", "IPath", "otherPath", "=", "otherEntry", ".", "getPath", "(", ")", ";", "if", "(", "entry", "!=", "otherEntry", "&&", "(", "otherKind", "==", "IClasspathEntry", ".", "CPE_SOURCE", "||", "(", "otherKind", "==", "IClasspathEntry", ".", "CPE_LIBRARY", "&&", "(", "JavaModel", ".", "getTarget", "(", "otherPath", ",", "false", ")", "instanceof", "IContainer", ")", ")", ")", ")", "{", "char", "[", "]", "[", "]", "inclusionPatterns", ",", "exclusionPatterns", ";", "if", "(", "otherPath", ".", "isPrefixOf", "(", "entryPath", ")", "&&", "!", "otherPath", ".", "equals", "(", "entryPath", ")", "&&", "!", "Util", ".", "isExcluded", "(", "entryPath", ".", "append", "(", "\"*\"", ")", ",", "inclusionPatterns", "=", "(", "(", "ClasspathEntry", ")", "otherEntry", ")", ".", "fullInclusionPatternChars", "(", ")", ",", "exclusionPatterns", "=", "(", "(", "ClasspathEntry", ")", "otherEntry", ")", ".", "fullExclusionPatternChars", "(", ")", ",", "false", ")", ")", "{", "String", "exclusionPattern", "=", "entryPath", ".", "removeFirstSegments", "(", "otherPath", ".", "segmentCount", "(", ")", ")", ".", "segment", "(", "0", ")", ";", "if", "(", "Util", ".", "isExcluded", "(", "entryPath", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "false", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_mustEndWithSlash", ",", "new", "String", "[", "]", "{", "exclusionPattern", ",", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", "}", ")", ")", ";", "}", "else", "{", "if", "(", "otherKind", "==", "IClasspathEntry", ".", "CPE_SOURCE", ")", "{", "exclusionPattern", "+=", "'/'", ";", "if", "(", "!", "disableExclusionPatterns", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotNestEntryInEntry", ",", "new", "String", "[", "]", "{", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "otherEntry", ".", "getPath", "(", ")", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "exclusionPattern", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotNestEntryInEntryNoExclusion", ",", "new", "String", "[", "]", "{", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "otherEntry", ".", "getPath", "(", ")", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "exclusionPattern", "}", ")", ")", ";", "}", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotNestEntryInLibrary", ",", "new", "String", "[", "]", "{", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "otherEntry", ".", "getPath", "(", ")", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", "}", ")", ")", ";", "}", "}", "}", "}", "}", "}", "char", "[", "]", "[", "]", "inclusionPatterns", "=", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullInclusionPatternChars", "(", ")", ";", "char", "[", "]", "[", "]", "exclusionPatterns", "=", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullExclusionPatternChars", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "outputCount", ";", "j", "++", ")", "{", "IPath", "currentOutput", "=", "outputLocations", "[", "j", "]", ";", "if", "(", "entryPath", ".", "equals", "(", "currentOutput", ")", ")", "continue", ";", "if", "(", "entryPath", ".", "isPrefixOf", "(", "currentOutput", ")", ")", "{", "if", "(", "kind", "!=", "IClasspathEntry", ".", "CPE_SOURCE", "||", "!", "Util", ".", "isExcluded", "(", "currentOutput", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "true", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotNestOutputInEntry", ",", "new", "String", "[", "]", "{", "currentOutput", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", "}", ")", ")", ";", "}", "}", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "outputCount", ";", "j", "++", ")", "{", "if", "(", "allowNestingInOutputLocations", "[", "j", "]", ")", "continue", ";", "IPath", "currentOutput", "=", "outputLocations", "[", "j", "]", ";", "if", "(", "currentOutput", ".", "isPrefixOf", "(", "entryPath", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotNestEntryInOutput", ",", "new", "String", "[", "]", "{", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "currentOutput", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", "}", ")", ")", ";", "}", "}", "}", "IJavaModelStatus", "cachedStatus", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "i", "]", ";", "if", "(", "entry", "==", "null", ")", "continue", ";", "IPath", "entryPath", "=", "entry", ".", "getPath", "(", ")", ";", "int", "kind", "=", "entry", ".", "getEntryKind", "(", ")", ";", "boolean", "isProjectRelative", "=", "projectName", ".", "equals", "(", "entryPath", ".", "segment", "(", "0", ")", ")", ";", "String", "entryPathMsg", "=", "isProjectRelative", "?", "entryPath", ".", "removeFirstSegments", "(", "1", ")", ".", "toString", "(", ")", ":", "entryPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "kind", "==", "IClasspathEntry", ".", "CPE_SOURCE", ")", "{", "IPath", "output", "=", "entry", ".", "getOutputLocation", "(", ")", ";", "if", "(", "output", "==", "null", ")", "output", "=", "projectOutputLocation", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length", ";", "j", "++", ")", "{", "IClasspathEntry", "otherEntry", "=", "classpath", "[", "j", "]", ";", "if", "(", "otherEntry", "==", "entry", ")", "continue", ";", "switch", "(", "otherEntry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "String", "option", "=", "javaProject", ".", "getOption", "(", "JavaCore", ".", "CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ",", "true", ")", ";", "if", "(", "otherEntry", ".", "getPath", "(", ")", ".", "equals", "(", "output", ")", "&&", "!", "JavaCore", ".", "IGNORE", ".", "equals", "(", "option", ")", ")", "{", "boolean", "opStartsWithProject", "=", "projectName", ".", "equals", "(", "otherEntry", ".", "getPath", "(", ")", ".", "segment", "(", "0", ")", ")", ";", "String", "otherPathMsg", "=", "opStartsWithProject", "?", "otherEntry", ".", "getPath", "(", ")", ".", "removeFirstSegments", "(", "1", ")", ".", "toString", "(", ")", ":", "otherEntry", ".", "getPath", "(", ")", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "JavaCore", ".", "ERROR", ".", "equals", "(", "option", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IStatus", ".", "ERROR", ",", "IJavaModelStatusConstants", ".", "OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotUseDistinctSourceFolderAsOutput", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "otherPathMsg", ",", "projectName", "}", ")", ")", ";", "}", "if", "(", "cachedStatus", "==", "null", ")", "{", "cachedStatus", "=", "new", "JavaModelStatus", "(", "IStatus", ".", "OK", ",", "IJavaModelStatusConstants", ".", "OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotUseDistinctSourceFolderAsOutput", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "otherPathMsg", ",", "projectName", "}", ")", ")", "{", "public", "boolean", "isOK", "(", ")", "{", "return", "true", ";", "}", "}", ";", "}", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "if", "(", "output", "!=", "projectOutputLocation", "&&", "otherEntry", ".", "getPath", "(", ")", ".", "equals", "(", "output", ")", ")", "{", "boolean", "opStartsWithProject", "=", "projectName", ".", "equals", "(", "otherEntry", ".", "getPath", "(", ")", ".", "segment", "(", "0", ")", ")", ";", "String", "otherPathMsg", "=", "opStartsWithProject", "?", "otherEntry", ".", "getPath", "(", ")", ".", "removeFirstSegments", "(", "1", ")", ".", "toString", "(", ")", ":", "otherEntry", ".", "getPath", "(", ")", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ";", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotUseLibraryAsOutput", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "otherPathMsg", ",", "projectName", "}", ")", ")", ";", "}", "}", "}", "}", "}", "if", "(", "cachedStatus", "!=", "null", ")", "return", "cachedStatus", ";", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "public", "static", "IJavaModelStatus", "validateClasspathEntry", "(", "IJavaProject", "project", ",", "IClasspathEntry", "entry", ",", "boolean", "checkSourceAttachment", ",", "boolean", "referredByContainer", ")", "{", "IJavaModelStatus", "status", "=", "validateClasspathEntry", "(", "project", ",", "entry", ",", "null", ",", "checkSourceAttachment", ",", "referredByContainer", ")", ";", "int", "statusCode", "=", "status", ".", "getCode", "(", ")", ";", "if", "(", "(", "statusCode", "==", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", "||", "statusCode", "==", "IJavaModelStatusConstants", ".", "CP_CONTAINER_PATH_UNBOUND", "||", "statusCode", "==", "IJavaModelStatusConstants", ".", "CP_VARIABLE_PATH_UNBOUND", "||", "statusCode", "==", "IJavaModelStatusConstants", ".", "INVALID_PATH", ")", "&&", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "isOptional", "(", ")", ")", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "return", "status", ";", "}", "private", "static", "IJavaModelStatus", "validateClasspathEntry", "(", "IJavaProject", "project", ",", "IClasspathEntry", "entry", ",", "IClasspathContainer", "entryContainer", ",", "boolean", "checkSourceAttachment", ",", "boolean", "referredByContainer", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "String", "projectName", "=", "project", ".", "getElementName", "(", ")", ";", "String", "entryPathMsg", "=", "projectName", ".", "equals", "(", "path", ".", "segment", "(", "0", ")", ")", "?", "path", ".", "removeFirstSegments", "(", "1", ")", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ":", "path", ".", "toString", "(", ")", ";", "switch", "(", "entry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_CONTAINER", ":", "if", "(", "path", ".", "segmentCount", "(", ")", ">=", "1", ")", "{", "try", "{", "IJavaModelStatus", "status", "=", "null", ";", "IClasspathAttribute", "[", "]", "extraAttributes", "=", "entry", ".", "getExtraAttributes", "(", ")", ";", "if", "(", "extraAttributes", "!=", "null", ")", "{", "int", "length", "=", "extraAttributes", ".", "length", ";", "HashSet", "set", "=", "new", "HashSet", "(", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "attName", "=", "extraAttributes", "[", "i", "]", ".", "getName", "(", ")", ";", "if", "(", "!", "set", ".", "add", "(", "attName", ")", ")", "{", "status", "=", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_duplicateEntryExtraAttribute", ",", "new", "String", "[", "]", "{", "attName", ",", "entryPathMsg", ",", "projectName", "}", ")", ")", ";", "break", ";", "}", "}", "}", "IClasspathContainer", "container", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getClasspathContainer", "(", "path", ",", "project", ")", ";", "if", "(", "container", "==", "null", ")", "{", "if", "(", "status", "!=", "null", ")", "return", "status", ";", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "CP_CONTAINER_PATH_UNBOUND", ",", "project", ",", "path", ")", ";", "}", "else", "if", "(", "container", "==", "JavaModelManager", ".", "CONTAINER_INITIALIZATION_IN_PROGRESS", ")", "{", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "IClasspathEntry", "[", "]", "containerEntries", "=", "container", ".", "getClasspathEntries", "(", ")", ";", "if", "(", "containerEntries", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "containerEntries", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "containerEntry", "=", "containerEntries", "[", "i", "]", ";", "int", "kind", "=", "containerEntry", "==", "null", "?", "0", ":", "containerEntry", ".", "getEntryKind", "(", ")", ";", "if", "(", "containerEntry", "==", "null", "||", "kind", "==", "IClasspathEntry", ".", "CPE_SOURCE", "||", "kind", "==", "IClasspathEntry", ".", "CPE_VARIABLE", "||", "kind", "==", "IClasspathEntry", ".", "CPE_CONTAINER", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CP_CONTAINER_ENTRY", ",", "project", ",", "path", ")", ";", "}", "IJavaModelStatus", "containerEntryStatus", "=", "validateClasspathEntry", "(", "project", ",", "containerEntry", ",", "container", ",", "checkSourceAttachment", ",", "true", ")", ";", "if", "(", "!", "containerEntryStatus", ".", "isOK", "(", ")", ")", "{", "return", "containerEntryStatus", ";", "}", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "new", "JavaModelStatus", "(", "e", ")", ";", "}", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalContainerPath", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "projectName", "}", ")", ")", ";", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_VARIABLE", ":", "if", "(", "path", ".", "segmentCount", "(", ")", ">=", "1", ")", "{", "try", "{", "entry", "=", "JavaCore", ".", "getResolvedClasspathEntry", "(", "entry", ")", ";", "}", "catch", "(", "AssertionFailedException", "e", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_PATH", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "entry", "==", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "CP_VARIABLE_PATH_UNBOUND", ",", "project", ",", "path", ")", ";", "}", "IJavaModelStatus", "status", "=", "validateClasspathEntry", "(", "project", ",", "entry", ",", "null", ",", "checkSourceAttachment", ",", "false", ")", ";", "if", "(", "!", "status", ".", "isOK", "(", ")", ")", "return", "status", ";", "String", "variableName", "=", "path", ".", "segment", "(", "0", ")", ";", "String", "deprecatedMessage", "=", "JavaCore", ".", "getClasspathVariableDeprecationMessage", "(", "variableName", ")", ";", "if", "(", "deprecatedMessage", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IStatus", ".", "WARNING", ",", "IJavaModelStatusConstants", ".", "DEPRECATED_VARIABLE", ",", "project", ",", "path", ",", "deprecatedMessage", ")", ";", "}", "return", "status", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalVariablePath", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "projectName", "}", ")", ")", ";", "}", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "path", "=", "ClasspathEntry", ".", "resolveDotDot", "(", "project", ".", "getProject", "(", ")", ".", "getLocation", "(", ")", ",", "path", ")", ";", "String", "containerInfo", "=", "null", ";", "if", "(", "entryContainer", "!=", "null", ")", "{", "if", "(", "entryContainer", "instanceof", "UserLibraryClasspathContainer", ")", "{", "containerInfo", "=", "Messages", ".", "bind", "(", "Messages", ".", "classpath_userLibraryInfo", ",", "new", "String", "[", "]", "{", "entryContainer", ".", "getDescription", "(", ")", "}", ")", ";", "}", "else", "{", "containerInfo", "=", "Messages", ".", "bind", "(", "Messages", ".", "classpath_containerInfo", ",", "new", "String", "[", "]", "{", "entryContainer", ".", "getDescription", "(", ")", "}", ")", ";", "}", "}", "IJavaModelStatus", "status", "=", "validateLibraryEntry", "(", "path", ",", "project", ",", "containerInfo", ",", "checkSourceAttachment", "?", "entry", ".", "getSourceAttachmentPath", "(", ")", ":", "null", ",", "entryPathMsg", ")", ";", "if", "(", "status", ".", "getCode", "(", ")", "==", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", "&&", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "isOptional", "(", ")", ")", "status", "=", "JavaModelStatus", ".", "VERIFIED_OK", ";", "if", "(", "!", "status", ".", "isOK", "(", ")", ")", "return", "status", ";", "break", ";", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "if", "(", "path", ".", "isAbsolute", "(", ")", "&&", "path", ".", "segmentCount", "(", ")", "==", "1", ")", "{", "IProject", "prereqProjectRsc", "=", "workspaceRoot", ".", "getProject", "(", "path", ".", "segment", "(", "0", ")", ")", ";", "IJavaProject", "prereqProject", "=", "JavaCore", ".", "create", "(", "prereqProjectRsc", ")", ";", "try", "{", "if", "(", "!", "prereqProjectRsc", ".", "exists", "(", ")", "||", "!", "prereqProjectRsc", ".", "hasNature", "(", "JavaCore", ".", "NATURE_ID", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundProject", ",", "new", "String", "[", "]", "{", "path", ".", "segment", "(", "0", ")", ",", "projectName", "}", ")", ")", ";", "}", "if", "(", "!", "prereqProjectRsc", ".", "isOpen", "(", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_closedProject", ",", "new", "String", "[", "]", "{", "path", ".", "segment", "(", "0", ")", "}", ")", ")", ";", "}", "if", "(", "!", "JavaCore", ".", "IGNORE", ".", "equals", "(", "project", ".", "getOption", "(", "JavaCore", ".", "CORE_INCOMPATIBLE_JDK_LEVEL", ",", "true", ")", ")", ")", "{", "long", "projectTargetJDK", "=", "CompilerOptions", ".", "versionToJdkLevel", "(", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_CODEGEN_TARGET_PLATFORM", ",", "true", ")", ")", ";", "long", "prereqProjectTargetJDK", "=", "CompilerOptions", ".", "versionToJdkLevel", "(", "prereqProject", ".", "getOption", "(", "JavaCore", ".", "COMPILER_CODEGEN_TARGET_PLATFORM", ",", "true", ")", ")", ";", "if", "(", "prereqProjectTargetJDK", ">", "projectTargetJDK", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INCOMPATIBLE_JDK_LEVEL", ",", "project", ",", "path", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_incompatibleLibraryJDKLevel", ",", "new", "String", "[", "]", "{", "project", ".", "getElementName", "(", ")", ",", "CompilerOptions", ".", "versionFromJdkLevel", "(", "projectTargetJDK", ")", ",", "path", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "CompilerOptions", ".", "versionFromJdkLevel", "(", "prereqProjectTargetJDK", ")", "}", ")", ")", ";", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundProject", ",", "new", "String", "[", "]", "{", "path", ".", "segment", "(", "0", ")", ",", "projectName", "}", ")", ")", ";", "}", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalProjectPath", ",", "new", "String", "[", "]", "{", "path", ".", "toString", "(", ")", ",", "projectName", "}", ")", ")", ";", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_SOURCE", ":", "if", "(", "(", "(", "entry", ".", "getInclusionPatterns", "(", ")", "!=", "null", "&&", "entry", ".", "getInclusionPatterns", "(", ")", ".", "length", ">", "0", ")", "||", "(", "entry", ".", "getExclusionPatterns", "(", ")", "!=", "null", "&&", "entry", ".", "getExclusionPatterns", "(", ")", ".", "length", ">", "0", ")", ")", "&&", "JavaCore", ".", "DISABLED", ".", "equals", "(", "project", ".", "getOption", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS", ",", "true", ")", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "DISABLED_CP_EXCLUSION_PATTERNS", ",", "project", ",", "path", ")", ";", "}", "if", "(", "entry", ".", "getOutputLocation", "(", ")", "!=", "null", "&&", "JavaCore", ".", "DISABLED", ".", "equals", "(", "project", ".", "getOption", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS", ",", "true", ")", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS", ",", "project", ",", "path", ")", ";", "}", "if", "(", "path", ".", "isAbsolute", "(", ")", "&&", "!", "path", ".", "isEmpty", "(", ")", ")", "{", "IPath", "projectPath", "=", "project", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ";", "if", "(", "!", "projectPath", ".", "isPrefixOf", "(", "path", ")", "||", "JavaModel", ".", "getTarget", "(", "path", ",", "true", ")", "==", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundSourceFolder", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "projectName", "}", ")", ")", ";", "}", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalSourceFolderPath", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "projectName", "}", ")", ")", ";", "}", "break", ";", "}", "IClasspathAttribute", "[", "]", "extraAttributes", "=", "entry", ".", "getExtraAttributes", "(", ")", ";", "if", "(", "extraAttributes", "!=", "null", ")", "{", "int", "length", "=", "extraAttributes", ".", "length", ";", "HashSet", "set", "=", "new", "HashSet", "(", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "attName", "=", "extraAttributes", "[", "i", "]", ".", "getName", "(", ")", ";", "if", "(", "!", "set", ".", "add", "(", "attName", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_duplicateEntryExtraAttribute", ",", "new", "String", "[", "]", "{", "attName", ",", "entryPathMsg", ",", "projectName", "}", ")", ")", ";", "}", "}", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "private", "static", "IJavaModelStatus", "validateLibraryEntry", "(", "IPath", "path", ",", "IJavaProject", "project", ",", "String", "container", ",", "IPath", "sourceAttachment", ",", "String", "entryPathMsg", ")", "{", "if", "(", "path", ".", "isAbsolute", "(", ")", "&&", "!", "path", ".", "isEmpty", "(", ")", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ",", "true", ")", ";", "if", "(", "target", "==", "null", ")", "{", "IPath", "workspaceLocation", "=", "workspaceRoot", ".", "getLocation", "(", ")", ";", "if", "(", "workspaceLocation", ".", "isPrefixOf", "(", "path", ")", ")", "{", "target", "=", "JavaModel", ".", "getTarget", "(", "path", ".", "makeRelativeTo", "(", "workspaceLocation", ")", ".", "makeAbsolute", "(", ")", ",", "true", ")", ";", "}", "}", "if", "(", "target", "!=", "null", "&&", "!", "JavaCore", ".", "IGNORE", ".", "equals", "(", "project", ".", "getOption", "(", "JavaCore", ".", "CORE_INCOMPATIBLE_JDK_LEVEL", ",", "true", ")", ")", ")", "{", "long", "projectTargetJDK", "=", "CompilerOptions", ".", "versionToJdkLevel", "(", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_CODEGEN_TARGET_PLATFORM", ",", "true", ")", ")", ";", "long", "libraryJDK", "=", "Util", ".", "getJdkLevel", "(", "target", ")", ";", "if", "(", "libraryJDK", "!=", "0", "&&", "libraryJDK", ">", "projectTargetJDK", ")", "{", "if", "(", "container", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INCOMPATIBLE_JDK_LEVEL", ",", "project", ",", "path", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_incompatibleLibraryJDKLevelInContainer", ",", "new", "String", "[", "]", "{", "project", ".", "getElementName", "(", ")", ",", "CompilerOptions", ".", "versionFromJdkLevel", "(", "projectTargetJDK", ")", ",", "path", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "container", ",", "CompilerOptions", ".", "versionFromJdkLevel", "(", "libraryJDK", ")", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INCOMPATIBLE_JDK_LEVEL", ",", "project", ",", "path", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_incompatibleLibraryJDKLevel", ",", "new", "String", "[", "]", "{", "project", ".", "getElementName", "(", ")", ",", "CompilerOptions", ".", "versionFromJdkLevel", "(", "projectTargetJDK", ")", ",", "path", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "CompilerOptions", ".", "versionFromJdkLevel", "(", "libraryJDK", ")", "}", ")", ")", ";", "}", "}", "}", "if", "(", "target", "instanceof", "IResource", ")", "{", "IResource", "resolvedResource", "=", "(", "IResource", ")", "target", ";", "switch", "(", "resolvedResource", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "FILE", ":", "if", "(", "sourceAttachment", "!=", "null", "&&", "!", "sourceAttachment", ".", "isEmpty", "(", ")", "&&", "JavaModel", ".", "getTarget", "(", "sourceAttachment", ",", "true", ")", "==", "null", ")", "{", "if", "(", "container", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundSourceAttachmentInContainedLibrary", ",", "new", "String", "[", "]", "{", "sourceAttachment", ".", "toString", "(", ")", ",", "path", ".", "toString", "(", ")", ",", "container", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundSourceAttachment", ",", "new", "String", "[", "]", "{", "sourceAttachment", ".", "toString", "(", ")", ",", "path", ".", "toString", "(", ")", ",", "project", ".", "getElementName", "(", ")", "}", ")", ")", ";", "}", "}", "IJavaModelStatus", "status", "=", "validateLibraryContents", "(", "path", ",", "project", ",", "entryPathMsg", ")", ";", "if", "(", "status", "!=", "JavaModelStatus", ".", "VERIFIED_OK", ")", "return", "status", ";", "break", ";", "case", "IResource", ".", "FOLDER", ":", "if", "(", "sourceAttachment", "!=", "null", "&&", "!", "sourceAttachment", ".", "isEmpty", "(", ")", "&&", "JavaModel", ".", "getTarget", "(", "sourceAttachment", ",", "true", ")", "==", "null", ")", "{", "if", "(", "container", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundSourceAttachmentInContainedLibrary", ",", "new", "String", "[", "]", "{", "sourceAttachment", ".", "toString", "(", ")", ",", "path", ".", "toString", "(", ")", ",", "container", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundSourceAttachment", ",", "new", "String", "[", "]", "{", "sourceAttachment", ".", "toString", "(", ")", ",", "path", ".", "toString", "(", ")", ",", "project", ".", "getElementName", "(", ")", "}", ")", ")", ";", "}", "}", "}", "}", "else", "if", "(", "target", "instanceof", "File", ")", "{", "File", "file", "=", "JavaModel", ".", "getFile", "(", "target", ")", ";", "if", "(", "file", "==", "null", ")", "{", "if", "(", "container", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalExternalFolderInContainer", ",", "new", "String", "[", "]", "{", "path", ".", "toOSString", "(", ")", ",", "container", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalExternalFolder", ",", "new", "String", "[", "]", "{", "path", ".", "toOSString", "(", ")", ",", "project", ".", "getElementName", "(", ")", "}", ")", ")", ";", "}", "}", "else", "{", "if", "(", "sourceAttachment", "!=", "null", "&&", "!", "sourceAttachment", ".", "isEmpty", "(", ")", "&&", "JavaModel", ".", "getTarget", "(", "sourceAttachment", ",", "true", ")", "==", "null", ")", "{", "if", "(", "container", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundSourceAttachmentInContainedLibrary", ",", "new", "String", "[", "]", "{", "sourceAttachment", ".", "toString", "(", ")", ",", "path", ".", "toOSString", "(", ")", ",", "container", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundSourceAttachment", ",", "new", "String", "[", "]", "{", "sourceAttachment", ".", "toString", "(", ")", ",", "path", ".", "toOSString", "(", ")", ",", "project", ".", "getElementName", "(", ")", "}", ")", ")", ";", "}", "}", "if", "(", "file", ".", "isFile", "(", ")", ")", "{", "IJavaModelStatus", "status", "=", "validateLibraryContents", "(", "path", ",", "project", ",", "entryPathMsg", ")", ";", "if", "(", "status", "!=", "JavaModelStatus", ".", "VERIFIED_OK", ")", "return", "status", ";", "}", "}", "}", "else", "{", "boolean", "isExternal", "=", "path", ".", "getDevice", "(", ")", "!=", "null", "||", "!", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProject", "(", "path", ".", "segment", "(", "0", ")", ")", ".", "exists", "(", ")", ";", "if", "(", "isExternal", ")", "{", "if", "(", "container", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundLibraryInContainer", ",", "new", "String", "[", "]", "{", "path", ".", "toOSString", "(", ")", ",", "container", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundLibrary", ",", "new", "String", "[", "]", "{", "path", ".", "toOSString", "(", ")", ",", "project", ".", "getElementName", "(", ")", "}", ")", ")", ";", "}", "}", "else", "{", "if", "(", "entryPathMsg", "==", "null", ")", "entryPathMsg", "=", "project", ".", "getElementName", "(", ")", ".", "equals", "(", "path", ".", "segment", "(", "0", ")", ")", "?", "path", ".", "removeFirstSegments", "(", "1", ")", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ":", "path", ".", "toString", "(", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundLibraryInContainer", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "container", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundLibrary", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "project", ".", "getElementName", "(", ")", "}", ")", ")", ";", "}", "}", "}", "}", "else", "{", "if", "(", "entryPathMsg", "==", "null", ")", "entryPathMsg", "=", "project", ".", "getElementName", "(", ")", ".", "equals", "(", "path", ".", "segment", "(", "0", ")", ")", "?", "path", ".", "removeFirstSegments", "(", "1", ")", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ":", "path", ".", "toString", "(", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalLibraryPathInContainer", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "container", "}", ")", ")", ";", "}", "else", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalLibraryPath", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "project", ".", "getElementName", "(", ")", "}", ")", ")", ";", "}", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "private", "static", "IJavaModelStatus", "validateLibraryContents", "(", "IPath", "path", ",", "IJavaProject", "project", ",", "String", "entryPathMsg", ")", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "try", "{", "manager", ".", "verifyArchiveContent", "(", "path", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "e", ".", "getStatus", "(", ")", ".", "getMessage", "(", ")", "==", "Messages", ".", "status_IOException", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_archiveReadError", ",", "new", "String", "[", "]", "{", "entryPathMsg", ",", "project", ".", "getElementName", "(", ")", "}", ")", ")", ";", "}", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "}", "</s>" ]
3,708
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Assert", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "ISchedulingRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IRegion", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AST", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "public", "class", "DeleteElementsOperation", "extends", "MultiOperation", "{", "protected", "Map", "childrenToRemove", ";", "protected", "ASTParser", "parser", ";", "public", "DeleteElementsOperation", "(", "IJavaElement", "[", "]", "elementsToDelete", ",", "boolean", "force", ")", "{", "super", "(", "elementsToDelete", ",", "force", ")", ";", "initASTParser", "(", ")", ";", "}", "private", "void", "deleteElement", "(", "IJavaElement", "elementToRemove", ",", "ICompilationUnit", "cu", ")", "throws", "JavaModelException", "{", "cu", ".", "makeConsistent", "(", "this", ".", "progressMonitor", ")", ";", "this", ".", "parser", ".", "setSource", "(", "cu", ")", ";", "CompilationUnit", "astCU", "=", "(", "CompilationUnit", ")", "this", ".", "parser", ".", "createAST", "(", "this", ".", "progressMonitor", ")", ";", "ASTNode", "node", "=", "(", "(", "JavaElement", ")", "elementToRemove", ")", ".", "findNode", "(", "astCU", ")", ";", "if", "(", "node", "==", "null", ")", "Assert", ".", "isTrue", "(", "false", ",", "\"\"", "+", "elementToRemove", ".", "getElementName", "(", ")", "+", "\"", "in", "\"", "+", "cu", ".", "getElementName", "(", ")", ")", ";", "AST", "ast", "=", "astCU", ".", "getAST", "(", ")", ";", "ASTRewrite", "rewriter", "=", "ASTRewrite", ".", "create", "(", "ast", ")", ";", "rewriter", ".", "remove", "(", "node", ",", "null", ")", ";", "TextEdit", "edits", "=", "rewriter", ".", "rewriteAST", "(", ")", ";", "applyTextEdit", "(", "cu", ",", "edits", ")", ";", "}", "private", "void", "initASTParser", "(", ")", "{", "this", ".", "parser", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS4", ")", ";", "}", "protected", "String", "getMainTaskName", "(", ")", "{", "return", "Messages", ".", "operation_deleteElementProgress", ";", "}", "protected", "ISchedulingRule", "getSchedulingRule", "(", ")", "{", "if", "(", "this", ".", "elementsToProcess", "!=", "null", "&&", "this", ".", "elementsToProcess", ".", "length", "==", "1", ")", "{", "IResource", "resource", "=", "this", ".", "elementsToProcess", "[", "0", "]", ".", "getResource", "(", ")", ";", "if", "(", "resource", "!=", "null", ")", "return", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRuleFactory", "(", ")", ".", "modifyRule", "(", "resource", ")", ";", "}", "return", "super", ".", "getSchedulingRule", "(", ")", ";", "}", "protected", "void", "groupElements", "(", ")", "throws", "JavaModelException", "{", "this", ".", "childrenToRemove", "=", "new", "HashMap", "(", "1", ")", ";", "int", "uniqueCUs", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "elementsToProcess", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "e", "=", "this", ".", "elementsToProcess", "[", "i", "]", ";", "ICompilationUnit", "cu", "=", "getCompilationUnitFor", "(", "e", ")", ";", "if", "(", "cu", "==", "null", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "READ_ONLY", ",", "e", ")", ")", ";", "}", "else", "{", "IRegion", "region", "=", "(", "IRegion", ")", "this", ".", "childrenToRemove", ".", "get", "(", "cu", ")", ";", "if", "(", "region", "==", "null", ")", "{", "region", "=", "new", "Region", "(", ")", ";", "this", ".", "childrenToRemove", ".", "put", "(", "cu", ",", "region", ")", ";", "uniqueCUs", "+=", "1", ";", "}", "region", ".", "add", "(", "e", ")", ";", "}", "}", "this", ".", "elementsToProcess", "=", "new", "IJavaElement", "[", "uniqueCUs", "]", ";", "Iterator", "iter", "=", "this", ".", "childrenToRemove", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "int", "i", "=", "0", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "this", ".", "elementsToProcess", "[", "i", "++", "]", "=", "(", "IJavaElement", ")", "iter", ".", "next", "(", ")", ";", "}", "}", "protected", "void", "processElement", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "ICompilationUnit", "cu", "=", "(", "ICompilationUnit", ")", "element", ";", "int", "numberOfImports", "=", "cu", ".", "getImports", "(", ")", ".", "length", ";", "JavaElementDelta", "delta", "=", "new", "JavaElementDelta", "(", "cu", ")", ";", "IJavaElement", "[", "]", "cuElements", "=", "(", "(", "IRegion", ")", "this", ".", "childrenToRemove", ".", "get", "(", "cu", ")", ")", ".", "getElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "cuElements", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "e", "=", "cuElements", "[", "i", "]", ";", "if", "(", "e", ".", "exists", "(", ")", ")", "{", "deleteElement", "(", "e", ",", "cu", ")", ";", "delta", ".", "removed", "(", "e", ")", ";", "if", "(", "e", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "IMPORT_DECLARATION", ")", "{", "numberOfImports", "--", ";", "if", "(", "numberOfImports", "==", "0", ")", "{", "delta", ".", "removed", "(", "cu", ".", "getImportContainer", "(", ")", ")", ";", "}", "}", "}", "}", "if", "(", "delta", ".", "getAffectedChildren", "(", ")", ".", "length", ">", "0", ")", "{", "cu", ".", "save", "(", "getSubProgressMonitor", "(", "1", ")", ",", "this", ".", "force", ")", ";", "if", "(", "!", "cu", ".", "isWorkingCopy", "(", ")", ")", "{", "addDelta", "(", "delta", ")", ";", "setAttribute", "(", "HAS_MODIFIED_RESOURCE_ATTR", ",", "TRUE", ")", ";", "}", "}", "}", "protected", "void", "processElements", "(", ")", "throws", "JavaModelException", "{", "groupElements", "(", ")", ";", "super", ".", "processElements", "(", ")", ";", "}", "protected", "void", "verify", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "IJavaElement", "[", "]", "children", "=", "(", "(", "IRegion", ")", "this", ".", "childrenToRemove", ".", "get", "(", "element", ")", ")", ".", "getElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "IJavaElement", "child", "=", "children", "[", "i", "]", ";", "if", "(", "child", ".", "getCorrespondingResource", "(", ")", "!=", "null", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "child", ")", ";", "if", "(", "child", ".", "isReadOnly", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "READ_ONLY", ",", "child", ")", ";", "}", "}", "}", "</s>" ]
3,709
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IOpenable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "DeleteResourceElementsOperation", "extends", "MultiOperation", "{", "protected", "DeleteResourceElementsOperation", "(", "IJavaElement", "[", "]", "elementsToProcess", ",", "boolean", "force", ")", "{", "super", "(", "elementsToProcess", ",", "force", ")", ";", "}", "private", "void", "deletePackageFragment", "(", "IPackageFragment", "frag", ")", "throws", "JavaModelException", "{", "IResource", "res", "=", "(", "(", "JavaElement", ")", "frag", ")", ".", "resource", "(", ")", ";", "if", "(", "res", "!=", "null", ")", "{", "IJavaElement", "[", "]", "childrenOfInterest", "=", "frag", ".", "getChildren", "(", ")", ";", "if", "(", "childrenOfInterest", ".", "length", ">", "0", ")", "{", "IResource", "[", "]", "resources", "=", "new", "IResource", "[", "childrenOfInterest", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childrenOfInterest", ".", "length", ";", "i", "++", ")", "{", "resources", "[", "i", "]", "=", "(", "(", "JavaElement", ")", "childrenOfInterest", "[", "i", "]", ")", ".", "resource", "(", ")", ";", "}", "deleteResources", "(", "resources", ",", "this", ".", "force", ")", ";", "}", "Object", "[", "]", "nonJavaResources", "=", "frag", ".", "getNonJavaResources", "(", ")", ";", "int", "actualResourceCount", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "nonJavaResources", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "nonJavaResources", "[", "i", "]", "instanceof", "IResource", ")", "actualResourceCount", "++", ";", "}", "IResource", "[", "]", "actualNonJavaResources", "=", "new", "IResource", "[", "actualResourceCount", "]", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "nonJavaResources", ".", "length", ",", "index", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "nonJavaResources", "[", "i", "]", "instanceof", "IResource", ")", "actualNonJavaResources", "[", "index", "++", "]", "=", "(", "IResource", ")", "nonJavaResources", "[", "i", "]", ";", "}", "deleteResources", "(", "actualNonJavaResources", ",", "this", ".", "force", ")", ";", "IResource", "[", "]", "remainingFiles", ";", "try", "{", "remainingFiles", "=", "(", "(", "IContainer", ")", "res", ")", ".", "members", "(", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "throw", "new", "JavaModelException", "(", "ce", ")", ";", "}", "boolean", "isEmpty", "=", "true", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "remainingFiles", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IResource", "file", "=", "remainingFiles", "[", "i", "]", ";", "if", "(", "file", "instanceof", "IFile", "&&", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "file", ".", "getName", "(", ")", ")", ")", "{", "deleteResource", "(", "file", ",", "IResource", ".", "FORCE", "|", "IResource", ".", "KEEP_HISTORY", ")", ";", "}", "else", "{", "isEmpty", "=", "false", ";", "}", "}", "if", "(", "isEmpty", "&&", "!", "frag", ".", "isDefaultPackage", "(", ")", ")", "{", "IResource", "fragResource", "=", "(", "(", "JavaElement", ")", "frag", ")", ".", "resource", "(", ")", ";", "if", "(", "fragResource", "!=", "null", ")", "{", "deleteEmptyPackageFragment", "(", "frag", ",", "false", ",", "fragResource", ".", "getParent", "(", ")", ")", ";", "}", "}", "}", "}", "protected", "String", "getMainTaskName", "(", ")", "{", "return", "Messages", ".", "operation_deleteResourceProgress", ";", "}", "protected", "void", "processElement", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "CLASS_FILE", ":", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "deleteResource", "(", "element", ".", "getResource", "(", ")", ",", "this", ".", "force", "?", "IResource", ".", "FORCE", "|", "IResource", ".", "KEEP_HISTORY", ":", "IResource", ".", "KEEP_HISTORY", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "deletePackageFragment", "(", "(", "IPackageFragment", ")", "element", ")", ";", "break", ";", "default", ":", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ")", ";", "}", "if", "(", "element", "instanceof", "IOpenable", ")", "{", "(", "(", "IOpenable", ")", "element", ")", ".", "close", "(", ")", ";", "}", "}", "protected", "void", "verify", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "if", "(", "element", "==", "null", "||", "!", "element", ".", "exists", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "ELEMENT_DOES_NOT_EXIST", ",", "element", ")", ";", "int", "type", "=", "element", ".", "getElementType", "(", ")", ";", "if", "(", "type", "<=", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", "||", "type", ">", "IJavaElement", ".", "COMPILATION_UNIT", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ";", "else", "if", "(", "type", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT", "&&", "element", "instanceof", "JarPackageFragment", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ";", "IResource", "resource", "=", "(", "(", "JavaElement", ")", "element", ")", ".", "resource", "(", ")", ";", "if", "(", "resource", "instanceof", "IFolder", ")", "{", "if", "(", "resource", ".", "isLinked", "(", ")", ")", "{", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_RESOURCE", ",", "element", ")", ";", "}", "}", "}", "}", "</s>" ]
3,710
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IScanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "ITerminalSymbols", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "InvalidInputException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "Constant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeIds", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "MementoTokenizer", ";", "public", "abstract", "class", "Member", "extends", "SourceRefElement", "implements", "IMember", "{", "protected", "Member", "(", "JavaElement", "parent", ")", "{", "super", "(", "parent", ")", ";", "}", "protected", "static", "boolean", "areSimilarMethods", "(", "String", "name1", ",", "String", "[", "]", "params1", ",", "String", "name2", ",", "String", "[", "]", "params2", ",", "String", "[", "]", "simpleNames1", ")", "{", "if", "(", "name1", ".", "equals", "(", "name2", ")", ")", "{", "int", "params1Length", "=", "params1", ".", "length", ";", "if", "(", "params1Length", "==", "params2", ".", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "params1Length", ";", "i", "++", ")", "{", "String", "simpleName1", "=", "simpleNames1", "==", "null", "?", "Signature", ".", "getSimpleName", "(", "Signature", ".", "toString", "(", "Signature", ".", "getTypeErasure", "(", "params1", "[", "i", "]", ")", ")", ")", ":", "simpleNames1", "[", "i", "]", ";", "String", "simpleName2", "=", "Signature", ".", "getSimpleName", "(", "Signature", ".", "toString", "(", "Signature", ".", "getTypeErasure", "(", "params2", "[", "i", "]", ")", ")", ")", ";", "if", "(", "!", "simpleName1", ".", "equals", "(", "simpleName2", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "}", "return", "false", ";", "}", "protected", "static", "Object", "convertConstant", "(", "Constant", "constant", ")", "{", "if", "(", "constant", "==", "null", ")", "return", "null", ";", "if", "(", "constant", "==", "Constant", ".", "NotAConstant", ")", "{", "return", "null", ";", "}", "switch", "(", "constant", ".", "typeID", "(", ")", ")", "{", "case", "TypeIds", ".", "T_boolean", ":", "return", "constant", ".", "booleanValue", "(", ")", "?", "Boolean", ".", "TRUE", ":", "Boolean", ".", "FALSE", ";", "case", "TypeIds", ".", "T_byte", ":", "return", "new", "Byte", "(", "constant", ".", "byteValue", "(", ")", ")", ";", "case", "TypeIds", ".", "T_char", ":", "return", "new", "Character", "(", "constant", ".", "charValue", "(", ")", ")", ";", "case", "TypeIds", ".", "T_double", ":", "return", "new", "Double", "(", "constant", ".", "doubleValue", "(", ")", ")", ";", "case", "TypeIds", ".", "T_float", ":", "return", "new", "Float", "(", "constant", ".", "floatValue", "(", ")", ")", ";", "case", "TypeIds", ".", "T_int", ":", "return", "new", "Integer", "(", "constant", ".", "intValue", "(", ")", ")", ";", "case", "TypeIds", ".", "T_long", ":", "return", "new", "Long", "(", "constant", ".", "longValue", "(", ")", ")", ";", "case", "TypeIds", ".", "T_short", ":", "return", "new", "Short", "(", "constant", ".", "shortValue", "(", ")", ")", ";", "case", "TypeIds", ".", "T_JavaLangString", ":", "return", "constant", ".", "stringValue", "(", ")", ";", "default", ":", "return", "null", ";", "}", "}", "public", "static", "IMethod", "[", "]", "findMethods", "(", "IMethod", "method", ",", "IMethod", "[", "]", "methods", ")", "{", "String", "elementName", "=", "method", ".", "getElementName", "(", ")", ";", "String", "[", "]", "parameters", "=", "method", ".", "getParameterTypes", "(", ")", ";", "int", "paramLength", "=", "parameters", ".", "length", ";", "String", "[", "]", "simpleNames", "=", "new", "String", "[", "paramLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paramLength", ";", "i", "++", ")", "{", "String", "erasure", "=", "Signature", ".", "getTypeErasure", "(", "parameters", "[", "i", "]", ")", ";", "simpleNames", "[", "i", "]", "=", "Signature", ".", "getSimpleName", "(", "Signature", ".", "toString", "(", "erasure", ")", ")", ";", "}", "ArrayList", "list", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "methods", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IMethod", "existingMethod", "=", "methods", "[", "i", "]", ";", "if", "(", "areSimilarMethods", "(", "elementName", ",", "parameters", ",", "existingMethod", ".", "getElementName", "(", ")", ",", "existingMethod", ".", "getParameterTypes", "(", ")", ",", "simpleNames", ")", ")", "{", "list", ".", "add", "(", "existingMethod", ")", ";", "}", "}", "int", "size", "=", "list", ".", "size", "(", ")", ";", "if", "(", "size", "==", "0", ")", "{", "return", "null", ";", "}", "else", "{", "IMethod", "[", "]", "result", "=", "new", "IMethod", "[", "size", "]", ";", "list", ".", "toArray", "(", "result", ")", ";", "return", "result", ";", "}", "}", "public", "String", "[", "]", "getCategories", "(", ")", "throws", "JavaModelException", "{", "IType", "type", "=", "(", "IType", ")", "getAncestor", "(", "IJavaElement", ".", "TYPE", ")", ";", "if", "(", "type", "==", "null", ")", "return", "CharOperation", ".", "NO_STRINGS", ";", "if", "(", "type", ".", "isBinary", "(", ")", ")", "{", "return", "CharOperation", ".", "NO_STRINGS", ";", "}", "else", "{", "SourceTypeElementInfo", "info", "=", "(", "SourceTypeElementInfo", ")", "(", "(", "SourceType", ")", "type", ")", ".", "getElementInfo", "(", ")", ";", "HashMap", "map", "=", "info", ".", "getCategories", "(", ")", ";", "if", "(", "map", "==", "null", ")", "return", "CharOperation", ".", "NO_STRINGS", ";", "String", "[", "]", "categories", "=", "(", "String", "[", "]", ")", "map", ".", "get", "(", "this", ")", ";", "if", "(", "categories", "==", "null", ")", "return", "CharOperation", ".", "NO_STRINGS", ";", "return", "categories", ";", "}", "}", "public", "IClassFile", "getClassFile", "(", ")", "{", "IJavaElement", "element", "=", "getParent", "(", ")", ";", "while", "(", "element", "instanceof", "IMember", ")", "{", "element", "=", "element", ".", "getParent", "(", ")", ";", "}", "if", "(", "element", "instanceof", "IClassFile", ")", "{", "return", "(", "IClassFile", ")", "element", ";", "}", "return", "null", ";", "}", "public", "IType", "getDeclaringType", "(", ")", "{", "JavaElement", "parentElement", "=", "(", "JavaElement", ")", "getParent", "(", ")", ";", "if", "(", "parentElement", ".", "getElementType", "(", ")", "==", "TYPE", ")", "{", "return", "(", "IType", ")", "parentElement", ";", "}", "return", "null", ";", "}", "public", "int", "getFlags", "(", ")", "throws", "JavaModelException", "{", "MemberElementInfo", "info", "=", "(", "MemberElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "getModifiers", "(", ")", ";", "}", "public", "IJavaElement", "getHandleFromMemento", "(", "String", "token", ",", "MementoTokenizer", "memento", ",", "WorkingCopyOwner", "workingCopyOwner", ")", "{", "switch", "(", "token", ".", "charAt", "(", "0", ")", ")", "{", "case", "JEM_COUNT", ":", "return", "getHandleUpdatingCountFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "case", "JEM_TYPE", ":", "String", "typeName", ";", "if", "(", "memento", ".", "hasMoreTokens", "(", ")", ")", "{", "typeName", "=", "memento", ".", "nextToken", "(", ")", ";", "char", "firstChar", "=", "typeName", ".", "charAt", "(", "0", ")", ";", "if", "(", "firstChar", "==", "JEM_FIELD", "||", "firstChar", "==", "JEM_INITIALIZER", "||", "firstChar", "==", "JEM_METHOD", "||", "firstChar", "==", "JEM_TYPE", "||", "firstChar", "==", "JEM_COUNT", ")", "{", "token", "=", "typeName", ";", "typeName", "=", "\"\"", ";", "}", "else", "{", "token", "=", "null", ";", "}", "}", "else", "{", "typeName", "=", "\"\"", ";", "token", "=", "null", ";", "}", "JavaElement", "type", "=", "(", "JavaElement", ")", "getType", "(", "typeName", ",", "1", ")", ";", "if", "(", "token", "==", "null", ")", "{", "return", "type", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "}", "else", "{", "return", "type", ".", "getHandleFromMemento", "(", "token", ",", "memento", ",", "workingCopyOwner", ")", ";", "}", "case", "JEM_LOCALVARIABLE", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "varName", "=", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "int", "declarationStart", "=", "Integer", ".", "parseInt", "(", "memento", ".", "nextToken", "(", ")", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "int", "declarationEnd", "=", "Integer", ".", "parseInt", "(", "memento", ".", "nextToken", "(", ")", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "int", "nameStart", "=", "Integer", ".", "parseInt", "(", "memento", ".", "nextToken", "(", ")", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "int", "nameEnd", "=", "Integer", ".", "parseInt", "(", "memento", ".", "nextToken", "(", ")", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "typeSignature", "=", "memento", ".", "nextToken", "(", ")", ";", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "int", "flags", "=", "Integer", ".", "parseInt", "(", "memento", ".", "nextToken", "(", ")", ")", ";", "memento", ".", "nextToken", "(", ")", ";", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "boolean", "isParameter", "=", "Boolean", ".", "valueOf", "(", "memento", ".", "nextToken", "(", ")", ")", ".", "booleanValue", "(", ")", ";", "return", "new", "LocalVariable", "(", "this", ",", "varName", ",", "declarationStart", ",", "declarationEnd", ",", "nameStart", ",", "nameEnd", ",", "typeSignature", ",", "null", ",", "flags", ",", "isParameter", ")", ";", "case", "JEM_TYPE_PARAMETER", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "typeParameterName", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "typeParameter", "=", "new", "TypeParameter", "(", "this", ",", "typeParameterName", ")", ";", "return", "typeParameter", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "case", "JEM_ANNOTATION", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "annotationName", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "annotation", "=", "new", "Annotation", "(", "this", ",", "annotationName", ")", ";", "return", "annotation", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "}", "return", "null", ";", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JavaElement", ".", "JEM_TYPE", ";", "}", "public", "Member", "getOuterMostLocalContext", "(", ")", "{", "IJavaElement", "current", "=", "this", ";", "Member", "lastLocalContext", "=", "null", ";", "parentLoop", ":", "while", "(", "true", ")", "{", "switch", "(", "current", ".", "getElementType", "(", ")", ")", "{", "case", "CLASS_FILE", ":", "case", "COMPILATION_UNIT", ":", "break", "parentLoop", ";", "case", "TYPE", ":", "break", ";", "case", "INITIALIZER", ":", "case", "FIELD", ":", "case", "METHOD", ":", "lastLocalContext", "=", "(", "Member", ")", "current", ";", "break", ";", "}", "current", "=", "current", ".", "getParent", "(", ")", ";", "}", "return", "lastLocalContext", ";", "}", "public", "ISourceRange", "getJavadocRange", "(", ")", "throws", "JavaModelException", "{", "ISourceRange", "range", "=", "getSourceRange", "(", ")", ";", "if", "(", "range", "==", "null", ")", "return", "null", ";", "IBuffer", "buf", "=", "null", ";", "if", "(", "isBinary", "(", ")", ")", "{", "buf", "=", "getClassFile", "(", ")", ".", "getBuffer", "(", ")", ";", "}", "else", "{", "ICompilationUnit", "compilationUnit", "=", "getCompilationUnit", "(", ")", ";", "if", "(", "!", "compilationUnit", ".", "isConsistent", "(", ")", ")", "{", "return", "null", ";", "}", "buf", "=", "compilationUnit", ".", "getBuffer", "(", ")", ";", "}", "final", "int", "start", "=", "range", ".", "getOffset", "(", ")", ";", "final", "int", "length", "=", "range", ".", "getLength", "(", ")", ";", "if", "(", "length", ">", "0", "&&", "buf", ".", "getChar", "(", "start", ")", "==", "'/'", ")", "{", "IScanner", "scanner", "=", "ToolFactory", ".", "createScanner", "(", "true", ",", "false", ",", "false", ",", "false", ")", ";", "try", "{", "scanner", ".", "setSource", "(", "buf", ".", "getText", "(", "start", ",", "length", ")", ".", "toCharArray", "(", ")", ")", ";", "int", "docOffset", "=", "-", "1", ";", "int", "docEnd", "=", "-", "1", ";", "int", "terminal", "=", "scanner", ".", "getNextToken", "(", ")", ";", "loop", ":", "while", "(", "true", ")", "{", "switch", "(", "terminal", ")", "{", "case", "ITerminalSymbols", ".", "TokenNameCOMMENT_JAVADOC", ":", "docOffset", "=", "scanner", ".", "getCurrentTokenStartPosition", "(", ")", ";", "docEnd", "=", "scanner", ".", "getCurrentTokenEndPosition", "(", ")", "+", "1", ";", "terminal", "=", "scanner", ".", "getNextToken", "(", ")", ";", "break", ";", "case", "ITerminalSymbols", ".", "TokenNameCOMMENT_LINE", ":", "case", "ITerminalSymbols", ".", "TokenNameCOMMENT_BLOCK", ":", "terminal", "=", "scanner", ".", "getNextToken", "(", ")", ";", "continue", "loop", ";", "default", ":", "break", "loop", ";", "}", "}", "if", "(", "docOffset", "!=", "-", "1", ")", "{", "return", "new", "SourceRange", "(", "docOffset", "+", "start", ",", "docEnd", "-", "docOffset", ")", ";", "}", "}", "catch", "(", "InvalidInputException", "ex", ")", "{", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "}", "}", "return", "null", ";", "}", "public", "ISourceRange", "getNameRange", "(", ")", "throws", "JavaModelException", "{", "MemberElementInfo", "info", "=", "(", "MemberElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "new", "SourceRange", "(", "info", ".", "getNameSourceStart", "(", ")", ",", "info", ".", "getNameSourceEnd", "(", ")", "-", "info", ".", "getNameSourceStart", "(", ")", "+", "1", ")", ";", "}", "public", "IType", "getType", "(", "String", "typeName", ",", "int", "count", ")", "{", "if", "(", "isBinary", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "toStringWithAncestors", "(", ")", ")", ";", "}", "else", "{", "SourceType", "type", "=", "new", "SourceType", "(", "this", ",", "typeName", ")", ";", "type", ".", "occurrenceCount", "=", "count", ";", "return", "type", ";", "}", "}", "public", "ITypeRoot", "getTypeRoot", "(", ")", "{", "IJavaElement", "element", "=", "getParent", "(", ")", ";", "while", "(", "element", "instanceof", "IMember", ")", "{", "element", "=", "element", ".", "getParent", "(", ")", ";", "}", "return", "(", "ITypeRoot", ")", "element", ";", "}", "public", "boolean", "isBinary", "(", ")", "{", "return", "false", ";", "}", "protected", "boolean", "isMainMethod", "(", "IMethod", "method", ")", "throws", "JavaModelException", "{", "if", "(", "\"main\"", ".", "equals", "(", "method", ".", "getElementName", "(", ")", ")", "&&", "Signature", ".", "SIG_VOID", ".", "equals", "(", "method", ".", "getReturnType", "(", ")", ")", ")", "{", "int", "flags", "=", "method", ".", "getFlags", "(", ")", ";", "if", "(", "Flags", ".", "isStatic", "(", "flags", ")", "&&", "Flags", ".", "isPublic", "(", "flags", ")", ")", "{", "String", "[", "]", "paramTypes", "=", "method", ".", "getParameterTypes", "(", ")", ";", "if", "(", "paramTypes", ".", "length", "==", "1", ")", "{", "String", "typeSignature", "=", "Signature", ".", "toString", "(", "paramTypes", "[", "0", "]", ")", ";", "return", "\"String[]\"", ".", "equals", "(", "Signature", ".", "getSimpleName", "(", "typeSignature", ")", ")", ";", "}", "}", "}", "return", "false", ";", "}", "public", "boolean", "isReadOnly", "(", ")", "{", "return", "getClassFile", "(", ")", "!=", "null", ";", "}", "public", "String", "readableName", "(", ")", "{", "IJavaElement", "declaringType", "=", "getDeclaringType", "(", ")", ";", "if", "(", "declaringType", "!=", "null", ")", "{", "String", "declaringName", "=", "(", "(", "JavaElement", ")", "getDeclaringType", "(", ")", ")", ".", "readableName", "(", ")", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "declaringName", ")", ";", "buffer", ".", "append", "(", "'.'", ")", ";", "buffer", ".", "append", "(", "getElementName", "(", ")", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "else", "{", "return", "super", ".", "readableName", "(", ")", ";", "}", "}", "}", "</s>" ]
3,711
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "ISafeRunnable", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "SafeRunner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CategorizedProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CompilationParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "ReconcileContext", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AST", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "CompilationUnitDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "ReconcileWorkingCopyOperation", "extends", "JavaModelOperation", "{", "public", "static", "boolean", "PERF", "=", "false", ";", "public", "int", "astLevel", ";", "public", "boolean", "resolveBindings", ";", "public", "HashMap", "problems", ";", "public", "int", "reconcileFlags", ";", "WorkingCopyOwner", "workingCopyOwner", ";", "public", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "ast", ";", "public", "JavaElementDeltaBuilder", "deltaBuilder", ";", "public", "boolean", "requestorIsActive", ";", "public", "ReconcileWorkingCopyOperation", "(", "IJavaElement", "workingCopy", ",", "int", "astLevel", ",", "int", "reconcileFlags", ",", "WorkingCopyOwner", "workingCopyOwner", ")", "{", "super", "(", "new", "IJavaElement", "[", "]", "{", "workingCopy", "}", ")", ";", "this", ".", "astLevel", "=", "astLevel", ";", "this", ".", "reconcileFlags", "=", "reconcileFlags", ";", "this", ".", "workingCopyOwner", "=", "workingCopyOwner", ";", "}", "protected", "void", "executeOperation", "(", ")", "throws", "JavaModelException", "{", "checkCanceled", "(", ")", ";", "try", "{", "beginTask", "(", "Messages", ".", "element_reconciling", ",", "2", ")", ";", "CompilationUnit", "workingCopy", "=", "getWorkingCopy", "(", ")", ";", "boolean", "wasConsistent", "=", "workingCopy", ".", "isConsistent", "(", ")", ";", "IProblemRequestor", "problemRequestor", "=", "workingCopy", ".", "getPerWorkingCopyInfo", "(", ")", ";", "if", "(", "problemRequestor", "!=", "null", ")", "problemRequestor", "=", "(", "(", "JavaModelManager", ".", "PerWorkingCopyInfo", ")", "problemRequestor", ")", ".", "getProblemRequestor", "(", ")", ";", "boolean", "defaultRequestorIsActive", "=", "problemRequestor", "!=", "null", "&&", "problemRequestor", ".", "isActive", "(", ")", ";", "IProblemRequestor", "ownerProblemRequestor", "=", "this", ".", "workingCopyOwner", ".", "getProblemRequestor", "(", "workingCopy", ")", ";", "boolean", "ownerRequestorIsActive", "=", "ownerProblemRequestor", "!=", "null", "&&", "ownerProblemRequestor", "!=", "problemRequestor", "&&", "ownerProblemRequestor", ".", "isActive", "(", ")", ";", "this", ".", "requestorIsActive", "=", "defaultRequestorIsActive", "||", "ownerRequestorIsActive", ";", "this", ".", "deltaBuilder", "=", "new", "JavaElementDeltaBuilder", "(", "workingCopy", ")", ";", "makeConsistent", "(", "workingCopy", ")", ";", "if", "(", "!", "wasConsistent", "||", "(", "(", "this", ".", "reconcileFlags", "&", "ICompilationUnit", ".", "FORCE_PROBLEM_DETECTION", ")", "!=", "0", ")", ")", "{", "notifyParticipants", "(", "workingCopy", ")", ";", "if", "(", "this", ".", "ast", "==", "null", ")", "makeConsistent", "(", "workingCopy", ")", ";", "}", "if", "(", "this", ".", "problems", "!=", "null", "&&", "(", "(", "(", "this", ".", "reconcileFlags", "&", "ICompilationUnit", ".", "FORCE_PROBLEM_DETECTION", ")", "!=", "0", ")", "||", "!", "wasConsistent", ")", ")", "{", "if", "(", "defaultRequestorIsActive", ")", "{", "reportProblems", "(", "workingCopy", ",", "problemRequestor", ")", ";", "}", "if", "(", "ownerRequestorIsActive", ")", "{", "reportProblems", "(", "workingCopy", ",", "ownerProblemRequestor", ")", ";", "}", "}", "JavaElementDelta", "delta", "=", "this", ".", "deltaBuilder", ".", "delta", ";", "if", "(", "delta", "!=", "null", ")", "{", "addReconcileDelta", "(", "workingCopy", ",", "delta", ")", ";", "}", "}", "finally", "{", "done", "(", ")", ";", "}", "}", "private", "void", "reportProblems", "(", "CompilationUnit", "workingCopy", ",", "IProblemRequestor", "problemRequestor", ")", "{", "try", "{", "problemRequestor", ".", "beginReporting", "(", ")", ";", "for", "(", "Iterator", "iteraror", "=", "this", ".", "problems", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "iteraror", ".", "hasNext", "(", ")", ";", ")", "{", "CategorizedProblem", "[", "]", "categorizedProblems", "=", "(", "CategorizedProblem", "[", "]", ")", "iteraror", ".", "next", "(", ")", ";", "if", "(", "categorizedProblems", "==", "null", ")", "continue", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "categorizedProblems", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "CategorizedProblem", "problem", "=", "categorizedProblems", "[", "i", "]", ";", "if", "(", "JavaModelManager", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "problem", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "this", ".", "progressMonitor", "!=", "null", "&&", "this", ".", "progressMonitor", ".", "isCanceled", "(", ")", ")", "break", ";", "problemRequestor", ".", "acceptProblem", "(", "problem", ")", ";", "}", "}", "}", "finally", "{", "problemRequestor", ".", "endReporting", "(", ")", ";", "}", "}", "protected", "CompilationUnit", "getWorkingCopy", "(", ")", "{", "return", "(", "CompilationUnit", ")", "getElementToProcess", "(", ")", ";", "}", "public", "boolean", "isReadOnly", "(", ")", "{", "return", "true", ";", "}", "public", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "makeConsistent", "(", "CompilationUnit", "workingCopy", ")", "throws", "JavaModelException", "{", "if", "(", "!", "workingCopy", ".", "isConsistent", "(", ")", ")", "{", "if", "(", "this", ".", "problems", "==", "null", ")", "this", ".", "problems", "=", "new", "HashMap", "(", ")", ";", "this", ".", "resolveBindings", "=", "this", ".", "requestorIsActive", ";", "this", ".", "ast", "=", "workingCopy", ".", "makeConsistent", "(", "this", ".", "astLevel", ",", "this", ".", "resolveBindings", ",", "this", ".", "reconcileFlags", ",", "this", ".", "problems", ",", "this", ".", "progressMonitor", ")", ";", "this", ".", "deltaBuilder", ".", "buildDeltas", "(", ")", ";", "if", "(", "this", ".", "ast", "!=", "null", "&&", "this", ".", "deltaBuilder", ".", "delta", "!=", "null", ")", "this", ".", "deltaBuilder", ".", "delta", ".", "changedAST", "(", "this", ".", "ast", ")", ";", "return", "this", ".", "ast", ";", "}", "if", "(", "this", ".", "ast", "!=", "null", ")", "return", "this", ".", "ast", ";", "CompilationUnitDeclaration", "unit", "=", "null", ";", "try", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "abortOnMissingSource", ".", "set", "(", "Boolean", ".", "TRUE", ")", ";", "CompilationUnit", "source", "=", "workingCopy", ".", "cloneCachingContents", "(", ")", ";", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "workingCopy", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ")", "&&", "(", "this", ".", "reconcileFlags", "&", "ICompilationUnit", ".", "FORCE_PROBLEM_DETECTION", ")", "!=", "0", ")", "{", "this", ".", "resolveBindings", "=", "this", ".", "requestorIsActive", ";", "if", "(", "this", ".", "problems", "==", "null", ")", "this", ".", "problems", "=", "new", "HashMap", "(", ")", ";", "unit", "=", "CompilationUnitProblemFinder", ".", "process", "(", "source", ",", "this", ".", "workingCopyOwner", ",", "this", ".", "problems", ",", "this", ".", "astLevel", "!=", "ICompilationUnit", ".", "NO_AST", ",", "this", ".", "reconcileFlags", ",", "this", ".", "progressMonitor", ")", ";", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "this", ".", "progressMonitor", ".", "worked", "(", "1", ")", ";", "}", "if", "(", "this", ".", "astLevel", "!=", "ICompilationUnit", ".", "NO_AST", "&&", "unit", "!=", "null", ")", "{", "Map", "options", "=", "workingCopy", ".", "getJavaProject", "(", ")", ".", "getOptions", "(", "true", ")", ";", "this", ".", "ast", "=", "AST", ".", "convertCompilationUnit", "(", "this", ".", "astLevel", ",", "unit", ",", "options", ",", "this", ".", "resolveBindings", ",", "source", ",", "this", ".", "reconcileFlags", ",", "this", ".", "progressMonitor", ")", ";", "if", "(", "this", ".", "ast", "!=", "null", ")", "{", "if", "(", "this", ".", "deltaBuilder", ".", "delta", "==", "null", ")", "{", "this", ".", "deltaBuilder", ".", "delta", "=", "new", "JavaElementDelta", "(", "workingCopy", ")", ";", "}", "this", ".", "deltaBuilder", ".", "delta", ".", "changedAST", "(", "this", ".", "ast", ")", ";", "}", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "this", ".", "progressMonitor", ".", "worked", "(", "1", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "workingCopy", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ")", ")", "throw", "e", ";", "}", "finally", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "abortOnMissingSource", ".", "set", "(", "null", ")", ";", "if", "(", "unit", "!=", "null", ")", "{", "unit", ".", "cleanUp", "(", ")", ";", "}", "}", "return", "this", ".", "ast", ";", "}", "private", "void", "notifyParticipants", "(", "final", "CompilationUnit", "workingCopy", ")", "{", "IJavaProject", "javaProject", "=", "getWorkingCopy", "(", ")", ".", "getJavaProject", "(", ")", ";", "CompilationParticipant", "[", "]", "participants", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "compilationParticipants", ".", "getCompilationParticipants", "(", "javaProject", ")", ";", "if", "(", "participants", "==", "null", ")", "return", ";", "final", "ReconcileContext", "context", "=", "new", "ReconcileContext", "(", "this", ",", "workingCopy", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "participants", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "final", "CompilationParticipant", "participant", "=", "participants", "[", "i", "]", ";", "SafeRunner", ".", "run", "(", "new", "ISafeRunnable", "(", ")", "{", "public", "void", "handleException", "(", "Throwable", "exception", ")", "{", "if", "(", "exception", "instanceof", "Error", ")", "{", "throw", "(", "Error", ")", "exception", ";", "}", "else", "if", "(", "exception", "instanceof", "OperationCanceledException", ")", "throw", "(", "OperationCanceledException", ")", "exception", ";", "else", "if", "(", "exception", "instanceof", "UnsupportedOperationException", ")", "{", "Util", ".", "log", "(", "exception", ",", "\"\"", ")", ";", "}", "else", "Util", ".", "log", "(", "exception", ",", "\"\"", ")", ";", "}", "public", "void", "run", "(", ")", "throws", "Exception", "{", "participant", ".", "reconcile", "(", "context", ")", ";", "}", "}", ")", ";", "}", "}", "protected", "IJavaModelStatus", "verify", "(", ")", "{", "IJavaModelStatus", "status", "=", "super", ".", "verify", "(", ")", ";", "if", "(", "!", "status", ".", "isOK", "(", ")", ")", "{", "return", "status", ";", "}", "CompilationUnit", "workingCopy", "=", "getWorkingCopy", "(", ")", ";", "if", "(", "!", "workingCopy", ".", "isWorkingCopy", "(", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "ELEMENT_DOES_NOT_EXIST", ",", "workingCopy", ")", ";", "}", "return", "status", ";", "}", "}", "</s>" ]
3,712
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "BufferedInputStream", ";", "import", "java", ".", "io", ".", "BufferedOutputStream", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ".", "PerProjectInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "DeltaProcessingState", "implements", "IResourceChangeListener", "{", "public", "IElementChangedListener", "[", "]", "elementChangedListeners", "=", "new", "IElementChangedListener", "[", "5", "]", ";", "public", "int", "[", "]", "elementChangedListenerMasks", "=", "new", "int", "[", "5", "]", ";", "public", "int", "elementChangedListenerCount", "=", "0", ";", "public", "IResourceChangeListener", "[", "]", "preResourceChangeListeners", "=", "new", "IResourceChangeListener", "[", "1", "]", ";", "public", "int", "[", "]", "preResourceChangeEventMasks", "=", "new", "int", "[", "1", "]", ";", "public", "int", "preResourceChangeListenerCount", "=", "0", ";", "private", "ThreadLocal", "deltaProcessors", "=", "new", "ThreadLocal", "(", ")", ";", "public", "void", "doNotUse", "(", ")", "{", "this", ".", "deltaProcessors", ".", "set", "(", "null", ")", ";", "}", "public", "HashMap", "roots", "=", "new", "HashMap", "(", ")", ";", "public", "HashMap", "otherRoots", "=", "new", "HashMap", "(", ")", ";", "public", "HashMap", "oldRoots", "=", "new", "HashMap", "(", ")", ";", "public", "HashMap", "oldOtherRoots", "=", "new", "HashMap", "(", ")", ";", "public", "HashMap", "sourceAttachments", "=", "new", "HashMap", "(", ")", ";", "public", "HashMap", "projectDependencies", "=", "new", "HashMap", "(", ")", ";", "public", "boolean", "rootsAreStale", "=", "true", ";", "private", "Set", "initializingThreads", "=", "Collections", ".", "synchronizedSet", "(", "new", "HashSet", "(", ")", ")", ";", "public", "Hashtable", "externalTimeStamps", ";", "private", "HashMap", "classpathChanges", "=", "new", "HashMap", "(", ")", ";", "private", "HashMap", "classpathValidations", "=", "new", "HashMap", "(", ")", ";", "private", "HashMap", "projectReferenceChanges", "=", "new", "HashMap", "(", ")", ";", "private", "HashMap", "externalFolderChanges", "=", "new", "HashMap", "(", ")", ";", "private", "HashSet", "javaProjectNamesCache", ";", "private", "HashSet", "externalElementsToRefresh", ";", "public", "synchronized", "void", "addElementChangedListener", "(", "IElementChangedListener", "listener", ",", "int", "eventMask", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "elementChangedListenerCount", ";", "i", "++", ")", "{", "if", "(", "this", ".", "elementChangedListeners", "[", "i", "]", "==", "listener", ")", "{", "int", "cloneLength", "=", "this", ".", "elementChangedListenerMasks", ".", "length", ";", "System", ".", "arraycopy", "(", "this", ".", "elementChangedListenerMasks", ",", "0", ",", "this", ".", "elementChangedListenerMasks", "=", "new", "int", "[", "cloneLength", "]", ",", "0", ",", "cloneLength", ")", ";", "this", ".", "elementChangedListenerMasks", "[", "i", "]", "|=", "eventMask", ";", "return", ";", "}", "}", "int", "length", ";", "if", "(", "(", "length", "=", "this", ".", "elementChangedListeners", ".", "length", ")", "==", "this", ".", "elementChangedListenerCount", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "elementChangedListeners", ",", "0", ",", "this", ".", "elementChangedListeners", "=", "new", "IElementChangedListener", "[", "length", "*", "2", "]", ",", "0", ",", "length", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "elementChangedListenerMasks", ",", "0", ",", "this", ".", "elementChangedListenerMasks", "=", "new", "int", "[", "length", "*", "2", "]", ",", "0", ",", "length", ")", ";", "}", "this", ".", "elementChangedListeners", "[", "this", ".", "elementChangedListenerCount", "]", "=", "listener", ";", "this", ".", "elementChangedListenerMasks", "[", "this", ".", "elementChangedListenerCount", "]", "=", "eventMask", ";", "this", ".", "elementChangedListenerCount", "++", ";", "}", "public", "synchronized", "void", "addForRefresh", "(", "IJavaElement", "externalElement", ")", "{", "if", "(", "this", ".", "externalElementsToRefresh", "==", "null", ")", "{", "this", ".", "externalElementsToRefresh", "=", "new", "HashSet", "(", ")", ";", "}", "this", ".", "externalElementsToRefresh", ".", "add", "(", "externalElement", ")", ";", "}", "public", "synchronized", "void", "addPreResourceChangedListener", "(", "IResourceChangeListener", "listener", ",", "int", "eventMask", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "preResourceChangeListenerCount", ";", "i", "++", ")", "{", "if", "(", "this", ".", "preResourceChangeListeners", "[", "i", "]", "==", "listener", ")", "{", "this", ".", "preResourceChangeEventMasks", "[", "i", "]", "|=", "eventMask", ";", "return", ";", "}", "}", "int", "length", ";", "if", "(", "(", "length", "=", "this", ".", "preResourceChangeListeners", ".", "length", ")", "==", "this", ".", "preResourceChangeListenerCount", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "preResourceChangeListeners", ",", "0", ",", "this", ".", "preResourceChangeListeners", "=", "new", "IResourceChangeListener", "[", "length", "*", "2", "]", ",", "0", ",", "length", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "preResourceChangeEventMasks", ",", "0", ",", "this", ".", "preResourceChangeEventMasks", "=", "new", "int", "[", "length", "*", "2", "]", ",", "0", ",", "length", ")", ";", "}", "this", ".", "preResourceChangeListeners", "[", "this", ".", "preResourceChangeListenerCount", "]", "=", "listener", ";", "this", ".", "preResourceChangeEventMasks", "[", "this", ".", "preResourceChangeListenerCount", "]", "=", "eventMask", ";", "this", ".", "preResourceChangeListenerCount", "++", ";", "}", "public", "DeltaProcessor", "getDeltaProcessor", "(", ")", "{", "DeltaProcessor", "deltaProcessor", "=", "(", "DeltaProcessor", ")", "this", ".", "deltaProcessors", ".", "get", "(", ")", ";", "if", "(", "deltaProcessor", "!=", "null", ")", "return", "deltaProcessor", ";", "deltaProcessor", "=", "new", "DeltaProcessor", "(", "this", ",", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ")", ";", "this", ".", "deltaProcessors", ".", "set", "(", "deltaProcessor", ")", ";", "return", "deltaProcessor", ";", "}", "public", "synchronized", "ClasspathChange", "addClasspathChange", "(", "IProject", "project", ",", "IClasspathEntry", "[", "]", "oldRawClasspath", ",", "IPath", "oldOutputLocation", ",", "IClasspathEntry", "[", "]", "oldResolvedClasspath", ")", "{", "ClasspathChange", "change", "=", "(", "ClasspathChange", ")", "this", ".", "classpathChanges", ".", "get", "(", "project", ")", ";", "if", "(", "change", "==", "null", ")", "{", "change", "=", "new", "ClasspathChange", "(", "(", "JavaProject", ")", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProject", "(", "project", ")", ",", "oldRawClasspath", ",", "oldOutputLocation", ",", "oldResolvedClasspath", ")", ";", "this", ".", "classpathChanges", ".", "put", "(", "project", ",", "change", ")", ";", "}", "else", "{", "if", "(", "change", ".", "oldRawClasspath", "==", "null", ")", "change", ".", "oldRawClasspath", "=", "oldRawClasspath", ";", "if", "(", "change", ".", "oldOutputLocation", "==", "null", ")", "change", ".", "oldOutputLocation", "=", "oldOutputLocation", ";", "if", "(", "change", ".", "oldResolvedClasspath", "==", "null", ")", "change", ".", "oldResolvedClasspath", "=", "oldResolvedClasspath", ";", "}", "return", "change", ";", "}", "public", "synchronized", "ClasspathChange", "getClasspathChange", "(", "IProject", "project", ")", "{", "return", "(", "ClasspathChange", ")", "this", ".", "classpathChanges", ".", "get", "(", "project", ")", ";", "}", "public", "synchronized", "HashMap", "removeAllClasspathChanges", "(", ")", "{", "HashMap", "result", "=", "this", ".", "classpathChanges", ";", "this", ".", "classpathChanges", "=", "new", "HashMap", "(", "result", ".", "size", "(", ")", ")", ";", "return", "result", ";", "}", "public", "synchronized", "ClasspathValidation", "addClasspathValidation", "(", "JavaProject", "project", ")", "{", "ClasspathValidation", "validation", "=", "(", "ClasspathValidation", ")", "this", ".", "classpathValidations", ".", "get", "(", "project", ")", ";", "if", "(", "validation", "==", "null", ")", "{", "validation", "=", "new", "ClasspathValidation", "(", "project", ")", ";", "this", ".", "classpathValidations", ".", "put", "(", "project", ",", "validation", ")", ";", "}", "return", "validation", ";", "}", "public", "synchronized", "void", "addExternalFolderChange", "(", "JavaProject", "project", ",", "IClasspathEntry", "[", "]", "oldResolvedClasspath", ")", "{", "ExternalFolderChange", "change", "=", "(", "ExternalFolderChange", ")", "this", ".", "externalFolderChanges", ".", "get", "(", "project", ")", ";", "if", "(", "change", "==", "null", ")", "{", "change", "=", "new", "ExternalFolderChange", "(", "project", ",", "oldResolvedClasspath", ")", ";", "this", ".", "externalFolderChanges", ".", "put", "(", "project", ",", "change", ")", ";", "}", "}", "public", "synchronized", "void", "addProjectReferenceChange", "(", "JavaProject", "project", ",", "IClasspathEntry", "[", "]", "oldResolvedClasspath", ")", "{", "ProjectReferenceChange", "change", "=", "(", "ProjectReferenceChange", ")", "this", ".", "projectReferenceChanges", ".", "get", "(", "project", ")", ";", "if", "(", "change", "==", "null", ")", "{", "change", "=", "new", "ProjectReferenceChange", "(", "project", ",", "oldResolvedClasspath", ")", ";", "this", ".", "projectReferenceChanges", ".", "put", "(", "project", ",", "change", ")", ";", "}", "}", "public", "void", "initializeRoots", "(", "boolean", "initAfterLoad", ")", "{", "HashMap", "[", "]", "rootInfos", "=", "null", ";", "if", "(", "this", ".", "rootsAreStale", ")", "{", "Thread", "currentThread", "=", "Thread", ".", "currentThread", "(", ")", ";", "boolean", "addedCurrentThread", "=", "false", ";", "try", "{", "if", "(", "!", "this", ".", "initializingThreads", ".", "add", "(", "currentThread", ")", ")", "return", ";", "addedCurrentThread", "=", "true", ";", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "forceBatchInitializations", "(", "initAfterLoad", ")", ";", "rootInfos", "=", "getRootInfos", "(", "false", ")", ";", "}", "finally", "{", "if", "(", "addedCurrentThread", ")", "{", "this", ".", "initializingThreads", ".", "remove", "(", "currentThread", ")", ";", "}", "}", "}", "synchronized", "(", "this", ")", "{", "this", ".", "oldRoots", "=", "this", ".", "roots", ";", "this", ".", "oldOtherRoots", "=", "this", ".", "otherRoots", ";", "if", "(", "this", ".", "rootsAreStale", "&&", "rootInfos", "!=", "null", ")", "{", "this", ".", "roots", "=", "rootInfos", "[", "0", "]", ";", "this", ".", "otherRoots", "=", "rootInfos", "[", "1", "]", ";", "this", ".", "sourceAttachments", "=", "rootInfos", "[", "2", "]", ";", "this", ".", "projectDependencies", "=", "rootInfos", "[", "3", "]", ";", "this", ".", "rootsAreStale", "=", "false", ";", "}", "}", "}", "synchronized", "void", "initializeRootsWithPreviousSession", "(", ")", "{", "HashMap", "[", "]", "rootInfos", "=", "getRootInfos", "(", "true", ")", ";", "if", "(", "rootInfos", "!=", "null", ")", "{", "this", ".", "roots", "=", "rootInfos", "[", "0", "]", ";", "this", ".", "otherRoots", "=", "rootInfos", "[", "1", "]", ";", "this", ".", "sourceAttachments", "=", "rootInfos", "[", "2", "]", ";", "this", ".", "projectDependencies", "=", "rootInfos", "[", "3", "]", ";", "this", ".", "rootsAreStale", "=", "false", ";", "}", "}", "private", "HashMap", "[", "]", "getRootInfos", "(", "boolean", "usePreviousSession", ")", "{", "HashMap", "newRoots", "=", "new", "HashMap", "(", ")", ";", "HashMap", "newOtherRoots", "=", "new", "HashMap", "(", ")", ";", "HashMap", "newSourceAttachments", "=", "new", "HashMap", "(", ")", ";", "HashMap", "newProjectDependencies", "=", "new", "HashMap", "(", ")", ";", "IJavaModel", "model", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ";", "IJavaProject", "[", "]", "projects", ";", "try", "{", "projects", "=", "model", ".", "getJavaProjects", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JavaProject", "project", "=", "(", "JavaProject", ")", "projects", "[", "i", "]", ";", "IClasspathEntry", "[", "]", "classpath", ";", "try", "{", "if", "(", "usePreviousSession", ")", "{", "PerProjectInfo", "perProjectInfo", "=", "project", ".", "getPerProjectInfo", "(", ")", ";", "project", ".", "resolveClasspath", "(", "perProjectInfo", ",", "true", ",", "false", ")", ";", "classpath", "=", "perProjectInfo", ".", "resolvedClasspath", ";", "}", "else", "{", "classpath", "=", "project", ".", "getResolvedClasspath", "(", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "continue", ";", "}", "for", "(", "int", "j", "=", "0", ",", "classpathLength", "=", "classpath", ".", "length", ";", "j", "<", "classpathLength", ";", "j", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "j", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_PROJECT", ")", "{", "IJavaProject", "key", "=", "model", ".", "getJavaProject", "(", "entry", ".", "getPath", "(", ")", ".", "segment", "(", "0", ")", ")", ";", "IJavaProject", "[", "]", "dependents", "=", "(", "IJavaProject", "[", "]", ")", "newProjectDependencies", ".", "get", "(", "key", ")", ";", "if", "(", "dependents", "==", "null", ")", "{", "dependents", "=", "new", "IJavaProject", "[", "]", "{", "project", "}", ";", "}", "else", "{", "int", "dependentsLength", "=", "dependents", ".", "length", ";", "System", ".", "arraycopy", "(", "dependents", ",", "0", ",", "dependents", "=", "new", "IJavaProject", "[", "dependentsLength", "+", "1", "]", ",", "0", ",", "dependentsLength", ")", ";", "dependents", "[", "dependentsLength", "]", "=", "project", ";", "}", "newProjectDependencies", ".", "put", "(", "key", ",", "dependents", ")", ";", "continue", ";", "}", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "newRoots", ".", "get", "(", "path", ")", "==", "null", ")", "{", "newRoots", ".", "put", "(", "path", ",", "new", "DeltaProcessor", ".", "RootInfo", "(", "project", ",", "path", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullInclusionPatternChars", "(", ")", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullExclusionPatternChars", "(", ")", ",", "entry", ".", "getEntryKind", "(", ")", ")", ")", ";", "}", "else", "{", "ArrayList", "rootList", "=", "(", "ArrayList", ")", "newOtherRoots", ".", "get", "(", "path", ")", ";", "if", "(", "rootList", "==", "null", ")", "{", "rootList", "=", "new", "ArrayList", "(", ")", ";", "newOtherRoots", ".", "put", "(", "path", ",", "rootList", ")", ";", "}", "rootList", ".", "add", "(", "new", "DeltaProcessor", ".", "RootInfo", "(", "project", ",", "path", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullInclusionPatternChars", "(", ")", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullExclusionPatternChars", "(", ")", ",", "entry", ".", "getEntryKind", "(", ")", ")", ")", ";", "}", "if", "(", "entry", ".", "getEntryKind", "(", ")", "!=", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "continue", ";", "String", "propertyString", "=", "null", ";", "try", "{", "propertyString", "=", "Util", ".", "getSourceAttachmentProperty", "(", "path", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "IPath", "sourceAttachmentPath", ";", "if", "(", "propertyString", "!=", "null", ")", "{", "int", "index", "=", "propertyString", ".", "lastIndexOf", "(", "PackageFragmentRoot", ".", "ATTACHMENT_PROPERTY_DELIMITER", ")", ";", "sourceAttachmentPath", "=", "(", "index", "<", "0", ")", "?", "new", "Path", "(", "propertyString", ")", ":", "new", "Path", "(", "propertyString", ".", "substring", "(", "0", ",", "index", ")", ")", ";", "}", "else", "{", "sourceAttachmentPath", "=", "entry", ".", "getSourceAttachmentPath", "(", ")", ";", "}", "if", "(", "sourceAttachmentPath", "!=", "null", ")", "{", "newSourceAttachments", ".", "put", "(", "sourceAttachmentPath", ",", "path", ")", ";", "}", "}", "}", "return", "new", "HashMap", "[", "]", "{", "newRoots", ",", "newOtherRoots", ",", "newSourceAttachments", ",", "newProjectDependencies", "}", ";", "}", "public", "synchronized", "ClasspathValidation", "[", "]", "removeClasspathValidations", "(", ")", "{", "int", "length", "=", "this", ".", "classpathValidations", ".", "size", "(", ")", ";", "if", "(", "length", "==", "0", ")", "return", "null", ";", "ClasspathValidation", "[", "]", "validations", "=", "new", "ClasspathValidation", "[", "length", "]", ";", "this", ".", "classpathValidations", ".", "values", "(", ")", ".", "toArray", "(", "validations", ")", ";", "this", ".", "classpathValidations", ".", "clear", "(", ")", ";", "return", "validations", ";", "}", "public", "synchronized", "ExternalFolderChange", "[", "]", "removeExternalFolderChanges", "(", ")", "{", "int", "length", "=", "this", ".", "externalFolderChanges", ".", "size", "(", ")", ";", "if", "(", "length", "==", "0", ")", "return", "null", ";", "ExternalFolderChange", "[", "]", "updates", "=", "new", "ExternalFolderChange", "[", "length", "]", ";", "this", ".", "externalFolderChanges", ".", "values", "(", ")", ".", "toArray", "(", "updates", ")", ";", "this", ".", "externalFolderChanges", ".", "clear", "(", ")", ";", "return", "updates", ";", "}", "public", "synchronized", "ProjectReferenceChange", "[", "]", "removeProjectReferenceChanges", "(", ")", "{", "int", "length", "=", "this", ".", "projectReferenceChanges", ".", "size", "(", ")", ";", "if", "(", "length", "==", "0", ")", "return", "null", ";", "ProjectReferenceChange", "[", "]", "updates", "=", "new", "ProjectReferenceChange", "[", "length", "]", ";", "this", ".", "projectReferenceChanges", ".", "values", "(", ")", ".", "toArray", "(", "updates", ")", ";", "this", ".", "projectReferenceChanges", ".", "clear", "(", ")", ";", "return", "updates", ";", "}", "public", "synchronized", "HashSet", "removeExternalElementsToRefresh", "(", ")", "{", "HashSet", "result", "=", "this", ".", "externalElementsToRefresh", ";", "this", ".", "externalElementsToRefresh", "=", "null", ";", "return", "result", ";", "}", "public", "synchronized", "void", "removeElementChangedListener", "(", "IElementChangedListener", "listener", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "elementChangedListenerCount", ";", "i", "++", ")", "{", "if", "(", "this", ".", "elementChangedListeners", "[", "i", "]", "==", "listener", ")", "{", "int", "length", "=", "this", ".", "elementChangedListeners", ".", "length", ";", "IElementChangedListener", "[", "]", "newListeners", "=", "new", "IElementChangedListener", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "elementChangedListeners", ",", "0", ",", "newListeners", ",", "0", ",", "i", ")", ";", "int", "[", "]", "newMasks", "=", "new", "int", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "elementChangedListenerMasks", ",", "0", ",", "newMasks", ",", "0", ",", "i", ")", ";", "int", "trailingLength", "=", "this", ".", "elementChangedListenerCount", "-", "i", "-", "1", ";", "if", "(", "trailingLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "elementChangedListeners", ",", "i", "+", "1", ",", "newListeners", ",", "i", ",", "trailingLength", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "elementChangedListenerMasks", ",", "i", "+", "1", ",", "newMasks", ",", "i", ",", "trailingLength", ")", ";", "}", "this", ".", "elementChangedListeners", "=", "newListeners", ";", "this", ".", "elementChangedListenerMasks", "=", "newMasks", ";", "this", ".", "elementChangedListenerCount", "--", ";", "return", ";", "}", "}", "}", "public", "synchronized", "void", "removePreResourceChangedListener", "(", "IResourceChangeListener", "listener", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "preResourceChangeListenerCount", ";", "i", "++", ")", "{", "if", "(", "this", ".", "preResourceChangeListeners", "[", "i", "]", "==", "listener", ")", "{", "int", "length", "=", "this", ".", "preResourceChangeListeners", ".", "length", ";", "IResourceChangeListener", "[", "]", "newListeners", "=", "new", "IResourceChangeListener", "[", "length", "]", ";", "int", "[", "]", "newEventMasks", "=", "new", "int", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "preResourceChangeListeners", ",", "0", ",", "newListeners", ",", "0", ",", "i", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "preResourceChangeEventMasks", ",", "0", ",", "newEventMasks", ",", "0", ",", "i", ")", ";", "int", "trailingLength", "=", "this", ".", "preResourceChangeListenerCount", "-", "i", "-", "1", ";", "if", "(", "trailingLength", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "preResourceChangeListeners", ",", "i", "+", "1", ",", "newListeners", ",", "i", ",", "trailingLength", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "preResourceChangeEventMasks", ",", "i", "+", "1", ",", "newEventMasks", ",", "i", ",", "trailingLength", ")", ";", "}", "this", ".", "preResourceChangeListeners", "=", "newListeners", ";", "this", ".", "preResourceChangeEventMasks", "=", "newEventMasks", ";", "this", ".", "preResourceChangeListenerCount", "--", ";", "return", ";", "}", "}", "}", "public", "void", "resourceChanged", "(", "final", "IResourceChangeEvent", "event", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "preResourceChangeListenerCount", ";", "i", "++", ")", "{", "final", "IResourceChangeListener", "listener", "=", "this", ".", "preResourceChangeListeners", "[", "i", "]", ";", "if", "(", "(", "this", ".", "preResourceChangeEventMasks", "[", "i", "]", "&", "event", ".", "getType", "(", ")", ")", "!=", "0", ")", "SafeRunner", ".", "run", "(", "new", "ISafeRunnable", "(", ")", "{", "public", "void", "handleException", "(", "Throwable", "exception", ")", "{", "Util", ".", "log", "(", "exception", ",", "\"\"", ")", ";", "}", "public", "void", "run", "(", ")", "throws", "Exception", "{", "listener", ".", "resourceChanged", "(", "event", ")", ";", "}", "}", ")", ";", "}", "try", "{", "getDeltaProcessor", "(", ")", ".", "resourceChanged", "(", "event", ")", ";", "}", "finally", "{", "if", "(", "event", ".", "getType", "(", ")", "==", "IResourceChangeEvent", ".", "POST_CHANGE", ")", "{", "this", ".", "deltaProcessors", ".", "set", "(", "null", ")", ";", "}", "else", "{", "getDeltaProcessor", "(", ")", ".", "overridenEventType", "=", "-", "1", ";", "}", "}", "}", "public", "Hashtable", "getExternalLibTimeStamps", "(", ")", "{", "if", "(", "this", ".", "externalTimeStamps", "==", "null", ")", "{", "Hashtable", "timeStamps", "=", "new", "Hashtable", "(", ")", ";", "File", "timestampsFile", "=", "getTimeStampsFile", "(", ")", ";", "DataInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "DataInputStream", "(", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "timestampsFile", ")", ")", ")", ";", "int", "size", "=", "in", ".", "readInt", "(", ")", ";", "while", "(", "size", "--", ">", "0", ")", "{", "String", "key", "=", "in", ".", "readUTF", "(", ")", ";", "long", "timestamp", "=", "in", ".", "readLong", "(", ")", ";", "timeStamps", ".", "put", "(", "Path", ".", "fromPortableString", "(", "key", ")", ",", "new", "Long", "(", "timestamp", ")", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "timestampsFile", ".", "exists", "(", ")", ")", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "try", "{", "in", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "this", ".", "externalTimeStamps", "=", "timeStamps", ";", "}", "return", "this", ".", "externalTimeStamps", ";", "}", "public", "IJavaProject", "findJavaProject", "(", "String", "name", ")", "{", "if", "(", "getOldJavaProjecNames", "(", ")", ".", "contains", "(", "name", ")", ")", "return", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProject", "(", "name", ")", ";", "return", "null", ";", "}", "public", "synchronized", "HashSet", "getOldJavaProjecNames", "(", ")", "{", "if", "(", "this", ".", "javaProjectNamesCache", "==", "null", ")", "{", "HashSet", "result", "=", "new", "HashSet", "(", ")", ";", "IJavaProject", "[", "]", "projects", ";", "try", "{", "projects", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProjects", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "this", ".", "javaProjectNamesCache", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaProject", "project", "=", "projects", "[", "i", "]", ";", "result", ".", "add", "(", "project", ".", "getElementName", "(", ")", ")", ";", "}", "return", "this", ".", "javaProjectNamesCache", "=", "result", ";", "}", "return", "this", ".", "javaProjectNamesCache", ";", "}", "public", "synchronized", "void", "resetOldJavaProjectNames", "(", ")", "{", "this", ".", "javaProjectNamesCache", "=", "null", ";", "}", "private", "File", "getTimeStampsFile", "(", ")", "{", "return", "JavaCore", ".", "getPlugin", "(", ")", ".", "getStateLocation", "(", ")", ".", "append", "(", "\"\"", ")", ".", "toFile", "(", ")", ";", "}", "public", "void", "saveExternalLibTimeStamps", "(", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "externalTimeStamps", "==", "null", ")", "return", ";", "HashSet", "toRemove", "=", "new", "HashSet", "(", ")", ";", "if", "(", "this", ".", "roots", "!=", "null", ")", "{", "Enumeration", "keys", "=", "this", ".", "externalTimeStamps", ".", "keys", "(", ")", ";", "while", "(", "keys", ".", "hasMoreElements", "(", ")", ")", "{", "Object", "key", "=", "keys", ".", "nextElement", "(", ")", ";", "if", "(", "this", ".", "roots", ".", "get", "(", "key", ")", "==", "null", ")", "{", "toRemove", ".", "add", "(", "key", ")", ";", "}", "}", "}", "File", "timestamps", "=", "getTimeStampsFile", "(", ")", ";", "DataOutputStream", "out", "=", "null", ";", "try", "{", "out", "=", "new", "DataOutputStream", "(", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "timestamps", ")", ")", ")", ";", "out", ".", "writeInt", "(", "this", ".", "externalTimeStamps", ".", "size", "(", ")", "-", "toRemove", ".", "size", "(", ")", ")", ";", "Iterator", "entries", "=", "this", ".", "externalTimeStamps", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "IPath", "key", "=", "(", "IPath", ")", "entry", ".", "getKey", "(", ")", ";", "if", "(", "!", "toRemove", ".", "contains", "(", "key", ")", ")", "{", "out", ".", "writeUTF", "(", "key", ".", "toPortableString", "(", ")", ")", ";", "Long", "timestamp", "=", "(", "Long", ")", "entry", ".", "getValue", "(", ")", ";", "out", ".", "writeLong", "(", "timestamp", ".", "longValue", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "IStatus", "status", "=", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "IStatus", ".", "ERROR", ",", "\"\"", ",", "e", ")", ";", "throw", "new", "CoreException", "(", "status", ")", ";", "}", "finally", "{", "if", "(", "out", "!=", "null", ")", "{", "try", "{", "out", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}", "public", "synchronized", "void", "updateRoots", "(", "IPath", "containerPath", ",", "IResourceDelta", "containerDelta", ",", "DeltaProcessor", "deltaProcessor", ")", "{", "Map", "updatedRoots", ";", "Map", "otherUpdatedRoots", ";", "if", "(", "containerDelta", ".", "getKind", "(", ")", "==", "IResourceDelta", ".", "REMOVED", ")", "{", "updatedRoots", "=", "this", ".", "oldRoots", ";", "otherUpdatedRoots", "=", "this", ".", "oldOtherRoots", ";", "}", "else", "{", "updatedRoots", "=", "this", ".", "roots", ";", "otherUpdatedRoots", "=", "this", ".", "otherRoots", ";", "}", "int", "containerSegmentCount", "=", "containerPath", ".", "segmentCount", "(", ")", ";", "boolean", "containerIsProject", "=", "containerSegmentCount", "==", "1", ";", "Iterator", "iterator", "=", "updatedRoots", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iterator", ".", "next", "(", ")", ";", "IPath", "path", "=", "(", "IPath", ")", "entry", ".", "getKey", "(", ")", ";", "if", "(", "containerPath", ".", "isPrefixOf", "(", "path", ")", "&&", "!", "containerPath", ".", "equals", "(", "path", ")", ")", "{", "IResourceDelta", "rootDelta", "=", "containerDelta", ".", "findMember", "(", "path", ".", "removeFirstSegments", "(", "containerSegmentCount", ")", ")", ";", "if", "(", "rootDelta", "==", "null", ")", "continue", ";", "DeltaProcessor", ".", "RootInfo", "rootInfo", "=", "(", "DeltaProcessor", ".", "RootInfo", ")", "entry", ".", "getValue", "(", ")", ";", "if", "(", "!", "containerIsProject", "||", "!", "rootInfo", ".", "project", ".", "getPath", "(", ")", ".", "isPrefixOf", "(", "path", ")", ")", "{", "deltaProcessor", ".", "updateCurrentDeltaAndIndex", "(", "rootDelta", ",", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ",", "rootInfo", ")", ";", "}", "ArrayList", "rootList", "=", "(", "ArrayList", ")", "otherUpdatedRoots", ".", "get", "(", "path", ")", ";", "if", "(", "rootList", "!=", "null", ")", "{", "Iterator", "otherProjects", "=", "rootList", ".", "iterator", "(", ")", ";", "while", "(", "otherProjects", ".", "hasNext", "(", ")", ")", "{", "rootInfo", "=", "(", "DeltaProcessor", ".", "RootInfo", ")", "otherProjects", ".", "next", "(", ")", ";", "if", "(", "!", "containerIsProject", "||", "!", "rootInfo", ".", "project", ".", "getPath", "(", ")", ".", "isPrefixOf", "(", "path", ")", ")", "{", "deltaProcessor", ".", "updateCurrentDeltaAndIndex", "(", "rootDelta", ",", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ",", "rootInfo", ")", ";", "}", "}", "}", "}", "}", "}", "}", "</s>" ]
3,713
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Status", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ClasspathContainerInitializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathContainer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "JavaModelStatus", "extends", "Status", "implements", "IJavaModelStatus", ",", "IJavaModelStatusConstants", "{", "protected", "IJavaElement", "[", "]", "elements", "=", "new", "IJavaElement", "[", "0", "]", ";", "protected", "IPath", "path", ";", "protected", "String", "string", ";", "protected", "final", "static", "IStatus", "[", "]", "NO_CHILDREN", "=", "new", "IStatus", "[", "]", "{", "}", ";", "protected", "IStatus", "[", "]", "children", "=", "NO_CHILDREN", ";", "public", "static", "final", "IJavaModelStatus", "VERIFIED_OK", "=", "new", "JavaModelStatus", "(", "OK", ",", "OK", ",", "Messages", ".", "status_OK", ")", ";", "public", "JavaModelStatus", "(", ")", "{", "super", "(", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "0", ",", "\"\"", ",", "null", ")", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ")", "{", "super", "(", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "code", ",", "\"\"", ",", "null", ")", ";", "this", ".", "elements", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ",", "IJavaElement", "[", "]", "elements", ")", "{", "super", "(", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "code", ",", "\"\"", ",", "null", ")", ";", "this", ".", "elements", "=", "elements", ";", "this", ".", "path", "=", "null", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ",", "String", "string", ")", "{", "this", "(", "ERROR", ",", "code", ",", "string", ")", ";", "}", "public", "JavaModelStatus", "(", "int", "severity", ",", "int", "code", ",", "String", "string", ")", "{", "super", "(", "severity", ",", "JavaCore", ".", "PLUGIN_ID", ",", "code", ",", "\"\"", ",", "null", ")", ";", "this", ".", "elements", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "this", ".", "path", "=", "null", ";", "this", ".", "string", "=", "string", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ",", "Throwable", "throwable", ")", "{", "super", "(", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "code", ",", "\"\"", ",", "throwable", ")", ";", "this", ".", "elements", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ",", "IPath", "path", ")", "{", "super", "(", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "code", ",", "\"\"", ",", "null", ")", ";", "this", ".", "elements", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "this", ".", "path", "=", "path", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ",", "IJavaElement", "element", ")", "{", "this", "(", "code", ",", "new", "IJavaElement", "[", "]", "{", "element", "}", ")", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ",", "IJavaElement", "element", ",", "String", "string", ")", "{", "this", "(", "code", ",", "new", "IJavaElement", "[", "]", "{", "element", "}", ")", ";", "this", ".", "string", "=", "string", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ",", "IJavaElement", "element", ",", "IPath", "path", ")", "{", "this", "(", "code", ",", "new", "IJavaElement", "[", "]", "{", "element", "}", ")", ";", "this", ".", "path", "=", "path", ";", "}", "public", "JavaModelStatus", "(", "int", "code", ",", "IJavaElement", "element", ",", "IPath", "path", ",", "String", "string", ")", "{", "this", "(", "code", ",", "new", "IJavaElement", "[", "]", "{", "element", "}", ")", ";", "this", ".", "path", "=", "path", ";", "this", ".", "string", "=", "string", ";", "}", "public", "JavaModelStatus", "(", "int", "severity", ",", "int", "code", ",", "IJavaElement", "element", ",", "IPath", "path", ",", "String", "msg", ")", "{", "super", "(", "severity", ",", "JavaCore", ".", "PLUGIN_ID", ",", "code", ",", "\"\"", ",", "null", ")", ";", "this", ".", "elements", "=", "new", "IJavaElement", "[", "]", "{", "element", "}", ";", "this", ".", "path", "=", "path", ";", "this", ".", "string", "=", "msg", ";", "}", "public", "JavaModelStatus", "(", "CoreException", "coreException", ")", "{", "super", "(", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "CORE_EXCEPTION", ",", "\"\"", ",", "coreException", ")", ";", "this", ".", "elements", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "}", "protected", "int", "getBits", "(", ")", "{", "int", "severity", "=", "1", "<<", "(", "getCode", "(", ")", "%", "100", "/", "33", ")", ";", "int", "category", "=", "1", "<<", "(", "(", "getCode", "(", ")", "/", "100", ")", "+", "3", ")", ";", "return", "severity", "|", "category", ";", "}", "public", "IStatus", "[", "]", "getChildren", "(", ")", "{", "return", "this", ".", "children", ";", "}", "public", "IJavaElement", "[", "]", "getElements", "(", ")", "{", "return", "this", ".", "elements", ";", "}", "public", "String", "getMessage", "(", ")", "{", "Throwable", "exception", "=", "getException", "(", ")", ";", "if", "(", "exception", "==", "null", ")", "{", "switch", "(", "getCode", "(", ")", ")", "{", "case", "CORE_EXCEPTION", ":", "return", "Messages", ".", "status_coreException", ";", "case", "BUILDER_INITIALIZATION_ERROR", ":", "return", "Messages", ".", "build_initializationError", ";", "case", "BUILDER_SERIALIZATION_ERROR", ":", "return", "Messages", ".", "build_serializationError", ";", "case", "DEVICE_PATH", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_cannotUseDeviceOnPath", ",", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "case", "DOM_EXCEPTION", ":", "return", "Messages", ".", "status_JDOMError", ";", "case", "ELEMENT_DOES_NOT_EXIST", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "element_doesNotExist", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "case", "ELEMENT_NOT_ON_CLASSPATH", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "element_notOnClasspath", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "case", "EVALUATION_ERROR", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_evaluationError", ",", "this", ".", "string", ")", ";", "case", "INDEX_OUT_OF_BOUNDS", ":", "return", "Messages", ".", "status_indexOutOfBounds", ";", "case", "INVALID_CONTENTS", ":", "return", "Messages", ".", "status_invalidContents", ";", "case", "INVALID_DESTINATION", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidDestination", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "case", "INVALID_ELEMENT_TYPES", ":", "StringBuffer", "buff", "=", "new", "StringBuffer", "(", "Messages", ".", "operation_notSupported", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "elements", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "buff", ".", "append", "(", "\",", "\"", ")", ";", "}", "buff", ".", "append", "(", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "i", "]", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "return", "buff", ".", "toString", "(", ")", ";", "case", "INVALID_NAME", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidName", ",", "this", ".", "string", ")", ";", "case", "INVALID_PACKAGE", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidPackage", ",", "this", ".", "string", ")", ";", "case", "INVALID_PATH", ":", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "return", "this", ".", "string", ";", "}", "else", "{", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidPath", ",", "new", "String", "[", "]", "{", "getPath", "(", ")", "==", "null", "?", "\"null\"", ":", "getPath", "(", ")", ".", "toString", "(", ")", "}", ")", ";", "}", "case", "INVALID_PROJECT", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidProject", ",", "this", ".", "string", ")", ";", "case", "INVALID_RESOURCE", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidResource", ",", "this", ".", "string", ")", ";", "case", "INVALID_RESOURCE_TYPE", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidResourceType", ",", "this", ".", "string", ")", ";", "case", "INVALID_SIBLING", ":", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidSibling", ",", "this", ".", "string", ")", ";", "}", "else", "{", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_invalidSibling", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "case", "IO_EXCEPTION", ":", "return", "Messages", ".", "status_IOException", ";", "case", "NAME_COLLISION", ":", "if", "(", "this", ".", "elements", "!=", "null", "&&", "this", ".", "elements", ".", "length", ">", "0", ")", "{", "IJavaElement", "element", "=", "this", ".", "elements", "[", "0", "]", ";", "if", "(", "element", "instanceof", "PackageFragment", "&&", "(", "(", "PackageFragment", ")", "element", ")", ".", "isDefaultPackage", "(", ")", ")", "{", "return", "Messages", ".", "operation_cannotRenameDefaultPackage", ";", "}", "}", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "return", "this", ".", "string", ";", "}", "else", "{", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "\"\"", ")", ";", "}", "case", "NO_ELEMENTS_TO_PROCESS", ":", "return", "Messages", ".", "operation_needElements", ";", "case", "NULL_NAME", ":", "return", "Messages", ".", "operation_needName", ";", "case", "NULL_PATH", ":", "return", "Messages", ".", "operation_needPath", ";", "case", "NULL_STRING", ":", "return", "Messages", ".", "operation_needString", ";", "case", "PATH_OUTSIDE_PROJECT", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "operation_pathOutsideProject", ",", "new", "String", "[", "]", "{", "this", ".", "string", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", "}", ")", ";", "case", "READ_ONLY", ":", "IJavaElement", "element", "=", "this", ".", "elements", "[", "0", "]", ";", "String", "name", "=", "element", ".", "getElementName", "(", ")", ";", "if", "(", "element", "instanceof", "IPackageFragment", "&&", "name", ".", "equals", "(", "IPackageFragment", ".", "DEFAULT_PACKAGE_NAME", ")", ")", "{", "return", "Messages", ".", "status_defaultPackageReadOnly", ";", "}", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_readOnly", ",", "name", ")", ";", "case", "RELATIVE_PATH", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "operation_needAbsolutePath", ",", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "case", "TARGET_EXCEPTION", ":", "return", "Messages", ".", "status_targetException", ";", "case", "UPDATE_CONFLICT", ":", "return", "Messages", ".", "status_updateConflict", ";", "case", "NO_LOCAL_CONTENTS", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_noLocalContents", ",", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "case", "CP_CONTAINER_PATH_UNBOUND", ":", "IJavaProject", "javaProject", "=", "(", "IJavaProject", ")", "this", ".", "elements", "[", "0", "]", ";", "ClasspathContainerInitializer", "initializer", "=", "JavaCore", ".", "getClasspathContainerInitializer", "(", "this", ".", "path", ".", "segment", "(", "0", ")", ")", ";", "String", "description", "=", "null", ";", "if", "(", "initializer", "!=", "null", ")", "description", "=", "initializer", ".", "getDescription", "(", "this", ".", "path", ",", "javaProject", ")", ";", "if", "(", "description", "==", "null", ")", "description", "=", "this", ".", "path", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ";", "return", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundContainerPath", ",", "new", "String", "[", "]", "{", "description", ",", "javaProject", ".", "getElementName", "(", ")", "}", ")", ";", "case", "INVALID_CP_CONTAINER_ENTRY", ":", "javaProject", "=", "(", "IJavaProject", ")", "this", ".", "elements", "[", "0", "]", ";", "IClasspathContainer", "container", "=", "null", ";", "description", "=", "null", ";", "try", "{", "container", "=", "JavaCore", ".", "getClasspathContainer", "(", "this", ".", "path", ",", "javaProject", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "if", "(", "container", "==", "null", ")", "{", "initializer", "=", "JavaCore", ".", "getClasspathContainerInitializer", "(", "this", ".", "path", ".", "segment", "(", "0", ")", ")", ";", "if", "(", "initializer", "!=", "null", ")", "description", "=", "initializer", ".", "getDescription", "(", "this", ".", "path", ",", "javaProject", ")", ";", "}", "else", "{", "description", "=", "container", ".", "getDescription", "(", ")", ";", "}", "if", "(", "description", "==", "null", ")", "description", "=", "this", ".", "path", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ";", "return", "Messages", ".", "bind", "(", "Messages", ".", "classpath_invalidContainer", ",", "new", "String", "[", "]", "{", "description", ",", "javaProject", ".", "getElementName", "(", ")", "}", ")", ";", "case", "CP_VARIABLE_PATH_UNBOUND", ":", "javaProject", "=", "(", "IJavaProject", ")", "this", ".", "elements", "[", "0", "]", ";", "return", "Messages", ".", "bind", "(", "Messages", ".", "classpath_unboundVariablePath", ",", "new", "String", "[", "]", "{", "this", ".", "path", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "javaProject", ".", "getElementName", "(", ")", "}", ")", ";", "case", "CLASSPATH_CYCLE", ":", "javaProject", "=", "(", "IJavaProject", ")", "this", ".", "elements", "[", "0", "]", ";", "return", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cycle", ",", "new", "String", "[", "]", "{", "javaProject", ".", "getElementName", "(", ")", ",", "this", ".", "string", "}", ")", ";", "case", "DISABLED_CP_EXCLUSION_PATTERNS", ":", "javaProject", "=", "(", "IJavaProject", ")", "this", ".", "elements", "[", "0", "]", ";", "String", "projectName", "=", "javaProject", ".", "getElementName", "(", ")", ";", "IPath", "newPath", "=", "this", ".", "path", ";", "if", "(", "this", ".", "path", ".", "segment", "(", "0", ")", ".", "toString", "(", ")", ".", "equals", "(", "projectName", ")", ")", "{", "newPath", "=", "this", ".", "path", ".", "removeFirstSegments", "(", "1", ")", ";", "}", "return", "Messages", ".", "bind", "(", "Messages", ".", "classpath_disabledInclusionExclusionPatterns", ",", "new", "String", "[", "]", "{", "newPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "projectName", "}", ")", ";", "case", "DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS", ":", "javaProject", "=", "(", "IJavaProject", ")", "this", ".", "elements", "[", "0", "]", ";", "projectName", "=", "javaProject", ".", "getElementName", "(", ")", ";", "newPath", "=", "this", ".", "path", ";", "if", "(", "this", ".", "path", ".", "segment", "(", "0", ")", ".", "toString", "(", ")", ".", "equals", "(", "projectName", ")", ")", "{", "newPath", "=", "this", ".", "path", ".", "removeFirstSegments", "(", "1", ")", ";", "}", "return", "Messages", ".", "bind", "(", "Messages", ".", "classpath_disabledMultipleOutputLocations", ",", "new", "String", "[", "]", "{", "newPath", ".", "makeRelative", "(", ")", ".", "toString", "(", ")", ",", "projectName", "}", ")", ";", "case", "CANNOT_RETRIEVE_ATTACHED_JAVADOC", ":", "if", "(", "this", ".", "elements", "!=", "null", "&&", "this", ".", "elements", ".", "length", "==", "1", ")", "{", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_cannot_retrieve_attached_javadoc", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ",", "this", ".", "string", ")", ";", "}", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_cannot_retrieve_attached_javadoc", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ",", "\"\"", ")", ";", "}", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_cannot_retrieve_attached_javadoc", ",", "this", ".", "string", ",", "\"\"", ")", ";", "}", "break", ";", "case", "CANNOT_RETRIEVE_ATTACHED_JAVADOC_TIMEOUT", ":", "if", "(", "this", ".", "elements", "!=", "null", "&&", "this", ".", "elements", ".", "length", "==", "1", ")", "{", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_timeout_javadoc", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ",", "this", ".", "string", ")", ";", "}", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_timeout_javadoc", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ",", "\"\"", ")", ";", "}", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_timeout_javadoc", ",", "this", ".", "string", ",", "\"\"", ")", ";", "}", "break", ";", "case", "UNKNOWN_JAVADOC_FORMAT", ":", "return", "Messages", ".", "bind", "(", "Messages", ".", "status_unknown_javadoc_format", ",", "(", "(", "JavaElement", ")", "this", ".", "elements", "[", "0", "]", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "case", "DEPRECATED_VARIABLE", ":", "javaProject", "=", "(", "IJavaProject", ")", "this", ".", "elements", "[", "0", "]", ";", "return", "Messages", ".", "bind", "(", "Messages", ".", "classpath_deprecated_variable", ",", "new", "String", "[", "]", "{", "this", ".", "path", ".", "segment", "(", "0", ")", ".", "toString", "(", ")", ",", "javaProject", ".", "getElementName", "(", ")", ",", "this", ".", "string", "}", ")", ";", "}", "if", "(", "this", ".", "string", "!=", "null", ")", "{", "return", "this", ".", "string", ";", "}", "else", "{", "return", "\"\"", ";", "}", "}", "else", "{", "String", "message", "=", "exception", ".", "getMessage", "(", ")", ";", "if", "(", "message", "!=", "null", ")", "{", "return", "message", ";", "}", "else", "{", "return", "exception", ".", "toString", "(", ")", ";", "}", "}", "}", "public", "IPath", "getPath", "(", ")", "{", "return", "this", ".", "path", ";", "}", "public", "int", "getSeverity", "(", ")", "{", "if", "(", "this", ".", "children", "==", "NO_CHILDREN", ")", "return", "super", ".", "getSeverity", "(", ")", ";", "int", "severity", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "children", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "int", "childrenSeverity", "=", "this", ".", "children", "[", "i", "]", ".", "getSeverity", "(", ")", ";", "if", "(", "childrenSeverity", ">", "severity", ")", "{", "severity", "=", "childrenSeverity", ";", "}", "}", "return", "severity", ";", "}", "public", "String", "getString", "(", ")", "{", "return", "this", ".", "string", ";", "}", "public", "boolean", "isDoesNotExist", "(", ")", "{", "int", "code", "=", "getCode", "(", ")", ";", "return", "code", "==", "ELEMENT_DOES_NOT_EXIST", "||", "code", "==", "ELEMENT_NOT_ON_CLASSPATH", ";", "}", "public", "boolean", "isMultiStatus", "(", ")", "{", "return", "this", ".", "children", "!=", "NO_CHILDREN", ";", "}", "public", "boolean", "isOK", "(", ")", "{", "return", "getCode", "(", ")", "==", "OK", ";", "}", "public", "boolean", "matches", "(", "int", "mask", ")", "{", "if", "(", "!", "isMultiStatus", "(", ")", ")", "{", "return", "matches", "(", "this", ",", "mask", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "children", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "matches", "(", "(", "JavaModelStatus", ")", "this", ".", "children", "[", "i", "]", ",", "mask", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "}", "protected", "boolean", "matches", "(", "JavaModelStatus", "status", ",", "int", "mask", ")", "{", "int", "severityMask", "=", "mask", "&", "0x7", ";", "int", "categoryMask", "=", "mask", "&", "~", "0x7", ";", "int", "bits", "=", "status", ".", "getBits", "(", ")", ";", "return", "(", "(", "severityMask", "==", "0", ")", "||", "(", "bits", "&", "severityMask", ")", "!=", "0", ")", "&&", "(", "(", "categoryMask", "==", "0", ")", "||", "(", "bits", "&", "categoryMask", ")", "!=", "0", ")", ";", "}", "public", "static", "IJavaModelStatus", "newMultiStatus", "(", "IJavaModelStatus", "[", "]", "children", ")", "{", "JavaModelStatus", "jms", "=", "new", "JavaModelStatus", "(", ")", ";", "jms", ".", "children", "=", "children", ";", "return", "jms", ";", "}", "public", "String", "toString", "(", ")", "{", "if", "(", "this", "==", "VERIFIED_OK", ")", "{", "return", "\"\"", ";", "}", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "getMessage", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"]\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
3,714
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "OpenableElementInfo", "extends", "JavaElementInfo", "{", "protected", "IJavaElement", "[", "]", "children", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "protected", "boolean", "isStructureKnown", "=", "false", ";", "public", "void", "addChild", "(", "IJavaElement", "child", ")", "{", "int", "length", "=", "this", ".", "children", ".", "length", ";", "if", "(", "length", "==", "0", ")", "{", "this", ".", "children", "=", "new", "IJavaElement", "[", "]", "{", "child", "}", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "children", "[", "i", "]", ".", "equals", "(", "child", ")", ")", "return", ";", "}", "System", ".", "arraycopy", "(", "this", ".", "children", ",", "0", ",", "this", ".", "children", "=", "new", "IJavaElement", "[", "length", "+", "1", "]", ",", "0", ",", "length", ")", ";", "this", ".", "children", "[", "length", "]", "=", "child", ";", "}", "}", "public", "IJavaElement", "[", "]", "getChildren", "(", ")", "{", "return", "this", ".", "children", ";", "}", "public", "boolean", "isStructureKnown", "(", ")", "{", "return", "this", ".", "isStructureKnown", ";", "}", "public", "void", "removeChild", "(", "IJavaElement", "child", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "element", "=", "this", ".", "children", "[", "i", "]", ";", "if", "(", "element", ".", "equals", "(", "child", ")", ")", "{", "if", "(", "length", "==", "1", ")", "{", "this", ".", "children", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "}", "else", "{", "IJavaElement", "[", "]", "newChildren", "=", "new", "IJavaElement", "[", "length", "-", "1", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "children", ",", "0", ",", "newChildren", ",", "0", ",", "i", ")", ";", "if", "(", "i", "<", "length", "-", "1", ")", "System", ".", "arraycopy", "(", "this", ".", "children", ",", "i", "+", "1", ",", "newChildren", ",", "i", ",", "length", "-", "1", "-", "i", ")", ";", "this", ".", "children", "=", "newChildren", ";", "}", "break", ";", "}", "}", "}", "public", "void", "setChildren", "(", "IJavaElement", "[", "]", "children", ")", "{", "this", ".", "children", "=", "children", ";", "}", "public", "void", "setIsStructureKnown", "(", "boolean", "newIsStructureKnown", ")", "{", "this", ".", "isStructureKnown", "=", "newIsStructureKnown", ";", "}", "}", "</s>" ]
3,715
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMemberValuePair", ";", "public", "class", "SourceAnnotationMethodInfo", "extends", "SourceMethodInfo", "{", "public", "int", "defaultValueStart", "=", "-", "1", ";", "public", "int", "defaultValueEnd", "=", "-", "1", ";", "public", "IMemberValuePair", "defaultValue", ";", "public", "boolean", "isAnnotationMethod", "(", ")", "{", "return", "true", ";", "}", "}", "</s>" ]
3,716
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ClasspathContainerInitializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathContainer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "UserLibraryClasspathContainerInitializer", "extends", "ClasspathContainerInitializer", "{", "public", "boolean", "canUpdateClasspathContainer", "(", "IPath", "containerPath", ",", "IJavaProject", "project", ")", "{", "return", "isUserLibraryContainer", "(", "containerPath", ")", ";", "}", "public", "Object", "getComparisonID", "(", "IPath", "containerPath", ",", "IJavaProject", "project", ")", "{", "return", "containerPath", ";", "}", "public", "String", "getDescription", "(", "IPath", "containerPath", ",", "IJavaProject", "project", ")", "{", "if", "(", "isUserLibraryContainer", "(", "containerPath", ")", ")", "{", "return", "containerPath", ".", "segment", "(", "1", ")", ";", "}", "return", "super", ".", "getDescription", "(", "containerPath", ",", "project", ")", ";", "}", "public", "void", "initialize", "(", "IPath", "containerPath", ",", "IJavaProject", "project", ")", "throws", "CoreException", "{", "if", "(", "isUserLibraryContainer", "(", "containerPath", ")", ")", "{", "String", "userLibName", "=", "containerPath", ".", "segment", "(", "1", ")", ";", "UserLibrary", "userLibrary", "=", "JavaModelManager", ".", "getUserLibraryManager", "(", ")", ".", "getUserLibrary", "(", "userLibName", ")", ";", "if", "(", "userLibrary", "!=", "null", ")", "{", "UserLibraryClasspathContainer", "container", "=", "new", "UserLibraryClasspathContainer", "(", "userLibName", ")", ";", "JavaCore", ".", "setClasspathContainer", "(", "containerPath", ",", "new", "IJavaProject", "[", "]", "{", "project", "}", ",", "new", "IClasspathContainer", "[", "]", "{", "container", "}", ",", "null", ")", ";", "}", "else", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", "||", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "verbose_no_user_library_found", "(", "project", ",", "userLibName", ")", ";", "}", "}", "else", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", "||", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "{", "verbose_not_a_user_library", "(", "project", ",", "containerPath", ")", ";", "}", "}", "private", "boolean", "isUserLibraryContainer", "(", "IPath", "path", ")", "{", "return", "path", "!=", "null", "&&", "path", ".", "segmentCount", "(", ")", "==", "2", "&&", "JavaCore", ".", "USER_LIBRARY_CONTAINER_ID", ".", "equals", "(", "path", ".", "segment", "(", "0", ")", ")", ";", "}", "public", "void", "requestClasspathContainerUpdate", "(", "IPath", "containerPath", ",", "IJavaProject", "project", ",", "IClasspathContainer", "containerSuggestion", ")", "throws", "CoreException", "{", "if", "(", "isUserLibraryContainer", "(", "containerPath", ")", ")", "{", "String", "name", "=", "containerPath", ".", "segment", "(", "1", ")", ";", "if", "(", "containerSuggestion", "!=", "null", ")", "{", "JavaModelManager", ".", "getUserLibraryManager", "(", ")", ".", "setUserLibrary", "(", "name", ",", "containerSuggestion", ".", "getClasspathEntries", "(", ")", ",", "containerSuggestion", ".", "getKind", "(", ")", "==", "IClasspathContainer", ".", "K_SYSTEM", ")", ";", "}", "else", "{", "JavaModelManager", ".", "getUserLibraryManager", "(", ")", ".", "removeUserLibrary", "(", "name", ")", ";", "}", "}", "}", "private", "void", "verbose_no_user_library_found", "(", "IJavaProject", "project", ",", "String", "userLibraryName", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "userLibraryName", ")", ";", "}", "private", "void", "verbose_not_a_user_library", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", ")", ";", "}", "}", "</s>" ]
3,717
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "OutputStreamWriter", ";", "import", "java", ".", "io", ".", "Reader", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilder", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilderFactory", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "ParserConfigurationException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Assert", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAccessRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathAttribute", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Element", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Node", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "import", "org", ".", "xml", ".", "sax", ".", "InputSource", ";", "import", "org", ".", "xml", ".", "sax", ".", "SAXException", ";", "public", "class", "UserLibrary", "{", "private", "static", "final", "String", "VERSION_ONE", "=", "\"1\"", ";", "private", "static", "final", "String", "CURRENT_VERSION", "=", "\"2\"", ";", "private", "static", "final", "String", "TAG_VERSION", "=", "\"version\"", ";", "private", "static", "final", "String", "TAG_USERLIBRARY", "=", "\"userlibrary\"", ";", "private", "static", "final", "String", "TAG_SOURCEATTACHMENT", "=", "\"\"", ";", "private", "static", "final", "String", "TAG_SOURCEATTACHMENTROOT", "=", "\"\"", ";", "private", "static", "final", "String", "TAG_PATH", "=", "\"path\"", ";", "private", "static", "final", "String", "TAG_ARCHIVE", "=", "\"archive\"", ";", "private", "static", "final", "String", "TAG_SYSTEMLIBRARY", "=", "\"\"", ";", "private", "boolean", "isSystemLibrary", ";", "private", "IClasspathEntry", "[", "]", "entries", ";", "public", "UserLibrary", "(", "IClasspathEntry", "[", "]", "entries", ",", "boolean", "isSystemLibrary", ")", "{", "Assert", ".", "isNotNull", "(", "entries", ")", ";", "this", ".", "entries", "=", "entries", ";", "this", ".", "isSystemLibrary", "=", "isSystemLibrary", ";", "}", "public", "IClasspathEntry", "[", "]", "getEntries", "(", ")", "{", "return", "this", ".", "entries", ";", "}", "public", "boolean", "isSystemLibrary", "(", ")", "{", "return", "this", ".", "isSystemLibrary", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "!=", "null", "&&", "obj", ".", "getClass", "(", ")", "==", "getClass", "(", ")", ")", "{", "UserLibrary", "other", "=", "(", "UserLibrary", ")", "obj", ";", "if", "(", "this", ".", "entries", ".", "length", "==", "other", ".", "entries", ".", "length", "&&", "this", ".", "isSystemLibrary", "==", "other", ".", "isSystemLibrary", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "entries", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "this", ".", "entries", "[", "i", "]", ".", "equals", "(", "other", ".", "entries", "[", "i", "]", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "int", "hashCode", "(", ")", "{", "int", "hashCode", "=", "0", ";", "if", "(", "this", ".", "isSystemLibrary", ")", "{", "hashCode", "++", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "entries", ".", "length", ";", "i", "++", ")", "{", "hashCode", "=", "hashCode", "*", "17", "+", "this", ".", "entries", ".", "hashCode", "(", ")", ";", "}", "return", "hashCode", ";", "}", "public", "static", "String", "serialize", "(", "IClasspathEntry", "[", "]", "entries", ",", "boolean", "isSystemLibrary", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "s", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "OutputStreamWriter", "writer", "=", "new", "OutputStreamWriter", "(", "s", ",", "\"UTF8\"", ")", ";", "XMLWriter", "xmlWriter", "=", "new", "XMLWriter", "(", "writer", ",", "null", ",", "true", ")", ";", "HashMap", "library", "=", "new", "HashMap", "(", ")", ";", "library", ".", "put", "(", "TAG_VERSION", ",", "String", ".", "valueOf", "(", "CURRENT_VERSION", ")", ")", ";", "library", ".", "put", "(", "TAG_SYSTEMLIBRARY", ",", "String", ".", "valueOf", "(", "isSystemLibrary", ")", ")", ";", "xmlWriter", ".", "printTag", "(", "TAG_USERLIBRARY", ",", "library", ",", "true", ",", "true", ",", "false", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "entries", ".", "length", ";", "i", "<", "length", ";", "++", "i", ")", "{", "ClasspathEntry", "cpEntry", "=", "(", "ClasspathEntry", ")", "entries", "[", "i", "]", ";", "HashMap", "archive", "=", "new", "HashMap", "(", ")", ";", "archive", ".", "put", "(", "TAG_PATH", ",", "cpEntry", ".", "getPath", "(", ")", ".", "toPortableString", "(", ")", ")", ";", "IPath", "sourceAttach", "=", "cpEntry", ".", "getSourceAttachmentPath", "(", ")", ";", "if", "(", "sourceAttach", "!=", "null", ")", "archive", ".", "put", "(", "TAG_SOURCEATTACHMENT", ",", "sourceAttach", ".", "toPortableString", "(", ")", ")", ";", "IPath", "sourceAttachRoot", "=", "cpEntry", ".", "getSourceAttachmentRootPath", "(", ")", ";", "if", "(", "sourceAttachRoot", "!=", "null", ")", "archive", ".", "put", "(", "TAG_SOURCEATTACHMENTROOT", ",", "sourceAttachRoot", ".", "toPortableString", "(", ")", ")", ";", "boolean", "hasExtraAttributes", "=", "cpEntry", ".", "extraAttributes", "!=", "null", "&&", "cpEntry", ".", "extraAttributes", ".", "length", "!=", "0", ";", "boolean", "hasRestrictions", "=", "cpEntry", ".", "getAccessRuleSet", "(", ")", "!=", "null", ";", "xmlWriter", ".", "printTag", "(", "TAG_ARCHIVE", ",", "archive", ",", "true", ",", "true", ",", "!", "(", "hasExtraAttributes", "||", "hasRestrictions", ")", ")", ";", "if", "(", "hasExtraAttributes", ")", "{", "cpEntry", ".", "encodeExtraAttributes", "(", "xmlWriter", ",", "true", ",", "true", ")", ";", "}", "if", "(", "hasRestrictions", ")", "{", "cpEntry", ".", "encodeAccessRules", "(", "xmlWriter", ",", "true", ",", "true", ")", ";", "}", "if", "(", "hasExtraAttributes", "||", "hasRestrictions", ")", "{", "xmlWriter", ".", "endTag", "(", "TAG_ARCHIVE", ",", "true", ",", "true", ")", ";", "}", "}", "xmlWriter", ".", "endTag", "(", "TAG_USERLIBRARY", ",", "true", ",", "true", ")", ";", "writer", ".", "flush", "(", ")", ";", "writer", ".", "close", "(", ")", ";", "return", "s", ".", "toString", "(", "\"UTF8\"", ")", ";", "}", "public", "static", "UserLibrary", "createFromString", "(", "Reader", "reader", ")", "throws", "IOException", "{", "Element", "cpElement", ";", "try", "{", "DocumentBuilder", "parser", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ".", "newDocumentBuilder", "(", ")", ";", "cpElement", "=", "parser", ".", "parse", "(", "new", "InputSource", "(", "reader", ")", ")", ".", "getDocumentElement", "(", ")", ";", "}", "catch", "(", "SAXException", "e", ")", "{", "throw", "new", "IOException", "(", "Messages", ".", "file_badFormat", ")", ";", "}", "catch", "(", "ParserConfigurationException", "e", ")", "{", "throw", "new", "IOException", "(", "Messages", ".", "file_badFormat", ")", ";", "}", "finally", "{", "reader", ".", "close", "(", ")", ";", "}", "if", "(", "!", "cpElement", ".", "getNodeName", "(", ")", ".", "equalsIgnoreCase", "(", "TAG_USERLIBRARY", ")", ")", "{", "throw", "new", "IOException", "(", "Messages", ".", "file_badFormat", ")", ";", "}", "String", "version", "=", "cpElement", ".", "getAttribute", "(", "TAG_VERSION", ")", ";", "boolean", "isSystem", "=", "Boolean", ".", "valueOf", "(", "cpElement", ".", "getAttribute", "(", "TAG_SYSTEMLIBRARY", ")", ")", ".", "booleanValue", "(", ")", ";", "NodeList", "list", "=", "cpElement", ".", "getChildNodes", "(", ")", ";", "int", "length", "=", "list", ".", "getLength", "(", ")", ";", "ArrayList", "res", "=", "new", "ArrayList", "(", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "++", "i", ")", "{", "Node", "node", "=", "list", ".", "item", "(", "i", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "Element", "element", "=", "(", "Element", ")", "node", ";", "if", "(", "element", ".", "getNodeName", "(", ")", ".", "equals", "(", "TAG_ARCHIVE", ")", ")", "{", "String", "pathString", "=", "element", ".", "getAttribute", "(", "TAG_PATH", ")", ";", "String", "sourceAttachString", "=", "element", ".", "hasAttribute", "(", "TAG_SOURCEATTACHMENT", ")", "?", "element", ".", "getAttribute", "(", "TAG_SOURCEATTACHMENT", ")", ":", "null", ";", "String", "sourceAttachRootString", "=", "element", ".", "hasAttribute", "(", "TAG_SOURCEATTACHMENTROOT", ")", "?", "element", ".", "getAttribute", "(", "TAG_SOURCEATTACHMENTROOT", ")", ":", "null", ";", "IPath", "entryPath", "=", "null", ";", "IPath", "sourceAttachPath", "=", "null", ";", "IPath", "sourceAttachRootPath", "=", "null", ";", "if", "(", "version", ".", "equals", "(", "VERSION_ONE", ")", ")", "{", "entryPath", "=", "Path", ".", "fromOSString", "(", "pathString", ")", ";", "if", "(", "sourceAttachString", "!=", "null", ")", "sourceAttachPath", "=", "Path", ".", "fromOSString", "(", "sourceAttachString", ")", ";", "if", "(", "sourceAttachRootString", "!=", "null", ")", "sourceAttachRootPath", "=", "Path", ".", "fromOSString", "(", "sourceAttachRootString", ")", ";", "}", "else", "{", "entryPath", "=", "Path", ".", "fromPortableString", "(", "pathString", ")", ";", "if", "(", "sourceAttachString", "!=", "null", ")", "sourceAttachPath", "=", "Path", ".", "fromPortableString", "(", "sourceAttachString", ")", ";", "if", "(", "sourceAttachRootString", "!=", "null", ")", "sourceAttachRootPath", "=", "Path", ".", "fromPortableString", "(", "sourceAttachRootString", ")", ";", "}", "NodeList", "children", "=", "element", ".", "getElementsByTagName", "(", "\"*\"", ")", ";", "boolean", "[", "]", "foundChildren", "=", "new", "boolean", "[", "children", ".", "getLength", "(", ")", "]", ";", "NodeList", "attributeList", "=", "ClasspathEntry", ".", "getChildAttributes", "(", "ClasspathEntry", ".", "TAG_ATTRIBUTES", ",", "children", ",", "foundChildren", ")", ";", "IClasspathAttribute", "[", "]", "extraAttributes", "=", "ClasspathEntry", ".", "decodeExtraAttributes", "(", "attributeList", ")", ";", "attributeList", "=", "ClasspathEntry", ".", "getChildAttributes", "(", "ClasspathEntry", ".", "TAG_ACCESS_RULES", ",", "children", ",", "foundChildren", ")", ";", "IAccessRule", "[", "]", "accessRules", "=", "ClasspathEntry", ".", "decodeAccessRules", "(", "attributeList", ")", ";", "IClasspathEntry", "entry", "=", "JavaCore", ".", "newLibraryEntry", "(", "entryPath", ",", "sourceAttachPath", ",", "sourceAttachRootPath", ",", "accessRules", ",", "extraAttributes", ",", "false", ")", ";", "res", ".", "add", "(", "entry", ")", ";", "}", "}", "}", "IClasspathEntry", "[", "]", "entries", "=", "(", "IClasspathEntry", "[", "]", ")", "res", ".", "toArray", "(", "new", "IClasspathEntry", "[", "res", ".", "size", "(", ")", "]", ")", ";", "return", "new", "UserLibrary", "(", "entries", ",", "isSystem", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "if", "(", "this", ".", "entries", "==", "null", ")", "return", "\"null\"", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "int", "length", "=", "this", ".", "entries", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "this", ".", "entries", "[", "i", "]", ".", "toString", "(", ")", "+", "'\\n'", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
3,718
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "LRUCache", ";", "public", "class", "ElementCache", "extends", "OverflowingLRUCache", "{", "IJavaElement", "spaceLimitParent", "=", "null", ";", "public", "ElementCache", "(", "int", "size", ")", "{", "super", "(", "size", ")", ";", "}", "public", "ElementCache", "(", "int", "size", ",", "int", "overflow", ")", "{", "super", "(", "size", ",", "overflow", ")", ";", "}", "protected", "boolean", "close", "(", "LRUCacheEntry", "entry", ")", "{", "Openable", "element", "=", "(", "Openable", ")", "entry", ".", "key", ";", "try", "{", "if", "(", "!", "element", ".", "canBeRemovedFromCache", "(", ")", ")", "{", "return", "false", ";", "}", "else", "{", "element", ".", "close", "(", ")", ";", "return", "true", ";", "}", "}", "catch", "(", "JavaModelException", "npe", ")", "{", "return", "false", ";", "}", "}", "protected", "void", "ensureSpaceLimit", "(", "Object", "info", ",", "IJavaElement", "parent", ")", "{", "int", "childrenSize", "=", "(", "(", "JavaElementInfo", ")", "info", ")", ".", "getChildren", "(", ")", ".", "length", ";", "int", "spaceNeeded", "=", "1", "+", "(", "int", ")", "(", "(", "1", "+", "this", ".", "loadFactor", ")", "*", "(", "childrenSize", "+", "this", ".", "overflow", ")", ")", ";", "if", "(", "this", ".", "spaceLimit", "<", "spaceNeeded", ")", "{", "shrink", "(", ")", ";", "setSpaceLimit", "(", "spaceNeeded", ")", ";", "this", ".", "spaceLimitParent", "=", "parent", ";", "}", "}", "protected", "LRUCache", "newInstance", "(", "int", "size", ",", "int", "newOverflow", ")", "{", "return", "new", "ElementCache", "(", "size", ",", "newOverflow", ")", ";", "}", "protected", "void", "resetSpaceLimit", "(", "int", "defaultLimit", ",", "IJavaElement", "parent", ")", "{", "if", "(", "parent", ".", "equals", "(", "this", ".", "spaceLimitParent", ")", ")", "{", "setSpaceLimit", "(", "defaultLimit", ")", ";", "this", ".", "spaceLimitParent", "=", "null", ";", "}", "}", "}", "</s>" ]
3,719
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "public", "class", "SourceConstructorInfo", "extends", "SourceMethodElementInfo", "{", "private", "static", "final", "char", "[", "]", "RETURN_TYPE_NAME", "=", "new", "char", "[", "]", "{", "'v'", ",", "'o'", ",", "'i'", ",", "'d'", "}", ";", "public", "boolean", "isAnnotationMethod", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isConstructor", "(", ")", "{", "return", "true", ";", "}", "public", "char", "[", "]", "getReturnTypeName", "(", ")", "{", "return", "RETURN_TYPE_NAME", ";", "}", "protected", "void", "setReturnType", "(", "char", "[", "]", "type", ")", "{", "}", "}", "</s>" ]
3,720
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IContainer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "ISchedulingRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaConventions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "CreatePackageFragmentOperation", "extends", "JavaModelOperation", "{", "protected", "String", "[", "]", "pkgName", ";", "public", "CreatePackageFragmentOperation", "(", "IPackageFragmentRoot", "parentElement", ",", "String", "packageName", ",", "boolean", "force", ")", "{", "super", "(", "null", ",", "new", "IJavaElement", "[", "]", "{", "parentElement", "}", ",", "force", ")", ";", "this", ".", "pkgName", "=", "packageName", "==", "null", "?", "null", ":", "Util", ".", "getTrimmedSimpleNames", "(", "packageName", ")", ";", "}", "protected", "void", "executeOperation", "(", ")", "throws", "JavaModelException", "{", "try", "{", "JavaElementDelta", "delta", "=", "null", ";", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "getParentElement", "(", ")", ";", "beginTask", "(", "Messages", ".", "operation_createPackageFragmentProgress", ",", "this", ".", "pkgName", ".", "length", ")", ";", "IContainer", "parentFolder", "=", "(", "IContainer", ")", "root", ".", "resource", "(", ")", ";", "String", "[", "]", "sideEffectPackageName", "=", "CharOperation", ".", "NO_STRINGS", ";", "ArrayList", "results", "=", "new", "ArrayList", "(", "this", ".", "pkgName", ".", "length", ")", ";", "char", "[", "]", "[", "]", "inclusionPatterns", "=", "root", ".", "fullInclusionPatternChars", "(", ")", ";", "char", "[", "]", "[", "]", "exclusionPatterns", "=", "root", ".", "fullExclusionPatternChars", "(", ")", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "pkgName", ".", "length", ";", "i", "++", ")", "{", "String", "subFolderName", "=", "this", ".", "pkgName", "[", "i", "]", ";", "sideEffectPackageName", "=", "Util", ".", "arrayConcat", "(", "sideEffectPackageName", ",", "subFolderName", ")", ";", "IResource", "subFolder", "=", "parentFolder", ".", "findMember", "(", "subFolderName", ")", ";", "if", "(", "subFolder", "==", "null", ")", "{", "createFolder", "(", "parentFolder", ",", "subFolderName", ",", "this", ".", "force", ")", ";", "parentFolder", "=", "parentFolder", ".", "getFolder", "(", "new", "Path", "(", "subFolderName", ")", ")", ";", "IPackageFragment", "addedFrag", "=", "root", ".", "getPackageFragment", "(", "sideEffectPackageName", ")", ";", "if", "(", "!", "Util", ".", "isExcluded", "(", "parentFolder", ",", "inclusionPatterns", ",", "exclusionPatterns", ")", ")", "{", "if", "(", "delta", "==", "null", ")", "{", "delta", "=", "newJavaElementDelta", "(", ")", ";", "}", "delta", ".", "added", "(", "addedFrag", ")", ";", "}", "results", ".", "add", "(", "addedFrag", ")", ";", "}", "else", "{", "parentFolder", "=", "(", "IContainer", ")", "subFolder", ";", "}", "worked", "(", "1", ")", ";", "}", "if", "(", "results", ".", "size", "(", ")", ">", "0", ")", "{", "this", ".", "resultElements", "=", "new", "IJavaElement", "[", "results", ".", "size", "(", ")", "]", ";", "results", ".", "toArray", "(", "this", ".", "resultElements", ")", ";", "if", "(", "delta", "!=", "null", ")", "{", "addDelta", "(", "delta", ")", ";", "}", "}", "}", "finally", "{", "done", "(", ")", ";", "}", "}", "protected", "ISchedulingRule", "getSchedulingRule", "(", ")", "{", "if", "(", "this", ".", "pkgName", ".", "length", "==", "0", ")", "return", "null", ";", "IResource", "parentResource", "=", "(", "(", "JavaElement", ")", "getParentElement", "(", ")", ")", ".", "resource", "(", ")", ";", "IResource", "resource", "=", "(", "(", "IContainer", ")", "parentResource", ")", ".", "getFolder", "(", "new", "Path", "(", "this", ".", "pkgName", "[", "0", "]", ")", ")", ";", "return", "resource", ".", "getWorkspace", "(", ")", ".", "getRuleFactory", "(", ")", ".", "createRule", "(", "resource", ")", ";", "}", "public", "IJavaModelStatus", "verify", "(", ")", "{", "IJavaElement", "parentElement", "=", "getParentElement", "(", ")", ";", "if", "(", "parentElement", "==", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NO_ELEMENTS_TO_PROCESS", ")", ";", "}", "String", "packageName", "=", "this", ".", "pkgName", "==", "null", "?", "null", ":", "Util", ".", "concatWith", "(", "this", ".", "pkgName", ",", "'.'", ")", ";", "IJavaProject", "project", "=", "parentElement", ".", "getJavaProject", "(", ")", ";", "if", "(", "this", ".", "pkgName", "==", "null", "||", "(", "this", ".", "pkgName", ".", "length", ">", "0", "&&", "JavaConventions", ".", "validatePackageName", "(", "packageName", ",", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ",", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ")", ".", "getSeverity", "(", ")", "==", "IStatus", ".", "ERROR", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_NAME", ",", "packageName", ")", ";", "}", "IJavaElement", "root", "=", "getParentElement", "(", ")", ";", "if", "(", "root", ".", "isReadOnly", "(", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "READ_ONLY", ",", "root", ")", ";", "}", "IContainer", "parentFolder", "=", "(", "IContainer", ")", "(", "(", "JavaElement", ")", "root", ")", ".", "resource", "(", ")", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "pkgName", ".", "length", ";", "i", "++", ")", "{", "IResource", "subFolder", "=", "parentFolder", ".", "findMember", "(", "this", ".", "pkgName", "[", "i", "]", ")", ";", "if", "(", "subFolder", "!=", "null", ")", "{", "if", "(", "subFolder", ".", "getType", "(", ")", "!=", "IResource", ".", "FOLDER", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "subFolder", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ")", ";", "}", "parentFolder", "=", "(", "IContainer", ")", "subFolder", ";", "}", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "}", "</s>" ]
3,721
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "text", ".", "NumberFormat", ";", "import", "java", ".", "util", ".", "Date", ";", "public", "class", "VerboseElementCache", "extends", "ElementCache", "{", "private", "Object", "beingAdded", ";", "private", "String", "name", ";", "public", "VerboseElementCache", "(", "int", "size", ",", "String", "name", ")", "{", "super", "(", "size", ")", ";", "this", ".", "name", "=", "name", ";", "}", "protected", "boolean", "makeSpace", "(", "int", "space", ")", "{", "if", "(", "this", ".", "beingAdded", "==", "null", ")", "return", "super", ".", "makeSpace", "(", "space", ")", ";", "String", "fillingRatio", "=", "toStringFillingRation", "(", "this", ".", "name", ")", ";", "boolean", "result", "=", "super", ".", "makeSpace", "(", "space", ")", ";", "String", "newFillingRatio", "=", "toStringFillingRation", "(", "this", ".", "name", ")", ";", "if", "(", "!", "fillingRatio", ".", "equals", "(", "newFillingRatio", ")", ")", "{", "System", ".", "out", ".", "println", "(", "Thread", ".", "currentThread", "(", ")", "+", "\"", "\"", "+", "new", "Date", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "fillingRatio", "+", "\"", "(NOW", "\"", "+", "NumberFormat", ".", "getInstance", "(", ")", ".", "format", "(", "fillingRatio", "(", ")", ")", "+", "\"%", "full)\"", ")", ";", "System", ".", "out", ".", "println", "(", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "(", "(", "JavaElement", ")", "this", ".", "beingAdded", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "}", "return", "result", ";", "}", "public", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "try", "{", "if", "(", "this", ".", "beingAdded", "==", "null", ")", "this", ".", "beingAdded", "=", "key", ";", "return", "super", ".", "put", "(", "key", ",", "value", ")", ";", "}", "finally", "{", "if", "(", "key", ".", "equals", "(", "this", ".", "beingAdded", ")", ")", "this", ".", "beingAdded", "=", "null", ";", "}", "}", "}", "</s>" ]
3,722
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ISourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "SourceRange", ";", "public", "class", "CompilationUnitElementInfo", "extends", "OpenableElementInfo", "{", "protected", "int", "sourceLength", ";", "protected", "long", "timestamp", ";", "public", "int", "annotationNumber", "=", "0", ";", "public", "int", "getSourceLength", "(", ")", "{", "return", "this", ".", "sourceLength", ";", "}", "protected", "ISourceRange", "getSourceRange", "(", ")", "{", "return", "new", "SourceRange", "(", "0", ",", "this", ".", "sourceLength", ")", ";", "}", "public", "void", "setSourceLength", "(", "int", "newSourceLength", ")", "{", "this", ".", "sourceLength", "=", "newSourceLength", ";", "}", "}", "</s>" ]
3,723
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ISourceReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "RenameElementsOperation", "extends", "MoveElementsOperation", "{", "public", "RenameElementsOperation", "(", "IJavaElement", "[", "]", "elements", ",", "IJavaElement", "[", "]", "destinations", ",", "String", "[", "]", "newNames", ",", "boolean", "force", ")", "{", "super", "(", "elements", ",", "destinations", ",", "force", ")", ";", "setRenamings", "(", "newNames", ")", ";", "}", "protected", "String", "getMainTaskName", "(", ")", "{", "return", "Messages", ".", "operation_renameElementProgress", ";", "}", "protected", "boolean", "isRename", "(", ")", "{", "return", "true", ";", "}", "protected", "IJavaModelStatus", "verify", "(", ")", "{", "IJavaModelStatus", "status", "=", "super", ".", "verify", "(", ")", ";", "if", "(", "!", "status", ".", "isOK", "(", ")", ")", "return", "status", ";", "if", "(", "this", ".", "renamingsList", "==", "null", "||", "this", ".", "renamingsList", ".", "length", "==", "0", ")", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NULL_NAME", ")", ";", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "protected", "void", "verify", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "if", "(", "element", "==", "null", "||", "!", "element", ".", "exists", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "ELEMENT_DOES_NOT_EXIST", ",", "element", ")", ";", "if", "(", "element", ".", "isReadOnly", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "READ_ONLY", ",", "element", ")", ";", "if", "(", "!", "(", "element", "instanceof", "ISourceReference", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ";", "int", "elementType", "=", "element", ".", "getElementType", "(", ")", ";", "if", "(", "elementType", "<", "IJavaElement", ".", "TYPE", "||", "elementType", "==", "IJavaElement", ".", "INITIALIZER", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ";", "verifyRenaming", "(", "element", ")", ";", "}", "}", "</s>" ]
3,724
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "*", ";", "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", ".", "core", ".", "compiler", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AST", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "IProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "CompilationUnitDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "AbortCompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "MementoTokenizer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "BadLocationException", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "IDocument", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "MalformedTreeException", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "UndoEdit", ";", "public", "class", "CompilationUnit", "extends", "Openable", "implements", "ICompilationUnit", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ",", "SuffixConstants", "{", "static", "final", "int", "JLS2_INTERNAL", "=", "AST", ".", "JLS2", ";", "private", "static", "final", "IImportDeclaration", "[", "]", "NO_IMPORTS", "=", "new", "IImportDeclaration", "[", "0", "]", ";", "protected", "String", "name", ";", "public", "WorkingCopyOwner", "owner", ";", "public", "CompilationUnit", "(", "PackageFragment", "parent", ",", "String", "name", ",", "WorkingCopyOwner", "owner", ")", "{", "super", "(", "parent", ")", ";", "this", ".", "name", "=", "name", ";", "this", ".", "owner", "=", "owner", ";", "}", "public", "UndoEdit", "applyTextEdit", "(", "TextEdit", "edit", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "IBuffer", "buffer", "=", "getBuffer", "(", ")", ";", "if", "(", "buffer", "instanceof", "IBuffer", ".", "ITextEditCapability", ")", "{", "return", "(", "(", "IBuffer", ".", "ITextEditCapability", ")", "buffer", ")", ".", "applyTextEdit", "(", "edit", ",", "monitor", ")", ";", "}", "else", "if", "(", "buffer", "!=", "null", ")", "{", "IDocument", "document", "=", "buffer", "instanceof", "IDocument", "?", "(", "IDocument", ")", "buffer", ":", "new", "DocumentAdapter", "(", "buffer", ")", ";", "try", "{", "UndoEdit", "undoEdit", "=", "edit", ".", "apply", "(", "document", ")", ";", "return", "undoEdit", ";", "}", "catch", "(", "MalformedTreeException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ",", "IJavaModelStatusConstants", ".", "BAD_TEXT_EDIT_LOCATION", ")", ";", "}", "catch", "(", "BadLocationException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ",", "IJavaModelStatusConstants", ".", "BAD_TEXT_EDIT_LOCATION", ")", ";", "}", "}", "return", "null", ";", "}", "public", "void", "becomeWorkingCopy", "(", "IProblemRequestor", "problemRequestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "JavaModelManager", ".", "PerWorkingCopyInfo", "perWorkingCopyInfo", "=", "manager", ".", "getPerWorkingCopyInfo", "(", "this", ",", "false", ",", "true", ",", "null", ")", ";", "if", "(", "perWorkingCopyInfo", "==", "null", ")", "{", "close", "(", ")", ";", "BecomeWorkingCopyOperation", "operation", "=", "new", "BecomeWorkingCopyOperation", "(", "this", ",", "problemRequestor", ")", ";", "operation", ".", "runOperation", "(", "monitor", ")", ";", "}", "}", "public", "void", "becomeWorkingCopy", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "IProblemRequestor", "requestor", "=", "this", ".", "owner", "==", "null", "?", "null", ":", "this", ".", "owner", ".", "getProblemRequestor", "(", "this", ")", ";", "becomeWorkingCopy", "(", "requestor", ",", "monitor", ")", ";", "}", "protected", "boolean", "buildStructure", "(", "OpenableElementInfo", "info", ",", "final", "IProgressMonitor", "pm", ",", "Map", "newElements", ",", "IResource", "underlyingResource", ")", "throws", "JavaModelException", "{", "CompilationUnitElementInfo", "unitInfo", "=", "(", "CompilationUnitElementInfo", ")", "info", ";", "IBuffer", "buffer", "=", "getBufferManager", "(", ")", ".", "getBuffer", "(", "CompilationUnit", ".", "this", ")", ";", "if", "(", "buffer", "==", "null", ")", "{", "openBuffer", "(", "pm", ",", "unitInfo", ")", ";", "}", "CompilationUnitStructureRequestor", "requestor", "=", "new", "CompilationUnitStructureRequestor", "(", "this", ",", "unitInfo", ",", "newElements", ")", ";", "JavaModelManager", ".", "PerWorkingCopyInfo", "perWorkingCopyInfo", "=", "getPerWorkingCopyInfo", "(", ")", ";", "IJavaProject", "project", "=", "getJavaProject", "(", ")", ";", "boolean", "createAST", ";", "boolean", "resolveBindings", ";", "int", "reconcileFlags", ";", "HashMap", "problems", ";", "if", "(", "info", "instanceof", "ASTHolderCUInfo", ")", "{", "ASTHolderCUInfo", "astHolder", "=", "(", "ASTHolderCUInfo", ")", "info", ";", "createAST", "=", "astHolder", ".", "astLevel", "!=", "NO_AST", ";", "resolveBindings", "=", "astHolder", ".", "resolveBindings", ";", "reconcileFlags", "=", "astHolder", ".", "reconcileFlags", ";", "problems", "=", "astHolder", ".", "problems", ";", "}", "else", "{", "createAST", "=", "false", ";", "resolveBindings", "=", "false", ";", "reconcileFlags", "=", "0", ";", "problems", "=", "null", ";", "}", "boolean", "computeProblems", "=", "perWorkingCopyInfo", "!=", "null", "&&", "perWorkingCopyInfo", ".", "isActive", "(", ")", "&&", "project", "!=", "null", "&&", "JavaProject", ".", "hasJavaNature", "(", "project", ".", "getProject", "(", ")", ")", ";", "IProblemFactory", "problemFactory", "=", "new", "DefaultProblemFactory", "(", ")", ";", "Map", "options", "=", "project", "==", "null", "?", "JavaCore", ".", "getOptions", "(", ")", ":", "project", ".", "getOptions", "(", "true", ")", ";", "if", "(", "!", "computeProblems", ")", "{", "options", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_TAGS", ",", "\"\"", ")", ";", "}", "CompilerOptions", "compilerOptions", "=", "new", "CompilerOptions", "(", "options", ")", ";", "compilerOptions", ".", "ignoreMethodBodies", "=", "(", "reconcileFlags", "&", "ICompilationUnit", ".", "IGNORE_METHOD_BODIES", ")", "!=", "0", ";", "SourceElementParser", "parser", "=", "new", "SourceElementParser", "(", "requestor", ",", "problemFactory", ",", "compilerOptions", ",", "true", ",", "!", "createAST", ")", ";", "parser", ".", "reportOnlyOneSyntaxError", "=", "!", "computeProblems", ";", "parser", ".", "setMethodsFullRecovery", "(", "true", ")", ";", "parser", ".", "setStatementsRecovery", "(", "(", "reconcileFlags", "&", "ICompilationUnit", ".", "ENABLE_STATEMENTS_RECOVERY", ")", "!=", "0", ")", ";", "if", "(", "!", "computeProblems", "&&", "!", "resolveBindings", "&&", "!", "createAST", ")", "parser", ".", "javadocParser", ".", "checkDocComment", "=", "false", ";", "requestor", ".", "parser", "=", "parser", ";", "if", "(", "underlyingResource", "==", "null", ")", "{", "underlyingResource", "=", "getResource", "(", ")", ";", "}", "if", "(", "underlyingResource", "!=", "null", ")", "unitInfo", ".", "timestamp", "=", "(", "(", "IFile", ")", "underlyingResource", ")", ".", "getModificationStamp", "(", ")", ";", "CompilationUnitDeclaration", "compilationUnitDeclaration", "=", "null", ";", "CompilationUnit", "source", "=", "cloneCachingContents", "(", ")", ";", "try", "{", "if", "(", "computeProblems", ")", "{", "if", "(", "problems", "==", "null", ")", "{", "problems", "=", "new", "HashMap", "(", ")", ";", "compilationUnitDeclaration", "=", "CompilationUnitProblemFinder", ".", "process", "(", "source", ",", "parser", ",", "this", ".", "owner", ",", "problems", ",", "createAST", ",", "reconcileFlags", ",", "pm", ")", ";", "try", "{", "perWorkingCopyInfo", ".", "beginReporting", "(", ")", ";", "for", "(", "Iterator", "iteraror", "=", "problems", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "iteraror", ".", "hasNext", "(", ")", ";", ")", "{", "CategorizedProblem", "[", "]", "categorizedProblems", "=", "(", "CategorizedProblem", "[", "]", ")", "iteraror", ".", "next", "(", ")", ";", "if", "(", "categorizedProblems", "==", "null", ")", "continue", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "categorizedProblems", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "perWorkingCopyInfo", ".", "acceptProblem", "(", "categorizedProblems", "[", "i", "]", ")", ";", "}", "}", "}", "finally", "{", "perWorkingCopyInfo", ".", "endReporting", "(", ")", ";", "}", "}", "else", "{", "compilationUnitDeclaration", "=", "CompilationUnitProblemFinder", ".", "process", "(", "source", ",", "parser", ",", "this", ".", "owner", ",", "problems", ",", "createAST", ",", "reconcileFlags", ",", "pm", ")", ";", "}", "}", "else", "{", "compilationUnitDeclaration", "=", "parser", ".", "parseCompilationUnit", "(", "source", ",", "true", ",", "pm", ")", ";", "}", "if", "(", "createAST", ")", "{", "int", "astLevel", "=", "(", "(", "ASTHolderCUInfo", ")", "info", ")", ".", "astLevel", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "cu", "=", "AST", ".", "convertCompilationUnit", "(", "astLevel", ",", "compilationUnitDeclaration", ",", "options", ",", "computeProblems", ",", "source", ",", "reconcileFlags", ",", "pm", ")", ";", "(", "(", "ASTHolderCUInfo", ")", "info", ")", ".", "ast", "=", "cu", ";", "}", "}", "finally", "{", "if", "(", "compilationUnitDeclaration", "!=", "null", ")", "{", "compilationUnitDeclaration", ".", "cleanUp", "(", ")", ";", "}", "}", "return", "unitInfo", ".", "isStructureKnown", "(", ")", ";", "}", "public", "CompilationUnit", "cloneCachingContents", "(", ")", "{", "return", "new", "CompilationUnit", "(", "(", "PackageFragment", ")", "this", ".", "parent", ",", "this", ".", "name", ",", "this", ".", "owner", ")", "{", "private", "char", "[", "]", "cachedContents", ";", "public", "char", "[", "]", "getContents", "(", ")", "{", "if", "(", "this", ".", "cachedContents", "==", "null", ")", "this", ".", "cachedContents", "=", "CompilationUnit", ".", "this", ".", "getContents", "(", ")", ";", "return", "this", ".", "cachedContents", ";", "}", "public", "CompilationUnit", "originalFromClone", "(", ")", "{", "return", "CompilationUnit", ".", "this", ";", "}", "}", ";", "}", "public", "boolean", "canBeRemovedFromCache", "(", ")", "{", "if", "(", "getPerWorkingCopyInfo", "(", ")", "!=", "null", ")", "return", "false", ";", "return", "super", ".", "canBeRemovedFromCache", "(", ")", ";", "}", "public", "boolean", "canBufferBeRemovedFromCache", "(", "IBuffer", "buffer", ")", "{", "if", "(", "getPerWorkingCopyInfo", "(", ")", "!=", "null", ")", "return", "false", ";", "return", "super", ".", "canBufferBeRemovedFromCache", "(", "buffer", ")", ";", "}", "public", "void", "close", "(", ")", "throws", "JavaModelException", "{", "if", "(", "getPerWorkingCopyInfo", "(", ")", "!=", "null", ")", "return", ";", "super", ".", "close", "(", ")", ";", "}", "protected", "void", "closing", "(", "Object", "info", ")", "{", "if", "(", "getPerWorkingCopyInfo", "(", ")", "==", "null", ")", "{", "super", ".", "closing", "(", "info", ")", ";", "}", "}", "public", "void", "codeComplete", "(", "int", "offset", ",", "ICompletionRequestor", "requestor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "offset", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "void", "codeComplete", "(", "int", "offset", ",", "ICompletionRequestor", "requestor", ",", "WorkingCopyOwner", "workingCopyOwner", ")", "throws", "JavaModelException", "{", "if", "(", "requestor", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "codeComplete", "(", "offset", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "CompletionRequestorWrapper", "(", "requestor", ")", ",", "workingCopyOwner", ")", ";", "}", "public", "void", "codeComplete", "(", "int", "offset", ",", "final", "ICodeCompletionRequestor", "requestor", ")", "throws", "JavaModelException", "{", "if", "(", "requestor", "==", "null", ")", "{", "codeComplete", "(", "offset", ",", "(", "ICompletionRequestor", ")", "null", ")", ";", "return", ";", "}", "codeComplete", "(", "offset", ",", "new", "ICompletionRequestor", "(", ")", "{", "public", "void", "acceptAnonymousType", "(", "char", "[", "]", "superTypePackageName", ",", "char", "[", "]", "superTypeName", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "}", "public", "void", "acceptClass", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "className", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptClass", "(", "packageName", ",", "className", ",", "completionName", ",", "modifiers", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptError", "(", "IProblem", "error", ")", "{", "}", "public", "void", "acceptField", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "fieldName", ",", "char", "[", "]", "typePackageName", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptField", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "fieldName", ",", "typePackageName", ",", "typeName", ",", "completionName", ",", "modifiers", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptInterface", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "interfaceName", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptInterface", "(", "packageName", ",", "interfaceName", ",", "completionName", ",", "modifiers", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptKeyword", "(", "char", "[", "]", "keywordName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptKeyword", "(", "keywordName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptLabel", "(", "char", "[", "]", "labelName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptLabel", "(", "labelName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptLocalVariable", "(", "char", "[", "]", "localVarName", ",", "char", "[", "]", "typePackageName", ",", "char", "[", "]", "typeName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "}", "public", "void", "acceptMethod", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "char", "[", "]", "returnTypePackageName", ",", "char", "[", "]", "returnTypeName", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptMethod", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "selector", ",", "parameterPackageNames", ",", "parameterTypeNames", ",", "returnTypePackageName", ",", "returnTypeName", ",", "completionName", ",", "modifiers", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptMethodDeclaration", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "char", "[", "]", "returnTypePackageName", ",", "char", "[", "]", "returnTypeName", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "}", "public", "void", "acceptModifier", "(", "char", "[", "]", "modifierName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptModifier", "(", "modifierName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptPackage", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "completionName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptPackage", "(", "packageName", ",", "completionName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptType", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "completionName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptType", "(", "packageName", ",", "typeName", ",", "completionName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptVariableName", "(", "char", "[", "]", "typePackageName", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "varName", ",", "char", "[", "]", "completionName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "}", "}", ")", ";", "}", "public", "void", "codeComplete", "(", "int", "offset", ",", "CompletionRequestor", "requestor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "offset", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "void", "codeComplete", "(", "int", "offset", ",", "CompletionRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "offset", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "monitor", ")", ";", "}", "public", "void", "codeComplete", "(", "int", "offset", ",", "CompletionRequestor", "requestor", ",", "WorkingCopyOwner", "workingCopyOwner", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "offset", ",", "requestor", ",", "workingCopyOwner", ",", "null", ")", ";", "}", "public", "void", "codeComplete", "(", "int", "offset", ",", "CompletionRequestor", "requestor", ",", "WorkingCopyOwner", "workingCopyOwner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "this", ",", "isWorkingCopy", "(", ")", "?", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ")", "getOriginalElement", "(", ")", ":", "this", ",", "offset", ",", "requestor", ",", "workingCopyOwner", ",", "this", ",", "monitor", ")", ";", "}", "public", "IJavaElement", "[", "]", "codeSelect", "(", "int", "offset", ",", "int", "length", ")", "throws", "JavaModelException", "{", "return", "codeSelect", "(", "offset", ",", "length", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "IJavaElement", "[", "]", "codeSelect", "(", "int", "offset", ",", "int", "length", ",", "WorkingCopyOwner", "workingCopyOwner", ")", "throws", "JavaModelException", "{", "return", "super", ".", "codeSelect", "(", "this", ",", "offset", ",", "length", ",", "workingCopyOwner", ")", ";", "}", "public", "void", "commit", "(", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "commitWorkingCopy", "(", "force", ",", "monitor", ")", ";", "}", "public", "void", "commitWorkingCopy", "(", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CommitWorkingCopyOperation", "op", "=", "new", "CommitWorkingCopyOperation", "(", "this", ",", "force", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "}", "public", "void", "copy", "(", "IJavaElement", "container", ",", "IJavaElement", "sibling", ",", "String", "rename", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "container", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "operation_nullContainer", ")", ";", "}", "IJavaElement", "[", "]", "elements", "=", "new", "IJavaElement", "[", "]", "{", "this", "}", ";", "IJavaElement", "[", "]", "containers", "=", "new", "IJavaElement", "[", "]", "{", "container", "}", ";", "String", "[", "]", "renamings", "=", "null", ";", "if", "(", "rename", "!=", "null", ")", "{", "renamings", "=", "new", "String", "[", "]", "{", "rename", "}", ";", "}", "getJavaModel", "(", ")", ".", "copy", "(", "elements", ",", "containers", ",", "null", ",", "renamings", ",", "force", ",", "monitor", ")", ";", "}", "protected", "Object", "createElementInfo", "(", ")", "{", "return", "new", "CompilationUnitElementInfo", "(", ")", ";", "}", "public", "IImportDeclaration", "createImport", "(", "String", "importName", ",", "IJavaElement", "sibling", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "createImport", "(", "importName", ",", "sibling", ",", "Flags", ".", "AccDefault", ",", "monitor", ")", ";", "}", "public", "IImportDeclaration", "createImport", "(", "String", "importName", ",", "IJavaElement", "sibling", ",", "int", "flags", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CreateImportOperation", "op", "=", "new", "CreateImportOperation", "(", "importName", ",", "this", ",", "flags", ")", ";", "if", "(", "sibling", "!=", "null", ")", "{", "op", ".", "createBefore", "(", "sibling", ")", ";", "}", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "getImport", "(", "importName", ")", ";", "}", "public", "IPackageDeclaration", "createPackageDeclaration", "(", "String", "pkg", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "CreatePackageDeclarationOperation", "op", "=", "new", "CreatePackageDeclarationOperation", "(", "pkg", ",", "this", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "getPackageDeclaration", "(", "pkg", ")", ";", "}", "public", "IType", "createType", "(", "String", "content", ",", "IJavaElement", "sibling", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "!", "exists", "(", ")", ")", "{", "IPackageFragment", "pkg", "=", "(", "IPackageFragment", ")", "getParent", "(", ")", ";", "String", "source", "=", "\"\"", ";", "if", "(", "!", "pkg", ".", "isDefaultPackage", "(", ")", ")", "{", "String", "lineSeparator", "=", "Util", ".", "getLineSeparator", "(", "null", ",", "getJavaProject", "(", ")", ")", ";", "source", "=", "\"package", "\"", "+", "pkg", ".", "getElementName", "(", ")", "+", "\";\"", "+", "lineSeparator", "+", "lineSeparator", ";", "}", "CreateCompilationUnitOperation", "op", "=", "new", "CreateCompilationUnitOperation", "(", "pkg", ",", "this", ".", "name", ",", "source", ",", "force", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "}", "CreateTypeOperation", "op", "=", "new", "CreateTypeOperation", "(", "this", ",", "content", ",", "force", ")", ";", "if", "(", "sibling", "!=", "null", ")", "{", "op", ".", "createBefore", "(", "sibling", ")", ";", "}", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "(", "IType", ")", "op", ".", "getResultElements", "(", ")", "[", "0", "]", ";", "}", "public", "void", "delete", "(", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "IJavaElement", "[", "]", "elements", "=", "new", "IJavaElement", "[", "]", "{", "this", "}", ";", "getJavaModel", "(", ")", ".", "delete", "(", "elements", ",", "force", ",", "monitor", ")", ";", "}", "public", "void", "destroy", "(", ")", "{", "try", "{", "discardWorkingCopy", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "JavaModelManager", ".", "VERBOSE", ")", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "void", "discardWorkingCopy", "(", ")", "throws", "JavaModelException", "{", "DiscardWorkingCopyOperation", "op", "=", "new", "DiscardWorkingCopyOperation", "(", "this", ")", ";", "op", ".", "runOperation", "(", "null", ")", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "!", "(", "obj", "instanceof", "CompilationUnit", ")", ")", "return", "false", ";", "CompilationUnit", "other", "=", "(", "CompilationUnit", ")", "obj", ";", "return", "this", ".", "owner", ".", "equals", "(", "other", ".", "owner", ")", "&&", "super", ".", "equals", "(", "obj", ")", ";", "}", "public", "IJavaElement", "[", "]", "findElements", "(", "IJavaElement", "element", ")", "{", "ArrayList", "children", "=", "new", "ArrayList", "(", ")", ";", "while", "(", "element", "!=", "null", "&&", "element", ".", "getElementType", "(", ")", "!=", "IJavaElement", ".", "COMPILATION_UNIT", ")", "{", "children", ".", "add", "(", "element", ")", ";", "element", "=", "element", ".", "getParent", "(", ")", ";", "}", "if", "(", "element", "==", "null", ")", "return", "null", ";", "IJavaElement", "currentElement", "=", "this", ";", "for", "(", "int", "i", "=", "children", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "SourceRefElement", "child", "=", "(", "SourceRefElement", ")", "children", ".", "get", "(", "i", ")", ";", "switch", "(", "child", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "PACKAGE_DECLARATION", ":", "currentElement", "=", "(", "(", "ICompilationUnit", ")", "currentElement", ")", ".", "getPackageDeclaration", "(", "child", ".", "getElementName", "(", ")", ")", ";", "break", ";", "case", "IJavaElement", ".", "IMPORT_CONTAINER", ":", "currentElement", "=", "(", "(", "ICompilationUnit", ")", "currentElement", ")", ".", "getImportContainer", "(", ")", ";", "break", ";", "case", "IJavaElement", ".", "IMPORT_DECLARATION", ":", "currentElement", "=", "(", "(", "IImportContainer", ")", "currentElement", ")", ".", "getImport", "(", "child", ".", "getElementName", "(", ")", ")", ";", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "switch", "(", "currentElement", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "currentElement", "=", "(", "(", "ICompilationUnit", ")", "currentElement", ")", ".", "getType", "(", "child", ".", "getElementName", "(", ")", ")", ";", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "currentElement", "=", "(", "(", "IType", ")", "currentElement", ")", ".", "getType", "(", "child", ".", "getElementName", "(", ")", ")", ";", "break", ";", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "INITIALIZER", ":", "case", "IJavaElement", ".", "METHOD", ":", "currentElement", "=", "(", "(", "IMember", ")", "currentElement", ")", ".", "getType", "(", "child", ".", "getElementName", "(", ")", ",", "child", ".", "occurrenceCount", ")", ";", "break", ";", "}", "break", ";", "case", "IJavaElement", ".", "INITIALIZER", ":", "currentElement", "=", "(", "(", "IType", ")", "currentElement", ")", ".", "getInitializer", "(", "child", ".", "occurrenceCount", ")", ";", "break", ";", "case", "IJavaElement", ".", "FIELD", ":", "currentElement", "=", "(", "(", "IType", ")", "currentElement", ")", ".", "getField", "(", "child", ".", "getElementName", "(", ")", ")", ";", "break", ";", "case", "IJavaElement", ".", "METHOD", ":", "currentElement", "=", "(", "(", "IType", ")", "currentElement", ")", ".", "getMethod", "(", "child", ".", "getElementName", "(", ")", ",", "(", "(", "IMethod", ")", "child", ")", ".", "getParameterTypes", "(", ")", ")", ";", "break", ";", "}", "}", "if", "(", "currentElement", "!=", "null", "&&", "currentElement", ".", "exists", "(", ")", ")", "{", "return", "new", "IJavaElement", "[", "]", "{", "currentElement", "}", ";", "}", "else", "{", "return", "null", ";", "}", "}", "public", "IType", "findPrimaryType", "(", ")", "{", "String", "typeName", "=", "Util", ".", "getNameWithoutJavaLikeExtension", "(", "getElementName", "(", ")", ")", ";", "IType", "primaryType", "=", "getType", "(", "typeName", ")", ";", "if", "(", "primaryType", ".", "exists", "(", ")", ")", "{", "return", "primaryType", ";", "}", "return", "null", ";", "}", "public", "IJavaElement", "findSharedWorkingCopy", "(", "IBufferFactory", "factory", ")", "{", "if", "(", "factory", "==", "null", ")", "factory", "=", "getBufferManager", "(", ")", ".", "getDefaultBufferFactory", "(", ")", ";", "return", "findWorkingCopy", "(", "BufferFactoryWrapper", ".", "create", "(", "factory", ")", ")", ";", "}", "public", "ICompilationUnit", "findWorkingCopy", "(", "WorkingCopyOwner", "workingCopyOwner", ")", "{", "CompilationUnit", "cu", "=", "LanguageSupportFactory", ".", "newCompilationUnit", "(", "(", "PackageFragment", ")", "this", ".", "parent", ",", "getElementName", "(", ")", ",", "workingCopyOwner", ")", ";", "if", "(", "workingCopyOwner", "==", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", "{", "return", "cu", ";", "}", "else", "{", "JavaModelManager", ".", "PerWorkingCopyInfo", "perWorkingCopyInfo", "=", "cu", ".", "getPerWorkingCopyInfo", "(", ")", ";", "if", "(", "perWorkingCopyInfo", "!=", "null", ")", "{", "return", "perWorkingCopyInfo", ".", "getWorkingCopy", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "}", "public", "IType", "[", "]", "getAllTypes", "(", ")", "throws", "JavaModelException", "{", "IJavaElement", "[", "]", "types", "=", "getTypes", "(", ")", ";", "int", "i", ";", "ArrayList", "allTypes", "=", "new", "ArrayList", "(", "types", ".", "length", ")", ";", "ArrayList", "typesToTraverse", "=", "new", "ArrayList", "(", "types", ".", "length", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "typesToTraverse", ".", "add", "(", "types", "[", "i", "]", ")", ";", "}", "while", "(", "!", "typesToTraverse", ".", "isEmpty", "(", ")", ")", "{", "IType", "type", "=", "(", "IType", ")", "typesToTraverse", ".", "get", "(", "0", ")", ";", "typesToTraverse", ".", "remove", "(", "type", ")", ";", "allTypes", ".", "add", "(", "type", ")", ";", "types", "=", "type", ".", "getTypes", "(", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "typesToTraverse", ".", "add", "(", "types", "[", "i", "]", ")", ";", "}", "}", "IType", "[", "]", "arrayOfAllTypes", "=", "new", "IType", "[", "allTypes", ".", "size", "(", ")", "]", ";", "allTypes", ".", "toArray", "(", "arrayOfAllTypes", ")", ";", "return", "arrayOfAllTypes", ";", "}", "public", "ICompilationUnit", "getCompilationUnit", "(", ")", "{", "return", "this", ";", "}", "public", "char", "[", "]", "getContents", "(", ")", "{", "IBuffer", "buffer", "=", "getBufferManager", "(", ")", ".", "getBuffer", "(", "this", ")", ";", "if", "(", "buffer", "==", "null", ")", "{", "IFile", "file", "=", "(", "IFile", ")", "getResource", "(", ")", ";", "String", "encoding", ";", "try", "{", "encoding", "=", "file", ".", "getCharset", "(", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "encoding", "=", "null", ";", "}", "try", "{", "return", "Util", ".", "getResourceContentsAsCharArray", "(", "file", ",", "encoding", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "abortOnMissingSource", ".", "get", "(", ")", "==", "Boolean", ".", "TRUE", ")", "{", "IOException", "ioException", "=", "e", ".", "getJavaModelStatus", "(", ")", ".", "getCode", "(", ")", "==", "IJavaModelStatusConstants", ".", "IO_EXCEPTION", "?", "(", "IOException", ")", "e", ".", "getException", "(", ")", ":", "new", "IOException", "(", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "new", "AbortCompilationUnit", "(", "null", ",", "ioException", ",", "encoding", ")", ";", "}", "else", "{", "Util", ".", "log", "(", "e", ",", "Messages", ".", "bind", "(", "Messages", ".", "file_notFound", ",", "file", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ")", ";", "}", "return", "CharOperation", ".", "NO_CHAR", ";", "}", "}", "char", "[", "]", "contents", "=", "buffer", ".", "getCharacters", "(", ")", ";", "if", "(", "contents", "==", "null", ")", "{", "if", "(", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "abortOnMissingSource", ".", "get", "(", ")", "==", "Boolean", ".", "TRUE", ")", "{", "IOException", "ioException", "=", "new", "IOException", "(", "Messages", ".", "buffer_closed", ")", ";", "IFile", "file", "=", "(", "IFile", ")", "getResource", "(", ")", ";", "String", "encoding", ";", "try", "{", "encoding", "=", "file", ".", "getCharset", "(", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "encoding", "=", "null", ";", "}", "throw", "new", "AbortCompilationUnit", "(", "null", ",", "ioException", ",", "encoding", ")", ";", "}", "return", "CharOperation", ".", "NO_CHAR", ";", "}", "return", "contents", ";", "}", "public", "IResource", "getCorrespondingResource", "(", ")", "throws", "JavaModelException", "{", "PackageFragmentRoot", "root", "=", "getPackageFragmentRoot", "(", ")", ";", "if", "(", "root", "==", "null", "||", "root", ".", "isArchive", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "getUnderlyingResource", "(", ")", ";", "}", "}", "public", "IJavaElement", "getElementAt", "(", "int", "position", ")", "throws", "JavaModelException", "{", "IJavaElement", "e", "=", "getSourceElementAt", "(", "position", ")", ";", "if", "(", "e", "==", "this", ")", "{", "return", "null", ";", "}", "else", "{", "return", "e", ";", "}", "}", "public", "String", "getElementName", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "COMPILATION_UNIT", ";", "}", "public", "char", "[", "]", "getFileName", "(", ")", "{", "return", "getPath", "(", ")", ".", "toString", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "public", "IJavaElement", "getHandleFromMemento", "(", "String", "token", ",", "MementoTokenizer", "memento", ",", "WorkingCopyOwner", "workingCopyOwner", ")", "{", "switch", "(", "token", ".", "charAt", "(", "0", ")", ")", "{", "case", "JEM_IMPORTDECLARATION", ":", "JavaElement", "container", "=", "(", "JavaElement", ")", "getImportContainer", "(", ")", ";", "return", "container", ".", "getHandleFromMemento", "(", "token", ",", "memento", ",", "workingCopyOwner", ")", ";", "case", "JEM_PACKAGEDECLARATION", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "pkgName", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "pkgDecl", "=", "(", "JavaElement", ")", "getPackageDeclaration", "(", "pkgName", ")", ";", "return", "pkgDecl", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "case", "JEM_TYPE", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "typeName", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "type", "=", "(", "JavaElement", ")", "getType", "(", "typeName", ")", ";", "return", "type", ".", "getHandleFromMemento", "(", "memento", ",", "workingCopyOwner", ")", ";", "}", "return", "null", ";", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JavaElement", ".", "JEM_COMPILATIONUNIT", ";", "}", "public", "IImportDeclaration", "getImport", "(", "String", "importName", ")", "{", "return", "getImportContainer", "(", ")", ".", "getImport", "(", "importName", ")", ";", "}", "public", "IImportContainer", "getImportContainer", "(", ")", "{", "return", "new", "ImportContainer", "(", "this", ")", ";", "}", "public", "IImportDeclaration", "[", "]", "getImports", "(", ")", "throws", "JavaModelException", "{", "IImportContainer", "container", "=", "getImportContainer", "(", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "Object", "info", "=", "manager", ".", "getInfo", "(", "container", ")", ";", "if", "(", "info", "==", "null", ")", "{", "if", "(", "manager", ".", "getInfo", "(", "this", ")", "!=", "null", ")", "return", "NO_IMPORTS", ";", "else", "{", "open", "(", "null", ")", ";", "info", "=", "manager", ".", "getInfo", "(", "container", ")", ";", "if", "(", "info", "==", "null", ")", "return", "NO_IMPORTS", ";", "}", "}", "IJavaElement", "[", "]", "elements", "=", "(", "(", "ImportContainerInfo", ")", "info", ")", ".", "children", ";", "int", "length", "=", "elements", ".", "length", ";", "IImportDeclaration", "[", "]", "imports", "=", "new", "IImportDeclaration", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "elements", ",", "0", ",", "imports", ",", "0", ",", "length", ")", ";", "return", "imports", ";", "}", "public", "ITypeRoot", "getTypeRoot", "(", ")", "{", "return", "this", ";", "}", "public", "char", "[", "]", "getMainTypeName", "(", ")", "{", "return", "Util", ".", "getNameWithoutJavaLikeExtension", "(", "getElementName", "(", ")", ")", ".", "toCharArray", "(", ")", ";", "}", "public", "IJavaElement", "getOriginal", "(", "IJavaElement", "workingCopyElement", ")", "{", "if", "(", "!", "isWorkingCopy", "(", ")", ")", "return", "null", ";", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "workingCopyElement", ".", "getAncestor", "(", "COMPILATION_UNIT", ")", ";", "if", "(", "cu", "==", "null", "||", "!", "this", ".", "owner", ".", "equals", "(", "cu", ".", "owner", ")", ")", "{", "return", "null", ";", "}", "return", "workingCopyElement", ".", "getPrimaryElement", "(", ")", ";", "}", "public", "IJavaElement", "getOriginalElement", "(", ")", "{", "if", "(", "!", "isWorkingCopy", "(", ")", ")", "return", "null", ";", "return", "getPrimaryElement", "(", ")", ";", "}", "public", "WorkingCopyOwner", "getOwner", "(", ")", "{", "return", "isPrimary", "(", ")", "||", "!", "isWorkingCopy", "(", ")", "?", "null", ":", "this", ".", "owner", ";", "}", "public", "IPackageDeclaration", "getPackageDeclaration", "(", "String", "pkg", ")", "{", "return", "new", "PackageDeclaration", "(", "this", ",", "pkg", ")", ";", "}", "public", "IPackageDeclaration", "[", "]", "getPackageDeclarations", "(", ")", "throws", "JavaModelException", "{", "ArrayList", "list", "=", "getChildrenOfType", "(", "PACKAGE_DECLARATION", ")", ";", "IPackageDeclaration", "[", "]", "array", "=", "new", "IPackageDeclaration", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "array", ")", ";", "return", "array", ";", "}", "public", "char", "[", "]", "[", "]", "getPackageName", "(", ")", "{", "PackageFragment", "packageFragment", "=", "(", "PackageFragment", ")", "getParent", "(", ")", ";", "if", "(", "packageFragment", "==", "null", ")", "return", "CharOperation", ".", "NO_CHAR_CHAR", ";", "return", "Util", ".", "toCharArrays", "(", "packageFragment", ".", "names", ")", ";", "}", "public", "IPath", "getPath", "(", ")", "{", "PackageFragmentRoot", "root", "=", "getPackageFragmentRoot", "(", ")", ";", "if", "(", "root", "==", "null", ")", "return", "new", "Path", "(", "getElementName", "(", ")", ")", ";", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "return", "root", ".", "getPath", "(", ")", ";", "}", "else", "{", "return", "getParent", "(", ")", ".", "getPath", "(", ")", ".", "append", "(", "getElementName", "(", ")", ")", ";", "}", "}", "public", "JavaModelManager", ".", "PerWorkingCopyInfo", "getPerWorkingCopyInfo", "(", ")", "{", "return", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getPerWorkingCopyInfo", "(", "this", ",", "false", ",", "false", ",", "null", ")", ";", "}", "public", "ICompilationUnit", "getPrimary", "(", ")", "{", "return", "(", "ICompilationUnit", ")", "getPrimaryElement", "(", "true", ")", ";", "}", "public", "IJavaElement", "getPrimaryElement", "(", "boolean", "checkOwner", ")", "{", "if", "(", "checkOwner", "&&", "isPrimary", "(", ")", ")", "return", "this", ";", "return", "LanguageSupportFactory", ".", "newCompilationUnit", "(", "(", "PackageFragment", ")", "getParent", "(", ")", ",", "getElementName", "(", ")", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "IResource", "resource", "(", "PackageFragmentRoot", "root", ")", "{", "if", "(", "root", "==", "null", ")", "return", "null", ";", "return", "(", "(", "IContainer", ")", "(", "(", "Openable", ")", "this", ".", "parent", ")", ".", "resource", "(", "root", ")", ")", ".", "getFile", "(", "new", "Path", "(", "getElementName", "(", ")", ")", ")", ";", "}", "public", "String", "getSource", "(", ")", "throws", "JavaModelException", "{", "IBuffer", "buffer", "=", "getBuffer", "(", ")", ";", "if", "(", "buffer", "==", "null", ")", "return", "\"\"", ";", "return", "buffer", ".", "getContents", "(", ")", ";", "}", "public", "ISourceRange", "getSourceRange", "(", ")", "throws", "JavaModelException", "{", "return", "(", "(", "CompilationUnitElementInfo", ")", "getElementInfo", "(", ")", ")", ".", "getSourceRange", "(", ")", ";", "}", "public", "IType", "getType", "(", "String", "typeName", ")", "{", "return", "new", "SourceType", "(", "this", ",", "typeName", ")", ";", "}", "public", "IType", "[", "]", "getTypes", "(", ")", "throws", "JavaModelException", "{", "ArrayList", "list", "=", "getChildrenOfType", "(", "TYPE", ")", ";", "IType", "[", "]", "array", "=", "new", "IType", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "array", ")", ";", "return", "array", ";", "}", "public", "IResource", "getUnderlyingResource", "(", ")", "throws", "JavaModelException", "{", "if", "(", "isWorkingCopy", "(", ")", "&&", "!", "isPrimary", "(", ")", ")", "return", "null", ";", "return", "super", ".", "getUnderlyingResource", "(", ")", ";", "}", "public", "IJavaElement", "getSharedWorkingCopy", "(", "IProgressMonitor", "pm", ",", "IBufferFactory", "factory", ",", "IProblemRequestor", "problemRequestor", ")", "throws", "JavaModelException", "{", "if", "(", "factory", "==", "null", ")", "factory", "=", "getBufferManager", "(", ")", ".", "getDefaultBufferFactory", "(", ")", ";", "return", "getWorkingCopy", "(", "BufferFactoryWrapper", ".", "create", "(", "factory", ")", ",", "problemRequestor", ",", "pm", ")", ";", "}", "public", "IJavaElement", "getWorkingCopy", "(", ")", "throws", "JavaModelException", "{", "return", "getWorkingCopy", "(", "null", ")", ";", "}", "public", "ICompilationUnit", "getWorkingCopy", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "getWorkingCopy", "(", "new", "WorkingCopyOwner", "(", ")", "{", "}", ",", "null", ",", "monitor", ")", ";", "}", "public", "ICompilationUnit", "getWorkingCopy", "(", "WorkingCopyOwner", "workingCopyOwner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "getWorkingCopy", "(", "workingCopyOwner", ",", "null", ",", "monitor", ")", ";", "}", "public", "IJavaElement", "getWorkingCopy", "(", "IProgressMonitor", "monitor", ",", "IBufferFactory", "factory", ",", "IProblemRequestor", "problemRequestor", ")", "throws", "JavaModelException", "{", "return", "getWorkingCopy", "(", "BufferFactoryWrapper", ".", "create", "(", "factory", ")", ",", "problemRequestor", ",", "monitor", ")", ";", "}", "public", "ICompilationUnit", "getWorkingCopy", "(", "WorkingCopyOwner", "workingCopyOwner", ",", "IProblemRequestor", "problemRequestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "!", "isPrimary", "(", ")", ")", "return", "this", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "CompilationUnit", "workingCopy", "=", "LanguageSupportFactory", ".", "newCompilationUnit", "(", "(", "PackageFragment", ")", "getParent", "(", ")", ",", "getElementName", "(", ")", ",", "workingCopyOwner", ")", ";", "JavaModelManager", ".", "PerWorkingCopyInfo", "perWorkingCopyInfo", "=", "manager", ".", "getPerWorkingCopyInfo", "(", "workingCopy", ",", "false", ",", "true", ",", "null", ")", ";", "if", "(", "perWorkingCopyInfo", "!=", "null", ")", "{", "return", "perWorkingCopyInfo", ".", "getWorkingCopy", "(", ")", ";", "}", "BecomeWorkingCopyOperation", "op", "=", "new", "BecomeWorkingCopyOperation", "(", "workingCopy", ",", "problemRequestor", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "return", "workingCopy", ";", "}", "protected", "boolean", "hasBuffer", "(", ")", "{", "return", "true", ";", "}", "public", "boolean", "hasResourceChanged", "(", ")", "{", "if", "(", "!", "isWorkingCopy", "(", ")", ")", "return", "false", ";", "Object", "info", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getInfo", "(", "this", ")", ";", "if", "(", "info", "==", "null", ")", "return", "false", ";", "IResource", "resource", "=", "getResource", "(", ")", ";", "if", "(", "resource", "==", "null", ")", "return", "false", ";", "return", "(", "(", "CompilationUnitElementInfo", ")", "info", ")", ".", "timestamp", "!=", "resource", ".", "getModificationStamp", "(", ")", ";", "}", "public", "boolean", "isBasedOn", "(", "IResource", "resource", ")", "{", "if", "(", "!", "isWorkingCopy", "(", ")", ")", "return", "false", ";", "if", "(", "!", "getResource", "(", ")", ".", "equals", "(", "resource", ")", ")", "return", "false", ";", "return", "!", "hasResourceChanged", "(", ")", ";", "}", "public", "boolean", "isConsistent", "(", ")", "{", "return", "!", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getElementsOutOfSynchWithBuffers", "(", ")", ".", "contains", "(", "this", ")", ";", "}", "public", "boolean", "isPrimary", "(", ")", "{", "return", "this", ".", "owner", "==", "DefaultWorkingCopyOwner", ".", "PRIMARY", ";", "}", "protected", "boolean", "isSourceElement", "(", ")", "{", "return", "true", ";", "}", "protected", "IStatus", "validateCompilationUnit", "(", "IResource", "resource", ")", "{", "IPackageFragmentRoot", "root", "=", "getPackageFragmentRoot", "(", ")", ";", "try", "{", "if", "(", "root", ".", "getKind", "(", ")", "!=", "IPackageFragmentRoot", ".", "K_SOURCE", ")", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "root", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "e", ".", "getJavaModelStatus", "(", ")", ";", "}", "if", "(", "resource", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "inclusionPatterns", "=", "(", "(", "PackageFragmentRoot", ")", "root", ")", ".", "fullInclusionPatternChars", "(", ")", ";", "char", "[", "]", "[", "]", "exclusionPatterns", "=", "(", "(", "PackageFragmentRoot", ")", "root", ")", ".", "fullExclusionPatternChars", "(", ")", ";", "if", "(", "Util", ".", "isExcluded", "(", "resource", ",", "inclusionPatterns", ",", "exclusionPatterns", ")", ")", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "ELEMENT_NOT_ON_CLASSPATH", ",", "this", ")", ";", "if", "(", "!", "resource", ".", "isAccessible", "(", ")", ")", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "ELEMENT_DOES_NOT_EXIST", ",", "this", ")", ";", "}", "IJavaProject", "project", "=", "getJavaProject", "(", ")", ";", "return", "JavaConventions", ".", "validateCompilationUnitName", "(", "getElementName", "(", ")", ",", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ",", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ")", ";", "}", "public", "boolean", "isWorkingCopy", "(", ")", "{", "return", "!", "isPrimary", "(", ")", "||", "getPerWorkingCopyInfo", "(", ")", "!=", "null", ";", "}", "public", "void", "makeConsistent", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "makeConsistent", "(", "NO_AST", ",", "false", ",", "0", ",", "null", ",", "monitor", ")", ";", "}", "public", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "makeConsistent", "(", "int", "astLevel", ",", "boolean", "resolveBindings", ",", "int", "reconcileFlags", ",", "HashMap", "problems", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "isConsistent", "(", ")", ")", "return", "null", ";", "try", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "abortOnMissingSource", ".", "set", "(", "Boolean", ".", "TRUE", ")", ";", "if", "(", "astLevel", "!=", "NO_AST", "||", "problems", "!=", "null", ")", "{", "ASTHolderCUInfo", "info", "=", "new", "ASTHolderCUInfo", "(", ")", ";", "info", ".", "astLevel", "=", "astLevel", ";", "info", ".", "resolveBindings", "=", "resolveBindings", ";", "info", ".", "reconcileFlags", "=", "reconcileFlags", ";", "info", ".", "problems", "=", "problems", ";", "openWhenClosed", "(", "info", ",", "monitor", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "result", "=", "info", ".", "ast", ";", "info", ".", "ast", "=", "null", ";", "return", "result", ";", "}", "else", "{", "openWhenClosed", "(", "createElementInfo", "(", ")", ",", "monitor", ")", ";", "return", "null", ";", "}", "}", "finally", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "abortOnMissingSource", ".", "set", "(", "null", ")", ";", "}", "}", "public", "void", "move", "(", "IJavaElement", "container", ",", "IJavaElement", "sibling", ",", "String", "rename", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "container", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "operation_nullContainer", ")", ";", "}", "IJavaElement", "[", "]", "elements", "=", "new", "IJavaElement", "[", "]", "{", "this", "}", ";", "IJavaElement", "[", "]", "containers", "=", "new", "IJavaElement", "[", "]", "{", "container", "}", ";", "String", "[", "]", "renamings", "=", "null", ";", "if", "(", "rename", "!=", "null", ")", "{", "renamings", "=", "new", "String", "[", "]", "{", "rename", "}", ";", "}", "getJavaModel", "(", ")", ".", "move", "(", "elements", ",", "containers", ",", "null", ",", "renamings", ",", "force", ",", "monitor", ")", ";", "}", "protected", "IBuffer", "openBuffer", "(", "IProgressMonitor", "pm", ",", "Object", "info", ")", "throws", "JavaModelException", "{", "BufferManager", "bufManager", "=", "getBufferManager", "(", ")", ";", "boolean", "isWorkingCopy", "=", "isWorkingCopy", "(", ")", ";", "IBuffer", "buffer", "=", "isWorkingCopy", "?", "this", ".", "owner", ".", "createBuffer", "(", "this", ")", ":", "BufferManager", ".", "createBuffer", "(", "this", ")", ";", "if", "(", "buffer", "==", "null", ")", "return", "null", ";", "ICompilationUnit", "original", "=", "null", ";", "boolean", "mustSetToOriginalContent", "=", "false", ";", "if", "(", "isWorkingCopy", ")", "{", "mustSetToOriginalContent", "=", "!", "isPrimary", "(", ")", "&&", "(", "original", "=", "LanguageSupportFactory", ".", "newCompilationUnit", "(", "(", "PackageFragment", ")", "getParent", "(", ")", ",", "getElementName", "(", ")", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ")", ".", "isOpen", "(", ")", ";", "}", "synchronized", "(", "bufManager", ")", "{", "IBuffer", "existingBuffer", "=", "bufManager", ".", "getBuffer", "(", "this", ")", ";", "if", "(", "existingBuffer", "!=", "null", ")", "return", "existingBuffer", ";", "if", "(", "buffer", ".", "getCharacters", "(", ")", "==", "null", ")", "{", "if", "(", "isWorkingCopy", ")", "{", "if", "(", "mustSetToOriginalContent", ")", "{", "buffer", ".", "setContents", "(", "original", ".", "getSource", "(", ")", ")", ";", "}", "else", "{", "IFile", "file", "=", "(", "IFile", ")", "getResource", "(", ")", ";", "if", "(", "file", "==", "null", "||", "!", "file", ".", "exists", "(", ")", ")", "{", "buffer", ".", "setContents", "(", "CharOperation", ".", "NO_CHAR", ")", ";", "}", "else", "{", "buffer", ".", "setContents", "(", "Util", ".", "getResourceContentsAsCharArray", "(", "file", ")", ")", ";", "}", "}", "}", "else", "{", "IFile", "file", "=", "(", "IFile", ")", "getResource", "(", ")", ";", "if", "(", "file", "==", "null", "||", "!", "file", ".", "exists", "(", ")", ")", "throw", "newNotPresentException", "(", ")", ";", "buffer", ".", "setContents", "(", "Util", ".", "getResourceContentsAsCharArray", "(", "file", ")", ")", ";", "}", "}", "bufManager", ".", "addBuffer", "(", "buffer", ")", ";", "buffer", ".", "addBufferChangedListener", "(", "this", ")", ";", "}", "return", "buffer", ";", "}", "protected", "void", "openAncestors", "(", "HashMap", "newElements", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "!", "isWorkingCopy", "(", ")", ")", "{", "super", ".", "openAncestors", "(", "newElements", ",", "monitor", ")", ";", "}", "}", "public", "CompilationUnit", "originalFromClone", "(", ")", "{", "return", "this", ";", "}", "public", "IMarker", "[", "]", "reconcile", "(", ")", "throws", "JavaModelException", "{", "reconcile", "(", "NO_AST", ",", "false", ",", "false", ",", "null", ",", "null", ")", ";", "return", "null", ";", "}", "public", "void", "reconcile", "(", "boolean", "forceProblemDetection", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "reconcile", "(", "NO_AST", ",", "forceProblemDetection", "?", "ICompilationUnit", ".", "FORCE_PROBLEM_DETECTION", ":", "0", ",", "null", ",", "monitor", ")", ";", "}", "public", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "reconcile", "(", "int", "astLevel", ",", "boolean", "forceProblemDetection", ",", "WorkingCopyOwner", "workingCopyOwner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "return", "reconcile", "(", "astLevel", ",", "forceProblemDetection", "?", "ICompilationUnit", ".", "FORCE_PROBLEM_DETECTION", ":", "0", ",", "workingCopyOwner", ",", "monitor", ")", ";", "}", "public", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "reconcile", "(", "int", "astLevel", ",", "boolean", "forceProblemDetection", ",", "boolean", "enableStatementsRecovery", ",", "WorkingCopyOwner", "workingCopyOwner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "int", "flags", "=", "0", ";", "if", "(", "forceProblemDetection", ")", "flags", "|=", "ICompilationUnit", ".", "FORCE_PROBLEM_DETECTION", ";", "if", "(", "enableStatementsRecovery", ")", "flags", "|=", "ICompilationUnit", ".", "ENABLE_STATEMENTS_RECOVERY", ";", "return", "reconcile", "(", "astLevel", ",", "flags", ",", "workingCopyOwner", ",", "monitor", ")", ";", "}", "public", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "reconcile", "(", "int", "astLevel", ",", "int", "reconcileFlags", ",", "WorkingCopyOwner", "workingCopyOwner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "!", "isWorkingCopy", "(", ")", ")", "return", "null", ";", "if", "(", "workingCopyOwner", "==", "null", ")", "workingCopyOwner", "=", "DefaultWorkingCopyOwner", ".", "PRIMARY", ";", "PerformanceStats", "stats", "=", "null", ";", "if", "(", "ReconcileWorkingCopyOperation", ".", "PERF", ")", "{", "stats", "=", "PerformanceStats", ".", "getStats", "(", "JavaModelManager", ".", "RECONCILE_PERF", ",", "this", ")", ";", "stats", ".", "startRun", "(", "new", "String", "(", "getFileName", "(", ")", ")", ")", ";", "}", "ReconcileWorkingCopyOperation", "op", "=", "new", "ReconcileWorkingCopyOperation", "(", "this", ",", "astLevel", ",", "reconcileFlags", ",", "workingCopyOwner", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "try", "{", "manager", ".", "cacheZipFiles", "(", "this", ")", ";", "op", ".", "runOperation", "(", "monitor", ")", ";", "}", "finally", "{", "manager", ".", "flushZipFiles", "(", "this", ")", ";", "}", "if", "(", "ReconcileWorkingCopyOperation", ".", "PERF", ")", "{", "stats", ".", "endRun", "(", ")", ";", "}", "return", "op", ".", "ast", ";", "}", "public", "void", "rename", "(", "String", "newName", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "newName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "operation_nullName", ")", ";", "}", "IJavaElement", "[", "]", "elements", "=", "new", "IJavaElement", "[", "]", "{", "this", "}", ";", "IJavaElement", "[", "]", "dests", "=", "new", "IJavaElement", "[", "]", "{", "getParent", "(", ")", "}", ";", "String", "[", "]", "renamings", "=", "new", "String", "[", "]", "{", "newName", "}", ";", "getJavaModel", "(", ")", ".", "rename", "(", "elements", ",", "dests", ",", "renamings", ",", "force", ",", "monitor", ")", ";", "}", "public", "void", "restore", "(", ")", "throws", "JavaModelException", "{", "if", "(", "!", "isWorkingCopy", "(", ")", ")", "return", ";", "CompilationUnit", "original", "=", "(", "CompilationUnit", ")", "getOriginalElement", "(", ")", ";", "IBuffer", "buffer", "=", "getBuffer", "(", ")", ";", "if", "(", "buffer", "==", "null", ")", "return", ";", "buffer", ".", "setContents", "(", "original", ".", "getContents", "(", ")", ")", ";", "updateTimeStamp", "(", "original", ")", ";", "makeConsistent", "(", "null", ")", ";", "}", "public", "void", "save", "(", "IProgressMonitor", "pm", ",", "boolean", "force", ")", "throws", "JavaModelException", "{", "if", "(", "isWorkingCopy", "(", ")", ")", "{", "reconcile", "(", ")", ";", "}", "else", "{", "super", ".", "save", "(", "pm", ",", "force", ")", ";", "}", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "if", "(", "!", "isPrimary", "(", ")", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "toStringName", "(", "buffer", ")", ";", "}", "else", "{", "if", "(", "isWorkingCopy", "(", ")", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "toStringName", "(", "buffer", ")", ";", "if", "(", "info", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"", "(not", "open)\"", ")", ";", "}", "}", "else", "{", "super", ".", "toStringInfo", "(", "tab", ",", "buffer", ",", "info", ",", "showResolvedInfo", ")", ";", "}", "}", "}", "protected", "void", "updateTimeStamp", "(", "CompilationUnit", "original", ")", "throws", "JavaModelException", "{", "long", "timeStamp", "=", "(", "(", "IFile", ")", "original", ".", "getResource", "(", ")", ")", ".", "getModificationStamp", "(", ")", ";", "if", "(", "timeStamp", "==", "IResource", ".", "NULL_STAMP", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_RESOURCE", ")", ")", ";", "}", "(", "(", "CompilationUnitElementInfo", ")", "getElementInfo", "(", ")", ")", ".", "timestamp", "=", "timeStamp", ";", "}", "protected", "IStatus", "validateExistence", "(", "IResource", "underlyingResource", ")", "{", "if", "(", "!", "isWorkingCopy", "(", ")", ")", "{", "IStatus", "status", "=", "validateCompilationUnit", "(", "underlyingResource", ")", ";", "if", "(", "!", "status", ".", "isOK", "(", ")", ")", "return", "status", ";", "}", "if", "(", "!", "isPrimary", "(", ")", "&&", "getPerWorkingCopyInfo", "(", ")", "==", "null", ")", "{", "return", "newDoesNotExistStatus", "(", ")", ";", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "public", "ISourceRange", "getNameRange", "(", ")", "{", "return", "null", ";", "}", "}", "</s>" ]
3,725
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SimpleName", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "CreateInitializerOperation", "extends", "CreateTypeMemberOperation", "{", "protected", "int", "numberOfInitializers", "=", "1", ";", "public", "CreateInitializerOperation", "(", "IType", "parentElement", ",", "String", "source", ")", "{", "super", "(", "parentElement", ",", "source", ",", "false", ")", ";", "}", "protected", "ASTNode", "generateElementAST", "(", "ASTRewrite", "rewriter", ",", "ICompilationUnit", "cu", ")", "throws", "JavaModelException", "{", "ASTNode", "node", "=", "super", ".", "generateElementAST", "(", "rewriter", ",", "cu", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "!=", "ASTNode", ".", "INITIALIZER", ")", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CONTENTS", ")", ")", ";", "return", "node", ";", "}", "protected", "IJavaElement", "generateResultHandle", "(", ")", "{", "try", "{", "getType", "(", ")", ".", "getCompilationUnit", "(", ")", ".", "close", "(", ")", ";", "if", "(", "this", ".", "anchorElement", "==", "null", ")", "{", "return", "getType", "(", ")", ".", "getInitializer", "(", "this", ".", "numberOfInitializers", ")", ";", "}", "else", "{", "IJavaElement", "[", "]", "children", "=", "getType", "(", ")", ".", "getChildren", "(", ")", ";", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "IJavaElement", "child", "=", "children", "[", "i", "]", ";", "if", "(", "child", ".", "equals", "(", "this", ".", "anchorElement", ")", ")", "{", "if", "(", "child", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "INITIALIZER", "&&", "this", ".", "insertionPolicy", "==", "CreateElementInCUOperation", ".", "INSERT_AFTER", ")", "{", "count", "++", ";", "}", "return", "getType", "(", ")", ".", "getInitializer", "(", "count", ")", ";", "}", "else", "if", "(", "child", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "INITIALIZER", ")", "{", "count", "++", ";", "}", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "return", "null", ";", "}", "public", "String", "getMainTaskName", "(", ")", "{", "return", "Messages", ".", "operation_createInitializerProgress", ";", "}", "protected", "SimpleName", "rename", "(", "ASTNode", "node", ",", "SimpleName", "newName", ")", "{", "return", "null", ";", "}", "protected", "void", "initializeDefaultPosition", "(", ")", "{", "IType", "parentElement", "=", "getType", "(", ")", ";", "try", "{", "IJavaElement", "[", "]", "elements", "=", "parentElement", ".", "getInitializers", "(", ")", ";", "if", "(", "elements", "!=", "null", "&&", "elements", ".", "length", ">", "0", ")", "{", "this", ".", "numberOfInitializers", "=", "elements", ".", "length", ";", "createAfter", "(", "elements", "[", "elements", ".", "length", "-", "1", "]", ")", ";", "}", "else", "{", "elements", "=", "parentElement", ".", "getChildren", "(", ")", ";", "if", "(", "elements", "!=", "null", "&&", "elements", ".", "length", ">", "0", ")", "{", "createBefore", "(", "elements", "[", "0", "]", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "</s>" ]
3,726
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryElementValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryField", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryNestedType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TagBits", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "class", "ClassFileInfo", "extends", "OpenableElementInfo", "implements", "SuffixConstants", "{", "protected", "JavaElement", "[", "]", "binaryChildren", "=", "null", ";", "protected", "ITypeParameter", "[", "]", "typeParameters", ";", "private", "void", "generateAnnotationsInfos", "(", "JavaElement", "member", ",", "IBinaryAnnotation", "[", "]", "binaryAnnotations", ",", "long", "tagBits", ",", "HashMap", "newElements", ")", "{", "generateAnnotationsInfos", "(", "member", ",", "null", ",", "binaryAnnotations", ",", "tagBits", ",", "newElements", ")", ";", "}", "private", "void", "generateAnnotationsInfos", "(", "JavaElement", "member", ",", "char", "[", "]", "parameterName", ",", "IBinaryAnnotation", "[", "]", "binaryAnnotations", ",", "long", "tagBits", ",", "HashMap", "newElements", ")", "{", "if", "(", "binaryAnnotations", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "binaryAnnotations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IBinaryAnnotation", "annotationInfo", "=", "binaryAnnotations", "[", "i", "]", ";", "generateAnnotationInfo", "(", "member", ",", "parameterName", ",", "newElements", ",", "annotationInfo", ",", "null", ")", ";", "}", "}", "generateStandardAnnotationsInfos", "(", "member", ",", "parameterName", ",", "tagBits", ",", "newElements", ")", ";", "}", "private", "void", "generateAnnotationInfo", "(", "JavaElement", "parent", ",", "HashMap", "newElements", ",", "IBinaryAnnotation", "annotationInfo", ",", "String", "memberValuePairName", ")", "{", "generateAnnotationInfo", "(", "parent", ",", "null", ",", "newElements", ",", "annotationInfo", ",", "memberValuePairName", ")", ";", "}", "private", "void", "generateAnnotationInfo", "(", "JavaElement", "parent", ",", "char", "[", "]", "parameterName", ",", "HashMap", "newElements", ",", "IBinaryAnnotation", "annotationInfo", ",", "String", "memberValuePairName", ")", "{", "char", "[", "]", "typeName", "=", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ".", "toCharArray", "(", "CharOperation", ".", "replaceOnCopy", "(", "annotationInfo", ".", "getTypeName", "(", ")", ",", "'/'", ",", "'.'", ")", ")", ";", "Annotation", "annotation", "=", "new", "Annotation", "(", "parent", ",", "new", "String", "(", "typeName", ")", ",", "memberValuePairName", ")", ";", "while", "(", "newElements", ".", "containsKey", "(", "annotation", ")", ")", "{", "annotation", ".", "occurrenceCount", "++", ";", "}", "newElements", ".", "put", "(", "annotation", ",", "annotationInfo", ")", ";", "IBinaryElementValuePair", "[", "]", "pairs", "=", "annotationInfo", ".", "getElementValuePairs", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "pairs", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Object", "value", "=", "pairs", "[", "i", "]", ".", "getValue", "(", ")", ";", "if", "(", "value", "instanceof", "IBinaryAnnotation", ")", "{", "generateAnnotationInfo", "(", "annotation", ",", "newElements", ",", "(", "IBinaryAnnotation", ")", "value", ",", "new", "String", "(", "pairs", "[", "i", "]", ".", "getName", "(", ")", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "Object", "[", "]", ")", "{", "Object", "[", "]", "valueArray", "=", "(", "Object", "[", "]", ")", "value", ";", "for", "(", "int", "j", "=", "0", ",", "valueArrayLength", "=", "valueArray", ".", "length", ";", "j", "<", "valueArrayLength", ";", "j", "++", ")", "{", "Object", "nestedValue", "=", "valueArray", "[", "j", "]", ";", "if", "(", "nestedValue", "instanceof", "IBinaryAnnotation", ")", "{", "generateAnnotationInfo", "(", "annotation", ",", "newElements", ",", "(", "IBinaryAnnotation", ")", "nestedValue", ",", "new", "String", "(", "pairs", "[", "i", "]", ".", "getName", "(", ")", ")", ")", ";", "}", "}", "}", "}", "}", "private", "void", "generateStandardAnnotationsInfos", "(", "JavaElement", "javaElement", ",", "char", "[", "]", "parameterName", ",", "long", "tagBits", ",", "HashMap", "newElements", ")", "{", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AllStandardAnnotationsMask", ")", "==", "0", ")", "return", ";", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationTargetMASK", ")", "!=", "0", ")", "{", "generateStandardAnnotation", "(", "javaElement", ",", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_TARGET", ",", "getTargetElementTypes", "(", "tagBits", ")", ",", "newElements", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationRetentionMASK", ")", "!=", "0", ")", "{", "generateStandardAnnotation", "(", "javaElement", ",", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_RETENTION", ",", "getRetentionPolicy", "(", "tagBits", ")", ",", "newElements", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationDeprecated", ")", "!=", "0", ")", "{", "generateStandardAnnotation", "(", "javaElement", ",", "TypeConstants", ".", "JAVA_LANG_DEPRECATED", ",", "Annotation", ".", "NO_MEMBER_VALUE_PAIRS", ",", "newElements", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationDocumented", ")", "!=", "0", ")", "{", "generateStandardAnnotation", "(", "javaElement", ",", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_DOCUMENTED", ",", "Annotation", ".", "NO_MEMBER_VALUE_PAIRS", ",", "newElements", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationInherited", ")", "!=", "0", ")", "{", "generateStandardAnnotation", "(", "javaElement", ",", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_INHERITED", ",", "Annotation", ".", "NO_MEMBER_VALUE_PAIRS", ",", "newElements", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationPolymorphicSignature", ")", "!=", "0", ")", "{", "generateStandardAnnotation", "(", "javaElement", ",", "TypeConstants", ".", "JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE", ",", "Annotation", ".", "NO_MEMBER_VALUE_PAIRS", ",", "newElements", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationSafeVarargs", ")", "!=", "0", ")", "{", "generateStandardAnnotation", "(", "javaElement", ",", "TypeConstants", ".", "JAVA_LANG_SAFEVARARGS", ",", "Annotation", ".", "NO_MEMBER_VALUE_PAIRS", ",", "newElements", ")", ";", "}", "}", "private", "void", "generateStandardAnnotation", "(", "JavaElement", "javaElement", ",", "char", "[", "]", "[", "]", "typeName", ",", "IMemberValuePair", "[", "]", "members", ",", "HashMap", "newElements", ")", "{", "IAnnotation", "annotation", "=", "new", "Annotation", "(", "javaElement", ",", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "typeName", ",", "'.'", ")", ")", ")", ";", "AnnotationInfo", "annotationInfo", "=", "new", "AnnotationInfo", "(", ")", ";", "annotationInfo", ".", "members", "=", "members", ";", "newElements", ".", "put", "(", "annotation", ",", "annotationInfo", ")", ";", "}", "private", "IMemberValuePair", "[", "]", "getTargetElementTypes", "(", "long", "tagBits", ")", "{", "ArrayList", "values", "=", "new", "ArrayList", "(", ")", ";", "String", "elementType", "=", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_ELEMENTTYPE", ",", "'.'", ")", ")", "+", "'.'", ";", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationForType", ")", "!=", "0", ")", "{", "values", ".", "add", "(", "elementType", "+", "new", "String", "(", "TypeConstants", ".", "TYPE", ")", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationForField", ")", "!=", "0", ")", "{", "values", ".", "add", "(", "elementType", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_FIELD", ")", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationForMethod", ")", "!=", "0", ")", "{", "values", ".", "add", "(", "elementType", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_METHOD", ")", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationForParameter", ")", "!=", "0", ")", "{", "values", ".", "add", "(", "elementType", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_PARAMETER", ")", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationForConstructor", ")", "!=", "0", ")", "{", "values", ".", "add", "(", "elementType", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_CONSTRUCTOR", ")", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationForLocalVariable", ")", "!=", "0", ")", "{", "values", ".", "add", "(", "elementType", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_LOCAL_VARIABLE", ")", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationForAnnotationType", ")", "!=", "0", ")", "{", "values", ".", "add", "(", "elementType", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_ANNOTATION_TYPE", ")", ")", ";", "}", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationForPackage", ")", "!=", "0", ")", "{", "values", ".", "add", "(", "elementType", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_PACKAGE", ")", ")", ";", "}", "final", "Object", "value", ";", "if", "(", "values", ".", "size", "(", ")", "==", "0", ")", "{", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationTarget", ")", "!=", "0", ")", "value", "=", "CharOperation", ".", "NO_STRINGS", ";", "else", "return", "Annotation", ".", "NO_MEMBER_VALUE_PAIRS", ";", "}", "else", "if", "(", "values", ".", "size", "(", ")", "==", "1", ")", "{", "value", "=", "values", ".", "get", "(", "0", ")", ";", "}", "else", "{", "value", "=", "values", ".", "toArray", "(", "new", "String", "[", "values", ".", "size", "(", ")", "]", ")", ";", "}", "return", "new", "IMemberValuePair", "[", "]", "{", "new", "IMemberValuePair", "(", ")", "{", "public", "int", "getValueKind", "(", ")", "{", "return", "IMemberValuePair", ".", "K_QUALIFIED_NAME", ";", "}", "public", "Object", "getValue", "(", ")", "{", "return", "value", ";", "}", "public", "String", "getMemberName", "(", ")", "{", "return", "new", "String", "(", "TypeConstants", ".", "VALUE", ")", ";", "}", "}", "}", ";", "}", "private", "IMemberValuePair", "[", "]", "getRetentionPolicy", "(", "long", "tagBits", ")", "{", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationRetentionMASK", ")", "==", "0", ")", "return", "Annotation", ".", "NO_MEMBER_VALUE_PAIRS", ";", "String", "retention", "=", "null", ";", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationRuntimeRetention", ")", "==", "TagBits", ".", "AnnotationRuntimeRetention", ")", "{", "retention", "=", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_RETENTIONPOLICY", ",", "'.'", ")", ")", "+", "'.'", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_RUNTIME", ")", ";", "}", "else", "if", "(", "(", "tagBits", "&", "TagBits", ".", "AnnotationSourceRetention", ")", "!=", "0", ")", "{", "retention", "=", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_RETENTIONPOLICY", ",", "'.'", ")", ")", "+", "'.'", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_SOURCE", ")", ";", "}", "else", "{", "retention", "=", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "TypeConstants", ".", "JAVA_LANG_ANNOTATION_RETENTIONPOLICY", ",", "'.'", ")", ")", "+", "'.'", "+", "new", "String", "(", "TypeConstants", ".", "UPPER_CLASS", ")", ";", "}", "final", "String", "value", "=", "retention", ";", "return", "new", "IMemberValuePair", "[", "]", "{", "new", "IMemberValuePair", "(", ")", "{", "public", "int", "getValueKind", "(", ")", "{", "return", "IMemberValuePair", ".", "K_QUALIFIED_NAME", ";", "}", "public", "Object", "getValue", "(", ")", "{", "return", "value", ";", "}", "public", "String", "getMemberName", "(", ")", "{", "return", "new", "String", "(", "TypeConstants", ".", "VALUE", ")", ";", "}", "}", "}", ";", "}", "private", "void", "generateFieldInfos", "(", "IType", "type", ",", "IBinaryType", "typeInfo", ",", "HashMap", "newElements", ",", "ArrayList", "childrenHandles", ")", "{", "IBinaryField", "[", "]", "fields", "=", "typeInfo", ".", "getFields", "(", ")", ";", "if", "(", "fields", "==", "null", ")", "{", "return", ";", "}", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "fieldCount", "=", "fields", ".", "length", ";", "i", "<", "fieldCount", ";", "i", "++", ")", "{", "IBinaryField", "fieldInfo", "=", "fields", "[", "i", "]", ";", "BinaryField", "field", "=", "new", "BinaryField", "(", "(", "JavaElement", ")", "type", ",", "manager", ".", "intern", "(", "new", "String", "(", "fieldInfo", ".", "getName", "(", ")", ")", ")", ")", ";", "newElements", ".", "put", "(", "field", ",", "fieldInfo", ")", ";", "childrenHandles", ".", "add", "(", "field", ")", ";", "generateAnnotationsInfos", "(", "field", ",", "fieldInfo", ".", "getAnnotations", "(", ")", ",", "fieldInfo", ".", "getTagBits", "(", ")", ",", "newElements", ")", ";", "}", "}", "private", "void", "generateInnerClassHandles", "(", "IType", "type", ",", "IBinaryType", "typeInfo", ",", "ArrayList", "childrenHandles", ")", "{", "IBinaryNestedType", "[", "]", "innerTypes", "=", "typeInfo", ".", "getMemberTypes", "(", ")", ";", "if", "(", "innerTypes", "!=", "null", ")", "{", "IPackageFragment", "pkg", "=", "(", "IPackageFragment", ")", "type", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", ";", "for", "(", "int", "i", "=", "0", ",", "typeCount", "=", "innerTypes", ".", "length", ";", "i", "<", "typeCount", ";", "i", "++", ")", "{", "IBinaryNestedType", "binaryType", "=", "innerTypes", "[", "i", "]", ";", "IClassFile", "parentClassFile", "=", "pkg", ".", "getClassFile", "(", "new", "String", "(", "ClassFile", ".", "unqualifiedName", "(", "binaryType", ".", "getName", "(", ")", ")", ")", "+", "SUFFIX_STRING_class", ")", ";", "IType", "innerType", "=", "new", "BinaryType", "(", "(", "JavaElement", ")", "parentClassFile", ",", "ClassFile", ".", "simpleName", "(", "binaryType", ".", "getName", "(", ")", ")", ")", ";", "childrenHandles", ".", "add", "(", "innerType", ")", ";", "}", "}", "}", "private", "void", "generateMethodInfos", "(", "IType", "type", ",", "IBinaryType", "typeInfo", ",", "HashMap", "newElements", ",", "ArrayList", "childrenHandles", ",", "ArrayList", "typeParameterHandles", ")", "{", "IBinaryMethod", "[", "]", "methods", "=", "typeInfo", ".", "getMethods", "(", ")", ";", "if", "(", "methods", "==", "null", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0", ",", "methodCount", "=", "methods", ".", "length", ";", "i", "<", "methodCount", ";", "i", "++", ")", "{", "IBinaryMethod", "methodInfo", "=", "methods", "[", "i", "]", ";", "boolean", "useGenericSignature", "=", "true", ";", "char", "[", "]", "signature", "=", "methodInfo", ".", "getGenericSignature", "(", ")", ";", "if", "(", "signature", "==", "null", ")", "{", "useGenericSignature", "=", "false", ";", "signature", "=", "methodInfo", ".", "getMethodDescriptor", "(", ")", ";", "}", "String", "selector", "=", "new", "String", "(", "methodInfo", ".", "getSelector", "(", ")", ")", ";", "final", "boolean", "isConstructor", "=", "methodInfo", ".", "isConstructor", "(", ")", ";", "if", "(", "isConstructor", ")", "{", "selector", "=", "type", ".", "getElementName", "(", ")", ";", "}", "String", "[", "]", "pNames", "=", "null", ";", "try", "{", "pNames", "=", "Signature", ".", "getParameterTypes", "(", "new", "String", "(", "signature", ")", ")", ";", "if", "(", "isConstructor", "&&", "useGenericSignature", "&&", "type", ".", "isMember", "(", ")", "&&", "!", "Flags", ".", "isStatic", "(", "type", ".", "getFlags", "(", ")", ")", ")", "{", "int", "length", "=", "pNames", ".", "length", ";", "System", ".", "arraycopy", "(", "pNames", ",", "0", ",", "(", "pNames", "=", "new", "String", "[", "length", "+", "1", "]", ")", ",", "1", ",", "length", ")", ";", "char", "[", "]", "descriptor", "=", "methodInfo", ".", "getMethodDescriptor", "(", ")", ";", "final", "String", "[", "]", "parameterTypes", "=", "Signature", ".", "getParameterTypes", "(", "new", "String", "(", "descriptor", ")", ")", ";", "pNames", "[", "0", "]", "=", "parameterTypes", "[", "0", "]", ";", "}", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "signature", "=", "methodInfo", ".", "getMethodDescriptor", "(", ")", ";", "pNames", "=", "Signature", ".", "getParameterTypes", "(", "new", "String", "(", "signature", ")", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "signature", "=", "methodInfo", ".", "getMethodDescriptor", "(", ")", ";", "pNames", "=", "Signature", ".", "getParameterTypes", "(", "new", "String", "(", "signature", ")", ")", ";", "}", "char", "[", "]", "[", "]", "paramNames", "=", "new", "char", "[", "pNames", ".", "length", "]", "[", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "pNames", ".", "length", ";", "j", "++", ")", "{", "paramNames", "[", "j", "]", "=", "pNames", "[", "j", "]", ".", "toCharArray", "(", ")", ";", "}", "char", "[", "]", "[", "]", "parameterTypes", "=", "ClassFile", ".", "translatedNames", "(", "paramNames", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "selector", "=", "manager", ".", "intern", "(", "selector", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "pNames", ".", "length", ";", "j", "++", ")", "{", "pNames", "[", "j", "]", "=", "manager", ".", "intern", "(", "new", "String", "(", "parameterTypes", "[", "j", "]", ")", ")", ";", "}", "BinaryMethod", "method", "=", "new", "BinaryMethod", "(", "(", "JavaElement", ")", "type", ",", "selector", ",", "pNames", ")", ";", "childrenHandles", ".", "add", "(", "method", ")", ";", "while", "(", "newElements", ".", "containsKey", "(", "method", ")", ")", "method", ".", "occurrenceCount", "++", ";", "newElements", ".", "put", "(", "method", ",", "methodInfo", ")", ";", "int", "max", "=", "pNames", ".", "length", ";", "char", "[", "]", "[", "]", "argumentNames", "=", "methodInfo", ".", "getArgumentNames", "(", ")", ";", "if", "(", "argumentNames", "==", "null", "||", "argumentNames", ".", "length", "<", "max", ")", "{", "argumentNames", "=", "new", "char", "[", "max", "]", "[", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "max", ";", "j", "++", ")", "{", "argumentNames", "[", "j", "]", "=", "(", "\"arg\"", "+", "j", ")", ".", "toCharArray", "(", ")", ";", "}", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "max", ";", "j", "++", ")", "{", "IBinaryAnnotation", "[", "]", "parameterAnnotations", "=", "methodInfo", ".", "getParameterAnnotations", "(", "j", ")", ";", "if", "(", "parameterAnnotations", "!=", "null", ")", "{", "LocalVariable", "localVariable", "=", "new", "LocalVariable", "(", "method", ",", "new", "String", "(", "argumentNames", "[", "j", "]", ")", ",", "0", ",", "-", "1", ",", "0", ",", "-", "1", ",", "method", ".", "parameterTypes", "[", "j", "]", ",", "null", ",", "-", "1", ",", "true", ")", ";", "generateAnnotationsInfos", "(", "localVariable", ",", "argumentNames", "[", "j", "]", ",", "parameterAnnotations", ",", "methodInfo", ".", "getTagBits", "(", ")", ",", "newElements", ")", ";", "}", "}", "generateTypeParameterInfos", "(", "method", ",", "signature", ",", "newElements", ",", "typeParameterHandles", ")", ";", "generateAnnotationsInfos", "(", "method", ",", "methodInfo", ".", "getAnnotations", "(", ")", ",", "methodInfo", ".", "getTagBits", "(", ")", ",", "newElements", ")", ";", "Object", "defaultValue", "=", "methodInfo", ".", "getDefaultValue", "(", ")", ";", "if", "(", "defaultValue", "instanceof", "IBinaryAnnotation", ")", "{", "generateAnnotationInfo", "(", "method", ",", "newElements", ",", "(", "IBinaryAnnotation", ")", "defaultValue", ",", "new", "String", "(", "methodInfo", ".", "getSelector", "(", ")", ")", ")", ";", "}", "}", "}", "private", "void", "generateTypeParameterInfos", "(", "BinaryMember", "parent", ",", "char", "[", "]", "signature", ",", "HashMap", "newElements", ",", "ArrayList", "typeParameterHandles", ")", "{", "if", "(", "signature", "==", "null", ")", "return", ";", "char", "[", "]", "[", "]", "typeParameterSignatures", "=", "Signature", ".", "getTypeParameters", "(", "signature", ")", ";", "for", "(", "int", "i", "=", "0", ",", "typeParameterCount", "=", "typeParameterSignatures", ".", "length", ";", "i", "<", "typeParameterCount", ";", "i", "++", ")", "{", "char", "[", "]", "typeParameterSignature", "=", "typeParameterSignatures", "[", "i", "]", ";", "char", "[", "]", "typeParameterName", "=", "Signature", ".", "getTypeVariable", "(", "typeParameterSignature", ")", ";", "CharOperation", ".", "replace", "(", "typeParameterSignature", ",", "'/'", ",", "'.'", ")", ";", "char", "[", "]", "[", "]", "typeParameterBoundSignatures", "=", "Signature", ".", "getTypeParameterBounds", "(", "typeParameterSignature", ")", ";", "int", "boundLength", "=", "typeParameterBoundSignatures", ".", "length", ";", "char", "[", "]", "[", "]", "typeParameterBounds", "=", "new", "char", "[", "boundLength", "]", "[", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "boundLength", ";", "j", "++", ")", "{", "typeParameterBounds", "[", "j", "]", "=", "Signature", ".", "toCharArray", "(", "typeParameterBoundSignatures", "[", "j", "]", ")", ";", "}", "TypeParameter", "typeParameter", "=", "new", "TypeParameter", "(", "parent", ",", "new", "String", "(", "typeParameterName", ")", ")", ";", "TypeParameterElementInfo", "info", "=", "new", "TypeParameterElementInfo", "(", ")", ";", "info", ".", "bounds", "=", "typeParameterBounds", ";", "info", ".", "boundsSignatures", "=", "typeParameterBoundSignatures", ";", "typeParameterHandles", ".", "add", "(", "typeParameter", ")", ";", "while", "(", "newElements", ".", "containsKey", "(", "typeParameter", ")", ")", "typeParameter", ".", "occurrenceCount", "++", ";", "newElements", ".", "put", "(", "typeParameter", ",", "info", ")", ";", "}", "}", "boolean", "hasReadBinaryChildren", "(", ")", "{", "return", "this", ".", "binaryChildren", "!=", "null", ";", "}", "protected", "void", "readBinaryChildren", "(", "ClassFile", "classFile", ",", "HashMap", "newElements", ",", "IBinaryType", "typeInfo", ")", "{", "ArrayList", "childrenHandles", "=", "new", "ArrayList", "(", ")", ";", "BinaryType", "type", "=", "(", "BinaryType", ")", "classFile", ".", "getType", "(", ")", ";", "ArrayList", "typeParameterHandles", "=", "new", "ArrayList", "(", ")", ";", "if", "(", "typeInfo", "!=", "null", ")", "{", "generateAnnotationsInfos", "(", "type", ",", "typeInfo", ".", "getAnnotations", "(", ")", ",", "typeInfo", ".", "getTagBits", "(", ")", ",", "newElements", ")", ";", "generateTypeParameterInfos", "(", "type", ",", "typeInfo", ".", "getGenericSignature", "(", ")", ",", "newElements", ",", "typeParameterHandles", ")", ";", "generateFieldInfos", "(", "type", ",", "typeInfo", ",", "newElements", ",", "childrenHandles", ")", ";", "generateMethodInfos", "(", "type", ",", "typeInfo", ",", "newElements", ",", "childrenHandles", ",", "typeParameterHandles", ")", ";", "generateInnerClassHandles", "(", "type", ",", "typeInfo", ",", "childrenHandles", ")", ";", "}", "this", ".", "binaryChildren", "=", "new", "JavaElement", "[", "childrenHandles", ".", "size", "(", ")", "]", ";", "childrenHandles", ".", "toArray", "(", "this", ".", "binaryChildren", ")", ";", "int", "typeParameterHandleSize", "=", "typeParameterHandles", ".", "size", "(", ")", ";", "if", "(", "typeParameterHandleSize", "==", "0", ")", "{", "this", ".", "typeParameters", "=", "TypeParameter", ".", "NO_TYPE_PARAMETERS", ";", "}", "else", "{", "this", ".", "typeParameters", "=", "new", "ITypeParameter", "[", "typeParameterHandleSize", "]", ";", "typeParameterHandles", ".", "toArray", "(", "this", ".", "typeParameters", ")", ";", "}", "}", "void", "removeBinaryChildren", "(", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "binaryChildren", "!=", "null", ")", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "binaryChildren", ".", "length", ";", "i", "++", ")", "{", "JavaElement", "child", "=", "this", ".", "binaryChildren", "[", "i", "]", ";", "if", "(", "child", "instanceof", "BinaryType", ")", "{", "manager", ".", "removeInfoAndChildren", "(", "(", "JavaElement", ")", "child", ".", "getParent", "(", ")", ")", ";", "}", "else", "{", "manager", ".", "removeInfoAndChildren", "(", "child", ")", ";", "}", "}", "this", ".", "binaryChildren", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "}", "if", "(", "this", ".", "typeParameters", "!=", "null", ")", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "typeParameters", ".", "length", ";", "i", "++", ")", "{", "TypeParameter", "typeParameter", "=", "(", "TypeParameter", ")", "this", ".", "typeParameters", "[", "i", "]", ";", "manager", ".", "removeInfoAndChildren", "(", "typeParameter", ")", ";", "}", "this", ".", "typeParameters", "=", "TypeParameter", ".", "NO_TYPE_PARAMETERS", ";", "}", "}", "}", "</s>" ]
3,727
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "Comparator", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipEntry", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IContainer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "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", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClassFile", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IField", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMember", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragmentRoot", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ISourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeParameter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaConventions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "SourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CategorizedProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "IProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ISourceElementRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Expression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ImportReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "ReferenceInfoAdapter", ";", "public", "class", "SourceMapper", "extends", "ReferenceInfoAdapter", "implements", "ISourceElementRequestor", ",", "SuffixConstants", "{", "public", "static", "class", "LocalVariableElementKey", "{", "String", "parent", ";", "String", "name", ";", "public", "LocalVariableElementKey", "(", "IJavaElement", "method", ",", "String", "name", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "method", ".", "getParent", "(", ")", ".", "getHandleIdentifier", "(", ")", ")", ".", "append", "(", "'#'", ")", ".", "append", "(", "method", ".", "getElementName", "(", ")", ")", ".", "append", "(", "'('", ")", ";", "if", "(", "method", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "METHOD", ")", "{", "String", "[", "]", "parameterTypes", "=", "(", "(", "IMethod", ")", "method", ")", ".", "getParameterTypes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "parameterTypes", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "buffer", ".", "append", "(", "','", ")", ";", "}", "buffer", ".", "append", "(", "Signature", ".", "getSignatureSimpleName", "(", "parameterTypes", "[", "i", "]", ")", ")", ";", "}", "}", "buffer", ".", "append", "(", "')'", ")", ";", "this", ".", "parent", "=", "String", ".", "valueOf", "(", "buffer", ")", ";", "this", ".", "name", "=", "name", ";", "}", "public", "int", "hashCode", "(", ")", "{", "final", "int", "prime", "=", "31", ";", "int", "result", "=", "1", ";", "result", "=", "prime", "*", "result", "+", "(", "(", "this", ".", "name", "==", "null", ")", "?", "0", ":", "this", ".", "name", ".", "hashCode", "(", ")", ")", ";", "result", "=", "prime", "*", "result", "+", "(", "(", "this", ".", "parent", "==", "null", ")", "?", "0", ":", "this", ".", "parent", ".", "hashCode", "(", ")", ")", ";", "return", "result", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "this", "==", "obj", ")", "return", "true", ";", "if", "(", "obj", "==", "null", ")", "return", "false", ";", "if", "(", "getClass", "(", ")", "!=", "obj", ".", "getClass", "(", ")", ")", "return", "false", ";", "LocalVariableElementKey", "other", "=", "(", "LocalVariableElementKey", ")", "obj", ";", "if", "(", "this", ".", "name", "==", "null", ")", "{", "if", "(", "other", ".", "name", "!=", "null", ")", "return", "false", ";", "}", "else", "if", "(", "!", "this", ".", "name", ".", "equals", "(", "other", ".", "name", ")", ")", "return", "false", ";", "if", "(", "this", ".", "parent", "==", "null", ")", "{", "if", "(", "other", ".", "parent", "!=", "null", ")", "return", "false", ";", "}", "else", "if", "(", "!", "this", ".", "parent", ".", "equals", "(", "other", ".", "parent", ")", ")", "return", "false", ";", "return", "true", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "'('", ")", ".", "append", "(", "this", ".", "parent", ")", ".", "append", "(", "'.'", ")", ".", "append", "(", "this", ".", "name", ")", ".", "append", "(", "')'", ")", ";", "return", "String", ".", "valueOf", "(", "buffer", ")", ";", "}", "}", "public", "static", "boolean", "VERBOSE", "=", "false", ";", "protected", "ArrayList", "rootPaths", ";", "protected", "BinaryType", "binaryType", ";", "protected", "IPath", "sourcePath", ";", "protected", "String", "rootPath", "=", "\"\"", ";", "protected", "HashMap", "parameterNames", ";", "protected", "HashMap", "sourceRanges", ";", "protected", "HashMap", "categories", ";", "protected", "HashMap", "parametersRanges", ";", "protected", "HashSet", "finalParameters", ";", "public", "static", "final", "SourceRange", "UNKNOWN_RANGE", "=", "new", "SourceRange", "(", "-", "1", ",", "0", ")", ";", "protected", "int", "[", "]", "memberDeclarationStart", ";", "protected", "SourceRange", "[", "]", "memberNameRange", ";", "protected", "String", "[", "]", "memberName", ";", "protected", "char", "[", "]", "[", "]", "[", "]", "methodParameterNames", ";", "protected", "char", "[", "]", "[", "]", "[", "]", "methodParameterTypes", ";", "protected", "IJavaElement", "searchedElement", ";", "private", "HashMap", "importsTable", ";", "private", "HashMap", "importsCounterTable", ";", "IType", "[", "]", "types", ";", "int", "[", "]", "typeDeclarationStarts", ";", "SourceRange", "[", "]", "typeNameRanges", ";", "int", "[", "]", "typeModifiers", ";", "int", "typeDepth", ";", "int", "anonymousCounter", ";", "int", "anonymousClassName", ";", "String", "encoding", ";", "Map", "options", ";", "private", "boolean", "areRootPathsComputed", ";", "public", "SourceMapper", "(", ")", "{", "this", ".", "areRootPathsComputed", "=", "false", ";", "}", "public", "SourceMapper", "(", "IPath", "sourcePath", ",", "String", "rootPath", ",", "Map", "options", ")", "{", "this", ".", "areRootPathsComputed", "=", "false", ";", "this", ".", "options", "=", "options", ";", "try", "{", "this", ".", "encoding", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getDefaultCharset", "(", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "if", "(", "rootPath", "!=", "null", ")", "{", "this", ".", "rootPaths", "=", "new", "ArrayList", "(", ")", ";", "this", ".", "rootPaths", ".", "add", "(", "rootPath", ")", ";", "}", "this", ".", "sourcePath", "=", "sourcePath", ";", "this", ".", "sourceRanges", "=", "new", "HashMap", "(", ")", ";", "this", ".", "parametersRanges", "=", "new", "HashMap", "(", ")", ";", "this", ".", "parameterNames", "=", "new", "HashMap", "(", ")", ";", "this", ".", "importsTable", "=", "new", "HashMap", "(", ")", ";", "this", ".", "importsCounterTable", "=", "new", "HashMap", "(", ")", ";", "}", "public", "void", "acceptImport", "(", "int", "declarationStart", ",", "int", "declarationEnd", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "[", "]", "tokens", ",", "boolean", "onDemand", ",", "int", "modifiers", ")", "{", "char", "[", "]", "[", "]", "imports", "=", "(", "char", "[", "]", "[", "]", ")", "this", ".", "importsTable", ".", "get", "(", "this", ".", "binaryType", ")", ";", "int", "importsCounter", ";", "if", "(", "imports", "==", "null", ")", "{", "imports", "=", "new", "char", "[", "5", "]", "[", "]", ";", "importsCounter", "=", "0", ";", "}", "else", "{", "importsCounter", "=", "(", "(", "Integer", ")", "this", ".", "importsCounterTable", ".", "get", "(", "this", ".", "binaryType", ")", ")", ".", "intValue", "(", ")", ";", "}", "if", "(", "imports", ".", "length", "==", "importsCounter", ")", "{", "System", ".", "arraycopy", "(", "imports", ",", "0", ",", "(", "imports", "=", "new", "char", "[", "importsCounter", "*", "2", "]", "[", "]", ")", ",", "0", ",", "importsCounter", ")", ";", "}", "char", "[", "]", "name", "=", "CharOperation", ".", "concatWith", "(", "tokens", ",", "'.'", ")", ";", "if", "(", "onDemand", ")", "{", "int", "nameLength", "=", "name", ".", "length", ";", "System", ".", "arraycopy", "(", "name", ",", "0", ",", "(", "name", "=", "new", "char", "[", "nameLength", "+", "2", "]", ")", ",", "0", ",", "nameLength", ")", ";", "name", "[", "nameLength", "]", "=", "'.'", ";", "name", "[", "nameLength", "+", "1", "]", "=", "'*'", ";", "}", "imports", "[", "importsCounter", "++", "]", "=", "name", ";", "this", ".", "importsTable", ".", "put", "(", "this", ".", "binaryType", ",", "imports", ")", ";", "this", ".", "importsCounterTable", ".", "put", "(", "this", ".", "binaryType", ",", "new", "Integer", "(", "importsCounter", ")", ")", ";", "}", "public", "void", "acceptLineSeparatorPositions", "(", "int", "[", "]", "positions", ")", "{", "}", "public", "void", "acceptPackage", "(", "ImportReference", "importReference", ")", "{", "}", "public", "void", "acceptProblem", "(", "CategorizedProblem", "problem", ")", "{", "}", "private", "void", "addCategories", "(", "IJavaElement", "element", ",", "char", "[", "]", "[", "]", "elementCategories", ")", "{", "if", "(", "elementCategories", "==", "null", ")", "return", ";", "if", "(", "this", ".", "categories", "==", "null", ")", "this", ".", "categories", "=", "new", "HashMap", "(", ")", ";", "this", ".", "categories", ".", "put", "(", "element", ",", "CharOperation", ".", "toStrings", "(", "elementCategories", ")", ")", ";", "}", "public", "void", "close", "(", ")", "{", "this", ".", "sourceRanges", "=", "null", ";", "this", ".", "parameterNames", "=", "null", ";", "this", ".", "parametersRanges", "=", "null", ";", "this", ".", "finalParameters", "=", "null", ";", "}", "private", "String", "[", "]", "convertTypeNamesToSigs", "(", "char", "[", "]", "[", "]", "typeNames", ")", "{", "if", "(", "typeNames", "==", "null", ")", "return", "CharOperation", ".", "NO_STRINGS", ";", "int", "n", "=", "typeNames", ".", "length", ";", "if", "(", "n", "==", "0", ")", "return", "CharOperation", ".", "NO_STRINGS", ";", "String", "[", "]", "typeSigs", "=", "new", "String", "[", "n", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "++", "i", ")", "{", "char", "[", "]", "typeSig", "=", "Signature", ".", "createCharArrayTypeSignature", "(", "typeNames", "[", "i", "]", ",", "false", ")", ";", "StringBuffer", "simpleTypeSig", "=", "null", ";", "int", "start", "=", "0", ";", "int", "dot", "=", "-", "1", ";", "int", "length", "=", "typeSig", ".", "length", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length", ";", "j", "++", ")", "{", "switch", "(", "typeSig", "[", "j", "]", ")", "{", "case", "Signature", ".", "C_UNRESOLVED", ":", "if", "(", "simpleTypeSig", "!=", "null", ")", "simpleTypeSig", ".", "append", "(", "typeSig", ",", "start", ",", "j", "-", "start", ")", ";", "start", "=", "j", ";", "break", ";", "case", "Signature", ".", "C_DOT", ":", "dot", "=", "j", ";", "break", ";", "case", "Signature", ".", "C_GENERIC_START", ":", "case", "Signature", ".", "C_NAME_END", ":", "if", "(", "dot", ">", "start", ")", "{", "if", "(", "simpleTypeSig", "==", "null", ")", "simpleTypeSig", "=", "new", "StringBuffer", "(", ")", ".", "append", "(", "typeSig", ",", "0", ",", "start", ")", ";", "simpleTypeSig", ".", "append", "(", "Signature", ".", "C_UNRESOLVED", ")", ";", "simpleTypeSig", ".", "append", "(", "typeSig", ",", "dot", "+", "1", ",", "j", "-", "dot", "-", "1", ")", ";", "start", "=", "j", ";", "}", "break", ";", "}", "}", "if", "(", "simpleTypeSig", "==", "null", ")", "{", "typeSigs", "[", "i", "]", "=", "new", "String", "(", "typeSig", ")", ";", "}", "else", "{", "simpleTypeSig", ".", "append", "(", "typeSig", ",", "start", ",", "length", "-", "start", ")", ";", "typeSigs", "[", "i", "]", "=", "simpleTypeSig", ".", "toString", "(", ")", ";", "}", "}", "return", "typeSigs", ";", "}", "private", "synchronized", "void", "computeAllRootPaths", "(", "IType", "type", ")", "{", "if", "(", "this", ".", "areRootPathsComputed", ")", "{", "return", ";", "}", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "type", ".", "getPackageFragment", "(", ")", ".", "getParent", "(", ")", ";", "IPath", "pkgFragmentRootPath", "=", "root", ".", "getPath", "(", ")", ";", "final", "HashSet", "tempRoots", "=", "new", "HashSet", "(", ")", ";", "long", "time", "=", "0", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "root", ".", "getElementName", "(", ")", ")", ";", "time", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "final", "HashSet", "firstLevelPackageNames", "=", "new", "HashSet", "(", ")", ";", "boolean", "containsADefaultPackage", "=", "false", ";", "boolean", "containsJavaSource", "=", "!", "pkgFragmentRootPath", ".", "equals", "(", "this", ".", "sourcePath", ")", ";", "String", "sourceLevel", "=", "null", ";", "String", "complianceLevel", "=", "null", ";", "if", "(", "root", ".", "isArchive", "(", ")", ")", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "ZipFile", "zip", "=", "null", ";", "try", "{", "zip", "=", "manager", ".", "getZipFile", "(", "pkgFragmentRootPath", ")", ";", "for", "(", "Enumeration", "entries", "=", "zip", ".", "entries", "(", ")", ";", "entries", ".", "hasMoreElements", "(", ")", ";", ")", "{", "ZipEntry", "entry", "=", "(", "ZipEntry", ")", "entries", ".", "nextElement", "(", ")", ";", "String", "entryName", "=", "entry", ".", "getName", "(", ")", ";", "if", "(", "!", "entry", ".", "isDirectory", "(", ")", ")", "{", "if", "(", "Util", ".", "isClassFileName", "(", "entryName", ")", ")", "{", "int", "index", "=", "entryName", ".", "indexOf", "(", "'/'", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "String", "firstLevelPackageName", "=", "entryName", ".", "substring", "(", "0", ",", "index", ")", ";", "if", "(", "!", "firstLevelPackageNames", ".", "contains", "(", "firstLevelPackageName", ")", ")", "{", "if", "(", "sourceLevel", "==", "null", ")", "{", "IJavaProject", "project", "=", "root", ".", "getJavaProject", "(", ")", ";", "sourceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "complianceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "}", "IStatus", "status", "=", "JavaConventions", ".", "validatePackageName", "(", "firstLevelPackageName", ",", "sourceLevel", ",", "complianceLevel", ")", ";", "if", "(", "status", ".", "isOK", "(", ")", "||", "status", ".", "getSeverity", "(", ")", "==", "IStatus", ".", "WARNING", ")", "{", "firstLevelPackageNames", ".", "add", "(", "firstLevelPackageName", ")", ";", "}", "}", "}", "else", "{", "containsADefaultPackage", "=", "true", ";", "}", "}", "else", "if", "(", "!", "containsJavaSource", "&&", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "entryName", ")", ")", "{", "containsJavaSource", "=", "true", ";", "}", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "finally", "{", "manager", ".", "closeZipFile", "(", "zip", ")", ";", "}", "}", "else", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "root", ".", "getPath", "(", ")", ",", "true", ")", ";", "if", "(", "target", "instanceof", "IResource", ")", "{", "IResource", "resource", "=", "(", "IResource", ")", "target", ";", "if", "(", "resource", "instanceof", "IContainer", ")", "{", "try", "{", "IResource", "[", "]", "members", "=", "(", "(", "IContainer", ")", "resource", ")", ".", "members", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "members", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "IResource", "member", "=", "members", "[", "i", "]", ";", "String", "resourceName", "=", "member", ".", "getName", "(", ")", ";", "if", "(", "member", ".", "getType", "(", ")", "==", "IResource", ".", "FOLDER", ")", "{", "if", "(", "sourceLevel", "==", "null", ")", "{", "IJavaProject", "project", "=", "root", ".", "getJavaProject", "(", ")", ";", "sourceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "complianceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "}", "IStatus", "status", "=", "JavaConventions", ".", "validatePackageName", "(", "resourceName", ",", "sourceLevel", ",", "complianceLevel", ")", ";", "if", "(", "status", ".", "isOK", "(", ")", "||", "status", ".", "getSeverity", "(", ")", "==", "IStatus", ".", "WARNING", ")", "{", "firstLevelPackageNames", ".", "add", "(", "resourceName", ")", ";", "}", "}", "else", "if", "(", "Util", ".", "isClassFileName", "(", "resourceName", ")", ")", "{", "containsADefaultPackage", "=", "true", ";", "}", "else", "if", "(", "!", "containsJavaSource", "&&", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "resourceName", ")", ")", "{", "containsJavaSource", "=", "true", ";", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "}", "}", "}", "if", "(", "containsJavaSource", ")", "{", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "this", ".", "sourcePath", ",", "true", ")", ";", "if", "(", "target", "instanceof", "IContainer", ")", "{", "IContainer", "folder", "=", "(", "IContainer", ")", "target", ";", "computeRootPath", "(", "folder", ",", "firstLevelPackageNames", ",", "containsADefaultPackage", ",", "tempRoots", ",", "folder", ".", "getFullPath", "(", ")", ".", "segmentCount", "(", ")", ")", ";", "}", "else", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "ZipFile", "zip", "=", "null", ";", "try", "{", "zip", "=", "manager", ".", "getZipFile", "(", "this", ".", "sourcePath", ")", ";", "for", "(", "Enumeration", "entries", "=", "zip", ".", "entries", "(", ")", ";", "entries", ".", "hasMoreElements", "(", ")", ";", ")", "{", "ZipEntry", "entry", "=", "(", "ZipEntry", ")", "entries", ".", "nextElement", "(", ")", ";", "String", "entryName", ";", "if", "(", "!", "entry", ".", "isDirectory", "(", ")", "&&", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "entryName", "=", "entry", ".", "getName", "(", ")", ")", ")", "{", "IPath", "path", "=", "new", "Path", "(", "entryName", ")", ";", "int", "segmentCount", "=", "path", ".", "segmentCount", "(", ")", ";", "if", "(", "segmentCount", ">", "1", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "path", ".", "segmentCount", "(", ")", "-", "1", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "firstLevelPackageNames", ".", "contains", "(", "path", ".", "segment", "(", "i", ")", ")", ")", "{", "tempRoots", ".", "add", "(", "path", ".", "uptoSegment", "(", "i", ")", ")", ";", "}", "if", "(", "i", "==", "max", "-", "1", "&&", "containsADefaultPackage", ")", "{", "tempRoots", ".", "add", "(", "path", ".", "uptoSegment", "(", "max", ")", ")", ";", "}", "}", "}", "else", "if", "(", "containsADefaultPackage", ")", "{", "tempRoots", ".", "add", "(", "new", "Path", "(", "\"\"", ")", ")", ";", "}", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "finally", "{", "manager", ".", "closeZipFile", "(", "zip", ")", ";", "}", "}", "}", "int", "size", "=", "tempRoots", ".", "size", "(", ")", ";", "if", "(", "this", ".", "rootPaths", "!=", "null", ")", "{", "for", "(", "Iterator", "iterator", "=", "this", ".", "rootPaths", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "tempRoots", ".", "add", "(", "new", "Path", "(", "(", "String", ")", "iterator", ".", "next", "(", ")", ")", ")", ";", "}", "this", ".", "rootPaths", ".", "clear", "(", ")", ";", "}", "else", "{", "this", ".", "rootPaths", "=", "new", "ArrayList", "(", "size", ")", ";", "}", "size", "=", "tempRoots", ".", "size", "(", ")", ";", "if", "(", "size", ">", "0", ")", "{", "ArrayList", "sortedRoots", "=", "new", "ArrayList", "(", "tempRoots", ")", ";", "if", "(", "size", ">", "1", ")", "{", "Collections", ".", "sort", "(", "sortedRoots", ",", "new", "Comparator", "(", ")", "{", "public", "int", "compare", "(", "Object", "o1", ",", "Object", "o2", ")", "{", "IPath", "path1", "=", "(", "IPath", ")", "o1", ";", "IPath", "path2", "=", "(", "IPath", ")", "o2", ";", "return", "path1", ".", "segmentCount", "(", ")", "-", "path2", ".", "segmentCount", "(", ")", ";", "}", "}", ")", ";", "}", "for", "(", "Iterator", "iter", "=", "sortedRoots", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "IPath", "path", "=", "(", "IPath", ")", "iter", ".", "next", "(", ")", ";", "this", ".", "rootPaths", ".", "add", "(", "path", ".", "toString", "(", ")", ")", ";", "}", "}", "this", ".", "areRootPathsComputed", "=", "true", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"Spent", "\"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "time", ")", "+", "\"ms\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Found", "\"", "+", "size", "+", "\"", "root", "paths\"", ")", ";", "int", "i", "=", "0", ";", "for", "(", "Iterator", "iterator", "=", "this", ".", "rootPaths", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "System", ".", "out", ".", "println", "(", "\"root[\"", "+", "i", "+", "\"]=\"", "+", "(", "(", "String", ")", "iterator", ".", "next", "(", ")", ")", ")", ";", "i", "++", ";", "}", "}", "}", "private", "void", "computeRootPath", "(", "IContainer", "container", ",", "HashSet", "firstLevelPackageNames", ",", "boolean", "hasDefaultPackage", ",", "Set", "set", ",", "int", "sourcePathSegmentCount", ")", "{", "try", "{", "IResource", "[", "]", "resources", "=", "container", ".", "members", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "resources", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "IResource", "resource", "=", "resources", "[", "i", "]", ";", "if", "(", "resource", ".", "getType", "(", ")", "==", "IResource", ".", "FOLDER", ")", "{", "if", "(", "firstLevelPackageNames", ".", "contains", "(", "resource", ".", "getName", "(", ")", ")", ")", "{", "IPath", "fullPath", "=", "container", ".", "getFullPath", "(", ")", ";", "IPath", "rootPathEntry", "=", "fullPath", ".", "removeFirstSegments", "(", "sourcePathSegmentCount", ")", ".", "setDevice", "(", "null", ")", ";", "if", "(", "rootPathEntry", ".", "segmentCount", "(", ")", ">=", "1", ")", "{", "set", ".", "add", "(", "rootPathEntry", ")", ";", "}", "computeRootPath", "(", "(", "IFolder", ")", "resource", ",", "firstLevelPackageNames", ",", "hasDefaultPackage", ",", "set", ",", "sourcePathSegmentCount", ")", ";", "}", "else", "{", "computeRootPath", "(", "(", "IFolder", ")", "resource", ",", "firstLevelPackageNames", ",", "hasDefaultPackage", ",", "set", ",", "sourcePathSegmentCount", ")", ";", "}", "}", "if", "(", "i", "==", "max", "-", "1", "&&", "hasDefaultPackage", ")", "{", "boolean", "hasJavaSourceFile", "=", "false", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "max", ";", "j", "++", ")", "{", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "resources", "[", "i", "]", ".", "getName", "(", ")", ")", ")", "{", "hasJavaSourceFile", "=", "true", ";", "break", ";", "}", "}", "if", "(", "hasJavaSourceFile", ")", "{", "IPath", "fullPath", "=", "container", ".", "getFullPath", "(", ")", ";", "IPath", "rootPathEntry", "=", "fullPath", ".", "removeFirstSegments", "(", "sourcePathSegmentCount", ")", ".", "setDevice", "(", "null", ")", ";", "set", ".", "add", "(", "rootPathEntry", ")", ";", "}", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "public", "void", "enterType", "(", "TypeInfo", "typeInfo", ")", "{", "this", ".", "typeDepth", "++", ";", "if", "(", "this", ".", "typeDepth", "==", "this", ".", "types", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "types", ",", "0", ",", "this", ".", "types", "=", "new", "IType", "[", "this", ".", "typeDepth", "*", "2", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "typeNameRanges", ",", "0", ",", "this", ".", "typeNameRanges", "=", "new", "SourceRange", "[", "this", ".", "typeDepth", "*", "2", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "typeDeclarationStarts", ",", "0", ",", "this", ".", "typeDeclarationStarts", "=", "new", "int", "[", "this", ".", "typeDepth", "*", "2", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "memberName", ",", "0", ",", "this", ".", "memberName", "=", "new", "String", "[", "this", ".", "typeDepth", "*", "2", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "memberDeclarationStart", ",", "0", ",", "this", ".", "memberDeclarationStart", "=", "new", "int", "[", "this", ".", "typeDepth", "*", "2", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "memberNameRange", ",", "0", ",", "this", ".", "memberNameRange", "=", "new", "SourceRange", "[", "this", ".", "typeDepth", "*", "2", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "methodParameterTypes", ",", "0", ",", "this", ".", "methodParameterTypes", "=", "new", "char", "[", "this", ".", "typeDepth", "*", "2", "]", "[", "]", "[", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "methodParameterNames", ",", "0", ",", "this", ".", "methodParameterNames", "=", "new", "char", "[", "this", ".", "typeDepth", "*", "2", "]", "[", "]", "[", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "typeModifiers", ",", "0", ",", "this", ".", "typeModifiers", "=", "new", "int", "[", "this", ".", "typeDepth", "*", "2", "]", ",", "0", ",", "this", ".", "typeDepth", ")", ";", "}", "if", "(", "typeInfo", ".", "name", ".", "length", "==", "0", ")", "{", "this", ".", "anonymousCounter", "++", ";", "if", "(", "this", ".", "anonymousCounter", "==", "this", ".", "anonymousClassName", ")", "{", "this", ".", "types", "[", "this", ".", "typeDepth", "]", "=", "getType", "(", "this", ".", "binaryType", ".", "getElementName", "(", ")", ")", ";", "}", "else", "{", "this", ".", "types", "[", "this", ".", "typeDepth", "]", "=", "getType", "(", "new", "String", "(", "typeInfo", ".", "name", ")", ")", ";", "}", "}", "else", "{", "this", ".", "types", "[", "this", ".", "typeDepth", "]", "=", "getType", "(", "new", "String", "(", "typeInfo", ".", "name", ")", ")", ";", "}", "this", ".", "typeNameRanges", "[", "this", ".", "typeDepth", "]", "=", "new", "SourceRange", "(", "typeInfo", ".", "nameSourceStart", ",", "typeInfo", ".", "nameSourceEnd", "-", "typeInfo", ".", "nameSourceStart", "+", "1", ")", ";", "this", ".", "typeDeclarationStarts", "[", "this", ".", "typeDepth", "]", "=", "typeInfo", ".", "declarationStart", ";", "IType", "currentType", "=", "this", ".", "types", "[", "this", ".", "typeDepth", "]", ";", "if", "(", "typeInfo", ".", "typeParameters", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "typeInfo", ".", "typeParameters", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "TypeParameterInfo", "typeParameterInfo", "=", "typeInfo", ".", "typeParameters", "[", "i", "]", ";", "ITypeParameter", "typeParameter", "=", "currentType", ".", "getTypeParameter", "(", "new", "String", "(", "typeParameterInfo", ".", "name", ")", ")", ";", "setSourceRange", "(", "typeParameter", ",", "new", "SourceRange", "(", "typeParameterInfo", ".", "declarationStart", ",", "typeParameterInfo", ".", "declarationEnd", "-", "typeParameterInfo", ".", "declarationStart", "+", "1", ")", ",", "new", "SourceRange", "(", "typeParameterInfo", ".", "nameSourceStart", ",", "typeParameterInfo", ".", "nameSourceEnd", "-", "typeParameterInfo", ".", "nameSourceStart", "+", "1", ")", ")", ";", "}", "}", "this", ".", "typeModifiers", "[", "this", ".", "typeDepth", "]", "=", "typeInfo", ".", "modifiers", ";", "addCategories", "(", "currentType", ",", "typeInfo", ".", "categories", ")", ";", "}", "public", "void", "enterCompilationUnit", "(", ")", "{", "}", "public", "void", "enterConstructor", "(", "MethodInfo", "methodInfo", ")", "{", "enterAbstractMethod", "(", "methodInfo", ")", ";", "}", "public", "void", "enterField", "(", "FieldInfo", "fieldInfo", ")", "{", "if", "(", "this", ".", "typeDepth", ">=", "0", ")", "{", "this", ".", "memberDeclarationStart", "[", "this", ".", "typeDepth", "]", "=", "fieldInfo", ".", "declarationStart", ";", "this", ".", "memberNameRange", "[", "this", ".", "typeDepth", "]", "=", "new", "SourceRange", "(", "fieldInfo", ".", "nameSourceStart", ",", "fieldInfo", ".", "nameSourceEnd", "-", "fieldInfo", ".", "nameSourceStart", "+", "1", ")", ";", "String", "fieldName", "=", "new", "String", "(", "fieldInfo", ".", "name", ")", ";", "this", ".", "memberName", "[", "this", ".", "typeDepth", "]", "=", "fieldName", ";", "IType", "currentType", "=", "this", ".", "types", "[", "this", ".", "typeDepth", "]", ";", "IField", "field", "=", "currentType", ".", "getField", "(", "fieldName", ")", ";", "addCategories", "(", "field", ",", "fieldInfo", ".", "categories", ")", ";", "}", "}", "public", "void", "enterInitializer", "(", "int", "declarationSourceStart", ",", "int", "modifiers", ")", "{", "}", "public", "void", "enterMethod", "(", "MethodInfo", "methodInfo", ")", "{", "enterAbstractMethod", "(", "methodInfo", ")", ";", "}", "private", "void", "enterAbstractMethod", "(", "MethodInfo", "methodInfo", ")", "{", "if", "(", "this", ".", "typeDepth", ">=", "0", ")", "{", "this", ".", "memberName", "[", "this", ".", "typeDepth", "]", "=", "new", "String", "(", "methodInfo", ".", "name", ")", ";", "this", ".", "memberNameRange", "[", "this", ".", "typeDepth", "]", "=", "new", "SourceRange", "(", "methodInfo", ".", "nameSourceStart", ",", "methodInfo", ".", "nameSourceEnd", "-", "methodInfo", ".", "nameSourceStart", "+", "1", ")", ";", "this", ".", "memberDeclarationStart", "[", "this", ".", "typeDepth", "]", "=", "methodInfo", ".", "declarationStart", ";", "IType", "currentType", "=", "this", ".", "types", "[", "this", ".", "typeDepth", "]", ";", "int", "currenTypeModifiers", "=", "this", ".", "typeModifiers", "[", "this", ".", "typeDepth", "]", ";", "char", "[", "]", "[", "]", "parameterTypes", "=", "methodInfo", ".", "parameterTypes", ";", "if", "(", "methodInfo", ".", "isConstructor", "&&", "currentType", ".", "getDeclaringType", "(", ")", "!=", "null", "&&", "!", "Flags", ".", "isStatic", "(", "currenTypeModifiers", ")", ")", "{", "IType", "declaringType", "=", "currentType", ".", "getDeclaringType", "(", ")", ";", "String", "declaringTypeName", "=", "declaringType", ".", "getElementName", "(", ")", ";", "if", "(", "declaringTypeName", ".", "length", "(", ")", "==", "0", ")", "{", "IClassFile", "classFile", "=", "declaringType", ".", "getClassFile", "(", ")", ";", "int", "length", "=", "parameterTypes", "!=", "null", "?", "parameterTypes", ".", "length", ":", "0", ";", "char", "[", "]", "[", "]", "newParameterTypes", "=", "new", "char", "[", "length", "+", "1", "]", "[", "]", ";", "declaringTypeName", "=", "classFile", ".", "getElementName", "(", ")", ";", "declaringTypeName", "=", "declaringTypeName", ".", "substring", "(", "0", ",", "declaringTypeName", ".", "indexOf", "(", "'.'", ")", ")", ";", "newParameterTypes", "[", "0", "]", "=", "declaringTypeName", ".", "toCharArray", "(", ")", ";", "if", "(", "length", "!=", "0", ")", "{", "System", ".", "arraycopy", "(", "parameterTypes", ",", "0", ",", "newParameterTypes", ",", "1", ",", "length", ")", ";", "}", "this", ".", "methodParameterTypes", "[", "this", ".", "typeDepth", "]", "=", "newParameterTypes", ";", "}", "else", "{", "int", "length", "=", "parameterTypes", "!=", "null", "?", "parameterTypes", ".", "length", ":", "0", ";", "char", "[", "]", "[", "]", "newParameterTypes", "=", "new", "char", "[", "length", "+", "1", "]", "[", "]", ";", "newParameterTypes", "[", "0", "]", "=", "declaringTypeName", ".", "toCharArray", "(", ")", ";", "if", "(", "length", "!=", "0", ")", "{", "System", ".", "arraycopy", "(", "parameterTypes", ",", "0", ",", "newParameterTypes", ",", "1", ",", "length", ")", ";", "}", "this", ".", "methodParameterTypes", "[", "this", ".", "typeDepth", "]", "=", "newParameterTypes", ";", "}", "}", "else", "{", "this", ".", "methodParameterTypes", "[", "this", ".", "typeDepth", "]", "=", "parameterTypes", ";", "}", "this", ".", "methodParameterNames", "[", "this", ".", "typeDepth", "]", "=", "methodInfo", ".", "parameterNames", ";", "IMethod", "method", "=", "currentType", ".", "getMethod", "(", "this", ".", "memberName", "[", "this", ".", "typeDepth", "]", ",", "convertTypeNamesToSigs", "(", "this", ".", "methodParameterTypes", "[", "this", ".", "typeDepth", "]", ")", ")", ";", "if", "(", "methodInfo", ".", "typeParameters", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "methodInfo", ".", "typeParameters", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "TypeParameterInfo", "typeParameterInfo", "=", "methodInfo", ".", "typeParameters", "[", "i", "]", ";", "ITypeParameter", "typeParameter", "=", "method", ".", "getTypeParameter", "(", "new", "String", "(", "typeParameterInfo", ".", "name", ")", ")", ";", "setSourceRange", "(", "typeParameter", ",", "new", "SourceRange", "(", "typeParameterInfo", ".", "declarationStart", ",", "typeParameterInfo", ".", "declarationEnd", "-", "typeParameterInfo", ".", "declarationStart", "+", "1", ")", ",", "new", "SourceRange", "(", "typeParameterInfo", ".", "nameSourceStart", ",", "typeParameterInfo", ".", "nameSourceEnd", "-", "typeParameterInfo", ".", "nameSourceStart", "+", "1", ")", ")", ";", "}", "}", "if", "(", "methodInfo", ".", "parameterInfos", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "methodInfo", ".", "parameterInfos", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ParameterInfo", "parameterInfo", "=", "methodInfo", ".", "parameterInfos", "[", "i", "]", ";", "LocalVariableElementKey", "key", "=", "new", "LocalVariableElementKey", "(", "method", ",", "new", "String", "(", "parameterInfo", ".", "name", ")", ")", ";", "SourceRange", "[", "]", "allRanges", "=", "new", "SourceRange", "[", "]", "{", "new", "SourceRange", "(", "parameterInfo", ".", "declarationStart", ",", "parameterInfo", ".", "declarationEnd", "-", "parameterInfo", ".", "declarationStart", "+", "1", ")", ",", "new", "SourceRange", "(", "parameterInfo", ".", "nameSourceStart", ",", "parameterInfo", ".", "nameSourceEnd", "-", "parameterInfo", ".", "nameSourceStart", "+", "1", ")", "}", ";", "this", ".", "parametersRanges", ".", "put", "(", "key", ",", "allRanges", ")", ";", "if", "(", "parameterInfo", ".", "modifiers", "!=", "0", ")", "{", "if", "(", "this", ".", "finalParameters", "==", "null", ")", "{", "this", ".", "finalParameters", "=", "new", "HashSet", "(", ")", ";", "}", "this", ".", "finalParameters", ".", "add", "(", "key", ")", ";", "}", "}", "}", "addCategories", "(", "method", ",", "methodInfo", ".", "categories", ")", ";", "}", "}", "public", "void", "exitType", "(", "int", "declarationEnd", ")", "{", "if", "(", "this", ".", "typeDepth", ">=", "0", ")", "{", "IType", "currentType", "=", "this", ".", "types", "[", "this", ".", "typeDepth", "]", ";", "setSourceRange", "(", "currentType", ",", "new", "SourceRange", "(", "this", ".", "typeDeclarationStarts", "[", "this", ".", "typeDepth", "]", ",", "declarationEnd", "-", "this", ".", "typeDeclarationStarts", "[", "this", ".", "typeDepth", "]", "+", "1", ")", ",", "this", ".", "typeNameRanges", "[", "this", ".", "typeDepth", "]", ")", ";", "this", ".", "typeDepth", "--", ";", "}", "}", "public", "void", "exitCompilationUnit", "(", "int", "declarationEnd", ")", "{", "}", "public", "void", "exitConstructor", "(", "int", "declarationEnd", ")", "{", "exitAbstractMethod", "(", "declarationEnd", ")", ";", "}", "public", "void", "exitField", "(", "int", "initializationStart", ",", "int", "declarationEnd", ",", "int", "declarationSourceEnd", ")", "{", "if", "(", "this", ".", "typeDepth", ">=", "0", ")", "{", "IType", "currentType", "=", "this", ".", "types", "[", "this", ".", "typeDepth", "]", ";", "setSourceRange", "(", "currentType", ".", "getField", "(", "this", ".", "memberName", "[", "this", ".", "typeDepth", "]", ")", ",", "new", "SourceRange", "(", "this", ".", "memberDeclarationStart", "[", "this", ".", "typeDepth", "]", ",", "declarationEnd", "-", "this", ".", "memberDeclarationStart", "[", "this", ".", "typeDepth", "]", "+", "1", ")", ",", "this", ".", "memberNameRange", "[", "this", ".", "typeDepth", "]", ")", ";", "}", "}", "public", "void", "exitInitializer", "(", "int", "declarationEnd", ")", "{", "}", "public", "void", "exitMethod", "(", "int", "declarationEnd", ",", "Expression", "defaultValue", ")", "{", "exitAbstractMethod", "(", "declarationEnd", ")", ";", "}", "private", "void", "exitAbstractMethod", "(", "int", "declarationEnd", ")", "{", "if", "(", "this", ".", "typeDepth", ">=", "0", ")", "{", "IType", "currentType", "=", "this", ".", "types", "[", "this", ".", "typeDepth", "]", ";", "SourceRange", "sourceRange", "=", "new", "SourceRange", "(", "this", ".", "memberDeclarationStart", "[", "this", ".", "typeDepth", "]", ",", "declarationEnd", "-", "this", ".", "memberDeclarationStart", "[", "this", ".", "typeDepth", "]", "+", "1", ")", ";", "IMethod", "method", "=", "currentType", ".", "getMethod", "(", "this", ".", "memberName", "[", "this", ".", "typeDepth", "]", ",", "convertTypeNamesToSigs", "(", "this", ".", "methodParameterTypes", "[", "this", ".", "typeDepth", "]", ")", ")", ";", "setSourceRange", "(", "method", ",", "sourceRange", ",", "this", ".", "memberNameRange", "[", "this", ".", "typeDepth", "]", ")", ";", "setMethodParameterNames", "(", "method", ",", "this", ".", "methodParameterNames", "[", "this", ".", "typeDepth", "]", ")", ";", "}", "}", "public", "char", "[", "]", "findSource", "(", "IType", "type", ",", "IBinaryType", "info", ")", "{", "if", "(", "!", "type", ".", "isBinary", "(", ")", ")", "{", "return", "null", ";", "}", "String", "simpleSourceFileName", "=", "(", "(", "BinaryType", ")", "type", ")", ".", "getSourceFileName", "(", "info", ")", ";", "if", "(", "simpleSourceFileName", "==", "null", ")", "{", "return", "null", ";", "}", "return", "findSource", "(", "type", ",", "simpleSourceFileName", ")", ";", "}", "public", "char", "[", "]", "findSource", "(", "IType", "type", ",", "String", "simpleSourceFileName", ")", "{", "long", "time", "=", "0", ";", "if", "(", "VERBOSE", ")", "{", "time", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "PackageFragment", "pkgFrag", "=", "(", "PackageFragment", ")", "type", ".", "getPackageFragment", "(", ")", ";", "String", "name", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "concatWith", "(", "pkgFrag", ".", "names", ",", "simpleSourceFileName", ",", "'/'", ")", ";", "char", "[", "]", "source", "=", "null", ";", "JavaModelManager", "javaModelManager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "try", "{", "javaModelManager", ".", "cacheZipFiles", "(", "this", ")", ";", "if", "(", "this", ".", "rootPath", "!=", "null", ")", "{", "source", "=", "getSourceForRootPath", "(", "this", ".", "rootPath", ",", "name", ")", ";", "}", "if", "(", "source", "==", "null", ")", "{", "computeAllRootPaths", "(", "type", ")", ";", "if", "(", "this", ".", "rootPaths", "!=", "null", ")", "{", "loop", ":", "for", "(", "Iterator", "iterator", "=", "this", ".", "rootPaths", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "String", "currentRootPath", "=", "(", "String", ")", "iterator", ".", "next", "(", ")", ";", "if", "(", "!", "currentRootPath", ".", "equals", "(", "this", ".", "rootPath", ")", ")", "{", "source", "=", "getSourceForRootPath", "(", "currentRootPath", ",", "name", ")", ";", "if", "(", "source", "!=", "null", ")", "{", "this", ".", "rootPath", "=", "currentRootPath", ";", "break", "loop", ";", "}", "}", "}", "}", "}", "}", "finally", "{", "javaModelManager", ".", "flushZipFiles", "(", "this", ")", ";", "}", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"spent", "\"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "time", ")", "+", "\"ms", "for", "\"", "+", "type", ".", "getElementName", "(", ")", ")", ";", "}", "return", "source", ";", "}", "private", "char", "[", "]", "getSourceForRootPath", "(", "String", "currentRootPath", ",", "String", "name", ")", "{", "String", "newFullName", ";", "if", "(", "!", "currentRootPath", ".", "equals", "(", "IPackageFragmentRoot", ".", "DEFAULT_PACKAGEROOT_PATH", ")", ")", "{", "if", "(", "currentRootPath", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "newFullName", "=", "currentRootPath", "+", "name", ";", "}", "else", "{", "newFullName", "=", "currentRootPath", "+", "'/'", "+", "name", ";", "}", "}", "else", "{", "newFullName", "=", "name", ";", "}", "return", "this", ".", "findSource", "(", "newFullName", ")", ";", "}", "public", "char", "[", "]", "findSource", "(", "String", "fullName", ")", "{", "char", "[", "]", "source", "=", "null", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "this", ".", "sourcePath", ",", "true", ")", ";", "String", "charSet", "=", "null", ";", "if", "(", "target", "instanceof", "IContainer", ")", "{", "IResource", "res", "=", "(", "(", "IContainer", ")", "target", ")", ".", "findMember", "(", "fullName", ")", ";", "if", "(", "res", "instanceof", "IFile", ")", "{", "try", "{", "source", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "getResourceContentsAsCharArray", "(", "(", "IFile", ")", "res", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "else", "{", "try", "{", "if", "(", "target", "instanceof", "IFile", ")", "charSet", "=", "(", "(", "IFile", ")", "target", ")", ".", "getCharset", "(", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "ZipEntry", "entry", "=", "null", ";", "ZipFile", "zip", "=", "null", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "try", "{", "zip", "=", "manager", ".", "getZipFile", "(", "this", ".", "sourcePath", ")", ";", "entry", "=", "zip", ".", "getEntry", "(", "fullName", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "source", "=", "readSource", "(", "entry", ",", "zip", ",", "charSet", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "return", "null", ";", "}", "finally", "{", "manager", ".", "closeZipFile", "(", "zip", ")", ";", "}", "}", "return", "source", ";", "}", "public", "int", "getFlags", "(", "IJavaElement", "element", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "LOCAL_VARIABLE", ":", "LocalVariableElementKey", "key", "=", "new", "LocalVariableElementKey", "(", "element", ".", "getParent", "(", ")", ",", "element", ".", "getElementName", "(", ")", ")", ";", "if", "(", "this", ".", "finalParameters", "!=", "null", "&&", "this", ".", "finalParameters", ".", "contains", "(", "key", ")", ")", "{", "return", "Flags", ".", "AccFinal", ";", "}", "}", "return", "0", ";", "}", "public", "SourceRange", "getNameRange", "(", "IJavaElement", "element", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "METHOD", ":", "if", "(", "(", "(", "IMember", ")", "element", ")", ".", "isBinary", "(", ")", ")", "{", "IJavaElement", "[", "]", "el", "=", "getUnqualifiedMethodHandle", "(", "(", "IMethod", ")", "element", ",", "false", ")", ";", "if", "(", "el", "[", "1", "]", "!=", "null", "&&", "this", ".", "sourceRanges", ".", "get", "(", "el", "[", "0", "]", ")", "==", "null", ")", "{", "element", "=", "getUnqualifiedMethodHandle", "(", "(", "IMethod", ")", "element", ",", "true", ")", "[", "0", "]", ";", "}", "else", "{", "element", "=", "el", "[", "0", "]", ";", "}", "}", "break", ";", "case", "IJavaElement", ".", "TYPE_PARAMETER", ":", "IJavaElement", "parent", "=", "element", ".", "getParent", "(", ")", ";", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "METHOD", ")", "{", "IMethod", "method", "=", "(", "IMethod", ")", "parent", ";", "if", "(", "method", ".", "isBinary", "(", ")", ")", "{", "IJavaElement", "[", "]", "el", "=", "getUnqualifiedMethodHandle", "(", "method", ",", "false", ")", ";", "if", "(", "el", "[", "1", "]", "!=", "null", "&&", "this", ".", "sourceRanges", ".", "get", "(", "el", "[", "0", "]", ")", "==", "null", ")", "{", "method", "=", "(", "IMethod", ")", "getUnqualifiedMethodHandle", "(", "method", ",", "true", ")", "[", "0", "]", ";", "}", "else", "{", "method", "=", "(", "IMethod", ")", "el", "[", "0", "]", ";", "}", "element", "=", "method", ".", "getTypeParameter", "(", "element", ".", "getElementName", "(", ")", ")", ";", "}", "}", "break", ";", "case", "IJavaElement", ".", "LOCAL_VARIABLE", ":", "LocalVariableElementKey", "key", "=", "new", "LocalVariableElementKey", "(", "element", ".", "getParent", "(", ")", ",", "element", ".", "getElementName", "(", ")", ")", ";", "SourceRange", "[", "]", "ranges", "=", "(", "SourceRange", "[", "]", ")", "this", ".", "parametersRanges", ".", "get", "(", "key", ")", ";", "if", "(", "ranges", "==", "null", ")", "{", "return", "UNKNOWN_RANGE", ";", "}", "else", "{", "return", "ranges", "[", "1", "]", ";", "}", "}", "SourceRange", "[", "]", "ranges", "=", "(", "SourceRange", "[", "]", ")", "this", ".", "sourceRanges", ".", "get", "(", "element", ")", ";", "if", "(", "ranges", "==", "null", ")", "{", "return", "UNKNOWN_RANGE", ";", "}", "else", "{", "return", "ranges", "[", "1", "]", ";", "}", "}", "public", "char", "[", "]", "[", "]", "getMethodParameterNames", "(", "IMethod", "method", ")", "{", "if", "(", "method", ".", "isBinary", "(", ")", ")", "{", "IJavaElement", "[", "]", "el", "=", "getUnqualifiedMethodHandle", "(", "method", ",", "false", ")", ";", "if", "(", "el", "[", "1", "]", "!=", "null", "&&", "this", ".", "parameterNames", ".", "get", "(", "el", "[", "0", "]", ")", "==", "null", ")", "{", "method", "=", "(", "IMethod", ")", "getUnqualifiedMethodHandle", "(", "method", ",", "true", ")", "[", "0", "]", ";", "}", "else", "{", "method", "=", "(", "IMethod", ")", "el", "[", "0", "]", ";", "}", "}", "char", "[", "]", "[", "]", "parameters", "=", "(", "char", "[", "]", "[", "]", ")", "this", ".", "parameterNames", ".", "get", "(", "method", ")", ";", "if", "(", "parameters", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "parameters", ";", "}", "}", "public", "SourceRange", "getSourceRange", "(", "IJavaElement", "element", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "METHOD", ":", "if", "(", "(", "(", "IMember", ")", "element", ")", ".", "isBinary", "(", ")", ")", "{", "IJavaElement", "[", "]", "el", "=", "getUnqualifiedMethodHandle", "(", "(", "IMethod", ")", "element", ",", "false", ")", ";", "if", "(", "el", "[", "1", "]", "!=", "null", "&&", "this", ".", "sourceRanges", ".", "get", "(", "el", "[", "0", "]", ")", "==", "null", ")", "{", "element", "=", "getUnqualifiedMethodHandle", "(", "(", "IMethod", ")", "element", ",", "true", ")", "[", "0", "]", ";", "}", "else", "{", "element", "=", "el", "[", "0", "]", ";", "}", "}", "break", ";", "case", "IJavaElement", ".", "TYPE_PARAMETER", ":", "IJavaElement", "parent", "=", "element", ".", "getParent", "(", ")", ";", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "METHOD", ")", "{", "IMethod", "method", "=", "(", "IMethod", ")", "parent", ";", "if", "(", "method", ".", "isBinary", "(", ")", ")", "{", "IJavaElement", "[", "]", "el", "=", "getUnqualifiedMethodHandle", "(", "method", ",", "false", ")", ";", "if", "(", "el", "[", "1", "]", "!=", "null", "&&", "this", ".", "sourceRanges", ".", "get", "(", "el", "[", "0", "]", ")", "==", "null", ")", "{", "method", "=", "(", "IMethod", ")", "getUnqualifiedMethodHandle", "(", "method", ",", "true", ")", "[", "0", "]", ";", "}", "else", "{", "method", "=", "(", "IMethod", ")", "el", "[", "0", "]", ";", "}", "element", "=", "method", ".", "getTypeParameter", "(", "element", ".", "getElementName", "(", ")", ")", ";", "}", "}", "break", ";", "case", "IJavaElement", ".", "LOCAL_VARIABLE", ":", "LocalVariableElementKey", "key", "=", "new", "LocalVariableElementKey", "(", "element", ".", "getParent", "(", ")", ",", "element", ".", "getElementName", "(", ")", ")", ";", "SourceRange", "[", "]", "ranges", "=", "(", "SourceRange", "[", "]", ")", "this", ".", "parametersRanges", ".", "get", "(", "key", ")", ";", "if", "(", "ranges", "==", "null", ")", "{", "return", "UNKNOWN_RANGE", ";", "}", "else", "{", "return", "ranges", "[", "0", "]", ";", "}", "}", "SourceRange", "[", "]", "ranges", "=", "(", "SourceRange", "[", "]", ")", "this", ".", "sourceRanges", ".", "get", "(", "element", ")", ";", "if", "(", "ranges", "==", "null", ")", "{", "return", "UNKNOWN_RANGE", ";", "}", "else", "{", "return", "ranges", "[", "0", "]", ";", "}", "}", "protected", "IType", "getType", "(", "String", "typeName", ")", "{", "if", "(", "typeName", ".", "length", "(", ")", "==", "0", ")", "{", "IJavaElement", "classFile", "=", "this", ".", "binaryType", ".", "getParent", "(", ")", ";", "String", "classFileName", "=", "classFile", ".", "getElementName", "(", ")", ";", "StringBuffer", "newClassFileName", "=", "new", "StringBuffer", "(", ")", ";", "int", "lastDollar", "=", "classFileName", ".", "lastIndexOf", "(", "'$'", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "lastDollar", ";", "i", "++", ")", "newClassFileName", ".", "append", "(", "classFileName", ".", "charAt", "(", "i", ")", ")", ";", "newClassFileName", ".", "append", "(", "Integer", ".", "toString", "(", "this", ".", "anonymousCounter", ")", ")", ";", "PackageFragment", "pkg", "=", "(", "PackageFragment", ")", "classFile", ".", "getParent", "(", ")", ";", "return", "new", "BinaryType", "(", "new", "ClassFile", "(", "pkg", ",", "newClassFileName", ".", "toString", "(", ")", ")", ",", "typeName", ")", ";", "}", "else", "if", "(", "this", ".", "binaryType", ".", "getElementName", "(", ")", ".", "equals", "(", "typeName", ")", ")", "return", "this", ".", "binaryType", ";", "else", "return", "this", ".", "binaryType", ".", "getType", "(", "typeName", ")", ";", "}", "protected", "IJavaElement", "[", "]", "getUnqualifiedMethodHandle", "(", "IMethod", "method", ",", "boolean", "noDollar", ")", "{", "boolean", "hasDollar", "=", "false", ";", "String", "[", "]", "qualifiedParameterTypes", "=", "method", ".", "getParameterTypes", "(", ")", ";", "String", "[", "]", "unqualifiedParameterTypes", "=", "new", "String", "[", "qualifiedParameterTypes", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "qualifiedParameterTypes", ".", "length", ";", "i", "++", ")", "{", "StringBuffer", "unqualifiedTypeSig", "=", "new", "StringBuffer", "(", ")", ";", "getUnqualifiedTypeSignature", "(", "qualifiedParameterTypes", "[", "i", "]", ",", "0", ",", "qualifiedParameterTypes", "[", "i", "]", ".", "length", "(", ")", ",", "unqualifiedTypeSig", ",", "noDollar", ")", ";", "unqualifiedParameterTypes", "[", "i", "]", "=", "unqualifiedTypeSig", ".", "toString", "(", ")", ";", "hasDollar", "|=", "unqualifiedParameterTypes", "[", "i", "]", ".", "lastIndexOf", "(", "'$'", ")", "!=", "-", "1", ";", "}", "IJavaElement", "[", "]", "result", "=", "new", "IJavaElement", "[", "2", "]", ";", "result", "[", "0", "]", "=", "(", "(", "IType", ")", "method", ".", "getParent", "(", ")", ")", ".", "getMethod", "(", "method", ".", "getElementName", "(", ")", ",", "unqualifiedParameterTypes", ")", ";", "if", "(", "hasDollar", ")", "{", "result", "[", "1", "]", "=", "result", "[", "0", "]", ";", "}", "return", "result", ";", "}", "private", "int", "getUnqualifiedTypeSignature", "(", "String", "qualifiedTypeSig", ",", "int", "start", ",", "int", "length", ",", "StringBuffer", "unqualifiedTypeSig", ",", "boolean", "noDollar", ")", "{", "char", "firstChar", "=", "qualifiedTypeSig", ".", "charAt", "(", "start", ")", ";", "int", "end", "=", "start", "+", "1", ";", "boolean", "sigStart", "=", "false", ";", "firstPass", ":", "for", "(", "int", "i", "=", "start", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "current", "=", "qualifiedTypeSig", ".", "charAt", "(", "i", ")", ";", "switch", "(", "current", ")", "{", "case", "Signature", ".", "C_ARRAY", ":", "case", "Signature", ".", "C_SUPER", ":", "case", "Signature", ".", "C_EXTENDS", ":", "unqualifiedTypeSig", ".", "append", "(", "current", ")", ";", "start", "=", "i", "+", "1", ";", "end", "=", "start", "+", "1", ";", "firstChar", "=", "qualifiedTypeSig", ".", "charAt", "(", "start", ")", ";", "break", ";", "case", "Signature", ".", "C_RESOLVED", ":", "case", "Signature", ".", "C_UNRESOLVED", ":", "case", "Signature", ".", "C_TYPE_VARIABLE", ":", "if", "(", "!", "sigStart", ")", "{", "start", "=", "++", "i", ";", "sigStart", "=", "true", ";", "}", "break", ";", "case", "Signature", ".", "C_NAME_END", ":", "case", "Signature", ".", "C_GENERIC_START", ":", "end", "=", "i", ";", "break", "firstPass", ";", "case", "Signature", ".", "C_STAR", ":", "unqualifiedTypeSig", ".", "append", "(", "current", ")", ";", "start", "=", "i", "+", "1", ";", "end", "=", "start", "+", "1", ";", "firstChar", "=", "qualifiedTypeSig", ".", "charAt", "(", "start", ")", ";", "break", ";", "case", "Signature", ".", "C_GENERIC_END", ":", "return", "i", ";", "case", "Signature", ".", "C_DOT", ":", "start", "=", "++", "i", ";", "break", ";", "case", "Signature", ".", "C_BOOLEAN", ":", "case", "Signature", ".", "C_BYTE", ":", "case", "Signature", ".", "C_CHAR", ":", "case", "Signature", ".", "C_DOUBLE", ":", "case", "Signature", ".", "C_FLOAT", ":", "case", "Signature", ".", "C_INT", ":", "case", "Signature", ".", "C_LONG", ":", "case", "Signature", ".", "C_SHORT", ":", "if", "(", "!", "sigStart", ")", "{", "unqualifiedTypeSig", ".", "append", "(", "current", ")", ";", "return", "i", "+", "1", ";", "}", "}", "}", "switch", "(", "firstChar", ")", "{", "case", "Signature", ".", "C_RESOLVED", ":", "case", "Signature", ".", "C_UNRESOLVED", ":", "case", "Signature", ".", "C_TYPE_VARIABLE", ":", "unqualifiedTypeSig", ".", "append", "(", "Signature", ".", "C_UNRESOLVED", ")", ";", "if", "(", "noDollar", ")", "{", "int", "lastDollar", "=", "qualifiedTypeSig", ".", "lastIndexOf", "(", "'$'", ",", "end", ")", ";", "if", "(", "lastDollar", ">", "start", ")", "start", "=", "lastDollar", "+", "1", ";", "}", "for", "(", "int", "i", "=", "start", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "current", "=", "qualifiedTypeSig", ".", "charAt", "(", "i", ")", ";", "switch", "(", "current", ")", "{", "case", "Signature", ".", "C_GENERIC_START", ":", "unqualifiedTypeSig", ".", "append", "(", "current", ")", ";", "i", "++", ";", "do", "{", "i", "=", "getUnqualifiedTypeSignature", "(", "qualifiedTypeSig", ",", "i", ",", "length", ",", "unqualifiedTypeSig", ",", "noDollar", ")", ";", "}", "while", "(", "qualifiedTypeSig", ".", "charAt", "(", "i", ")", "!=", "Signature", ".", "C_GENERIC_END", ")", ";", "unqualifiedTypeSig", ".", "append", "(", "Signature", ".", "C_GENERIC_END", ")", ";", "break", ";", "case", "Signature", ".", "C_NAME_END", ":", "unqualifiedTypeSig", ".", "append", "(", "current", ")", ";", "return", "i", "+", "1", ";", "default", ":", "unqualifiedTypeSig", ".", "append", "(", "current", ")", ";", "break", ";", "}", "}", "return", "length", ";", "default", ":", "unqualifiedTypeSig", ".", "append", "(", "qualifiedTypeSig", ".", "substring", "(", "start", ",", "end", ")", ")", ";", "return", "end", ";", "}", "}", "public", "void", "mapSource", "(", "IType", "type", ",", "char", "[", "]", "contents", ",", "IBinaryType", "info", ")", "{", "this", ".", "mapSource", "(", "type", ",", "contents", ",", "info", ",", "null", ")", ";", "}", "public", "synchronized", "ISourceRange", "mapSource", "(", "IType", "type", ",", "char", "[", "]", "contents", ",", "IBinaryType", "info", ",", "IJavaElement", "elementToFind", ")", "{", "this", ".", "binaryType", "=", "(", "BinaryType", ")", "type", ";", "if", "(", "this", ".", "sourceRanges", ".", "get", "(", "type", ")", "!=", "null", ")", "return", "(", "elementToFind", "!=", "null", ")", "?", "getNameRange", "(", "elementToFind", ")", ":", "null", ";", "this", ".", "importsTable", ".", "remove", "(", "this", ".", "binaryType", ")", ";", "this", ".", "importsCounterTable", ".", "remove", "(", "this", ".", "binaryType", ")", ";", "this", ".", "searchedElement", "=", "elementToFind", ";", "this", ".", "types", "=", "new", "IType", "[", "1", "]", ";", "this", ".", "typeDeclarationStarts", "=", "new", "int", "[", "1", "]", ";", "this", ".", "typeNameRanges", "=", "new", "SourceRange", "[", "1", "]", ";", "this", ".", "typeModifiers", "=", "new", "int", "[", "1", "]", ";", "this", ".", "typeDepth", "=", "-", "1", ";", "this", ".", "memberDeclarationStart", "=", "new", "int", "[", "1", "]", ";", "this", ".", "memberName", "=", "new", "String", "[", "1", "]", ";", "this", ".", "memberNameRange", "=", "new", "SourceRange", "[", "1", "]", ";", "this", ".", "methodParameterTypes", "=", "new", "char", "[", "1", "]", "[", "]", "[", "]", ";", "this", ".", "methodParameterNames", "=", "new", "char", "[", "1", "]", "[", "]", "[", "]", ";", "this", ".", "anonymousCounter", "=", "0", ";", "HashMap", "oldSourceRanges", "=", "null", ";", "if", "(", "elementToFind", "!=", "null", ")", "{", "oldSourceRanges", "=", "(", "HashMap", ")", "this", ".", "sourceRanges", ".", "clone", "(", ")", ";", "}", "try", "{", "IProblemFactory", "factory", "=", "new", "DefaultProblemFactory", "(", ")", ";", "SourceElementParser", "parser", "=", "null", ";", "this", ".", "anonymousClassName", "=", "0", ";", "if", "(", "info", "==", "null", ")", "{", "try", "{", "info", "=", "(", "IBinaryType", ")", "this", ".", "binaryType", ".", "getElementInfo", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "boolean", "isAnonymousClass", "=", "info", ".", "isAnonymous", "(", ")", ";", "char", "[", "]", "fullName", "=", "info", ".", "getName", "(", ")", ";", "if", "(", "isAnonymousClass", ")", "{", "String", "eltName", "=", "this", ".", "binaryType", ".", "getParent", "(", ")", ".", "getElementName", "(", ")", ";", "eltName", "=", "eltName", ".", "substring", "(", "eltName", ".", "lastIndexOf", "(", "'$'", ")", "+", "1", ",", "eltName", ".", "length", "(", ")", ")", ";", "try", "{", "this", ".", "anonymousClassName", "=", "Integer", ".", "parseInt", "(", "eltName", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "}", "}", "boolean", "doFullParse", "=", "hasToRetrieveSourceRangesForLocalClass", "(", "fullName", ")", ";", "parser", "=", "LanguageSupportFactory", ".", "getSourceElementParser", "(", "this", ",", "factory", ",", "new", "CompilerOptions", "(", "this", ".", "options", ")", ",", "doFullParse", ",", "true", ",", "true", ")", ";", "parser", ".", "javadocParser", ".", "checkDocComment", "=", "false", ";", "IJavaElement", "javaElement", "=", "this", ".", "binaryType", ".", "getCompilationUnit", "(", ")", ";", "if", "(", "javaElement", "==", "null", ")", "javaElement", "=", "this", ".", "binaryType", ".", "getParent", "(", ")", ";", "parser", ".", "parseCompilationUnit", "(", "new", "BasicCompilationUnit", "(", "contents", ",", "null", ",", "this", ".", "binaryType", ".", "sourceFileName", "(", "info", ")", ",", "javaElement", ")", ",", "doFullParse", ",", "null", ")", ";", "IProject", "project", "=", "javaElement", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ";", "if", "(", "LanguageSupportFactory", ".", "isInterestingProject", "(", "project", ")", "&&", "LanguageSupportFactory", ".", "isInterestingSourceFile", "(", "this", ".", "binaryType", ".", "getSourceFileName", "(", "info", ")", ")", ")", "{", "LanguageSupportFactory", ".", "filterNonSourceMembers", "(", "this", ".", "binaryType", ")", ";", "}", "if", "(", "elementToFind", "!=", "null", ")", "{", "ISourceRange", "range", "=", "getNameRange", "(", "elementToFind", ")", ";", "return", "range", ";", "}", "else", "{", "return", "null", ";", "}", "}", "finally", "{", "if", "(", "elementToFind", "!=", "null", ")", "{", "this", ".", "sourceRanges", "=", "oldSourceRanges", ";", "}", "this", ".", "binaryType", "=", "null", ";", "this", ".", "searchedElement", "=", "null", ";", "this", ".", "types", "=", "null", ";", "this", ".", "typeDeclarationStarts", "=", "null", ";", "this", ".", "typeNameRanges", "=", "null", ";", "this", ".", "typeDepth", "=", "-", "1", ";", "}", "}", "private", "char", "[", "]", "readSource", "(", "ZipEntry", "entry", ",", "ZipFile", "zip", ",", "String", "charSet", ")", "{", "try", "{", "byte", "[", "]", "bytes", "=", "Util", ".", "getZipEntryByteContent", "(", "entry", ",", "zip", ")", ";", "if", "(", "bytes", "!=", "null", ")", "{", "return", "Util", ".", "bytesToChar", "(", "bytes", ",", "charSet", "==", "null", "?", "this", ".", "encoding", ":", "charSet", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "}", "return", "null", ";", "}", "protected", "void", "setMethodParameterNames", "(", "IMethod", "method", ",", "char", "[", "]", "[", "]", "parameterNames", ")", "{", "if", "(", "parameterNames", "==", "null", ")", "{", "parameterNames", "=", "CharOperation", ".", "NO_CHAR_CHAR", ";", "}", "this", ".", "parameterNames", ".", "put", "(", "method", ",", "parameterNames", ")", ";", "}", "protected", "void", "setSourceRange", "(", "IJavaElement", "element", ",", "SourceRange", "sourceRange", ",", "SourceRange", "nameRange", ")", "{", "this", ".", "sourceRanges", ".", "put", "(", "element", ",", "new", "SourceRange", "[", "]", "{", "sourceRange", ",", "nameRange", "}", ")", ";", "}", "public", "char", "[", "]", "[", "]", "getImports", "(", "BinaryType", "type", ")", "{", "char", "[", "]", "[", "]", "imports", "=", "(", "char", "[", "]", "[", "]", ")", "this", ".", "importsTable", ".", "get", "(", "type", ")", ";", "if", "(", "imports", "!=", "null", ")", "{", "int", "importsCounter", "=", "(", "(", "Integer", ")", "this", ".", "importsCounterTable", ".", "get", "(", "type", ")", ")", ".", "intValue", "(", ")", ";", "if", "(", "imports", ".", "length", "!=", "importsCounter", ")", "{", "System", ".", "arraycopy", "(", "imports", ",", "0", ",", "(", "imports", "=", "new", "char", "[", "importsCounter", "]", "[", "]", ")", ",", "0", ",", "importsCounter", ")", ";", "}", "this", ".", "importsTable", ".", "put", "(", "type", ",", "imports", ")", ";", "}", "return", "imports", ";", "}", "private", "boolean", "hasToRetrieveSourceRangesForLocalClass", "(", "char", "[", "]", "eltName", ")", "{", "if", "(", "eltName", "==", "null", ")", "return", "false", ";", "int", "length", "=", "eltName", ".", "length", ";", "int", "dollarIndex", "=", "CharOperation", ".", "indexOf", "(", "'$'", ",", "eltName", ",", "0", ")", ";", "while", "(", "dollarIndex", "!=", "-", "1", ")", "{", "int", "nameStart", "=", "dollarIndex", "+", "1", ";", "if", "(", "nameStart", "==", "length", ")", "return", "false", ";", "if", "(", "Character", ".", "isDigit", "(", "eltName", "[", "nameStart", "]", ")", ")", "return", "true", ";", "dollarIndex", "=", "CharOperation", ".", "indexOf", "(", "'$'", ",", "eltName", ",", "nameStart", ")", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
3,728
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElementDelta", ";", "public", "class", "SimpleDelta", "{", "protected", "int", "kind", "=", "0", ";", "protected", "int", "changeFlags", "=", "0", ";", "public", "void", "added", "(", ")", "{", "this", ".", "kind", "=", "IJavaElementDelta", ".", "ADDED", ";", "}", "public", "void", "changed", "(", "int", "flags", ")", "{", "this", ".", "kind", "=", "IJavaElementDelta", ".", "CHANGED", ";", "this", ".", "changeFlags", "|=", "flags", ";", "}", "public", "int", "getFlags", "(", ")", "{", "return", "this", ".", "changeFlags", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "this", ".", "kind", ";", "}", "public", "void", "modifiers", "(", ")", "{", "changed", "(", "IJavaElementDelta", ".", "F_MODIFIERS", ")", ";", "}", "public", "void", "removed", "(", ")", "{", "this", ".", "kind", "=", "IJavaElementDelta", ".", "REMOVED", ";", "this", ".", "changeFlags", "=", "0", ";", "}", "public", "void", "superTypes", "(", ")", "{", "changed", "(", "IJavaElementDelta", ".", "F_SUPER_TYPES", ")", ";", "}", "protected", "void", "toDebugString", "(", "StringBuffer", "buffer", ")", "{", "buffer", ".", "append", "(", "\"[\"", ")", ";", "switch", "(", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "buffer", ".", "append", "(", "'+'", ")", ";", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "buffer", ".", "append", "(", "'-'", ")", ";", "break", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "buffer", ".", "append", "(", "'*'", ")", ";", "break", ";", "default", ":", "buffer", ".", "append", "(", "'?'", ")", ";", "break", ";", "}", "buffer", ".", "append", "(", "\"]:", "{\"", ")", ";", "toDebugString", "(", "buffer", ",", "getFlags", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"}\"", ")", ";", "}", "protected", "boolean", "toDebugString", "(", "StringBuffer", "buffer", ",", "int", "flags", ")", "{", "boolean", "prev", "=", "false", ";", "if", "(", "(", "flags", "&", "IJavaElementDelta", ".", "F_MODIFIERS", ")", "!=", "0", ")", "{", "if", "(", "prev", ")", "buffer", ".", "append", "(", "\"", "|", "\"", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "prev", "=", "true", ";", "}", "if", "(", "(", "flags", "&", "IJavaElementDelta", ".", "F_SUPER_TYPES", ")", "!=", "0", ")", "{", "if", "(", "prev", ")", "buffer", ".", "append", "(", "\"", "|", "\"", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "prev", "=", "true", ";", "}", "return", "prev", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "toDebugString", "(", "buffer", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
3,729
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "INameEnvironment", ";", "public", "interface", "INameEnvironmentWithProgress", "extends", "INameEnvironment", "{", "void", "setMonitor", "(", "IProgressMonitor", "monitor", ")", ";", "}", "</s>" ]
3,730
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "eval", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IMarker", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelMarker", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CategorizedProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "eval", ".", "ICodeSnippetRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ClassFile", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "JavaBuilder", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "eval", ".", "IRequestor", ";", "public", "class", "RequestorWrapper", "implements", "IRequestor", "{", "ICodeSnippetRequestor", "requestor", ";", "public", "RequestorWrapper", "(", "ICodeSnippetRequestor", "requestor", ")", "{", "this", ".", "requestor", "=", "requestor", ";", "}", "public", "boolean", "acceptClassFiles", "(", "ClassFile", "[", "]", "classFiles", ",", "char", "[", "]", "codeSnippetClassName", ")", "{", "int", "length", "=", "classFiles", ".", "length", ";", "byte", "[", "]", "[", "]", "classFileBytes", "=", "new", "byte", "[", "length", "]", "[", "]", ";", "String", "[", "]", "[", "]", "compoundNames", "=", "new", "String", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ClassFile", "classFile", "=", "classFiles", "[", "i", "]", ";", "classFileBytes", "[", "i", "]", "=", "classFile", ".", "getBytes", "(", ")", ";", "char", "[", "]", "[", "]", "classFileCompundName", "=", "classFile", ".", "getCompoundName", "(", ")", ";", "int", "length2", "=", "classFileCompundName", ".", "length", ";", "String", "[", "]", "compoundName", "=", "new", "String", "[", "length2", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length2", ";", "j", "++", ")", "{", "compoundName", "[", "j", "]", "=", "new", "String", "(", "classFileCompundName", "[", "j", "]", ")", ";", "}", "compoundNames", "[", "i", "]", "=", "compoundName", ";", "}", "return", "this", ".", "requestor", ".", "acceptClassFiles", "(", "classFileBytes", ",", "compoundNames", ",", "codeSnippetClassName", "==", "null", "?", "null", ":", "new", "String", "(", "codeSnippetClassName", ")", ")", ";", "}", "public", "void", "acceptProblem", "(", "CategorizedProblem", "problem", ",", "char", "[", "]", "fragmentSource", ",", "int", "fragmentKind", ")", "{", "try", "{", "IMarker", "marker", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "createMarker", "(", "IJavaModelMarker", ".", "TRANSIENT_PROBLEM", ")", ";", "marker", ".", "setAttribute", "(", "IJavaModelMarker", ".", "ID", ",", "problem", ".", "getID", "(", ")", ")", ";", "marker", ".", "setAttribute", "(", "IMarker", ".", "CHAR_START", ",", "problem", ".", "getSourceStart", "(", ")", ")", ";", "marker", ".", "setAttribute", "(", "IMarker", ".", "CHAR_END", ",", "problem", ".", "getSourceEnd", "(", ")", "+", "1", ")", ";", "marker", ".", "setAttribute", "(", "IMarker", ".", "LINE_NUMBER", ",", "problem", ".", "getSourceLineNumber", "(", ")", ")", ";", "marker", ".", "setAttribute", "(", "IMarker", ".", "MESSAGE", ",", "problem", ".", "getMessage", "(", ")", ")", ";", "marker", ".", "setAttribute", "(", "IMarker", ".", "SEVERITY", ",", "(", "problem", ".", "isWarning", "(", ")", "?", "IMarker", ".", "SEVERITY_WARNING", ":", "IMarker", ".", "SEVERITY_ERROR", ")", ")", ";", "marker", ".", "setAttribute", "(", "IMarker", ".", "SOURCE_ID", ",", "JavaBuilder", ".", "SOURCE_ID", ")", ";", "this", ".", "requestor", ".", "acceptProblem", "(", "marker", ",", "new", "String", "(", "fragmentSource", ")", ",", "fragmentKind", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "</s>" ]
3,731
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "eval", ";", "import", "java", ".", "util", ".", "Locale", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "eval", ".", "ICodeSnippetRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "eval", ".", "IEvaluationContext", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "eval", ".", "IGlobalVariable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "IProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "INameEnvironment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "NameEnvironment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "ProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "eval", ".", "EvaluationContext", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "eval", ".", "GlobalVariable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "eval", ".", "IRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "eval", ".", "InstallException", ";", "public", "class", "EvaluationContextWrapper", "implements", "IEvaluationContext", "{", "protected", "EvaluationContext", "context", ";", "protected", "JavaProject", "project", ";", "public", "EvaluationContextWrapper", "(", "EvaluationContext", "context", ",", "JavaProject", "project", ")", "{", "this", ".", "context", "=", "context", ";", "this", ".", "project", "=", "project", ";", "}", "public", "IGlobalVariable", "[", "]", "allVariables", "(", ")", "{", "GlobalVariable", "[", "]", "vars", "=", "this", ".", "context", ".", "allVariables", "(", ")", ";", "int", "length", "=", "vars", ".", "length", ";", "GlobalVariableWrapper", "[", "]", "result", "=", "new", "GlobalVariableWrapper", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "new", "GlobalVariableWrapper", "(", "vars", "[", "i", "]", ")", ";", "}", "return", "result", ";", "}", "protected", "void", "checkBuilderState", "(", ")", "{", "return", ";", "}", "public", "void", "codeComplete", "(", "String", "codeSnippet", ",", "int", "position", ",", "ICompletionRequestor", "requestor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "codeSnippet", ",", "position", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "void", "codeComplete", "(", "String", "codeSnippet", ",", "int", "position", ",", "ICompletionRequestor", "requestor", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "if", "(", "requestor", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "}", "codeComplete", "(", "codeSnippet", ",", "position", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "CompletionRequestorWrapper", "(", "requestor", ")", ",", "owner", ")", ";", "}", "public", "void", "codeComplete", "(", "String", "codeSnippet", ",", "int", "position", ",", "CompletionRequestor", "requestor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "codeSnippet", ",", "position", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "void", "codeComplete", "(", "String", "codeSnippet", ",", "int", "position", ",", "CompletionRequestor", "requestor", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "codeSnippet", ",", "position", ",", "requestor", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "null", ")", ";", "}", "public", "void", "codeComplete", "(", "String", "codeSnippet", ",", "int", "position", ",", "CompletionRequestor", "requestor", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "codeComplete", "(", "codeSnippet", ",", "position", ",", "requestor", ",", "owner", ",", "null", ")", ";", "}", "public", "void", "codeComplete", "(", "String", "codeSnippet", ",", "int", "position", ",", "CompletionRequestor", "requestor", ",", "WorkingCopyOwner", "owner", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "SearchableEnvironment", "environment", "=", "this", ".", "project", ".", "newSearchableNameEnvironment", "(", "owner", ")", ";", "this", ".", "context", ".", "complete", "(", "codeSnippet", ".", "toCharArray", "(", ")", ",", "position", ",", "environment", ",", "requestor", ",", "this", ".", "project", ".", "getOptions", "(", "true", ")", ",", "this", ".", "project", ",", "owner", ",", "monitor", ")", ";", "}", "public", "IJavaElement", "[", "]", "codeSelect", "(", "String", "codeSnippet", ",", "int", "offset", ",", "int", "length", ")", "throws", "JavaModelException", "{", "return", "codeSelect", "(", "codeSnippet", ",", "offset", ",", "length", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "}", "public", "IJavaElement", "[", "]", "codeSelect", "(", "String", "codeSnippet", ",", "int", "offset", ",", "int", "length", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "SearchableEnvironment", "environment", "=", "this", ".", "project", ".", "newSearchableNameEnvironment", "(", "owner", ")", ";", "SelectionRequestor", "requestor", "=", "new", "SelectionRequestor", "(", "environment", ".", "nameLookup", ",", "null", ")", ";", "this", ".", "context", ".", "select", "(", "codeSnippet", ".", "toCharArray", "(", ")", ",", "offset", ",", "offset", "+", "length", "-", "1", ",", "environment", ",", "requestor", ",", "this", ".", "project", ".", "getOptions", "(", "true", ")", ",", "owner", ")", ";", "return", "requestor", ".", "getElements", "(", ")", ";", "}", "public", "void", "deleteVariable", "(", "IGlobalVariable", "variable", ")", "{", "if", "(", "variable", "instanceof", "GlobalVariableWrapper", ")", "{", "GlobalVariableWrapper", "wrapper", "=", "(", "GlobalVariableWrapper", ")", "variable", ";", "this", ".", "context", ".", "deleteVariable", "(", "wrapper", ".", "variable", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "}", "public", "void", "evaluateCodeSnippet", "(", "String", "codeSnippet", ",", "String", "[", "]", "localVariableTypeNames", ",", "String", "[", "]", "localVariableNames", ",", "int", "[", "]", "localVariableModifiers", ",", "IType", "declaringType", ",", "boolean", "isStatic", ",", "boolean", "isConstructorCall", ",", "ICodeSnippetRequestor", "requestor", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", "{", "checkBuilderState", "(", ")", ";", "int", "length", "=", "localVariableTypeNames", ".", "length", ";", "char", "[", "]", "[", "]", "varTypeNames", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "varTypeNames", "[", "i", "]", "=", "localVariableTypeNames", "[", "i", "]", ".", "toCharArray", "(", ")", ";", "}", "length", "=", "localVariableNames", ".", "length", ";", "char", "[", "]", "[", "]", "varNames", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "varNames", "[", "i", "]", "=", "localVariableNames", "[", "i", "]", ".", "toCharArray", "(", ")", ";", "}", "Map", "options", "=", "this", ".", "project", ".", "getOptions", "(", "true", ")", ";", "if", "(", "declaringType", "!=", "null", ")", "{", "this", ".", "context", ".", "setPackageName", "(", "declaringType", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "ICompilationUnit", "compilationUnit", "=", "declaringType", ".", "getCompilationUnit", "(", ")", ";", "if", "(", "compilationUnit", "!=", "null", ")", "{", "IImportDeclaration", "[", "]", "imports", "=", "compilationUnit", ".", "getImports", "(", ")", ";", "int", "importsLength", "=", "imports", ".", "length", ";", "if", "(", "importsLength", "!=", "0", ")", "{", "char", "[", "]", "[", "]", "importsNames", "=", "new", "char", "[", "importsLength", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "importsLength", ";", "i", "++", ")", "{", "importsNames", "[", "i", "]", "=", "imports", "[", "i", "]", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "this", ".", "context", ".", "setImports", "(", "importsNames", ")", ";", "options", ".", "put", "(", "CompilerOptions", ".", "OPTION_ReportUnusedImport", ",", "CompilerOptions", ".", "IGNORE", ")", ";", "}", "}", "else", "{", "SourceMapper", "sourceMapper", "=", "(", "(", "ClassFile", ")", "declaringType", ".", "getClassFile", "(", ")", ")", ".", "getSourceMapper", "(", ")", ";", "if", "(", "sourceMapper", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "imports", "=", "sourceMapper", ".", "getImports", "(", "(", "BinaryType", ")", "declaringType", ")", ";", "if", "(", "imports", "!=", "null", ")", "{", "this", ".", "context", ".", "setImports", "(", "imports", ")", ";", "options", ".", "put", "(", "CompilerOptions", ".", "OPTION_ReportUnusedImport", ",", "CompilerOptions", ".", "IGNORE", ")", ";", "}", "}", "}", "}", "INameEnvironment", "environment", "=", "null", ";", "try", "{", "this", ".", "context", ".", "evaluate", "(", "codeSnippet", ".", "toCharArray", "(", ")", ",", "varTypeNames", ",", "varNames", ",", "localVariableModifiers", ",", "declaringType", "==", "null", "?", "null", ":", "declaringType", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ",", "isStatic", ",", "isConstructorCall", ",", "environment", "=", "getBuildNameEnvironment", "(", ")", ",", "options", ",", "getInfrastructureEvaluationRequestor", "(", "requestor", ")", ",", "getProblemFactory", "(", ")", ")", ";", "}", "catch", "(", "InstallException", "e", ")", "{", "handleInstallException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "environment", "!=", "null", ")", "environment", ".", "cleanup", "(", ")", ";", "}", "}", "public", "void", "evaluateCodeSnippet", "(", "String", "codeSnippet", ",", "ICodeSnippetRequestor", "requestor", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "checkBuilderState", "(", ")", ";", "INameEnvironment", "environment", "=", "null", ";", "try", "{", "this", ".", "context", ".", "evaluate", "(", "codeSnippet", ".", "toCharArray", "(", ")", ",", "environment", "=", "getBuildNameEnvironment", "(", ")", ",", "this", ".", "project", ".", "getOptions", "(", "true", ")", ",", "getInfrastructureEvaluationRequestor", "(", "requestor", ")", ",", "getProblemFactory", "(", ")", ")", ";", "}", "catch", "(", "InstallException", "e", ")", "{", "handleInstallException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "environment", "!=", "null", ")", "environment", ".", "cleanup", "(", ")", ";", "}", "}", "public", "void", "evaluateVariable", "(", "IGlobalVariable", "variable", ",", "ICodeSnippetRequestor", "requestor", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "JavaModelException", "{", "checkBuilderState", "(", ")", ";", "INameEnvironment", "environment", "=", "null", ";", "try", "{", "this", ".", "context", ".", "evaluateVariable", "(", "(", "(", "GlobalVariableWrapper", ")", "variable", ")", ".", "variable", ",", "environment", "=", "getBuildNameEnvironment", "(", ")", ",", "this", ".", "project", ".", "getOptions", "(", "true", ")", ",", "getInfrastructureEvaluationRequestor", "(", "requestor", ")", ",", "getProblemFactory", "(", ")", ")", ";", "}", "catch", "(", "InstallException", "e", ")", "{", "handleInstallException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "environment", "!=", "null", ")", "environment", ".", "cleanup", "(", ")", ";", "}", "}", "protected", "INameEnvironment", "getBuildNameEnvironment", "(", ")", "{", "return", "new", "NameEnvironment", "(", "getProject", "(", ")", ")", ";", "}", "public", "char", "[", "]", "getVarClassName", "(", ")", "{", "return", "this", ".", "context", ".", "getVarClassName", "(", ")", ";", "}", "public", "String", "[", "]", "getImports", "(", ")", "{", "char", "[", "]", "[", "]", "imports", "=", "this", ".", "context", ".", "getImports", "(", ")", ";", "int", "length", "=", "imports", ".", "length", ";", "String", "[", "]", "result", "=", "new", "String", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "new", "String", "(", "imports", "[", "i", "]", ")", ";", "}", "return", "result", ";", "}", "public", "EvaluationContext", "getInfrastructureEvaluationContext", "(", ")", "{", "return", "this", ".", "context", ";", "}", "protected", "IRequestor", "getInfrastructureEvaluationRequestor", "(", "ICodeSnippetRequestor", "requestor", ")", "{", "return", "new", "RequestorWrapper", "(", "requestor", ")", ";", "}", "public", "String", "getPackageName", "(", ")", "{", "return", "new", "String", "(", "this", ".", "context", ".", "getPackageName", "(", ")", ")", ";", "}", "protected", "IProblemFactory", "getProblemFactory", "(", ")", "{", "return", "ProblemFactory", ".", "getProblemFactory", "(", "Locale", ".", "getDefault", "(", ")", ")", ";", "}", "public", "IJavaProject", "getProject", "(", ")", "{", "return", "this", ".", "project", ";", "}", "protected", "void", "handleInstallException", "(", "InstallException", "e", ")", "throws", "JavaModelException", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "EVALUATION_ERROR", ",", "e", ".", "toString", "(", ")", ")", ")", ";", "}", "public", "IGlobalVariable", "newVariable", "(", "String", "typeName", ",", "String", "name", ",", "String", "initializer", ")", "{", "GlobalVariable", "newVar", "=", "this", ".", "context", ".", "newVariable", "(", "typeName", ".", "toCharArray", "(", ")", ",", "name", ".", "toCharArray", "(", ")", ",", "(", "initializer", "==", "null", ")", "?", "null", ":", "initializer", ".", "toCharArray", "(", ")", ")", ";", "return", "new", "GlobalVariableWrapper", "(", "newVar", ")", ";", "}", "public", "void", "setImports", "(", "String", "[", "]", "imports", ")", "{", "int", "length", "=", "imports", ".", "length", ";", "char", "[", "]", "[", "]", "result", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "imports", "[", "i", "]", ".", "toCharArray", "(", ")", ";", "}", "this", ".", "context", ".", "setImports", "(", "result", ")", ";", "}", "public", "void", "setPackageName", "(", "String", "packageName", ")", "{", "this", ".", "context", ".", "setPackageName", "(", "packageName", ".", "toCharArray", "(", ")", ")", ";", "}", "public", "void", "validateImports", "(", "ICodeSnippetRequestor", "requestor", ")", "{", "checkBuilderState", "(", ")", ";", "INameEnvironment", "environment", "=", "null", ";", "try", "{", "this", ".", "context", ".", "evaluateImports", "(", "environment", "=", "getBuildNameEnvironment", "(", ")", ",", "getInfrastructureEvaluationRequestor", "(", "requestor", ")", ",", "getProblemFactory", "(", ")", ")", ";", "}", "finally", "{", "if", "(", "environment", "!=", "null", ")", "environment", ".", "cleanup", "(", ")", ";", "}", "}", "public", "void", "codeComplete", "(", "String", "codeSnippet", ",", "int", "position", ",", "final", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICodeCompletionRequestor", "requestor", ")", "throws", "JavaModelException", "{", "if", "(", "requestor", "==", "null", ")", "{", "codeComplete", "(", "codeSnippet", ",", "position", ",", "(", "ICompletionRequestor", ")", "null", ")", ";", "return", ";", "}", "codeComplete", "(", "codeSnippet", ",", "position", ",", "new", "ICompletionRequestor", "(", ")", "{", "public", "void", "acceptAnonymousType", "(", "char", "[", "]", "superTypePackageName", ",", "char", "[", "]", "superTypeName", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "}", "public", "void", "acceptClass", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "className", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptClass", "(", "packageName", ",", "className", ",", "completionName", ",", "modifiers", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptError", "(", "IProblem", "error", ")", "{", "}", "public", "void", "acceptField", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "name", ",", "char", "[", "]", "typePackageName", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptField", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "name", ",", "typePackageName", ",", "typeName", ",", "completionName", ",", "modifiers", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptInterface", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "interfaceName", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptInterface", "(", "packageName", ",", "interfaceName", ",", "completionName", ",", "modifiers", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptKeyword", "(", "char", "[", "]", "keywordName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptKeyword", "(", "keywordName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptLabel", "(", "char", "[", "]", "labelName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptLabel", "(", "labelName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptLocalVariable", "(", "char", "[", "]", "name", ",", "char", "[", "]", "typePackageName", ",", "char", "[", "]", "typeName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "}", "public", "void", "acceptMethod", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "char", "[", "]", "returnTypePackageName", ",", "char", "[", "]", "returnTypeName", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptMethod", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "selector", ",", "parameterPackageNames", ",", "parameterTypeNames", ",", "returnTypePackageName", ",", "returnTypeName", ",", "completionName", ",", "modifiers", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptMethodDeclaration", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "char", "[", "]", "returnTypePackageName", ",", "char", "[", "]", "returnTypeName", ",", "char", "[", "]", "completionName", ",", "int", "modifiers", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "}", "public", "void", "acceptModifier", "(", "char", "[", "]", "modifierName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptModifier", "(", "modifierName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptPackage", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "completionName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptPackage", "(", "packageName", ",", "completionName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptType", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "completionName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "requestor", ".", "acceptType", "(", "packageName", ",", "typeName", ",", "completionName", ",", "completionStart", ",", "completionEnd", ")", ";", "}", "public", "void", "acceptVariableName", "(", "char", "[", "]", "typePackageName", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "name", ",", "char", "[", "]", "completionName", ",", "int", "completionStart", ",", "int", "completionEnd", ",", "int", "relevance", ")", "{", "}", "}", ")", ";", "}", "}", "</s>" ]
3,732
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "eval", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "eval", ".", "IGlobalVariable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "eval", ".", "GlobalVariable", ";", "class", "GlobalVariableWrapper", "implements", "IGlobalVariable", "{", "GlobalVariable", "variable", ";", "GlobalVariableWrapper", "(", "GlobalVariable", "variable", ")", "{", "this", ".", "variable", "=", "variable", ";", "}", "public", "String", "getInitializer", "(", ")", "{", "char", "[", "]", "initializer", "=", "this", ".", "variable", ".", "getInitializer", "(", ")", ";", "if", "(", "initializer", "!=", "null", ")", "{", "return", "new", "String", "(", "initializer", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "public", "String", "getName", "(", ")", "{", "return", "new", "String", "(", "this", ".", "variable", ".", "getName", "(", ")", ")", ";", "}", "public", "String", "getTypeName", "(", ")", "{", "return", "new", "String", "(", "this", ".", "variable", ".", "getTypeName", "(", ")", ")", ";", "}", "}", "</s>" ]
3,733
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IContainer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HashSetOfArray", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HashtableOfArrayToObject", ";", "class", "JavaProjectElementInfo", "extends", "OpenableElementInfo", "{", "static", "final", "IPackageFragmentRoot", "[", "]", "NO_ROOTS", "=", "new", "IPackageFragmentRoot", "[", "0", "]", ";", "static", "class", "ProjectCache", "{", "ProjectCache", "(", "IPackageFragmentRoot", "[", "]", "allPkgFragmentRootsCache", ",", "Map", "rootToResolvedEntries", ",", "Map", "pkgFragmentsCaches", ")", "{", "this", ".", "allPkgFragmentRootsCache", "=", "allPkgFragmentRootsCache", ";", "this", ".", "rootToResolvedEntries", "=", "rootToResolvedEntries", ";", "this", ".", "pkgFragmentsCaches", "=", "pkgFragmentsCaches", ";", "}", "public", "IPackageFragmentRoot", "[", "]", "allPkgFragmentRootsCache", ";", "public", "HashtableOfArrayToObject", "allPkgFragmentsCache", ";", "public", "Map", "pkgFragmentsCaches", ";", "public", "Map", "rootToResolvedEntries", ";", "}", "private", "Object", "[", "]", "nonJavaResources", ";", "ProjectCache", "projectCache", ";", "static", "void", "addSuperPackageNames", "(", "String", "[", "]", "pkgName", ",", "HashtableOfArrayToObject", "packageFragments", ")", "{", "for", "(", "int", "i", "=", "pkgName", ".", "length", "-", "1", ";", "i", ">", "0", ";", "i", "--", ")", "{", "if", "(", "packageFragments", ".", "getKey", "(", "pkgName", ",", "i", ")", "==", "null", ")", "{", "System", ".", "arraycopy", "(", "pkgName", ",", "0", ",", "pkgName", "=", "new", "String", "[", "i", "]", ",", "0", ",", "i", ")", ";", "packageFragments", ".", "put", "(", "pkgName", ",", "NO_ROOTS", ")", ";", "}", "}", "}", "public", "JavaProjectElementInfo", "(", ")", "{", "this", ".", "nonJavaResources", "=", "null", ";", "}", "private", "Object", "[", "]", "computeNonJavaResources", "(", "JavaProject", "project", ")", "{", "IPath", "projectPath", "=", "project", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ";", "boolean", "srcIsProject", "=", "false", ";", "boolean", "binIsProject", "=", "false", ";", "char", "[", "]", "[", "]", "inclusionPatterns", "=", "null", ";", "char", "[", "]", "[", "]", "exclusionPatterns", "=", "null", ";", "IPath", "projectOutput", "=", "null", ";", "boolean", "isClasspathResolved", "=", "true", ";", "try", "{", "IClasspathEntry", "entry", "=", "project", ".", "getClasspathEntryFor", "(", "projectPath", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "srcIsProject", "=", "true", ";", "inclusionPatterns", "=", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullInclusionPatternChars", "(", ")", ";", "exclusionPatterns", "=", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullExclusionPatternChars", "(", ")", ";", "}", "projectOutput", "=", "project", ".", "getOutputLocation", "(", ")", ";", "binIsProject", "=", "projectPath", ".", "equals", "(", "projectOutput", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "isClasspathResolved", "=", "false", ";", "}", "Object", "[", "]", "resources", "=", "new", "IResource", "[", "5", "]", ";", "int", "resourcesCounter", "=", "0", ";", "try", "{", "IResource", "[", "]", "members", "=", "(", "(", "IContainer", ")", "project", ".", "getResource", "(", ")", ")", ".", "members", "(", ")", ";", "int", "length", "=", "members", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "String", "sourceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "String", "complianceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "IClasspathEntry", "[", "]", "classpath", "=", "project", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IResource", "res", "=", "members", "[", "i", "]", ";", "switch", "(", "res", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "FILE", ":", "IPath", "resFullPath", "=", "res", ".", "getFullPath", "(", ")", ";", "String", "resName", "=", "res", ".", "getName", "(", ")", ";", "if", "(", "isClasspathResolved", "&&", "isClasspathEntryOrOutputLocation", "(", "resFullPath", ",", "res", ".", "getLocation", "(", ")", ",", "classpath", ",", "projectOutput", ")", ")", "{", "break", ";", "}", "if", "(", "srcIsProject", "&&", "Util", ".", "isValidCompilationUnitName", "(", "resName", ",", "sourceLevel", ",", "complianceLevel", ")", "&&", "!", "Util", ".", "isExcluded", "(", "res", ",", "inclusionPatterns", ",", "exclusionPatterns", ")", ")", "{", "break", ";", "}", "if", "(", "binIsProject", "&&", "Util", ".", "isValidClassFileName", "(", "resName", ",", "sourceLevel", ",", "complianceLevel", ")", ")", "{", "break", ";", "}", "if", "(", "resources", ".", "length", "==", "resourcesCounter", ")", "{", "System", ".", "arraycopy", "(", "resources", ",", "0", ",", "(", "resources", "=", "new", "IResource", "[", "resourcesCounter", "*", "2", "]", ")", ",", "0", ",", "resourcesCounter", ")", ";", "}", "resources", "[", "resourcesCounter", "++", "]", "=", "res", ";", "break", ";", "case", "IResource", ".", "FOLDER", ":", "resFullPath", "=", "res", ".", "getFullPath", "(", ")", ";", "if", "(", "(", "srcIsProject", "&&", "!", "Util", ".", "isExcluded", "(", "res", ",", "inclusionPatterns", ",", "exclusionPatterns", ")", "&&", "Util", ".", "isValidFolderNameForPackage", "(", "res", ".", "getName", "(", ")", ",", "sourceLevel", ",", "complianceLevel", ")", ")", "||", "(", "isClasspathResolved", "&&", "isClasspathEntryOrOutputLocation", "(", "resFullPath", ",", "res", ".", "getLocation", "(", ")", ",", "classpath", ",", "projectOutput", ")", ")", ")", "{", "break", ";", "}", "if", "(", "resources", ".", "length", "==", "resourcesCounter", ")", "{", "System", ".", "arraycopy", "(", "resources", ",", "0", ",", "(", "resources", "=", "new", "IResource", "[", "resourcesCounter", "*", "2", "]", ")", ",", "0", ",", "resourcesCounter", ")", ";", "}", "resources", "[", "resourcesCounter", "++", "]", "=", "res", ";", "}", "}", "}", "if", "(", "resources", ".", "length", "!=", "resourcesCounter", ")", "{", "System", ".", "arraycopy", "(", "resources", ",", "0", ",", "(", "resources", "=", "new", "IResource", "[", "resourcesCounter", "]", ")", ",", "0", ",", "resourcesCounter", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "resources", "=", "NO_NON_JAVA_RESOURCES", ";", "resourcesCounter", "=", "0", ";", "}", "return", "resources", ";", "}", "ProjectCache", "getProjectCache", "(", "JavaProject", "project", ")", "{", "ProjectCache", "cache", "=", "this", ".", "projectCache", ";", "if", "(", "cache", "==", "null", ")", "{", "IPackageFragmentRoot", "[", "]", "roots", ";", "Map", "reverseMap", "=", "new", "HashMap", "(", "3", ")", ";", "try", "{", "roots", "=", "project", ".", "getAllPackageFragmentRoots", "(", "reverseMap", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "roots", "=", "new", "IPackageFragmentRoot", "[", "0", "]", ";", "reverseMap", ".", "clear", "(", ")", ";", "}", "HashMap", "rootInfos", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "deltaState", ".", "roots", ";", "HashMap", "pkgFragmentsCaches", "=", "new", "HashMap", "(", ")", ";", "int", "length", "=", "roots", ".", "length", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IPackageFragmentRoot", "root", "=", "roots", "[", "i", "]", ";", "DeltaProcessor", ".", "RootInfo", "rootInfo", "=", "(", "DeltaProcessor", ".", "RootInfo", ")", "rootInfos", ".", "get", "(", "root", ".", "getPath", "(", ")", ")", ";", "if", "(", "rootInfo", "==", "null", "||", "rootInfo", ".", "project", ".", "equals", "(", "project", ")", ")", "{", "roots", "[", "i", "]", "=", "root", "=", "(", "IPackageFragmentRoot", ")", "manager", ".", "getExistingElement", "(", "root", ")", ";", "HashSetOfArray", "fragmentsCache", "=", "new", "HashSetOfArray", "(", ")", ";", "initializePackageNames", "(", "root", ",", "fragmentsCache", ")", ";", "pkgFragmentsCaches", ".", "put", "(", "root", ",", "fragmentsCache", ")", ";", "}", "}", "cache", "=", "new", "ProjectCache", "(", "roots", ",", "reverseMap", ",", "pkgFragmentsCaches", ")", ";", "this", ".", "projectCache", "=", "cache", ";", "}", "return", "cache", ";", "}", "Object", "[", "]", "getNonJavaResources", "(", "JavaProject", "project", ")", "{", "if", "(", "this", ".", "nonJavaResources", "==", "null", ")", "{", "this", ".", "nonJavaResources", "=", "computeNonJavaResources", "(", "project", ")", ";", "}", "return", "this", ".", "nonJavaResources", ";", "}", "private", "void", "initializePackageNames", "(", "IPackageFragmentRoot", "root", ",", "HashSetOfArray", "fragmentsCache", ")", "{", "IJavaElement", "[", "]", "frags", "=", "null", ";", "try", "{", "if", "(", "!", "root", ".", "isOpen", "(", ")", ")", "{", "PackageFragmentRootInfo", "info", "=", "root", ".", "isArchive", "(", ")", "?", "new", "JarPackageFragmentRootInfo", "(", ")", ":", "new", "PackageFragmentRootInfo", "(", ")", ";", "(", "(", "PackageFragmentRoot", ")", "root", ")", ".", "computeChildren", "(", "info", ",", "(", "(", "JavaElement", ")", "root", ")", ".", "resource", "(", ")", ")", ";", "frags", "=", "info", ".", "children", ";", "}", "else", "frags", "=", "root", ".", "getChildren", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", ";", "}", "for", "(", "int", "j", "=", "0", ",", "length", "=", "frags", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "fragmentsCache", ".", "add", "(", "(", "(", "PackageFragment", ")", "frags", "[", "j", "]", ")", ".", "names", ")", ";", "}", "}", "private", "boolean", "isClasspathEntryOrOutputLocation", "(", "IPath", "path", ",", "IPath", "location", ",", "IClasspathEntry", "[", "]", "resolvedClasspath", ",", "IPath", "projectOutput", ")", "{", "if", "(", "projectOutput", ".", "equals", "(", "path", ")", ")", "return", "true", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "resolvedClasspath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "resolvedClasspath", "[", "i", "]", ";", "IPath", "entryPath", ";", "if", "(", "(", "entryPath", "=", "entry", ".", "getPath", "(", ")", ")", ".", "equals", "(", "path", ")", "||", "entryPath", ".", "equals", "(", "location", ")", ")", "{", "return", "true", ";", "}", "IPath", "output", ";", "if", "(", "(", "output", "=", "entry", ".", "getOutputLocation", "(", ")", ")", "!=", "null", "&&", "output", ".", "equals", "(", "path", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "NameLookup", "newNameLookup", "(", "JavaProject", "project", ",", "ICompilationUnit", "[", "]", "workingCopies", ")", "{", "ProjectCache", "cache", "=", "getProjectCache", "(", "project", ")", ";", "HashtableOfArrayToObject", "allPkgFragmentsCache", "=", "cache", ".", "allPkgFragmentsCache", ";", "if", "(", "allPkgFragmentsCache", "==", "null", ")", "{", "HashMap", "rootInfos", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "deltaState", ".", "roots", ";", "IPackageFragmentRoot", "[", "]", "allRoots", "=", "cache", ".", "allPkgFragmentRootsCache", ";", "int", "length", "=", "allRoots", ".", "length", ";", "allPkgFragmentsCache", "=", "new", "HashtableOfArrayToObject", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IPackageFragmentRoot", "root", "=", "allRoots", "[", "i", "]", ";", "DeltaProcessor", ".", "RootInfo", "rootInfo", "=", "(", "DeltaProcessor", ".", "RootInfo", ")", "rootInfos", ".", "get", "(", "root", ".", "getPath", "(", ")", ")", ";", "JavaProject", "rootProject", "=", "rootInfo", "==", "null", "?", "project", ":", "rootInfo", ".", "project", ";", "HashSetOfArray", "fragmentsCache", ";", "if", "(", "rootProject", ".", "equals", "(", "project", ")", ")", "{", "fragmentsCache", "=", "(", "HashSetOfArray", ")", "cache", ".", "pkgFragmentsCaches", ".", "get", "(", "root", ")", ";", "}", "else", "{", "ProjectCache", "rootProjectCache", ";", "try", "{", "rootProjectCache", "=", "rootProject", ".", "getProjectCache", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "continue", ";", "}", "fragmentsCache", "=", "(", "HashSetOfArray", ")", "rootProjectCache", ".", "pkgFragmentsCaches", ".", "get", "(", "root", ")", ";", "}", "if", "(", "fragmentsCache", "==", "null", ")", "{", "fragmentsCache", "=", "new", "HashSetOfArray", "(", ")", ";", "initializePackageNames", "(", "root", ",", "fragmentsCache", ")", ";", "}", "Object", "[", "]", "[", "]", "set", "=", "fragmentsCache", ".", "set", ";", "for", "(", "int", "j", "=", "0", ",", "length2", "=", "set", ".", "length", ";", "j", "<", "length2", ";", "j", "++", ")", "{", "String", "[", "]", "pkgName", "=", "(", "String", "[", "]", ")", "set", "[", "j", "]", ";", "if", "(", "pkgName", "==", "null", ")", "continue", ";", "Object", "existing", "=", "allPkgFragmentsCache", ".", "get", "(", "pkgName", ")", ";", "if", "(", "existing", "==", "null", "||", "existing", "==", "NO_ROOTS", ")", "{", "allPkgFragmentsCache", ".", "put", "(", "pkgName", ",", "root", ")", ";", "addSuperPackageNames", "(", "pkgName", ",", "allPkgFragmentsCache", ")", ";", "}", "else", "{", "if", "(", "existing", "instanceof", "PackageFragmentRoot", ")", "{", "allPkgFragmentsCache", ".", "put", "(", "pkgName", ",", "new", "IPackageFragmentRoot", "[", "]", "{", "(", "PackageFragmentRoot", ")", "existing", ",", "root", "}", ")", ";", "}", "else", "{", "IPackageFragmentRoot", "[", "]", "roots", "=", "(", "IPackageFragmentRoot", "[", "]", ")", "existing", ";", "int", "rootLength", "=", "roots", ".", "length", ";", "System", ".", "arraycopy", "(", "roots", ",", "0", ",", "roots", "=", "new", "IPackageFragmentRoot", "[", "rootLength", "+", "1", "]", ",", "0", ",", "rootLength", ")", ";", "roots", "[", "rootLength", "]", "=", "root", ";", "allPkgFragmentsCache", ".", "put", "(", "pkgName", ",", "roots", ")", ";", "}", "}", "}", "}", "cache", ".", "allPkgFragmentsCache", "=", "allPkgFragmentsCache", ";", "}", "return", "new", "NameLookup", "(", "cache", ".", "allPkgFragmentRootsCache", ",", "cache", ".", "allPkgFragmentsCache", ",", "workingCopies", ",", "cache", ".", "rootToResolvedEntries", ")", ";", "}", "void", "resetCaches", "(", ")", "{", "this", ".", "projectCache", "=", "null", ";", "}", "void", "setNonJavaResources", "(", "Object", "[", "]", "resources", ")", "{", "this", ".", "nonJavaResources", "=", "resources", ";", "}", "}", "</s>" ]
3,734
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "java", ".", "util", ".", "*", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElementDelta", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SimpleDelta", ";", "public", "class", "ChangeCollector", "{", "HashMap", "changes", "=", "new", "HashMap", "(", ")", ";", "TypeHierarchy", "hierarchy", ";", "public", "ChangeCollector", "(", "TypeHierarchy", "hierarchy", ")", "{", "this", ".", "hierarchy", "=", "hierarchy", ";", "}", "private", "void", "addAffectedChildren", "(", "IJavaElementDelta", "delta", ")", "throws", "JavaModelException", "{", "IJavaElementDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElementDelta", "child", "=", "children", "[", "i", "]", ";", "IJavaElement", "childElement", "=", "child", ".", "getElement", "(", ")", ";", "switch", "(", "childElement", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "IMPORT_CONTAINER", ":", "addChange", "(", "(", "IImportContainer", ")", "childElement", ",", "child", ")", ";", "break", ";", "case", "IJavaElement", ".", "IMPORT_DECLARATION", ":", "addChange", "(", "(", "IImportDeclaration", ")", "childElement", ",", "child", ")", ";", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "addChange", "(", "(", "IType", ")", "childElement", ",", "child", ")", ";", "break", ";", "case", "IJavaElement", ".", "INITIALIZER", ":", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "METHOD", ":", "addChange", "(", "(", "IMember", ")", "childElement", ",", "child", ")", ";", "break", ";", "}", "}", "}", "public", "void", "addChange", "(", "ICompilationUnit", "cu", ",", "IJavaElementDelta", "newDelta", ")", "throws", "JavaModelException", "{", "int", "newKind", "=", "newDelta", ".", "getKind", "(", ")", ";", "switch", "(", "newKind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "ArrayList", "allTypes", "=", "new", "ArrayList", "(", ")", ";", "getAllTypesFromElement", "(", "cu", ",", "allTypes", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "allTypes", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "(", "IType", ")", "allTypes", ".", "get", "(", "i", ")", ";", "addTypeAddition", "(", "type", ",", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "type", ")", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "allTypes", "=", "new", "ArrayList", "(", ")", ";", "getAllTypesFromHierarchy", "(", "(", "JavaElement", ")", "cu", ",", "allTypes", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "allTypes", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "(", "IType", ")", "allTypes", ".", "get", "(", "i", ")", ";", "addTypeRemoval", "(", "type", ",", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "type", ")", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "addAffectedChildren", "(", "newDelta", ")", ";", "break", ";", "}", "}", "private", "void", "addChange", "(", "IImportContainer", "importContainer", ",", "IJavaElementDelta", "newDelta", ")", "throws", "JavaModelException", "{", "int", "newKind", "=", "newDelta", ".", "getKind", "(", ")", ";", "if", "(", "newKind", "==", "IJavaElementDelta", ".", "CHANGED", ")", "{", "addAffectedChildren", "(", "newDelta", ")", ";", "return", ";", "}", "SimpleDelta", "existingDelta", "=", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "importContainer", ")", ";", "if", "(", "existingDelta", "!=", "null", ")", "{", "switch", "(", "newKind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "if", "(", "existingDelta", ".", "getKind", "(", ")", "==", "IJavaElementDelta", ".", "REMOVED", ")", "{", "this", ".", "changes", ".", "remove", "(", "importContainer", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "if", "(", "existingDelta", ".", "getKind", "(", ")", "==", "IJavaElementDelta", ".", "ADDED", ")", "{", "this", ".", "changes", ".", "remove", "(", "importContainer", ")", ";", "}", "break", ";", "}", "}", "else", "{", "SimpleDelta", "delta", "=", "new", "SimpleDelta", "(", ")", ";", "switch", "(", "newKind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "delta", ".", "added", "(", ")", ";", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "delta", ".", "removed", "(", ")", ";", "break", ";", "}", "this", ".", "changes", ".", "put", "(", "importContainer", ",", "delta", ")", ";", "}", "}", "private", "void", "addChange", "(", "IImportDeclaration", "importDecl", ",", "IJavaElementDelta", "newDelta", ")", "{", "SimpleDelta", "existingDelta", "=", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "importDecl", ")", ";", "int", "newKind", "=", "newDelta", ".", "getKind", "(", ")", ";", "if", "(", "existingDelta", "!=", "null", ")", "{", "switch", "(", "newKind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "if", "(", "existingDelta", ".", "getKind", "(", ")", "==", "IJavaElementDelta", ".", "REMOVED", ")", "{", "this", ".", "changes", ".", "remove", "(", "importDecl", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "if", "(", "existingDelta", ".", "getKind", "(", ")", "==", "IJavaElementDelta", ".", "ADDED", ")", "{", "this", ".", "changes", ".", "remove", "(", "importDecl", ")", ";", "}", "break", ";", "}", "}", "else", "{", "SimpleDelta", "delta", "=", "new", "SimpleDelta", "(", ")", ";", "switch", "(", "newKind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "delta", ".", "added", "(", ")", ";", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "delta", ".", "removed", "(", ")", ";", "break", ";", "}", "this", ".", "changes", ".", "put", "(", "importDecl", ",", "delta", ")", ";", "}", "}", "private", "void", "addChange", "(", "IMember", "member", ",", "IJavaElementDelta", "newDelta", ")", "throws", "JavaModelException", "{", "int", "newKind", "=", "newDelta", ".", "getKind", "(", ")", ";", "switch", "(", "newKind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "ArrayList", "allTypes", "=", "new", "ArrayList", "(", ")", ";", "getAllTypesFromElement", "(", "member", ",", "allTypes", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "allTypes", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "innerType", "=", "(", "IType", ")", "allTypes", ".", "get", "(", "i", ")", ";", "addTypeAddition", "(", "innerType", ",", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "innerType", ")", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "allTypes", "=", "new", "ArrayList", "(", ")", ";", "getAllTypesFromHierarchy", "(", "(", "JavaElement", ")", "member", ",", "allTypes", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "allTypes", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "(", "IType", ")", "allTypes", ".", "get", "(", "i", ")", ";", "addTypeRemoval", "(", "type", ",", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "type", ")", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "addAffectedChildren", "(", "newDelta", ")", ";", "break", ";", "}", "}", "private", "void", "addChange", "(", "IType", "type", ",", "IJavaElementDelta", "newDelta", ")", "throws", "JavaModelException", "{", "int", "newKind", "=", "newDelta", ".", "getKind", "(", ")", ";", "SimpleDelta", "existingDelta", "=", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "type", ")", ";", "switch", "(", "newKind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "addTypeAddition", "(", "type", ",", "existingDelta", ")", ";", "ArrayList", "allTypes", "=", "new", "ArrayList", "(", ")", ";", "getAllTypesFromElement", "(", "type", ",", "allTypes", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "allTypes", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "innerType", "=", "(", "IType", ")", "allTypes", ".", "get", "(", "i", ")", ";", "addTypeAddition", "(", "innerType", ",", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "innerType", ")", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "addTypeRemoval", "(", "type", ",", "existingDelta", ")", ";", "allTypes", "=", "new", "ArrayList", "(", ")", ";", "getAllTypesFromHierarchy", "(", "(", "JavaElement", ")", "type", ",", "allTypes", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "allTypes", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "innerType", "=", "(", "IType", ")", "allTypes", ".", "get", "(", "i", ")", ";", "addTypeRemoval", "(", "innerType", ",", "(", "SimpleDelta", ")", "this", ".", "changes", ".", "get", "(", "innerType", ")", ")", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "addTypeChange", "(", "type", ",", "newDelta", ".", "getFlags", "(", ")", ",", "existingDelta", ")", ";", "addAffectedChildren", "(", "newDelta", ")", ";", "break", ";", "}", "}", "private", "void", "addTypeAddition", "(", "IType", "type", ",", "SimpleDelta", "existingDelta", ")", "throws", "JavaModelException", "{", "if", "(", "existingDelta", "!=", "null", ")", "{", "switch", "(", "existingDelta", ".", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "REMOVED", ":", "boolean", "hasChange", "=", "false", ";", "if", "(", "hasSuperTypeChange", "(", "type", ")", ")", "{", "existingDelta", ".", "superTypes", "(", ")", ";", "hasChange", "=", "true", ";", "}", "if", "(", "hasVisibilityChange", "(", "type", ")", ")", "{", "existingDelta", ".", "modifiers", "(", ")", ";", "hasChange", "=", "true", ";", "}", "if", "(", "!", "hasChange", ")", "{", "this", ".", "changes", ".", "remove", "(", "type", ")", ";", "}", "break", ";", "}", "}", "else", "{", "String", "typeName", "=", "type", ".", "getElementName", "(", ")", ";", "if", "(", "this", ".", "hierarchy", ".", "hasSupertype", "(", "typeName", ")", "||", "this", ".", "hierarchy", ".", "subtypesIncludeSupertypeOf", "(", "type", ")", "||", "this", ".", "hierarchy", ".", "missingTypes", ".", "contains", "(", "typeName", ")", ")", "{", "SimpleDelta", "delta", "=", "new", "SimpleDelta", "(", ")", ";", "delta", ".", "added", "(", ")", ";", "this", ".", "changes", ".", "put", "(", "type", ",", "delta", ")", ";", "}", "}", "}", "private", "void", "addTypeChange", "(", "IType", "type", ",", "int", "newFlags", ",", "SimpleDelta", "existingDelta", ")", "throws", "JavaModelException", "{", "if", "(", "existingDelta", "!=", "null", ")", "{", "switch", "(", "existingDelta", ".", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "CHANGED", ":", "int", "existingFlags", "=", "existingDelta", ".", "getFlags", "(", ")", ";", "boolean", "hasChange", "=", "false", ";", "if", "(", "(", "existingFlags", "&", "IJavaElementDelta", ".", "F_SUPER_TYPES", ")", "!=", "0", "&&", "hasSuperTypeChange", "(", "type", ")", ")", "{", "existingDelta", ".", "superTypes", "(", ")", ";", "hasChange", "=", "true", ";", "}", "if", "(", "(", "existingFlags", "&", "IJavaElementDelta", ".", "F_MODIFIERS", ")", "!=", "0", "&&", "hasVisibilityChange", "(", "type", ")", ")", "{", "existingDelta", ".", "modifiers", "(", ")", ";", "hasChange", "=", "true", ";", "}", "if", "(", "!", "hasChange", ")", "{", "this", ".", "changes", ".", "remove", "(", "type", ")", ";", "}", "break", ";", "}", "}", "else", "{", "SimpleDelta", "typeDelta", "=", "null", ";", "if", "(", "(", "newFlags", "&", "IJavaElementDelta", ".", "F_SUPER_TYPES", ")", "!=", "0", "&&", "this", ".", "hierarchy", ".", "includesTypeOrSupertype", "(", "type", ")", ")", "{", "typeDelta", "=", "new", "SimpleDelta", "(", ")", ";", "typeDelta", ".", "superTypes", "(", ")", ";", "}", "if", "(", "(", "newFlags", "&", "IJavaElementDelta", ".", "F_MODIFIERS", ")", "!=", "0", "&&", "(", "this", ".", "hierarchy", ".", "hasSupertype", "(", "type", ".", "getElementName", "(", ")", ")", "||", "type", ".", "equals", "(", "this", ".", "hierarchy", ".", "focusType", ")", ")", ")", "{", "if", "(", "typeDelta", "==", "null", ")", "{", "typeDelta", "=", "new", "SimpleDelta", "(", ")", ";", "}", "typeDelta", ".", "modifiers", "(", ")", ";", "}", "if", "(", "typeDelta", "!=", "null", ")", "{", "this", ".", "changes", ".", "put", "(", "type", ",", "typeDelta", ")", ";", "}", "}", "}", "private", "void", "addTypeRemoval", "(", "IType", "type", ",", "SimpleDelta", "existingDelta", ")", "{", "if", "(", "existingDelta", "!=", "null", ")", "{", "switch", "(", "existingDelta", ".", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "this", ".", "changes", ".", "remove", "(", "type", ")", ";", "break", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "existingDelta", ".", "removed", "(", ")", ";", "break", ";", "}", "}", "else", "{", "if", "(", "this", ".", "hierarchy", ".", "contains", "(", "type", ")", ")", "{", "SimpleDelta", "typeDelta", "=", "new", "SimpleDelta", "(", ")", ";", "typeDelta", ".", "removed", "(", ")", ";", "this", ".", "changes", ".", "put", "(", "type", ",", "typeDelta", ")", ";", "}", "}", "}", "private", "void", "getAllTypesFromElement", "(", "IJavaElement", "element", ",", "ArrayList", "allTypes", ")", "throws", "JavaModelException", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "IType", "[", "]", "types", "=", "(", "(", "ICompilationUnit", ")", "element", ")", ".", "getTypes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "types", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "types", "[", "i", "]", ";", "allTypes", ".", "add", "(", "type", ")", ";", "getAllTypesFromElement", "(", "type", ",", "allTypes", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "types", "=", "(", "(", "IType", ")", "element", ")", ".", "getTypes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "types", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "types", "[", "i", "]", ";", "allTypes", ".", "add", "(", "type", ")", ";", "getAllTypesFromElement", "(", "type", ",", "allTypes", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "INITIALIZER", ":", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "METHOD", ":", "IJavaElement", "[", "]", "children", "=", "(", "(", "IMember", ")", "element", ")", ".", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "(", "IType", ")", "children", "[", "i", "]", ";", "allTypes", ".", "add", "(", "type", ")", ";", "getAllTypesFromElement", "(", "type", ",", "allTypes", ")", ";", "}", "break", ";", "}", "}", "private", "void", "getAllTypesFromHierarchy", "(", "JavaElement", "element", ",", "ArrayList", "allTypes", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "ArrayList", "types", "=", "(", "ArrayList", ")", "this", ".", "hierarchy", ".", "files", ".", "get", "(", "element", ")", ";", "if", "(", "types", "!=", "null", ")", "{", "allTypes", ".", "addAll", "(", "types", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "case", "IJavaElement", ".", "INITIALIZER", ":", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "METHOD", ":", "types", "=", "(", "ArrayList", ")", "this", ".", "hierarchy", ".", "files", ".", "get", "(", "(", "(", "IMember", ")", "element", ")", ".", "getCompilationUnit", "(", ")", ")", ";", "if", "(", "types", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "types", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "(", "IType", ")", "types", ".", "get", "(", "i", ")", ";", "if", "(", "element", ".", "isAncestorOf", "(", "type", ")", ")", "{", "allTypes", ".", "add", "(", "type", ")", ";", "}", "}", "}", "break", ";", "}", "}", "private", "boolean", "hasSuperTypeChange", "(", "IType", "type", ")", "throws", "JavaModelException", "{", "IType", "superclass", "=", "this", ".", "hierarchy", ".", "getSuperclass", "(", "type", ")", ";", "String", "existingSuperclassName", "=", "superclass", "==", "null", "?", "null", ":", "superclass", ".", "getElementName", "(", ")", ";", "String", "newSuperclassName", "=", "type", ".", "getSuperclassName", "(", ")", ";", "if", "(", "existingSuperclassName", "!=", "null", "&&", "!", "existingSuperclassName", ".", "equals", "(", "newSuperclassName", ")", ")", "{", "return", "true", ";", "}", "IType", "[", "]", "existingSuperInterfaces", "=", "this", ".", "hierarchy", ".", "getSuperInterfaces", "(", "type", ")", ";", "String", "[", "]", "newSuperInterfaces", "=", "type", ".", "getSuperInterfaceNames", "(", ")", ";", "if", "(", "existingSuperInterfaces", ".", "length", "!=", "newSuperInterfaces", ".", "length", ")", "{", "return", "true", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "newSuperInterfaces", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "superInterfaceName", "=", "newSuperInterfaces", "[", "i", "]", ";", "if", "(", "!", "superInterfaceName", ".", "equals", "(", "newSuperInterfaces", "[", "i", "]", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "private", "boolean", "hasVisibilityChange", "(", "IType", "type", ")", "throws", "JavaModelException", "{", "int", "existingFlags", "=", "this", ".", "hierarchy", ".", "getCachedFlags", "(", "type", ")", ";", "int", "newFlags", "=", "type", ".", "getFlags", "(", ")", ";", "return", "existingFlags", "!=", "newFlags", ";", "}", "public", "boolean", "needsRefresh", "(", ")", "{", "return", "this", ".", "changes", ".", "size", "(", ")", "!=", "0", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "Iterator", "iterator", "=", "this", ".", "changes", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iterator", ".", "next", "(", ")", ";", "buffer", ".", "append", "(", "(", "(", "JavaElement", ")", "entry", ".", "getKey", "(", ")", ")", ".", "toDebugString", "(", ")", ")", ";", "buffer", ".", "append", "(", "entry", ".", "getValue", "(", ")", ")", ";", "if", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
3,735
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IGenericType", ";", "public", "class", "HierarchyType", "implements", "IGenericType", "{", "public", "IType", "typeHandle", ";", "public", "char", "[", "]", "name", ";", "public", "int", "modifiers", ";", "public", "char", "[", "]", "superclassName", ";", "public", "char", "[", "]", "[", "]", "superInterfaceNames", ";", "public", "HierarchyType", "(", "IType", "typeHandle", ",", "char", "[", "]", "name", ",", "int", "modifiers", ",", "char", "[", "]", "superclassName", ",", "char", "[", "]", "[", "]", "superInterfaceNames", ")", "{", "this", ".", "typeHandle", "=", "typeHandle", ";", "this", ".", "name", "=", "name", ";", "this", ".", "modifiers", "=", "modifiers", ";", "this", ".", "superclassName", "=", "superclassName", ";", "this", ".", "superInterfaceNames", "=", "superInterfaceNames", ";", "}", "public", "char", "[", "]", "getFileName", "(", ")", "{", "return", "this", ".", "typeHandle", ".", "getCompilationUnit", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "return", "this", ".", "modifiers", ";", "}", "public", "boolean", "isBinaryType", "(", ")", "{", "return", "false", ";", "}", "}", "</s>" ]
3,736
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "util", ".", "CompilerUtils", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IGenericType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "ResourceCompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "abstract", "class", "HierarchyBuilder", "{", "protected", "TypeHierarchy", "hierarchy", ";", "protected", "NameLookup", "nameLookup", ";", "protected", "HierarchyResolver", "hierarchyResolver", ";", "protected", "Map", "infoToHandle", ";", "protected", "String", "focusQualifiedName", ";", "public", "HierarchyBuilder", "(", "TypeHierarchy", "hierarchy", ")", "throws", "JavaModelException", "{", "this", ".", "hierarchy", "=", "hierarchy", ";", "JavaProject", "project", "=", "(", "JavaProject", ")", "hierarchy", ".", "javaProject", "(", ")", ";", "IType", "focusType", "=", "hierarchy", ".", "getType", "(", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "unitToLookInside", "=", "focusType", "==", "null", "?", "null", ":", "focusType", ".", "getCompilationUnit", "(", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "workingCopies", "=", "this", ".", "hierarchy", ".", "workingCopies", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "unitsToLookInside", ";", "if", "(", "unitToLookInside", "!=", "null", ")", "{", "int", "wcLength", "=", "workingCopies", "==", "null", "?", "0", ":", "workingCopies", ".", "length", ";", "if", "(", "wcLength", "==", "0", ")", "{", "unitsToLookInside", "=", "new", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "{", "unitToLookInside", "}", ";", "}", "else", "{", "unitsToLookInside", "=", "new", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "wcLength", "+", "1", "]", ";", "unitsToLookInside", "[", "0", "]", "=", "unitToLookInside", ";", "System", ".", "arraycopy", "(", "workingCopies", ",", "0", ",", "unitsToLookInside", ",", "1", ",", "wcLength", ")", ";", "}", "}", "else", "{", "unitsToLookInside", "=", "workingCopies", ";", "}", "if", "(", "project", "!=", "null", ")", "{", "Map", "optionMap", "=", "project", ".", "getOptions", "(", "true", ")", ";", "CompilerUtils", ".", "configureOptionsBasedOnNature", "(", "optionMap", ",", "project", ")", ";", "SearchableEnvironment", "searchableEnvironment", "=", "project", ".", "newSearchableNameEnvironment", "(", "unitsToLookInside", ")", ";", "this", ".", "nameLookup", "=", "searchableEnvironment", ".", "nameLookup", ";", "this", ".", "hierarchyResolver", "=", "new", "HierarchyResolver", "(", "searchableEnvironment", ",", "optionMap", ",", "this", ",", "new", "DefaultProblemFactory", "(", ")", ")", ";", "}", "this", ".", "infoToHandle", "=", "new", "HashMap", "(", "5", ")", ";", "this", ".", "focusQualifiedName", "=", "focusType", "==", "null", "?", "null", ":", "focusType", ".", "getFullyQualifiedName", "(", ")", ";", "}", "public", "abstract", "void", "build", "(", "boolean", "computeSubtypes", ")", "throws", "JavaModelException", ",", "CoreException", ";", "protected", "void", "buildSupertypes", "(", ")", "{", "IType", "focusType", "=", "getType", "(", ")", ";", "if", "(", "focusType", "==", "null", ")", "return", ";", "IGenericType", "type", ";", "try", "{", "type", "=", "(", "IGenericType", ")", "(", "(", "JavaElement", ")", "focusType", ")", ".", "getElementInfo", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", ";", "}", "this", ".", "hierarchyResolver", ".", "resolve", "(", "type", ")", ";", "if", "(", "!", "this", ".", "hierarchy", ".", "contains", "(", "focusType", ")", ")", "{", "this", ".", "hierarchy", ".", "addRootClass", "(", "focusType", ")", ";", "}", "}", "public", "void", "connect", "(", "IGenericType", "type", ",", "IType", "typeHandle", ",", "IType", "superclassHandle", ",", "IType", "[", "]", "superinterfaceHandles", ")", "{", "if", "(", "typeHandle", "==", "null", ")", "return", ";", "if", "(", "TypeHierarchy", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "println", "(", "\"Connecting:", "\"", "+", "(", "(", "JavaElement", ")", "typeHandle", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "(", "superclassHandle", "==", "null", "?", "\"<None>\"", ":", "(", "(", "JavaElement", ")", "superclassHandle", ")", ".", "toStringWithAncestors", "(", ")", ")", ")", ";", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "if", "(", "superinterfaceHandles", "==", "null", "||", "superinterfaceHandles", ".", "length", "==", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"", "<None>\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "superinterfaceHandles", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "superinterfaceHandles", "[", "i", "]", "==", "null", ")", "continue", ";", "System", ".", "out", ".", "println", "(", "\"", "\"", "+", "(", "(", "JavaElement", ")", "superinterfaceHandles", "[", "i", "]", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "}", "}", "switch", "(", "TypeDeclaration", ".", "kind", "(", "type", ".", "getModifiers", "(", ")", ")", ")", "{", "case", "TypeDeclaration", ".", "CLASS_DECL", ":", "case", "TypeDeclaration", ".", "ENUM_DECL", ":", "if", "(", "superclassHandle", "==", "null", ")", "{", "this", ".", "hierarchy", ".", "addRootClass", "(", "typeHandle", ")", ";", "}", "else", "{", "this", ".", "hierarchy", ".", "cacheSuperclass", "(", "typeHandle", ",", "superclassHandle", ")", ";", "}", "break", ";", "case", "TypeDeclaration", ".", "INTERFACE_DECL", ":", "case", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ":", "if", "(", "this", ".", "hierarchy", ".", "typeToSuperInterfaces", ".", "get", "(", "typeHandle", ")", "==", "null", ")", "this", ".", "hierarchy", ".", "addInterface", "(", "typeHandle", ")", ";", "break", ";", "}", "if", "(", "superinterfaceHandles", "==", "null", ")", "{", "superinterfaceHandles", "=", "TypeHierarchy", ".", "NO_TYPE", ";", "}", "this", ".", "hierarchy", ".", "cacheSuperInterfaces", "(", "typeHandle", ",", "superinterfaceHandles", ")", ";", "this", ".", "hierarchy", ".", "cacheFlags", "(", "typeHandle", ",", "type", ".", "getModifiers", "(", ")", ")", ";", "}", "protected", "IType", "getHandle", "(", "IGenericType", "genericType", ",", "ReferenceBinding", "binding", ")", "{", "if", "(", "genericType", "==", "null", ")", "return", "null", ";", "if", "(", "genericType", "instanceof", "HierarchyType", ")", "{", "IType", "handle", "=", "(", "IType", ")", "this", ".", "infoToHandle", ".", "get", "(", "genericType", ")", ";", "if", "(", "handle", "==", "null", ")", "{", "handle", "=", "(", "(", "HierarchyType", ")", "genericType", ")", ".", "typeHandle", ";", "handle", "=", "(", "IType", ")", "(", "(", "JavaElement", ")", "handle", ")", ".", "resolved", "(", "binding", ")", ";", "this", ".", "infoToHandle", ".", "put", "(", "genericType", ",", "handle", ")", ";", "}", "return", "handle", ";", "}", "else", "if", "(", "genericType", ".", "isBinaryType", "(", ")", ")", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "this", ".", "infoToHandle", ".", "get", "(", "genericType", ")", ";", "if", "(", "classFile", "==", "null", ")", "{", "IType", "handle", "=", "lookupBinaryHandle", "(", "(", "IBinaryType", ")", "genericType", ")", ";", "if", "(", "handle", "==", "null", ")", "return", "null", ";", "classFile", "=", "(", "ClassFile", ")", "handle", ".", "getParent", "(", ")", ";", "this", ".", "infoToHandle", ".", "put", "(", "genericType", ",", "classFile", ")", ";", "}", "return", "new", "ResolvedBinaryType", "(", "classFile", ",", "classFile", ".", "getTypeName", "(", ")", ",", "new", "String", "(", "binding", ".", "computeUniqueKey", "(", ")", ")", ")", ";", "}", "else", "if", "(", "genericType", "instanceof", "SourceTypeElementInfo", ")", "{", "IType", "handle", "=", "(", "(", "SourceTypeElementInfo", ")", "genericType", ")", ".", "getHandle", "(", ")", ";", "return", "(", "IType", ")", "(", "(", "JavaElement", ")", "handle", ")", ".", "resolved", "(", "binding", ")", ";", "}", "else", "return", "null", ";", "}", "protected", "IType", "getType", "(", ")", "{", "return", "this", ".", "hierarchy", ".", "getType", "(", ")", ";", "}", "protected", "IType", "lookupBinaryHandle", "(", "IBinaryType", "typeInfo", ")", "{", "int", "flag", ";", "String", "qualifiedName", ";", "switch", "(", "TypeDeclaration", ".", "kind", "(", "typeInfo", ".", "getModifiers", "(", ")", ")", ")", "{", "case", "TypeDeclaration", ".", "CLASS_DECL", ":", "flag", "=", "NameLookup", ".", "ACCEPT_CLASSES", ";", "break", ";", "case", "TypeDeclaration", ".", "INTERFACE_DECL", ":", "flag", "=", "NameLookup", ".", "ACCEPT_INTERFACES", ";", "break", ";", "case", "TypeDeclaration", ".", "ENUM_DECL", ":", "flag", "=", "NameLookup", ".", "ACCEPT_ENUMS", ";", "break", ";", "default", ":", "flag", "=", "NameLookup", ".", "ACCEPT_ANNOTATIONS", ";", "break", ";", "}", "char", "[", "]", "bName", "=", "typeInfo", ".", "getName", "(", ")", ";", "qualifiedName", "=", "new", "String", "(", "ClassFile", ".", "translatedName", "(", "bName", ")", ")", ";", "if", "(", "qualifiedName", ".", "equals", "(", "this", ".", "focusQualifiedName", ")", ")", "return", "getType", "(", ")", ";", "NameLookup", ".", "Answer", "answer", "=", "this", ".", "nameLookup", ".", "findType", "(", "qualifiedName", ",", "false", ",", "flag", ",", "true", ",", "false", ",", "false", ",", "null", ")", ";", "return", "answer", "==", "null", "||", "answer", ".", "type", "==", "null", "||", "!", "answer", ".", "type", ".", "isBinary", "(", ")", "?", "null", ":", "answer", ".", "type", ";", "}", "protected", "void", "worked", "(", "IProgressMonitor", "monitor", ",", "int", "work", ")", "{", "if", "(", "monitor", "!=", "null", ")", "{", "if", "(", "monitor", ".", "isCanceled", "(", ")", ")", "{", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "else", "{", "monitor", ".", "worked", "(", "work", ")", ";", "}", "}", "}", "protected", "ICompilationUnit", "createCompilationUnitFromPath", "(", "Openable", "handle", ",", "IFile", "file", ")", "{", "final", "char", "[", "]", "elementName", "=", "handle", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "return", "new", "ResourceCompilationUnit", "(", "file", ",", "file", ".", "getLocationURI", "(", ")", ")", "{", "public", "char", "[", "]", "getFileName", "(", ")", "{", "return", "elementName", ";", "}", "}", ";", "}", "protected", "IBinaryType", "createInfoFromClassFile", "(", "Openable", "handle", ",", "IResource", "file", ")", "{", "IBinaryType", "info", "=", "null", ";", "try", "{", "info", "=", "Util", ".", "newClassFileReader", "(", "file", ")", ";", "}", "catch", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFormatException", "e", ")", "{", "if", "(", "TypeHierarchy", ".", "DEBUG", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "catch", "(", "java", ".", "io", ".", "IOException", "e", ")", "{", "if", "(", "TypeHierarchy", ".", "DEBUG", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "TypeHierarchy", ".", "DEBUG", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "this", ".", "infoToHandle", ".", "put", "(", "info", ",", "handle", ")", ";", "return", "info", ";", "}", "protected", "IBinaryType", "createInfoFromClassFileInJar", "(", "Openable", "classFile", ")", "{", "PackageFragment", "pkg", "=", "(", "PackageFragment", ")", "classFile", ".", "getParent", "(", ")", ";", "String", "classFilePath", "=", "Util", ".", "concatWith", "(", "pkg", ".", "names", ",", "classFile", ".", "getElementName", "(", ")", ",", "'/'", ")", ";", "IBinaryType", "info", "=", "null", ";", "java", ".", "util", ".", "zip", ".", "ZipFile", "zipFile", "=", "null", ";", "try", "{", "zipFile", "=", "(", "(", "JarPackageFragmentRoot", ")", "pkg", ".", "getParent", "(", ")", ")", ".", "getJar", "(", ")", ";", "info", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileReader", ".", "read", "(", "zipFile", ",", "classFilePath", ")", ";", "}", "catch", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFormatException", "e", ")", "{", "if", "(", "TypeHierarchy", ".", "DEBUG", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "catch", "(", "java", ".", "io", ".", "IOException", "e", ")", "{", "if", "(", "TypeHierarchy", ".", "DEBUG", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "TypeHierarchy", ".", "DEBUG", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "finally", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "closeZipFile", "(", "zipFile", ")", ";", "}", "this", ".", "infoToHandle", ".", "put", "(", "info", ",", "classFile", ")", ";", "return", "info", ";", "}", "}", "</s>" ]
3,737
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "java", ".", "util", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "NullProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "SubProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRuleSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "HashtableOfObject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "HashtableOfObjectToInt", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IndexQueryRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaSearchParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "SubTypeSearchJob", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "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", ".", "SuperTypeReferencePattern", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HandleFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "IndexBasedHierarchyBuilder", "extends", "HierarchyBuilder", "implements", "SuffixConstants", "{", "public", "static", "final", "int", "MAXTICKS", "=", "800", ";", "protected", "Map", "cuToHandle", ";", "protected", "IJavaSearchScope", "scope", ";", "protected", "Map", "binariesFromIndexMatches", ";", "static", "class", "Queue", "{", "public", "char", "[", "]", "[", "]", "names", "=", "new", "char", "[", "10", "]", "[", "]", ";", "public", "int", "start", "=", "0", ";", "public", "int", "end", "=", "-", "1", ";", "public", "void", "add", "(", "char", "[", "]", "name", ")", "{", "if", "(", "++", "this", ".", "end", "==", "this", ".", "names", ".", "length", ")", "{", "this", ".", "end", "-=", "this", ".", "start", ";", "System", ".", "arraycopy", "(", "this", ".", "names", ",", "this", ".", "start", ",", "this", ".", "names", "=", "new", "char", "[", "this", ".", "end", "*", "2", "]", "[", "]", ",", "0", ",", "this", ".", "end", ")", ";", "this", ".", "start", "=", "0", ";", "}", "this", ".", "names", "[", "this", ".", "end", "]", "=", "name", ";", "}", "public", "char", "[", "]", "retrieve", "(", ")", "{", "if", "(", "this", ".", "start", ">", "this", ".", "end", ")", "return", "null", ";", "char", "[", "]", "name", "=", "this", ".", "names", "[", "this", ".", "start", "++", "]", ";", "if", "(", "this", ".", "start", ">", "this", ".", "end", ")", "{", "this", ".", "start", "=", "0", ";", "this", ".", "end", "=", "-", "1", ";", "}", "return", "name", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"Queue:n\"", ")", ";", "for", "(", "int", "i", "=", "this", ".", "start", ";", "i", "<=", "this", ".", "end", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "this", ".", "names", "[", "i", "]", ")", ".", "append", "(", "'\\n'", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "public", "IndexBasedHierarchyBuilder", "(", "TypeHierarchy", "hierarchy", ",", "IJavaSearchScope", "scope", ")", "throws", "JavaModelException", "{", "super", "(", "hierarchy", ")", ";", "this", ".", "cuToHandle", "=", "new", "HashMap", "(", "5", ")", ";", "this", ".", "binariesFromIndexMatches", "=", "new", "HashMap", "(", "10", ")", ";", "this", ".", "scope", "=", "scope", ";", "}", "public", "void", "build", "(", "boolean", "computeSubtypes", ")", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "try", "{", "manager", ".", "cacheZipFiles", "(", "this", ")", ";", "if", "(", "computeSubtypes", ")", "{", "IType", "focusType", "=", "getType", "(", ")", ";", "boolean", "focusIsObject", "=", "focusType", ".", "getElementName", "(", ")", ".", "equals", "(", "new", "String", "(", "IIndexConstants", ".", "OBJECT", ")", ")", ";", "int", "amountOfWorkForSubtypes", "=", "focusIsObject", "?", "5", ":", "80", ";", "IProgressMonitor", "possibleSubtypesMonitor", "=", "this", ".", "hierarchy", ".", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "this", ".", "hierarchy", ".", "progressMonitor", ",", "amountOfWorkForSubtypes", ")", ";", "HashSet", "localTypes", "=", "new", "HashSet", "(", "10", ")", ";", "String", "[", "]", "allPossibleSubtypes", ";", "if", "(", "(", "(", "Member", ")", "focusType", ")", ".", "getOuterMostLocalContext", "(", ")", "==", "null", ")", "{", "allPossibleSubtypes", "=", "determinePossibleSubTypes", "(", "localTypes", ",", "possibleSubtypesMonitor", ")", ";", "}", "else", "{", "allPossibleSubtypes", "=", "CharOperation", ".", "NO_STRINGS", ";", "}", "if", "(", "allPossibleSubtypes", "!=", "null", ")", "{", "IProgressMonitor", "buildMonitor", "=", "this", ".", "hierarchy", ".", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "this", ".", "hierarchy", ".", "progressMonitor", ",", "100", "-", "amountOfWorkForSubtypes", ")", ";", "this", ".", "hierarchy", ".", "initialize", "(", "allPossibleSubtypes", ".", "length", ")", ";", "buildFromPotentialSubtypes", "(", "allPossibleSubtypes", ",", "localTypes", ",", "buildMonitor", ")", ";", "}", "}", "else", "{", "this", ".", "hierarchy", ".", "initialize", "(", "1", ")", ";", "buildSupertypes", "(", ")", ";", "}", "}", "finally", "{", "manager", ".", "flushZipFiles", "(", "this", ")", ";", "}", "}", "private", "void", "buildForProject", "(", "JavaProject", "project", ",", "ArrayList", "potentialSubtypes", ",", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "workingCopies", ",", "HashSet", "localTypes", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "int", "openablesLength", "=", "potentialSubtypes", ".", "size", "(", ")", ";", "if", "(", "openablesLength", ">", "0", ")", "{", "Openable", "[", "]", "openables", "=", "new", "Openable", "[", "openablesLength", "]", ";", "potentialSubtypes", ".", "toArray", "(", "openables", ")", ";", "IPackageFragmentRoot", "[", "]", "roots", "=", "project", ".", "getPackageFragmentRoots", "(", ")", ";", "int", "rootsLength", "=", "roots", ".", "length", ";", "final", "HashtableOfObjectToInt", "indexes", "=", "new", "HashtableOfObjectToInt", "(", "openablesLength", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "openablesLength", ";", "i", "++", ")", "{", "IJavaElement", "root", "=", "openables", "[", "i", "]", ".", "getAncestor", "(", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", ";", "int", "index", ";", "for", "(", "index", "=", "0", ";", "index", "<", "rootsLength", ";", "index", "++", ")", "{", "if", "(", "roots", "[", "index", "]", ".", "equals", "(", "root", ")", ")", "break", ";", "}", "indexes", ".", "put", "(", "openables", "[", "i", "]", ",", "index", ")", ";", "}", "Arrays", ".", "sort", "(", "openables", ",", "new", "Comparator", "(", ")", "{", "public", "int", "compare", "(", "Object", "a", ",", "Object", "b", ")", "{", "int", "aIndex", "=", "indexes", ".", "get", "(", "a", ")", ";", "int", "bIndex", "=", "indexes", ".", "get", "(", "b", ")", ";", "if", "(", "aIndex", "!=", "bIndex", ")", "return", "aIndex", "-", "bIndex", ";", "return", "(", "(", "Openable", ")", "b", ")", ".", "getElementName", "(", ")", ".", "compareTo", "(", "(", "(", "Openable", ")", "a", ")", ".", "getElementName", "(", ")", ")", ";", "}", "}", ")", ";", "IType", "focusType", "=", "getType", "(", ")", ";", "boolean", "inProjectOfFocusType", "=", "focusType", "!=", "null", "&&", "focusType", ".", "getJavaProject", "(", ")", ".", "equals", "(", "project", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "unitsToLookInside", "=", "null", ";", "if", "(", "inProjectOfFocusType", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "unitToLookInside", "=", "focusType", ".", "getCompilationUnit", "(", ")", ";", "if", "(", "unitToLookInside", "!=", "null", ")", "{", "int", "wcLength", "=", "workingCopies", "==", "null", "?", "0", ":", "workingCopies", ".", "length", ";", "if", "(", "wcLength", "==", "0", ")", "{", "unitsToLookInside", "=", "new", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "{", "unitToLookInside", "}", ";", "}", "else", "{", "unitsToLookInside", "=", "new", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "wcLength", "+", "1", "]", ";", "unitsToLookInside", "[", "0", "]", "=", "unitToLookInside", ";", "System", ".", "arraycopy", "(", "workingCopies", ",", "0", ",", "unitsToLookInside", ",", "1", ",", "wcLength", ")", ";", "}", "}", "else", "{", "unitsToLookInside", "=", "workingCopies", ";", "}", "}", "SearchableEnvironment", "searchableEnvironment", "=", "project", ".", "newSearchableNameEnvironment", "(", "unitsToLookInside", ")", ";", "this", ".", "nameLookup", "=", "searchableEnvironment", ".", "nameLookup", ";", "Map", "options", "=", "project", ".", "getOptions", "(", "true", ")", ";", "options", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_TAGS", ",", "\"\"", ")", ";", "this", ".", "hierarchyResolver", "=", "new", "HierarchyResolver", "(", "searchableEnvironment", ",", "options", ",", "this", ",", "new", "DefaultProblemFactory", "(", ")", ")", ";", "if", "(", "focusType", "!=", "null", ")", "{", "Member", "declaringMember", "=", "(", "(", "Member", ")", "focusType", ")", ".", "getOuterMostLocalContext", "(", ")", ";", "if", "(", "declaringMember", "==", "null", ")", "{", "if", "(", "!", "inProjectOfFocusType", ")", "{", "char", "[", "]", "typeQualifiedName", "=", "focusType", ".", "getTypeQualifiedName", "(", "'.'", ")", ".", "toCharArray", "(", ")", ";", "String", "[", "]", "packageName", "=", "(", "(", "PackageFragment", ")", "focusType", ".", "getPackageFragment", "(", ")", ")", ".", "names", ";", "if", "(", "searchableEnvironment", ".", "findType", "(", "typeQualifiedName", ",", "Util", ".", "toCharArrays", "(", "packageName", ")", ")", "==", "null", ")", "{", "return", ";", "}", "}", "}", "else", "{", "Openable", "openable", ";", "if", "(", "declaringMember", ".", "isBinary", "(", ")", ")", "{", "openable", "=", "(", "Openable", ")", "declaringMember", ".", "getClassFile", "(", ")", ";", "}", "else", "{", "openable", "=", "(", "Openable", ")", "declaringMember", ".", "getCompilationUnit", "(", ")", ";", "}", "localTypes", "=", "new", "HashSet", "(", ")", ";", "localTypes", ".", "add", "(", "openable", ".", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "this", ".", "hierarchyResolver", ".", "resolve", "(", "new", "Openable", "[", "]", "{", "openable", "}", ",", "localTypes", ",", "monitor", ")", ";", "return", ";", "}", "}", "this", ".", "hierarchyResolver", ".", "resolve", "(", "openables", ",", "localTypes", ",", "monitor", ")", ";", "}", "}", "private", "void", "buildFromPotentialSubtypes", "(", "String", "[", "]", "allPotentialSubTypes", ",", "HashSet", "localTypes", ",", "IProgressMonitor", "monitor", ")", "{", "IType", "focusType", "=", "getType", "(", ")", ";", "HashMap", "wcPaths", "=", "new", "HashMap", "(", ")", ";", "int", "wcLength", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "workingCopies", "=", "this", ".", "hierarchy", ".", "workingCopies", ";", "if", "(", "workingCopies", "!=", "null", "&&", "(", "wcLength", "=", "workingCopies", ".", "length", ")", ">", "0", ")", "{", "String", "[", "]", "newPaths", "=", "new", "String", "[", "wcLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "wcLength", ";", "i", "++", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "workingCopy", "=", "workingCopies", "[", "i", "]", ";", "String", "path", "=", "workingCopy", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "wcPaths", ".", "put", "(", "path", ",", "workingCopy", ")", ";", "newPaths", "[", "i", "]", "=", "path", ";", "}", "int", "potentialSubtypesLength", "=", "allPotentialSubTypes", ".", "length", ";", "System", ".", "arraycopy", "(", "allPotentialSubTypes", ",", "0", ",", "allPotentialSubTypes", "=", "new", "String", "[", "potentialSubtypesLength", "+", "wcLength", "]", ",", "0", ",", "potentialSubtypesLength", ")", ";", "System", ".", "arraycopy", "(", "newPaths", ",", "0", ",", "allPotentialSubTypes", ",", "potentialSubtypesLength", ",", "wcLength", ")", ";", "}", "int", "length", "=", "allPotentialSubTypes", ".", "length", ";", "Openable", "focusCU", "=", "(", "Openable", ")", "focusType", ".", "getCompilationUnit", "(", ")", ";", "String", "focusPath", "=", "null", ";", "if", "(", "focusCU", "!=", "null", ")", "{", "focusPath", "=", "focusCU", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "length", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "allPotentialSubTypes", ",", "0", ",", "allPotentialSubTypes", "=", "new", "String", "[", "length", "+", "1", "]", ",", "0", ",", "length", ")", ";", "allPotentialSubTypes", "[", "length", "]", "=", "focusPath", ";", "}", "else", "{", "allPotentialSubTypes", "=", "new", "String", "[", "]", "{", "focusPath", "}", ";", "}", "length", "++", ";", "}", "Arrays", ".", "sort", "(", "allPotentialSubTypes", ")", ";", "ArrayList", "potentialSubtypes", "=", "new", "ArrayList", "(", ")", ";", "try", "{", "HandleFactory", "factory", "=", "new", "HandleFactory", "(", ")", ";", "IJavaProject", "currentProject", "=", "null", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "beginTask", "(", "\"\"", ",", "length", "*", "2", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "try", "{", "String", "resourcePath", "=", "allPotentialSubTypes", "[", "i", "]", ";", "if", "(", "i", ">", "0", "&&", "resourcePath", ".", "equals", "(", "allPotentialSubTypes", "[", "i", "-", "1", "]", ")", ")", "continue", ";", "Openable", "handle", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "workingCopy", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ")", "wcPaths", ".", "get", "(", "resourcePath", ")", ";", "if", "(", "workingCopy", "!=", "null", ")", "{", "handle", "=", "(", "Openable", ")", "workingCopy", ";", "}", "else", "{", "handle", "=", "resourcePath", ".", "equals", "(", "focusPath", ")", "?", "focusCU", ":", "factory", ".", "createOpenable", "(", "resourcePath", ",", "this", ".", "scope", ")", ";", "if", "(", "handle", "==", "null", ")", "continue", ";", "}", "IJavaProject", "project", "=", "handle", ".", "getJavaProject", "(", ")", ";", "if", "(", "currentProject", "==", "null", ")", "{", "currentProject", "=", "project", ";", "potentialSubtypes", "=", "new", "ArrayList", "(", "5", ")", ";", "}", "else", "if", "(", "!", "currentProject", ".", "equals", "(", "project", ")", ")", "{", "buildForProject", "(", "(", "JavaProject", ")", "currentProject", ",", "potentialSubtypes", ",", "workingCopies", ",", "localTypes", ",", "monitor", ")", ";", "currentProject", "=", "project", ";", "potentialSubtypes", "=", "new", "ArrayList", "(", "5", ")", ";", "}", "potentialSubtypes", ".", "add", "(", "handle", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "continue", ";", "}", "}", "try", "{", "if", "(", "currentProject", "==", "null", ")", "{", "currentProject", "=", "focusType", ".", "getJavaProject", "(", ")", ";", "if", "(", "focusType", ".", "isBinary", "(", ")", ")", "{", "potentialSubtypes", ".", "add", "(", "focusType", ".", "getClassFile", "(", ")", ")", ";", "}", "else", "{", "potentialSubtypes", ".", "add", "(", "focusType", ".", "getCompilationUnit", "(", ")", ")", ";", "}", "}", "buildForProject", "(", "(", "JavaProject", ")", "currentProject", ",", "potentialSubtypes", ",", "workingCopies", ",", "localTypes", ",", "monitor", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "if", "(", "!", "this", ".", "hierarchy", ".", "contains", "(", "focusType", ")", ")", "{", "try", "{", "currentProject", "=", "focusType", ".", "getJavaProject", "(", ")", ";", "potentialSubtypes", "=", "new", "ArrayList", "(", ")", ";", "if", "(", "focusType", ".", "isBinary", "(", ")", ")", "{", "potentialSubtypes", ".", "add", "(", "focusType", ".", "getClassFile", "(", ")", ")", ";", "}", "else", "{", "potentialSubtypes", ".", "add", "(", "focusType", ".", "getCompilationUnit", "(", ")", ")", ";", "}", "buildForProject", "(", "(", "JavaProject", ")", "currentProject", ",", "potentialSubtypes", ",", "workingCopies", ",", "localTypes", ",", "monitor", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "if", "(", "!", "this", ".", "hierarchy", ".", "contains", "(", "focusType", ")", ")", "{", "this", ".", "hierarchy", ".", "addRootClass", "(", "focusType", ")", ";", "}", "}", "finally", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "done", "(", ")", ";", "}", "}", "protected", "ICompilationUnit", "createCompilationUnitFromPath", "(", "Openable", "handle", ",", "IFile", "file", ")", "{", "ICompilationUnit", "unit", "=", "super", ".", "createCompilationUnitFromPath", "(", "handle", ",", "file", ")", ";", "this", ".", "cuToHandle", ".", "put", "(", "unit", ",", "handle", ")", ";", "return", "unit", ";", "}", "protected", "IBinaryType", "createInfoFromClassFile", "(", "Openable", "classFile", ",", "IResource", "file", ")", "{", "String", "documentPath", "=", "classFile", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";", "IBinaryType", "binaryType", "=", "(", "IBinaryType", ")", "this", ".", "binariesFromIndexMatches", ".", "get", "(", "documentPath", ")", ";", "if", "(", "binaryType", "!=", "null", ")", "{", "this", ".", "infoToHandle", ".", "put", "(", "binaryType", ",", "classFile", ")", ";", "return", "binaryType", ";", "}", "else", "{", "return", "super", ".", "createInfoFromClassFile", "(", "classFile", ",", "file", ")", ";", "}", "}", "protected", "IBinaryType", "createInfoFromClassFileInJar", "(", "Openable", "classFile", ")", "{", "String", "filePath", "=", "(", "(", "(", "ClassFile", ")", "classFile", ")", ".", "getType", "(", ")", ".", "getFullyQualifiedName", "(", "'$'", ")", ")", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "SuffixConstants", ".", "SUFFIX_STRING_class", ";", "IPackageFragmentRoot", "root", "=", "classFile", ".", "getPackageFragmentRoot", "(", ")", ";", "IPath", "path", "=", "root", ".", "getPath", "(", ")", ";", "String", "rootPath", "=", "path", ".", "getDevice", "(", ")", "==", "null", "?", "path", ".", "toString", "(", ")", ":", "path", ".", "toOSString", "(", ")", ";", "String", "documentPath", "=", "rootPath", "+", "IJavaSearchScope", ".", "JAR_FILE_ENTRY_SEPARATOR", "+", "filePath", ";", "IBinaryType", "binaryType", "=", "(", "IBinaryType", ")", "this", ".", "binariesFromIndexMatches", ".", "get", "(", "documentPath", ")", ";", "if", "(", "binaryType", "!=", "null", ")", "{", "this", ".", "infoToHandle", ".", "put", "(", "binaryType", ",", "classFile", ")", ";", "return", "binaryType", ";", "}", "else", "{", "return", "super", ".", "createInfoFromClassFileInJar", "(", "classFile", ")", ";", "}", "}", "private", "String", "[", "]", "determinePossibleSubTypes", "(", "final", "HashSet", "localTypes", ",", "IProgressMonitor", "monitor", ")", "{", "class", "PathCollector", "implements", "IPathRequestor", "{", "HashSet", "paths", "=", "new", "HashSet", "(", "10", ")", ";", "public", "void", "acceptPath", "(", "String", "path", ",", "boolean", "containsLocalTypes", ")", "{", "this", ".", "paths", ".", "add", "(", "path", ")", ";", "if", "(", "containsLocalTypes", ")", "{", "localTypes", ".", "add", "(", "path", ")", ";", "}", "}", "}", "PathCollector", "collector", "=", "new", "PathCollector", "(", ")", ";", "try", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "beginTask", "(", "\"\"", ",", "MAXTICKS", ")", ";", "searchAllPossibleSubTypes", "(", "getType", "(", ")", ",", "this", ".", "scope", ",", "this", ".", "binariesFromIndexMatches", ",", "collector", ",", "IJavaSearchConstants", ".", "WAIT_UNTIL_READY_TO_SEARCH", ",", "monitor", ")", ";", "}", "finally", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "done", "(", ")", ";", "}", "HashSet", "paths", "=", "collector", ".", "paths", ";", "int", "length", "=", "paths", ".", "size", "(", ")", ";", "String", "[", "]", "result", "=", "new", "String", "[", "length", "]", ";", "int", "count", "=", "0", ";", "for", "(", "Iterator", "iter", "=", "paths", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "result", "[", "count", "++", "]", "=", "(", "String", ")", "iter", ".", "next", "(", ")", ";", "}", "return", "result", ";", "}", "public", "static", "void", "searchAllPossibleSubTypes", "(", "IType", "type", ",", "IJavaSearchScope", "scope", ",", "final", "Map", "binariesFromIndexMatches", ",", "final", "IPathRequestor", "pathRequestor", ",", "int", "waitingPolicy", ",", "final", "IProgressMonitor", "progressMonitor", ")", "{", "final", "Queue", "queue", "=", "new", "Queue", "(", ")", ";", "final", "HashtableOfObject", "foundSuperNames", "=", "new", "HashtableOfObject", "(", "5", ")", ";", "IndexManager", "indexManager", "=", "JavaModelManager", ".", "getIndexManager", "(", ")", ";", "IndexQueryRequestor", "searchRequestor", "=", "new", "IndexQueryRequestor", "(", ")", "{", "public", "boolean", "acceptIndexMatch", "(", "String", "documentPath", ",", "SearchPattern", "indexRecord", ",", "SearchParticipant", "participant", ",", "AccessRuleSet", "access", ")", "{", "SuperTypeReferencePattern", "record", "=", "(", "SuperTypeReferencePattern", ")", "indexRecord", ";", "boolean", "isLocalOrAnonymous", "=", "record", ".", "enclosingTypeName", "==", "IIndexConstants", ".", "ONE_ZERO", ";", "pathRequestor", ".", "acceptPath", "(", "documentPath", ",", "isLocalOrAnonymous", ")", ";", "char", "[", "]", "typeName", "=", "record", ".", "simpleName", ";", "if", "(", "documentPath", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "SUFFIX_STRING_class", ")", ")", "{", "int", "suffix", "=", "documentPath", ".", "length", "(", ")", "-", "SUFFIX_STRING_class", ".", "length", "(", ")", ";", "HierarchyBinaryType", "binaryType", "=", "(", "HierarchyBinaryType", ")", "binariesFromIndexMatches", ".", "get", "(", "documentPath", ")", ";", "if", "(", "binaryType", "==", "null", ")", "{", "char", "[", "]", "enclosingTypeName", "=", "record", ".", "enclosingTypeName", ";", "if", "(", "isLocalOrAnonymous", ")", "{", "int", "lastSlash", "=", "documentPath", ".", "lastIndexOf", "(", "'/'", ")", ";", "int", "lastDollar", "=", "documentPath", ".", "lastIndexOf", "(", "'$'", ")", ";", "if", "(", "lastDollar", "==", "-", "1", ")", "{", "enclosingTypeName", "=", "null", ";", "typeName", "=", "documentPath", ".", "substring", "(", "lastSlash", "+", "1", ",", "suffix", ")", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "enclosingTypeName", "=", "documentPath", ".", "substring", "(", "lastSlash", "+", "1", ",", "lastDollar", ")", ".", "toCharArray", "(", ")", ";", "typeName", "=", "documentPath", ".", "substring", "(", "lastDollar", "+", "1", ",", "suffix", ")", ".", "toCharArray", "(", ")", ";", "}", "}", "binaryType", "=", "new", "HierarchyBinaryType", "(", "record", ".", "modifiers", ",", "record", ".", "pkgName", ",", "typeName", ",", "enclosingTypeName", ",", "record", ".", "typeParameterSignatures", ",", "record", ".", "classOrInterface", ")", ";", "binariesFromIndexMatches", ".", "put", "(", "documentPath", ",", "binaryType", ")", ";", "}", "binaryType", ".", "recordSuperType", "(", "record", ".", "superSimpleName", ",", "record", ".", "superQualification", ",", "record", ".", "superClassOrInterface", ")", ";", "}", "if", "(", "!", "isLocalOrAnonymous", "&&", "!", "foundSuperNames", ".", "containsKey", "(", "typeName", ")", ")", "{", "foundSuperNames", ".", "put", "(", "typeName", ",", "typeName", ")", ";", "queue", ".", "add", "(", "typeName", ")", ";", "}", "return", "true", ";", "}", "}", ";", "int", "superRefKind", ";", "try", "{", "superRefKind", "=", "type", ".", "isClass", "(", ")", "?", "SuperTypeReferencePattern", ".", "ONLY_SUPER_CLASSES", ":", "SuperTypeReferencePattern", ".", "ALL_SUPER_TYPES", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "superRefKind", "=", "SuperTypeReferencePattern", ".", "ALL_SUPER_TYPES", ";", "}", "SuperTypeReferencePattern", "pattern", "=", "new", "SuperTypeReferencePattern", "(", "null", ",", "null", ",", "superRefKind", ",", "SearchPattern", ".", "R_EXACT_MATCH", "|", "SearchPattern", ".", "R_CASE_SENSITIVE", ")", ";", "MatchLocator", ".", "setFocus", "(", "pattern", ",", "type", ")", ";", "SubTypeSearchJob", "job", "=", "new", "SubTypeSearchJob", "(", "pattern", ",", "new", "JavaSearchParticipant", "(", ")", ",", "scope", ",", "searchRequestor", ")", ";", "int", "ticks", "=", "0", ";", "queue", ".", "add", "(", "type", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "try", "{", "while", "(", "queue", ".", "start", "<=", "queue", ".", "end", ")", "{", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "return", ";", "char", "[", "]", "currentTypeName", "=", "queue", ".", "retrieve", "(", ")", ";", "if", "(", "CharOperation", ".", "equals", "(", "currentTypeName", ",", "IIndexConstants", ".", "OBJECT", ")", ")", "currentTypeName", "=", "null", ";", "pattern", ".", "superSimpleName", "=", "currentTypeName", ";", "indexManager", ".", "performConcurrentJob", "(", "job", ",", "waitingPolicy", ",", "progressMonitor", "==", "null", "?", "null", ":", "new", "NullProgressMonitor", "(", ")", "{", "public", "void", "setCanceled", "(", "boolean", "value", ")", "{", "progressMonitor", ".", "setCanceled", "(", "value", ")", ";", "}", "public", "boolean", "isCanceled", "(", ")", "{", "return", "progressMonitor", ".", "isCanceled", "(", ")", ";", "}", "public", "void", "subTask", "(", "String", "name", ")", "{", "progressMonitor", ".", "subTask", "(", "name", ")", ";", "}", "}", ")", ";", "if", "(", "progressMonitor", "!=", "null", "&&", "++", "ticks", "<=", "MAXTICKS", ")", "progressMonitor", ".", "worked", "(", "1", ")", ";", "if", "(", "currentTypeName", "==", "null", ")", "break", ";", "}", "}", "finally", "{", "job", ".", "finished", "(", ")", ";", "}", "}", "}", "</s>" ]
3,738
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "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", ".", "CompilationResult", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "DefaultErrorHandlingPolicies", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "IErrorHandlingPolicy", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "IProblemFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "CompilationUnitDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "QualifiedAllocationExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "AccessRestriction", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IGenericType", ";", "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", ".", "ClassScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "LocalTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "LookupEnvironment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "PackageBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ProblemReasons", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "SourceTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TagBits", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeIds", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Parser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "SourceTypeConverter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "AbortCompilation", ";", "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", ".", "core", ".", "ClassFile", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "Member", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "Openable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SourceTypeElementInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "ASTNodeFinder", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HandleFactory", ";", "public", "class", "HierarchyResolver", "implements", "ITypeRequestor", "{", "private", "ReferenceBinding", "focusType", ";", "private", "boolean", "superTypesOnly", ";", "private", "boolean", "hasMissingSuperClass", ";", "LookupEnvironment", "lookupEnvironment", ";", "private", "CompilerOptions", "options", ";", "HierarchyBuilder", "builder", ";", "private", "ReferenceBinding", "[", "]", "typeBindings", ";", "private", "int", "typeIndex", ";", "private", "IGenericType", "[", "]", "typeModels", ";", "private", "static", "final", "CompilationUnitDeclaration", "FakeUnit", ";", "static", "{", "IErrorHandlingPolicy", "policy", "=", "DefaultErrorHandlingPolicies", ".", "exitAfterAllProblems", "(", ")", ";", "ProblemReporter", "problemReporter", "=", "new", "ProblemReporter", "(", "policy", ",", "new", "CompilerOptions", "(", ")", ",", "new", "DefaultProblemFactory", "(", ")", ")", ";", "CompilationResult", "result", "=", "new", "CompilationResult", "(", "CharOperation", ".", "NO_CHAR", ",", "0", ",", "0", ",", "0", ")", ";", "FakeUnit", "=", "new", "CompilationUnitDeclaration", "(", "problemReporter", ",", "result", ",", "0", ")", ";", "}", "public", "HierarchyResolver", "(", "INameEnvironment", "nameEnvironment", ",", "Map", "settings", ",", "HierarchyBuilder", "builder", ",", "IProblemFactory", "problemFactory", ")", "{", "this", ".", "options", "=", "new", "CompilerOptions", "(", "settings", ")", ";", "IErrorHandlingPolicy", "policy", "=", "DefaultErrorHandlingPolicies", ".", "exitAfterAllProblems", "(", ")", ";", "ProblemReporter", "problemReporter", "=", "new", "ProblemReporter", "(", "policy", ",", "this", ".", "options", ",", "problemFactory", ")", ";", "setEnvironment", "(", "new", "LookupEnvironment", "(", "this", ",", "this", ".", "options", ",", "problemReporter", ",", "nameEnvironment", ")", ",", "builder", ")", ";", "}", "public", "HierarchyResolver", "(", "LookupEnvironment", "lookupEnvironment", ",", "HierarchyBuilder", "builder", ")", "{", "setEnvironment", "(", "lookupEnvironment", ",", "builder", ")", ";", "}", "public", "void", "accept", "(", "IBinaryType", "binaryType", ",", "PackageBinding", "packageBinding", ",", "AccessRestriction", "accessRestriction", ")", "{", "IProgressMonitor", "progressMonitor", "=", "this", ".", "builder", ".", "hierarchy", ".", "progressMonitor", ";", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "BinaryTypeBinding", "typeBinding", "=", "this", ".", "lookupEnvironment", ".", "createBinaryTypeFrom", "(", "binaryType", ",", "packageBinding", ",", "accessRestriction", ")", ";", "try", "{", "this", ".", "remember", "(", "binaryType", ",", "typeBinding", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "}", "public", "void", "accept", "(", "ICompilationUnit", "sourceUnit", ",", "AccessRestriction", "accessRestriction", ")", "{", "this", ".", "lookupEnvironment", ".", "problemReporter", ".", "abortDueToInternalError", "(", "new", "StringBuffer", "(", "Messages", ".", "accept_cannot", ")", ".", "append", "(", "sourceUnit", ".", "getFileName", "(", ")", ")", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "accept", "(", "ISourceType", "[", "]", "sourceTypes", ",", "PackageBinding", "packageBinding", ",", "AccessRestriction", "accessRestriction", ")", "{", "IProgressMonitor", "progressMonitor", "=", "this", ".", "builder", ".", "hierarchy", ".", "progressMonitor", ";", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "ISourceType", "sourceType", "=", "sourceTypes", "[", "0", "]", ";", "while", "(", "sourceType", ".", "getEnclosingType", "(", ")", "!=", "null", ")", "sourceType", "=", "sourceType", ".", "getEnclosingType", "(", ")", ";", "CompilationResult", "result", "=", "new", "CompilationResult", "(", "sourceType", ".", "getFileName", "(", ")", ",", "1", ",", "1", ",", "this", ".", "options", ".", "maxProblemsPerUnit", ")", ";", "CompilationUnitDeclaration", "unit", "=", "SourceTypeConverter", ".", "buildCompilationUnit", "(", "new", "ISourceType", "[", "]", "{", "sourceType", "}", ",", "SourceTypeConverter", ".", "MEMBER_TYPE", ",", "this", ".", "lookupEnvironment", ".", "problemReporter", ",", "result", ")", ";", "if", "(", "unit", "!=", "null", ")", "{", "try", "{", "this", ".", "lookupEnvironment", ".", "buildTypeBindings", "(", "unit", ",", "accessRestriction", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "cu", "=", "(", "(", "SourceTypeElementInfo", ")", "sourceType", ")", ".", "getHandle", "(", ")", ".", "getCompilationUnit", "(", ")", ";", "rememberAllTypes", "(", "unit", ",", "cu", ",", "false", ")", ";", "this", ".", "lookupEnvironment", ".", "completeTypeBindings", "(", "unit", ",", "true", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "}", "}", "private", "IType", "findSuperClass", "(", "IGenericType", "type", ",", "ReferenceBinding", "typeBinding", ")", "{", "ReferenceBinding", "superBinding", "=", "typeBinding", ".", "superclass", "(", ")", ";", "if", "(", "superBinding", "!=", "null", ")", "{", "superBinding", "=", "(", "ReferenceBinding", ")", "superBinding", ".", "erasure", "(", ")", ";", "if", "(", "typeBinding", ".", "isHierarchyInconsistent", "(", ")", ")", "{", "if", "(", "superBinding", ".", "problemId", "(", ")", "==", "ProblemReasons", ".", "NotFound", ")", "{", "this", ".", "hasMissingSuperClass", "=", "true", ";", "this", ".", "builder", ".", "hierarchy", ".", "missingTypes", ".", "add", "(", "new", "String", "(", "superBinding", ".", "sourceName", ")", ")", ";", "return", "null", ";", "}", "else", "if", "(", "(", "superBinding", ".", "id", "==", "TypeIds", ".", "T_JavaLangObject", ")", ")", "{", "char", "[", "]", "superclassName", ";", "char", "separator", ";", "if", "(", "type", "instanceof", "IBinaryType", ")", "{", "superclassName", "=", "(", "(", "IBinaryType", ")", "type", ")", ".", "getSuperclassName", "(", ")", ";", "separator", "=", "'/'", ";", "}", "else", "if", "(", "type", "instanceof", "ISourceType", ")", "{", "superclassName", "=", "(", "(", "ISourceType", ")", "type", ")", ".", "getSuperclassName", "(", ")", ";", "separator", "=", "'.'", ";", "}", "else", "if", "(", "type", "instanceof", "HierarchyType", ")", "{", "superclassName", "=", "(", "(", "HierarchyType", ")", "type", ")", ".", "superclassName", ";", "separator", "=", "'.'", ";", "}", "else", "{", "return", "null", ";", "}", "if", "(", "superclassName", "!=", "null", ")", "{", "int", "lastSeparator", "=", "CharOperation", ".", "lastIndexOf", "(", "separator", ",", "superclassName", ")", ";", "char", "[", "]", "simpleName", "=", "lastSeparator", "==", "-", "1", "?", "superclassName", ":", "CharOperation", ".", "subarray", "(", "superclassName", ",", "lastSeparator", "+", "1", ",", "superclassName", ".", "length", ")", ";", "if", "(", "!", "CharOperation", ".", "equals", "(", "simpleName", ",", "TypeConstants", ".", "OBJECT", ")", ")", "{", "this", ".", "hasMissingSuperClass", "=", "true", ";", "this", ".", "builder", ".", "hierarchy", ".", "missingTypes", ".", "add", "(", "new", "String", "(", "simpleName", ")", ")", ";", "return", "null", ";", "}", "}", "}", "}", "for", "(", "int", "t", "=", "this", ".", "typeIndex", ";", "t", ">=", "0", ";", "t", "--", ")", "{", "if", "(", "this", ".", "typeBindings", "[", "t", "]", "==", "superBinding", ")", "{", "return", "this", ".", "builder", ".", "getHandle", "(", "this", ".", "typeModels", "[", "t", "]", ",", "superBinding", ")", ";", "}", "}", "}", "return", "null", ";", "}", "private", "IType", "[", "]", "findSuperInterfaces", "(", "IGenericType", "type", ",", "ReferenceBinding", "typeBinding", ")", "{", "char", "[", "]", "[", "]", "superInterfaceNames", ";", "char", "separator", ";", "if", "(", "type", "instanceof", "IBinaryType", ")", "{", "superInterfaceNames", "=", "(", "(", "IBinaryType", ")", "type", ")", ".", "getInterfaceNames", "(", ")", ";", "separator", "=", "'/'", ";", "}", "else", "if", "(", "type", "instanceof", "ISourceType", ")", "{", "ISourceType", "sourceType", "=", "(", "ISourceType", ")", "type", ";", "if", "(", "sourceType", ".", "getName", "(", ")", ".", "length", "==", "0", ")", "{", "if", "(", "typeBinding", ".", "superInterfaces", "(", ")", "!=", "null", "&&", "typeBinding", ".", "superInterfaces", "(", ")", ".", "length", ">", "0", ")", "{", "superInterfaceNames", "=", "new", "char", "[", "]", "[", "]", "{", "sourceType", ".", "getSuperclassName", "(", ")", "}", ";", "}", "else", "{", "superInterfaceNames", "=", "sourceType", ".", "getInterfaceNames", "(", ")", ";", "}", "}", "else", "{", "if", "(", "TypeDeclaration", ".", "kind", "(", "sourceType", ".", "getModifiers", "(", ")", ")", "==", "TypeDeclaration", ".", "ANNOTATION_TYPE_DECL", ")", "superInterfaceNames", "=", "new", "char", "[", "]", "[", "]", "{", "TypeConstants", ".", "CharArray_JAVA_LANG_ANNOTATION_ANNOTATION", "}", ";", "else", "superInterfaceNames", "=", "sourceType", ".", "getInterfaceNames", "(", ")", ";", "}", "separator", "=", "'.'", ";", "}", "else", "if", "(", "type", "instanceof", "HierarchyType", ")", "{", "HierarchyType", "hierarchyType", "=", "(", "HierarchyType", ")", "type", ";", "if", "(", "hierarchyType", ".", "name", ".", "length", "==", "0", ")", "{", "if", "(", "typeBinding", ".", "superInterfaces", "(", ")", "!=", "null", "&&", "typeBinding", ".", "superInterfaces", "(", ")", ".", "length", ">", "0", ")", "{", "superInterfaceNames", "=", "new", "char", "[", "]", "[", "]", "{", "hierarchyType", ".", "superclassName", "}", ";", "}", "else", "{", "superInterfaceNames", "=", "hierarchyType", ".", "superInterfaceNames", ";", "}", "}", "else", "{", "superInterfaceNames", "=", "hierarchyType", ".", "superInterfaceNames", ";", "}", "separator", "=", "'.'", ";", "}", "else", "{", "return", "null", ";", "}", "ReferenceBinding", "[", "]", "interfaceBindings", "=", "typeBinding", ".", "superInterfaces", "(", ")", ";", "int", "bindingIndex", "=", "0", ";", "int", "bindingLength", "=", "interfaceBindings", "==", "null", "?", "0", ":", "interfaceBindings", ".", "length", ";", "int", "length", "=", "superInterfaceNames", "==", "null", "?", "0", ":", "superInterfaceNames", ".", "length", ";", "IType", "[", "]", "superinterfaces", "=", "new", "IType", "[", "length", "]", ";", "int", "index", "=", "0", ";", "next", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "char", "[", "]", "superInterfaceName", "=", "superInterfaceNames", "[", "i", "]", ";", "int", "end", "=", "superInterfaceName", ".", "length", ";", "int", "genericStart", "=", "CharOperation", ".", "indexOf", "(", "Signature", ".", "C_GENERIC_START", ",", "superInterfaceName", ")", ";", "if", "(", "genericStart", "!=", "-", "1", ")", "end", "=", "genericStart", ";", "int", "lastSeparator", "=", "CharOperation", ".", "lastIndexOf", "(", "separator", ",", "superInterfaceName", ",", "0", ",", "end", ")", ";", "int", "start", "=", "lastSeparator", "+", "1", ";", "int", "lastDollar", "=", "CharOperation", ".", "lastIndexOf", "(", "'$'", ",", "superInterfaceName", ",", "start", ")", ";", "if", "(", "lastDollar", "!=", "-", "1", ")", "start", "=", "lastDollar", "+", "1", ";", "char", "[", "]", "simpleName", "=", "CharOperation", ".", "subarray", "(", "superInterfaceName", ",", "start", ",", "end", ")", ";", "if", "(", "bindingIndex", "<", "bindingLength", ")", "{", "ReferenceBinding", "interfaceBinding", "=", "(", "ReferenceBinding", ")", "interfaceBindings", "[", "bindingIndex", "]", ".", "erasure", "(", ")", ";", "if", "(", "CharOperation", ".", "equals", "(", "simpleName", ",", "interfaceBinding", ".", "sourceName", ")", ")", "{", "bindingIndex", "++", ";", "for", "(", "int", "t", "=", "this", ".", "typeIndex", ";", "t", ">=", "0", ";", "t", "--", ")", "{", "if", "(", "this", ".", "typeBindings", "[", "t", "]", "==", "interfaceBinding", ")", "{", "IType", "handle", "=", "this", ".", "builder", ".", "getHandle", "(", "this", ".", "typeModels", "[", "t", "]", ",", "interfaceBinding", ")", ";", "if", "(", "handle", "!=", "null", ")", "{", "superinterfaces", "[", "index", "++", "]", "=", "handle", ";", "continue", "next", ";", "}", "}", "}", "}", "}", "this", ".", "builder", ".", "hierarchy", ".", "missingTypes", ".", "add", "(", "new", "String", "(", "simpleName", ")", ")", ";", "}", "if", "(", "index", "!=", "length", ")", "System", ".", "arraycopy", "(", "superinterfaces", ",", "0", ",", "superinterfaces", "=", "new", "IType", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "superinterfaces", ";", "}", "private", "void", "fixSupertypeBindings", "(", ")", "{", "for", "(", "int", "current", "=", "this", ".", "typeIndex", ";", "current", ">=", "0", ";", "current", "--", ")", "{", "ReferenceBinding", "typeBinding", "=", "this", ".", "typeBindings", "[", "current", "]", ";", "if", "(", "(", "typeBinding", ".", "tagBits", "&", "TagBits", ".", "HierarchyHasProblems", ")", "==", "0", ")", "continue", ";", "if", "(", "typeBinding", "instanceof", "SourceTypeBinding", ")", "{", "if", "(", "typeBinding", "instanceof", "LocalTypeBinding", ")", "{", "LocalTypeBinding", "localTypeBinding", "=", "(", "LocalTypeBinding", ")", "typeBinding", ";", "QualifiedAllocationExpression", "allocationExpression", "=", "localTypeBinding", ".", "scope", ".", "referenceContext", ".", "allocation", ";", "TypeReference", "type", ";", "if", "(", "allocationExpression", "!=", "null", "&&", "(", "type", "=", "allocationExpression", ".", "type", ")", "!=", "null", "&&", "type", ".", "resolvedType", "!=", "null", ")", "{", "localTypeBinding", ".", "superclass", "=", "(", "ReferenceBinding", ")", "type", ".", "resolvedType", ";", "continue", ";", "}", "}", "ClassScope", "scope", "=", "(", "(", "SourceTypeBinding", ")", "typeBinding", ")", ".", "scope", ";", "if", "(", "scope", "!=", "null", ")", "{", "TypeDeclaration", "typeDeclaration", "=", "scope", ".", "referenceContext", ";", "TypeReference", "superclassRef", "=", "typeDeclaration", "==", "null", "?", "null", ":", "typeDeclaration", ".", "superclass", ";", "TypeBinding", "superclass", "=", "superclassRef", "==", "null", "?", "null", ":", "superclassRef", ".", "resolvedType", ";", "if", "(", "superclass", "!=", "null", ")", "{", "superclass", "=", "superclass", ".", "closestMatch", "(", ")", ";", "}", "if", "(", "superclass", "instanceof", "ReferenceBinding", ")", "{", "if", "(", "!", "(", "subTypeOfType", "(", "(", "ReferenceBinding", ")", "superclass", ",", "typeBinding", ")", ")", ")", "{", "(", "(", "SourceTypeBinding", ")", "typeBinding", ")", ".", "superclass", "=", "(", "ReferenceBinding", ")", "superclass", ";", "}", "}", "TypeReference", "[", "]", "superInterfaces", "=", "typeDeclaration", "==", "null", "?", "null", ":", "typeDeclaration", ".", "superInterfaces", ";", "int", "length", ";", "ReferenceBinding", "[", "]", "interfaceBindings", "=", "typeBinding", ".", "superInterfaces", "(", ")", ";", "if", "(", "superInterfaces", "!=", "null", "&&", "(", "length", "=", "superInterfaces", ".", "length", ")", ">", "(", "interfaceBindings", "==", "null", "?", "0", ":", "interfaceBindings", ".", "length", ")", ")", "{", "interfaceBindings", "=", "new", "ReferenceBinding", "[", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "TypeBinding", "superInterface", "=", "superInterfaces", "[", "i", "]", ".", "resolvedType", ";", "if", "(", "superInterface", "!=", "null", ")", "{", "superInterface", "=", "superInterface", ".", "closestMatch", "(", ")", ";", "}", "if", "(", "superInterface", "instanceof", "ReferenceBinding", ")", "{", "if", "(", "!", "(", "subTypeOfType", "(", "(", "ReferenceBinding", ")", "superInterface", ",", "typeBinding", ")", ")", ")", "{", "interfaceBindings", "[", "index", "++", "]", "=", "(", "ReferenceBinding", ")", "superInterface", ";", "}", "}", "}", "if", "(", "index", "<", "length", ")", "System", ".", "arraycopy", "(", "interfaceBindings", ",", "0", ",", "interfaceBindings", "=", "new", "ReferenceBinding", "[", "index", "]", ",", "0", ",", "index", ")", ";", "(", "(", "SourceTypeBinding", ")", "typeBinding", ")", ".", "superInterfaces", "=", "interfaceBindings", ";", "}", "}", "}", "else", "if", "(", "typeBinding", "instanceof", "BinaryTypeBinding", ")", "{", "try", "{", "typeBinding", ".", "superclass", "(", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "(", "(", "BinaryTypeBinding", ")", "typeBinding", ")", ".", "tagBits", "&=", "~", "TagBits", ".", "HasUnresolvedSuperclass", ";", "this", ".", "builder", ".", "hierarchy", ".", "missingTypes", ".", "add", "(", "new", "String", "(", "typeBinding", ".", "superclass", "(", ")", ".", "sourceName", "(", ")", ")", ")", ";", "this", ".", "hasMissingSuperClass", "=", "true", ";", "}", "try", "{", "typeBinding", ".", "superInterfaces", "(", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "(", "(", "BinaryTypeBinding", ")", "typeBinding", ")", ".", "tagBits", "&=", "~", "TagBits", ".", "HasUnresolvedSuperinterfaces", ";", "}", "}", "}", "}", "private", "void", "remember", "(", "IGenericType", "suppliedType", ",", "ReferenceBinding", "typeBinding", ")", "{", "if", "(", "typeBinding", "==", "null", ")", "return", ";", "if", "(", "++", "this", ".", "typeIndex", "==", "this", ".", "typeModels", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "typeModels", ",", "0", ",", "this", ".", "typeModels", "=", "new", "IGenericType", "[", "this", ".", "typeIndex", "*", "2", "]", ",", "0", ",", "this", ".", "typeIndex", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "typeBindings", ",", "0", ",", "this", ".", "typeBindings", "=", "new", "ReferenceBinding", "[", "this", ".", "typeIndex", "*", "2", "]", ",", "0", ",", "this", ".", "typeIndex", ")", ";", "}", "this", ".", "typeModels", "[", "this", ".", "typeIndex", "]", "=", "suppliedType", ";", "this", ".", "typeBindings", "[", "this", ".", "typeIndex", "]", "=", "typeBinding", ";", "}", "private", "void", "remember", "(", "IType", "type", ",", "ReferenceBinding", "typeBinding", ")", "{", "if", "(", "(", "(", "CompilationUnit", ")", "type", ".", "getCompilationUnit", "(", ")", ")", ".", "isOpen", "(", ")", ")", "{", "try", "{", "IGenericType", "genericType", "=", "(", "IGenericType", ")", "(", "(", "JavaElement", ")", "type", ")", ".", "getElementInfo", "(", ")", ";", "remember", "(", "genericType", ",", "typeBinding", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", ";", "}", "}", "else", "{", "if", "(", "typeBinding", "==", "null", ")", "return", ";", "TypeDeclaration", "typeDeclaration", "=", "(", "(", "SourceTypeBinding", ")", "typeBinding", ")", ".", "scope", ".", "referenceType", "(", ")", ";", "char", "[", "]", "superclassName", "=", "null", ";", "TypeReference", "superclass", ";", "if", "(", "(", "typeDeclaration", ".", "bits", "&", "ASTNode", ".", "IsAnonymousType", ")", "!=", "0", ")", "{", "superclass", "=", "typeDeclaration", ".", "allocation", ".", "type", ";", "}", "else", "{", "superclass", "=", "typeDeclaration", ".", "superclass", ";", "}", "if", "(", "superclass", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "typeName", "=", "superclass", ".", "getTypeName", "(", ")", ";", "superclassName", "=", "typeName", "==", "null", "?", "null", ":", "typeName", "[", "typeName", ".", "length", "-", "1", "]", ";", "}", "char", "[", "]", "[", "]", "superInterfaceNames", "=", "null", ";", "TypeReference", "[", "]", "superInterfaces", "=", "typeDeclaration", ".", "superInterfaces", ";", "if", "(", "superInterfaces", "!=", "null", ")", "{", "int", "length", "=", "superInterfaces", ".", "length", ";", "superInterfaceNames", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "TypeReference", "superInterface", "=", "superInterfaces", "[", "i", "]", ";", "char", "[", "]", "[", "]", "typeName", "=", "superInterface", ".", "getTypeName", "(", ")", ";", "superInterfaceNames", "[", "i", "]", "=", "typeName", "[", "typeName", ".", "length", "-", "1", "]", ";", "}", "}", "HierarchyType", "hierarchyType", "=", "new", "HierarchyType", "(", "type", ",", "typeDeclaration", ".", "name", ",", "typeDeclaration", ".", "binding", ".", "modifiers", ",", "superclassName", ",", "superInterfaceNames", ")", ";", "remember", "(", "hierarchyType", ",", "typeDeclaration", ".", "binding", ")", ";", "}", "}", "private", "void", "rememberAllTypes", "(", "CompilationUnitDeclaration", "parsedUnit", ",", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "cu", ",", "boolean", "includeLocalTypes", ")", "{", "TypeDeclaration", "[", "]", "types", "=", "parsedUnit", ".", "types", ";", "if", "(", "types", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "types", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "TypeDeclaration", "type", "=", "types", "[", "i", "]", ";", "rememberWithMemberTypes", "(", "type", ",", "cu", ".", "getType", "(", "new", "String", "(", "type", ".", "name", ")", ")", ")", ";", "}", "}", "if", "(", "includeLocalTypes", "&&", "parsedUnit", ".", "localTypes", "!=", "null", ")", "{", "HandleFactory", "factory", "=", "new", "HandleFactory", "(", ")", ";", "HashSet", "existingElements", "=", "new", "HashSet", "(", "parsedUnit", ".", "localTypeCount", ")", ";", "HashMap", "knownScopes", "=", "new", "HashMap", "(", "parsedUnit", ".", "localTypeCount", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parsedUnit", ".", "localTypeCount", ";", "i", "++", ")", "{", "LocalTypeBinding", "localType", "=", "parsedUnit", ".", "localTypes", "[", "i", "]", ";", "ClassScope", "classScope", "=", "localType", ".", "scope", ";", "TypeDeclaration", "typeDecl", "=", "classScope", ".", "referenceType", "(", ")", ";", "IType", "typeHandle", "=", "(", "IType", ")", "factory", ".", "createElement", "(", "classScope", ",", "cu", ",", "existingElements", ",", "knownScopes", ")", ";", "rememberWithMemberTypes", "(", "typeDecl", ",", "typeHandle", ")", ";", "}", "}", "}", "private", "void", "rememberWithMemberTypes", "(", "TypeDeclaration", "typeDecl", ",", "IType", "typeHandle", ")", "{", "remember", "(", "typeHandle", ",", "typeDecl", ".", "binding", ")", ";", "TypeDeclaration", "[", "]", "memberTypes", "=", "typeDecl", ".", "memberTypes", ";", "if", "(", "memberTypes", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "memberTypes", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "TypeDeclaration", "memberType", "=", "memberTypes", "[", "i", "]", ";", "rememberWithMemberTypes", "(", "memberType", ",", "typeHandle", ".", "getType", "(", "new", "String", "(", "memberType", ".", "name", ")", ")", ")", ";", "}", "}", "}", "private", "void", "reportHierarchy", "(", "IType", "focus", ",", "TypeDeclaration", "focusLocalType", ",", "ReferenceBinding", "binaryTypeBinding", ")", "{", "if", "(", "focus", "!=", "null", ")", "{", "if", "(", "binaryTypeBinding", "!=", "null", ")", "{", "this", ".", "focusType", "=", "binaryTypeBinding", ";", "}", "else", "{", "if", "(", "focusLocalType", "!=", "null", ")", "{", "this", ".", "focusType", "=", "focusLocalType", ".", "binding", ";", "}", "else", "{", "char", "[", "]", "fullyQualifiedName", "=", "focus", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ";", "setFocusType", "(", "CharOperation", ".", "splitOn", "(", "'.'", ",", "fullyQualifiedName", ")", ")", ";", "}", "}", "}", "fixSupertypeBindings", "(", ")", ";", "int", "objectIndex", "=", "-", "1", ";", "IProgressMonitor", "progressMonitor", "=", "this", ".", "builder", ".", "hierarchy", ".", "progressMonitor", ";", "for", "(", "int", "current", "=", "this", ".", "typeIndex", ";", "current", ">=", "0", ";", "current", "--", ")", "{", "if", "(", "progressMonitor", "!=", "null", "&&", "progressMonitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "ReferenceBinding", "typeBinding", "=", "this", ".", "typeBindings", "[", "current", "]", ";", "if", "(", "typeBinding", ".", "id", "==", "TypeIds", ".", "T_JavaLangObject", ")", "{", "objectIndex", "=", "current", ";", "continue", ";", "}", "IGenericType", "suppliedType", "=", "this", ".", "typeModels", "[", "current", "]", ";", "if", "(", "!", "subOrSuperOfFocus", "(", "typeBinding", ")", ")", "{", "continue", ";", "}", "IType", "superclass", ";", "if", "(", "typeBinding", ".", "isInterface", "(", ")", ")", "{", "superclass", "=", "null", ";", "}", "else", "{", "superclass", "=", "findSuperClass", "(", "suppliedType", ",", "typeBinding", ")", ";", "}", "IType", "[", "]", "superinterfaces", "=", "findSuperInterfaces", "(", "suppliedType", ",", "typeBinding", ")", ";", "this", ".", "builder", ".", "connect", "(", "suppliedType", ",", "this", ".", "builder", ".", "getHandle", "(", "suppliedType", ",", "typeBinding", ")", ",", "superclass", ",", "superinterfaces", ")", ";", "}", "if", "(", "objectIndex", ">", "-", "1", "&&", "(", "!", "this", ".", "hasMissingSuperClass", "||", "this", ".", "focusType", "==", "null", ")", ")", "{", "IGenericType", "objectType", "=", "this", ".", "typeModels", "[", "objectIndex", "]", ";", "this", ".", "builder", ".", "connect", "(", "objectType", ",", "this", ".", "builder", ".", "getHandle", "(", "objectType", ",", "this", ".", "typeBindings", "[", "objectIndex", "]", ")", ",", "null", ",", "null", ")", ";", "}", "}", "private", "void", "reset", "(", ")", "{", "this", ".", "lookupEnvironment", ".", "reset", "(", ")", ";", "this", ".", "focusType", "=", "null", ";", "this", ".", "superTypesOnly", "=", "false", ";", "this", ".", "typeIndex", "=", "-", "1", ";", "this", ".", "typeModels", "=", "new", "IGenericType", "[", "5", "]", ";", "this", ".", "typeBindings", "=", "new", "ReferenceBinding", "[", "5", "]", ";", "}", "public", "void", "resolve", "(", "IGenericType", "suppliedType", ")", "{", "try", "{", "if", "(", "suppliedType", ".", "isBinaryType", "(", ")", ")", "{", "BinaryTypeBinding", "binaryTypeBinding", "=", "this", ".", "lookupEnvironment", ".", "cacheBinaryType", "(", "(", "IBinaryType", ")", "suppliedType", ",", "false", ",", "null", ")", ";", "remember", "(", "suppliedType", ",", "binaryTypeBinding", ")", ";", "int", "startIndex", "=", "this", ".", "typeIndex", ";", "for", "(", "int", "i", "=", "startIndex", ";", "i", "<=", "this", ".", "typeIndex", ";", "i", "++", ")", "{", "IGenericType", "igType", "=", "this", ".", "typeModels", "[", "i", "]", ";", "if", "(", "igType", "!=", "null", "&&", "igType", ".", "isBinaryType", "(", ")", ")", "{", "CompilationUnitDeclaration", "previousUnitBeingCompleted", "=", "this", ".", "lookupEnvironment", ".", "unitBeingCompleted", ";", "try", "{", "if", "(", "previousUnitBeingCompleted", "==", "null", ")", "{", "this", ".", "lookupEnvironment", ".", "unitBeingCompleted", "=", "FakeUnit", ";", "}", "ReferenceBinding", "typeBinding", "=", "this", ".", "typeBindings", "[", "i", "]", ";", "typeBinding", ".", "superclass", "(", ")", ";", "typeBinding", ".", "superInterfaces", "(", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "finally", "{", "this", ".", "lookupEnvironment", ".", "unitBeingCompleted", "=", "previousUnitBeingCompleted", ";", "}", "}", "}", "this", ".", "superTypesOnly", "=", "true", ";", "reportHierarchy", "(", "this", ".", "builder", ".", "getType", "(", ")", ",", "null", ",", "binaryTypeBinding", ")", ";", "}", "else", "{", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "cu", "=", "(", "(", "SourceTypeElementInfo", ")", "suppliedType", ")", ".", "getHandle", "(", ")", ".", "getCompilationUnit", "(", ")", ";", "HashSet", "localTypes", "=", "new", "HashSet", "(", ")", ";", "localTypes", ".", "add", "(", "cu", ".", "getPath", "(", ")", ".", "toString", "(", ")", ")", ";", "this", ".", "superTypesOnly", "=", "true", ";", "resolve", "(", "new", "Openable", "[", "]", "{", "(", "Openable", ")", "cu", "}", ",", "localTypes", ",", "null", ")", ";", "}", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "finally", "{", "reset", "(", ")", ";", "}", "}", "public", "void", "resolve", "(", "Openable", "[", "]", "openables", ",", "HashSet", "localTypes", ",", "IProgressMonitor", "monitor", ")", "{", "try", "{", "int", "openablesLength", "=", "openables", ".", "length", ";", "CompilationUnitDeclaration", "[", "]", "parsedUnits", "=", "new", "CompilationUnitDeclaration", "[", "openablesLength", "]", ";", "boolean", "[", "]", "hasLocalType", "=", "new", "boolean", "[", "openablesLength", "]", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "]", "cus", "=", "new", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "[", "openablesLength", "]", ";", "int", "unitsIndex", "=", "0", ";", "CompilationUnitDeclaration", "focusUnit", "=", "null", ";", "ReferenceBinding", "focusBinaryBinding", "=", "null", ";", "IType", "focus", "=", "this", ".", "builder", ".", "getType", "(", ")", ";", "Openable", "focusOpenable", "=", "null", ";", "if", "(", "focus", "!=", "null", ")", "{", "if", "(", "focus", ".", "isBinary", "(", ")", ")", "{", "focusOpenable", "=", "(", "Openable", ")", "focus", ".", "getClassFile", "(", ")", ";", "}", "else", "{", "focusOpenable", "=", "(", "Openable", ")", "focus", ".", "getCompilationUnit", "(", ")", ";", "}", "}", "Parser", "parser", "=", "LanguageSupportFactory", ".", "getParser", "(", "this", ",", "this", ".", "lookupEnvironment", ".", "globalOptions", ",", "this", ".", "lookupEnvironment", ".", "problemReporter", ",", "true", ",", "1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "openablesLength", ";", "i", "++", ")", "{", "Openable", "openable", "=", "openables", "[", "i", "]", ";", "if", "(", "openable", "instanceof", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", "cu", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ")", "openable", ";", "boolean", "containsLocalType", "=", "false", ";", "if", "(", "localTypes", "==", "null", ")", "{", "containsLocalType", "=", "true", ";", "}", "else", "{", "IPath", "path", "=", "cu", ".", "getPath", "(", ")", ";", "containsLocalType", "=", "localTypes", ".", "contains", "(", "path", ".", "toString", "(", ")", ")", ";", "}", "CompilationUnitDeclaration", "parsedUnit", "=", "null", ";", "if", "(", "cu", ".", "isOpen", "(", ")", ")", "{", "CompilationResult", "result", "=", "new", "CompilationResult", "(", "(", "ICompilationUnit", ")", "cu", ",", "i", ",", "openablesLength", ",", "this", ".", "options", ".", "maxProblemsPerUnit", ")", ";", "SourceTypeElementInfo", "[", "]", "typeInfos", "=", "null", ";", "try", "{", "IType", "[", "]", "topLevelTypes", "=", "cu", ".", "getTypes", "(", ")", ";", "int", "topLevelLength", "=", "topLevelTypes", ".", "length", ";", "if", "(", "topLevelLength", "==", "0", ")", "continue", ";", "typeInfos", "=", "new", "SourceTypeElementInfo", "[", "topLevelLength", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "topLevelLength", ";", "j", "++", ")", "{", "IType", "topLevelType", "=", "topLevelTypes", "[", "j", "]", ";", "typeInfos", "[", "j", "]", "=", "(", "SourceTypeElementInfo", ")", "(", "(", "JavaElement", ")", "topLevelType", ")", ".", "getElementInfo", "(", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "int", "flags", "=", "!", "containsLocalType", "?", "SourceTypeConverter", ".", "MEMBER_TYPE", ":", "SourceTypeConverter", ".", "FIELD_AND_METHOD", "|", "SourceTypeConverter", ".", "MEMBER_TYPE", "|", "SourceTypeConverter", ".", "LOCAL_TYPE", ";", "parsedUnit", "=", "SourceTypeConverter", ".", "buildCompilationUnit", "(", "typeInfos", ",", "flags", ",", "this", ".", "lookupEnvironment", ".", "problemReporter", ",", "result", ")", ";", "if", "(", "containsLocalType", ")", "parsedUnit", ".", "bits", "|=", "ASTNode", ".", "HasAllMethodBodies", ";", "}", "else", "{", "IFile", "file", "=", "(", "IFile", ")", "cu", ".", "getResource", "(", ")", ";", "ICompilationUnit", "sourceUnit", "=", "this", ".", "builder", ".", "createCompilationUnitFromPath", "(", "openable", ",", "file", ")", ";", "CompilationResult", "unitResult", "=", "new", "CompilationResult", "(", "sourceUnit", ",", "i", ",", "openablesLength", ",", "this", ".", "options", ".", "maxProblemsPerUnit", ")", ";", "parsedUnit", "=", "parser", ".", "dietParse", "(", "sourceUnit", ",", "unitResult", ")", ";", "}", "if", "(", "parsedUnit", "!=", "null", ")", "{", "hasLocalType", "[", "unitsIndex", "]", "=", "containsLocalType", ";", "cus", "[", "unitsIndex", "]", "=", "cu", ";", "parsedUnits", "[", "unitsIndex", "++", "]", "=", "parsedUnit", ";", "try", "{", "this", ".", "lookupEnvironment", ".", "buildTypeBindings", "(", "parsedUnit", ",", "null", ")", ";", "if", "(", "openable", ".", "equals", "(", "focusOpenable", ")", ")", "{", "focusUnit", "=", "parsedUnit", ";", "}", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "}", "}", "else", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "openable", ";", "IBinaryType", "binaryType", "=", "(", "IBinaryType", ")", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getInfo", "(", "classFile", ".", "getType", "(", ")", ")", ";", "if", "(", "binaryType", "==", "null", ")", "{", "if", "(", "classFile", ".", "getPackageFragmentRoot", "(", ")", ".", "isArchive", "(", ")", ")", "{", "binaryType", "=", "this", ".", "builder", ".", "createInfoFromClassFileInJar", "(", "classFile", ")", ";", "}", "else", "{", "IResource", "file", "=", "classFile", ".", "resource", "(", ")", ";", "binaryType", "=", "this", ".", "builder", ".", "createInfoFromClassFile", "(", "classFile", ",", "file", ")", ";", "}", "}", "if", "(", "binaryType", "!=", "null", ")", "{", "try", "{", "BinaryTypeBinding", "binaryTypeBinding", "=", "this", ".", "lookupEnvironment", ".", "cacheBinaryType", "(", "binaryType", ",", "false", ",", "null", ")", ";", "remember", "(", "binaryType", ",", "binaryTypeBinding", ")", ";", "if", "(", "openable", ".", "equals", "(", "focusOpenable", ")", ")", "{", "focusBinaryBinding", "=", "binaryTypeBinding", ";", "}", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "}", "}", "}", "TypeDeclaration", "focusLocalType", "=", "null", ";", "if", "(", "focus", "!=", "null", "&&", "focusBinaryBinding", "==", "null", "&&", "focusUnit", "!=", "null", "&&", "(", "(", "Member", ")", "focus", ")", ".", "getOuterMostLocalContext", "(", ")", "!=", "null", ")", "{", "focusLocalType", "=", "new", "ASTNodeFinder", "(", "focusUnit", ")", ".", "findType", "(", "focus", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "this", ".", "typeIndex", ";", "i", "++", ")", "{", "IGenericType", "suppliedType", "=", "this", ".", "typeModels", "[", "i", "]", ";", "if", "(", "suppliedType", "!=", "null", "&&", "suppliedType", ".", "isBinaryType", "(", ")", ")", "{", "CompilationUnitDeclaration", "previousUnitBeingCompleted", "=", "this", ".", "lookupEnvironment", ".", "unitBeingCompleted", ";", "try", "{", "if", "(", "previousUnitBeingCompleted", "==", "null", ")", "{", "this", ".", "lookupEnvironment", ".", "unitBeingCompleted", "=", "FakeUnit", ";", "}", "ReferenceBinding", "typeBinding", "=", "this", ".", "typeBindings", "[", "i", "]", ";", "typeBinding", ".", "superclass", "(", ")", ";", "typeBinding", ".", "superInterfaces", "(", ")", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "finally", "{", "this", ".", "lookupEnvironment", ".", "unitBeingCompleted", "=", "previousUnitBeingCompleted", ";", "}", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "unitsIndex", ";", "i", "++", ")", "{", "CompilationUnitDeclaration", "parsedUnit", "=", "parsedUnits", "[", "i", "]", ";", "if", "(", "parsedUnit", "!=", "null", ")", "{", "try", "{", "if", "(", "hasLocalType", "[", "i", "]", ")", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "parser", ".", "getMethodBodies", "(", "parsedUnit", ")", ";", "}", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "hasLocalType", "[", "i", "]", "=", "false", ";", "}", "}", "}", "try", "{", "this", ".", "lookupEnvironment", ".", "completeTypeBindings", "(", "parsedUnits", ",", "hasLocalType", ",", "unitsIndex", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "unitsIndex", ";", "i", "++", ")", "{", "CompilationUnitDeclaration", "parsedUnit", "=", "parsedUnits", "[", "i", "]", ";", "if", "(", "parsedUnit", "!=", "null", "&&", "!", "parsedUnit", ".", "hasErrors", "(", ")", ")", "{", "boolean", "containsLocalType", "=", "hasLocalType", "[", "i", "]", ";", "if", "(", "containsLocalType", ")", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "parsedUnit", ".", "scope", ".", "faultInTypes", "(", ")", ";", "parsedUnit", ".", "resolve", "(", ")", ";", "}", "rememberAllTypes", "(", "parsedUnit", ",", "cus", "[", "i", "]", ",", "containsLocalType", ")", ";", "}", "}", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "worked", "(", "monitor", ",", "1", ")", ";", "if", "(", "focusBinaryBinding", "==", "null", "&&", "focus", "!=", "null", "&&", "focus", ".", "isBinary", "(", ")", ")", "{", "char", "[", "]", "fullyQualifiedName", "=", "focus", ".", "getFullyQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ";", "focusBinaryBinding", "=", "this", ".", "lookupEnvironment", ".", "getCachedType", "(", "CharOperation", ".", "splitOn", "(", "'.'", ",", "fullyQualifiedName", ")", ")", ";", "if", "(", "focusBinaryBinding", "==", "null", ")", "return", ";", "}", "reportHierarchy", "(", "focus", ",", "focusLocalType", ",", "focusBinaryBinding", ")", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "if", "(", "TypeHierarchy", ".", "DEBUG", ")", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "reset", "(", ")", ";", "}", "}", "private", "void", "setEnvironment", "(", "LookupEnvironment", "lookupEnvironment", ",", "HierarchyBuilder", "builder", ")", "{", "this", ".", "lookupEnvironment", "=", "lookupEnvironment", ";", "this", ".", "builder", "=", "builder", ";", "this", ".", "typeIndex", "=", "-", "1", ";", "this", ".", "typeModels", "=", "new", "IGenericType", "[", "5", "]", ";", "this", ".", "typeBindings", "=", "new", "ReferenceBinding", "[", "5", "]", ";", "}", "public", "ReferenceBinding", "setFocusType", "(", "char", "[", "]", "[", "]", "compoundName", ")", "{", "if", "(", "compoundName", "==", "null", "||", "this", ".", "lookupEnvironment", "==", "null", ")", "return", "null", ";", "this", ".", "focusType", "=", "this", ".", "lookupEnvironment", ".", "getCachedType", "(", "compoundName", ")", ";", "if", "(", "this", ".", "focusType", "==", "null", ")", "{", "this", ".", "focusType", "=", "this", ".", "lookupEnvironment", ".", "askForType", "(", "compoundName", ")", ";", "if", "(", "this", ".", "focusType", "==", "null", ")", "{", "int", "length", "=", "compoundName", ".", "length", ";", "char", "[", "]", "typeName", "=", "compoundName", "[", "length", "-", "1", "]", ";", "int", "firstDollar", "=", "CharOperation", ".", "indexOf", "(", "'$'", ",", "typeName", ")", ";", "if", "(", "firstDollar", "!=", "-", "1", ")", "{", "compoundName", "[", "length", "-", "1", "]", "=", "CharOperation", ".", "subarray", "(", "typeName", ",", "0", ",", "firstDollar", ")", ";", "this", ".", "focusType", "=", "this", ".", "lookupEnvironment", ".", "askForType", "(", "compoundName", ")", ";", "if", "(", "this", ".", "focusType", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "memberTypeNames", "=", "CharOperation", ".", "splitOn", "(", "'$'", ",", "typeName", ",", "firstDollar", "+", "1", ",", "typeName", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "memberTypeNames", ".", "length", ";", "i", "++", ")", "{", "this", ".", "focusType", "=", "this", ".", "focusType", ".", "getMemberType", "(", "memberTypeNames", "[", "i", "]", ")", ";", "}", "}", "}", "}", "}", "return", "this", ".", "focusType", ";", "}", "public", "boolean", "subOrSuperOfFocus", "(", "ReferenceBinding", "typeBinding", ")", "{", "if", "(", "this", ".", "focusType", "==", "null", ")", "return", "true", ";", "try", "{", "if", "(", "subTypeOfType", "(", "this", ".", "focusType", ",", "typeBinding", ")", ")", "return", "true", ";", "if", "(", "!", "this", ".", "superTypesOnly", "&&", "subTypeOfType", "(", "typeBinding", ",", "this", ".", "focusType", ")", ")", "return", "true", ";", "}", "catch", "(", "AbortCompilation", "e", ")", "{", "}", "return", "false", ";", "}", "private", "boolean", "subTypeOfType", "(", "ReferenceBinding", "subType", ",", "ReferenceBinding", "typeBinding", ")", "{", "if", "(", "typeBinding", "==", "null", "||", "subType", "==", "null", ")", "return", "false", ";", "if", "(", "subType", "==", "typeBinding", ")", "return", "true", ";", "ReferenceBinding", "superclass", "=", "subType", ".", "superclass", "(", ")", ";", "if", "(", "superclass", "!=", "null", ")", "superclass", "=", "(", "ReferenceBinding", ")", "superclass", ".", "erasure", "(", ")", ";", "if", "(", "subTypeOfType", "(", "superclass", ",", "typeBinding", ")", ")", "return", "true", ";", "ReferenceBinding", "[", "]", "superInterfaces", "=", "subType", ".", "superInterfaces", "(", ")", ";", "if", "(", "superInterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "superInterfaces", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ReferenceBinding", "superInterface", "=", "(", "ReferenceBinding", ")", "superInterfaces", "[", "i", "]", ".", "erasure", "(", ")", ";", "if", "(", "subTypeOfType", "(", "superInterface", ",", "typeBinding", ")", ")", "return", "true", ";", "}", "}", "return", "false", ";", "}", "protected", "void", "worked", "(", "IProgressMonitor", "monitor", ",", "int", "work", ")", "{", "if", "(", "monitor", "!=", "null", ")", "{", "if", "(", "monitor", ".", "isCanceled", "(", ")", ")", "{", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "else", "{", "monitor", ".", "worked", "(", "work", ")", ";", "}", "}", "}", "}", "</s>" ]
3,739
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "SubProgressMonitor", ";", "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", ".", "internal", ".", "core", ".", "JavaModelManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "Openable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "SearchableEnvironment", ";", "public", "class", "RegionBasedHierarchyBuilder", "extends", "HierarchyBuilder", "{", "public", "RegionBasedHierarchyBuilder", "(", "TypeHierarchy", "hierarchy", ")", "throws", "JavaModelException", "{", "super", "(", "hierarchy", ")", ";", "}", "public", "void", "build", "(", "boolean", "computeSubtypes", ")", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "try", "{", "manager", ".", "cacheZipFiles", "(", "this", ")", ";", "if", "(", "this", ".", "hierarchy", ".", "focusType", "==", "null", "||", "computeSubtypes", ")", "{", "IProgressMonitor", "typeInRegionMonitor", "=", "this", ".", "hierarchy", ".", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "this", ".", "hierarchy", ".", "progressMonitor", ",", "30", ")", ";", "HashMap", "allOpenablesInRegion", "=", "determineOpenablesInRegion", "(", "typeInRegionMonitor", ")", ";", "this", ".", "hierarchy", ".", "initialize", "(", "allOpenablesInRegion", ".", "size", "(", ")", ")", ";", "IProgressMonitor", "buildMonitor", "=", "this", ".", "hierarchy", ".", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "this", ".", "hierarchy", ".", "progressMonitor", ",", "70", ")", ";", "createTypeHierarchyBasedOnRegion", "(", "allOpenablesInRegion", ",", "buildMonitor", ")", ";", "(", "(", "RegionBasedTypeHierarchy", ")", "this", ".", "hierarchy", ")", ".", "pruneDeadBranches", "(", ")", ";", "}", "else", "{", "this", ".", "hierarchy", ".", "initialize", "(", "1", ")", ";", "buildSupertypes", "(", ")", ";", "}", "}", "finally", "{", "manager", ".", "flushZipFiles", "(", "this", ")", ";", "}", "}", "private", "void", "createTypeHierarchyBasedOnRegion", "(", "HashMap", "allOpenablesInRegion", ",", "IProgressMonitor", "monitor", ")", "{", "try", "{", "int", "size", "=", "allOpenablesInRegion", ".", "size", "(", ")", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "beginTask", "(", "\"\"", ",", "size", "*", "2", ")", ";", "this", ".", "infoToHandle", "=", "new", "HashMap", "(", "size", ")", ";", "Iterator", "javaProjects", "=", "allOpenablesInRegion", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "javaProjects", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "javaProjects", ".", "next", "(", ")", ";", "JavaProject", "project", "=", "(", "JavaProject", ")", "entry", ".", "getKey", "(", ")", ";", "ArrayList", "allOpenables", "=", "(", "ArrayList", ")", "entry", ".", "getValue", "(", ")", ";", "Openable", "[", "]", "openables", "=", "new", "Openable", "[", "allOpenables", ".", "size", "(", ")", "]", ";", "allOpenables", ".", "toArray", "(", "openables", ")", ";", "try", "{", "SearchableEnvironment", "searchableEnvironment", "=", "project", ".", "newSearchableNameEnvironment", "(", "this", ".", "hierarchy", ".", "workingCopies", ")", ";", "this", ".", "nameLookup", "=", "searchableEnvironment", ".", "nameLookup", ";", "this", ".", "hierarchyResolver", ".", "resolve", "(", "openables", ",", "null", ",", "monitor", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "finally", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "done", "(", ")", ";", "}", "}", "private", "HashMap", "determineOpenablesInRegion", "(", "IProgressMonitor", "monitor", ")", "{", "try", "{", "HashMap", "allOpenables", "=", "new", "HashMap", "(", ")", ";", "IJavaElement", "[", "]", "roots", "=", "(", "(", "RegionBasedTypeHierarchy", ")", "this", ".", "hierarchy", ")", ".", "region", ".", "getElements", "(", ")", ";", "int", "length", "=", "roots", ".", "length", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "beginTask", "(", "\"\"", ",", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "root", "=", "roots", "[", "i", "]", ";", "IJavaProject", "javaProject", "=", "root", ".", "getJavaProject", "(", ")", ";", "ArrayList", "openables", "=", "(", "ArrayList", ")", "allOpenables", ".", "get", "(", "javaProject", ")", ";", "if", "(", "openables", "==", "null", ")", "{", "openables", "=", "new", "ArrayList", "(", ")", ";", "allOpenables", ".", "put", "(", "javaProject", ",", "openables", ")", ";", "}", "switch", "(", "root", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "injectAllOpenablesForJavaProject", "(", "(", "IJavaProject", ")", "root", ",", "openables", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "injectAllOpenablesForPackageFragmentRoot", "(", "(", "IPackageFragmentRoot", ")", "root", ",", "openables", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "injectAllOpenablesForPackageFragment", "(", "(", "IPackageFragment", ")", "root", ",", "openables", ")", ";", "break", ";", "case", "IJavaElement", ".", "CLASS_FILE", ":", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "openables", ".", "add", "(", "root", ")", ";", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "IType", "type", "=", "(", "IType", ")", "root", ";", "if", "(", "type", ".", "isBinary", "(", ")", ")", "{", "openables", ".", "add", "(", "type", ".", "getClassFile", "(", ")", ")", ";", "}", "else", "{", "openables", ".", "add", "(", "type", ".", "getCompilationUnit", "(", ")", ")", ";", "}", "break", ";", "default", ":", "break", ";", "}", "worked", "(", "monitor", ",", "1", ")", ";", "}", "return", "allOpenables", ";", "}", "finally", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "done", "(", ")", ";", "}", "}", "private", "void", "injectAllOpenablesForJavaProject", "(", "IJavaProject", "project", ",", "ArrayList", "openables", ")", "{", "try", "{", "IPackageFragmentRoot", "[", "]", "devPathRoots", "=", "(", "(", "JavaProject", ")", "project", ")", ".", "getPackageFragmentRoots", "(", ")", ";", "if", "(", "devPathRoots", "==", "null", ")", "{", "return", ";", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "devPathRoots", ".", "length", ";", "j", "++", ")", "{", "IPackageFragmentRoot", "root", "=", "devPathRoots", "[", "j", "]", ";", "injectAllOpenablesForPackageFragmentRoot", "(", "root", ",", "openables", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "private", "void", "injectAllOpenablesForPackageFragment", "(", "IPackageFragment", "packFrag", ",", "ArrayList", "openables", ")", "{", "try", "{", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "packFrag", ".", "getParent", "(", ")", ";", "int", "kind", "=", "root", ".", "getKind", "(", ")", ";", "if", "(", "kind", "!=", "0", ")", "{", "boolean", "isSourcePackageFragment", "=", "(", "kind", "==", "IPackageFragmentRoot", ".", "K_SOURCE", ")", ";", "if", "(", "isSourcePackageFragment", ")", "{", "ICompilationUnit", "[", "]", "cus", "=", "packFrag", ".", "getCompilationUnits", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "cus", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "openables", ".", "add", "(", "cus", "[", "i", "]", ")", ";", "}", "}", "else", "{", "IClassFile", "[", "]", "classFiles", "=", "packFrag", ".", "getClassFiles", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "classFiles", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "openables", ".", "add", "(", "classFiles", "[", "i", "]", ")", ";", "}", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "private", "void", "injectAllOpenablesForPackageFragmentRoot", "(", "IPackageFragmentRoot", "root", ",", "ArrayList", "openables", ")", "{", "try", "{", "IJavaElement", "[", "]", "packFrags", "=", "root", ".", "getChildren", "(", ")", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "packFrags", ".", "length", ";", "k", "++", ")", "{", "IPackageFragment", "packFrag", "=", "(", "IPackageFragment", ")", "packFrags", "[", "k", "]", ";", "injectAllOpenablesForPackageFragment", "(", "packFrag", ",", "openables", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", ";", "}", "}", "}", "</s>" ]
3,740
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "Openable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "Region", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "TypeVector", ";", "public", "class", "RegionBasedTypeHierarchy", "extends", "TypeHierarchy", "{", "protected", "IRegion", "region", ";", "public", "RegionBasedTypeHierarchy", "(", "IRegion", "region", ",", "ICompilationUnit", "[", "]", "workingCopies", ",", "IType", "type", ",", "boolean", "computeSubtypes", ")", "{", "super", "(", "type", ",", "workingCopies", ",", "(", "IJavaSearchScope", ")", "null", ",", "computeSubtypes", ")", ";", "Region", "newRegion", "=", "new", "Region", "(", ")", "{", "public", "void", "add", "(", "IJavaElement", "element", ")", "{", "if", "(", "!", "contains", "(", "element", ")", ")", "{", "removeAllChildren", "(", "element", ")", ";", "this", ".", "rootElements", ".", "add", "(", "element", ")", ";", "if", "(", "element", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "JAVA_PROJECT", ")", "{", "try", "{", "IPackageFragmentRoot", "[", "]", "roots", "=", "(", "(", "IJavaProject", ")", "element", ")", ".", "getPackageFragmentRoots", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "roots", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "roots", "[", "i", "]", ".", "isArchive", "(", ")", "&&", "!", "this", ".", "rootElements", ".", "contains", "(", "roots", "[", "i", "]", ")", ")", "this", ".", "rootElements", ".", "add", "(", "roots", "[", "i", "]", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "this", ".", "rootElements", ".", "trimToSize", "(", ")", ";", "}", "}", "}", ";", "IJavaElement", "[", "]", "elements", "=", "region", ".", "getElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "elements", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "newRegion", ".", "add", "(", "elements", "[", "i", "]", ")", ";", "}", "this", ".", "region", "=", "newRegion", ";", "if", "(", "elements", ".", "length", ">", "0", ")", "this", ".", "project", "=", "elements", "[", "0", "]", ".", "getJavaProject", "(", ")", ";", "}", "protected", "void", "initializeRegions", "(", ")", "{", "super", ".", "initializeRegions", "(", ")", ";", "IJavaElement", "[", "]", "roots", "=", "this", ".", "region", ".", "getElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "roots", ".", "length", ";", "i", "++", ")", "{", "IJavaElement", "root", "=", "roots", "[", "i", "]", ";", "if", "(", "root", "instanceof", "IOpenable", ")", "{", "this", ".", "files", ".", "put", "(", "root", ",", "new", "ArrayList", "(", ")", ")", ";", "}", "else", "{", "Openable", "o", "=", "(", "Openable", ")", "(", "(", "JavaElement", ")", "root", ")", ".", "getOpenableParent", "(", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "this", ".", "files", ".", "put", "(", "o", ",", "new", "ArrayList", "(", ")", ")", ";", "}", "}", "checkCanceled", "(", ")", ";", "}", "}", "protected", "void", "compute", "(", ")", "throws", "JavaModelException", ",", "CoreException", "{", "HierarchyBuilder", "builder", "=", "new", "RegionBasedHierarchyBuilder", "(", "this", ")", ";", "builder", ".", "build", "(", "this", ".", "computeSubtypes", ")", ";", "}", "protected", "boolean", "isAffectedByOpenable", "(", "IJavaElementDelta", "delta", ",", "IJavaElement", "element", ",", "int", "eventType", ")", "{", "if", "(", "element", "instanceof", "CompilationUnit", "&&", "(", "(", "CompilationUnit", ")", "element", ")", ".", "isWorkingCopy", "(", ")", ")", "{", "return", "super", ".", "isAffectedByOpenable", "(", "delta", ",", "element", ",", "eventType", ")", ";", "}", "if", "(", "this", ".", "focusType", "==", "null", ")", "{", "return", "this", ".", "region", ".", "contains", "(", "element", ")", ";", "}", "else", "{", "return", "super", ".", "isAffectedByOpenable", "(", "delta", ",", "element", ",", "eventType", ")", ";", "}", "}", "public", "IJavaProject", "javaProject", "(", ")", "{", "return", "this", ".", "project", ";", "}", "public", "void", "pruneDeadBranches", "(", ")", "{", "pruneDeadBranches", "(", "getRootClasses", "(", ")", ")", ";", "pruneDeadBranches", "(", "getRootInterfaces", "(", ")", ")", ";", "}", "private", "boolean", "pruneDeadBranches", "(", "IType", "type", ")", "{", "TypeVector", "subtypes", "=", "(", "TypeVector", ")", "this", ".", "typeToSubtypes", ".", "get", "(", "type", ")", ";", "if", "(", "subtypes", "==", "null", ")", "return", "true", ";", "pruneDeadBranches", "(", "subtypes", ".", "copy", "(", ")", ".", "elements", "(", ")", ")", ";", "subtypes", "=", "(", "TypeVector", ")", "this", ".", "typeToSubtypes", ".", "get", "(", "type", ")", ";", "return", "(", "subtypes", "==", "null", "||", "subtypes", ".", "size", "==", "0", ")", ";", "}", "private", "void", "pruneDeadBranches", "(", "IType", "[", "]", "types", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "types", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "types", "[", "i", "]", ";", "if", "(", "pruneDeadBranches", "(", "type", ")", "&&", "!", "this", ".", "region", ".", "contains", "(", "type", ")", ")", "{", "removeType", "(", "type", ")", ";", "}", "}", "}", "protected", "void", "removeType", "(", "IType", "type", ")", "{", "IType", "[", "]", "subtypes", "=", "getSubtypes", "(", "type", ")", ";", "this", ".", "typeToSubtypes", ".", "remove", "(", "type", ")", ";", "if", "(", "subtypes", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "subtypes", ".", "length", ";", "i", "++", ")", "{", "removeType", "(", "subtypes", "[", "i", "]", ")", ";", "}", "}", "IType", "superclass", "=", "(", "IType", ")", "this", ".", "classToSuperclass", ".", "remove", "(", "type", ")", ";", "if", "(", "superclass", "!=", "null", ")", "{", "TypeVector", "types", "=", "(", "TypeVector", ")", "this", ".", "typeToSubtypes", ".", "get", "(", "superclass", ")", ";", "if", "(", "types", "!=", "null", ")", "types", ".", "remove", "(", "type", ")", ";", "}", "IType", "[", "]", "superinterfaces", "=", "(", "IType", "[", "]", ")", "this", ".", "typeToSuperInterfaces", ".", "remove", "(", "type", ")", ";", "if", "(", "superinterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "superinterfaces", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IType", "superinterface", "=", "superinterfaces", "[", "i", "]", ";", "TypeVector", "types", "=", "(", "TypeVector", ")", "this", ".", "typeToSubtypes", ".", "get", "(", "superinterface", ")", ";", "if", "(", "types", "!=", "null", ")", "types", ".", "remove", "(", "type", ")", ";", "}", "}", "this", ".", "interfaces", ".", "remove", "(", "type", ")", ";", "}", "}", "</s>" ]
3,741
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Hashtable", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "ISafeRunnable", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "SafeRunner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "IJavaSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "search", ".", "SearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "TypeHierarchy", "implements", "ITypeHierarchy", ",", "IElementChangedListener", "{", "public", "static", "boolean", "DEBUG", "=", "false", ";", "static", "final", "byte", "VERSION", "=", "0x0000", ";", "static", "final", "byte", "SEPARATOR1", "=", "'\\n'", ";", "static", "final", "byte", "SEPARATOR2", "=", "','", ";", "static", "final", "byte", "SEPARATOR3", "=", "'>'", ";", "static", "final", "byte", "SEPARATOR4", "=", "'\\r'", ";", "static", "final", "byte", "COMPUTE_SUBTYPES", "=", "0x0001", ";", "static", "final", "byte", "CLASS", "=", "0x0000", ";", "static", "final", "byte", "INTERFACE", "=", "0x0001", ";", "static", "final", "byte", "COMPUTED_FOR", "=", "0x0002", ";", "static", "final", "byte", "ROOT", "=", "0x0004", ";", "static", "final", "byte", "[", "]", "NO_FLAGS", "=", "new", "byte", "[", "]", "{", "}", ";", "static", "final", "int", "SIZE", "=", "10", ";", "protected", "IJavaProject", "project", ";", "protected", "IType", "focusType", ";", "protected", "ICompilationUnit", "[", "]", "workingCopies", ";", "protected", "Map", "classToSuperclass", ";", "protected", "Map", "typeToSuperInterfaces", ";", "protected", "Map", "typeToSubtypes", ";", "protected", "Map", "typeFlags", ";", "protected", "TypeVector", "rootClasses", "=", "new", "TypeVector", "(", ")", ";", "protected", "ArrayList", "interfaces", "=", "new", "ArrayList", "(", "10", ")", ";", "public", "ArrayList", "missingTypes", "=", "new", "ArrayList", "(", "4", ")", ";", "protected", "static", "final", "IType", "[", "]", "NO_TYPE", "=", "new", "IType", "[", "0", "]", ";", "protected", "IProgressMonitor", "progressMonitor", "=", "null", ";", "protected", "ArrayList", "changeListeners", "=", "null", ";", "public", "Map", "files", "=", "null", ";", "protected", "Region", "packageRegion", "=", "null", ";", "protected", "Region", "projectRegion", "=", "null", ";", "protected", "boolean", "computeSubtypes", ";", "IJavaSearchScope", "scope", ";", "public", "boolean", "needsRefresh", "=", "true", ";", "protected", "ChangeCollector", "changeCollector", ";", "public", "TypeHierarchy", "(", ")", "{", "}", "public", "TypeHierarchy", "(", "IType", "type", ",", "ICompilationUnit", "[", "]", "workingCopies", ",", "IJavaProject", "project", ",", "boolean", "computeSubtypes", ")", "{", "this", "(", "type", ",", "workingCopies", ",", "SearchEngine", ".", "createJavaSearchScope", "(", "new", "IJavaElement", "[", "]", "{", "project", "}", ")", ",", "computeSubtypes", ")", ";", "this", ".", "project", "=", "project", ";", "}", "public", "TypeHierarchy", "(", "IType", "type", ",", "ICompilationUnit", "[", "]", "workingCopies", ",", "IJavaSearchScope", "scope", ",", "boolean", "computeSubtypes", ")", "{", "this", ".", "focusType", "=", "type", "==", "null", "?", "null", ":", "(", "IType", ")", "(", "(", "JavaElement", ")", "type", ")", ".", "unresolved", "(", ")", ";", "this", ".", "workingCopies", "=", "workingCopies", ";", "this", ".", "computeSubtypes", "=", "computeSubtypes", ";", "this", ".", "scope", "=", "scope", ";", "}", "protected", "void", "initializeRegions", "(", ")", "{", "IType", "[", "]", "allTypes", "=", "getAllTypes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "allTypes", ".", "length", ";", "i", "++", ")", "{", "IType", "type", "=", "allTypes", "[", "i", "]", ";", "Openable", "o", "=", "(", "Openable", ")", "(", "(", "JavaElement", ")", "type", ")", ".", "getOpenableParent", "(", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "ArrayList", "types", "=", "(", "ArrayList", ")", "this", ".", "files", ".", "get", "(", "o", ")", ";", "if", "(", "types", "==", "null", ")", "{", "types", "=", "new", "ArrayList", "(", ")", ";", "this", ".", "files", ".", "put", "(", "o", ",", "types", ")", ";", "}", "types", ".", "add", "(", "type", ")", ";", "}", "IPackageFragment", "pkg", "=", "type", ".", "getPackageFragment", "(", ")", ";", "this", ".", "packageRegion", ".", "add", "(", "pkg", ")", ";", "IJavaProject", "declaringProject", "=", "type", ".", "getJavaProject", "(", ")", ";", "if", "(", "declaringProject", "!=", "null", ")", "{", "this", ".", "projectRegion", ".", "add", "(", "declaringProject", ")", ";", "}", "checkCanceled", "(", ")", ";", "}", "}", "private", "void", "addAllCheckingDuplicates", "(", "ArrayList", "list", ",", "IType", "[", "]", "collection", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "collection", ".", "length", ";", "i", "++", ")", "{", "IType", "element", "=", "collection", "[", "i", "]", ";", "if", "(", "!", "list", ".", "contains", "(", "element", ")", ")", "{", "list", ".", "add", "(", "element", ")", ";", "}", "}", "}", "protected", "void", "addInterface", "(", "IType", "type", ")", "{", "this", ".", "interfaces", ".", "add", "(", "type", ")", ";", "}", "protected", "void", "addRootClass", "(", "IType", "type", ")", "{", "if", "(", "this", ".", "rootClasses", ".", "contains", "(", "type", ")", ")", "return", ";", "this", ".", "rootClasses", ".", "add", "(", "type", ")", ";", "}", "protected", "void", "addSubtype", "(", "IType", "type", ",", "IType", "subtype", ")", "{", "TypeVector", "subtypes", "=", "(", "TypeVector", ")", "this", ".", "typeToSubtypes", ".", "get", "(", "type", ")", ";", "if", "(", "subtypes", "==", "null", ")", "{", "subtypes", "=", "new", "TypeVector", "(", ")", ";", "this", ".", "typeToSubtypes", ".", "put", "(", "type", ",", "subtypes", ")", ";", "}", "if", "(", "!", "subtypes", ".", "contains", "(", "subtype", ")", ")", "{", "subtypes", ".", "add", "(", "subtype", ")", ";", "}", "}", "public", "synchronized", "void", "addTypeHierarchyChangedListener", "(", "ITypeHierarchyChangedListener", "listener", ")", "{", "ArrayList", "listeners", "=", "this", ".", "changeListeners", ";", "if", "(", "listeners", "==", "null", ")", "{", "this", ".", "changeListeners", "=", "listeners", "=", "new", "ArrayList", "(", ")", ";", "}", "if", "(", "listeners", ".", "size", "(", ")", "==", "0", ")", "{", "JavaCore", ".", "addElementChangedListener", "(", "this", ")", ";", "}", "if", "(", "listeners", ".", "indexOf", "(", "listener", ")", "==", "-", "1", ")", "{", "listeners", ".", "add", "(", "listener", ")", ";", "}", "}", "private", "static", "Integer", "bytesToFlags", "(", "byte", "[", "]", "bytes", ")", "{", "if", "(", "bytes", "!=", "null", "&&", "bytes", ".", "length", ">", "0", ")", "{", "return", "new", "Integer", "(", "new", "String", "(", "bytes", ")", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "public", "void", "cacheFlags", "(", "IType", "type", ",", "int", "flags", ")", "{", "this", ".", "typeFlags", ".", "put", "(", "type", ",", "new", "Integer", "(", "flags", ")", ")", ";", "}", "protected", "void", "cacheSuperclass", "(", "IType", "type", ",", "IType", "superclass", ")", "{", "if", "(", "superclass", "!=", "null", ")", "{", "this", ".", "classToSuperclass", ".", "put", "(", "type", ",", "superclass", ")", ";", "addSubtype", "(", "superclass", ",", "type", ")", ";", "}", "}", "protected", "void", "cacheSuperInterfaces", "(", "IType", "type", ",", "IType", "[", "]", "superinterfaces", ")", "{", "this", ".", "typeToSuperInterfaces", ".", "put", "(", "type", ",", "superinterfaces", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "superinterfaces", ".", "length", ";", "i", "++", ")", "{", "IType", "superinterface", "=", "superinterfaces", "[", "i", "]", ";", "if", "(", "superinterface", "!=", "null", ")", "{", "addSubtype", "(", "superinterface", ",", "type", ")", ";", "}", "}", "}", "protected", "void", "checkCanceled", "(", ")", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", "&&", "this", ".", "progressMonitor", ".", "isCanceled", "(", ")", ")", "{", "throw", "new", "OperationCanceledException", "(", ")", ";", "}", "}", "protected", "void", "compute", "(", ")", "throws", "JavaModelException", ",", "CoreException", "{", "if", "(", "this", ".", "focusType", "!=", "null", ")", "{", "HierarchyBuilder", "builder", "=", "new", "IndexBasedHierarchyBuilder", "(", "this", ",", "this", ".", "scope", ")", ";", "builder", ".", "build", "(", "this", ".", "computeSubtypes", ")", ";", "}", "}", "public", "boolean", "contains", "(", "IType", "type", ")", "{", "if", "(", "this", ".", "classToSuperclass", ".", "get", "(", "type", ")", "!=", "null", ")", "{", "return", "true", ";", "}", "if", "(", "this", ".", "rootClasses", ".", "contains", "(", "type", ")", ")", "return", "true", ";", "if", "(", "this", ".", "interfaces", ".", "contains", "(", "type", ")", ")", "return", "true", ";", "return", "false", ";", "}", "public", "void", "elementChanged", "(", "ElementChangedEvent", "event", ")", "{", "if", "(", "this", ".", "needsRefresh", ")", "return", ";", "if", "(", "isAffected", "(", "event", ".", "getDelta", "(", ")", ",", "event", ".", "getType", "(", ")", ")", ")", "{", "this", ".", "needsRefresh", "=", "true", ";", "fireChange", "(", ")", ";", "}", "}", "public", "boolean", "exists", "(", ")", "{", "if", "(", "!", "this", ".", "needsRefresh", ")", "return", "true", ";", "return", "(", "this", ".", "focusType", "==", "null", "||", "this", ".", "focusType", ".", "exists", "(", ")", ")", "&&", "javaProject", "(", ")", ".", "exists", "(", ")", ";", "}", "public", "void", "fireChange", "(", ")", "{", "ArrayList", "listeners", "=", "getClonedChangeListeners", "(", ")", ";", "if", "(", "listeners", "==", "null", ")", "{", "return", ";", "}", "if", "(", "DEBUG", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"]\"", ")", ";", "if", "(", "this", ".", "focusType", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "(", "(", "JavaElement", ")", "this", ".", "focusType", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listeners", ".", "size", "(", ")", ";", "i", "++", ")", "{", "final", "ITypeHierarchyChangedListener", "listener", "=", "(", "ITypeHierarchyChangedListener", ")", "listeners", ".", "get", "(", "i", ")", ";", "SafeRunner", ".", "run", "(", "new", "ISafeRunnable", "(", ")", "{", "public", "void", "handleException", "(", "Throwable", "exception", ")", "{", "Util", ".", "log", "(", "exception", ",", "\"\"", ")", ";", "}", "public", "void", "run", "(", ")", "throws", "Exception", "{", "listener", ".", "typeHierarchyChanged", "(", "TypeHierarchy", ".", "this", ")", ";", "}", "}", ")", ";", "}", "}", "private", "synchronized", "ArrayList", "getClonedChangeListeners", "(", ")", "{", "ArrayList", "listeners", "=", "this", ".", "changeListeners", ";", "if", "(", "listeners", "==", "null", ")", "{", "return", "null", ";", "}", "return", "(", "ArrayList", ")", "listeners", ".", "clone", "(", ")", ";", "}", "private", "static", "byte", "[", "]", "flagsToBytes", "(", "Integer", "flags", ")", "{", "if", "(", "flags", "!=", "null", ")", "{", "return", "flags", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ";", "}", "else", "{", "return", "NO_FLAGS", ";", "}", "}", "public", "IType", "[", "]", "getAllClasses", "(", ")", "{", "TypeVector", "classes", "=", "this", ".", "rootClasses", ".", "copy", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "this", ".", "classToSuperclass", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "classes", ".", "add", "(", "(", "IType", ")", "iter", ".", "next", "(", ")", ")", ";", "}", "return", "classes", ".", "elements", "(", ")", ";", "}", "public", "IType", "[", "]", "getAllInterfaces", "(", ")", "{", "IType", "[", "]", "collection", "=", "new", "IType", "[", "this", ".", "interfaces", ".", "size", "(", ")", "]", ";", "this", ".", "interfaces", ".", "toArray", "(", "collection", ")", ";", "return", "collection", ";", "}", "public", "IType", "[", "]", "getAllSubtypes", "(", "IType", "type", ")", "{", "return", "getAllSubtypesForType", "(", "type", ")", ";", "}", "private", "IType", "[", "]", "getAllSubtypesForType", "(", "IType", "type", ")", "{", "ArrayList", "subTypes", "=", "new", "ArrayList", "(", ")", ";", "getAllSubtypesForType0", "(", "type", ",", "subTypes", ")", ";", "IType", "[", "]", "subClasses", "=", "new", "IType", "[", "subTypes", ".", "size", "(", ")", "]", ";", "subTypes", ".", "toArray", "(", "subClasses", ")", ";", "return", "subClasses", ";", "}", "private", "void", "getAllSubtypesForType0", "(", "IType", "type", ",", "ArrayList", "subs", ")", "{", "IType", "[", "]", "subTypes", "=", "getSubtypesForType", "(", "type", ")", ";", "if", "(", "subTypes", ".", "length", "!=", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "subTypes", ".", "length", ";", "i", "++", ")", "{", "IType", "subType", "=", "subTypes", "[", "i", "]", ";", "subs", ".", "add", "(", "subType", ")", ";", "getAllSubtypesForType0", "(", "subType", ",", "subs", ")", ";", "}", "}", "}", "public", "IType", "[", "]", "getAllSuperclasses", "(", "IType", "type", ")", "{", "IType", "superclass", "=", "getSuperclass", "(", "type", ")", ";", "TypeVector", "supers", "=", "new", "TypeVector", "(", ")", ";", "while", "(", "superclass", "!=", "null", ")", "{", "supers", ".", "add", "(", "superclass", ")", ";", "superclass", "=", "getSuperclass", "(", "superclass", ")", ";", "}", "return", "supers", ".", "elements", "(", ")", ";", "}", "public", "IType", "[", "]", "getAllSuperInterfaces", "(", "IType", "type", ")", "{", "ArrayList", "supers", "=", "getAllSuperInterfaces0", "(", "type", ",", "null", ")", ";", "if", "(", "supers", "==", "null", ")", "return", "NO_TYPE", ";", "IType", "[", "]", "superinterfaces", "=", "new", "IType", "[", "supers", ".", "size", "(", ")", "]", ";", "supers", ".", "toArray", "(", "superinterfaces", ")", ";", "return", "superinterfaces", ";", "}", "private", "ArrayList", "getAllSuperInterfaces0", "(", "IType", "type", ",", "ArrayList", "supers", ")", "{", "IType", "[", "]", "superinterfaces", "=", "(", "IType", "[", "]", ")", "this", ".", "typeToSuperInterfaces", ".", "get", "(", "type", ")", ";", "if", "(", "superinterfaces", "==", "null", ")", "return", "supers", ";", "if", "(", "superinterfaces", ".", "length", "!=", "0", ")", "{", "if", "(", "supers", "==", "null", ")", "supers", "=", "new", "ArrayList", "(", ")", ";", "addAllCheckingDuplicates", "(", "supers", ",", "superinterfaces", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "superinterfaces", ".", "length", ";", "i", "++", ")", "{", "supers", "=", "getAllSuperInterfaces0", "(", "superinterfaces", "[", "i", "]", ",", "supers", ")", ";", "}", "}", "IType", "superclass", "=", "(", "IType", ")", "this", ".", "classToSuperclass", ".", "get", "(", "type", ")", ";", "if", "(", "superclass", "!=", "null", ")", "{", "supers", "=", "getAllSuperInterfaces0", "(", "superclass", ",", "supers", ")", ";", "}", "return", "supers", ";", "}", "public", "IType", "[", "]", "getAllSupertypes", "(", "IType", "type", ")", "{", "ArrayList", "supers", "=", "getAllSupertypes0", "(", "type", ",", "null", ")", ";", "if", "(", "supers", "==", "null", ")", "return", "NO_TYPE", ";", "IType", "[", "]", "supertypes", "=", "new", "IType", "[", "supers", ".", "size", "(", ")", "]", ";", "supers", ".", "toArray", "(", "supertypes", ")", ";", "return", "supertypes", ";", "}", "private", "ArrayList", "getAllSupertypes0", "(", "IType", "type", ",", "ArrayList", "supers", ")", "{", "IType", "[", "]", "superinterfaces", "=", "(", "IType", "[", "]", ")", "this", ".", "typeToSuperInterfaces", ".", "get", "(", "type", ")", ";", "if", "(", "superinterfaces", "==", "null", ")", "return", "supers", ";", "if", "(", "superinterfaces", ".", "length", "!=", "0", ")", "{", "if", "(", "supers", "==", "null", ")", "supers", "=", "new", "ArrayList", "(", ")", ";", "addAllCheckingDuplicates", "(", "supers", ",", "superinterfaces", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "superinterfaces", ".", "length", ";", "i", "++", ")", "{", "supers", "=", "getAllSuperInterfaces0", "(", "superinterfaces", "[", "i", "]", ",", "supers", ")", ";", "}", "}", "IType", "superclass", "=", "(", "IType", ")", "this", ".", "classToSuperclass", ".", "get", "(", "type", ")", ";", "if", "(", "superclass", "!=", "null", ")", "{", "if", "(", "supers", "==", "null", ")", "supers", "=", "new", "ArrayList", "(", ")", ";", "supers", ".", "add", "(", "superclass", ")", ";", "supers", "=", "getAllSupertypes0", "(", "superclass", ",", "supers", ")", ";", "}", "return", "supers", ";", "}", "public", "IType", "[", "]", "getAllTypes", "(", ")", "{", "IType", "[", "]", "classes", "=", "getAllClasses", "(", ")", ";", "int", "classesLength", "=", "classes", ".", "length", ";", "IType", "[", "]", "allInterfaces", "=", "getAllInterfaces", "(", ")", ";", "int", "interfacesLength", "=", "allInterfaces", ".", "length", ";", "IType", "[", "]", "all", "=", "new", "IType", "[", "classesLength", "+", "interfacesLength", "]", ";", "System", ".", "arraycopy", "(", "classes", ",", "0", ",", "all", ",", "0", ",", "classesLength", ")", ";", "System", ".", "arraycopy", "(", "allInterfaces", ",", "0", ",", "all", ",", "classesLength", ",", "interfacesLength", ")", ";", "return", "all", ";", "}", "public", "int", "getCachedFlags", "(", "IType", "type", ")", "{", "Integer", "flagObject", "=", "(", "Integer", ")", "this", ".", "typeFlags", ".", "get", "(", "type", ")", ";", "if", "(", "flagObject", "!=", "null", ")", "{", "return", "flagObject", ".", "intValue", "(", ")", ";", "}", "return", "-", "1", ";", "}", "public", "IType", "[", "]", "getExtendingInterfaces", "(", "IType", "type", ")", "{", "if", "(", "!", "isInterface", "(", "type", ")", ")", "return", "NO_TYPE", ";", "return", "getExtendingInterfaces0", "(", "type", ")", ";", "}", "private", "IType", "[", "]", "getExtendingInterfaces0", "(", "IType", "extendedInterface", ")", "{", "Iterator", "iter", "=", "this", ".", "typeToSuperInterfaces", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "ArrayList", "interfaceList", "=", "new", "ArrayList", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iter", ".", "next", "(", ")", ";", "IType", "type", "=", "(", "IType", ")", "entry", ".", "getKey", "(", ")", ";", "if", "(", "!", "isInterface", "(", "type", ")", ")", "{", "continue", ";", "}", "IType", "[", "]", "superInterfaces", "=", "(", "IType", "[", "]", ")", "entry", ".", "getValue", "(", ")", ";", "if", "(", "superInterfaces", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "superInterfaces", ".", "length", ";", "i", "++", ")", "{", "IType", "superInterface", "=", "superInterfaces", "[", "i", "]", ";", "if", "(", "superInterface", ".", "equals", "(", "extendedInterface", ")", ")", "{", "interfaceList", ".", "add", "(", "type", ")", ";", "}", "}", "}", "}", "IType", "[", "]", "extendingInterfaces", "=", "new", "IType", "[", "interfaceList", ".", "size", "(", ")", "]", ";", "interfaceList", ".", "toArray", "(", "extendingInterfaces", ")", ";", "return", "extendingInterfaces", ";", "}", "public", "IType", "[", "]", "getImplementingClasses", "(", "IType", "type", ")", "{", "if", "(", "!", "isInterface", "(", "type", ")", ")", "{", "return", "NO_TYPE", ";", "}", "return", "getImplementingClasses0", "(", "type", ")", ";", "}", "private", "IType", "[", "]", "getImplementingClasses0", "(", "IType", "interfce", ")", "{", "Iterator", "iter", "=", "this", ".", "typeToSuperInterfaces", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "ArrayList", "iMenters", "=", "new", "ArrayList", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iter", ".", "next", "(", ")", ";", "IType", "type", "=", "(", "IType", ")", "entry", ".", "getKey", "(", ")", ";", "if", "(", "isInterface", "(", "type", ")", ")", "{", "continue", ";", "}", "IType", "[", "]", "types", "=", "(", "IType", "[", "]", ")", "entry", ".", "getValue", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "IType", "iFace", "=", "types", "[", "i", "]", ";", "if", "(", "iFace", ".", "equals", "(", "interfce", ")", ")", "{", "iMenters", ".", "add", "(", "type", ")", ";", "}", "}", "}", "IType", "[", "]", "implementers", "=", "new", "IType", "[", "iMenters", ".", "size", "(", ")", "]", ";", "iMenters", ".", "toArray", "(", "implementers", ")", ";", "return", "implementers", ";", "}", "public", "IType", "[", "]", "getRootClasses", "(", ")", "{", "return", "this", ".", "rootClasses", ".", "elements", "(", ")", ";", "}", "public", "IType", "[", "]", "getRootInterfaces", "(", ")", "{", "IType", "[", "]", "allInterfaces", "=", "getAllInterfaces", "(", ")", ";", "IType", "[", "]", "roots", "=", "new", "IType", "[", "allInterfaces", ".", "length", "]", ";", "int", "rootNumber", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "allInterfaces", ".", "length", ";", "i", "++", ")", "{", "IType", "[", "]", "superInterfaces", "=", "getSuperInterfaces", "(", "allInterfaces", "[", "i", "]", ")", ";", "if", "(", "superInterfaces", "==", "null", "||", "superInterfaces", ".", "length", "==", "0", ")", "{", "roots", "[", "rootNumber", "++", "]", "=", "allInterfaces", "[", "i", "]", ";", "}", "}", "IType", "[", "]", "result", "=", "new", "IType", "[", "rootNumber", "]", ";", "if", "(", "result", ".", "length", ">", "0", ")", "{", "System", ".", "arraycopy", "(", "roots", ",", "0", ",", "result", ",", "0", ",", "rootNumber", ")", ";", "}", "return", "result", ";", "}", "public", "IType", "[", "]", "getSubclasses", "(", "IType", "type", ")", "{", "if", "(", "isInterface", "(", "type", ")", ")", "{", "return", "NO_TYPE", ";", "}", "TypeVector", "vector", "=", "(", "TypeVector", ")", "this", ".", "typeToSubtypes", ".", "get", "(", "type", ")", ";", "if", "(", "vector", "==", "null", ")", "return", "NO_TYPE", ";", "else", "return", "vector", ".", "elements", "(", ")", ";", "}", "public", "IType", "[", "]", "getSubtypes", "(", "IType", "type", ")", "{", "return", "getSubtypesForType", "(", "type", ")", ";", "}", "private", "IType", "[", "]", "getSubtypesForType", "(", "IType", "type", ")", "{", "TypeVector", "vector", "=", "(", "TypeVector", ")", "this", ".", "typeToSubtypes", ".", "get", "(", "type", ")", ";", "if", "(", "vector", "==", "null", ")", "return", "NO_TYPE", ";", "else", "return", "vector", ".", "elements", "(", ")", ";", "}", "public", "IType", "getSuperclass", "(", "IType", "type", ")", "{", "if", "(", "isInterface", "(", "type", ")", ")", "{", "return", "null", ";", "}", "return", "(", "IType", ")", "this", ".", "classToSuperclass", ".", "get", "(", "type", ")", ";", "}", "public", "IType", "[", "]", "getSuperInterfaces", "(", "IType", "type", ")", "{", "IType", "[", "]", "types", "=", "(", "IType", "[", "]", ")", "this", ".", "typeToSuperInterfaces", ".", "get", "(", "type", ")", ";", "if", "(", "types", "==", "null", ")", "{", "return", "NO_TYPE", ";", "}", "return", "types", ";", "}", "public", "IType", "[", "]", "getSupertypes", "(", "IType", "type", ")", "{", "IType", "superclass", "=", "getSuperclass", "(", "type", ")", ";", "if", "(", "superclass", "==", "null", ")", "{", "return", "getSuperInterfaces", "(", "type", ")", ";", "}", "else", "{", "TypeVector", "superTypes", "=", "new", "TypeVector", "(", "getSuperInterfaces", "(", "type", ")", ")", ";", "superTypes", ".", "add", "(", "superclass", ")", ";", "return", "superTypes", ".", "elements", "(", ")", ";", "}", "}", "public", "IType", "getType", "(", ")", "{", "return", "this", ".", "focusType", ";", "}", "protected", "IType", "[", "]", "growAndAddToArray", "(", "IType", "[", "]", "array", ",", "IType", "[", "]", "additions", ")", "{", "if", "(", "array", "==", "null", "||", "array", ".", "length", "==", "0", ")", "{", "return", "additions", ";", "}", "IType", "[", "]", "old", "=", "array", ";", "array", "=", "new", "IType", "[", "old", ".", "length", "+", "additions", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "old", ",", "0", ",", "array", ",", "0", ",", "old", ".", "length", ")", ";", "System", ".", "arraycopy", "(", "additions", ",", "0", ",", "array", ",", "old", ".", "length", ",", "additions", ".", "length", ")", ";", "return", "array", ";", "}", "protected", "IType", "[", "]", "growAndAddToArray", "(", "IType", "[", "]", "array", ",", "IType", "addition", ")", "{", "if", "(", "array", "==", "null", "||", "array", ".", "length", "==", "0", ")", "{", "return", "new", "IType", "[", "]", "{", "addition", "}", ";", "}", "IType", "[", "]", "old", "=", "array", ";", "array", "=", "new", "IType", "[", "old", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "old", ",", "0", ",", "array", ",", "0", ",", "old", ".", "length", ")", ";", "array", "[", "old", ".", "length", "]", "=", "addition", ";", "return", "array", ";", "}", "public", "boolean", "hasFineGrainChanges", "(", ")", "{", "ChangeCollector", "collector", "=", "this", ".", "changeCollector", ";", "return", "collector", "!=", "null", "&&", "collector", ".", "needsRefresh", "(", ")", ";", "}", "private", "boolean", "hasSubtypeNamed", "(", "String", "simpleName", ")", "{", "if", "(", "this", ".", "focusType", "!=", "null", "&&", "this", ".", "focusType", ".", "getElementName", "(", ")", ".", "equals", "(", "simpleName", ")", ")", "{", "return", "true", ";", "}", "IType", "[", "]", "types", "=", "this", ".", "focusType", "==", "null", "?", "getAllTypes", "(", ")", ":", "getAllSubtypes", "(", "this", ".", "focusType", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "types", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "types", "[", "i", "]", ".", "getElementName", "(", ")", ".", "equals", "(", "simpleName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "private", "boolean", "hasTypeNamed", "(", "String", "simpleName", ")", "{", "IType", "[", "]", "types", "=", "getAllTypes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "types", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "types", "[", "i", "]", ".", "getElementName", "(", ")", ".", "equals", "(", "simpleName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "boolean", "includesTypeOrSupertype", "(", "IType", "type", ")", "{", "try", "{", "if", "(", "hasTypeNamed", "(", "type", ".", "getElementName", "(", ")", ")", ")", "return", "true", ";", "String", "superclassName", "=", "type", ".", "getSuperclassName", "(", ")", ";", "if", "(", "superclassName", "!=", "null", ")", "{", "int", "lastSeparator", "=", "superclassName", ".", "lastIndexOf", "(", "'.'", ")", ";", "String", "simpleName", "=", "superclassName", ".", "substring", "(", "lastSeparator", "+", "1", ")", ";", "if", "(", "hasTypeNamed", "(", "simpleName", ")", ")", "return", "true", ";", "}", "String", "[", "]", "superinterfaceNames", "=", "type", ".", "getSuperInterfaceNames", "(", ")", ";", "if", "(", "superinterfaceNames", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "superinterfaceNames", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "superinterfaceName", "=", "superinterfaceNames", "[", "i", "]", ";", "int", "lastSeparator", "=", "superinterfaceName", ".", "lastIndexOf", "(", "'.'", ")", ";", "String", "simpleName", "=", "superinterfaceName", ".", "substring", "(", "lastSeparator", "+", "1", ")", ";", "if", "(", "hasTypeNamed", "(", "simpleName", ")", ")", "return", "true", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "return", "false", ";", "}", "protected", "void", "initialize", "(", "int", "size", ")", "{", "if", "(", "size", "<", "10", ")", "{", "size", "=", "10", ";", "}", "int", "smallSize", "=", "(", "size", "/", "2", ")", ";", "this", ".", "classToSuperclass", "=", "new", "HashMap", "(", "size", ")", ";", "this", ".", "interfaces", "=", "new", "ArrayList", "(", "smallSize", ")", ";", "this", ".", "missingTypes", "=", "new", "ArrayList", "(", "smallSize", ")", ";", "this", ".", "rootClasses", "=", "new", "TypeVector", "(", ")", ";", "this", ".", "typeToSubtypes", "=", "new", "HashMap", "(", "smallSize", ")", ";", "this", ".", "typeToSuperInterfaces", "=", "new", "HashMap", "(", "smallSize", ")", ";", "this", ".", "typeFlags", "=", "new", "HashMap", "(", "smallSize", ")", ";", "this", ".", "projectRegion", "=", "new", "Region", "(", ")", ";", "this", ".", "packageRegion", "=", "new", "Region", "(", ")", ";", "this", ".", "files", "=", "new", "HashMap", "(", "5", ")", ";", "}", "public", "synchronized", "boolean", "isAffected", "(", "IJavaElementDelta", "delta", ",", "int", "eventType", ")", "{", "IJavaElement", "element", "=", "delta", ".", "getElement", "(", ")", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "return", "isAffectedByJavaModel", "(", "delta", ",", "element", ",", "eventType", ")", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "return", "isAffectedByJavaProject", "(", "delta", ",", "element", ",", "eventType", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "return", "isAffectedByPackageFragmentRoot", "(", "delta", ",", "element", ",", "eventType", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "return", "isAffectedByPackageFragment", "(", "delta", ",", "(", "PackageFragment", ")", "element", ",", "eventType", ")", ";", "case", "IJavaElement", ".", "CLASS_FILE", ":", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "return", "isAffectedByOpenable", "(", "delta", ",", "element", ",", "eventType", ")", ";", "}", "return", "false", ";", "}", "private", "boolean", "isAffectedByChildren", "(", "IJavaElementDelta", "delta", ",", "int", "eventType", ")", "{", "if", "(", "(", "delta", ".", "getFlags", "(", ")", "&", "IJavaElementDelta", ".", "F_CHILDREN", ")", ">", "0", ")", "{", "IJavaElementDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "if", "(", "isAffected", "(", "children", "[", "i", "]", ",", "eventType", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "private", "boolean", "isAffectedByJavaModel", "(", "IJavaElementDelta", "delta", ",", "IJavaElement", "element", ",", "int", "eventType", ")", "{", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "case", "IJavaElementDelta", ".", "REMOVED", ":", "return", "element", ".", "equals", "(", "javaProject", "(", ")", ".", "getJavaModel", "(", ")", ")", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "return", "isAffectedByChildren", "(", "delta", ",", "eventType", ")", ";", "}", "return", "false", ";", "}", "private", "boolean", "isAffectedByJavaProject", "(", "IJavaElementDelta", "delta", ",", "IJavaElement", "element", ",", "int", "eventType", ")", "{", "int", "kind", "=", "delta", ".", "getKind", "(", ")", ";", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "(", "flags", "&", "IJavaElementDelta", ".", "F_OPENED", ")", "!=", "0", ")", "{", "kind", "=", "IJavaElementDelta", ".", "ADDED", ";", "}", "if", "(", "(", "flags", "&", "IJavaElementDelta", ".", "F_CLOSED", ")", "!=", "0", ")", "{", "kind", "=", "IJavaElementDelta", ".", "REMOVED", ";", "}", "switch", "(", "kind", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "try", "{", "IClasspathEntry", "[", "]", "classpath", "=", "(", "(", "JavaProject", ")", "javaProject", "(", ")", ")", ".", "getExpandedClasspath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "classpath", ".", "length", ";", "i", "++", ")", "{", "if", "(", "classpath", "[", "i", "]", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_PROJECT", "&&", "classpath", "[", "i", "]", ".", "getPath", "(", ")", ".", "equals", "(", "element", ".", "getPath", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "this", ".", "focusType", "!=", "null", ")", "{", "classpath", "=", "(", "(", "JavaProject", ")", "element", ")", ".", "getExpandedClasspath", "(", ")", ";", "IPath", "hierarchyProject", "=", "javaProject", "(", ")", ".", "getPath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "classpath", ".", "length", ";", "i", "++", ")", "{", "if", "(", "classpath", "[", "i", "]", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_PROJECT", "&&", "classpath", "[", "i", "]", ".", "getPath", "(", ")", ".", "equals", "(", "hierarchyProject", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "case", "IJavaElementDelta", ".", "REMOVED", ":", "IJavaElement", "[", "]", "pkgs", "=", "this", ".", "packageRegion", ".", "getElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pkgs", ".", "length", ";", "i", "++", ")", "{", "IJavaProject", "javaProject", "=", "pkgs", "[", "i", "]", ".", "getJavaProject", "(", ")", ";", "if", "(", "javaProject", "!=", "null", "&&", "javaProject", ".", "equals", "(", "element", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "return", "isAffectedByChildren", "(", "delta", ",", "eventType", ")", ";", "}", "return", "false", ";", "}", "private", "boolean", "isAffectedByPackageFragment", "(", "IJavaElementDelta", "delta", ",", "PackageFragment", "element", ",", "int", "eventType", ")", "{", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "return", "this", ".", "projectRegion", ".", "contains", "(", "element", ")", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "return", "packageRegionContainsSamePackageFragment", "(", "element", ")", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "return", "isAffectedByChildren", "(", "delta", ",", "eventType", ")", ";", "}", "return", "false", ";", "}", "private", "boolean", "isAffectedByPackageFragmentRoot", "(", "IJavaElementDelta", "delta", ",", "IJavaElement", "element", ",", "int", "eventType", ")", "{", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "ADDED", ":", "return", "this", ".", "projectRegion", ".", "contains", "(", "element", ")", ";", "case", "IJavaElementDelta", ".", "REMOVED", ":", "case", "IJavaElementDelta", ".", "CHANGED", ":", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "(", "flags", "&", "IJavaElementDelta", ".", "F_ADDED_TO_CLASSPATH", ")", ">", "0", ")", "{", "if", "(", "this", ".", "projectRegion", "!=", "null", ")", "{", "IPackageFragmentRoot", "root", "=", "(", "IPackageFragmentRoot", ")", "element", ";", "IPath", "rootPath", "=", "root", ".", "getPath", "(", ")", ";", "IJavaElement", "[", "]", "elements", "=", "this", ".", "projectRegion", ".", "getElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "elements", "[", "i", "]", ";", "try", "{", "IClasspathEntry", "entry", "=", "javaProject", ".", "getClasspathEntryFor", "(", "rootPath", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "return", "true", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "}", "if", "(", "(", "flags", "&", "IJavaElementDelta", ".", "F_REMOVED_FROM_CLASSPATH", ")", ">", "0", "||", "(", "flags", "&", "IJavaElementDelta", ".", "F_ARCHIVE_CONTENT_CHANGED", ")", ">", "0", ")", "{", "IJavaElement", "[", "]", "pkgs", "=", "this", ".", "packageRegion", ".", "getElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pkgs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "pkgs", "[", "i", "]", ".", "getParent", "(", ")", ".", "equals", "(", "element", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "}", "return", "isAffectedByChildren", "(", "delta", ",", "eventType", ")", ";", "}", "protected", "boolean", "isAffectedByOpenable", "(", "IJavaElementDelta", "delta", ",", "IJavaElement", "element", ",", "int", "eventType", ")", "{", "if", "(", "element", "instanceof", "CompilationUnit", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "element", ";", "ICompilationUnit", "focusCU", "=", "this", ".", "focusType", "!=", "null", "?", "this", ".", "focusType", ".", "getCompilationUnit", "(", ")", ":", "null", ";", "if", "(", "focusCU", "!=", "null", "&&", "focusCU", ".", "getOwner", "(", ")", "!=", "cu", ".", "getOwner", "(", ")", ")", "return", "false", ";", "if", "(", "eventType", "!=", "ElementChangedEvent", ".", "POST_RECONCILE", "&&", "!", "cu", ".", "isPrimary", "(", ")", "&&", "delta", ".", "getKind", "(", ")", "==", "IJavaElementDelta", ".", "ADDED", ")", "return", "false", ";", "ChangeCollector", "collector", "=", "this", ".", "changeCollector", ";", "if", "(", "collector", "==", "null", ")", "{", "collector", "=", "new", "ChangeCollector", "(", "this", ")", ";", "}", "try", "{", "collector", ".", "addChange", "(", "cu", ",", "delta", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "DEBUG", ")", "e", ".", "printStackTrace", "(", ")", ";", "}", "if", "(", "cu", ".", "isWorkingCopy", "(", ")", "&&", "eventType", "==", "ElementChangedEvent", ".", "POST_RECONCILE", ")", "{", "this", ".", "changeCollector", "=", "collector", ";", "return", "false", ";", "}", "else", "{", "return", "collector", ".", "needsRefresh", "(", ")", ";", "}", "}", "else", "if", "(", "element", "instanceof", "ClassFile", ")", "{", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IJavaElementDelta", ".", "REMOVED", ":", "return", "this", ".", "files", ".", "get", "(", "element", ")", "!=", "null", ";", "case", "IJavaElementDelta", ".", "ADDED", ":", "IType", "type", "=", "(", "(", "ClassFile", ")", "element", ")", ".", "getType", "(", ")", ";", "String", "typeName", "=", "type", ".", "getElementName", "(", ")", ";", "if", "(", "hasSupertype", "(", "typeName", ")", "||", "subtypesIncludeSupertypeOf", "(", "type", ")", "||", "this", ".", "missingTypes", ".", "contains", "(", "typeName", ")", ")", "{", "return", "true", ";", "}", "break", ";", "case", "IJavaElementDelta", ".", "CHANGED", ":", "IJavaElementDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElementDelta", "child", "=", "children", "[", "i", "]", ";", "IJavaElement", "childElement", "=", "child", ".", "getElement", "(", ")", ";", "if", "(", "childElement", "instanceof", "IType", ")", "{", "type", "=", "(", "IType", ")", "childElement", ";", "boolean", "hasVisibilityChange", "=", "(", "delta", ".", "getFlags", "(", ")", "&", "IJavaElementDelta", ".", "F_MODIFIERS", ")", ">", "0", ";", "boolean", "hasSupertypeChange", "=", "(", "delta", ".", "getFlags", "(", ")", "&", "IJavaElementDelta", ".", "F_SUPER_TYPES", ")", ">", "0", ";", "if", "(", "(", "hasVisibilityChange", "&&", "hasSupertype", "(", "type", ".", "getElementName", "(", ")", ")", ")", "||", "(", "hasSupertypeChange", "&&", "includesTypeOrSupertype", "(", "type", ")", ")", ")", "{", "return", "true", ";", "}", "}", "}", "break", ";", "}", "}", "return", "false", ";", "}", "private", "boolean", "isInterface", "(", "IType", "type", ")", "{", "int", "flags", "=", "getCachedFlags", "(", "type", ")", ";", "if", "(", "flags", "==", "-", "1", ")", "{", "try", "{", "return", "type", ".", "isInterface", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "}", "else", "{", "return", "Flags", ".", "isInterface", "(", "flags", ")", ";", "}", "}", "public", "IJavaProject", "javaProject", "(", ")", "{", "return", "this", ".", "focusType", ".", "getJavaProject", "(", ")", ";", "}", "protected", "static", "byte", "[", "]", "readUntil", "(", "InputStream", "input", ",", "byte", "separator", ")", "throws", "JavaModelException", ",", "IOException", "{", "return", "readUntil", "(", "input", ",", "separator", ",", "0", ")", ";", "}", "protected", "static", "byte", "[", "]", "readUntil", "(", "InputStream", "input", ",", "byte", "separator", ",", "int", "offset", ")", "throws", "IOException", ",", "JavaModelException", "{", "int", "length", "=", "0", ";", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "SIZE", "]", ";", "byte", "b", ";", "while", "(", "(", "b", "=", "(", "byte", ")", "input", ".", "read", "(", ")", ")", "!=", "separator", "&&", "b", "!=", "-", "1", ")", "{", "if", "(", "bytes", ".", "length", "==", "length", ")", "{", "System", ".", "arraycopy", "(", "bytes", ",", "0", ",", "bytes", "=", "new", "byte", "[", "length", "*", "2", "]", ",", "0", ",", "length", ")", ";", "}", "bytes", "[", "length", "++", "]", "=", "b", ";", "}", "if", "(", "b", "==", "-", "1", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IStatus", ".", "ERROR", ")", ")", ";", "}", "System", ".", "arraycopy", "(", "bytes", ",", "0", ",", "bytes", "=", "new", "byte", "[", "length", "+", "offset", "]", ",", "offset", ",", "length", ")", ";", "return", "bytes", ";", "}", "public", "static", "ITypeHierarchy", "load", "(", "IType", "type", ",", "InputStream", "input", ",", "WorkingCopyOwner", "owner", ")", "throws", "JavaModelException", "{", "try", "{", "TypeHierarchy", "typeHierarchy", "=", "new", "TypeHierarchy", "(", ")", ";", "typeHierarchy", ".", "initialize", "(", "1", ")", ";", "IType", "[", "]", "types", "=", "new", "IType", "[", "SIZE", "]", ";", "int", "typeCount", "=", "0", ";", "byte", "version", "=", "(", "byte", ")", "input", ".", "read", "(", ")", ";", "if", "(", "version", "!=", "VERSION", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IStatus", ".", "ERROR", ")", ")", ";", "}", "byte", "generalInfo", "=", "(", "byte", ")", "input", ".", "read", "(", ")", ";", "if", "(", "(", "generalInfo", "&", "COMPUTE_SUBTYPES", ")", "!=", "0", ")", "{", "typeHierarchy", ".", "computeSubtypes", "=", "true", ";", "}", "byte", "b", ";", "byte", "[", "]", "bytes", ";", "bytes", "=", "readUntil", "(", "input", ",", "SEPARATOR1", ")", ";", "if", "(", "bytes", ".", "length", ">", "0", ")", "{", "typeHierarchy", ".", "project", "=", "(", "IJavaProject", ")", "JavaCore", ".", "create", "(", "new", "String", "(", "bytes", ")", ")", ";", "typeHierarchy", ".", "scope", "=", "SearchEngine", ".", "createJavaSearchScope", "(", "new", "IJavaElement", "[", "]", "{", "typeHierarchy", ".", "project", "}", ")", ";", "}", "else", "{", "typeHierarchy", ".", "project", "=", "null", ";", "typeHierarchy", ".", "scope", "=", "SearchEngine", ".", "createWorkspaceScope", "(", ")", ";", "}", "{", "bytes", "=", "readUntil", "(", "input", ",", "SEPARATOR1", ")", ";", "byte", "[", "]", "missing", ";", "int", "j", "=", "0", ";", "int", "length", "=", "bytes", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "b", "=", "bytes", "[", "i", "]", ";", "if", "(", "b", "==", "SEPARATOR2", ")", "{", "missing", "=", "new", "byte", "[", "i", "-", "j", "]", ";", "System", ".", "arraycopy", "(", "bytes", ",", "j", ",", "missing", ",", "0", ",", "i", "-", "j", ")", ";", "typeHierarchy", ".", "missingTypes", ".", "add", "(", "new", "String", "(", "missing", ")", ")", ";", "j", "=", "i", "+", "1", ";", "}", "}", "System", ".", "arraycopy", "(", "bytes", ",", "j", ",", "missing", "=", "new", "byte", "[", "length", "-", "j", "]", ",", "0", ",", "length", "-", "j", ")", ";", "typeHierarchy", ".", "missingTypes", ".", "add", "(", "new", "String", "(", "missing", ")", ")", ";", "}", "while", "(", "(", "b", "=", "(", "byte", ")", "input", ".", "read", "(", ")", ")", "!=", "SEPARATOR1", "&&", "b", "!=", "-", "1", ")", "{", "bytes", "=", "readUntil", "(", "input", ",", "SEPARATOR4", ",", "1", ")", ";", "bytes", "[", "0", "]", "=", "b", ";", "IType", "element", "=", "(", "IType", ")", "JavaCore", ".", "create", "(", "new", "String", "(", "bytes", ")", ",", "owner", ")", ";", "if", "(", "types", ".", "length", "==", "typeCount", ")", "{", "System", ".", "arraycopy", "(", "types", ",", "0", ",", "types", "=", "new", "IType", "[", "typeCount", "*", "2", "]", ",", "0", ",", "typeCount", ")", ";", "}", "types", "[", "typeCount", "++", "]", "=", "element", ";", "bytes", "=", "readUntil", "(", "input", ",", "SEPARATOR4", ")", ";", "Integer", "flags", "=", "bytesToFlags", "(", "bytes", ")", ";", "if", "(", "flags", "!=", "null", ")", "{", "typeHierarchy", ".", "cacheFlags", "(", "element", ",", "flags", ".", "intValue", "(", ")", ")", ";", "}", "byte", "info", "=", "(", "byte", ")", "input", ".", "read", "(", ")", ";", "if", "(", "(", "info", "&", "INTERFACE", ")", "!=", "0", ")", "{", "typeHierarchy", ".", "addInterface", "(", "element", ")", ";", "}", "if", "(", "(", "info", "&", "COMPUTED_FOR", ")", "!=", "0", ")", "{", "if", "(", "!", "element", ".", "equals", "(", "type", ")", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IStatus", ".", "ERROR", ")", ")", ";", "}", "typeHierarchy", ".", "focusType", "=", "element", ";", "}", "if", "(", "(", "info", "&", "ROOT", ")", "!=", "0", ")", "{", "typeHierarchy", ".", "addRootClass", "(", "element", ")", ";", "}", "}", "while", "(", "(", "b", "=", "(", "byte", ")", "input", ".", "read", "(", ")", ")", "!=", "SEPARATOR1", "&&", "b", "!=", "-", "1", ")", "{", "bytes", "=", "readUntil", "(", "input", ",", "SEPARATOR3", ",", "1", ")", ";", "bytes", "[", "0", "]", "=", "b", ";", "int", "subClass", "=", "new", "Integer", "(", "new", "String", "(", "bytes", ")", ")", ".", "intValue", "(", ")", ";", "bytes", "=", "readUntil", "(", "input", ",", "SEPARATOR1", ")", ";", "int", "superClass", "=", "new", "Integer", "(", "new", "String", "(", "bytes", ")", ")", ".", "intValue", "(", ")", ";", "typeHierarchy", ".", "cacheSuperclass", "(", "types", "[", "subClass", "]", ",", "types", "[", "superClass", "]", ")", ";", "}", "while", "(", "(", "b", "=", "(", "byte", ")", "input", ".", "read", "(", ")", ")", "!=", "SEPARATOR1", "&&", "b", "!=", "-", "1", ")", "{", "bytes", "=", "readUntil", "(", "input", ",", "SEPARATOR3", ",", "1", ")", ";", "bytes", "[", "0", "]", "=", "b", ";", "int", "subClass", "=", "new", "Integer", "(", "new", "String", "(", "bytes", ")", ")", ".", "intValue", "(", ")", ";", "bytes", "=", "readUntil", "(", "input", ",", "SEPARATOR1", ")", ";", "IType", "[", "]", "superInterfaces", "=", "new", "IType", "[", "(", "bytes", ".", "length", "/", "2", ")", "+", "1", "]", ";", "int", "interfaceCount", "=", "0", ";", "int", "j", "=", "0", ";", "byte", "[", "]", "b2", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bytes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "bytes", "[", "i", "]", "==", "SEPARATOR2", ")", "{", "b2", "=", "new", "byte", "[", "i", "-", "j", "]", ";", "System", ".", "arraycopy", "(", "bytes", ",", "j", ",", "b2", ",", "0", ",", "i", "-", "j", ")", ";", "j", "=", "i", "+", "1", ";", "superInterfaces", "[", "interfaceCount", "++", "]", "=", "types", "[", "new", "Integer", "(", "new", "String", "(", "b2", ")", ")", ".", "intValue", "(", ")", "]", ";", "}", "}", "b2", "=", "new", "byte", "[", "bytes", ".", "length", "-", "j", "]", ";", "System", ".", "arraycopy", "(", "bytes", ",", "j", ",", "b2", ",", "0", ",", "bytes", ".", "length", "-", "j", ")", ";", "superInterfaces", "[", "interfaceCount", "++", "]", "=", "types", "[", "new", "Integer", "(", "new", "String", "(", "b2", ")", ")", ".", "intValue", "(", ")", "]", ";", "System", ".", "arraycopy", "(", "superInterfaces", ",", "0", ",", "superInterfaces", "=", "new", "IType", "[", "interfaceCount", "]", ",", "0", ",", "interfaceCount", ")", ";", "typeHierarchy", ".", "cacheSuperInterfaces", "(", "types", "[", "subClass", "]", ",", "superInterfaces", ")", ";", "}", "if", "(", "b", "==", "-", "1", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IStatus", ".", "ERROR", ")", ")", ";", "}", "return", "typeHierarchy", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ",", "IJavaModelStatusConstants", ".", "IO_EXCEPTION", ")", ";", "}", "}", "protected", "boolean", "packageRegionContainsSamePackageFragment", "(", "PackageFragment", "element", ")", "{", "IJavaElement", "[", "]", "pkgs", "=", "this", ".", "packageRegion", ".", "getElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pkgs", ".", "length", ";", "i", "++", ")", "{", "PackageFragment", "pkg", "=", "(", "PackageFragment", ")", "pkgs", "[", "i", "]", ";", "if", "(", "Util", ".", "equalArraysOrNull", "(", "pkg", ".", "names", ",", "element", ".", "names", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "public", "synchronized", "void", "refresh", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "try", "{", "this", ".", "progressMonitor", "=", "monitor", ";", "if", "(", "monitor", "!=", "null", ")", "{", "monitor", ".", "beginTask", "(", "this", ".", "focusType", "!=", "null", "?", "Messages", ".", "bind", "(", "Messages", ".", "hierarchy_creatingOnType", ",", "this", ".", "focusType", ".", "getFullyQualifiedName", "(", ")", ")", ":", "Messages", ".", "hierarchy_creating", ",", "100", ")", ";", "}", "long", "start", "=", "-", "1", ";", "if", "(", "DEBUG", ")", "{", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "this", ".", "computeSubtypes", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"]\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"]\"", ")", ";", "}", "if", "(", "this", ".", "focusType", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"", "on", "type", "\"", "+", "(", "(", "JavaElement", ")", "this", ".", "focusType", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "}", "}", "compute", "(", ")", ";", "initializeRegions", "(", ")", ";", "this", ".", "needsRefresh", "=", "false", ";", "this", ".", "changeCollector", "=", "null", ";", "if", "(", "DEBUG", ")", "{", "if", "(", "this", ".", "computeSubtypes", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", "+", "\"ms\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", "+", "\"ms\"", ")", ";", "}", "System", ".", "out", ".", "println", "(", "this", ".", "toString", "(", ")", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "monitor", "!=", "null", ")", "{", "monitor", ".", "done", "(", ")", ";", "}", "this", ".", "progressMonitor", "=", "null", ";", "}", "}", "public", "synchronized", "void", "removeTypeHierarchyChangedListener", "(", "ITypeHierarchyChangedListener", "listener", ")", "{", "ArrayList", "listeners", "=", "this", ".", "changeListeners", ";", "if", "(", "listeners", "==", "null", ")", "{", "return", ";", "}", "listeners", ".", "remove", "(", "listener", ")", ";", "if", "(", "listeners", ".", "isEmpty", "(", ")", ")", "{", "JavaCore", ".", "removeElementChangedListener", "(", "this", ")", ";", "}", "}", "public", "void", "store", "(", "OutputStream", "output", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "try", "{", "Hashtable", "hashtable", "=", "new", "Hashtable", "(", ")", ";", "Hashtable", "hashtable2", "=", "new", "Hashtable", "(", ")", ";", "int", "count", "=", "0", ";", "if", "(", "this", ".", "focusType", "!=", "null", ")", "{", "Integer", "index", "=", "new", "Integer", "(", "count", "++", ")", ";", "hashtable", ".", "put", "(", "this", ".", "focusType", ",", "index", ")", ";", "hashtable2", ".", "put", "(", "index", ",", "this", ".", "focusType", ")", ";", "}", "Object", "[", "]", "types", "=", "this", ".", "classToSuperclass", ".", "entrySet", "(", ")", ".", "toArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "types", "[", "i", "]", ";", "Object", "t", "=", "entry", ".", "getKey", "(", ")", ";", "if", "(", "hashtable", ".", "get", "(", "t", ")", "==", "null", ")", "{", "Integer", "index", "=", "new", "Integer", "(", "count", "++", ")", ";", "hashtable", ".", "put", "(", "t", ",", "index", ")", ";", "hashtable2", ".", "put", "(", "index", ",", "t", ")", ";", "}", "Object", "superClass", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "superClass", "!=", "null", "&&", "hashtable", ".", "get", "(", "superClass", ")", "==", "null", ")", "{", "Integer", "index", "=", "new", "Integer", "(", "count", "++", ")", ";", "hashtable", ".", "put", "(", "superClass", ",", "index", ")", ";", "hashtable2", ".", "put", "(", "index", ",", "superClass", ")", ";", "}", "}", "types", "=", "this", ".", "typeToSuperInterfaces", ".", "entrySet", "(", ")", ".", "toArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "types", "[", "i", "]", ";", "Object", "t", "=", "entry", ".", "getKey", "(", ")", ";", "if", "(", "hashtable", ".", "get", "(", "t", ")", "==", "null", ")", "{", "Integer", "index", "=", "new", "Integer", "(", "count", "++", ")", ";", "hashtable", ".", "put", "(", "t", ",", "index", ")", ";", "hashtable2", ".", "put", "(", "index", ",", "t", ")", ";", "}", "Object", "[", "]", "sp", "=", "(", "Object", "[", "]", ")", "entry", ".", "getValue", "(", ")", ";", "if", "(", "sp", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "sp", ".", "length", ";", "j", "++", ")", "{", "Object", "superInterface", "=", "sp", "[", "j", "]", ";", "if", "(", "sp", "[", "j", "]", "!=", "null", "&&", "hashtable", ".", "get", "(", "superInterface", ")", "==", "null", ")", "{", "Integer", "index", "=", "new", "Integer", "(", "count", "++", ")", ";", "hashtable", ".", "put", "(", "superInterface", ",", "index", ")", ";", "hashtable2", ".", "put", "(", "index", ",", "superInterface", ")", ";", "}", "}", "}", "}", "output", ".", "write", "(", "VERSION", ")", ";", "byte", "generalInfo", "=", "0", ";", "if", "(", "this", ".", "computeSubtypes", ")", "{", "generalInfo", "|=", "COMPUTE_SUBTYPES", ";", "}", "output", ".", "write", "(", "generalInfo", ")", ";", "if", "(", "this", ".", "project", "!=", "null", ")", "{", "output", ".", "write", "(", "this", ".", "project", ".", "getHandleIdentifier", "(", ")", ".", "getBytes", "(", ")", ")", ";", "}", "output", ".", "write", "(", "SEPARATOR1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "missingTypes", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "0", ")", "{", "output", ".", "write", "(", "SEPARATOR2", ")", ";", "}", "output", ".", "write", "(", "(", "(", "String", ")", "this", ".", "missingTypes", ".", "get", "(", "i", ")", ")", ".", "getBytes", "(", ")", ")", ";", "}", "output", ".", "write", "(", "SEPARATOR1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "IType", "t", "=", "(", "IType", ")", "hashtable2", ".", "get", "(", "new", "Integer", "(", "i", ")", ")", ";", "output", ".", "write", "(", "t", ".", "getHandleIdentifier", "(", ")", ".", "getBytes", "(", ")", ")", ";", "output", ".", "write", "(", "SEPARATOR4", ")", ";", "output", ".", "write", "(", "flagsToBytes", "(", "(", "Integer", ")", "this", ".", "typeFlags", ".", "get", "(", "t", ")", ")", ")", ";", "output", ".", "write", "(", "SEPARATOR4", ")", ";", "byte", "info", "=", "CLASS", ";", "if", "(", "this", ".", "focusType", "!=", "null", "&&", "this", ".", "focusType", ".", "equals", "(", "t", ")", ")", "{", "info", "|=", "COMPUTED_FOR", ";", "}", "if", "(", "this", ".", "interfaces", ".", "contains", "(", "t", ")", ")", "{", "info", "|=", "INTERFACE", ";", "}", "if", "(", "this", ".", "rootClasses", ".", "contains", "(", "t", ")", ")", "{", "info", "|=", "ROOT", ";", "}", "output", ".", "write", "(", "info", ")", ";", "}", "output", ".", "write", "(", "SEPARATOR1", ")", ";", "types", "=", "this", ".", "classToSuperclass", ".", "entrySet", "(", ")", ".", "toArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "types", "[", "i", "]", ";", "IJavaElement", "key", "=", "(", "IJavaElement", ")", "entry", ".", "getKey", "(", ")", ";", "IJavaElement", "value", "=", "(", "IJavaElement", ")", "entry", ".", "getValue", "(", ")", ";", "output", ".", "write", "(", "(", "(", "Integer", ")", "hashtable", ".", "get", "(", "key", ")", ")", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "output", ".", "write", "(", "'>'", ")", ";", "output", ".", "write", "(", "(", "(", "Integer", ")", "hashtable", ".", "get", "(", "value", ")", ")", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "output", ".", "write", "(", "SEPARATOR1", ")", ";", "}", "output", ".", "write", "(", "SEPARATOR1", ")", ";", "types", "=", "this", ".", "typeToSuperInterfaces", ".", "entrySet", "(", ")", ".", "toArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "types", "[", "i", "]", ";", "IJavaElement", "key", "=", "(", "IJavaElement", ")", "entry", ".", "getKey", "(", ")", ";", "IJavaElement", "[", "]", "values", "=", "(", "IJavaElement", "[", "]", ")", "entry", ".", "getValue", "(", ")", ";", "if", "(", "values", ".", "length", ">", "0", ")", "{", "output", ".", "write", "(", "(", "(", "Integer", ")", "hashtable", ".", "get", "(", "key", ")", ")", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "output", ".", "write", "(", "SEPARATOR3", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "values", ".", "length", ";", "j", "++", ")", "{", "IJavaElement", "value", "=", "values", "[", "j", "]", ";", "if", "(", "j", "!=", "0", ")", "output", ".", "write", "(", "SEPARATOR2", ")", ";", "output", ".", "write", "(", "(", "(", "Integer", ")", "hashtable", ".", "get", "(", "value", ")", ")", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "}", "output", ".", "write", "(", "SEPARATOR1", ")", ";", "}", "}", "output", ".", "write", "(", "SEPARATOR1", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ",", "IJavaModelStatusConstants", ".", "IO_EXCEPTION", ")", ";", "}", "}", "boolean", "subtypesIncludeSupertypeOf", "(", "IType", "type", ")", "{", "String", "superclassName", "=", "null", ";", "try", "{", "superclassName", "=", "type", ".", "getSuperclassName", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "DEBUG", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}", "if", "(", "superclassName", "==", "null", ")", "{", "superclassName", "=", "\"Object\"", ";", "}", "int", "dot", "=", "-", "1", ";", "String", "simpleSuper", "=", "(", "dot", "=", "superclassName", ".", "lastIndexOf", "(", "'.'", ")", ")", ">", "-", "1", "?", "superclassName", ".", "substring", "(", "dot", "+", "1", ")", ":", "superclassName", ";", "if", "(", "hasSubtypeNamed", "(", "simpleSuper", ")", ")", "{", "return", "true", ";", "}", "String", "[", "]", "interfaceNames", "=", "null", ";", "try", "{", "interfaceNames", "=", "type", ".", "getSuperInterfaceNames", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "DEBUG", ")", "e", ".", "printStackTrace", "(", ")", ";", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "interfaceNames", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "dot", "=", "-", "1", ";", "String", "interfaceName", "=", "interfaceNames", "[", "i", "]", ";", "String", "simpleInterface", "=", "(", "dot", "=", "interfaceName", ".", "lastIndexOf", "(", "'.'", ")", ")", ">", "-", "1", "?", "interfaceName", ".", "substring", "(", "dot", ")", ":", "interfaceName", ";", "if", "(", "hasSubtypeNamed", "(", "simpleInterface", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"Focus:", "\"", ")", ";", "if", "(", "this", ".", "focusType", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"<NONE>n\"", ")", ";", "}", "else", "{", "toString", "(", "buffer", ",", "this", ".", "focusType", ",", "0", ")", ";", "}", "if", "(", "exists", "(", ")", ")", "{", "if", "(", "this", ".", "focusType", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "toString", "(", "buffer", ",", "this", ".", "focusType", ",", "0", ",", "true", ")", ";", "buffer", ".", "append", "(", "\"Sub", "types:n\"", ")", ";", "toString", "(", "buffer", ",", "this", ".", "focusType", ",", "0", ",", "false", ")", ";", "}", "else", "{", "if", "(", "this", ".", "rootClasses", ".", "size", ">", "0", ")", "{", "IJavaElement", "[", "]", "roots", "=", "Util", ".", "sortCopy", "(", "getRootClasses", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "int", "length", "=", "roots", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "root", "=", "roots", "[", "i", "]", ";", "toString", "(", "buffer", ",", "root", ",", "1", ")", ";", "toString", "(", "buffer", ",", "root", ",", "1", ",", "true", ")", ";", "}", "buffer", ".", "append", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "root", "=", "roots", "[", "i", "]", ";", "toString", "(", "buffer", ",", "root", ",", "1", ")", ";", "toString", "(", "buffer", ",", "root", ",", "1", ",", "false", ")", ";", "}", "}", "else", "if", "(", "this", ".", "rootClasses", ".", "size", "==", "0", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "}", "}", "else", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "private", "void", "toString", "(", "StringBuffer", "buffer", ",", "IJavaElement", "type", ",", "int", "indent", ",", "boolean", "ascendant", ")", "{", "IType", "[", "]", "types", "=", "ascendant", "?", "getSupertypes", "(", "(", "IType", ")", "type", ")", ":", "getSubtypes", "(", "(", "IType", ")", "type", ")", ";", "IJavaElement", "[", "]", "sortedTypes", "=", "Util", ".", "sortCopy", "(", "types", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sortedTypes", ".", "length", ";", "i", "++", ")", "{", "toString", "(", "buffer", ",", "sortedTypes", "[", "i", "]", ",", "indent", "+", "1", ")", ";", "toString", "(", "buffer", ",", "sortedTypes", "[", "i", "]", ",", "indent", "+", "1", ",", "ascendant", ")", ";", "}", "}", "private", "void", "toString", "(", "StringBuffer", "buffer", ",", "IJavaElement", "type", ",", "int", "indent", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "indent", ";", "j", "++", ")", "{", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "buffer", ".", "append", "(", "(", "(", "JavaElement", ")", "type", ")", ".", "toStringWithAncestors", "(", "false", ")", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "boolean", "hasSupertype", "(", "String", "simpleName", ")", "{", "for", "(", "Iterator", "iter", "=", "this", ".", "classToSuperclass", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "IType", "superType", "=", "(", "IType", ")", "iter", ".", "next", "(", ")", ";", "if", "(", "superType", ".", "getElementName", "(", ")", ".", "equals", "(", "simpleName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "protected", "void", "worked", "(", "int", "work", ")", "{", "if", "(", "this", ".", "progressMonitor", "!=", "null", ")", "{", "this", ".", "progressMonitor", ".", "worked", "(", "work", ")", ";", "checkCanceled", "(", ")", ";", "}", "}", "}", "</s>" ]
3,742
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryField", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryNestedType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IIndexConstants", ";", "public", "class", "HierarchyBinaryType", "implements", "IBinaryType", "{", "private", "int", "modifiers", ";", "private", "char", "[", "]", "sourceName", ";", "private", "char", "[", "]", "name", ";", "private", "char", "[", "]", "enclosingTypeName", ";", "private", "char", "[", "]", "superclass", ";", "private", "char", "[", "]", "[", "]", "superInterfaces", "=", "NoInterface", ";", "private", "char", "[", "]", "[", "]", "typeParameterSignatures", ";", "private", "char", "[", "]", "genericSignature", ";", "public", "HierarchyBinaryType", "(", "int", "modifiers", ",", "char", "[", "]", "qualification", ",", "char", "[", "]", "sourceName", ",", "char", "[", "]", "enclosingTypeName", ",", "char", "[", "]", "[", "]", "typeParameterSignatures", ",", "char", "typeSuffix", ")", "{", "this", ".", "modifiers", "=", "modifiers", ";", "this", ".", "sourceName", "=", "sourceName", ";", "if", "(", "enclosingTypeName", "==", "null", ")", "{", "this", ".", "name", "=", "CharOperation", ".", "concat", "(", "qualification", ",", "sourceName", ",", "'/'", ")", ";", "}", "else", "{", "this", ".", "name", "=", "CharOperation", ".", "concat", "(", "qualification", ",", "'/'", ",", "enclosingTypeName", ",", "'$'", ",", "sourceName", ")", ";", "this", ".", "enclosingTypeName", "=", "CharOperation", ".", "concat", "(", "qualification", ",", "enclosingTypeName", ",", "'/'", ")", ";", "CharOperation", ".", "replace", "(", "this", ".", "enclosingTypeName", ",", "'.'", ",", "'/'", ")", ";", "}", "this", ".", "typeParameterSignatures", "=", "typeParameterSignatures", ";", "CharOperation", ".", "replace", "(", "this", ".", "name", ",", "'.'", ",", "'/'", ")", ";", "}", "public", "IBinaryAnnotation", "[", "]", "getAnnotations", "(", ")", "{", "return", "null", ";", "}", "public", "char", "[", "]", "getEnclosingMethod", "(", ")", "{", "return", "null", ";", "}", "public", "char", "[", "]", "getEnclosingTypeName", "(", ")", "{", "return", "this", ".", "enclosingTypeName", ";", "}", "public", "IBinaryField", "[", "]", "getFields", "(", ")", "{", "return", "null", ";", "}", "public", "char", "[", "]", "getFileName", "(", ")", "{", "return", "null", ";", "}", "public", "char", "[", "]", "getGenericSignature", "(", ")", "{", "if", "(", "this", ".", "typeParameterSignatures", "!=", "null", "&&", "this", ".", "genericSignature", "==", "null", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "'<'", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "typeParameterSignatures", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "this", ".", "typeParameterSignatures", "[", "i", "]", ")", ";", "}", "buffer", ".", "append", "(", "'>'", ")", ";", "if", "(", "this", ".", "superclass", "==", "null", ")", "buffer", ".", "append", "(", "Signature", ".", "createTypeSignature", "(", "\"\"", ",", "true", ")", ")", ";", "else", "buffer", ".", "append", "(", "Signature", ".", "createTypeSignature", "(", "this", ".", "superclass", ",", "true", ")", ")", ";", "if", "(", "this", ".", "superInterfaces", "!=", "null", ")", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "superInterfaces", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "buffer", ".", "append", "(", "Signature", ".", "createTypeSignature", "(", "this", ".", "superInterfaces", "[", "i", "]", ",", "true", ")", ")", ";", "this", ".", "genericSignature", "=", "buffer", ".", "toString", "(", ")", ".", "toCharArray", "(", ")", ";", "CharOperation", ".", "replace", "(", "this", ".", "genericSignature", ",", "'.'", ",", "'/'", ")", ";", "}", "return", "this", ".", "genericSignature", ";", "}", "public", "char", "[", "]", "[", "]", "getInterfaceNames", "(", ")", "{", "return", "this", ".", "superInterfaces", ";", "}", "public", "IBinaryNestedType", "[", "]", "getMemberTypes", "(", ")", "{", "return", "null", ";", "}", "public", "IBinaryMethod", "[", "]", "getMethods", "(", ")", "{", "return", "null", ";", "}", "public", "char", "[", "]", "[", "]", "[", "]", "getMissingTypeNames", "(", ")", "{", "return", "null", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "return", "this", ".", "modifiers", ";", "}", "public", "char", "[", "]", "getName", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "char", "[", "]", "getSourceName", "(", ")", "{", "return", "this", ".", "sourceName", ";", "}", "public", "char", "[", "]", "getSuperclassName", "(", ")", "{", "return", "this", ".", "superclass", ";", "}", "public", "long", "getTagBits", "(", ")", "{", "return", "0", ";", "}", "public", "boolean", "isAnonymous", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isBinaryType", "(", ")", "{", "return", "true", ";", "}", "public", "boolean", "isLocal", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isMember", "(", ")", "{", "return", "false", ";", "}", "public", "void", "recordSuperType", "(", "char", "[", "]", "superTypeName", ",", "char", "[", "]", "superQualification", ",", "char", "superClassOrInterface", ")", "{", "if", "(", "superQualification", "!=", "null", ")", "{", "int", "length", "=", "superQualification", ".", "length", ";", "if", "(", "superQualification", "[", "length", "-", "1", "]", "==", "'$'", ")", "{", "char", "[", "]", "enclosingSuperName", "=", "CharOperation", ".", "lastSegment", "(", "superQualification", ",", "'.'", ")", ";", "superTypeName", "=", "CharOperation", ".", "concat", "(", "enclosingSuperName", ",", "superTypeName", ")", ";", "superQualification", "=", "CharOperation", ".", "subarray", "(", "superQualification", ",", "0", ",", "length", "-", "enclosingSuperName", ".", "length", "-", "1", ")", ";", "}", "}", "if", "(", "superClassOrInterface", "==", "IIndexConstants", ".", "CLASS_SUFFIX", ")", "{", "if", "(", "TypeDeclaration", ".", "kind", "(", "this", ".", "modifiers", ")", "==", "TypeDeclaration", ".", "INTERFACE_DECL", ")", "return", ";", "char", "[", "]", "encodedName", "=", "CharOperation", ".", "concat", "(", "superQualification", ",", "superTypeName", ",", "'/'", ")", ";", "CharOperation", ".", "replace", "(", "encodedName", ",", "'.'", ",", "'/'", ")", ";", "this", ".", "superclass", "=", "encodedName", ";", "}", "else", "{", "char", "[", "]", "encodedName", "=", "CharOperation", ".", "concat", "(", "superQualification", ",", "superTypeName", ",", "'/'", ")", ";", "CharOperation", ".", "replace", "(", "encodedName", ",", "'.'", ",", "'/'", ")", ";", "if", "(", "this", ".", "superInterfaces", "==", "NoInterface", ")", "{", "this", ".", "superInterfaces", "=", "new", "char", "[", "]", "[", "]", "{", "encodedName", "}", ";", "}", "else", "{", "int", "length", "=", "this", ".", "superInterfaces", ".", "length", ";", "System", ".", "arraycopy", "(", "this", ".", "superInterfaces", ",", "0", ",", "this", ".", "superInterfaces", "=", "new", "char", "[", "length", "+", "1", "]", "[", "]", ",", "0", ",", "length", ")", ";", "this", ".", "superInterfaces", "[", "length", "]", "=", "encodedName", ";", "}", "}", "}", "public", "char", "[", "]", "sourceFileName", "(", ")", "{", "return", "null", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "this", ".", "modifiers", "==", "ClassFileConstants", ".", "AccPublic", ")", "{", "buffer", ".", "append", "(", "\"public", "\"", ")", ";", "}", "switch", "(", "TypeDeclaration", ".", "kind", "(", "this", ".", "modifiers", ")", ")", "{", "case", "TypeDeclaration", ".", "CLASS_DECL", ":", "buffer", ".", "append", "(", "\"class", "\"", ")", ";", "break", ";", "case", "TypeDeclaration", ".", "INTERFACE_DECL", ":", "buffer", ".", "append", "(", "\"interface", "\"", ")", ";", "break", ";", "case", "TypeDeclaration", ".", "ENUM_DECL", ":", "buffer", ".", "append", "(", "\"enum", "\"", ")", ";", "break", ";", "}", "if", "(", "this", ".", "name", "!=", "null", ")", "{", "buffer", ".", "append", "(", "this", ".", "name", ")", ";", "}", "if", "(", "this", ".", "superclass", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"n", "extends", "\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "superclass", ")", ";", "}", "int", "length", ";", "if", "(", "this", ".", "superInterfaces", "!=", "null", "&&", "(", "length", "=", "this", ".", "superInterfaces", ".", "length", ")", "!=", "0", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "this", ".", "superInterfaces", "[", "i", "]", ")", ";", "if", "(", "i", "!=", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
3,743
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "Comparator", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTVisitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AbstractTypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AnnotationTypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AnonymousClassDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "BodyDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "EnumConstantDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "EnumDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ListRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "util", ".", "CompilationUnitSorter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "BadLocationException", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "Document", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "RangeMarker", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEditGroup", ";", "public", "class", "SortElementsOperation", "extends", "JavaModelOperation", "{", "public", "static", "final", "String", "CONTAINS_MALFORMED_NODES", "=", "\"malformed\"", ";", "Comparator", "comparator", ";", "int", "[", "]", "positions", ";", "int", "apiLevel", ";", "public", "SortElementsOperation", "(", "int", "level", ",", "IJavaElement", "[", "]", "elements", ",", "int", "[", "]", "positions", ",", "Comparator", "comparator", ")", "{", "super", "(", "elements", ")", ";", "this", ".", "comparator", "=", "comparator", ";", "this", ".", "positions", "=", "positions", ";", "this", ".", "apiLevel", "=", "level", ";", "}", "protected", "int", "getMainAmountOfWork", "(", ")", "{", "return", "this", ".", "elementsToProcess", ".", "length", ";", "}", "boolean", "checkMalformedNodes", "(", "ASTNode", "node", ")", "{", "Object", "property", "=", "node", ".", "getProperty", "(", "CONTAINS_MALFORMED_NODES", ")", ";", "if", "(", "property", "==", "null", ")", "return", "false", ";", "return", "(", "(", "Boolean", ")", "property", ")", ".", "booleanValue", "(", ")", ";", "}", "protected", "boolean", "isMalformed", "(", "ASTNode", "node", ")", "{", "return", "(", "node", ".", "getFlags", "(", ")", "&", "ASTNode", ".", "MALFORMED", ")", "!=", "0", ";", "}", "protected", "void", "executeOperation", "(", ")", "throws", "JavaModelException", "{", "try", "{", "beginTask", "(", "Messages", ".", "operation_sortelements", ",", "getMainAmountOfWork", "(", ")", ")", ";", "CompilationUnit", "copy", "=", "(", "CompilationUnit", ")", "this", ".", "elementsToProcess", "[", "0", "]", ";", "ICompilationUnit", "unit", "=", "copy", ".", "getPrimary", "(", ")", ";", "IBuffer", "buffer", "=", "copy", ".", "getBuffer", "(", ")", ";", "if", "(", "buffer", "==", "null", ")", "{", "return", ";", "}", "char", "[", "]", "bufferContents", "=", "buffer", ".", "getCharacters", "(", ")", ";", "String", "result", "=", "processElement", "(", "unit", ",", "bufferContents", ")", ";", "if", "(", "!", "CharOperation", ".", "equals", "(", "result", ".", "toCharArray", "(", ")", ",", "bufferContents", ")", ")", "{", "copy", ".", "getBuffer", "(", ")", ".", "setContents", "(", "result", ")", ";", "}", "worked", "(", "1", ")", ";", "}", "finally", "{", "done", "(", ")", ";", "}", "}", "public", "TextEdit", "calculateEdit", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "unit", ",", "TextEditGroup", "group", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "elementsToProcess", ".", "length", "!=", "1", ")", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NO_ELEMENTS_TO_PROCESS", ")", ")", ";", "if", "(", "!", "(", "this", ".", "elementsToProcess", "[", "0", "]", "instanceof", "ICompilationUnit", ")", ")", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "this", ".", "elementsToProcess", "[", "0", "]", ")", ")", ";", "try", "{", "beginTask", "(", "Messages", ".", "operation_sortelements", ",", "getMainAmountOfWork", "(", ")", ")", ";", "ICompilationUnit", "cu", "=", "(", "ICompilationUnit", ")", "this", ".", "elementsToProcess", "[", "0", "]", ";", "String", "content", "=", "cu", ".", "getBuffer", "(", ")", ".", "getContents", "(", ")", ";", "ASTRewrite", "rewrite", "=", "sortCompilationUnit", "(", "unit", ",", "group", ")", ";", "if", "(", "rewrite", "==", "null", ")", "{", "return", "null", ";", "}", "Document", "document", "=", "new", "Document", "(", "content", ")", ";", "return", "rewrite", ".", "rewriteAST", "(", "document", ",", "cu", ".", "getJavaProject", "(", ")", ".", "getOptions", "(", "true", ")", ")", ";", "}", "finally", "{", "done", "(", ")", ";", "}", "}", "private", "String", "processElement", "(", "ICompilationUnit", "unit", ",", "char", "[", "]", "source", ")", "{", "Document", "document", "=", "new", "Document", "(", "new", "String", "(", "source", ")", ")", ";", "CompilerOptions", "options", "=", "new", "CompilerOptions", "(", "unit", ".", "getJavaProject", "(", ")", ".", "getOptions", "(", "true", ")", ")", ";", "ASTParser", "parser", "=", "ASTParser", ".", "newParser", "(", "this", ".", "apiLevel", ")", ";", "parser", ".", "setCompilerOptions", "(", "options", ".", "getMap", "(", ")", ")", ";", "parser", ".", "setSource", "(", "source", ")", ";", "parser", ".", "setKind", "(", "ASTParser", ".", "K_COMPILATION_UNIT", ")", ";", "parser", ".", "setResolveBindings", "(", "false", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "ast", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ")", "parser", ".", "createAST", "(", "null", ")", ";", "ASTRewrite", "rewriter", "=", "sortCompilationUnit", "(", "ast", ",", "null", ")", ";", "if", "(", "rewriter", "==", "null", ")", "return", "document", ".", "get", "(", ")", ";", "TextEdit", "edits", "=", "rewriter", ".", "rewriteAST", "(", "document", ",", "unit", ".", "getJavaProject", "(", ")", ".", "getOptions", "(", "true", ")", ")", ";", "RangeMarker", "[", "]", "markers", "=", "null", ";", "if", "(", "this", ".", "positions", "!=", "null", ")", "{", "markers", "=", "new", "RangeMarker", "[", "this", ".", "positions", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "this", ".", "positions", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "markers", "[", "i", "]", "=", "new", "RangeMarker", "(", "this", ".", "positions", "[", "i", "]", ",", "0", ")", ";", "insert", "(", "edits", ",", "markers", "[", "i", "]", ")", ";", "}", "}", "try", "{", "edits", ".", "apply", "(", "document", ",", "TextEdit", ".", "UPDATE_REGIONS", ")", ";", "if", "(", "this", ".", "positions", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "markers", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "this", ".", "positions", "[", "i", "]", "=", "markers", "[", "i", "]", ".", "getOffset", "(", ")", ";", "}", "}", "}", "catch", "(", "BadLocationException", "e", ")", "{", "}", "return", "document", ".", "get", "(", ")", ";", "}", "private", "ASTRewrite", "sortCompilationUnit", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "ast", ",", "final", "TextEditGroup", "group", ")", "{", "ast", ".", "accept", "(", "new", "ASTVisitor", "(", ")", "{", "public", "boolean", "visit", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "compilationUnit", ")", "{", "List", "types", "=", "compilationUnit", ".", "types", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "types", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "AbstractTypeDeclaration", "typeDeclaration", "=", "(", "AbstractTypeDeclaration", ")", "iter", ".", "next", "(", ")", ";", "typeDeclaration", ".", "setProperty", "(", "CompilationUnitSorter", ".", "RELATIVE_ORDER", ",", "new", "Integer", "(", "typeDeclaration", ".", "getStartPosition", "(", ")", ")", ")", ";", "compilationUnit", ".", "setProperty", "(", "CONTAINS_MALFORMED_NODES", ",", "Boolean", ".", "valueOf", "(", "isMalformed", "(", "typeDeclaration", ")", ")", ")", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeDeclaration", "annotationTypeDeclaration", ")", "{", "List", "bodyDeclarations", "=", "annotationTypeDeclaration", ".", "bodyDeclarations", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "bodyDeclarations", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "BodyDeclaration", "bodyDeclaration", "=", "(", "BodyDeclaration", ")", "iter", ".", "next", "(", ")", ";", "bodyDeclaration", ".", "setProperty", "(", "CompilationUnitSorter", ".", "RELATIVE_ORDER", ",", "new", "Integer", "(", "bodyDeclaration", ".", "getStartPosition", "(", ")", ")", ")", ";", "annotationTypeDeclaration", ".", "setProperty", "(", "CONTAINS_MALFORMED_NODES", ",", "Boolean", ".", "valueOf", "(", "isMalformed", "(", "bodyDeclaration", ")", ")", ")", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "AnonymousClassDeclaration", "anonymousClassDeclaration", ")", "{", "List", "bodyDeclarations", "=", "anonymousClassDeclaration", ".", "bodyDeclarations", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "bodyDeclarations", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "BodyDeclaration", "bodyDeclaration", "=", "(", "BodyDeclaration", ")", "iter", ".", "next", "(", ")", ";", "bodyDeclaration", ".", "setProperty", "(", "CompilationUnitSorter", ".", "RELATIVE_ORDER", ",", "new", "Integer", "(", "bodyDeclaration", ".", "getStartPosition", "(", ")", ")", ")", ";", "anonymousClassDeclaration", ".", "setProperty", "(", "CONTAINS_MALFORMED_NODES", ",", "Boolean", ".", "valueOf", "(", "isMalformed", "(", "bodyDeclaration", ")", ")", ")", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ")", "{", "List", "bodyDeclarations", "=", "typeDeclaration", ".", "bodyDeclarations", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "bodyDeclarations", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "BodyDeclaration", "bodyDeclaration", "=", "(", "BodyDeclaration", ")", "iter", ".", "next", "(", ")", ";", "bodyDeclaration", ".", "setProperty", "(", "CompilationUnitSorter", ".", "RELATIVE_ORDER", ",", "new", "Integer", "(", "bodyDeclaration", ".", "getStartPosition", "(", ")", ")", ")", ";", "typeDeclaration", ".", "setProperty", "(", "CONTAINS_MALFORMED_NODES", ",", "Boolean", ".", "valueOf", "(", "isMalformed", "(", "bodyDeclaration", ")", ")", ")", ";", "}", "return", "true", ";", "}", "public", "boolean", "visit", "(", "EnumDeclaration", "enumDeclaration", ")", "{", "List", "bodyDeclarations", "=", "enumDeclaration", ".", "bodyDeclarations", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "bodyDeclarations", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "BodyDeclaration", "bodyDeclaration", "=", "(", "BodyDeclaration", ")", "iter", ".", "next", "(", ")", ";", "bodyDeclaration", ".", "setProperty", "(", "CompilationUnitSorter", ".", "RELATIVE_ORDER", ",", "new", "Integer", "(", "bodyDeclaration", ".", "getStartPosition", "(", ")", ")", ")", ";", "enumDeclaration", ".", "setProperty", "(", "CONTAINS_MALFORMED_NODES", ",", "Boolean", ".", "valueOf", "(", "isMalformed", "(", "bodyDeclaration", ")", ")", ")", ";", "}", "List", "enumConstants", "=", "enumDeclaration", ".", "enumConstants", "(", ")", ";", "for", "(", "Iterator", "iter", "=", "enumConstants", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "EnumConstantDeclaration", "enumConstantDeclaration", "=", "(", "EnumConstantDeclaration", ")", "iter", ".", "next", "(", ")", ";", "enumConstantDeclaration", ".", "setProperty", "(", "CompilationUnitSorter", ".", "RELATIVE_ORDER", ",", "new", "Integer", "(", "enumConstantDeclaration", ".", "getStartPosition", "(", ")", ")", ")", ";", "enumDeclaration", ".", "setProperty", "(", "CONTAINS_MALFORMED_NODES", ",", "Boolean", ".", "valueOf", "(", "isMalformed", "(", "enumConstantDeclaration", ")", ")", ")", ";", "}", "return", "true", ";", "}", "}", ")", ";", "final", "ASTRewrite", "rewriter", "=", "ASTRewrite", ".", "create", "(", "ast", ".", "getAST", "(", ")", ")", ";", "final", "boolean", "[", "]", "hasChanges", "=", "new", "boolean", "[", "]", "{", "false", "}", ";", "ast", ".", "accept", "(", "new", "ASTVisitor", "(", ")", "{", "private", "void", "sortElements", "(", "List", "elements", ",", "ListRewrite", "listRewrite", ")", "{", "if", "(", "elements", ".", "size", "(", ")", "==", "0", ")", "return", ";", "final", "List", "myCopy", "=", "new", "ArrayList", "(", ")", ";", "myCopy", ".", "addAll", "(", "elements", ")", ";", "Collections", ".", "sort", "(", "myCopy", ",", "SortElementsOperation", ".", "this", ".", "comparator", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elements", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ASTNode", "oldNode", "=", "(", "ASTNode", ")", "elements", ".", "get", "(", "i", ")", ";", "ASTNode", "newNode", "=", "(", "ASTNode", ")", "myCopy", ".", "get", "(", "i", ")", ";", "if", "(", "oldNode", "!=", "newNode", ")", "{", "listRewrite", ".", "replace", "(", "oldNode", ",", "rewriter", ".", "createMoveTarget", "(", "newNode", ")", ",", "group", ")", ";", "hasChanges", "[", "0", "]", "=", "true", ";", "}", "}", "}", "public", "boolean", "visit", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "compilationUnit", ")", "{", "if", "(", "checkMalformedNodes", "(", "compilationUnit", ")", ")", "{", "return", "true", ";", "}", "sortElements", "(", "compilationUnit", ".", "types", "(", ")", ",", "rewriter", ".", "getListRewrite", "(", "compilationUnit", ",", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ".", "TYPES_PROPERTY", ")", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "AnnotationTypeDeclaration", "annotationTypeDeclaration", ")", "{", "if", "(", "checkMalformedNodes", "(", "annotationTypeDeclaration", ")", ")", "{", "return", "true", ";", "}", "sortElements", "(", "annotationTypeDeclaration", ".", "bodyDeclarations", "(", ")", ",", "rewriter", ".", "getListRewrite", "(", "annotationTypeDeclaration", ",", "AnnotationTypeDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ")", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "AnonymousClassDeclaration", "anonymousClassDeclaration", ")", "{", "if", "(", "checkMalformedNodes", "(", "anonymousClassDeclaration", ")", ")", "{", "return", "true", ";", "}", "sortElements", "(", "anonymousClassDeclaration", ".", "bodyDeclarations", "(", ")", ",", "rewriter", ".", "getListRewrite", "(", "anonymousClassDeclaration", ",", "AnonymousClassDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ")", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "TypeDeclaration", "typeDeclaration", ")", "{", "if", "(", "checkMalformedNodes", "(", "typeDeclaration", ")", ")", "{", "return", "true", ";", "}", "sortElements", "(", "typeDeclaration", ".", "bodyDeclarations", "(", ")", ",", "rewriter", ".", "getListRewrite", "(", "typeDeclaration", ",", "TypeDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ")", ")", ";", "return", "true", ";", "}", "public", "boolean", "visit", "(", "EnumDeclaration", "enumDeclaration", ")", "{", "if", "(", "checkMalformedNodes", "(", "enumDeclaration", ")", ")", "{", "return", "true", ";", "}", "sortElements", "(", "enumDeclaration", ".", "bodyDeclarations", "(", ")", ",", "rewriter", ".", "getListRewrite", "(", "enumDeclaration", ",", "EnumDeclaration", ".", "BODY_DECLARATIONS_PROPERTY", ")", ")", ";", "sortElements", "(", "enumDeclaration", ".", "enumConstants", "(", ")", ",", "rewriter", ".", "getListRewrite", "(", "enumDeclaration", ",", "EnumDeclaration", ".", "ENUM_CONSTANTS_PROPERTY", ")", ")", ";", "return", "true", ";", "}", "}", ")", ";", "if", "(", "!", "hasChanges", "[", "0", "]", ")", "return", "null", ";", "return", "rewriter", ";", "}", "public", "IJavaModelStatus", "verify", "(", ")", "{", "if", "(", "this", ".", "elementsToProcess", ".", "length", "!=", "1", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NO_ELEMENTS_TO_PROCESS", ")", ";", "}", "if", "(", "this", ".", "elementsToProcess", "[", "0", "]", "==", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NO_ELEMENTS_TO_PROCESS", ")", ";", "}", "if", "(", "!", "(", "this", ".", "elementsToProcess", "[", "0", "]", "instanceof", "ICompilationUnit", ")", "||", "!", "(", "(", "ICompilationUnit", ")", "this", ".", "elementsToProcess", "[", "0", "]", ")", ".", "isWorkingCopy", "(", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "this", ".", "elementsToProcess", "[", "0", "]", ")", ";", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "public", "static", "void", "insert", "(", "TextEdit", "parent", ",", "TextEdit", "edit", ")", "{", "if", "(", "!", "parent", ".", "hasChildren", "(", ")", ")", "{", "parent", ".", "addChild", "(", "edit", ")", ";", "return", ";", "}", "TextEdit", "[", "]", "children", "=", "parent", ".", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "TextEdit", "child", "=", "children", "[", "i", "]", ";", "if", "(", "covers", "(", "child", ",", "edit", ")", ")", "{", "insert", "(", "child", ",", "edit", ")", ";", "return", ";", "}", "}", "for", "(", "int", "i", "=", "children", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "TextEdit", "child", "=", "children", "[", "i", "]", ";", "if", "(", "covers", "(", "edit", ",", "child", ")", ")", "{", "parent", ".", "removeChild", "(", "i", ")", ";", "edit", ".", "addChild", "(", "child", ")", ";", "}", "}", "parent", ".", "addChild", "(", "edit", ")", ";", "}", "private", "static", "boolean", "covers", "(", "TextEdit", "thisEdit", ",", "TextEdit", "otherEdit", ")", "{", "if", "(", "thisEdit", ".", "getLength", "(", ")", "==", "0", ")", "{", "return", "false", ";", "}", "int", "thisOffset", "=", "thisEdit", ".", "getOffset", "(", ")", ";", "int", "thisEnd", "=", "thisEdit", ".", "getExclusiveEnd", "(", ")", ";", "if", "(", "otherEdit", ".", "getLength", "(", ")", "==", "0", ")", "{", "int", "otherOffset", "=", "otherEdit", ".", "getOffset", "(", ")", ";", "return", "thisOffset", "<=", "otherOffset", "&&", "otherOffset", "<", "thisEnd", ";", "}", "else", "{", "int", "otherOffset", "=", "otherEdit", ".", "getOffset", "(", ")", ";", "int", "otherEnd", "=", "otherEdit", ".", "getExclusiveEnd", "(", ")", ";", "return", "thisOffset", "<=", "otherOffset", "&&", "otherEnd", "<=", "thisEnd", ";", "}", "}", "}", "</s>" ]
3,744
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IBuffer", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "BadLocationException", ";", "import", "org", ".", "eclipse", ".", "jface", ".", "text", ".", "Document", ";", "public", "class", "DocumentAdapter", "extends", "Document", "{", "private", "IBuffer", "buffer", ";", "public", "DocumentAdapter", "(", "IBuffer", "buffer", ")", "{", "super", "(", "buffer", ".", "getContents", "(", ")", ")", ";", "this", ".", "buffer", "=", "buffer", ";", "}", "public", "void", "set", "(", "String", "text", ")", "{", "super", ".", "set", "(", "text", ")", ";", "this", ".", "buffer", ".", "setContents", "(", "text", ")", ";", "}", "public", "void", "replace", "(", "int", "offset", ",", "int", "length", ",", "String", "text", ")", "throws", "BadLocationException", "{", "super", ".", "replace", "(", "offset", ",", "length", ",", "text", ")", ";", "this", ".", "buffer", ".", "replace", "(", "offset", ",", "length", ",", "text", ")", ";", "}", "}", "</s>" ]
3,745
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "public", "class", "ResolvedSourceField", "extends", "SourceField", "{", "private", "String", "uniqueKey", ";", "public", "ResolvedSourceField", "(", "JavaElement", "parent", ",", "String", "name", ",", "String", "uniqueKey", ")", "{", "super", "(", "parent", ",", "name", ")", ";", "this", ".", "uniqueKey", "=", "uniqueKey", ";", "}", "public", "String", "getKey", "(", ")", "{", "return", "this", ".", "uniqueKey", ";", "}", "public", "boolean", "isResolved", "(", ")", "{", "return", "true", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "super", ".", "toStringInfo", "(", "tab", ",", "buffer", ",", "info", ",", "showResolvedInfo", ")", ";", "if", "(", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "\"", "{key=\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "getKey", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"}\"", ")", ";", "}", "}", "public", "JavaElement", "unresolved", "(", ")", "{", "SourceRefElement", "handle", "=", "new", "SourceField", "(", "this", ".", "parent", ",", "this", ".", "name", ")", ";", "handle", ".", "occurrenceCount", "=", "this", ".", "occurrenceCount", ";", "return", "handle", ";", "}", "}", "</s>" ]
3,746
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IInitializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ISourceRange", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "Initializer", "extends", "Member", "implements", "IInitializer", "{", "protected", "Initializer", "(", "JavaElement", "parent", ",", "int", "count", ")", "{", "super", "(", "parent", ")", ";", "if", "(", "count", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "this", ".", "occurrenceCount", "=", "count", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "Initializer", ")", ")", "return", "false", ";", "return", "super", ".", "equals", "(", "o", ")", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "INITIALIZER", ";", "}", "protected", "void", "getHandleMemento", "(", "StringBuffer", "buff", ")", "{", "(", "(", "JavaElement", ")", "getParent", "(", ")", ")", ".", "getHandleMemento", "(", "buff", ")", ";", "buff", ".", "append", "(", "getHandleMementoDelimiter", "(", ")", ")", ";", "buff", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JavaElement", ".", "JEM_INITIALIZER", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "Util", ".", "combineHashCodes", "(", "this", ".", "parent", ".", "hashCode", "(", ")", ",", "this", ".", "occurrenceCount", ")", ";", "}", "public", "String", "readableName", "(", ")", "{", "return", "(", "(", "JavaElement", ")", "getDeclaringType", "(", ")", ")", ".", "readableName", "(", ")", ";", "}", "public", "void", "rename", "(", "String", "newName", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "this", ")", ")", ";", "}", "public", "ISourceRange", "getNameRange", "(", ")", "{", "return", "null", ";", "}", "public", "IJavaElement", "getPrimaryElement", "(", "boolean", "checkOwner", ")", "{", "if", "(", "checkOwner", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "getAncestor", "(", "COMPILATION_UNIT", ")", ";", "if", "(", "cu", "==", "null", "||", "cu", ".", "isPrimary", "(", ")", ")", "return", "this", ";", "}", "IJavaElement", "primaryParent", "=", "this", ".", "parent", ".", "getPrimaryElement", "(", "false", ")", ";", "return", "(", "(", "IType", ")", "primaryParent", ")", ".", "getInitializer", "(", "this", ".", "occurrenceCount", ")", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "if", "(", "info", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "buffer", ".", "append", "(", "\">", "(not", "open)\"", ")", ";", "}", "else", "if", "(", "info", "==", "NO_INFO", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "else", "{", "try", "{", "buffer", ".", "append", "(", "\"<\"", ")", ";", "if", "(", "Flags", ".", "isStatic", "(", "getFlags", "(", ")", ")", ")", "{", "buffer", ".", "append", "(", "\"static", "\"", ")", ";", "}", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "buffer", ".", "append", "(", "\">\"", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "buffer", ".", "append", "(", "\"\"", "+", "getElementName", "(", ")", ")", ";", "}", "}", "}", "}", "</s>" ]
3,747
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "InitializerWithChildrenInfo", "extends", "InitializerElementInfo", "{", "protected", "IJavaElement", "[", "]", "children", ";", "public", "InitializerWithChildrenInfo", "(", "IJavaElement", "[", "]", "children", ")", "{", "this", ".", "children", "=", "children", ";", "}", "public", "IJavaElement", "[", "]", "getChildren", "(", ")", "{", "return", "this", ".", "children", ";", "}", "}", "</s>" ]
3,748
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "GenericXMLWriter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "XMLWriter", "extends", "GenericXMLWriter", "{", "public", "XMLWriter", "(", "Writer", "writer", ",", "IJavaProject", "project", ",", "boolean", "printXmlVersion", ")", "{", "super", "(", "writer", ",", "Util", ".", "getLineSeparator", "(", "(", "String", ")", "null", ",", "project", ")", ",", "printXmlVersion", ")", ";", "}", "}", "</s>" ]
3,749
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "java", ".", "util", ".", "Stack", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "ReferenceInfoAdapter", ";", "public", "class", "AbstractDOMBuilder", "extends", "ReferenceInfoAdapter", "implements", "ILineStartFinder", "{", "protected", "boolean", "fAbort", ";", "protected", "boolean", "fBuildingCU", "=", "false", ";", "protected", "boolean", "fBuildingType", "=", "false", ";", "protected", "char", "[", "]", "fDocument", "=", "null", ";", "protected", "int", "[", "]", "fLineStartPositions", "=", "new", "int", "[", "]", "{", "0", "}", ";", "protected", "Stack", "fStack", "=", "null", ";", "protected", "int", "fFieldCount", ";", "protected", "DOMNode", "fNode", ";", "public", "AbstractDOMBuilder", "(", ")", "{", "super", "(", ")", ";", "}", "public", "void", "acceptLineSeparatorPositions", "(", "int", "[", "]", "positions", ")", "{", "if", "(", "positions", "!=", "null", ")", "{", "int", "length", "=", "positions", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "this", ".", "fLineStartPositions", "=", "new", "int", "[", "length", "+", "1", "]", ";", "this", ".", "fLineStartPositions", "[", "0", "]", "=", "0", ";", "int", "documentLength", "=", "this", ".", "fDocument", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "iPlusOne", "=", "i", "+", "1", ";", "int", "positionPlusOne", "=", "positions", "[", "i", "]", "+", "1", ";", "if", "(", "positionPlusOne", "<", "documentLength", ")", "{", "if", "(", "iPlusOne", "<", "length", ")", "{", "this", ".", "fLineStartPositions", "[", "iPlusOne", "]", "=", "positionPlusOne", ";", "}", "else", "{", "if", "(", "this", ".", "fDocument", "[", "positionPlusOne", "]", "==", "'\\n'", ")", "{", "this", ".", "fLineStartPositions", "[", "iPlusOne", "]", "=", "positionPlusOne", "+", "1", ";", "}", "else", "{", "this", ".", "fLineStartPositions", "[", "iPlusOne", "]", "=", "positionPlusOne", ";", "}", "}", "}", "else", "{", "this", ".", "fLineStartPositions", "[", "iPlusOne", "]", "=", "positionPlusOne", ";", "}", "}", "}", "}", "}", "protected", "void", "addChild", "(", "IDOMNode", "child", ")", "{", "if", "(", "this", ".", "fStack", ".", "size", "(", ")", ">", "0", ")", "{", "DOMNode", "parent", "=", "(", "DOMNode", ")", "this", ".", "fStack", ".", "peek", "(", ")", ";", "if", "(", "this", ".", "fBuildingCU", "||", "this", ".", "fBuildingType", ")", "{", "parent", ".", "basicAddChild", "(", "child", ")", ";", "}", "}", "}", "public", "IDOMCompilationUnit", "createCompilationUnit", "(", "char", "[", "]", "contents", ",", "char", "[", "]", "name", ")", "{", "return", "createCompilationUnit", "(", "new", "CompilationUnit", "(", "contents", ",", "name", ")", ")", ";", "}", "public", "IDOMCompilationUnit", "createCompilationUnit", "(", "ICompilationUnit", "compilationUnit", ")", "{", "if", "(", "this", ".", "fAbort", ")", "{", "return", "null", ";", "}", "this", ".", "fNode", ".", "normalize", "(", "this", ")", ";", "return", "(", "IDOMCompilationUnit", ")", "this", ".", "fNode", ";", "}", "public", "void", "enterCompilationUnit", "(", ")", "{", "if", "(", "this", ".", "fBuildingCU", ")", "{", "IDOMCompilationUnit", "cu", "=", "new", "DOMCompilationUnit", "(", "this", ".", "fDocument", ",", "new", "int", "[", "]", "{", "0", ",", "this", ".", "fDocument", ".", "length", "-", "1", "}", ")", ";", "this", ".", "fStack", ".", "push", "(", "cu", ")", ";", "}", "}", "public", "void", "exitCompilationUnit", "(", "int", "declarationEnd", ")", "{", "DOMCompilationUnit", "cu", "=", "(", "DOMCompilationUnit", ")", "this", ".", "fStack", ".", "pop", "(", ")", ";", "cu", ".", "setSourceRangeEnd", "(", "declarationEnd", ")", ";", "this", ".", "fNode", "=", "cu", ";", "}", "protected", "void", "exitType", "(", "int", "bodyEnd", ",", "int", "declarationEnd", ")", "{", "DOMType", "type", "=", "(", "DOMType", ")", "this", ".", "fStack", ".", "pop", "(", ")", ";", "type", ".", "setSourceRangeEnd", "(", "declarationEnd", ")", ";", "type", ".", "setCloseBodyRangeStart", "(", "bodyEnd", ")", ";", "type", ".", "setCloseBodyRangeEnd", "(", "bodyEnd", ")", ";", "this", ".", "fNode", "=", "type", ";", "}", "public", "int", "getLineStart", "(", "int", "position", ")", "{", "int", "lineSeparatorCount", "=", "this", ".", "fLineStartPositions", ".", "length", ";", "for", "(", "int", "i", "=", "lineSeparatorCount", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "this", ".", "fLineStartPositions", "[", "i", "]", "<=", "position", ")", "return", "this", ".", "fLineStartPositions", "[", "i", "]", ";", "}", "return", "0", ";", "}", "protected", "void", "initializeBuild", "(", "char", "[", "]", "sourceCode", ",", "boolean", "buildingCompilationUnit", ",", "boolean", "buildingType", ")", "{", "this", ".", "fBuildingCU", "=", "buildingCompilationUnit", ";", "this", ".", "fBuildingType", "=", "buildingType", ";", "this", ".", "fStack", "=", "new", "Stack", "(", ")", ";", "this", ".", "fDocument", "=", "sourceCode", ";", "this", ".", "fFieldCount", "=", "0", ";", "this", ".", "fAbort", "=", "false", ";", "}", "}", "</s>" ]
3,750
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "DOMField", "extends", "DOMMember", "implements", "IDOMField", "{", "protected", "String", "fType", ";", "protected", "int", "[", "]", "fTypeRange", ";", "protected", "String", "fInitializer", ";", "protected", "int", "[", "]", "fInitializerRange", ";", "DOMField", "(", ")", "{", "}", "DOMField", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ",", "int", "[", "]", "commentRange", ",", "int", "flags", ",", "int", "[", "]", "modifierRange", ",", "int", "[", "]", "typeRange", ",", "String", "type", ",", "boolean", "hasInitializer", ",", "int", "[", "]", "initRange", ",", "boolean", "isVariableDeclarator", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ",", "commentRange", ",", "flags", ",", "modifierRange", ")", ";", "this", ".", "fType", "=", "type", ";", "this", ".", "fTypeRange", "=", "typeRange", ";", "setHasInitializer", "(", "hasInitializer", ")", ";", "this", ".", "fInitializerRange", "=", "initRange", ";", "setIsVariableDeclarator", "(", "isVariableDeclarator", ")", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "true", ")", ";", "}", "DOMField", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ",", "int", "flags", ",", "String", "type", ",", "boolean", "isVariableDeclarator", ")", "{", "this", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "flags", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "type", ",", "false", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "isVariableDeclarator", ")", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "false", ")", ";", "}", "protected", "void", "appendMemberBodyContents", "(", "CharArrayBuffer", "buffer", ")", "{", "}", "protected", "void", "appendMemberDeclarationContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "isVariableDeclarator", "(", ")", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSourceRange", "[", "0", "]", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fSourceRange", "[", "0", "]", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "getTypeContents", "(", ")", ")", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fTypeRange", "[", "1", "]", "+", "1", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fTypeRange", "[", "1", "]", "-", "1", ")", ";", "}", "buffer", ".", "append", "(", "getNameContents", "(", ")", ")", ";", "if", "(", "hasInitializer", "(", ")", ")", "{", "if", "(", "this", ".", "fInitializerRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "'='", ")", ".", "append", "(", "this", ".", "fInitializer", ")", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fNameRange", "[", "1", "]", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fInitializerRange", "[", "0", "]", "-", "this", ".", "fNameRange", "[", "1", "]", "-", "1", ")", ".", "append", "(", "getInitializer", "(", ")", ")", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fInitializerRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fInitializerRange", "[", "1", "]", ")", ";", "}", "}", "else", "{", "if", "(", "this", ".", "fInitializerRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fNameRange", "[", "1", "]", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fInitializerRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fInitializerRange", "[", "1", "]", ")", ";", "}", "}", "}", "protected", "void", "appendMemberHeaderFragment", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "isVariableDeclarator", "(", ")", ")", "{", "return", ";", "}", "else", "{", "super", ".", "appendMemberHeaderFragment", "(", "buffer", ")", ";", "}", "}", "protected", "void", "appendSimpleContents", "(", "CharArrayBuffer", "buffer", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSourceRange", "[", "0", "]", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fSourceRange", "[", "0", "]", ")", ";", "buffer", ".", "append", "(", "this", ".", "fName", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fNameRange", "[", "1", "]", ")", ";", "}", "protected", "void", "becomeDetailed", "(", ")", "throws", "DOMException", "{", "if", "(", "!", "isDetailed", "(", ")", ")", "{", "if", "(", "isVariableDeclarator", "(", ")", "||", "hasMultipleVariableDeclarators", "(", ")", ")", "{", "DOMNode", "first", "=", "getFirstFieldDeclaration", "(", ")", ";", "DOMNode", "last", "=", "getLastFieldDeclaration", "(", ")", ";", "DOMNode", "node", "=", "first", ";", "String", "source", "=", "first", ".", "getContents", "(", ")", ";", "while", "(", "node", "!=", "last", ")", "{", "node", "=", "node", ".", "fNextNode", ";", "source", "+=", "node", ".", "getContents", "(", ")", ";", "}", "DOMBuilder", "builder", "=", "new", "DOMBuilder", "(", ")", ";", "IDOMField", "[", "]", "details", "=", "builder", ".", "createFields", "(", "source", ".", "toCharArray", "(", ")", ")", ";", "if", "(", "details", ".", "length", "==", "0", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_cannotDetail", ")", ";", "}", "else", "{", "node", "=", "this", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "details", ".", "length", ";", "i", "++", ")", "{", "node", ".", "shareContents", "(", "(", "DOMNode", ")", "details", "[", "i", "]", ")", ";", "node", "=", "node", ".", "fNextNode", ";", "}", "}", "}", "else", "{", "super", ".", "becomeDetailed", "(", ")", ";", "}", "}", "}", "public", "Object", "clone", "(", ")", "{", "if", "(", "isVariableDeclarator", "(", ")", "||", "hasMultipleVariableDeclarators", "(", ")", ")", "{", "return", "getFactory", "(", ")", ".", "createField", "(", "new", "String", "(", "getSingleVariableDeclaratorContents", "(", ")", ")", ")", ";", "}", "else", "{", "return", "super", ".", "clone", "(", ")", ";", "}", "}", "protected", "void", "expand", "(", ")", "{", "if", "(", "isVariableDeclarator", "(", ")", "||", "hasMultipleVariableDeclarators", "(", ")", ")", "{", "Enumeration", "siblings", "=", "new", "SiblingEnumeration", "(", "getFirstFieldDeclaration", "(", ")", ")", ";", "DOMField", "field", "=", "(", "DOMField", ")", "siblings", ".", "nextElement", "(", ")", ";", "DOMNode", "next", "=", "field", ".", "fNextNode", ";", "while", "(", "siblings", ".", "hasMoreElements", "(", ")", "&&", "(", "next", "instanceof", "DOMField", ")", "&&", "(", "(", "(", "DOMField", ")", "next", ")", ".", "isVariableDeclarator", "(", ")", ")", ")", "{", "field", ".", "localizeContents", "(", ")", ";", "if", "(", "field", ".", "fParent", "!=", "null", ")", "{", "field", ".", "fParent", ".", "fragment", "(", ")", ";", "}", "field", "=", "(", "DOMField", ")", "siblings", ".", "nextElement", "(", ")", ";", "next", "=", "field", ".", "fNextNode", ";", "}", "field", ".", "localizeContents", "(", ")", ";", "}", "}", "protected", "DOMNode", "getDetailedNode", "(", ")", "{", "if", "(", "isVariableDeclarator", "(", ")", "||", "hasMultipleVariableDeclarators", "(", ")", ")", "{", "return", "(", "DOMNode", ")", "getFactory", "(", ")", ".", "createField", "(", "new", "String", "(", "getSingleVariableDeclaratorContents", "(", ")", ")", ")", ";", "}", "else", "{", "return", "(", "DOMNode", ")", "getFactory", "(", ")", ".", "createField", "(", "getContents", "(", ")", ")", ";", "}", "}", "protected", "DOMField", "getFirstFieldDeclaration", "(", ")", "{", "if", "(", "isVariableDeclarator", "(", ")", ")", "{", "return", "(", "(", "DOMField", ")", "this", ".", "fPreviousNode", ")", ".", "getFirstFieldDeclaration", "(", ")", ";", "}", "else", "{", "return", "this", ";", "}", "}", "public", "String", "getInitializer", "(", ")", "{", "becomeDetailed", "(", ")", ";", "if", "(", "hasInitializer", "(", ")", ")", "{", "if", "(", "this", ".", "fInitializer", "!=", "null", ")", "{", "return", "this", ".", "fInitializer", ";", "}", "else", "{", "return", "new", "String", "(", "this", ".", "fDocument", ",", "this", ".", "fInitializerRange", "[", "0", "]", ",", "this", ".", "fInitializerRange", "[", "1", "]", "+", "1", "-", "this", ".", "fInitializerRange", "[", "0", "]", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "public", "IJavaElement", "getJavaElement", "(", "IJavaElement", "parent", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "return", "(", "(", "IType", ")", "parent", ")", ".", "getField", "(", "getName", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_illegalParent", ")", ";", "}", "}", "protected", "DOMField", "getLastFieldDeclaration", "(", ")", "{", "DOMField", "field", "=", "this", ";", "while", "(", "field", ".", "isVariableDeclarator", "(", ")", "||", "field", ".", "hasMultipleVariableDeclarators", "(", ")", ")", "{", "if", "(", "field", ".", "fNextNode", "instanceof", "DOMField", "&&", "(", "(", "DOMField", ")", "field", ".", "fNextNode", ")", ".", "isVariableDeclarator", "(", ")", ")", "{", "field", "=", "(", "DOMField", ")", "field", ".", "fNextNode", ";", "}", "else", "{", "break", ";", "}", "}", "return", "field", ";", "}", "protected", "int", "getMemberDeclarationStartPosition", "(", ")", "{", "return", "this", ".", "fTypeRange", "[", "0", "]", ";", "}", "public", "int", "getNodeType", "(", ")", "{", "return", "IDOMNode", ".", "FIELD", ";", "}", "protected", "char", "[", "]", "getSingleVariableDeclaratorContents", "(", ")", "{", "CharArrayBuffer", "buffer", "=", "new", "CharArrayBuffer", "(", ")", ";", "DOMField", "first", "=", "getFirstFieldDeclaration", "(", ")", ";", "if", "(", "first", ".", "isDetailed", "(", ")", ")", "{", "first", ".", "appendMemberHeaderFragment", "(", "buffer", ")", ";", "buffer", ".", "append", "(", "getType", "(", ")", ")", ";", "if", "(", "isVariableDeclarator", "(", ")", ")", "{", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fTypeRange", "[", "1", "]", "+", "1", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fTypeRange", "[", "1", "]", "-", "1", ")", ";", "}", "}", "else", "{", "buffer", ".", "append", "(", "first", ".", "fDocument", ",", "first", ".", "fSourceRange", "[", "0", "]", ",", "first", ".", "fNameRange", "[", "0", "]", "-", "first", ".", "fSourceRange", "[", "0", "]", ")", ";", "}", "buffer", ".", "append", "(", "getName", "(", ")", ")", ";", "if", "(", "hasInitializer", "(", ")", ")", "{", "if", "(", "this", ".", "fInitializerRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "'='", ")", ".", "append", "(", "this", ".", "fInitializer", ")", ".", "append", "(", "';'", ")", ".", "append", "(", "Util", ".", "getLineSeparator", "(", "buffer", ".", "toString", "(", ")", ",", "null", ")", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fInitializerRange", "[", "0", "]", "-", "this", ".", "fNameRange", "[", "1", "]", "-", "1", ")", ".", "append", "(", "getInitializer", "(", ")", ")", ".", "append", "(", "';'", ")", ".", "append", "(", "Util", ".", "getLineSeparator", "(", "buffer", ".", "toString", "(", ")", ",", "null", ")", ")", ";", "}", "}", "else", "{", "buffer", ".", "append", "(", "';'", ")", ".", "append", "(", "Util", ".", "getLineSeparator", "(", "buffer", ".", "toString", "(", ")", ",", "null", ")", ")", ";", "}", "return", "buffer", ".", "getContents", "(", ")", ";", "}", "public", "String", "getType", "(", ")", "{", "return", "this", ".", "fType", ";", "}", "protected", "char", "[", "]", "getTypeContents", "(", ")", "{", "if", "(", "isTypeAltered", "(", ")", ")", "{", "return", "this", ".", "fType", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "return", "CharOperation", ".", "subarray", "(", "this", ".", "fDocument", ",", "this", ".", "fTypeRange", "[", "0", "]", ",", "this", ".", "fTypeRange", "[", "1", "]", "+", "1", ")", ";", "}", "}", "protected", "boolean", "hasInitializer", "(", ")", "{", "return", "getMask", "(", "MASK_FIELD_HAS_INITIALIZER", ")", ";", "}", "protected", "boolean", "hasMultipleVariableDeclarators", "(", ")", "{", "return", "this", ".", "fNextNode", "!=", "null", "&&", "(", "this", ".", "fNextNode", "instanceof", "DOMField", ")", "&&", "(", "(", "DOMField", ")", "this", ".", "fNextNode", ")", ".", "isVariableDeclarator", "(", ")", ";", "}", "public", "void", "insertSibling", "(", "IDOMNode", "sibling", ")", "throws", "IllegalArgumentException", ",", "DOMException", "{", "if", "(", "isVariableDeclarator", "(", ")", ")", "{", "expand", "(", ")", ";", "}", "super", ".", "insertSibling", "(", "sibling", ")", ";", "}", "protected", "boolean", "isTypeAltered", "(", ")", "{", "return", "getMask", "(", "MASK_FIELD_TYPE_ALTERED", ")", ";", "}", "protected", "boolean", "isVariableDeclarator", "(", ")", "{", "return", "getMask", "(", "MASK_FIELD_IS_VARIABLE_DECLARATOR", ")", ";", "}", "protected", "DOMNode", "newDOMNode", "(", ")", "{", "return", "new", "DOMField", "(", ")", ";", "}", "void", "normalizeEndPosition", "(", "ILineStartFinder", "finder", ",", "DOMNode", "next", ")", "{", "if", "(", "next", "==", "null", ")", "{", "DOMNode", "parent", "=", "(", "DOMNode", ")", "getParent", "(", ")", ";", "if", "(", "parent", "==", "null", "||", "parent", "instanceof", "DOMCompilationUnit", ")", "{", "setSourceRangeEnd", "(", "this", ".", "fDocument", ".", "length", "-", "1", ")", ";", "}", "else", "{", "int", "temp", "=", "(", "(", "DOMType", ")", "parent", ")", ".", "getCloseBodyPosition", "(", ")", "-", "1", ";", "setSourceRangeEnd", "(", "temp", ")", ";", "this", ".", "fInsertionPosition", "=", "Math", ".", "max", "(", "finder", ".", "getLineStart", "(", "temp", "+", "1", ")", ",", "getEndPosition", "(", ")", ")", ";", "}", "}", "else", "{", "int", "temp", "=", "next", ".", "getStartPosition", "(", ")", "-", "1", ";", "this", ".", "fInsertionPosition", "=", "Math", ".", "max", "(", "finder", ".", "getLineStart", "(", "temp", "+", "1", ")", ",", "getEndPosition", "(", ")", ")", ";", "next", ".", "normalizeStartPosition", "(", "getEndPosition", "(", ")", ",", "finder", ")", ";", "if", "(", "next", "instanceof", "DOMField", ")", "{", "DOMField", "field", "=", "(", "DOMField", ")", "next", ";", "if", "(", "field", ".", "isVariableDeclarator", "(", ")", "&&", "this", ".", "fTypeRange", "[", "0", "]", "==", "field", ".", "fTypeRange", "[", "0", "]", ")", "return", ";", "}", "setSourceRangeEnd", "(", "next", ".", "getStartPosition", "(", ")", "-", "1", ")", ";", "}", "}", "void", "normalizeStartPosition", "(", "int", "endPosition", ",", "ILineStartFinder", "finder", ")", "{", "if", "(", "isVariableDeclarator", "(", ")", ")", "{", "setStartPosition", "(", "this", ".", "fPreviousNode", ".", "getEndPosition", "(", ")", "+", "1", ")", ";", "}", "else", "{", "super", ".", "normalizeStartPosition", "(", "endPosition", ",", "finder", ")", ";", "}", "}", "protected", "void", "offset", "(", "int", "offset", ")", "{", "super", ".", "offset", "(", "offset", ")", ";", "offsetRange", "(", "this", ".", "fInitializerRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fTypeRange", ",", "offset", ")", ";", "}", "public", "void", "remove", "(", ")", "{", "expand", "(", ")", ";", "super", ".", "remove", "(", ")", ";", "}", "public", "void", "setComment", "(", "String", "comment", ")", "{", "expand", "(", ")", ";", "super", ".", "setComment", "(", "comment", ")", ";", "}", "public", "void", "setFlags", "(", "int", "flags", ")", "{", "expand", "(", ")", ";", "super", ".", "setFlags", "(", "flags", ")", ";", "}", "protected", "void", "setHasInitializer", "(", "boolean", "hasInitializer", ")", "{", "setMask", "(", "MASK_FIELD_HAS_INITIALIZER", ",", "hasInitializer", ")", ";", "}", "public", "void", "setInitializer", "(", "String", "initializer", ")", "{", "becomeDetailed", "(", ")", ";", "fragment", "(", ")", ";", "setHasInitializer", "(", "initializer", "!=", "null", ")", ";", "this", ".", "fInitializer", "=", "initializer", ";", "}", "void", "setInitializerRange", "(", "int", "start", ",", "int", "end", ")", "{", "this", ".", "fInitializerRange", "[", "0", "]", "=", "start", ";", "this", ".", "fInitializerRange", "[", "1", "]", "=", "end", ";", "}", "protected", "void", "setIsVariableDeclarator", "(", "boolean", "isVariableDeclarator", ")", "{", "setMask", "(", "MASK_FIELD_IS_VARIABLE_DECLARATOR", ",", "isVariableDeclarator", ")", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_nullName", ")", ";", "}", "else", "{", "super", ".", "setName", "(", "name", ")", ";", "setTypeAltered", "(", "true", ")", ";", "}", "}", "public", "void", "setType", "(", "String", "typeName", ")", "throws", "IllegalArgumentException", "{", "if", "(", "typeName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_nullType", ")", ";", "}", "becomeDetailed", "(", ")", ";", "expand", "(", ")", ";", "fragment", "(", ")", ";", "setTypeAltered", "(", "true", ")", ";", "setNameAltered", "(", "true", ")", ";", "this", ".", "fType", "=", "typeName", ";", "}", "protected", "void", "setTypeAltered", "(", "boolean", "typeAltered", ")", "{", "setMask", "(", "MASK_FIELD_TYPE_ALTERED", ",", "typeAltered", ")", ";", "}", "protected", "void", "shareContents", "(", "DOMNode", "node", ")", "{", "super", ".", "shareContents", "(", "node", ")", ";", "DOMField", "field", "=", "(", "DOMField", ")", "node", ";", "this", ".", "fInitializer", "=", "field", ".", "fInitializer", ";", "this", ".", "fInitializerRange", "=", "rangeCopy", "(", "field", ".", "fInitializerRange", ")", ";", "this", ".", "fType", "=", "field", ".", "fType", ";", "this", ".", "fTypeRange", "=", "rangeCopy", "(", "field", ".", "fTypeRange", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"FIELD:", "\"", "+", "getName", "(", ")", ";", "}", "}", "</s>" ]
3,751
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "abstract", "class", "DOMMember", "extends", "DOMNode", "implements", "IDOMMember", "{", "protected", "int", "fFlags", "=", "0", ";", "protected", "String", "fComment", "=", "null", ";", "protected", "int", "[", "]", "fCommentRange", ";", "protected", "char", "[", "]", "fModifiers", "=", "null", ";", "protected", "int", "[", "]", "fModifierRange", ";", "DOMMember", "(", ")", "{", "}", "DOMMember", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ",", "int", "[", "]", "commentRange", ",", "int", "flags", ",", "int", "[", "]", "modifierRange", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ")", ";", "this", ".", "fFlags", "=", "flags", ";", "this", ".", "fComment", "=", "null", ";", "this", ".", "fCommentRange", "=", "commentRange", ";", "this", ".", "fModifierRange", "=", "modifierRange", ";", "setHasComment", "(", "commentRange", "[", "0", "]", ">=", "0", ")", ";", "}", "protected", "void", "appendFragmentedContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "isDetailed", "(", ")", ")", "{", "appendMemberHeaderFragment", "(", "buffer", ")", ";", "appendMemberDeclarationContents", "(", "buffer", ")", ";", "appendMemberBodyContents", "(", "buffer", ")", ";", "}", "else", "{", "appendSimpleContents", "(", "buffer", ")", ";", "}", "}", "protected", "abstract", "void", "appendMemberBodyContents", "(", "CharArrayBuffer", "buffer", ")", ";", "protected", "abstract", "void", "appendMemberDeclarationContents", "(", "CharArrayBuffer", "buffer", ")", ";", "protected", "void", "appendMemberHeaderFragment", "(", "CharArrayBuffer", "buffer", ")", "{", "int", "spaceStart", ",", "spaceEnd", ";", "if", "(", "hasComment", "(", ")", ")", "{", "spaceStart", "=", "this", ".", "fSourceRange", "[", "0", "]", ";", "spaceEnd", "=", "this", ".", "fCommentRange", "[", "0", "]", ";", "if", "(", "spaceEnd", ">", "0", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "spaceStart", ",", "spaceEnd", "-", "spaceStart", ")", ";", "}", "}", "String", "fragment", "=", "getComment", "(", ")", ";", "if", "(", "fragment", "!=", "null", ")", "{", "buffer", ".", "append", "(", "fragment", ")", ";", "}", "if", "(", "this", ".", "fCommentRange", "[", "1", "]", ">=", "0", ")", "{", "spaceStart", "=", "this", ".", "fCommentRange", "[", "1", "]", "+", "1", ";", "}", "else", "{", "spaceStart", "=", "this", ".", "fSourceRange", "[", "0", "]", ";", "}", "if", "(", "this", ".", "fModifierRange", "[", "0", "]", ">=", "0", ")", "{", "spaceEnd", "=", "this", ".", "fModifierRange", "[", "0", "]", "-", "1", ";", "}", "else", "{", "spaceEnd", "=", "getMemberDeclarationStartPosition", "(", ")", "-", "1", ";", "}", "if", "(", "spaceEnd", ">=", "spaceStart", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "spaceStart", ",", "spaceEnd", "+", "1", "-", "spaceStart", ")", ";", "}", "buffer", ".", "append", "(", "getModifiersText", "(", ")", ")", ";", "}", "protected", "abstract", "void", "appendSimpleContents", "(", "CharArrayBuffer", "buffer", ")", ";", "protected", "String", "[", "]", "appendString", "(", "String", "[", "]", "list", ",", "String", "element", ")", "{", "String", "[", "]", "copy", "=", "new", "String", "[", "list", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "list", ",", "0", ",", "copy", ",", "0", ",", "list", ".", "length", ")", ";", "copy", "[", "list", ".", "length", "]", "=", "element", ";", "return", "copy", ";", "}", "protected", "char", "[", "]", "generateFlags", "(", ")", "{", "char", "[", "]", "flags", "=", "Flags", ".", "toString", "(", "getFlags", "(", ")", ")", ".", "toCharArray", "(", ")", ";", "if", "(", "flags", ".", "length", "==", "0", ")", "{", "return", "flags", ";", "}", "else", "{", "return", "CharOperation", ".", "concat", "(", "flags", ",", "new", "char", "[", "]", "{", "'", "'", "}", ")", ";", "}", "}", "public", "String", "getComment", "(", ")", "{", "becomeDetailed", "(", ")", ";", "if", "(", "hasComment", "(", ")", ")", "{", "if", "(", "this", ".", "fComment", "!=", "null", ")", "{", "return", "this", ".", "fComment", ";", "}", "else", "{", "return", "new", "String", "(", "this", ".", "fDocument", ",", "this", ".", "fCommentRange", "[", "0", "]", ",", "this", ".", "fCommentRange", "[", "1", "]", "+", "1", "-", "this", ".", "fCommentRange", "[", "0", "]", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "public", "int", "getFlags", "(", ")", "{", "return", "this", ".", "fFlags", ";", "}", "protected", "abstract", "int", "getMemberDeclarationStartPosition", "(", ")", ";", "protected", "char", "[", "]", "getModifiersText", "(", ")", "{", "if", "(", "this", ".", "fModifiers", "==", "null", ")", "{", "if", "(", "this", ".", "fModifierRange", "[", "0", "]", "<", "0", ")", "{", "return", "null", ";", "}", "else", "{", "return", "CharOperation", ".", "subarray", "(", "this", ".", "fDocument", ",", "this", ".", "fModifierRange", "[", "0", "]", ",", "this", ".", "fModifierRange", "[", "1", "]", "+", "1", ")", ";", "}", "}", "else", "{", "return", "this", ".", "fModifiers", ";", "}", "}", "protected", "boolean", "hasBody", "(", ")", "{", "return", "getMask", "(", "MASK_HAS_BODY", ")", ";", "}", "protected", "boolean", "hasComment", "(", ")", "{", "return", "getMask", "(", "MASK_HAS_COMMENT", ")", ";", "}", "protected", "void", "offset", "(", "int", "offset", ")", "{", "super", ".", "offset", "(", "offset", ")", ";", "offsetRange", "(", "this", ".", "fCommentRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fModifierRange", ",", "offset", ")", ";", "}", "public", "void", "setComment", "(", "String", "comment", ")", "{", "becomeDetailed", "(", ")", ";", "this", ".", "fComment", "=", "comment", ";", "fragment", "(", ")", ";", "setHasComment", "(", "comment", "!=", "null", ")", ";", "if", "(", "comment", "!=", "null", "&&", "comment", ".", "indexOf", "(", "\"@deprecated\"", ")", ">=", "0", ")", "{", "this", ".", "fFlags", "=", "this", ".", "fFlags", "|", "ClassFileConstants", ".", "AccDeprecated", ";", "return", ";", "}", "this", ".", "fFlags", "=", "this", ".", "fFlags", "&", "(", "~", "ClassFileConstants", ".", "AccDeprecated", ")", ";", "}", "public", "void", "setFlags", "(", "int", "flags", ")", "{", "becomeDetailed", "(", ")", ";", "if", "(", "Flags", ".", "isDeprecated", "(", "this", ".", "fFlags", ")", ")", "{", "this", ".", "fFlags", "=", "flags", "|", "ClassFileConstants", ".", "AccDeprecated", ";", "}", "else", "{", "this", ".", "fFlags", "=", "flags", "&", "(", "~", "ClassFileConstants", ".", "AccDeprecated", ")", ";", "}", "fragment", "(", ")", ";", "this", ".", "fModifiers", "=", "generateFlags", "(", ")", ";", "}", "protected", "void", "setHasBody", "(", "boolean", "hasBody", ")", "{", "setMask", "(", "MASK_HAS_BODY", ",", "hasBody", ")", ";", "}", "protected", "void", "setHasComment", "(", "boolean", "hasComment", ")", "{", "setMask", "(", "MASK_HAS_COMMENT", ",", "hasComment", ")", ";", "}", "protected", "void", "setStartPosition", "(", "int", "start", ")", "{", "if", "(", "this", ".", "fCommentRange", "[", "0", "]", ">=", "0", ")", "{", "this", ".", "fCommentRange", "[", "0", "]", "=", "start", ";", "}", "super", ".", "setStartPosition", "(", "start", ")", ";", "}", "protected", "void", "shareContents", "(", "DOMNode", "node", ")", "{", "super", ".", "shareContents", "(", "node", ")", ";", "DOMMember", "member", "=", "(", "DOMMember", ")", "node", ";", "this", ".", "fComment", "=", "member", ".", "fComment", ";", "this", ".", "fCommentRange", "=", "rangeCopy", "(", "member", ".", "fCommentRange", ")", ";", "this", ".", "fFlags", "=", "member", ".", "fFlags", ";", "this", ".", "fModifiers", "=", "member", ".", "fModifiers", ";", "this", ".", "fModifierRange", "=", "rangeCopy", "(", "member", ".", "fModifierRange", ")", ";", "}", "}", "</s>" ]
3,752
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CategorizedProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ISourceElementRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Expression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ImportReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "TypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "public", "class", "SimpleDOMBuilder", "extends", "AbstractDOMBuilder", "implements", "ISourceElementRequestor", "{", "public", "void", "acceptProblem", "(", "CategorizedProblem", "problem", ")", "{", "}", "public", "void", "acceptImport", "(", "int", "declarationStart", ",", "int", "declarationEnd", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "[", "]", "tokens", ",", "boolean", "onDemand", ",", "int", "modifiers", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "declarationStart", ",", "declarationEnd", "}", ";", "String", "importName", "=", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "tokens", ",", "'.'", ")", ")", ";", "if", "(", "onDemand", ")", "{", "importName", "+=", "\".*\"", ";", "}", "this", ".", "fNode", "=", "new", "DOMImport", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "importName", ",", "onDemand", ",", "modifiers", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "}", "public", "void", "acceptPackage", "(", "ImportReference", "importReference", ")", "{", "int", "[", "]", "sourceRange", "=", "new", "int", "[", "]", "{", "importReference", ".", "declarationSourceStart", ",", "importReference", ".", "declarationSourceEnd", "}", ";", "char", "[", "]", "name", "=", "CharOperation", ".", "concatWith", "(", "importReference", ".", "getImportName", "(", ")", ",", "'.'", ")", ";", "this", ".", "fNode", "=", "new", "DOMPackage", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "new", "String", "(", "name", ")", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "}", "public", "IDOMCompilationUnit", "createCompilationUnit", "(", "String", "sourceCode", ",", "String", "name", ")", "{", "return", "createCompilationUnit", "(", "sourceCode", ".", "toCharArray", "(", ")", ",", "name", ".", "toCharArray", "(", ")", ")", ";", "}", "public", "IDOMCompilationUnit", "createCompilationUnit", "(", "ICompilationUnit", "compilationUnit", ")", "{", "initializeBuild", "(", "compilationUnit", ".", "getContents", "(", ")", ",", "true", ",", "true", ")", ";", "getParser", "(", "JavaCore", ".", "getOptions", "(", ")", ")", ".", "parseCompilationUnit", "(", "compilationUnit", ",", "false", ",", "null", ")", ";", "return", "super", ".", "createCompilationUnit", "(", "compilationUnit", ")", ";", "}", "protected", "void", "enterAbstractMethod", "(", "MethodInfo", "methodInfo", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "methodInfo", ".", "declarationStart", ",", "-", "1", "}", ";", "int", "[", "]", "nameRange", "=", "{", "methodInfo", ".", "nameSourceStart", ",", "methodInfo", ".", "nameSourceEnd", "}", ";", "this", ".", "fNode", "=", "new", "DOMMethod", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "CharOperation", ".", "charToString", "(", "methodInfo", ".", "name", ")", ",", "nameRange", ",", "methodInfo", ".", "modifiers", ",", "methodInfo", ".", "isConstructor", ",", "CharOperation", ".", "charToString", "(", "methodInfo", ".", "returnType", ")", ",", "CharOperation", ".", "charArrayToStringArray", "(", "methodInfo", ".", "parameterTypes", ")", ",", "CharOperation", ".", "charArrayToStringArray", "(", "methodInfo", ".", "parameterNames", ")", ",", "CharOperation", ".", "charArrayToStringArray", "(", "methodInfo", ".", "exceptionTypes", ")", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "this", ".", "fStack", ".", "push", "(", "this", ".", "fNode", ")", ";", "}", "public", "void", "enterConstructor", "(", "MethodInfo", "methodInfo", ")", "{", "String", "nameString", "=", "new", "String", "(", "this", ".", "fDocument", ",", "methodInfo", ".", "nameSourceStart", ",", "methodInfo", ".", "nameSourceEnd", "-", "methodInfo", ".", "nameSourceStart", ")", ";", "int", "openParenPosition", "=", "nameString", ".", "indexOf", "(", "'('", ")", ";", "if", "(", "openParenPosition", ">", "-", "1", ")", "methodInfo", ".", "nameSourceEnd", "=", "methodInfo", ".", "nameSourceStart", "+", "openParenPosition", "-", "1", ";", "enterAbstractMethod", "(", "methodInfo", ")", ";", "}", "public", "void", "enterField", "(", "FieldInfo", "fieldInfo", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "fieldInfo", ".", "declarationStart", ",", "-", "1", "}", ";", "int", "[", "]", "nameRange", "=", "{", "fieldInfo", ".", "nameSourceStart", ",", "fieldInfo", ".", "nameSourceEnd", "}", ";", "boolean", "isSecondary", "=", "false", ";", "if", "(", "this", ".", "fNode", "instanceof", "DOMField", ")", "{", "isSecondary", "=", "fieldInfo", ".", "declarationStart", "==", "this", ".", "fNode", ".", "fSourceRange", "[", "0", "]", ";", "}", "this", ".", "fNode", "=", "new", "DOMField", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "CharOperation", ".", "charToString", "(", "fieldInfo", ".", "name", ")", ",", "nameRange", ",", "fieldInfo", ".", "modifiers", ",", "CharOperation", ".", "charToString", "(", "fieldInfo", ".", "type", ")", ",", "isSecondary", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "this", ".", "fStack", ".", "push", "(", "this", ".", "fNode", ")", ";", "}", "public", "void", "enterInitializer", "(", "int", "declarationSourceStart", ",", "int", "modifiers", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "declarationSourceStart", ",", "-", "1", "}", ";", "this", ".", "fNode", "=", "new", "DOMInitializer", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "modifiers", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "this", ".", "fStack", ".", "push", "(", "this", ".", "fNode", ")", ";", "}", "public", "void", "enterMethod", "(", "MethodInfo", "methodInfo", ")", "{", "enterAbstractMethod", "(", "methodInfo", ")", ";", "}", "public", "void", "enterType", "(", "TypeInfo", "typeInfo", ")", "{", "if", "(", "this", ".", "fBuildingType", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "typeInfo", ".", "declarationStart", ",", "-", "1", "}", ";", "int", "[", "]", "nameRange", "=", "new", "int", "[", "]", "{", "typeInfo", ".", "nameSourceStart", ",", "typeInfo", ".", "nameSourceEnd", "}", ";", "this", ".", "fNode", "=", "new", "DOMType", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "new", "String", "(", "typeInfo", ".", "name", ")", ",", "nameRange", ",", "typeInfo", ".", "modifiers", ",", "CharOperation", ".", "charArrayToStringArray", "(", "typeInfo", ".", "superinterfaces", ")", ",", "TypeDeclaration", ".", "kind", "(", "typeInfo", ".", "modifiers", ")", "==", "TypeDeclaration", ".", "CLASS_DECL", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "this", ".", "fStack", ".", "push", "(", "this", ".", "fNode", ")", ";", "}", "}", "public", "void", "exitConstructor", "(", "int", "declarationEnd", ")", "{", "exitMember", "(", "declarationEnd", ")", ";", "}", "public", "void", "exitField", "(", "int", "initializationStart", ",", "int", "declarationEnd", ",", "int", "declarationSourceEnd", ")", "{", "exitMember", "(", "declarationEnd", ")", ";", "}", "public", "void", "exitInitializer", "(", "int", "declarationEnd", ")", "{", "exitMember", "(", "declarationEnd", ")", ";", "}", "protected", "void", "exitMember", "(", "int", "declarationEnd", ")", "{", "DOMMember", "m", "=", "(", "DOMMember", ")", "this", ".", "fStack", ".", "pop", "(", ")", ";", "m", ".", "setSourceRangeEnd", "(", "declarationEnd", ")", ";", "this", ".", "fNode", "=", "m", ";", "}", "public", "void", "exitMethod", "(", "int", "declarationEnd", ",", "Expression", "defaultValue", ")", "{", "exitMember", "(", "declarationEnd", ")", ";", "}", "public", "void", "exitType", "(", "int", "declarationEnd", ")", "{", "exitType", "(", "declarationEnd", ",", "declarationEnd", ")", ";", "}", "protected", "SourceElementParser", "getParser", "(", "Map", "settings", ")", "{", "return", "new", "SourceElementParser", "(", "this", ",", "new", "DefaultProblemFactory", "(", ")", ",", "new", "CompilerOptions", "(", "settings", ")", ",", "false", ",", "true", ")", ";", "}", "}", "</s>" ]
3,753
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "DOMCompilationUnit", "extends", "DOMNode", "implements", "IDOMCompilationUnit", ",", "SuffixConstants", "{", "protected", "String", "fHeader", ";", "DOMCompilationUnit", "(", ")", "{", "this", ".", "fHeader", "=", "\"\"", ";", "}", "DOMCompilationUnit", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "null", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ")", ";", "this", ".", "fHeader", "=", "\"\"", ";", "}", "protected", "void", "appendFragmentedContents", "(", "CharArrayBuffer", "buffer", ")", "{", "buffer", ".", "append", "(", "getHeader", "(", ")", ")", ";", "appendContentsOfChildren", "(", "buffer", ")", ";", "}", "public", "boolean", "canHaveChildren", "(", ")", "{", "return", "true", ";", "}", "public", "String", "getHeader", "(", ")", "{", "return", "this", ".", "fHeader", ";", "}", "public", "IJavaElement", "getJavaElement", "(", "IJavaElement", "parent", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", "{", "return", "(", "(", "IPackageFragment", ")", "parent", ")", ".", "getCompilationUnit", "(", "getName", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_illegalParent", ")", ";", "}", "}", "public", "String", "getName", "(", ")", "{", "IDOMType", "topLevelType", "=", "null", ";", "IDOMType", "firstType", "=", "null", ";", "IDOMNode", "child", "=", "this", ".", "fFirstChild", ";", "while", "(", "child", "!=", "null", ")", "{", "if", "(", "child", ".", "getNodeType", "(", ")", "==", "IDOMNode", ".", "TYPE", ")", "{", "IDOMType", "type", "=", "(", "IDOMType", ")", "child", ";", "if", "(", "firstType", "==", "null", ")", "{", "firstType", "=", "type", ";", "}", "if", "(", "Flags", ".", "isPublic", "(", "type", ".", "getFlags", "(", ")", ")", ")", "{", "topLevelType", "=", "type", ";", "break", ";", "}", "}", "child", "=", "child", ".", "getNextNode", "(", ")", ";", "}", "if", "(", "topLevelType", "==", "null", ")", "{", "topLevelType", "=", "firstType", ";", "}", "if", "(", "topLevelType", "!=", "null", ")", "{", "return", "topLevelType", ".", "getName", "(", ")", "+", "Util", ".", "defaultJavaExtension", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "public", "int", "getNodeType", "(", ")", "{", "return", "IDOMNode", ".", "COMPILATION_UNIT", ";", "}", "protected", "void", "initalizeHeader", "(", ")", "{", "DOMNode", "child", "=", "(", "DOMNode", ")", "getFirstChild", "(", ")", ";", "if", "(", "child", "!=", "null", ")", "{", "int", "childStart", "=", "child", ".", "getStartPosition", "(", ")", ";", "if", "(", "childStart", ">", "1", ")", "{", "setHeader", "(", "new", "String", "(", "this", ".", "fDocument", ",", "0", ",", "childStart", ")", ")", ";", "}", "}", "}", "public", "boolean", "isAllowableChild", "(", "IDOMNode", "node", ")", "{", "if", "(", "node", "!=", "null", ")", "{", "int", "type", "=", "node", ".", "getNodeType", "(", ")", ";", "return", "type", "==", "IDOMNode", ".", "PACKAGE", "||", "type", "==", "IDOMNode", ".", "IMPORT", "||", "type", "==", "IDOMNode", ".", "TYPE", ";", "}", "else", "{", "return", "false", ";", "}", "}", "protected", "DOMNode", "newDOMNode", "(", ")", "{", "return", "new", "DOMCompilationUnit", "(", ")", ";", "}", "void", "normalize", "(", "ILineStartFinder", "finder", ")", "{", "super", ".", "normalize", "(", "finder", ")", ";", "initalizeHeader", "(", ")", ";", "}", "public", "void", "setHeader", "(", "String", "comment", ")", "{", "this", ".", "fHeader", "=", "comment", ";", "fragment", "(", ")", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "}", "protected", "void", "shareContents", "(", "DOMNode", "node", ")", "{", "super", ".", "shareContents", "(", "node", ")", ";", "this", ".", "fHeader", "=", "(", "(", "DOMCompilationUnit", ")", "node", ")", ".", "fHeader", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "getName", "(", ")", ";", "}", "}", "</s>" ]
3,754
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CategorizedProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "DocumentElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "IDocumentElementRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "impl", ".", "CompilerOptions", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "public", "class", "DOMBuilder", "extends", "AbstractDOMBuilder", "implements", "IDocumentElementRequestor", "{", "protected", "boolean", "fBuildingSingleMember", "=", "false", ";", "protected", "boolean", "fFinishedSingleMember", "=", "false", ";", "protected", "ArrayList", "fFields", ";", "Map", "options", "=", "JavaCore", ".", "getOptions", "(", ")", ";", "public", "DOMBuilder", "(", ")", "{", "}", "public", "void", "acceptImport", "(", "int", "declarationStart", ",", "int", "declarationEnd", ",", "int", "[", "]", "javaDocPositions", ",", "char", "[", "]", "name", ",", "int", "nameStart", ",", "boolean", "onDemand", ",", "int", "modifiers", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "declarationStart", ",", "declarationEnd", "}", ";", "int", "[", "]", "nameRange", "=", "{", "nameStart", ",", "declarationEnd", "-", "1", "}", ";", "String", "importName", "=", "new", "String", "(", "this", ".", "fDocument", ",", "nameRange", "[", "0", "]", ",", "nameRange", "[", "1", "]", "+", "1", "-", "nameRange", "[", "0", "]", ")", ";", "this", ".", "fNode", "=", "new", "DOMImport", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "importName", ",", "nameRange", ",", "onDemand", ",", "modifiers", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "if", "(", "this", ".", "fBuildingSingleMember", ")", "{", "this", ".", "fFinishedSingleMember", "=", "true", ";", "}", "}", "public", "void", "acceptInitializer", "(", "int", "declarationStart", ",", "int", "declarationEnd", ",", "int", "[", "]", "javaDocPositions", ",", "int", "modifiers", ",", "int", "modifiersStart", ",", "int", "bodyStart", ",", "int", "bodyEnd", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "declarationStart", ",", "declarationEnd", "}", ";", "int", "[", "]", "commentRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "javaDocPositions", "!=", "null", ")", "{", "int", "length", "=", "javaDocPositions", ".", "length", ";", "commentRange", "[", "0", "]", "=", "javaDocPositions", "[", "length", "-", "2", "]", ";", "commentRange", "[", "1", "]", "=", "javaDocPositions", "[", "length", "-", "1", "]", ";", "}", "int", "[", "]", "modifiersRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "modifiersStart", ">=", "declarationStart", ")", "{", "modifiersRange", "[", "0", "]", "=", "modifiersStart", ";", "modifiersRange", "[", "1", "]", "=", "bodyStart", "-", "1", ";", "}", "this", ".", "fNode", "=", "new", "DOMInitializer", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "commentRange", ",", "modifiers", ",", "modifiersRange", ",", "bodyStart", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "if", "(", "this", ".", "fBuildingSingleMember", ")", "{", "this", ".", "fFinishedSingleMember", "=", "true", ";", "}", "}", "public", "void", "acceptPackage", "(", "int", "declarationStart", ",", "int", "declarationEnd", ",", "int", "[", "]", "javaDocPositions", ",", "char", "[", "]", "name", ",", "int", "nameStartPosition", ")", "{", "int", "[", "]", "sourceRange", "=", "null", ";", "if", "(", "javaDocPositions", "!=", "null", ")", "{", "int", "length", "=", "javaDocPositions", ".", "length", ";", "sourceRange", "=", "new", "int", "[", "]", "{", "javaDocPositions", "[", "length", "-", "2", "]", ",", "declarationEnd", "}", ";", "}", "else", "{", "sourceRange", "=", "new", "int", "[", "]", "{", "declarationStart", ",", "declarationEnd", "}", ";", "}", "int", "[", "]", "nameRange", "=", "{", "nameStartPosition", ",", "declarationEnd", "-", "1", "}", ";", "this", ".", "fNode", "=", "new", "DOMPackage", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "CharOperation", ".", "charToString", "(", "name", ")", ",", "nameRange", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "if", "(", "this", ".", "fBuildingSingleMember", ")", "{", "this", ".", "fFinishedSingleMember", "=", "true", ";", "}", "}", "public", "void", "acceptProblem", "(", "CategorizedProblem", "problem", ")", "{", "if", "(", "this", ".", "fBuildingSingleMember", "&&", "this", ".", "fFinishedSingleMember", ")", "{", "return", ";", "}", "this", ".", "fAbort", "=", "true", ";", "}", "protected", "void", "addChild", "(", "IDOMNode", "child", ")", "{", "super", ".", "addChild", "(", "child", ")", ";", "if", "(", "this", ".", "fStack", ".", "isEmpty", "(", ")", "&&", "this", ".", "fFields", "!=", "null", ")", "{", "this", ".", "fFields", ".", "add", "(", "child", ")", ";", "}", "}", "public", "IDOMCompilationUnit", "createCompilationUnit", "(", ")", "{", "return", "new", "DOMCompilationUnit", "(", ")", ";", "}", "public", "IDOMCompilationUnit", "createCompilationUnit", "(", "ICompilationUnit", "compilationUnit", ")", "{", "initializeBuild", "(", "compilationUnit", ".", "getContents", "(", ")", ",", "true", ",", "true", ",", "false", ")", ";", "getParser", "(", "this", ".", "options", ")", ".", "parseCompilationUnit", "(", "compilationUnit", ")", ";", "return", "super", ".", "createCompilationUnit", "(", "compilationUnit", ")", ";", "}", "public", "IDOMField", "createField", "(", "char", "[", "]", "sourceCode", ")", "{", "initializeBuild", "(", "sourceCode", ",", "false", ",", "false", ",", "true", ")", ";", "getParser", "(", "this", ".", "options", ")", ".", "parseField", "(", "sourceCode", ")", ";", "if", "(", "this", ".", "fAbort", "||", "this", ".", "fNode", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "this", ".", "fFieldCount", ">", "1", ")", "{", "return", "null", ";", "}", "this", ".", "fNode", ".", "normalize", "(", "this", ")", ";", "return", "(", "IDOMField", ")", "this", ".", "fNode", ";", "}", "public", "IDOMField", "[", "]", "createFields", "(", "char", "[", "]", "sourceCode", ")", "{", "initializeBuild", "(", "sourceCode", ",", "false", ",", "false", ",", "false", ")", ";", "this", ".", "fFields", "=", "new", "ArrayList", "(", ")", ";", "getParser", "(", "this", ".", "options", ")", ".", "parseField", "(", "sourceCode", ")", ";", "if", "(", "this", ".", "fAbort", ")", "{", "return", "null", ";", "}", "IDOMField", "[", "]", "fields", "=", "new", "IDOMField", "[", "this", ".", "fFields", ".", "size", "(", ")", "]", ";", "this", ".", "fFields", ".", "toArray", "(", "fields", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "DOMNode", "node", "=", "(", "DOMNode", ")", "fields", "[", "i", "]", ";", "if", "(", "i", "<", "(", "fields", ".", "length", "-", "1", ")", ")", "{", "DOMNode", "next", "=", "(", "DOMNode", ")", "fields", "[", "i", "+", "1", "]", ";", "node", ".", "fNextNode", "=", "next", ";", "next", ".", "fPreviousNode", "=", "node", ";", "}", "(", "(", "DOMNode", ")", "fields", "[", "i", "]", ")", ".", "normalize", "(", "this", ")", ";", "}", "return", "fields", ";", "}", "public", "IDOMImport", "createImport", "(", ")", "{", "return", "new", "DOMImport", "(", ")", ";", "}", "public", "IDOMImport", "createImport", "(", "char", "[", "]", "sourceCode", ")", "{", "initializeBuild", "(", "sourceCode", ",", "false", ",", "false", ",", "true", ")", ";", "getParser", "(", "this", ".", "options", ")", ".", "parseImport", "(", "sourceCode", ")", ";", "if", "(", "this", ".", "fAbort", "||", "this", ".", "fNode", "==", "null", ")", "{", "return", "null", ";", "}", "this", ".", "fNode", ".", "normalize", "(", "this", ")", ";", "return", "(", "IDOMImport", ")", "this", ".", "fNode", ";", "}", "public", "IDOMInitializer", "createInitializer", "(", "char", "[", "]", "sourceCode", ")", "{", "initializeBuild", "(", "sourceCode", ",", "false", ",", "false", ",", "true", ")", ";", "getParser", "(", "this", ".", "options", ")", ".", "parseInitializer", "(", "sourceCode", ")", ";", "if", "(", "this", ".", "fAbort", "||", "this", ".", "fNode", "==", "null", "||", "!", "(", "this", ".", "fNode", "instanceof", "IDOMInitializer", ")", ")", "{", "return", "null", ";", "}", "this", ".", "fNode", ".", "normalize", "(", "this", ")", ";", "return", "(", "IDOMInitializer", ")", "this", ".", "fNode", ";", "}", "public", "IDOMMethod", "createMethod", "(", "char", "[", "]", "sourceCode", ")", "{", "initializeBuild", "(", "sourceCode", ",", "false", ",", "false", ",", "true", ")", ";", "getParser", "(", "this", ".", "options", ")", ".", "parseMethod", "(", "sourceCode", ")", ";", "if", "(", "this", ".", "fAbort", "||", "this", ".", "fNode", "==", "null", ")", "{", "return", "null", ";", "}", "this", ".", "fNode", ".", "normalize", "(", "this", ")", ";", "return", "(", "IDOMMethod", ")", "this", ".", "fNode", ";", "}", "public", "IDOMPackage", "createPackage", "(", ")", "{", "return", "new", "DOMPackage", "(", ")", ";", "}", "public", "IDOMPackage", "createPackage", "(", "char", "[", "]", "sourceCode", ")", "{", "initializeBuild", "(", "sourceCode", ",", "false", ",", "false", ",", "true", ")", ";", "getParser", "(", "this", ".", "options", ")", ".", "parsePackage", "(", "sourceCode", ")", ";", "if", "(", "this", ".", "fAbort", "||", "this", ".", "fNode", "==", "null", ")", "{", "return", "null", ";", "}", "this", ".", "fNode", ".", "normalize", "(", "this", ")", ";", "return", "(", "IDOMPackage", ")", "this", ".", "fNode", ";", "}", "public", "IDOMType", "createType", "(", "char", "[", "]", "sourceCode", ")", "{", "initializeBuild", "(", "sourceCode", ",", "false", ",", "true", ",", "false", ")", ";", "getParser", "(", "this", ".", "options", ")", ".", "parseType", "(", "sourceCode", ")", ";", "if", "(", "this", ".", "fAbort", ")", "{", "return", "null", ";", "}", "if", "(", "this", ".", "fNode", "!=", "null", ")", "this", ".", "fNode", ".", "normalize", "(", "this", ")", ";", "if", "(", "this", ".", "fNode", "instanceof", "IDOMType", ")", "{", "return", "(", "IDOMType", ")", "this", ".", "fNode", ";", "}", "return", "null", ";", "}", "protected", "void", "enterAbstractMethod", "(", "int", "declarationStart", ",", "int", "[", "]", "javaDocPositions", ",", "int", "modifiers", ",", "int", "modifiersStart", ",", "char", "[", "]", "returnType", ",", "int", "returnTypeStart", ",", "int", "returnTypeEnd", ",", "int", "returnTypeDimensionCount", ",", "char", "[", "]", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "[", "]", "parameterTypes", ",", "int", "[", "]", "parameterTypeStarts", ",", "int", "[", "]", "parameterTypeEnds", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "int", "[", "]", "parameterNameStarts", ",", "int", "[", "]", "parameterNameEnds", ",", "int", "parametersEnd", ",", "int", "extendedReturnTypeDimensionCount", ",", "int", "extendedReturnTypeDimensionEnd", ",", "char", "[", "]", "[", "]", "exceptionTypes", ",", "int", "[", "]", "exceptionTypeStarts", ",", "int", "[", "]", "exceptionTypeEnds", ",", "int", "bodyStart", ",", "boolean", "isConstructor", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "declarationStart", ",", "-", "1", "}", ";", "int", "[", "]", "nameRange", "=", "{", "nameStart", ",", "nameEnd", "}", ";", "int", "[", "]", "commentRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "javaDocPositions", "!=", "null", ")", "{", "int", "length", "=", "javaDocPositions", ".", "length", ";", "commentRange", "[", "0", "]", "=", "javaDocPositions", "[", "length", "-", "2", "]", ";", "commentRange", "[", "1", "]", "=", "javaDocPositions", "[", "length", "-", "1", "]", ";", "}", "int", "[", "]", "modifiersRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "modifiersStart", ">", "-", "1", ")", "{", "modifiersRange", "[", "0", "]", "=", "modifiersStart", ";", "if", "(", "isConstructor", ")", "{", "modifiersRange", "[", "1", "]", "=", "nameStart", "-", "1", ";", "}", "else", "{", "modifiersRange", "[", "1", "]", "=", "returnTypeStart", "-", "1", ";", "}", "}", "int", "[", "]", "returnTypeRange", "=", "null", ";", "if", "(", "extendedReturnTypeDimensionCount", ">", "0", ")", "returnTypeRange", "=", "new", "int", "[", "]", "{", "returnTypeStart", ",", "returnTypeEnd", ",", "parametersEnd", "+", "1", ",", "extendedReturnTypeDimensionEnd", "}", ";", "else", "returnTypeRange", "=", "new", "int", "[", "]", "{", "returnTypeStart", ",", "returnTypeEnd", "}", ";", "int", "[", "]", "parameterRange", "=", "{", "nameEnd", "+", "1", ",", "parametersEnd", "}", ";", "int", "[", "]", "exceptionRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "exceptionTypes", "!=", "null", "&&", "exceptionTypes", ".", "length", ">", "0", ")", "{", "int", "exceptionCount", "=", "exceptionTypes", ".", "length", ";", "exceptionRange", "[", "0", "]", "=", "exceptionTypeStarts", "[", "0", "]", ";", "exceptionRange", "[", "1", "]", "=", "exceptionTypeEnds", "[", "exceptionCount", "-", "1", "]", ";", "}", "int", "[", "]", "bodyRange", "=", "null", ";", "if", "(", "exceptionRange", "[", "1", "]", ">", "-", "1", ")", "{", "bodyRange", "=", "new", "int", "[", "]", "{", "exceptionRange", "[", "1", "]", "+", "1", ",", "-", "1", "}", ";", "}", "else", "{", "bodyRange", "=", "new", "int", "[", "]", "{", "parametersEnd", "+", "1", ",", "-", "1", "}", ";", "}", "this", ".", "fNode", "=", "new", "DOMMethod", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "CharOperation", ".", "charToString", "(", "name", ")", ",", "nameRange", ",", "commentRange", ",", "modifiers", ",", "modifiersRange", ",", "isConstructor", ",", "CharOperation", ".", "charToString", "(", "returnType", ")", ",", "returnTypeRange", ",", "CharOperation", ".", "charArrayToStringArray", "(", "parameterTypes", ")", ",", "CharOperation", ".", "charArrayToStringArray", "(", "parameterNames", ")", ",", "parameterRange", ",", "CharOperation", ".", "charArrayToStringArray", "(", "exceptionTypes", ")", ",", "exceptionRange", ",", "bodyRange", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "this", ".", "fStack", ".", "push", "(", "this", ".", "fNode", ")", ";", "}", "public", "void", "enterClass", "(", "int", "declarationStart", ",", "int", "[", "]", "javaDocPositions", ",", "int", "modifiers", ",", "int", "modifiersStart", ",", "int", "keywordStart", ",", "char", "[", "]", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "superclass", ",", "int", "superclassStart", ",", "int", "superclassEnd", ",", "char", "[", "]", "[", "]", "superinterfaces", ",", "int", "[", "]", "superinterfaceStarts", ",", "int", "[", "]", "superinterfaceEnds", ",", "int", "bodyStart", ")", "{", "enterType", "(", "declarationStart", ",", "javaDocPositions", ",", "modifiers", ",", "modifiersStart", ",", "keywordStart", ",", "name", ",", "nameStart", ",", "nameEnd", ",", "superclass", ",", "superclassStart", ",", "superclassEnd", ",", "superinterfaces", ",", "superinterfaceStarts", ",", "superinterfaceEnds", ",", "bodyStart", ",", "true", ")", ";", "}", "public", "void", "enterConstructor", "(", "int", "declarationStart", ",", "int", "[", "]", "javaDocPositions", ",", "int", "modifiers", ",", "int", "modifiersStart", ",", "char", "[", "]", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "[", "]", "parameterTypes", ",", "int", "[", "]", "parameterTypeStarts", ",", "int", "[", "]", "parameterTypeEnds", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "int", "[", "]", "parameterNameStarts", ",", "int", "[", "]", "parameterNameEnds", ",", "int", "parametersEnd", ",", "char", "[", "]", "[", "]", "exceptionTypes", ",", "int", "[", "]", "exceptionTypeStarts", ",", "int", "[", "]", "exceptionTypeEnds", ",", "int", "bodyStart", ")", "{", "String", "nameString", "=", "new", "String", "(", "this", ".", "fDocument", ",", "nameStart", ",", "nameEnd", "-", "nameStart", ")", ";", "int", "openParenPosition", "=", "nameString", ".", "indexOf", "(", "'('", ")", ";", "if", "(", "openParenPosition", ">", "-", "1", ")", "nameEnd", "=", "nameStart", "+", "openParenPosition", "-", "1", ";", "enterAbstractMethod", "(", "declarationStart", ",", "javaDocPositions", ",", "modifiers", ",", "modifiersStart", ",", "null", ",", "-", "1", ",", "-", "1", ",", "0", ",", "name", ",", "nameStart", ",", "nameEnd", ",", "parameterTypes", ",", "parameterTypeStarts", ",", "parameterTypeEnds", ",", "parameterNames", ",", "parameterNameStarts", ",", "parameterNameEnds", ",", "parametersEnd", ",", "0", ",", "-", "1", ",", "exceptionTypes", ",", "exceptionTypeStarts", ",", "exceptionTypeEnds", ",", "bodyStart", ",", "true", ")", ";", "}", "public", "void", "enterField", "(", "int", "declarationStart", ",", "int", "[", "]", "javaDocPositions", ",", "int", "modifiers", ",", "int", "modifiersStart", ",", "char", "[", "]", "type", ",", "int", "typeStart", ",", "int", "typeEnd", ",", "int", "typeDimensionCount", ",", "char", "[", "]", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "int", "extendedTypeDimensionCount", ",", "int", "extendedTypeDimensionEnd", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "declarationStart", ",", "(", "extendedTypeDimensionEnd", ">", "nameEnd", ")", "?", "extendedTypeDimensionEnd", ":", "nameEnd", "}", ";", "int", "[", "]", "nameRange", "=", "{", "nameStart", ",", "nameEnd", "}", ";", "int", "[", "]", "commentRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "javaDocPositions", "!=", "null", ")", "{", "int", "length", "=", "javaDocPositions", ".", "length", ";", "commentRange", "[", "0", "]", "=", "javaDocPositions", "[", "length", "-", "2", "]", ";", "commentRange", "[", "1", "]", "=", "javaDocPositions", "[", "length", "-", "1", "]", ";", "}", "int", "[", "]", "modifiersRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "modifiersStart", ">", "-", "1", ")", "{", "modifiersRange", "[", "0", "]", "=", "modifiersStart", ";", "modifiersRange", "[", "1", "]", "=", "typeStart", "-", "1", ";", "}", "int", "[", "]", "typeRange", "=", "{", "typeStart", ",", "typeEnd", "}", ";", "boolean", "hasInitializer", "=", "false", ";", "int", "[", "]", "initializerRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "boolean", "isVariableDeclarator", "=", "false", ";", "if", "(", "this", ".", "fNode", "instanceof", "DOMField", ")", "{", "DOMField", "field", "=", "(", "DOMField", ")", "this", ".", "fNode", ";", "if", "(", "field", ".", "fTypeRange", "[", "0", "]", "==", "typeStart", ")", "isVariableDeclarator", "=", "true", ";", "}", "this", ".", "fNode", "=", "new", "DOMField", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "CharOperation", ".", "charToString", "(", "name", ")", ",", "nameRange", ",", "commentRange", ",", "modifiers", ",", "modifiersRange", ",", "typeRange", ",", "CharOperation", ".", "charToString", "(", "type", ")", ",", "hasInitializer", ",", "initializerRange", ",", "isVariableDeclarator", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "this", ".", "fStack", ".", "push", "(", "this", ".", "fNode", ")", ";", "}", "public", "void", "enterInterface", "(", "int", "declarationStart", ",", "int", "[", "]", "javaDocPositions", ",", "int", "modifiers", ",", "int", "modifiersStart", ",", "int", "keywordStart", ",", "char", "[", "]", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "[", "]", "superinterfaces", ",", "int", "[", "]", "superinterfaceStarts", ",", "int", "[", "]", "superinterfaceEnds", ",", "int", "bodyStart", ")", "{", "enterType", "(", "declarationStart", ",", "javaDocPositions", ",", "modifiers", ",", "modifiersStart", ",", "keywordStart", ",", "name", ",", "nameStart", ",", "nameEnd", ",", "null", ",", "-", "1", ",", "-", "1", ",", "superinterfaces", ",", "superinterfaceStarts", ",", "superinterfaceEnds", ",", "bodyStart", ",", "false", ")", ";", "}", "public", "void", "enterMethod", "(", "int", "declarationStart", ",", "int", "[", "]", "javaDocPositions", ",", "int", "modifiers", ",", "int", "modifiersStart", ",", "char", "[", "]", "returnType", ",", "int", "returnTypeStart", ",", "int", "returnTypeEnd", ",", "int", "returnTypeDimensionCount", ",", "char", "[", "]", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "[", "]", "parameterTypes", ",", "int", "[", "]", "parameterTypeStarts", ",", "int", "[", "]", "parameterTypeEnds", ",", "char", "[", "]", "[", "]", "parameterNames", ",", "int", "[", "]", "parameterNameStarts", ",", "int", "[", "]", "parameterNameEnds", ",", "int", "parametersEnd", ",", "int", "extendedReturnTypeDimensionCount", ",", "int", "extendedReturnTypeDimensionEnd", ",", "char", "[", "]", "[", "]", "exceptionTypes", ",", "int", "[", "]", "exceptionTypeStarts", ",", "int", "[", "]", "exceptionTypeEnds", ",", "int", "bodyStart", ")", "{", "enterAbstractMethod", "(", "declarationStart", ",", "javaDocPositions", ",", "modifiers", ",", "modifiersStart", ",", "returnType", ",", "returnTypeStart", ",", "returnTypeEnd", ",", "returnTypeDimensionCount", ",", "name", ",", "nameStart", ",", "nameEnd", ",", "parameterTypes", ",", "parameterTypeStarts", ",", "parameterTypeEnds", ",", "parameterNames", ",", "parameterNameStarts", ",", "parameterNameEnds", ",", "parametersEnd", ",", "extendedReturnTypeDimensionCount", ",", "extendedReturnTypeDimensionEnd", ",", "exceptionTypes", ",", "exceptionTypeStarts", ",", "exceptionTypeEnds", ",", "bodyStart", ",", "false", ")", ";", "}", "protected", "void", "enterType", "(", "int", "declarationStart", ",", "int", "[", "]", "javaDocPositions", ",", "int", "modifiers", ",", "int", "modifiersStart", ",", "int", "keywordStart", ",", "char", "[", "]", "name", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "char", "[", "]", "superclass", ",", "int", "superclassStart", ",", "int", "superclassEnd", ",", "char", "[", "]", "[", "]", "superinterfaces", ",", "int", "[", "]", "superinterfaceStarts", ",", "int", "[", "]", "superinterfaceEnds", ",", "int", "bodyStart", ",", "boolean", "isClass", ")", "{", "if", "(", "this", ".", "fBuildingType", ")", "{", "int", "[", "]", "sourceRange", "=", "{", "declarationStart", ",", "-", "1", "}", ";", "int", "[", "]", "commentRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "javaDocPositions", "!=", "null", ")", "{", "int", "length", "=", "javaDocPositions", ".", "length", ";", "commentRange", "[", "0", "]", "=", "javaDocPositions", "[", "length", "-", "2", "]", ";", "commentRange", "[", "1", "]", "=", "javaDocPositions", "[", "length", "-", "1", "]", ";", "}", "int", "[", "]", "modifiersRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "modifiersStart", ">", "-", "1", ")", "{", "modifiersRange", "[", "0", "]", "=", "modifiersStart", ";", "modifiersRange", "[", "1", "]", "=", "(", "modifiersStart", ">", "-", "1", ")", "?", "keywordStart", "-", "1", ":", "-", "1", ";", "}", "int", "[", "]", "typeKeywordRange", "=", "{", "keywordStart", ",", "nameStart", "-", "1", "}", ";", "int", "[", "]", "nameRange", "=", "new", "int", "[", "]", "{", "nameStart", ",", "nameEnd", "}", ";", "int", "[", "]", "extendsKeywordRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "int", "[", "]", "superclassRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "int", "[", "]", "implementsKeywordRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "int", "[", "]", "interfacesRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "if", "(", "isClass", ")", "{", "if", "(", "superclass", "!=", "null", ")", "{", "extendsKeywordRange", "[", "0", "]", "=", "nameEnd", "+", "1", ";", "extendsKeywordRange", "[", "1", "]", "=", "superclassStart", "-", "1", ";", "superclassRange", "[", "0", "]", "=", "superclassStart", ";", "superclassRange", "[", "1", "]", "=", "superclassEnd", ";", "}", "if", "(", "superinterfaces", "!=", "null", "&&", "superinterfaces", ".", "length", ">", "0", ")", "{", "superclassRange", "[", "1", "]", "=", "superclassEnd", ";", "if", "(", "superclassEnd", ">", "-", "1", ")", "{", "implementsKeywordRange", "[", "0", "]", "=", "superclassEnd", "+", "1", ";", "}", "else", "{", "implementsKeywordRange", "[", "0", "]", "=", "nameEnd", "+", "1", ";", "}", "implementsKeywordRange", "[", "1", "]", "=", "superinterfaceStarts", "[", "0", "]", "-", "1", ";", "interfacesRange", "[", "0", "]", "=", "superinterfaceStarts", "[", "0", "]", ";", "interfacesRange", "[", "1", "]", "=", "superinterfaceEnds", "[", "superinterfaces", ".", "length", "-", "1", "]", ";", "}", "}", "else", "{", "if", "(", "superinterfaces", "!=", "null", "&&", "superinterfaces", ".", "length", ">", "0", ")", "{", "extendsKeywordRange", "[", "0", "]", "=", "nameEnd", "+", "1", ";", "extendsKeywordRange", "[", "1", "]", "=", "superinterfaceStarts", "[", "0", "]", "-", "1", ";", "interfacesRange", "[", "0", "]", "=", "superinterfaceStarts", "[", "0", "]", ";", "interfacesRange", "[", "1", "]", "=", "superinterfaceEnds", "[", "superinterfaces", ".", "length", "-", "1", "]", ";", "}", "}", "int", "[", "]", "openBodyRange", "=", "{", "bodyStart", ",", "-", "1", "}", ";", "int", "[", "]", "closeBodyRange", "=", "{", "-", "1", ",", "-", "1", "}", ";", "this", ".", "fNode", "=", "new", "DOMType", "(", "this", ".", "fDocument", ",", "sourceRange", ",", "new", "String", "(", "name", ")", ",", "nameRange", ",", "commentRange", ",", "modifiers", ",", "modifiersRange", ",", "typeKeywordRange", ",", "superclassRange", ",", "extendsKeywordRange", ",", "CharOperation", ".", "charArrayToStringArray", "(", "superinterfaces", ")", ",", "interfacesRange", ",", "implementsKeywordRange", ",", "openBodyRange", ",", "closeBodyRange", ",", "isClass", ")", ";", "addChild", "(", "this", ".", "fNode", ")", ";", "this", ".", "fStack", ".", "push", "(", "this", ".", "fNode", ")", ";", "}", "}", "protected", "void", "exitAbstractMethod", "(", "int", "bodyEnd", ",", "int", "declarationEnd", ")", "{", "DOMMethod", "method", "=", "(", "DOMMethod", ")", "this", ".", "fStack", ".", "pop", "(", ")", ";", "method", ".", "setSourceRangeEnd", "(", "declarationEnd", ")", ";", "method", ".", "setBodyRangeEnd", "(", "bodyEnd", "+", "1", ")", ";", "this", ".", "fNode", "=", "method", ";", "if", "(", "this", ".", "fBuildingSingleMember", ")", "{", "this", ".", "fFinishedSingleMember", "=", "true", ";", "}", "}", "public", "void", "exitClass", "(", "int", "bodyEnd", ",", "int", "declarationEnd", ")", "{", "exitType", "(", "bodyEnd", ",", "declarationEnd", ")", ";", "}", "public", "void", "exitConstructor", "(", "int", "bodyEnd", ",", "int", "declarationEnd", ")", "{", "exitAbstractMethod", "(", "bodyEnd", ",", "declarationEnd", ")", ";", "}", "public", "void", "exitField", "(", "int", "bodyEnd", ",", "int", "declarationEnd", ")", "{", "DOMField", "field", "=", "(", "DOMField", ")", "this", ".", "fStack", ".", "pop", "(", ")", ";", "if", "(", "field", ".", "getEndPosition", "(", ")", "<", "declarationEnd", ")", "{", "field", ".", "setSourceRangeEnd", "(", "declarationEnd", ")", ";", "int", "nameEnd", "=", "field", ".", "fNameRange", "[", "1", "]", ";", "if", "(", "nameEnd", "<", "bodyEnd", ")", "{", "String", "initializer", "=", "new", "String", "(", "this", ".", "fDocument", ",", "nameEnd", "+", "1", ",", "bodyEnd", "-", "nameEnd", ")", ";", "int", "index", "=", "initializer", ".", "indexOf", "(", "'='", ")", ";", "if", "(", "index", ">", "-", "1", ")", "{", "field", ".", "setHasInitializer", "(", "true", ")", ";", "field", ".", "setInitializerRange", "(", "nameEnd", "+", "index", "+", "2", ",", "bodyEnd", ")", ";", "}", "}", "}", "this", ".", "fFieldCount", "++", ";", "this", ".", "fNode", "=", "field", ";", "if", "(", "this", ".", "fBuildingSingleMember", ")", "{", "this", ".", "fFinishedSingleMember", "=", "true", ";", "}", "}", "public", "void", "exitInterface", "(", "int", "bodyEnd", ",", "int", "declarationEnd", ")", "{", "exitType", "(", "bodyEnd", ",", "declarationEnd", ")", ";", "}", "public", "void", "exitMethod", "(", "int", "bodyEnd", ",", "int", "declarationEnd", ")", "{", "exitAbstractMethod", "(", "bodyEnd", ",", "declarationEnd", ")", ";", "}", "protected", "DocumentElementParser", "getParser", "(", "Map", "settings", ")", "{", "return", "new", "DocumentElementParser", "(", "this", ",", "new", "DefaultProblemFactory", "(", ")", ",", "new", "CompilerOptions", "(", "settings", ")", ")", ";", "}", "protected", "void", "initializeBuild", "(", "char", "[", "]", "sourceCode", ",", "boolean", "buildingCompilationUnit", ",", "boolean", "buildingType", ",", "boolean", "singleMember", ")", "{", "super", ".", "initializeBuild", "(", "sourceCode", ",", "buildingCompilationUnit", ",", "buildingType", ")", ";", "this", ".", "fBuildingSingleMember", "=", "singleMember", ";", "this", ".", "fFinishedSingleMember", "=", "false", ";", "}", "}", "</s>" ]
3,755
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ICompilationUnit", ";", "public", "class", "CompilationUnit", "implements", "ICompilationUnit", "{", "protected", "char", "[", "]", "fContents", ";", "protected", "char", "[", "]", "fFileName", ";", "protected", "char", "[", "]", "fMainTypeName", ";", "public", "CompilationUnit", "(", "char", "[", "]", "contents", ",", "char", "[", "]", "filename", ")", "{", "this", ".", "fContents", "=", "contents", ";", "this", ".", "fFileName", "=", "filename", ";", "String", "file", "=", "new", "String", "(", "filename", ")", ";", "int", "start", "=", "file", ".", "lastIndexOf", "(", "\"/\"", ")", "+", "1", ";", "if", "(", "start", "==", "0", "||", "start", "<", "file", ".", "lastIndexOf", "(", "\"\\\\\"", ")", ")", "start", "=", "file", ".", "lastIndexOf", "(", "\"\\\\\"", ")", "+", "1", ";", "int", "end", "=", "file", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "end", "==", "-", "1", ")", "end", "=", "file", ".", "length", "(", ")", ";", "this", ".", "fMainTypeName", "=", "file", ".", "substring", "(", "start", ",", "end", ")", ".", "toCharArray", "(", ")", ";", "}", "public", "char", "[", "]", "getContents", "(", ")", "{", "return", "this", ".", "fContents", ";", "}", "public", "char", "[", "]", "getFileName", "(", ")", "{", "return", "this", ".", "fFileName", ";", "}", "public", "char", "[", "]", "getMainTypeName", "(", ")", "{", "return", "this", ".", "fMainTypeName", ";", "}", "public", "char", "[", "]", "[", "]", "getPackageName", "(", ")", "{", "return", "null", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "new", "String", "(", "this", ".", "fFileName", ")", "+", "\"]\"", ";", "}", "}", "</s>" ]
3,756
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "DOMPackage", "extends", "DOMNode", "implements", "IDOMPackage", "{", "DOMPackage", "(", ")", "{", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "true", ")", ";", "}", "DOMPackage", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "name", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ")", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "false", ")", ";", "}", "DOMPackage", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ")", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "true", ")", ";", "}", "protected", "void", "appendFragmentedContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "this", ".", "fNameRange", "[", "0", "]", "<", "0", ")", "{", "String", "lineSeparator", "=", "Util", ".", "getLineSeparator", "(", "buffer", ".", "toString", "(", ")", ",", "null", ")", ";", "buffer", ".", "append", "(", "\"package", "\"", ")", ".", "append", "(", "this", ".", "fName", ")", ".", "append", "(", "';'", ")", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "lineSeparator", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSourceRange", "[", "0", "]", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fSourceRange", "[", "0", "]", ")", ".", "append", "(", "this", ".", "fName", ")", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fNameRange", "[", "1", "]", ")", ";", "}", "}", "public", "String", "getContents", "(", ")", "{", "if", "(", "this", ".", "fName", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "super", ".", "getContents", "(", ")", ";", "}", "}", "protected", "DOMNode", "getDetailedNode", "(", ")", "{", "return", "(", "DOMNode", ")", "getFactory", "(", ")", ".", "createPackage", "(", "getContents", "(", ")", ")", ";", "}", "public", "IJavaElement", "getJavaElement", "(", "IJavaElement", "parent", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "COMPILATION_UNIT", ")", "{", "return", "(", "(", "ICompilationUnit", ")", "parent", ")", ".", "getPackageDeclaration", "(", "getName", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_illegalParent", ")", ";", "}", "}", "public", "int", "getNodeType", "(", ")", "{", "return", "IDOMNode", ".", "PACKAGE", ";", "}", "protected", "DOMNode", "newDOMNode", "(", ")", "{", "return", "new", "DOMPackage", "(", ")", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "becomeDetailed", "(", ")", ";", "super", ".", "setName", "(", "name", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"PACKAGE:", "\"", "+", "getName", "(", ")", ";", "}", "}", "</s>" ]
3,757
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "class", "SiblingEnumeration", "implements", "Enumeration", "{", "protected", "IDOMNode", "fCurrentElement", ";", "SiblingEnumeration", "(", "IDOMNode", "child", ")", "{", "this", ".", "fCurrentElement", "=", "child", ";", "}", "public", "boolean", "hasMoreElements", "(", ")", "{", "return", "this", ".", "fCurrentElement", "!=", "null", ";", "}", "public", "Object", "nextElement", "(", ")", "{", "IDOMNode", "curr", "=", "this", ".", "fCurrentElement", ";", "if", "(", "curr", "!=", "null", ")", "{", "this", ".", "fCurrentElement", "=", "this", ".", "fCurrentElement", ".", "getNextNode", "(", ")", ";", "}", "return", "curr", ";", "}", "}", "</s>" ]
3,758
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "DOMInitializer", "extends", "DOMMember", "implements", "IDOMInitializer", "{", "protected", "String", "fBody", ";", "protected", "int", "[", "]", "fBodyRange", ";", "DOMInitializer", "(", ")", "{", "}", "DOMInitializer", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "int", "[", "]", "commentRange", ",", "int", "flags", ",", "int", "[", "]", "modifierRange", ",", "int", "bodyStartPosition", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "null", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "commentRange", ",", "flags", ",", "modifierRange", ")", ";", "this", ".", "fBodyRange", "=", "new", "int", "[", "2", "]", ";", "this", ".", "fBodyRange", "[", "0", "]", "=", "bodyStartPosition", ";", "this", ".", "fBodyRange", "[", "1", "]", "=", "sourceRange", "[", "1", "]", ";", "setHasBody", "(", "true", ")", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "true", ")", ";", "}", "DOMInitializer", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "int", "flags", ")", "{", "this", "(", "document", ",", "sourceRange", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "flags", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "-", "1", ")", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "false", ")", ";", "}", "protected", "void", "appendMemberBodyContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "hasBody", "(", ")", ")", "{", "buffer", ".", "append", "(", "getBody", "(", ")", ")", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fBodyRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fBodyRange", "[", "1", "]", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "\"{}\"", ")", ".", "append", "(", "Util", ".", "getLineSeparator", "(", "buffer", ".", "toString", "(", ")", ",", "null", ")", ")", ";", "}", "}", "protected", "void", "appendMemberDeclarationContents", "(", "CharArrayBuffer", "buffer", ")", "{", "}", "protected", "void", "appendSimpleContents", "(", "CharArrayBuffer", "buffer", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSourceRange", "[", "0", "]", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fSourceRange", "[", "0", "]", ")", ";", "buffer", ".", "append", "(", "this", ".", "fName", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fNameRange", "[", "1", "]", ")", ";", "}", "public", "String", "getBody", "(", ")", "{", "becomeDetailed", "(", ")", ";", "if", "(", "hasBody", "(", ")", ")", "{", "if", "(", "this", ".", "fBody", "!=", "null", ")", "{", "return", "this", ".", "fBody", ";", "}", "else", "{", "return", "new", "String", "(", "this", ".", "fDocument", ",", "this", ".", "fBodyRange", "[", "0", "]", ",", "this", ".", "fBodyRange", "[", "1", "]", "+", "1", "-", "this", ".", "fBodyRange", "[", "0", "]", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "protected", "DOMNode", "getDetailedNode", "(", ")", "{", "return", "(", "DOMNode", ")", "getFactory", "(", ")", ".", "createInitializer", "(", "getContents", "(", ")", ")", ";", "}", "public", "IJavaElement", "getJavaElement", "(", "IJavaElement", "parent", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "int", "count", "=", "1", ";", "IDOMNode", "previousNode", "=", "getPreviousNode", "(", ")", ";", "while", "(", "previousNode", "!=", "null", ")", "{", "if", "(", "previousNode", "instanceof", "DOMInitializer", ")", "{", "count", "++", ";", "}", "previousNode", "=", "previousNode", ".", "getPreviousNode", "(", ")", ";", "}", "return", "(", "(", "IType", ")", "parent", ")", ".", "getInitializer", "(", "count", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_illegalParent", ")", ";", "}", "}", "protected", "int", "getMemberDeclarationStartPosition", "(", ")", "{", "return", "this", ".", "fBodyRange", "[", "0", "]", ";", "}", "public", "int", "getNodeType", "(", ")", "{", "return", "IDOMNode", ".", "INITIALIZER", ";", "}", "public", "boolean", "isSignatureEqual", "(", "IDOMNode", "node", ")", "{", "return", "false", ";", "}", "protected", "DOMNode", "newDOMNode", "(", ")", "{", "return", "new", "DOMInitializer", "(", ")", ";", "}", "protected", "void", "offset", "(", "int", "offset", ")", "{", "super", ".", "offset", "(", "offset", ")", ";", "offsetRange", "(", "this", ".", "fBodyRange", ",", "offset", ")", ";", "}", "public", "void", "setBody", "(", "String", "body", ")", "{", "becomeDetailed", "(", ")", ";", "this", ".", "fBody", "=", "body", ";", "setHasBody", "(", "body", "!=", "null", ")", ";", "fragment", "(", ")", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "}", "protected", "void", "shareContents", "(", "DOMNode", "node", ")", "{", "super", ".", "shareContents", "(", "node", ")", ";", "DOMInitializer", "init", "=", "(", "DOMInitializer", ")", "node", ";", "this", ".", "fBody", "=", "init", ".", "fBody", ";", "this", ".", "fBodyRange", "=", "rangeCopy", "(", "init", ".", "fBodyRange", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"INITIALIZER\"", ";", "}", "}", "</s>" ]
3,759
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "InvalidInputException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "Scanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "TerminalTokens", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "class", "DOMType", "extends", "DOMMember", "implements", "IDOMType", "{", "protected", "String", "fTypeKeyword", ";", "protected", "int", "[", "]", "fTypeRange", ";", "protected", "String", "fSuperclass", ";", "protected", "int", "[", "]", "fSuperclassRange", ";", "protected", "int", "[", "]", "fExtendsRange", ";", "protected", "int", "[", "]", "fImplementsRange", ";", "protected", "char", "[", "]", "fInterfaces", ";", "protected", "int", "[", "]", "fInterfacesRange", ";", "protected", "int", "[", "]", "fOpenBodyRange", ";", "protected", "int", "[", "]", "fCloseBodyRange", ";", "protected", "String", "[", "]", "fSuperInterfaces", "=", "CharOperation", ".", "NO_STRINGS", ";", "protected", "String", "[", "]", "fTypeParameters", "=", "CharOperation", ".", "NO_STRINGS", ";", "protected", "boolean", "fIsEnum", "=", "false", ";", "protected", "boolean", "fIsAnnotation", "=", "false", ";", "DOMType", "(", ")", "{", "}", "DOMType", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ",", "int", "[", "]", "commentRange", ",", "int", "flags", ",", "int", "[", "]", "modifierRange", ",", "int", "[", "]", "typeRange", ",", "int", "[", "]", "superclassRange", ",", "int", "[", "]", "extendsRange", ",", "String", "[", "]", "implementsList", ",", "int", "[", "]", "implementsRange", ",", "int", "[", "]", "implementsKeywordRange", ",", "int", "[", "]", "openBodyRange", ",", "int", "[", "]", "closeBodyRange", ",", "boolean", "isClass", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ",", "commentRange", ",", "flags", ",", "modifierRange", ")", ";", "this", ".", "fTypeRange", "=", "typeRange", ";", "setMask", "(", "MASK_TYPE_IS_CLASS", ",", "isClass", ")", ";", "this", ".", "fExtendsRange", "=", "extendsRange", ";", "this", ".", "fImplementsRange", "=", "implementsKeywordRange", ";", "this", ".", "fSuperclassRange", "=", "superclassRange", ";", "this", ".", "fInterfacesRange", "=", "implementsRange", ";", "this", ".", "fCloseBodyRange", "=", "closeBodyRange", ";", "setMask", "(", "MASK_TYPE_HAS_SUPERCLASS", ",", "superclassRange", "[", "0", "]", ">", "0", ")", ";", "setMask", "(", "MASK_TYPE_HAS_INTERFACES", ",", "implementsList", "!=", "null", ")", ";", "this", ".", "fSuperInterfaces", "=", "implementsList", ";", "this", ".", "fOpenBodyRange", "=", "openBodyRange", ";", "this", ".", "fCloseBodyRange", "=", "closeBodyRange", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "true", ")", ";", "}", "DOMType", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ",", "int", "flags", ",", "String", "[", "]", "implementsList", ",", "boolean", "isClass", ")", "{", "this", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "flags", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "implementsList", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "new", "int", "[", "]", "{", "sourceRange", "[", "1", "]", ",", "sourceRange", "[", "1", "]", "}", ",", "isClass", ")", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "false", ")", ";", "}", "public", "void", "addSuperInterface", "(", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_addNullInterface", ")", ";", "}", "if", "(", "this", ".", "fSuperInterfaces", "==", "null", ")", "{", "this", ".", "fSuperInterfaces", "=", "new", "String", "[", "1", "]", ";", "this", ".", "fSuperInterfaces", "[", "0", "]", "=", "name", ";", "}", "else", "{", "this", ".", "fSuperInterfaces", "=", "appendString", "(", "this", ".", "fSuperInterfaces", ",", "name", ")", ";", "}", "setSuperInterfaces", "(", "this", ".", "fSuperInterfaces", ")", ";", "}", "protected", "void", "appendMemberBodyContents", "(", "CharArrayBuffer", "buffer", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fOpenBodyRange", "[", "0", "]", ",", "this", ".", "fOpenBodyRange", "[", "1", "]", "+", "1", "-", "this", ".", "fOpenBodyRange", "[", "0", "]", ")", ";", "appendContentsOfChildren", "(", "buffer", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fCloseBodyRange", "[", "0", "]", ",", "this", ".", "fCloseBodyRange", "[", "1", "]", "+", "1", "-", "this", ".", "fCloseBodyRange", "[", "0", "]", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fCloseBodyRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fCloseBodyRange", "[", "1", "]", ")", ";", "}", "protected", "void", "appendMemberDeclarationContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "this", ".", "fTypeKeyword", "!=", "null", ")", "{", "buffer", ".", "append", "(", "this", ".", "fTypeKeyword", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fTypeRange", "[", "1", "]", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fTypeRange", "[", "1", "]", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fTypeRange", "[", "0", "]", ",", "this", ".", "fTypeRange", "[", "1", "]", "+", "1", "-", "this", ".", "fTypeRange", "[", "0", "]", ")", ";", "}", "buffer", ".", "append", "(", "getName", "(", ")", ")", ";", "if", "(", "isClass", "(", ")", ")", "{", "boolean", "hasInterfaces", "=", "false", ";", "if", "(", "getMask", "(", "MASK_TYPE_HAS_SUPERCLASS", ")", ")", "{", "if", "(", "this", ".", "fExtendsRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "\"", "extends", "\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fExtendsRange", "[", "0", "]", ",", "this", ".", "fExtendsRange", "[", "1", "]", "+", "1", "-", "this", ".", "fExtendsRange", "[", "0", "]", ")", ";", "}", "if", "(", "this", ".", "fSuperclass", "!=", "null", ")", "{", "buffer", ".", "append", "(", "this", ".", "fSuperclass", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSuperclassRange", "[", "0", "]", ",", "this", ".", "fSuperclassRange", "[", "1", "]", "+", "1", "-", "this", ".", "fSuperclassRange", "[", "0", "]", ")", ";", "}", "}", "if", "(", "getMask", "(", "MASK_TYPE_HAS_INTERFACES", ")", ")", "{", "hasInterfaces", "=", "true", ";", "if", "(", "this", ".", "fImplementsRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "\"", "implements", "\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fImplementsRange", "[", "0", "]", ",", "this", ".", "fImplementsRange", "[", "1", "]", "+", "1", "-", "this", ".", "fImplementsRange", "[", "0", "]", ")", ";", "}", "if", "(", "this", ".", "fInterfaces", "!=", "null", ")", "{", "buffer", ".", "append", "(", "this", ".", "fInterfaces", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fInterfacesRange", "[", "0", "]", ",", "this", ".", "fInterfacesRange", "[", "1", "]", "+", "1", "-", "this", ".", "fInterfacesRange", "[", "0", "]", ")", ";", "}", "}", "if", "(", "hasInterfaces", ")", "{", "if", "(", "this", ".", "fImplementsRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fInterfacesRange", "[", "1", "]", "+", "1", ",", "this", ".", "fOpenBodyRange", "[", "0", "]", "-", "this", ".", "fInterfacesRange", "[", "1", "]", "-", "1", ")", ";", "}", "}", "else", "{", "if", "(", "this", ".", "fSuperclassRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "else", "if", "(", "this", ".", "fImplementsRange", "[", "0", "]", ">", "0", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSuperclassRange", "[", "1", "]", "+", "1", ",", "this", ".", "fImplementsRange", "[", "0", "]", "-", "this", ".", "fSuperclassRange", "[", "1", "]", "-", "1", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fInterfacesRange", "[", "1", "]", "+", "1", ",", "this", ".", "fOpenBodyRange", "[", "0", "]", "-", "this", ".", "fInterfacesRange", "[", "1", "]", "-", "1", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSuperclassRange", "[", "1", "]", "+", "1", ",", "this", ".", "fOpenBodyRange", "[", "0", "]", "-", "this", ".", "fSuperclassRange", "[", "1", "]", "-", "1", ")", ";", "}", "}", "}", "else", "{", "if", "(", "getMask", "(", "MASK_TYPE_HAS_INTERFACES", ")", ")", "{", "if", "(", "this", ".", "fExtendsRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "\"", "extends", "\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fExtendsRange", "[", "0", "]", ",", "this", ".", "fExtendsRange", "[", "1", "]", "+", "1", "-", "this", ".", "fExtendsRange", "[", "0", "]", ")", ";", "}", "if", "(", "this", ".", "fInterfaces", "!=", "null", ")", "{", "buffer", ".", "append", "(", "this", ".", "fInterfaces", ")", ";", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fInterfacesRange", "[", "0", "]", ",", "this", ".", "fInterfacesRange", "[", "1", "]", "+", "1", "-", "this", ".", "fInterfacesRange", "[", "0", "]", ")", ";", "}", "}", "else", "{", "if", "(", "this", ".", "fImplementsRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fOpenBodyRange", "[", "0", "]", "-", "this", ".", "fNameRange", "[", "1", "]", "-", "1", ")", ";", "}", "}", "}", "}", "protected", "void", "appendSimpleContents", "(", "CharArrayBuffer", "buffer", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSourceRange", "[", "0", "]", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fSourceRange", "[", "0", "]", ")", ";", "buffer", ".", "append", "(", "this", ".", "fName", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fOpenBodyRange", "[", "1", "]", "-", "this", ".", "fNameRange", "[", "1", "]", ")", ";", "appendContentsOfChildren", "(", "buffer", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fCloseBodyRange", "[", "0", "]", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fCloseBodyRange", "[", "0", "]", "+", "1", ")", ";", "}", "public", "boolean", "canHaveChildren", "(", ")", "{", "return", "true", ";", "}", "int", "getCloseBodyPosition", "(", ")", "{", "return", "this", ".", "fCloseBodyRange", "[", "0", "]", ";", "}", "protected", "DOMNode", "getDetailedNode", "(", ")", "{", "return", "(", "DOMNode", ")", "getFactory", "(", ")", ".", "createType", "(", "getContents", "(", ")", ")", ";", "}", "public", "int", "getInsertionPosition", "(", ")", "{", "return", "this", ".", "fInsertionPosition", ";", "}", "public", "IJavaElement", "getJavaElement", "(", "IJavaElement", "parent", ")", "throws", "IllegalArgumentException", "{", "switch", "(", "parent", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "return", "(", "(", "ICompilationUnit", ")", "parent", ")", ".", "getType", "(", "getName", "(", ")", ")", ";", "case", "IJavaElement", ".", "TYPE", ":", "return", "(", "(", "IType", ")", "parent", ")", ".", "getType", "(", "getName", "(", ")", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_illegalParent", ")", ";", "}", "}", "protected", "int", "getMemberDeclarationStartPosition", "(", ")", "{", "return", "this", ".", "fTypeRange", "[", "0", "]", ";", "}", "public", "int", "getNodeType", "(", ")", "{", "return", "IDOMNode", ".", "TYPE", ";", "}", "int", "getOpenBodyEnd", "(", ")", "{", "return", "this", ".", "fOpenBodyRange", "[", "1", "]", ";", "}", "public", "String", "getSuperclass", "(", ")", "{", "becomeDetailed", "(", ")", ";", "if", "(", "getMask", "(", "MASK_TYPE_HAS_SUPERCLASS", ")", ")", "{", "if", "(", "this", ".", "fSuperclass", "!=", "null", ")", "{", "return", "this", ".", "fSuperclass", ";", "}", "else", "{", "return", "new", "String", "(", "this", ".", "fDocument", ",", "this", ".", "fSuperclassRange", "[", "0", "]", ",", "this", ".", "fSuperclassRange", "[", "1", "]", "+", "1", "-", "this", ".", "fSuperclassRange", "[", "0", "]", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "public", "String", "[", "]", "getSuperInterfaces", "(", ")", "{", "return", "this", ".", "fSuperInterfaces", ";", "}", "public", "boolean", "isAllowableChild", "(", "IDOMNode", "node", ")", "{", "if", "(", "node", "!=", "null", ")", "{", "int", "type", "=", "node", ".", "getNodeType", "(", ")", ";", "return", "type", "==", "IDOMNode", ".", "TYPE", "||", "type", "==", "IDOMNode", ".", "FIELD", "||", "type", "==", "IDOMNode", ".", "METHOD", "||", "type", "==", "IDOMNode", ".", "INITIALIZER", ";", "}", "else", "{", "return", "false", ";", "}", "}", "public", "boolean", "isClass", "(", ")", "{", "return", "getMask", "(", "MASK_TYPE_IS_CLASS", ")", ";", "}", "protected", "DOMNode", "newDOMNode", "(", ")", "{", "return", "new", "DOMType", "(", ")", ";", "}", "void", "normalize", "(", "ILineStartFinder", "finder", ")", "{", "int", "openBodyEnd", ",", "openBodyStart", ",", "closeBodyStart", ",", "closeBodyEnd", ";", "DOMNode", "first", "=", "(", "DOMNode", ")", "getFirstChild", "(", ")", ";", "DOMNode", "lastNode", "=", "null", ";", "Scanner", "scanner", "=", "new", "Scanner", "(", ")", ";", "scanner", ".", "setSource", "(", "this", ".", "fDocument", ")", ";", "scanner", ".", "resetTo", "(", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fDocument", ".", "length", ")", ";", "try", "{", "int", "currentToken", "=", "scanner", ".", "getNextToken", "(", ")", ";", "while", "(", "currentToken", "!=", "TerminalTokens", ".", "TokenNameLBRACE", "&&", "currentToken", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "currentToken", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "if", "(", "currentToken", "==", "TerminalTokens", ".", "TokenNameLBRACE", ")", "{", "openBodyEnd", "=", "scanner", ".", "currentPosition", "-", "1", ";", "openBodyStart", "=", "scanner", ".", "startPosition", ";", "}", "else", "{", "openBodyEnd", "=", "this", ".", "fDocument", ".", "length", ";", "openBodyStart", "=", "this", ".", "fDocument", ".", "length", ";", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "openBodyEnd", "=", "this", ".", "fDocument", ".", "length", ";", "openBodyStart", "=", "this", ".", "fDocument", ".", "length", ";", "}", "if", "(", "first", "!=", "null", ")", "{", "int", "lineStart", "=", "finder", ".", "getLineStart", "(", "first", ".", "getStartPosition", "(", ")", ")", ";", "if", "(", "lineStart", ">", "openBodyEnd", ")", "{", "openBodyEnd", "=", "lineStart", "-", "1", ";", "}", "else", "{", "openBodyEnd", "=", "first", ".", "getStartPosition", "(", ")", "-", "1", ";", "}", "lastNode", "=", "(", "DOMNode", ")", "first", ".", "getNextNode", "(", ")", ";", "if", "(", "lastNode", "==", "null", ")", "{", "lastNode", "=", "first", ";", "}", "else", "{", "while", "(", "lastNode", ".", "getNextNode", "(", ")", "!=", "null", ")", "{", "lastNode", "=", "(", "DOMNode", ")", "lastNode", ".", "getNextNode", "(", ")", ";", "}", "}", "scanner", ".", "setSource", "(", "this", ".", "fDocument", ")", ";", "scanner", ".", "resetTo", "(", "lastNode", ".", "getEndPosition", "(", ")", "+", "1", ",", "this", ".", "fDocument", ".", "length", ")", ";", "try", "{", "int", "currentToken", "=", "scanner", ".", "getNextToken", "(", ")", ";", "while", "(", "currentToken", "!=", "TerminalTokens", ".", "TokenNameRBRACE", "&&", "currentToken", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "currentToken", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "if", "(", "currentToken", "==", "TerminalTokens", ".", "TokenNameRBRACE", ")", "{", "closeBodyStart", "=", "scanner", ".", "startPosition", ";", "closeBodyEnd", "=", "scanner", ".", "currentPosition", "-", "1", ";", "}", "else", "{", "closeBodyStart", "=", "this", ".", "fDocument", ".", "length", ";", "closeBodyEnd", "=", "this", ".", "fDocument", ".", "length", ";", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "closeBodyStart", "=", "this", ".", "fDocument", ".", "length", ";", "closeBodyEnd", "=", "this", ".", "fDocument", ".", "length", ";", "}", "}", "else", "{", "scanner", ".", "resetTo", "(", "openBodyEnd", ",", "this", ".", "fDocument", ".", "length", ")", ";", "try", "{", "int", "currentToken", "=", "scanner", ".", "getNextToken", "(", ")", ";", "while", "(", "currentToken", "!=", "TerminalTokens", ".", "TokenNameRBRACE", "&&", "currentToken", "!=", "TerminalTokens", ".", "TokenNameEOF", ")", "{", "currentToken", "=", "scanner", ".", "getNextToken", "(", ")", ";", "}", "if", "(", "currentToken", "==", "TerminalTokens", ".", "TokenNameRBRACE", ")", "{", "closeBodyStart", "=", "scanner", ".", "startPosition", ";", "closeBodyEnd", "=", "scanner", ".", "currentPosition", "-", "1", ";", "}", "else", "{", "closeBodyStart", "=", "this", ".", "fDocument", ".", "length", ";", "closeBodyEnd", "=", "this", ".", "fDocument", ".", "length", ";", "}", "}", "catch", "(", "InvalidInputException", "e", ")", "{", "closeBodyStart", "=", "this", ".", "fDocument", ".", "length", ";", "closeBodyEnd", "=", "this", ".", "fDocument", ".", "length", ";", "}", "openBodyEnd", "=", "closeBodyEnd", "-", "1", ";", "}", "setOpenBodyRangeEnd", "(", "openBodyEnd", ")", ";", "setOpenBodyRangeStart", "(", "openBodyStart", ")", ";", "setCloseBodyRangeStart", "(", "closeBodyStart", ")", ";", "setCloseBodyRangeEnd", "(", "closeBodyEnd", ")", ";", "this", ".", "fInsertionPosition", "=", "finder", ".", "getLineStart", "(", "closeBodyStart", ")", ";", "if", "(", "lastNode", "!=", "null", "&&", "this", ".", "fInsertionPosition", "<", "lastNode", ".", "getEndPosition", "(", ")", ")", "{", "this", ".", "fInsertionPosition", "=", "getCloseBodyPosition", "(", ")", ";", "}", "if", "(", "this", ".", "fInsertionPosition", "<=", "openBodyEnd", ")", "{", "this", ".", "fInsertionPosition", "=", "getCloseBodyPosition", "(", ")", ";", "}", "super", ".", "normalize", "(", "finder", ")", ";", "}", "void", "normalizeEndPosition", "(", "ILineStartFinder", "finder", ",", "DOMNode", "next", ")", "{", "if", "(", "next", "==", "null", ")", "{", "DOMNode", "parent", "=", "(", "DOMNode", ")", "getParent", "(", ")", ";", "if", "(", "parent", "==", "null", "||", "parent", "instanceof", "DOMCompilationUnit", ")", "{", "setSourceRangeEnd", "(", "this", ".", "fDocument", ".", "length", "-", "1", ")", ";", "}", "else", "{", "setSourceRangeEnd", "(", "(", "(", "DOMType", ")", "parent", ")", ".", "getCloseBodyPosition", "(", ")", "-", "1", ")", ";", "}", "}", "else", "{", "next", ".", "normalizeStartPosition", "(", "getEndPosition", "(", ")", ",", "finder", ")", ";", "setSourceRangeEnd", "(", "next", ".", "getStartPosition", "(", ")", "-", "1", ")", ";", "}", "}", "protected", "void", "offset", "(", "int", "offset", ")", "{", "super", ".", "offset", "(", "offset", ")", ";", "offsetRange", "(", "this", ".", "fCloseBodyRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fExtendsRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fImplementsRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fInterfacesRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fOpenBodyRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fSuperclassRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fTypeRange", ",", "offset", ")", ";", "}", "public", "void", "setClass", "(", "boolean", "b", ")", "{", "becomeDetailed", "(", ")", ";", "fragment", "(", ")", ";", "setMask", "(", "MASK_TYPE_IS_CLASS", ",", "b", ")", ";", "if", "(", "b", ")", "{", "this", ".", "fTypeKeyword", "=", "\"class\"", ";", "}", "else", "{", "this", ".", "fTypeKeyword", "=", "\"interface\"", ";", "setSuperclass", "(", "null", ")", ";", "}", "}", "void", "setCloseBodyRangeEnd", "(", "int", "end", ")", "{", "this", ".", "fCloseBodyRange", "[", "1", "]", "=", "end", ";", "}", "void", "setCloseBodyRangeStart", "(", "int", "start", ")", "{", "this", ".", "fCloseBodyRange", "[", "0", "]", "=", "start", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_nullName", ")", ";", "}", "super", ".", "setName", "(", "name", ")", ";", "Enumeration", "children", "=", "getChildren", "(", ")", ";", "while", "(", "children", ".", "hasMoreElements", "(", ")", ")", "{", "IDOMNode", "child", "=", "(", "IDOMNode", ")", "children", ".", "nextElement", "(", ")", ";", "if", "(", "child", ".", "getNodeType", "(", ")", "==", "IDOMNode", ".", "METHOD", "&&", "(", "(", "IDOMMethod", ")", "child", ")", ".", "isConstructor", "(", ")", ")", "{", "(", "(", "DOMNode", ")", "child", ")", ".", "fragment", "(", ")", ";", "}", "}", "}", "void", "setOpenBodyRangeEnd", "(", "int", "end", ")", "{", "this", ".", "fOpenBodyRange", "[", "1", "]", "=", "end", ";", "}", "void", "setOpenBodyRangeStart", "(", "int", "start", ")", "{", "this", ".", "fOpenBodyRange", "[", "0", "]", "=", "start", ";", "}", "public", "void", "setSuperclass", "(", "String", "superclassName", ")", "{", "becomeDetailed", "(", ")", ";", "fragment", "(", ")", ";", "this", ".", "fSuperclass", "=", "superclassName", ";", "setMask", "(", "MASK_TYPE_HAS_SUPERCLASS", ",", "superclassName", "!=", "null", ")", ";", "}", "public", "void", "setSuperInterfaces", "(", "String", "[", "]", "names", ")", "{", "becomeDetailed", "(", ")", ";", "if", "(", "names", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_nullInterfaces", ")", ";", "}", "fragment", "(", ")", ";", "this", ".", "fSuperInterfaces", "=", "names", ";", "if", "(", "names", ".", "length", "==", "0", ")", "{", "this", ".", "fInterfaces", "=", "null", ";", "this", ".", "fSuperInterfaces", "=", "CharOperation", ".", "NO_STRINGS", ";", "setMask", "(", "MASK_TYPE_HAS_INTERFACES", ",", "false", ")", ";", "}", "else", "{", "setMask", "(", "MASK_TYPE_HAS_INTERFACES", ",", "true", ")", ";", "CharArrayBuffer", "buffer", "=", "new", "CharArrayBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "names", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "buffer", ".", "append", "(", "names", "[", "i", "]", ")", ";", "}", "this", ".", "fInterfaces", "=", "buffer", ".", "getContents", "(", ")", ";", "}", "}", "void", "setTypeKeyword", "(", "String", "keyword", ")", "{", "this", ".", "fTypeKeyword", "=", "keyword", ";", "}", "protected", "void", "shareContents", "(", "DOMNode", "node", ")", "{", "super", ".", "shareContents", "(", "node", ")", ";", "DOMType", "type", "=", "(", "DOMType", ")", "node", ";", "this", ".", "fCloseBodyRange", "=", "rangeCopy", "(", "type", ".", "fCloseBodyRange", ")", ";", "this", ".", "fExtendsRange", "=", "type", ".", "fExtendsRange", ";", "this", ".", "fImplementsRange", "=", "rangeCopy", "(", "type", ".", "fImplementsRange", ")", ";", "this", ".", "fInterfaces", "=", "type", ".", "fInterfaces", ";", "this", ".", "fInterfacesRange", "=", "rangeCopy", "(", "type", ".", "fInterfacesRange", ")", ";", "this", ".", "fOpenBodyRange", "=", "rangeCopy", "(", "type", ".", "fOpenBodyRange", ")", ";", "this", ".", "fSuperclass", "=", "type", ".", "fSuperclass", ";", "this", ".", "fSuperclassRange", "=", "rangeCopy", "(", "type", ".", "fSuperclassRange", ")", ";", "this", ".", "fSuperInterfaces", "=", "type", ".", "fSuperInterfaces", ";", "this", ".", "fTypeKeyword", "=", "type", ".", "fTypeKeyword", ";", "this", ".", "fTypeRange", "=", "rangeCopy", "(", "type", ".", "fTypeRange", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"TYPE:", "\"", "+", "getName", "(", ")", ";", "}", "public", "String", "[", "]", "getTypeParameters", "(", ")", "{", "return", "this", ".", "fTypeParameters", ";", "}", "public", "boolean", "isEnum", "(", ")", "{", "return", "this", ".", "fIsEnum", ";", "}", "public", "boolean", "isAnnotation", "(", ")", "{", "return", "this", ".", "fIsAnnotation", ";", "}", "public", "void", "setEnum", "(", "boolean", "b", ")", "{", "this", ".", "fIsEnum", "=", "b", ";", "if", "(", "this", ".", "fIsEnum", ")", "{", "setClass", "(", "true", ")", ";", "setSuperclass", "(", "null", ")", ";", "}", "}", "public", "void", "setAnnotation", "(", "boolean", "b", ")", "{", "this", ".", "fIsAnnotation", "=", "b", ";", "if", "(", "this", ".", "fIsAnnotation", ")", "{", "setClass", "(", "false", ")", ";", "setSuperclass", "(", "null", ")", ";", "setSuperInterfaces", "(", "CharOperation", ".", "NO_STRINGS", ")", ";", "}", "}", "public", "void", "setTypeParameters", "(", "String", "[", "]", "typeParameters", ")", "{", "this", ".", "fTypeParameters", "=", "typeParameters", ";", "}", "}", "</s>" ]
3,760
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "public", "interface", "ILineStartFinder", "{", "public", "int", "getLineStart", "(", "int", "position", ")", ";", "}", "</s>" ]
3,761
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "java", ".", "util", ".", "Enumeration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "abstract", "class", "DOMNode", "implements", "IDOMNode", "{", "protected", "DOMNode", "fFirstChild", "=", "null", ";", "protected", "DOMNode", "fLastChild", "=", "null", ";", "protected", "DOMNode", "fNextNode", "=", "null", ";", "protected", "DOMNode", "fParent", "=", "null", ";", "protected", "DOMNode", "fPreviousNode", "=", "null", ";", "protected", "boolean", "fIsFragmented", "=", "false", ";", "protected", "String", "fName", "=", "null", ";", "protected", "int", "[", "]", "fNameRange", ";", "protected", "char", "[", "]", "fDocument", "=", "null", ";", "protected", "int", "[", "]", "fSourceRange", ";", "protected", "int", "fStateMask", "=", "0", ";", "protected", "int", "fInsertionPosition", ";", "protected", "static", "final", "int", "MASK_FIELD_HAS_INITIALIZER", "=", "0x00000001", ";", "protected", "static", "final", "int", "MASK_FIELD_IS_VARIABLE_DECLARATOR", "=", "0x00000002", ";", "protected", "static", "final", "int", "MASK_FIELD_TYPE_ALTERED", "=", "0x00000004", ";", "protected", "static", "final", "int", "MASK_NAME_ALTERED", "=", "0x00000008", ";", "protected", "static", "final", "int", "MASK_HAS_BODY", "=", "0x00000010", ";", "protected", "static", "final", "int", "MASK_HAS_COMMENT", "=", "0x00000020", ";", "protected", "static", "final", "int", "MASK_IS_CONSTRUCTOR", "=", "0x00000040", ";", "protected", "static", "final", "int", "MASK_TYPE_IS_CLASS", "=", "0x00000080", ";", "protected", "static", "final", "int", "MASK_TYPE_HAS_SUPERCLASS", "=", "0x00000100", ";", "protected", "static", "final", "int", "MASK_TYPE_HAS_INTERFACES", "=", "0x00000200", ";", "protected", "static", "final", "int", "MASK_RETURN_TYPE_ALTERED", "=", "0x00000400", ";", "protected", "static", "final", "int", "MASK_DETAILED_SOURCE_INDEXES", "=", "0x00000800", ";", "DOMNode", "(", ")", "{", "this", ".", "fName", "=", "null", ";", "this", ".", "fDocument", "=", "null", ";", "this", ".", "fSourceRange", "=", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ";", "this", ".", "fNameRange", "=", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ";", "fragment", "(", ")", ";", "}", "DOMNode", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ")", "{", "super", "(", ")", ";", "this", ".", "fDocument", "=", "document", ";", "this", ".", "fSourceRange", "=", "sourceRange", ";", "this", ".", "fName", "=", "name", ";", "this", ".", "fNameRange", "=", "nameRange", ";", "}", "public", "void", "addChild", "(", "IDOMNode", "child", ")", "throws", "IllegalArgumentException", ",", "DOMException", "{", "basicAddChild", "(", "child", ")", ";", "if", "(", "child", ".", "getNodeType", "(", ")", "==", "IDOMNode", ".", "METHOD", "&&", "(", "(", "IDOMMethod", ")", "child", ")", ".", "isConstructor", "(", ")", ")", "{", "(", "(", "DOMNode", ")", "child", ")", ".", "fragment", "(", ")", ";", "}", "else", "{", "fragment", "(", ")", ";", "}", "}", "protected", "void", "appendContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "isFragmented", "(", ")", ")", "{", "appendFragmentedContents", "(", "buffer", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSourceRange", "[", "0", "]", ",", "this", ".", "fSourceRange", "[", "1", "]", "+", "1", "-", "this", ".", "fSourceRange", "[", "0", "]", ")", ";", "}", "}", "protected", "void", "appendContentsOfChildren", "(", "CharArrayBuffer", "buffer", ")", "{", "DOMNode", "child", "=", "this", ".", "fFirstChild", ";", "DOMNode", "sibling", ";", "int", "start", "=", "0", ",", "end", "=", "0", ";", "if", "(", "child", "!=", "null", ")", "{", "start", "=", "child", ".", "getStartPosition", "(", ")", ";", "end", "=", "child", ".", "getEndPosition", "(", ")", ";", "}", "while", "(", "child", "!=", "null", ")", "{", "sibling", "=", "child", ".", "fNextNode", ";", "if", "(", "sibling", "!=", "null", ")", "{", "if", "(", "sibling", ".", "isContentMergableWith", "(", "child", ")", ")", "{", "end", "=", "sibling", ".", "getEndPosition", "(", ")", ";", "}", "else", "{", "if", "(", "child", ".", "isFragmented", "(", ")", ")", "{", "child", ".", "appendContents", "(", "buffer", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "child", ".", "getDocument", "(", ")", ",", "start", ",", "end", "+", "1", "-", "start", ")", ";", "}", "start", "=", "sibling", ".", "getStartPosition", "(", ")", ";", "end", "=", "sibling", ".", "getEndPosition", "(", ")", ";", "}", "}", "else", "{", "if", "(", "child", ".", "isFragmented", "(", ")", ")", "{", "child", ".", "appendContents", "(", "buffer", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "child", ".", "getDocument", "(", ")", ",", "start", ",", "end", "+", "1", "-", "start", ")", ";", "}", "}", "child", "=", "sibling", ";", "}", "}", "protected", "abstract", "void", "appendFragmentedContents", "(", "CharArrayBuffer", "buffer", ")", ";", "void", "basicAddChild", "(", "IDOMNode", "child", ")", "throws", "IllegalArgumentException", ",", "DOMException", "{", "if", "(", "!", "canHaveChildren", "(", ")", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_unableAddChild", ")", ";", "}", "if", "(", "child", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_addNullChild", ")", ";", "}", "if", "(", "!", "isAllowableChild", "(", "child", ")", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_addIncompatibleChild", ")", ";", "}", "if", "(", "child", ".", "getParent", "(", ")", "!=", "null", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_addChildWithParent", ")", ";", "}", "if", "(", "child", "==", "getRoot", "(", ")", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_addAncestorAsChild", ")", ";", "}", "DOMNode", "node", "=", "(", "DOMNode", ")", "child", ";", "if", "(", "node", ".", "getDocument", "(", ")", "!=", "getDocument", "(", ")", ")", "{", "node", ".", "localizeContents", "(", ")", ";", "}", "if", "(", "this", ".", "fFirstChild", "==", "null", ")", "{", "this", ".", "fFirstChild", "=", "node", ";", "}", "else", "{", "this", ".", "fLastChild", ".", "fNextNode", "=", "node", ";", "node", ".", "fPreviousNode", "=", "this", ".", "fLastChild", ";", "}", "this", ".", "fLastChild", "=", "node", ";", "node", ".", "fParent", "=", "this", ";", "}", "protected", "void", "becomeDetailed", "(", ")", "throws", "DOMException", "{", "if", "(", "!", "isDetailed", "(", ")", ")", "{", "DOMNode", "detailed", "=", "getDetailedNode", "(", ")", ";", "if", "(", "detailed", "==", "null", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_cannotDetail", ")", ";", "}", "if", "(", "detailed", "!=", "this", ")", "{", "shareContents", "(", "detailed", ")", ";", "}", "}", "}", "public", "boolean", "canHaveChildren", "(", ")", "{", "return", "false", ";", "}", "public", "Object", "clone", "(", ")", "{", "int", "length", "=", "0", ";", "char", "[", "]", "buffer", "=", "null", ";", "int", "offset", "=", "this", ".", "fSourceRange", "[", "0", "]", ";", "if", "(", "offset", ">=", "0", ")", "{", "length", "=", "this", ".", "fSourceRange", "[", "1", "]", "-", "offset", "+", "1", ";", "buffer", "=", "new", "char", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "fDocument", ",", "offset", ",", "buffer", ",", "0", ",", "length", ")", ";", "}", "DOMNode", "clone", "=", "newDOMNode", "(", ")", ";", "clone", ".", "shareContents", "(", "this", ")", ";", "clone", ".", "fDocument", "=", "buffer", ";", "if", "(", "offset", ">", "0", ")", "{", "clone", ".", "offset", "(", "0", "-", "offset", ")", ";", "}", "if", "(", "canHaveChildren", "(", ")", ")", "{", "Enumeration", "children", "=", "getChildren", "(", ")", ";", "while", "(", "children", ".", "hasMoreElements", "(", ")", ")", "{", "DOMNode", "child", "=", "(", "DOMNode", ")", "children", ".", "nextElement", "(", ")", ";", "if", "(", "child", ".", "fDocument", "==", "this", ".", "fDocument", ")", "{", "DOMNode", "childClone", "=", "child", ".", "cloneSharingDocument", "(", "buffer", ",", "offset", ")", ";", "clone", ".", "basicAddChild", "(", "childClone", ")", ";", "}", "else", "{", "DOMNode", "childClone", "=", "(", "DOMNode", ")", "child", ".", "clone", "(", ")", ";", "clone", ".", "addChild", "(", "childClone", ")", ";", "}", "}", "}", "return", "clone", ";", "}", "private", "DOMNode", "cloneSharingDocument", "(", "char", "[", "]", "document", ",", "int", "rootOffset", ")", "{", "DOMNode", "clone", "=", "newDOMNode", "(", ")", ";", "clone", ".", "shareContents", "(", "this", ")", ";", "clone", ".", "fDocument", "=", "document", ";", "if", "(", "rootOffset", ">", "0", ")", "{", "clone", ".", "offset", "(", "0", "-", "rootOffset", ")", ";", "}", "if", "(", "canHaveChildren", "(", ")", ")", "{", "Enumeration", "children", "=", "getChildren", "(", ")", ";", "while", "(", "children", ".", "hasMoreElements", "(", ")", ")", "{", "DOMNode", "child", "=", "(", "DOMNode", ")", "children", ".", "nextElement", "(", ")", ";", "if", "(", "child", ".", "fDocument", "==", "this", ".", "fDocument", ")", "{", "DOMNode", "childClone", "=", "child", ".", "cloneSharingDocument", "(", "document", ",", "rootOffset", ")", ";", "clone", ".", "basicAddChild", "(", "childClone", ")", ";", "}", "else", "{", "DOMNode", "childClone", "=", "(", "DOMNode", ")", "child", ".", "clone", "(", ")", ";", "clone", ".", "addChild", "(", "childClone", ")", ";", "}", "}", "}", "return", "clone", ";", "}", "protected", "void", "fragment", "(", ")", "{", "if", "(", "!", "isFragmented", "(", ")", ")", "{", "this", ".", "fIsFragmented", "=", "true", ";", "if", "(", "this", ".", "fParent", "!=", "null", ")", "{", "this", ".", "fParent", ".", "fragment", "(", ")", ";", "}", "}", "}", "public", "char", "[", "]", "getCharacters", "(", ")", "{", "CharArrayBuffer", "buffer", "=", "new", "CharArrayBuffer", "(", ")", ";", "appendContents", "(", "buffer", ")", ";", "return", "buffer", ".", "getContents", "(", ")", ";", "}", "public", "IDOMNode", "getChild", "(", "String", "name", ")", "{", "DOMNode", "child", "=", "this", ".", "fFirstChild", ";", "while", "(", "child", "!=", "null", ")", "{", "String", "n", "=", "child", ".", "getName", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "if", "(", "n", "==", "null", ")", "{", "return", "child", ";", "}", "}", "else", "{", "if", "(", "name", ".", "equals", "(", "n", ")", ")", "{", "return", "child", ";", "}", "}", "child", "=", "child", ".", "fNextNode", ";", "}", "return", "null", ";", "}", "public", "Enumeration", "getChildren", "(", ")", "{", "return", "new", "SiblingEnumeration", "(", "this", ".", "fFirstChild", ")", ";", "}", "public", "String", "getContents", "(", ")", "{", "CharArrayBuffer", "buffer", "=", "new", "CharArrayBuffer", "(", ")", ";", "appendContents", "(", "buffer", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "protected", "DOMNode", "getDetailedNode", "(", ")", "{", "return", "this", ";", "}", "protected", "char", "[", "]", "getDocument", "(", ")", "{", "return", "this", ".", "fDocument", ";", "}", "public", "int", "getEndPosition", "(", ")", "{", "return", "this", ".", "fSourceRange", "[", "1", "]", ";", "}", "protected", "IDOMFactory", "getFactory", "(", ")", "{", "return", "new", "DOMFactory", "(", ")", ";", "}", "public", "IDOMNode", "getFirstChild", "(", ")", "{", "return", "this", ".", "fFirstChild", ";", "}", "public", "int", "getInsertionPosition", "(", ")", "{", "return", "this", ".", "fInsertionPosition", ";", "}", "protected", "boolean", "getMask", "(", "int", "mask", ")", "{", "return", "(", "this", ".", "fStateMask", "&", "mask", ")", ">", "0", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "fName", ";", "}", "protected", "char", "[", "]", "getNameContents", "(", ")", "{", "if", "(", "isNameAltered", "(", ")", ")", "{", "return", "this", ".", "fName", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "if", "(", "this", ".", "fName", "==", "null", "||", "this", ".", "fNameRange", "[", "0", "]", "<", "0", ")", "{", "return", "null", ";", "}", "else", "{", "int", "length", "=", "this", ".", "fNameRange", "[", "1", "]", "+", "1", "-", "this", ".", "fNameRange", "[", "0", "]", ";", "char", "[", "]", "result", "=", "new", "char", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "0", "]", ",", "result", ",", "0", ",", "length", ")", ";", "return", "result", ";", "}", "}", "}", "public", "IDOMNode", "getNextNode", "(", ")", "{", "return", "this", ".", "fNextNode", ";", "}", "public", "IDOMNode", "getParent", "(", ")", "{", "return", "this", ".", "fParent", ";", "}", "protected", "int", "getParentEndDeclaration", "(", ")", "{", "IDOMNode", "parent", "=", "getParent", "(", ")", ";", "if", "(", "parent", "==", "null", ")", "{", "return", "0", ";", "}", "else", "{", "if", "(", "parent", "instanceof", "IDOMCompilationUnit", ")", "{", "return", "0", ";", "}", "else", "{", "return", "(", "(", "DOMType", ")", "parent", ")", ".", "getOpenBodyEnd", "(", ")", ";", "}", "}", "}", "public", "IDOMNode", "getPreviousNode", "(", ")", "{", "return", "this", ".", "fPreviousNode", ";", "}", "protected", "IDOMNode", "getRoot", "(", ")", "{", "if", "(", "this", ".", "fParent", "==", "null", ")", "{", "return", "this", ";", "}", "else", "{", "return", "this", ".", "fParent", ".", "getRoot", "(", ")", ";", "}", "}", "public", "int", "getStartPosition", "(", ")", "{", "return", "this", ".", "fSourceRange", "[", "0", "]", ";", "}", "public", "void", "insertSibling", "(", "IDOMNode", "sibling", ")", "throws", "IllegalArgumentException", ",", "DOMException", "{", "if", "(", "sibling", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_addNullSibling", ")", ";", "}", "if", "(", "this", ".", "fParent", "==", "null", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_addSiblingBeforeRoot", ")", ";", "}", "if", "(", "!", "this", ".", "fParent", ".", "isAllowableChild", "(", "sibling", ")", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_addIncompatibleSibling", ")", ";", "}", "if", "(", "sibling", ".", "getParent", "(", ")", "!=", "null", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_addSiblingWithParent", ")", ";", "}", "if", "(", "sibling", "==", "getRoot", "(", ")", ")", "{", "throw", "new", "DOMException", "(", "Messages", ".", "dom_addAncestorAsSibling", ")", ";", "}", "DOMNode", "node", "=", "(", "DOMNode", ")", "sibling", ";", "if", "(", "node", ".", "getDocument", "(", ")", "!=", "getDocument", "(", ")", ")", "{", "node", ".", "localizeContents", "(", ")", ";", "}", "if", "(", "this", ".", "fPreviousNode", "==", "null", ")", "{", "this", ".", "fParent", ".", "fFirstChild", "=", "node", ";", "}", "else", "{", "this", ".", "fPreviousNode", ".", "fNextNode", "=", "node", ";", "}", "node", ".", "fParent", "=", "this", ".", "fParent", ";", "node", ".", "fPreviousNode", "=", "this", ".", "fPreviousNode", ";", "node", ".", "fNextNode", "=", "this", ";", "this", ".", "fPreviousNode", "=", "node", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "IDOMNode", ".", "METHOD", "&&", "(", "(", "IDOMMethod", ")", "node", ")", ".", "isConstructor", "(", ")", ")", "{", "node", ".", "fragment", "(", ")", ";", "}", "else", "{", "this", ".", "fParent", ".", "fragment", "(", ")", ";", "}", "}", "public", "boolean", "isAllowableChild", "(", "IDOMNode", "node", ")", "{", "return", "false", ";", "}", "protected", "boolean", "isContentMergableWith", "(", "DOMNode", "node", ")", "{", "return", "!", "node", ".", "isFragmented", "(", ")", "&&", "!", "isFragmented", "(", ")", "&&", "node", ".", "getDocument", "(", ")", "==", "getDocument", "(", ")", "&&", "node", ".", "getEndPosition", "(", ")", "+", "1", "==", "getStartPosition", "(", ")", ";", "}", "protected", "boolean", "isDetailed", "(", ")", "{", "return", "getMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ")", ";", "}", "protected", "boolean", "isFragmented", "(", ")", "{", "return", "this", ".", "fIsFragmented", ";", "}", "protected", "boolean", "isNameAltered", "(", ")", "{", "return", "getMask", "(", "MASK_NAME_ALTERED", ")", ";", "}", "public", "boolean", "isSignatureEqual", "(", "IDOMNode", "node", ")", "{", "return", "getNodeType", "(", ")", "==", "node", ".", "getNodeType", "(", ")", "&&", "getName", "(", ")", ".", "equals", "(", "node", ".", "getName", "(", ")", ")", ";", "}", "protected", "void", "localizeContents", "(", ")", "{", "DOMNode", "clone", "=", "(", "DOMNode", ")", "clone", "(", ")", ";", "shareContents", "(", "clone", ")", ";", "}", "protected", "abstract", "DOMNode", "newDOMNode", "(", ")", ";", "void", "normalize", "(", "ILineStartFinder", "finder", ")", "{", "if", "(", "getPreviousNode", "(", ")", "==", "null", ")", "normalizeStartPosition", "(", "getParentEndDeclaration", "(", ")", ",", "finder", ")", ";", "if", "(", "canHaveChildren", "(", ")", ")", "{", "Enumeration", "children", "=", "getChildren", "(", ")", ";", "while", "(", "children", ".", "hasMoreElements", "(", ")", ")", "(", "(", "DOMNode", ")", "children", ".", "nextElement", "(", ")", ")", ".", "normalize", "(", "finder", ")", ";", "}", "normalizeEndPosition", "(", "finder", ",", "(", "DOMNode", ")", "getNextNode", "(", ")", ")", ";", "}", "void", "normalizeEndPosition", "(", "ILineStartFinder", "finder", ",", "DOMNode", "next", ")", "{", "if", "(", "next", "==", "null", ")", "{", "DOMNode", "parent", "=", "(", "DOMNode", ")", "getParent", "(", ")", ";", "if", "(", "parent", "==", "null", "||", "parent", "instanceof", "DOMCompilationUnit", ")", "{", "setSourceRangeEnd", "(", "this", ".", "fDocument", ".", "length", "-", "1", ")", ";", "}", "else", "{", "int", "temp", "=", "(", "(", "DOMType", ")", "parent", ")", ".", "getCloseBodyPosition", "(", ")", "-", "1", ";", "setSourceRangeEnd", "(", "temp", ")", ";", "this", ".", "fInsertionPosition", "=", "Math", ".", "max", "(", "finder", ".", "getLineStart", "(", "temp", "+", "1", ")", ",", "getEndPosition", "(", ")", ")", ";", "}", "}", "else", "{", "int", "temp", "=", "next", ".", "getStartPosition", "(", ")", "-", "1", ";", "this", ".", "fInsertionPosition", "=", "Math", ".", "max", "(", "finder", ".", "getLineStart", "(", "temp", "+", "1", ")", ",", "getEndPosition", "(", ")", ")", ";", "next", ".", "normalizeStartPosition", "(", "getEndPosition", "(", ")", ",", "finder", ")", ";", "setSourceRangeEnd", "(", "next", ".", "getStartPosition", "(", ")", "-", "1", ")", ";", "}", "}", "void", "normalizeStartPosition", "(", "int", "previousEnd", ",", "ILineStartFinder", "finder", ")", "{", "int", "nodeStart", "=", "getStartPosition", "(", ")", ";", "int", "lineStart", "=", "finder", ".", "getLineStart", "(", "nodeStart", ")", ";", "if", "(", "nodeStart", ">", "lineStart", "&&", "(", "lineStart", ">", "previousEnd", "||", "(", "previousEnd", "==", "0", "&&", "lineStart", "==", "0", ")", ")", ")", "setStartPosition", "(", "lineStart", ")", ";", "}", "protected", "void", "offset", "(", "int", "offset", ")", "{", "offsetRange", "(", "this", ".", "fNameRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fSourceRange", ",", "offset", ")", ";", "}", "protected", "void", "offsetRange", "(", "int", "[", "]", "range", ",", "int", "offset", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "range", ".", "length", ";", "i", "++", ")", "{", "range", "[", "i", "]", "+=", "offset", ";", "if", "(", "range", "[", "i", "]", "<", "0", ")", "{", "range", "[", "i", "]", "=", "-", "1", ";", "}", "}", "}", "protected", "int", "[", "]", "rangeCopy", "(", "int", "[", "]", "range", ")", "{", "int", "[", "]", "copy", "=", "new", "int", "[", "range", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "range", ".", "length", ";", "i", "++", ")", "{", "copy", "[", "i", "]", "=", "range", "[", "i", "]", ";", "}", "return", "copy", ";", "}", "public", "void", "remove", "(", ")", "{", "if", "(", "this", ".", "fParent", "!=", "null", ")", "{", "this", ".", "fParent", ".", "fragment", "(", ")", ";", "}", "if", "(", "this", ".", "fNextNode", "!=", "null", ")", "{", "this", ".", "fNextNode", ".", "fPreviousNode", "=", "this", ".", "fPreviousNode", ";", "}", "if", "(", "this", ".", "fPreviousNode", "!=", "null", ")", "{", "this", ".", "fPreviousNode", ".", "fNextNode", "=", "this", ".", "fNextNode", ";", "}", "if", "(", "this", ".", "fParent", "!=", "null", ")", "{", "if", "(", "this", ".", "fParent", ".", "fFirstChild", "==", "this", ")", "{", "this", ".", "fParent", ".", "fFirstChild", "=", "this", ".", "fNextNode", ";", "}", "if", "(", "this", ".", "fParent", ".", "fLastChild", "==", "this", ")", "{", "this", ".", "fParent", ".", "fLastChild", "=", "this", ".", "fPreviousNode", ";", "}", "}", "this", ".", "fParent", "=", "null", ";", "this", ".", "fNextNode", "=", "null", ";", "this", ".", "fPreviousNode", "=", "null", ";", "}", "protected", "void", "setMask", "(", "int", "mask", ",", "boolean", "on", ")", "{", "if", "(", "on", ")", "{", "this", ".", "fStateMask", "|=", "mask", ";", "}", "else", "{", "this", ".", "fStateMask", "&=", "~", "mask", ";", "}", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "this", ".", "fName", "=", "name", ";", "setNameAltered", "(", "true", ")", ";", "fragment", "(", ")", ";", "}", "protected", "void", "setNameAltered", "(", "boolean", "altered", ")", "{", "setMask", "(", "MASK_NAME_ALTERED", ",", "altered", ")", ";", "}", "protected", "void", "setSourceRangeEnd", "(", "int", "end", ")", "{", "this", ".", "fSourceRange", "[", "1", "]", "=", "end", ";", "}", "protected", "void", "setStartPosition", "(", "int", "start", ")", "{", "this", ".", "fSourceRange", "[", "0", "]", "=", "start", ";", "}", "protected", "void", "shareContents", "(", "DOMNode", "node", ")", "{", "this", ".", "fDocument", "=", "node", ".", "fDocument", ";", "this", ".", "fIsFragmented", "=", "node", ".", "fIsFragmented", ";", "this", ".", "fName", "=", "node", ".", "fName", ";", "this", ".", "fNameRange", "=", "rangeCopy", "(", "node", ".", "fNameRange", ")", ";", "this", ".", "fSourceRange", "=", "rangeCopy", "(", "node", ".", "fSourceRange", ")", ";", "this", ".", "fStateMask", "=", "node", ".", "fStateMask", ";", "if", "(", "canHaveChildren", "(", ")", ")", "{", "Enumeration", "myChildren", "=", "getChildren", "(", ")", ";", "Enumeration", "otherChildren", "=", "node", ".", "getChildren", "(", ")", ";", "DOMNode", "myChild", ",", "otherChild", ";", "while", "(", "myChildren", ".", "hasMoreElements", "(", ")", ")", "{", "myChild", "=", "(", "DOMNode", ")", "myChildren", ".", "nextElement", "(", ")", ";", "otherChild", "=", "(", "DOMNode", ")", "otherChildren", ".", "nextElement", "(", ")", ";", "myChild", ".", "shareContents", "(", "otherChild", ")", ";", "}", "}", "}", "public", "abstract", "String", "toString", "(", ")", ";", "}", "</s>" ]
3,762
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "DOMMethod", "extends", "DOMMember", "implements", "IDOMMethod", "{", "protected", "String", "fReturnType", ";", "protected", "int", "[", "]", "fReturnTypeRange", ";", "protected", "char", "[", "]", "fParameterList", ";", "protected", "int", "[", "]", "fParameterRange", ";", "protected", "char", "[", "]", "fExceptionList", ";", "protected", "int", "[", "]", "fExceptionRange", ";", "protected", "String", "fBody", ";", "protected", "int", "[", "]", "fBodyRange", ";", "protected", "String", "[", "]", "fParameterNames", ";", "protected", "String", "[", "]", "fParameterTypes", ";", "protected", "String", "[", "]", "fExceptions", ";", "protected", "String", "[", "]", "fTypeParameters", "=", "CharOperation", ".", "NO_STRINGS", ";", "protected", "String", "fDefaultValue", "=", "null", ";", "DOMMethod", "(", ")", "{", "}", "DOMMethod", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ",", "int", "[", "]", "commentRange", ",", "int", "flags", ",", "int", "[", "]", "modifierRange", ",", "boolean", "isConstructor", ",", "String", "returnType", ",", "int", "[", "]", "returnTypeRange", ",", "String", "[", "]", "parameterTypes", ",", "String", "[", "]", "parameterNames", ",", "int", "[", "]", "parameterRange", ",", "String", "[", "]", "exceptions", ",", "int", "[", "]", "exceptionRange", ",", "int", "[", "]", "bodyRange", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ",", "commentRange", ",", "flags", ",", "modifierRange", ")", ";", "setMask", "(", "MASK_IS_CONSTRUCTOR", ",", "isConstructor", ")", ";", "this", ".", "fReturnType", "=", "returnType", ";", "this", ".", "fReturnTypeRange", "=", "returnTypeRange", ";", "this", ".", "fParameterTypes", "=", "parameterTypes", ";", "this", ".", "fParameterNames", "=", "parameterNames", ";", "this", ".", "fParameterRange", "=", "parameterRange", ";", "this", ".", "fExceptionRange", "=", "exceptionRange", ";", "this", ".", "fExceptions", "=", "exceptions", ";", "setHasBody", "(", "true", ")", ";", "this", ".", "fBodyRange", "=", "bodyRange", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "true", ")", ";", "}", "DOMMethod", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ",", "int", "flags", ",", "boolean", "isConstructor", ",", "String", "returnType", ",", "String", "[", "]", "parameterTypes", ",", "String", "[", "]", "parameterNames", ",", "String", "[", "]", "exceptions", ")", "{", "this", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "flags", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "isConstructor", ",", "returnType", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "parameterTypes", ",", "parameterNames", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "exceptions", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ")", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "false", ")", ";", "}", "public", "void", "addException", "(", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_nullExceptionType", ")", ";", "}", "if", "(", "this", ".", "fExceptions", "==", "null", ")", "{", "this", ".", "fExceptions", "=", "new", "String", "[", "1", "]", ";", "this", ".", "fExceptions", "[", "0", "]", "=", "name", ";", "}", "else", "{", "this", ".", "fExceptions", "=", "appendString", "(", "this", ".", "fExceptions", ",", "name", ")", ";", "}", "setExceptions", "(", "this", ".", "fExceptions", ")", ";", "}", "public", "void", "addParameter", "(", "String", "type", ",", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_nullTypeParameter", ")", ";", "}", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_nullNameParameter", ")", ";", "}", "if", "(", "this", ".", "fParameterNames", "==", "null", ")", "{", "this", ".", "fParameterNames", "=", "new", "String", "[", "1", "]", ";", "this", ".", "fParameterNames", "[", "0", "]", "=", "name", ";", "}", "else", "{", "this", ".", "fParameterNames", "=", "appendString", "(", "this", ".", "fParameterNames", ",", "name", ")", ";", "}", "if", "(", "this", ".", "fParameterTypes", "==", "null", ")", "{", "this", ".", "fParameterTypes", "=", "new", "String", "[", "1", "]", ";", "this", ".", "fParameterTypes", "[", "0", "]", "=", "type", ";", "}", "else", "{", "this", ".", "fParameterTypes", "=", "appendString", "(", "this", ".", "fParameterTypes", ",", "type", ")", ";", "}", "setParameters", "(", "this", ".", "fParameterTypes", ",", "this", ".", "fParameterNames", ")", ";", "}", "protected", "void", "appendMemberBodyContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "this", ".", "fBody", "!=", "null", ")", "{", "buffer", ".", "append", "(", "this", ".", "fBody", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fBodyRange", "[", "0", "]", ",", "this", ".", "fBodyRange", "[", "1", "]", "+", "1", "-", "this", ".", "fBodyRange", "[", "0", "]", ")", ";", "}", "}", "protected", "void", "appendMemberDeclarationContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "isConstructor", "(", ")", ")", "{", "buffer", ".", "append", "(", "getConstructorName", "(", ")", ")", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fParameterRange", "[", "0", "]", "-", "this", ".", "fNameRange", "[", "1", "]", "-", "1", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "getReturnTypeContents", "(", ")", ")", ";", "if", "(", "this", ".", "fReturnTypeRange", "[", "0", "]", ">=", "0", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fReturnTypeRange", "[", "1", "]", "+", "1", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fReturnTypeRange", "[", "1", "]", "-", "1", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "buffer", ".", "append", "(", "getNameContents", "(", ")", ")", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fParameterRange", "[", "0", "]", "-", "this", ".", "fNameRange", "[", "1", "]", "-", "1", ")", ";", "}", "if", "(", "this", ".", "fParameterList", "!=", "null", ")", "{", "buffer", ".", "append", "(", "this", ".", "fParameterList", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fParameterRange", "[", "0", "]", ",", "this", ".", "fParameterRange", "[", "1", "]", "+", "1", "-", "this", ".", "fParameterRange", "[", "0", "]", ")", ";", "}", "int", "start", ";", "if", "(", "hasTrailingArrayQualifier", "(", ")", "&&", "isReturnTypeAltered", "(", ")", ")", "{", "start", "=", "this", ".", "fReturnTypeRange", "[", "3", "]", "+", "1", ";", "}", "else", "{", "start", "=", "this", ".", "fParameterRange", "[", "1", "]", "+", "1", ";", "}", "if", "(", "this", ".", "fExceptions", "!=", "null", ")", "{", "if", "(", "this", ".", "fExceptionRange", "[", "0", "]", ">=", "0", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "start", ",", "this", ".", "fExceptionRange", "[", "0", "]", "-", "start", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "\"", "throws", "\"", ")", ";", "}", "if", "(", "this", ".", "fExceptionList", "!=", "null", ")", "{", "buffer", ".", "append", "(", "this", ".", "fExceptionList", ")", ";", "if", "(", "this", ".", "fExceptionRange", "[", "0", "]", ">=", "0", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fExceptionRange", "[", "1", "]", "+", "1", ",", "this", ".", "fBodyRange", "[", "0", "]", "-", "this", ".", "fExceptionRange", "[", "1", "]", "-", "1", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fParameterRange", "[", "1", "]", "+", "1", ",", "this", ".", "fBodyRange", "[", "0", "]", "-", "this", ".", "fParameterRange", "[", "1", "]", "-", "1", ")", ";", "}", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fExceptionRange", "[", "0", "]", ",", "this", ".", "fBodyRange", "[", "0", "]", "-", "this", ".", "fExceptionRange", "[", "0", "]", ")", ";", "}", "}", "else", "{", "if", "(", "this", ".", "fExceptionRange", "[", "0", "]", ">=", "0", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fExceptionRange", "[", "1", "]", "+", "1", ",", "this", ".", "fBodyRange", "[", "0", "]", "-", "this", ".", "fExceptionRange", "[", "1", "]", "-", "1", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "start", ",", "this", ".", "fBodyRange", "[", "0", "]", "-", "start", ")", ";", "}", "}", "}", "protected", "void", "appendSimpleContents", "(", "CharArrayBuffer", "buffer", ")", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSourceRange", "[", "0", "]", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fSourceRange", "[", "0", "]", ")", ";", "if", "(", "isConstructor", "(", ")", ")", "{", "buffer", ".", "append", "(", "getConstructorName", "(", ")", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fName", ")", ";", "}", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fNameRange", "[", "1", "]", ")", ";", "}", "public", "String", "getBody", "(", ")", "{", "becomeDetailed", "(", ")", ";", "if", "(", "hasBody", "(", ")", ")", "{", "if", "(", "this", ".", "fBody", "!=", "null", ")", "{", "return", "this", ".", "fBody", ";", "}", "else", "{", "return", "new", "String", "(", "this", ".", "fDocument", ",", "this", ".", "fBodyRange", "[", "0", "]", ",", "this", ".", "fBodyRange", "[", "1", "]", "+", "1", "-", "this", ".", "fBodyRange", "[", "0", "]", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "protected", "String", "getConstructorName", "(", ")", "{", "if", "(", "isConstructor", "(", ")", ")", "{", "if", "(", "getParent", "(", ")", "!=", "null", ")", "{", "return", "getParent", "(", ")", ".", "getName", "(", ")", ";", "}", "else", "{", "return", "new", "String", "(", "getNameContents", "(", ")", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "protected", "DOMNode", "getDetailedNode", "(", ")", "{", "return", "(", "DOMNode", ")", "getFactory", "(", ")", ".", "createMethod", "(", "getContents", "(", ")", ")", ";", "}", "public", "String", "[", "]", "getExceptions", "(", ")", "{", "return", "this", ".", "fExceptions", ";", "}", "protected", "char", "[", "]", "generateFlags", "(", ")", "{", "char", "[", "]", "flags", "=", "Flags", ".", "toString", "(", "getFlags", "(", ")", "&", "~", "Flags", ".", "AccVarargs", ")", ".", "toCharArray", "(", ")", ";", "if", "(", "flags", ".", "length", "==", "0", ")", "{", "return", "flags", ";", "}", "else", "{", "return", "CharOperation", ".", "concat", "(", "flags", ",", "new", "char", "[", "]", "{", "'", "'", "}", ")", ";", "}", "}", "public", "IJavaElement", "getJavaElement", "(", "IJavaElement", "parent", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "String", "[", "]", "sigs", "=", "null", ";", "if", "(", "this", ".", "fParameterTypes", "!=", "null", ")", "{", "sigs", "=", "new", "String", "[", "this", ".", "fParameterTypes", ".", "length", "]", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "fParameterTypes", ".", "length", ";", "i", "++", ")", "{", "sigs", "[", "i", "]", "=", "Signature", ".", "createTypeSignature", "(", "this", ".", "fParameterTypes", "[", "i", "]", ".", "toCharArray", "(", ")", ",", "false", ")", ";", "}", "}", "String", "name", "=", "null", ";", "if", "(", "isConstructor", "(", ")", ")", "{", "name", "=", "getConstructorName", "(", ")", ";", "}", "else", "{", "name", "=", "getName", "(", ")", ";", "}", "return", "(", "(", "IType", ")", "parent", ")", ".", "getMethod", "(", "name", ",", "sigs", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_illegalParent", ")", ";", "}", "}", "protected", "int", "getMemberDeclarationStartPosition", "(", ")", "{", "if", "(", "this", ".", "fReturnTypeRange", "[", "0", "]", ">=", "0", ")", "{", "return", "this", ".", "fReturnTypeRange", "[", "0", "]", ";", "}", "else", "{", "return", "this", ".", "fNameRange", "[", "0", "]", ";", "}", "}", "public", "String", "getName", "(", ")", "{", "if", "(", "isConstructor", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "super", ".", "getName", "(", ")", ";", "}", "}", "public", "int", "getNodeType", "(", ")", "{", "return", "IDOMNode", ".", "METHOD", ";", "}", "public", "String", "[", "]", "getParameterNames", "(", ")", "{", "return", "this", ".", "fParameterNames", ";", "}", "public", "String", "[", "]", "getParameterTypes", "(", ")", "{", "return", "this", ".", "fParameterTypes", ";", "}", "public", "String", "getReturnType", "(", ")", "{", "if", "(", "isConstructor", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "this", ".", "fReturnType", ";", "}", "}", "protected", "char", "[", "]", "getReturnTypeContents", "(", ")", "{", "if", "(", "isConstructor", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "if", "(", "isReturnTypeAltered", "(", ")", ")", "{", "return", "this", ".", "fReturnType", ".", "toCharArray", "(", ")", ";", "}", "else", "{", "return", "CharOperation", ".", "subarray", "(", "this", ".", "fDocument", ",", "this", ".", "fReturnTypeRange", "[", "0", "]", ",", "this", ".", "fReturnTypeRange", "[", "1", "]", "+", "1", ")", ";", "}", "}", "}", "protected", "boolean", "hasTrailingArrayQualifier", "(", ")", "{", "return", "this", ".", "fReturnTypeRange", ".", "length", ">", "2", ";", "}", "public", "boolean", "isConstructor", "(", ")", "{", "return", "getMask", "(", "MASK_IS_CONSTRUCTOR", ")", ";", "}", "protected", "boolean", "isReturnTypeAltered", "(", ")", "{", "return", "getMask", "(", "MASK_RETURN_TYPE_ALTERED", ")", ";", "}", "public", "boolean", "isSignatureEqual", "(", "IDOMNode", "node", ")", "{", "boolean", "ok", "=", "node", ".", "getNodeType", "(", ")", "==", "getNodeType", "(", ")", ";", "if", "(", "ok", ")", "{", "IDOMMethod", "method", "=", "(", "IDOMMethod", ")", "node", ";", "ok", "=", "(", "isConstructor", "(", ")", "&&", "method", ".", "isConstructor", "(", ")", ")", "||", "(", "!", "isConstructor", "(", ")", "&&", "!", "method", ".", "isConstructor", "(", ")", ")", ";", "if", "(", "ok", "&&", "!", "isConstructor", "(", ")", ")", "{", "ok", "=", "getName", "(", ")", ".", "equals", "(", "method", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "!", "ok", ")", "{", "return", "false", ";", "}", "String", "[", "]", "types", "=", "method", ".", "getParameterTypes", "(", ")", ";", "if", "(", "this", ".", "fParameterTypes", "==", "null", "||", "this", ".", "fParameterTypes", ".", "length", "==", "0", ")", "{", "if", "(", "types", "==", "null", "||", "types", ".", "length", "==", "0", ")", "{", "return", "true", ";", "}", "}", "else", "{", "if", "(", "types", "==", "null", "||", "types", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", "if", "(", "this", ".", "fParameterTypes", ".", "length", "!=", "types", ".", "length", ")", "{", "return", "false", ";", "}", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "this", ".", "fParameterTypes", "[", "i", "]", ".", "equals", "(", "types", "[", "i", "]", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "}", "return", "false", ";", "}", "protected", "DOMNode", "newDOMNode", "(", ")", "{", "return", "new", "DOMMethod", "(", ")", ";", "}", "protected", "void", "offset", "(", "int", "offset", ")", "{", "super", ".", "offset", "(", "offset", ")", ";", "offsetRange", "(", "this", ".", "fBodyRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fExceptionRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fParameterRange", ",", "offset", ")", ";", "offsetRange", "(", "this", ".", "fReturnTypeRange", ",", "offset", ")", ";", "}", "public", "void", "setBody", "(", "String", "body", ")", "{", "becomeDetailed", "(", ")", ";", "fragment", "(", ")", ";", "this", ".", "fBody", "=", "body", ";", "setHasBody", "(", "body", "!=", "null", ")", ";", "if", "(", "!", "hasBody", "(", ")", ")", "{", "this", ".", "fBody", "=", "\";\"", "+", "Util", ".", "getLineSeparator", "(", "body", ",", "null", ")", ";", "}", "}", "void", "setBodyRangeEnd", "(", "int", "end", ")", "{", "this", ".", "fBodyRange", "[", "1", "]", "=", "end", ";", "}", "public", "void", "setConstructor", "(", "boolean", "b", ")", "{", "becomeDetailed", "(", ")", ";", "setMask", "(", "MASK_IS_CONSTRUCTOR", ",", "b", ")", ";", "fragment", "(", ")", ";", "}", "public", "void", "setExceptions", "(", "String", "[", "]", "names", ")", "{", "becomeDetailed", "(", ")", ";", "if", "(", "names", "==", "null", "||", "names", ".", "length", "==", "0", ")", "{", "this", ".", "fExceptions", "=", "null", ";", "}", "else", "{", "this", ".", "fExceptions", "=", "names", ";", "CharArrayBuffer", "buffer", "=", "new", "CharArrayBuffer", "(", ")", ";", "char", "[", "]", "comma", "=", "new", "char", "[", "]", "{", "','", ",", "'", "'", "}", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "names", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "buffer", ".", "append", "(", "comma", ")", ";", "buffer", ".", "append", "(", "names", "[", "i", "]", ")", ";", "}", "this", ".", "fExceptionList", "=", "buffer", ".", "getContents", "(", ")", ";", "}", "fragment", "(", ")", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_nullName", ")", ";", "}", "else", "{", "super", ".", "setName", "(", "name", ")", ";", "}", "}", "public", "void", "setParameters", "(", "String", "[", "]", "types", ",", "String", "[", "]", "names", ")", "throws", "IllegalArgumentException", "{", "becomeDetailed", "(", ")", ";", "if", "(", "types", "==", "null", "||", "names", "==", "null", ")", "{", "if", "(", "types", "==", "null", "&&", "names", "==", "null", ")", "{", "this", ".", "fParameterTypes", "=", "null", ";", "this", ".", "fParameterNames", "=", "null", ";", "this", ".", "fParameterList", "=", "new", "char", "[", "]", "{", "'('", ",", "')'", "}", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_mismatchArgNamesAndTypes", ")", ";", "}", "}", "else", "if", "(", "names", ".", "length", "!=", "types", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_mismatchArgNamesAndTypes", ")", ";", "}", "else", "if", "(", "names", ".", "length", "==", "0", ")", "{", "setParameters", "(", "null", ",", "null", ")", ";", "}", "else", "{", "this", ".", "fParameterNames", "=", "names", ";", "this", ".", "fParameterTypes", "=", "types", ";", "CharArrayBuffer", "parametersBuffer", "=", "new", "CharArrayBuffer", "(", ")", ";", "parametersBuffer", ".", "append", "(", "\"(\"", ")", ";", "char", "[", "]", "comma", "=", "new", "char", "[", "]", "{", "','", ",", "'", "'", "}", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "names", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "parametersBuffer", ".", "append", "(", "comma", ")", ";", "}", "parametersBuffer", ".", "append", "(", "types", "[", "i", "]", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "names", "[", "i", "]", ")", ";", "}", "parametersBuffer", ".", "append", "(", "')'", ")", ";", "this", ".", "fParameterList", "=", "parametersBuffer", ".", "getContents", "(", ")", ";", "}", "fragment", "(", ")", ";", "}", "public", "void", "setReturnType", "(", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "dom_nullReturnType", ")", ";", "}", "becomeDetailed", "(", ")", ";", "fragment", "(", ")", ";", "setReturnTypeAltered", "(", "true", ")", ";", "this", ".", "fReturnType", "=", "name", ";", "}", "protected", "void", "setReturnTypeAltered", "(", "boolean", "typeAltered", ")", "{", "setMask", "(", "MASK_RETURN_TYPE_ALTERED", ",", "typeAltered", ")", ";", "}", "protected", "void", "setSourceRangeEnd", "(", "int", "end", ")", "{", "super", ".", "setSourceRangeEnd", "(", "end", ")", ";", "this", ".", "fBodyRange", "[", "1", "]", "=", "end", ";", "}", "protected", "void", "shareContents", "(", "DOMNode", "node", ")", "{", "super", ".", "shareContents", "(", "node", ")", ";", "DOMMethod", "method", "=", "(", "DOMMethod", ")", "node", ";", "this", ".", "fBody", "=", "method", ".", "fBody", ";", "this", ".", "fBodyRange", "=", "rangeCopy", "(", "method", ".", "fBodyRange", ")", ";", "this", ".", "fExceptionList", "=", "method", ".", "fExceptionList", ";", "this", ".", "fExceptionRange", "=", "rangeCopy", "(", "method", ".", "fExceptionRange", ")", ";", "this", ".", "fExceptions", "=", "method", ".", "fExceptions", ";", "this", ".", "fParameterList", "=", "method", ".", "fParameterList", ";", "this", ".", "fParameterNames", "=", "method", ".", "fParameterNames", ";", "this", ".", "fParameterRange", "=", "rangeCopy", "(", "method", ".", "fParameterRange", ")", ";", "this", ".", "fParameterTypes", "=", "method", ".", "fParameterTypes", ";", "this", ".", "fReturnType", "=", "method", ".", "fReturnType", ";", "this", ".", "fReturnTypeRange", "=", "rangeCopy", "(", "method", ".", "fReturnTypeRange", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "if", "(", "isConstructor", "(", ")", ")", "{", "return", "\"CONSTRUCTOR\"", ";", "}", "else", "{", "return", "\"METHOD:", "\"", "+", "getName", "(", ")", ";", "}", "}", "public", "void", "setDefault", "(", "String", "defaultValue", ")", "{", "this", ".", "fDefaultValue", "=", "defaultValue", ";", "}", "public", "String", "getDefault", "(", ")", "{", "return", "this", ".", "fDefaultValue", ";", "}", "public", "String", "[", "]", "getTypeParameters", "(", ")", "{", "return", "this", ".", "fTypeParameters", ";", "}", "public", "void", "setTypeParameters", "(", "String", "[", "]", "typeParameters", ")", "{", "this", ".", "fTypeParameters", "=", "typeParameters", ";", "}", "}", "</s>" ]
3,763
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "jdom", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "jdom", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "CharArrayBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "DOMImport", "extends", "DOMNode", "implements", "IDOMImport", "{", "protected", "boolean", "fOnDemand", ";", "protected", "int", "fFlags", "=", "Flags", ".", "AccDefault", ";", "DOMImport", "(", ")", "{", "this", ".", "fName", "=", "\"java.lang.*\"", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "true", ")", ";", "}", "DOMImport", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "int", "[", "]", "nameRange", ",", "boolean", "onDemand", ",", "int", "modifiers", ")", "{", "super", "(", "document", ",", "sourceRange", ",", "name", ",", "nameRange", ")", ";", "this", ".", "fOnDemand", "=", "onDemand", ";", "this", ".", "fFlags", "=", "modifiers", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "true", ")", ";", "}", "DOMImport", "(", "char", "[", "]", "document", ",", "int", "[", "]", "sourceRange", ",", "String", "name", ",", "boolean", "onDemand", ",", "int", "modifiers", ")", "{", "this", "(", "document", ",", "sourceRange", ",", "name", ",", "new", "int", "[", "]", "{", "-", "1", ",", "-", "1", "}", ",", "onDemand", ",", "modifiers", ")", ";", "this", ".", "fOnDemand", "=", "onDemand", ";", "setMask", "(", "MASK_DETAILED_SOURCE_INDEXES", ",", "false", ")", ";", "}", "protected", "void", "appendFragmentedContents", "(", "CharArrayBuffer", "buffer", ")", "{", "if", "(", "this", ".", "fNameRange", "[", "0", "]", "<", "0", ")", "{", "buffer", ".", "append", "(", "\"import", "\"", ")", ".", "append", "(", "this", ".", "fName", ")", ".", "append", "(", "';'", ")", ".", "append", "(", "Util", ".", "getLineSeparator", "(", "buffer", ".", "toString", "(", ")", ",", "null", ")", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fSourceRange", "[", "0", "]", ",", "this", ".", "fNameRange", "[", "0", "]", "-", "this", ".", "fSourceRange", "[", "0", "]", ")", ";", "buffer", ".", "append", "(", "this", ".", "fName", ")", ";", "buffer", ".", "append", "(", "this", ".", "fDocument", ",", "this", ".", "fNameRange", "[", "1", "]", "+", "1", ",", "this", ".", "fSourceRange", "[", "1", "]", "-", "this", ".", "fNameRange", "[", "1", "]", ")", ";", "}", "}", "public", "String", "getContents", "(", ")", "{", "if", "(", "this", ".", "fName", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "super", ".", "getContents", "(", ")", ";", "}", "}", "protected", "DOMNode", "getDetailedNode", "(", ")", "{", "return", "(", "DOMNode", ")", "getFactory", "(", ")", ".", "createImport", "(", "getContents", "(", ")", ")", ";", "}", "public", "IJavaElement", "getJavaElement", "(", "IJavaElement", "parent", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "COMPILATION_UNIT", ")", "{", "return", "(", "(", "ICompilationUnit", ")", "parent", ")", ".", "getImport", "(", "getName", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_illegalParent", ")", ";", "}", "}", "public", "int", "getNodeType", "(", ")", "{", "return", "IDOMNode", ".", "IMPORT", ";", "}", "public", "boolean", "isOnDemand", "(", ")", "{", "return", "this", ".", "fOnDemand", ";", "}", "protected", "DOMNode", "newDOMNode", "(", ")", "{", "return", "new", "DOMImport", "(", ")", ";", "}", "public", "void", "setName", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_nullName", ")", ";", "}", "becomeDetailed", "(", ")", ";", "super", ".", "setName", "(", "name", ")", ";", "this", ".", "fOnDemand", "=", "name", ".", "endsWith", "(", "\".*\"", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"IMPORT:", "\"", "+", "getName", "(", ")", ";", "}", "public", "int", "getFlags", "(", ")", "{", "return", "this", ".", "fFlags", ";", "}", "public", "void", "setFlags", "(", "int", "flags", ")", "{", "this", ".", "fFlags", "=", "flags", ";", "}", "}", "</s>" ]
3,764
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IBuffer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "WorkingCopyOwner", ";", "public", "class", "DefaultWorkingCopyOwner", "extends", "WorkingCopyOwner", "{", "public", "WorkingCopyOwner", "primaryBufferProvider", ";", "public", "static", "final", "DefaultWorkingCopyOwner", "PRIMARY", "=", "new", "DefaultWorkingCopyOwner", "(", ")", ";", "private", "DefaultWorkingCopyOwner", "(", ")", "{", "}", "public", "IBuffer", "createBuffer", "(", "ICompilationUnit", "workingCopy", ")", "{", "if", "(", "this", ".", "primaryBufferProvider", "!=", "null", ")", "return", "this", ".", "primaryBufferProvider", ".", "createBuffer", "(", "workingCopy", ")", ";", "return", "super", ".", "createBuffer", "(", "workingCopy", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", ";", "}", "}", "</s>" ]
3,765
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "public", "class", "TypeParameter", "extends", "SourceRefElement", "implements", "ITypeParameter", "{", "static", "final", "ITypeParameter", "[", "]", "NO_TYPE_PARAMETERS", "=", "new", "ITypeParameter", "[", "0", "]", ";", "protected", "String", "name", ";", "public", "TypeParameter", "(", "JavaElement", "parent", ",", "String", "name", ")", "{", "super", "(", "parent", ")", ";", "this", ".", "name", "=", "name", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "TypeParameter", ")", ")", "return", "false", ";", "return", "super", ".", "equals", "(", "o", ")", ";", "}", "public", "String", "[", "]", "getBounds", "(", ")", "throws", "JavaModelException", "{", "TypeParameterElementInfo", "info", "=", "(", "TypeParameterElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "CharOperation", ".", "toStrings", "(", "info", ".", "bounds", ")", ";", "}", "public", "String", "[", "]", "getBoundsSignatures", "(", ")", "throws", "JavaModelException", "{", "String", "[", "]", "boundSignatures", "=", "null", ";", "TypeParameterElementInfo", "info", "=", "(", "TypeParameterElementInfo", ")", "this", ".", "getElementInfo", "(", ")", ";", "if", "(", "this", ".", "parent", "instanceof", "BinaryMember", ")", "{", "char", "[", "]", "[", "]", "boundsSignatures", "=", "info", ".", "boundsSignatures", ";", "if", "(", "boundsSignatures", "==", "null", "||", "boundsSignatures", ".", "length", "==", "0", ")", "{", "return", "CharOperation", ".", "NO_STRINGS", ";", "}", "return", "CharOperation", ".", "toStrings", "(", "info", ".", "boundsSignatures", ")", ";", "}", "char", "[", "]", "[", "]", "bounds", "=", "info", ".", "bounds", ";", "if", "(", "bounds", "==", "null", "||", "bounds", ".", "length", "==", "0", ")", "{", "return", "CharOperation", ".", "NO_STRINGS", ";", "}", "int", "boundsLength", "=", "bounds", ".", "length", ";", "boundSignatures", "=", "new", "String", "[", "boundsLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "boundsLength", ";", "i", "++", ")", "{", "boundSignatures", "[", "i", "]", "=", "new", "String", "(", "Signature", ".", "createCharArrayTypeSignature", "(", "bounds", "[", "i", "]", ",", "false", ")", ")", ";", "}", "return", "boundSignatures", ";", "}", "public", "IMember", "getDeclaringMember", "(", ")", "{", "return", "(", "IMember", ")", "getParent", "(", ")", ";", "}", "public", "String", "getElementName", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "TYPE_PARAMETER", ";", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JavaElement", ".", "JEM_TYPE_PARAMETER", ";", "}", "public", "ISourceRange", "getNameRange", "(", ")", "throws", "JavaModelException", "{", "SourceMapper", "mapper", "=", "getSourceMapper", "(", ")", ";", "if", "(", "mapper", "!=", "null", ")", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "getClassFile", "(", ")", ";", "if", "(", "classFile", "!=", "null", ")", "{", "classFile", ".", "getBuffer", "(", ")", ";", "return", "mapper", ".", "getNameRange", "(", "this", ")", ";", "}", "}", "TypeParameterElementInfo", "info", "=", "(", "TypeParameterElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "new", "SourceRange", "(", "info", ".", "nameStart", ",", "info", ".", "nameEnd", "-", "info", ".", "nameStart", "+", "1", ")", ";", "}", "public", "ISourceRange", "getSourceRange", "(", ")", "throws", "JavaModelException", "{", "SourceMapper", "mapper", "=", "getSourceMapper", "(", ")", ";", "if", "(", "mapper", "!=", "null", ")", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "getClassFile", "(", ")", ";", "if", "(", "classFile", "!=", "null", ")", "{", "classFile", ".", "getBuffer", "(", ")", ";", "return", "mapper", ".", "getSourceRange", "(", "this", ")", ";", "}", "}", "return", "super", ".", "getSourceRange", "(", ")", ";", "}", "public", "IClassFile", "getClassFile", "(", ")", "{", "return", "(", "(", "JavaElement", ")", "getParent", "(", ")", ")", ".", "getClassFile", "(", ")", ";", "}", "public", "ITypeRoot", "getTypeRoot", "(", ")", "{", "return", "this", ".", "getDeclaringMember", "(", ")", ".", "getTypeRoot", "(", ")", ";", "}", "protected", "void", "toStringName", "(", "StringBuffer", "buffer", ")", "{", "buffer", ".", "append", "(", "'<'", ")", ";", "buffer", ".", "append", "(", "getElementName", "(", ")", ")", ";", "buffer", ".", "append", "(", "'>'", ")", ";", "}", "}", "</s>" ]
3,766
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IField", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IInitializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "public", "interface", "IJavaElementRequestor", "{", "public", "void", "acceptField", "(", "IField", "field", ")", ";", "public", "void", "acceptInitializer", "(", "IInitializer", "initializer", ")", ";", "public", "void", "acceptMemberType", "(", "IType", "type", ")", ";", "public", "void", "acceptMethod", "(", "IMethod", "method", ")", ";", "public", "void", "acceptPackageFragment", "(", "IPackageFragment", "packageFragment", ")", ";", "public", "void", "acceptType", "(", "IType", "type", ")", ";", "boolean", "isCanceled", "(", ")", ";", "}", "</s>" ]
3,767
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "OperationCanceledException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CategorizedProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "AbortCompilation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "problem", ".", "DefaultProblemFactory", ";", "public", "class", "CancelableProblemFactory", "extends", "DefaultProblemFactory", "{", "public", "IProgressMonitor", "monitor", ";", "public", "CancelableProblemFactory", "(", "IProgressMonitor", "monitor", ")", "{", "super", "(", ")", ";", "this", ".", "monitor", "=", "monitor", ";", "}", "public", "CategorizedProblem", "createProblem", "(", "char", "[", "]", "originatingFileName", ",", "int", "problemId", ",", "String", "[", "]", "problemArguments", ",", "String", "[", "]", "messageArguments", ",", "int", "severity", ",", "int", "startPosition", ",", "int", "endPosition", ",", "int", "lineNumber", ",", "int", "columnNumber", ")", "{", "if", "(", "this", ".", "monitor", "!=", "null", "&&", "this", ".", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "AbortCompilation", "(", "true", ",", "new", "OperationCanceledException", "(", ")", ")", ";", "return", "super", ".", "createProblem", "(", "originatingFileName", ",", "problemId", ",", "problemArguments", ",", "messageArguments", ",", "severity", ",", "startPosition", ",", "endPosition", ",", "lineNumber", ",", "columnNumber", ")", ";", "}", "public", "CategorizedProblem", "createProblem", "(", "char", "[", "]", "originatingFileName", ",", "int", "problemId", ",", "String", "[", "]", "problemArguments", ",", "int", "elaborationId", ",", "String", "[", "]", "messageArguments", ",", "int", "severity", ",", "int", "startPosition", ",", "int", "endPosition", ",", "int", "lineNumber", ",", "int", "columnNumber", ")", "{", "if", "(", "this", ".", "monitor", "!=", "null", "&&", "this", ".", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "AbortCompilation", "(", "true", ",", "new", "OperationCanceledException", "(", ")", ")", ";", "return", "super", ".", "createProblem", "(", "originatingFileName", ",", "problemId", ",", "problemArguments", ",", "elaborationId", ",", "messageArguments", ",", "severity", ",", "startPosition", ",", "endPosition", ",", "lineNumber", ",", "columnNumber", ")", ";", "}", "}", "</s>" ]
3,768
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "abstract", "class", "MemberElementInfo", "extends", "SourceRefElementInfo", "{", "protected", "int", "flags", ";", "public", "int", "getNameSourceEnd", "(", ")", "{", "return", "-", "1", ";", "}", "public", "int", "getNameSourceStart", "(", ")", "{", "return", "-", "1", ";", "}", "public", "int", "getModifiers", "(", ")", "{", "return", "this", ".", "flags", ";", "}", "protected", "void", "setFlags", "(", "int", "flags", ")", "{", "this", ".", "flags", "=", "flags", ";", "}", "}", "</s>" ]
3,769
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "*", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipEntry", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipException", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HashtableOfArrayToObject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "JarPackageFragmentRoot", "extends", "PackageFragmentRoot", "{", "private", "final", "static", "ArrayList", "EMPTY_LIST", "=", "new", "ArrayList", "(", ")", ";", "protected", "final", "IPath", "jarPath", ";", "protected", "JarPackageFragmentRoot", "(", "IPath", "externalJarPath", ",", "JavaProject", "project", ")", "{", "super", "(", "null", ",", "project", ")", ";", "this", ".", "jarPath", "=", "externalJarPath", ";", "}", "protected", "JarPackageFragmentRoot", "(", "IResource", "resource", ",", "JavaProject", "project", ")", "{", "super", "(", "resource", ",", "project", ")", ";", "this", ".", "jarPath", "=", "resource", ".", "getFullPath", "(", ")", ";", "}", "protected", "boolean", "computeChildren", "(", "OpenableElementInfo", "info", ",", "IResource", "underlyingResource", ")", "throws", "JavaModelException", "{", "HashtableOfArrayToObject", "rawPackageInfo", "=", "new", "HashtableOfArrayToObject", "(", ")", ";", "IJavaElement", "[", "]", "children", ";", "ZipFile", "jar", "=", "null", ";", "try", "{", "IJavaProject", "project", "=", "getJavaProject", "(", ")", ";", "String", "sourceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "String", "compliance", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "jar", "=", "getJar", "(", ")", ";", "rawPackageInfo", ".", "put", "(", "CharOperation", ".", "NO_STRINGS", ",", "new", "ArrayList", "[", "]", "{", "EMPTY_LIST", ",", "EMPTY_LIST", "}", ")", ";", "for", "(", "Enumeration", "e", "=", "jar", ".", "entries", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "ZipEntry", "member", "=", "(", "ZipEntry", ")", "e", ".", "nextElement", "(", ")", ";", "initRawPackageInfo", "(", "rawPackageInfo", ",", "member", ".", "getName", "(", ")", ",", "member", ".", "isDirectory", "(", ")", ",", "sourceLevel", ",", "compliance", ")", ";", "}", "children", "=", "new", "IJavaElement", "[", "rawPackageInfo", ".", "size", "(", ")", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "rawPackageInfo", ".", "keyTable", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "[", "]", "pkgName", "=", "(", "String", "[", "]", ")", "rawPackageInfo", ".", "keyTable", "[", "i", "]", ";", "if", "(", "pkgName", "==", "null", ")", "continue", ";", "children", "[", "index", "++", "]", "=", "getPackageFragment", "(", "pkgName", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "e", ".", "getCause", "(", ")", "instanceof", "ZipException", ")", "{", "Util", ".", "log", "(", "IStatus", ".", "ERROR", ",", "\"\"", "+", "toStringWithAncestors", "(", ")", ")", ";", "children", "=", "NO_ELEMENTS", ";", "}", "else", "if", "(", "e", "instanceof", "JavaModelException", ")", "{", "throw", "(", "JavaModelException", ")", "e", ";", "}", "else", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "finally", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "closeZipFile", "(", "jar", ")", ";", "}", "info", ".", "setChildren", "(", "children", ")", ";", "(", "(", "JarPackageFragmentRootInfo", ")", "info", ")", ".", "rawPackageInfo", "=", "rawPackageInfo", ";", "return", "true", ";", "}", "protected", "Object", "createElementInfo", "(", ")", "{", "return", "new", "JarPackageFragmentRootInfo", "(", ")", ";", "}", "protected", "int", "determineKind", "(", "IResource", "underlyingResource", ")", "{", "return", "IPackageFragmentRoot", ".", "K_BINARY", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "this", "==", "o", ")", "return", "true", ";", "if", "(", "o", "instanceof", "JarPackageFragmentRoot", ")", "{", "JarPackageFragmentRoot", "other", "=", "(", "JarPackageFragmentRoot", ")", "o", ";", "return", "this", ".", "jarPath", ".", "equals", "(", "other", ".", "jarPath", ")", ";", "}", "return", "false", ";", "}", "public", "String", "getElementName", "(", ")", "{", "return", "this", ".", "jarPath", ".", "lastSegment", "(", ")", ";", "}", "public", "ZipFile", "getJar", "(", ")", "throws", "CoreException", "{", "return", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getZipFile", "(", "getPath", "(", ")", ")", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "IPackageFragmentRoot", ".", "K_BINARY", ";", "}", "int", "internalKind", "(", ")", "throws", "JavaModelException", "{", "return", "IPackageFragmentRoot", ".", "K_BINARY", ";", "}", "public", "Object", "[", "]", "getNonJavaResources", "(", ")", "throws", "JavaModelException", "{", "Object", "[", "]", "defaultPkgResources", "=", "(", "(", "JarPackageFragment", ")", "getPackageFragment", "(", "CharOperation", ".", "NO_STRINGS", ")", ")", ".", "storedNonJavaResources", "(", ")", ";", "int", "length", "=", "defaultPkgResources", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "defaultPkgResources", ";", "Object", "[", "]", "nonJavaResources", "=", "new", "Object", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JarEntryResource", "nonJavaResource", "=", "(", "JarEntryResource", ")", "defaultPkgResources", "[", "i", "]", ";", "nonJavaResources", "[", "i", "]", "=", "nonJavaResource", ".", "clone", "(", "this", ")", ";", "}", "return", "nonJavaResources", ";", "}", "public", "PackageFragment", "getPackageFragment", "(", "String", "[", "]", "pkgName", ")", "{", "return", "new", "JarPackageFragment", "(", "this", ",", "pkgName", ")", ";", "}", "public", "IPath", "internalPath", "(", ")", "{", "if", "(", "isExternal", "(", ")", ")", "{", "return", "this", ".", "jarPath", ";", "}", "else", "{", "return", "super", ".", "internalPath", "(", ")", ";", "}", "}", "public", "IResource", "resource", "(", "PackageFragmentRoot", "root", ")", "{", "if", "(", "this", ".", "resource", "==", "null", ")", "{", "return", "null", ";", "}", "return", "super", ".", "resource", "(", "root", ")", ";", "}", "public", "IResource", "getUnderlyingResource", "(", ")", "throws", "JavaModelException", "{", "if", "(", "isExternal", "(", ")", ")", "{", "if", "(", "!", "exists", "(", ")", ")", "throw", "newNotPresentException", "(", ")", ";", "return", "null", ";", "}", "else", "{", "return", "super", ".", "getUnderlyingResource", "(", ")", ";", "}", "}", "public", "int", "hashCode", "(", ")", "{", "return", "this", ".", "jarPath", ".", "hashCode", "(", ")", ";", "}", "private", "void", "initRawPackageInfo", "(", "HashtableOfArrayToObject", "rawPackageInfo", ",", "String", "entryName", ",", "boolean", "isDirectory", ",", "String", "sourceLevel", ",", "String", "compliance", ")", "{", "int", "lastSeparator", "=", "isDirectory", "?", "entryName", ".", "length", "(", ")", "-", "1", ":", "entryName", ".", "lastIndexOf", "(", "'/'", ")", ";", "String", "[", "]", "pkgName", "=", "Util", ".", "splitOn", "(", "'/'", ",", "entryName", ",", "0", ",", "lastSeparator", ")", ";", "String", "[", "]", "existing", "=", "null", ";", "int", "length", "=", "pkgName", ".", "length", ";", "int", "existingLength", "=", "length", ";", "while", "(", "existingLength", ">=", "0", ")", "{", "existing", "=", "(", "String", "[", "]", ")", "rawPackageInfo", ".", "getKey", "(", "pkgName", ",", "existingLength", ")", ";", "if", "(", "existing", "!=", "null", ")", "break", ";", "existingLength", "--", ";", "}", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "for", "(", "int", "i", "=", "existingLength", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "Util", ".", "isValidFolderNameForPackage", "(", "pkgName", "[", "i", "]", ",", "sourceLevel", ",", "compliance", ")", ")", "{", "System", ".", "arraycopy", "(", "existing", ",", "0", ",", "existing", "=", "new", "String", "[", "i", "+", "1", "]", ",", "0", ",", "i", ")", ";", "existing", "[", "i", "]", "=", "manager", ".", "intern", "(", "pkgName", "[", "i", "]", ")", ";", "rawPackageInfo", ".", "put", "(", "existing", ",", "new", "ArrayList", "[", "]", "{", "EMPTY_LIST", ",", "EMPTY_LIST", "}", ")", ";", "}", "else", "{", "if", "(", "!", "isDirectory", ")", "{", "ArrayList", "[", "]", "children", "=", "(", "ArrayList", "[", "]", ")", "rawPackageInfo", ".", "get", "(", "existing", ")", ";", "if", "(", "children", "[", "1", "]", "==", "EMPTY_LIST", ")", "children", "[", "1", "]", "=", "new", "ArrayList", "(", ")", ";", "children", "[", "1", "]", ".", "add", "(", "entryName", ")", ";", "}", "return", ";", "}", "}", "if", "(", "isDirectory", ")", "return", ";", "ArrayList", "[", "]", "children", "=", "(", "ArrayList", "[", "]", ")", "rawPackageInfo", ".", "get", "(", "pkgName", ")", ";", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "entryName", ")", ")", "{", "if", "(", "children", "[", "0", "]", "==", "EMPTY_LIST", ")", "children", "[", "0", "]", "=", "new", "ArrayList", "(", ")", ";", "String", "nameWithoutExtension", "=", "entryName", ".", "substring", "(", "lastSeparator", "+", "1", ",", "entryName", ".", "length", "(", ")", "-", "6", ")", ";", "children", "[", "0", "]", ".", "add", "(", "nameWithoutExtension", ")", ";", "}", "else", "{", "if", "(", "children", "[", "1", "]", "==", "EMPTY_LIST", ")", "children", "[", "1", "]", "=", "new", "ArrayList", "(", ")", ";", "children", "[", "1", "]", ".", "add", "(", "entryName", ")", ";", "}", "}", "public", "boolean", "isArchive", "(", ")", "{", "return", "true", ";", "}", "public", "boolean", "isExternal", "(", ")", "{", "return", "resource", "(", ")", "==", "null", ";", "}", "public", "boolean", "isReadOnly", "(", ")", "{", "return", "true", ";", "}", "protected", "boolean", "resourceExists", "(", "IResource", "underlyingResource", ")", "{", "if", "(", "underlyingResource", "==", "null", ")", "{", "return", "JavaModel", ".", "getExternalTarget", "(", "getPath", "(", ")", ",", "true", ")", "!=", "null", ";", "}", "else", "{", "return", "super", ".", "resourceExists", "(", "underlyingResource", ")", ";", "}", "}", "protected", "void", "toStringAncestors", "(", "StringBuffer", "buffer", ")", "{", "if", "(", "isExternal", "(", ")", ")", "return", ";", "super", ".", "toStringAncestors", "(", "buffer", ")", ";", "}", "}", "</s>" ]
3,770
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "public", "interface", "IPathRequestor", "{", "void", "acceptPath", "(", "String", "path", ",", "boolean", "containsLocalTypes", ")", ";", "}", "</s>" ]
3,771
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IField", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IInitializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "public", "class", "JavaElementRequestor", "implements", "IJavaElementRequestor", "{", "protected", "boolean", "canceled", "=", "false", ";", "protected", "ArrayList", "fields", "=", "null", ";", "protected", "ArrayList", "initializers", "=", "null", ";", "protected", "ArrayList", "memberTypes", "=", "null", ";", "protected", "ArrayList", "methods", "=", "null", ";", "protected", "ArrayList", "packageFragments", "=", "null", ";", "protected", "ArrayList", "types", "=", "null", ";", "protected", "static", "final", "IField", "[", "]", "EMPTY_FIELD_ARRAY", "=", "new", "IField", "[", "0", "]", ";", "protected", "static", "final", "IInitializer", "[", "]", "EMPTY_INITIALIZER_ARRAY", "=", "new", "IInitializer", "[", "0", "]", ";", "protected", "static", "final", "IType", "[", "]", "EMPTY_TYPE_ARRAY", "=", "new", "IType", "[", "0", "]", ";", "protected", "static", "final", "IPackageFragment", "[", "]", "EMPTY_PACKAGE_FRAGMENT_ARRAY", "=", "new", "IPackageFragment", "[", "0", "]", ";", "protected", "static", "final", "IMethod", "[", "]", "EMPTY_METHOD_ARRAY", "=", "new", "IMethod", "[", "0", "]", ";", "public", "void", "acceptField", "(", "IField", "field", ")", "{", "if", "(", "this", ".", "fields", "==", "null", ")", "{", "this", ".", "fields", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "fields", ".", "add", "(", "field", ")", ";", "}", "public", "void", "acceptInitializer", "(", "IInitializer", "initializer", ")", "{", "if", "(", "this", ".", "initializers", "==", "null", ")", "{", "this", ".", "initializers", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "initializers", ".", "add", "(", "initializer", ")", ";", "}", "public", "void", "acceptMemberType", "(", "IType", "type", ")", "{", "if", "(", "this", ".", "memberTypes", "==", "null", ")", "{", "this", ".", "memberTypes", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "memberTypes", ".", "add", "(", "type", ")", ";", "}", "public", "void", "acceptMethod", "(", "IMethod", "method", ")", "{", "if", "(", "this", ".", "methods", "==", "null", ")", "{", "this", ".", "methods", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "methods", ".", "add", "(", "method", ")", ";", "}", "public", "void", "acceptPackageFragment", "(", "IPackageFragment", "packageFragment", ")", "{", "if", "(", "this", ".", "packageFragments", "==", "null", ")", "{", "this", ".", "packageFragments", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "packageFragments", ".", "add", "(", "packageFragment", ")", ";", "}", "public", "void", "acceptType", "(", "IType", "type", ")", "{", "if", "(", "this", ".", "types", "==", "null", ")", "{", "this", ".", "types", "=", "new", "ArrayList", "(", ")", ";", "}", "this", ".", "types", ".", "add", "(", "type", ")", ";", "}", "public", "IField", "[", "]", "getFields", "(", ")", "{", "if", "(", "this", ".", "fields", "==", "null", ")", "{", "return", "EMPTY_FIELD_ARRAY", ";", "}", "int", "size", "=", "this", ".", "fields", ".", "size", "(", ")", ";", "IField", "[", "]", "results", "=", "new", "IField", "[", "size", "]", ";", "this", ".", "fields", ".", "toArray", "(", "results", ")", ";", "return", "results", ";", "}", "public", "IInitializer", "[", "]", "getInitializers", "(", ")", "{", "if", "(", "this", ".", "initializers", "==", "null", ")", "{", "return", "EMPTY_INITIALIZER_ARRAY", ";", "}", "int", "size", "=", "this", ".", "initializers", ".", "size", "(", ")", ";", "IInitializer", "[", "]", "results", "=", "new", "IInitializer", "[", "size", "]", ";", "this", ".", "initializers", ".", "toArray", "(", "results", ")", ";", "return", "results", ";", "}", "public", "IType", "[", "]", "getMemberTypes", "(", ")", "{", "if", "(", "this", ".", "memberTypes", "==", "null", ")", "{", "return", "EMPTY_TYPE_ARRAY", ";", "}", "int", "size", "=", "this", ".", "memberTypes", ".", "size", "(", ")", ";", "IType", "[", "]", "results", "=", "new", "IType", "[", "size", "]", ";", "this", ".", "memberTypes", ".", "toArray", "(", "results", ")", ";", "return", "results", ";", "}", "public", "IMethod", "[", "]", "getMethods", "(", ")", "{", "if", "(", "this", ".", "methods", "==", "null", ")", "{", "return", "EMPTY_METHOD_ARRAY", ";", "}", "int", "size", "=", "this", ".", "methods", ".", "size", "(", ")", ";", "IMethod", "[", "]", "results", "=", "new", "IMethod", "[", "size", "]", ";", "this", ".", "methods", ".", "toArray", "(", "results", ")", ";", "return", "results", ";", "}", "public", "IPackageFragment", "[", "]", "getPackageFragments", "(", ")", "{", "if", "(", "this", ".", "packageFragments", "==", "null", ")", "{", "return", "EMPTY_PACKAGE_FRAGMENT_ARRAY", ";", "}", "int", "size", "=", "this", ".", "packageFragments", ".", "size", "(", ")", ";", "IPackageFragment", "[", "]", "results", "=", "new", "IPackageFragment", "[", "size", "]", ";", "this", ".", "packageFragments", ".", "toArray", "(", "results", ")", ";", "return", "results", ";", "}", "public", "IType", "[", "]", "getTypes", "(", ")", "{", "if", "(", "this", ".", "types", "==", "null", ")", "{", "return", "EMPTY_TYPE_ARRAY", ";", "}", "int", "size", "=", "this", ".", "types", ".", "size", "(", ")", ";", "IType", "[", "]", "results", "=", "new", "IType", "[", "size", "]", ";", "this", ".", "types", ".", "toArray", "(", "results", ")", ";", "return", "results", ";", "}", "public", "boolean", "isCanceled", "(", ")", "{", "return", "this", ".", "canceled", ";", "}", "public", "void", "reset", "(", ")", "{", "this", ".", "canceled", "=", "false", ";", "this", ".", "fields", "=", "null", ";", "this", ".", "initializers", "=", "null", ";", "this", ".", "memberTypes", "=", "null", ";", "this", ".", "methods", "=", "null", ";", "this", ".", "packageFragments", "=", "null", ";", "this", ".", "types", "=", "null", ";", "}", "public", "void", "setCanceled", "(", "boolean", "b", ")", "{", "this", ".", "canceled", "=", "b", ";", "}", "}", "</s>" ]
3,772
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "public", "interface", "JavadocConstants", "{", "String", "ANCHOR_PREFIX_END", "=", "\"\\\"\"", ";", "char", "[", "]", "ANCHOR_PREFIX_START", "=", "\"<A", "NAME=\\\"\"", ".", "toCharArray", "(", ")", ";", "int", "ANCHOR_PREFIX_START_LENGHT", "=", "ANCHOR_PREFIX_START", ".", "length", ";", "char", "[", "]", "ANCHOR_SUFFIX", "=", "\"</A>\"", ".", "toCharArray", "(", ")", ";", "int", "ANCHOR_SUFFIX_LENGTH", "=", "JavadocConstants", ".", "ANCHOR_SUFFIX", ".", "length", ";", "char", "[", "]", "CONSTRUCTOR_DETAIL", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "CONSTRUCTOR_SUMMARY", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "FIELD_DETAIL", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "FIELD_SUMMARY", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "ENUM_CONSTANT_SUMMARY", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "END_OF_CLASS_DATA", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "String", "HTML_EXTENSION", "=", "\".html\"", ";", "String", "INDEX_FILE_NAME", "=", "\"index.html\"", ";", "char", "[", "]", "METHOD_DETAIL", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "METHOD_SUMMARY", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "NESTED_CLASS_SUMMARY", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "String", "PACKAGE_FILE_NAME", "=", "\"\"", ";", "char", "[", "]", "SEPARATOR_START", "=", "\"<!--", "=\"", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "START_OF_CLASS_DATA", "=", "\"\"", ".", "toCharArray", "(", ")", ";", "int", "START_OF_CLASS_DATA_LENGTH", "=", "JavadocConstants", ".", "START_OF_CLASS_DATA", ".", "length", ";", "}", "</s>" ]
3,773
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathAttribute", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "ClasspathAttribute", "implements", "IClasspathAttribute", "{", "private", "String", "name", ";", "private", "String", "value", ";", "public", "ClasspathAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "value", "=", "value", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "!", "(", "obj", "instanceof", "ClasspathAttribute", ")", ")", "return", "false", ";", "ClasspathAttribute", "other", "=", "(", "ClasspathAttribute", ")", "obj", ";", "return", "this", ".", "name", ".", "equals", "(", "other", ".", "name", ")", "&&", "this", ".", "value", ".", "equals", "(", "other", ".", "value", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "String", "getValue", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "Util", ".", "combineHashCodes", "(", "this", ".", "name", ".", "hashCode", "(", ")", ",", "this", ".", "value", ".", "hashCode", "(", ")", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "this", ".", "name", "+", "\"=\"", "+", "this", ".", "value", ";", "}", "}", "</s>" ]
3,774
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "*", ";", "import", "java", ".", "net", ".", "URI", ";", "import", "java", ".", "text", ".", "MessageFormat", ";", "import", "java", ".", "util", ".", "*", ";", "import", "java", ".", "util", ".", "Map", ".", "Entry", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipException", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilder", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "DocumentBuilderFactory", ";", "import", "javax", ".", "xml", ".", "parsers", ".", "ParserConfigurationException", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "content", ".", "IContentTypeManager", ".", "ContentTypeChangeEvent", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "content", ".", "IContentTypeManager", ".", "IContentTypeChangeListener", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "Job", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "DefaultScope", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "IEclipsePreferences", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "IPreferencesService", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "InstanceScope", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "preferences", ".", "IEclipsePreferences", ".", "PreferenceChangeEvent", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CompilationParticipant", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "IProblem", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "formatter", ".", "DefaultCodeFormatterConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "CompletionEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "SelectionEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "AbstractAnnotationProcessorManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "Compiler", ";", "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", ".", "compiler", ".", "util", ".", "HashtableOfObjectToInt", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaProjectElementInfo", ".", "ProjectCache", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "JavaBuilder", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ".", "TypeHierarchy", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "AbstractSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "BasicSearchEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "IRestrictedAccessTypeRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaWorkspaceScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IndexManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "processing", ".", "JobManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HashtableOfArrayToObject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "LRUCache", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "WeakHashSet", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "WeakHashSetOfCharArray", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "LRUCache", ".", "Stats", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "formatter", ".", "DefaultCodeFormatter", ";", "import", "org", ".", "osgi", ".", "service", ".", "prefs", ".", "BackingStoreException", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Element", ";", "import", "org", ".", "w3c", ".", "dom", ".", "Node", ";", "import", "org", ".", "w3c", ".", "dom", ".", "NodeList", ";", "import", "org", ".", "xml", ".", "sax", ".", "InputSource", ";", "import", "org", ".", "xml", ".", "sax", ".", "SAXException", ";", "public", "class", "JavaModelManager", "implements", "ISaveParticipant", ",", "IContentTypeChangeListener", "{", "private", "static", "final", "String", "NON_CHAINING_JARS_CACHE", "=", "\"\"", ";", "private", "static", "final", "String", "INVALID_ARCHIVES_CACHE", "=", "\"\"", ";", "static", "class", "ZipCache", "{", "private", "Map", "map", ";", "Object", "owner", ";", "ZipCache", "(", "Object", "owner", ")", "{", "this", ".", "map", "=", "new", "HashMap", "(", ")", ";", "this", ".", "owner", "=", "owner", ";", "}", "public", "void", "flush", "(", ")", "{", "Thread", "currentThread", "=", "Thread", ".", "currentThread", "(", ")", ";", "Iterator", "iterator", "=", "this", ".", "map", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "try", "{", "ZipFile", "zipFile", "=", "(", "ZipFile", ")", "iterator", ".", "next", "(", ")", ";", "if", "(", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "currentThread", "+", "\"\"", "+", "zipFile", ".", "getName", "(", ")", ")", ";", "}", "zipFile", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "public", "ZipFile", "getCache", "(", "IPath", "path", ")", "{", "return", "(", "ZipFile", ")", "this", ".", "map", ".", "get", "(", "path", ")", ";", "}", "public", "void", "setCache", "(", "IPath", "path", ",", "ZipFile", "zipFile", ")", "{", "this", ".", "map", ".", "put", "(", "path", ",", "zipFile", ")", ";", "}", "}", "final", "JavaModel", "javaModel", "=", "new", "JavaModel", "(", ")", ";", "public", "HashMap", "variables", "=", "new", "HashMap", "(", "5", ")", ";", "public", "HashSet", "variablesWithInitializer", "=", "new", "HashSet", "(", "5", ")", ";", "public", "HashMap", "deprecatedVariables", "=", "new", "HashMap", "(", "5", ")", ";", "public", "HashSet", "readOnlyVariables", "=", "new", "HashSet", "(", "5", ")", ";", "public", "HashMap", "previousSessionVariables", "=", "new", "HashMap", "(", "5", ")", ";", "private", "ThreadLocal", "variableInitializationInProgress", "=", "new", "ThreadLocal", "(", ")", ";", "public", "HashMap", "containers", "=", "new", "HashMap", "(", "5", ")", ";", "public", "HashMap", "previousSessionContainers", "=", "new", "HashMap", "(", "5", ")", ";", "private", "ThreadLocal", "containerInitializationInProgress", "=", "new", "ThreadLocal", "(", ")", ";", "ThreadLocal", "containersBeingInitialized", "=", "new", "ThreadLocal", "(", ")", ";", "public", "static", "final", "int", "NO_BATCH_INITIALIZATION", "=", "0", ";", "public", "static", "final", "int", "NEED_BATCH_INITIALIZATION", "=", "1", ";", "public", "static", "final", "int", "BATCH_INITIALIZATION_IN_PROGRESS", "=", "2", ";", "public", "static", "final", "int", "BATCH_INITIALIZATION_FINISHED", "=", "3", ";", "public", "int", "batchContainerInitializations", "=", "NO_BATCH_INITIALIZATION", ";", "public", "BatchInitializationMonitor", "batchContainerInitializationsProgress", "=", "new", "BatchInitializationMonitor", "(", ")", ";", "public", "Hashtable", "containerInitializersCache", "=", "new", "Hashtable", "(", "5", ")", ";", "private", "ThreadLocal", "classpathsBeingResolved", "=", "new", "ThreadLocal", "(", ")", ";", "public", "JavaWorkspaceScope", "workspaceScope", ";", "private", "WeakHashSet", "stringSymbols", "=", "new", "WeakHashSet", "(", "5", ")", ";", "private", "WeakHashSetOfCharArray", "charArraySymbols", "=", "new", "WeakHashSetOfCharArray", "(", "5", ")", ";", "private", "IConfigurationElement", "annotationProcessorManagerFactory", "=", "null", ";", "public", "Map", "rootPathToAttachments", "=", "new", "Hashtable", "(", ")", ";", "public", "final", "static", "String", "CP_VARIABLE_PREFERENCES_PREFIX", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "final", "static", "String", "CP_CONTAINER_PREFERENCES_PREFIX", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "final", "static", "String", "CP_USERLIBRARY_PREFERENCES_PREFIX", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "final", "static", "String", "CP_ENTRY_IGNORE", "=", "\"\"", ";", "public", "final", "static", "IPath", "CP_ENTRY_IGNORE_PATH", "=", "new", "Path", "(", "CP_ENTRY_IGNORE", ")", ";", "public", "final", "static", "String", "TRUE", "=", "\"true\"", ";", "private", "final", "static", "int", "VARIABLES_AND_CONTAINERS_FILE_VERSION", "=", "2", ";", "public", "static", "final", "String", "CPVARIABLE_INITIALIZER_EXTPOINT_ID", "=", "\"\"", ";", "public", "static", "final", "String", "CPCONTAINER_INITIALIZER_EXTPOINT_ID", "=", "\"\"", ";", "public", "static", "final", "String", "FORMATTER_EXTPOINT_ID", "=", "\"\"", ";", "public", "static", "final", "String", "COMPILATION_PARTICIPANT_EXTPOINT_ID", "=", "\"\"", ";", "public", "static", "final", "String", "ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID", "=", "\"\"", ";", "private", "static", "final", "String", "RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS", "=", "\"\"", ";", "public", "final", "static", "IPath", "VARIABLE_INITIALIZATION_IN_PROGRESS", "=", "new", "Path", "(", "\"\"", ")", ";", "public", "final", "static", "IClasspathContainer", "CONTAINER_INITIALIZATION_IN_PROGRESS", "=", "new", "IClasspathContainer", "(", ")", "{", "public", "IClasspathEntry", "[", "]", "getClasspathEntries", "(", ")", "{", "return", "null", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "\"\"", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "0", ";", "}", "public", "IPath", "getPath", "(", ")", "{", "return", "null", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "getDescription", "(", ")", ";", "}", "}", ";", "private", "static", "final", "String", "BUFFER_MANAGER_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "INDEX_MANAGER_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "INDEX_MANAGER_ADVANCED_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "COMPILER_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "JAVAMODEL_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "JAVAMODELCACHE_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "CP_RESOLVE_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "CP_RESOLVE_ADVANCED_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "CP_RESOLVE_FAILURE_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "ZIP_ACCESS_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "DELTA_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "DELTA_DEBUG_VERBOSE", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "HIERARCHY_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "POST_ACTION_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "BUILDER_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "BUILDER_STATS_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "COMPLETION_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "RESOLUTION_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "SELECTION_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "SEARCH_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "SOURCE_MAPPER_DEBUG_VERBOSE", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "static", "final", "String", "FORMATTER_DEBUG", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "static", "final", "String", "COMPLETION_PERF", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "static", "final", "String", "SELECTION_PERF", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "static", "final", "String", "DELTA_LISTENER_PERF", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "static", "final", "String", "VARIABLE_INITIALIZER_PERF", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "static", "final", "String", "CONTAINER_INITIALIZER_PERF", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "public", "static", "final", "String", "RECONCILE_PERF", "=", "JavaCore", ".", "PLUGIN_ID", "+", "\"\"", ";", "private", "final", "static", "String", "INDEXED_SECONDARY_TYPES", "=", "\"\"", ";", "public", "static", "boolean", "PERF_VARIABLE_INITIALIZER", "=", "false", ";", "public", "static", "boolean", "PERF_CONTAINER_INITIALIZER", "=", "false", ";", "boolean", "resolveReferencedLibrariesForContainers", "=", "false", ";", "public", "final", "static", "ICompilationUnit", "[", "]", "NO_WORKING_COPY", "=", "new", "ICompilationUnit", "[", "0", "]", ";", "private", "final", "static", "int", "UNKNOWN_OPTION", "=", "0", ";", "private", "final", "static", "int", "DEPRECATED_OPTION", "=", "1", ";", "private", "final", "static", "int", "VALID_OPTION", "=", "2", ";", "HashSet", "optionNames", "=", "new", "HashSet", "(", "20", ")", ";", "Map", "deprecatedOptions", "=", "new", "HashMap", "(", ")", ";", "Hashtable", "optionsCache", ";", "public", "final", "IEclipsePreferences", "[", "]", "preferencesLookup", "=", "new", "IEclipsePreferences", "[", "2", "]", ";", "static", "final", "int", "PREF_INSTANCE", "=", "0", ";", "static", "final", "int", "PREF_DEFAULT", "=", "1", ";", "static", "final", "Object", "[", "]", "[", "]", "NO_PARTICIPANTS", "=", "new", "Object", "[", "0", "]", "[", "]", ";", "public", "static", "class", "CompilationParticipants", "{", "private", "final", "static", "int", "MAX_SOURCE_LEVEL", "=", "7", ";", "private", "Object", "[", "]", "[", "]", "registeredParticipants", "=", "null", ";", "private", "HashSet", "managedMarkerTypes", ";", "public", "CompilationParticipant", "[", "]", "getCompilationParticipants", "(", "IJavaProject", "project", ")", "{", "final", "Object", "[", "]", "[", "]", "participantsPerSource", "=", "getRegisteredParticipants", "(", ")", ";", "if", "(", "participantsPerSource", "==", "NO_PARTICIPANTS", ")", "return", "null", ";", "String", "sourceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "final", "int", "sourceLevelIndex", "=", "indexForSourceLevel", "(", "sourceLevel", ")", ";", "final", "Object", "[", "]", "participants", "=", "participantsPerSource", "[", "sourceLevelIndex", "]", ";", "int", "length", "=", "participants", ".", "length", ";", "CompilationParticipant", "[", "]", "result", "=", "new", "CompilationParticipant", "[", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "participants", "[", "i", "]", "instanceof", "IConfigurationElement", ")", "{", "final", "IConfigurationElement", "configElement", "=", "(", "IConfigurationElement", ")", "participants", "[", "i", "]", ";", "final", "int", "participantIndex", "=", "i", ";", "SafeRunner", ".", "run", "(", "new", "ISafeRunnable", "(", ")", "{", "public", "void", "handleException", "(", "Throwable", "exception", ")", "{", "Util", ".", "log", "(", "exception", ",", "\"\"", ")", ";", "}", "public", "void", "run", "(", ")", "throws", "Exception", "{", "Object", "executableExtension", "=", "configElement", ".", "createExecutableExtension", "(", "\"class\"", ")", ";", "for", "(", "int", "j", "=", "sourceLevelIndex", ";", "j", "<", "MAX_SOURCE_LEVEL", ";", "j", "++", ")", "participantsPerSource", "[", "j", "]", "[", "participantIndex", "]", "=", "executableExtension", ";", "}", "}", ")", ";", "}", "CompilationParticipant", "participant", ";", "if", "(", "(", "participants", "[", "i", "]", "instanceof", "CompilationParticipant", ")", "&&", "(", "participant", "=", "(", "CompilationParticipant", ")", "participants", "[", "i", "]", ")", ".", "isActive", "(", "project", ")", ")", "result", "[", "index", "++", "]", "=", "participant", ";", "}", "if", "(", "index", "==", "0", ")", "return", "null", ";", "if", "(", "index", "<", "length", ")", "System", ".", "arraycopy", "(", "result", ",", "0", ",", "result", "=", "new", "CompilationParticipant", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "result", ";", "}", "public", "HashSet", "managedMarkerTypes", "(", ")", "{", "if", "(", "this", ".", "managedMarkerTypes", "==", "null", ")", "{", "getRegisteredParticipants", "(", ")", ";", "}", "return", "this", ".", "managedMarkerTypes", ";", "}", "private", "synchronized", "Object", "[", "]", "[", "]", "getRegisteredParticipants", "(", ")", "{", "if", "(", "this", ".", "registeredParticipants", "!=", "null", ")", "{", "return", "this", ".", "registeredParticipants", ";", "}", "this", ".", "managedMarkerTypes", "=", "new", "HashSet", "(", ")", ";", "IExtensionPoint", "extension", "=", "Platform", ".", "getExtensionRegistry", "(", ")", ".", "getExtensionPoint", "(", "JavaCore", ".", "PLUGIN_ID", ",", "COMPILATION_PARTICIPANT_EXTPOINT_ID", ")", ";", "if", "(", "extension", "==", "null", ")", "return", "this", ".", "registeredParticipants", "=", "NO_PARTICIPANTS", ";", "final", "ArrayList", "modifyingEnv", "=", "new", "ArrayList", "(", ")", ";", "final", "ArrayList", "creatingProblems", "=", "new", "ArrayList", "(", ")", ";", "final", "ArrayList", "others", "=", "new", "ArrayList", "(", ")", ";", "IExtension", "[", "]", "extensions", "=", "extension", ".", "getExtensions", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extensions", ".", "length", ";", "i", "++", ")", "{", "IConfigurationElement", "[", "]", "configElements", "=", "extensions", "[", "i", "]", ".", "getConfigurationElements", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "configElements", ".", "length", ";", "j", "++", ")", "{", "final", "IConfigurationElement", "configElement", "=", "configElements", "[", "j", "]", ";", "String", "elementName", "=", "configElement", ".", "getName", "(", ")", ";", "if", "(", "!", "(", "\"\"", ".", "equals", "(", "elementName", ")", ")", ")", "{", "continue", ";", "}", "if", "(", "TRUE", ".", "equals", "(", "configElement", ".", "getAttribute", "(", "\"\"", ")", ")", ")", "modifyingEnv", ".", "add", "(", "configElement", ")", ";", "else", "if", "(", "TRUE", ".", "equals", "(", "configElement", ".", "getAttribute", "(", "\"\"", ")", ")", ")", "creatingProblems", ".", "add", "(", "configElement", ")", ";", "else", "others", ".", "add", "(", "configElement", ")", ";", "IConfigurationElement", "[", "]", "managedMarkers", "=", "configElement", ".", "getChildren", "(", "\"\"", ")", ";", "for", "(", "int", "k", "=", "0", ",", "length", "=", "managedMarkers", ".", "length", ";", "k", "<", "length", ";", "k", "++", ")", "{", "IConfigurationElement", "element", "=", "managedMarkers", "[", "k", "]", ";", "String", "markerType", "=", "element", ".", "getAttribute", "(", "\"markerType\"", ")", ";", "if", "(", "markerType", "!=", "null", ")", "this", ".", "managedMarkerTypes", ".", "add", "(", "markerType", ")", ";", "}", "}", "}", "int", "size", "=", "modifyingEnv", ".", "size", "(", ")", "+", "creatingProblems", ".", "size", "(", ")", "+", "others", ".", "size", "(", ")", ";", "if", "(", "size", "==", "0", ")", "return", "this", ".", "registeredParticipants", "=", "NO_PARTICIPANTS", ";", "IConfigurationElement", "[", "]", "configElements", "=", "new", "IConfigurationElement", "[", "size", "]", ";", "int", "index", "=", "0", ";", "index", "=", "sortParticipants", "(", "modifyingEnv", ",", "configElements", ",", "index", ")", ";", "index", "=", "sortParticipants", "(", "creatingProblems", ",", "configElements", ",", "index", ")", ";", "index", "=", "sortParticipants", "(", "others", ",", "configElements", ",", "index", ")", ";", "Object", "[", "]", "[", "]", "result", "=", "new", "Object", "[", "MAX_SOURCE_LEVEL", "]", "[", "]", ";", "int", "length", "=", "configElements", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "MAX_SOURCE_LEVEL", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "new", "Object", "[", "length", "]", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "sourceLevel", "=", "configElements", "[", "i", "]", ".", "getAttribute", "(", "\"\"", ")", ";", "int", "sourceLevelIndex", "=", "indexForSourceLevel", "(", "sourceLevel", ")", ";", "for", "(", "int", "j", "=", "sourceLevelIndex", ";", "j", "<", "MAX_SOURCE_LEVEL", ";", "j", "++", ")", "{", "result", "[", "j", "]", "[", "i", "]", "=", "configElements", "[", "i", "]", ";", "}", "}", "return", "this", ".", "registeredParticipants", "=", "result", ";", "}", "private", "int", "indexForSourceLevel", "(", "String", "sourceLevel", ")", "{", "if", "(", "sourceLevel", "==", "null", ")", "return", "0", ";", "int", "majVersion", "=", "(", "int", ")", "(", "CompilerOptions", ".", "versionToJdkLevel", "(", "sourceLevel", ")", ">>>", "16", ")", ";", "switch", "(", "majVersion", ")", "{", "case", "ClassFileConstants", ".", "MAJOR_VERSION_1_2", ":", "return", "1", ";", "case", "ClassFileConstants", ".", "MAJOR_VERSION_1_3", ":", "return", "2", ";", "case", "ClassFileConstants", ".", "MAJOR_VERSION_1_4", ":", "return", "3", ";", "case", "ClassFileConstants", ".", "MAJOR_VERSION_1_5", ":", "return", "4", ";", "case", "ClassFileConstants", ".", "MAJOR_VERSION_1_6", ":", "return", "5", ";", "case", "ClassFileConstants", ".", "MAJOR_VERSION_1_7", ":", "return", "6", ";", "default", ":", "return", "0", ";", "}", "}", "private", "int", "sortParticipants", "(", "ArrayList", "group", ",", "IConfigurationElement", "[", "]", "configElements", ",", "int", "index", ")", "{", "int", "size", "=", "group", ".", "size", "(", ")", ";", "if", "(", "size", "==", "0", ")", "return", "index", ";", "Object", "[", "]", "elements", "=", "group", ".", "toArray", "(", ")", ";", "Util", ".", "sort", "(", "elements", ",", "new", "Util", ".", "Comparer", "(", ")", "{", "public", "int", "compare", "(", "Object", "a", ",", "Object", "b", ")", "{", "if", "(", "a", "==", "b", ")", "return", "0", ";", "String", "id", "=", "(", "(", "IConfigurationElement", ")", "a", ")", ".", "getAttribute", "(", "\"id\"", ")", ";", "if", "(", "id", "==", "null", ")", "return", "-", "1", ";", "IConfigurationElement", "[", "]", "requiredElements", "=", "(", "(", "IConfigurationElement", ")", "b", ")", ".", "getChildren", "(", "\"requires\"", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "requiredElements", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IConfigurationElement", "required", "=", "requiredElements", "[", "i", "]", ";", "if", "(", "id", ".", "equals", "(", "required", ".", "getAttribute", "(", "\"id\"", ")", ")", ")", "return", "1", ";", "}", "return", "-", "1", ";", "}", "}", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "configElements", "[", "index", "+", "i", "]", "=", "(", "IConfigurationElement", ")", "elements", "[", "i", "]", ";", "return", "index", "+", "size", ";", "}", "}", "public", "final", "CompilationParticipants", "compilationParticipants", "=", "new", "CompilationParticipants", "(", ")", ";", "public", "ThreadLocal", "abortOnMissingSource", "=", "new", "ThreadLocal", "(", ")", ";", "private", "ExternalFoldersManager", "externalFoldersManager", "=", "ExternalFoldersManager", ".", "getExternalFoldersManager", "(", ")", ";", "public", "static", "boolean", "conflictsWithOutputLocation", "(", "IPath", "folderPath", ",", "JavaProject", "project", ")", "{", "try", "{", "IPath", "outputLocation", "=", "project", ".", "getOutputLocation", "(", ")", ";", "if", "(", "outputLocation", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "outputLocation", ".", "isPrefixOf", "(", "folderPath", ")", ")", "{", "IClasspathEntry", "[", "]", "classpath", "=", "project", ".", "getResolvedClasspath", "(", ")", ";", "boolean", "isOutputUsed", "=", "false", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "classpath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_SOURCE", ")", "{", "if", "(", "entry", ".", "getPath", "(", ")", ".", "equals", "(", "outputLocation", ")", ")", "{", "return", "false", ";", "}", "if", "(", "entry", ".", "getOutputLocation", "(", ")", "==", "null", ")", "{", "isOutputUsed", "=", "true", ";", "}", "}", "}", "return", "isOutputUsed", ";", "}", "return", "false", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "true", ";", "}", "}", "public", "synchronized", "IClasspathContainer", "containerGet", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "if", "(", "containerIsInitializationInProgress", "(", "project", ",", "containerPath", ")", ")", "{", "return", "CONTAINER_INITIALIZATION_IN_PROGRESS", ";", "}", "Map", "projectContainers", "=", "(", "Map", ")", "this", ".", "containers", ".", "get", "(", "project", ")", ";", "if", "(", "projectContainers", "==", "null", ")", "{", "return", "null", ";", "}", "IClasspathContainer", "container", "=", "(", "IClasspathContainer", ")", "projectContainers", ".", "get", "(", "containerPath", ")", ";", "return", "container", ";", "}", "public", "synchronized", "IClasspathContainer", "containerGetDefaultToPreviousSession", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Map", "projectContainers", "=", "(", "Map", ")", "this", ".", "containers", ".", "get", "(", "project", ")", ";", "if", "(", "projectContainers", "==", "null", ")", "return", "getPreviousSessionContainer", "(", "containerPath", ",", "project", ")", ";", "IClasspathContainer", "container", "=", "(", "IClasspathContainer", ")", "projectContainers", ".", "get", "(", "containerPath", ")", ";", "if", "(", "container", "==", "null", ")", "return", "getPreviousSessionContainer", "(", "containerPath", ",", "project", ")", ";", "return", "container", ";", "}", "private", "boolean", "containerIsInitializationInProgress", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Map", "initializations", "=", "(", "Map", ")", "this", ".", "containerInitializationInProgress", ".", "get", "(", ")", ";", "if", "(", "initializations", "==", "null", ")", "return", "false", ";", "HashSet", "projectInitializations", "=", "(", "HashSet", ")", "initializations", ".", "get", "(", "project", ")", ";", "if", "(", "projectInitializations", "==", "null", ")", "return", "false", ";", "return", "projectInitializations", ".", "contains", "(", "containerPath", ")", ";", "}", "private", "void", "containerAddInitializationInProgress", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Map", "initializations", "=", "(", "Map", ")", "this", ".", "containerInitializationInProgress", ".", "get", "(", ")", ";", "if", "(", "initializations", "==", "null", ")", "this", ".", "containerInitializationInProgress", ".", "set", "(", "initializations", "=", "new", "HashMap", "(", ")", ")", ";", "HashSet", "projectInitializations", "=", "(", "HashSet", ")", "initializations", ".", "get", "(", "project", ")", ";", "if", "(", "projectInitializations", "==", "null", ")", "initializations", ".", "put", "(", "project", ",", "projectInitializations", "=", "new", "HashSet", "(", ")", ")", ";", "projectInitializations", ".", "add", "(", "containerPath", ")", ";", "}", "public", "void", "containerBeingInitializedPut", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "IClasspathContainer", "container", ")", "{", "Map", "perProjectContainers", "=", "(", "Map", ")", "this", ".", "containersBeingInitialized", ".", "get", "(", ")", ";", "if", "(", "perProjectContainers", "==", "null", ")", "this", ".", "containersBeingInitialized", ".", "set", "(", "perProjectContainers", "=", "new", "HashMap", "(", ")", ")", ";", "HashMap", "perPathContainers", "=", "(", "HashMap", ")", "perProjectContainers", ".", "get", "(", "project", ")", ";", "if", "(", "perPathContainers", "==", "null", ")", "perProjectContainers", ".", "put", "(", "project", ",", "perPathContainers", "=", "new", "HashMap", "(", ")", ")", ";", "perPathContainers", ".", "put", "(", "containerPath", ",", "container", ")", ";", "}", "public", "IClasspathContainer", "containerBeingInitializedGet", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Map", "perProjectContainers", "=", "(", "Map", ")", "this", ".", "containersBeingInitialized", ".", "get", "(", ")", ";", "if", "(", "perProjectContainers", "==", "null", ")", "return", "null", ";", "HashMap", "perPathContainers", "=", "(", "HashMap", ")", "perProjectContainers", ".", "get", "(", "project", ")", ";", "if", "(", "perPathContainers", "==", "null", ")", "return", "null", ";", "return", "(", "IClasspathContainer", ")", "perPathContainers", ".", "get", "(", "containerPath", ")", ";", "}", "public", "IClasspathContainer", "containerBeingInitializedRemove", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Map", "perProjectContainers", "=", "(", "Map", ")", "this", ".", "containersBeingInitialized", ".", "get", "(", ")", ";", "if", "(", "perProjectContainers", "==", "null", ")", "return", "null", ";", "HashMap", "perPathContainers", "=", "(", "HashMap", ")", "perProjectContainers", ".", "get", "(", "project", ")", ";", "if", "(", "perPathContainers", "==", "null", ")", "return", "null", ";", "IClasspathContainer", "container", "=", "(", "IClasspathContainer", ")", "perPathContainers", ".", "remove", "(", "containerPath", ")", ";", "if", "(", "perPathContainers", ".", "size", "(", ")", "==", "0", ")", "perPathContainers", ".", "remove", "(", "project", ")", ";", "if", "(", "perProjectContainers", ".", "size", "(", ")", "==", "0", ")", "this", ".", "containersBeingInitialized", ".", "set", "(", "null", ")", ";", "return", "container", ";", "}", "public", "synchronized", "void", "containerPut", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "IClasspathContainer", "container", ")", "{", "if", "(", "container", "==", "CONTAINER_INITIALIZATION_IN_PROGRESS", ")", "{", "containerAddInitializationInProgress", "(", "project", ",", "containerPath", ")", ";", "return", ";", "}", "else", "{", "containerRemoveInitializationInProgress", "(", "project", ",", "containerPath", ")", ";", "Map", "projectContainers", "=", "(", "Map", ")", "this", ".", "containers", ".", "get", "(", "project", ")", ";", "if", "(", "projectContainers", "==", "null", ")", "{", "projectContainers", "=", "new", "HashMap", "(", "1", ")", ";", "this", ".", "containers", ".", "put", "(", "project", ",", "projectContainers", ")", ";", "}", "if", "(", "container", "==", "null", ")", "{", "projectContainers", ".", "remove", "(", "containerPath", ")", ";", "}", "else", "{", "projectContainers", ".", "put", "(", "containerPath", ",", "container", ")", ";", "}", "Map", "previousContainers", "=", "(", "Map", ")", "this", ".", "previousSessionContainers", ".", "get", "(", "project", ")", ";", "if", "(", "previousContainers", "!=", "null", ")", "{", "previousContainers", ".", "remove", "(", "containerPath", ")", ";", "}", "}", "}", "public", "synchronized", "void", "containerRemove", "(", "IJavaProject", "project", ")", "{", "Map", "initializations", "=", "(", "Map", ")", "this", ".", "containerInitializationInProgress", ".", "get", "(", ")", ";", "if", "(", "initializations", "!=", "null", ")", "{", "initializations", ".", "remove", "(", "project", ")", ";", "}", "this", ".", "containers", ".", "remove", "(", "project", ")", ";", "}", "public", "boolean", "containerPutIfInitializingWithSameEntries", "(", "IPath", "containerPath", ",", "IJavaProject", "[", "]", "projects", ",", "IClasspathContainer", "[", "]", "respectiveContainers", ")", "{", "int", "projectLength", "=", "projects", ".", "length", ";", "if", "(", "projectLength", "!=", "1", ")", "return", "false", ";", "final", "IClasspathContainer", "container", "=", "respectiveContainers", "[", "0", "]", ";", "IJavaProject", "project", "=", "projects", "[", "0", "]", ";", "if", "(", "!", "containerIsInitializationInProgress", "(", "project", ",", "containerPath", ")", ")", "return", "false", ";", "IClasspathContainer", "previousContainer", "=", "containerGetDefaultToPreviousSession", "(", "project", ",", "containerPath", ")", ";", "if", "(", "container", "==", "null", ")", "{", "if", "(", "previousContainer", "==", "null", ")", "{", "containerPut", "(", "project", ",", "containerPath", ",", "null", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "final", "IClasspathEntry", "[", "]", "newEntries", "=", "container", ".", "getClasspathEntries", "(", ")", ";", "if", "(", "previousContainer", "==", "null", ")", "if", "(", "newEntries", ".", "length", "==", "0", ")", "{", "containerPut", "(", "project", ",", "containerPath", ",", "container", ")", ";", "return", "true", ";", "}", "else", "{", "if", "(", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_missbehaving_container", "(", "containerPath", ",", "projects", ",", "respectiveContainers", ",", "container", ",", "newEntries", ",", "null", ")", ";", "return", "false", ";", "}", "final", "IClasspathEntry", "[", "]", "oldEntries", "=", "previousContainer", ".", "getClasspathEntries", "(", ")", ";", "if", "(", "oldEntries", ".", "length", "!=", "newEntries", ".", "length", ")", "{", "if", "(", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_missbehaving_container", "(", "containerPath", ",", "projects", ",", "respectiveContainers", ",", "container", ",", "newEntries", ",", "oldEntries", ")", ";", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "newEntries", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "newEntries", "[", "i", "]", "==", "null", ")", "{", "if", "(", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_missbehaving_container", "(", "project", ",", "containerPath", ",", "newEntries", ")", ";", "return", "false", ";", "}", "if", "(", "!", "newEntries", "[", "i", "]", ".", "equals", "(", "oldEntries", "[", "i", "]", ")", ")", "{", "if", "(", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_missbehaving_container", "(", "containerPath", ",", "projects", ",", "respectiveContainers", ",", "container", ",", "newEntries", ",", "oldEntries", ")", ";", "return", "false", ";", "}", "}", "containerPut", "(", "project", ",", "containerPath", ",", "container", ")", ";", "return", "true", ";", "}", "private", "void", "verbose_missbehaving_container", "(", "IPath", "containerPath", ",", "IJavaProject", "[", "]", "projects", ",", "IClasspathContainer", "[", "]", "respectiveContainers", ",", "final", "IClasspathContainer", "container", ",", "final", "IClasspathEntry", "[", "]", "newEntries", ",", "final", "IClasspathEntry", "[", "]", "oldEntries", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"\"", "+", "containerPath", "+", "'\\n'", "+", "\"tprojects:", "{\"", "+", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "toString", "(", "projects", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "Displayable", "(", ")", "{", "public", "String", "displayString", "(", "Object", "o", ")", "{", "return", "(", "(", "IJavaProject", ")", "o", ")", ".", "getElementName", "(", ")", ";", "}", "}", ")", "+", "\"\"", "+", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "toString", "(", "respectiveContainers", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "Displayable", "(", ")", "{", "public", "String", "displayString", "(", "Object", "o", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"tt\"", ")", ";", "if", "(", "o", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"<null>\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "buffer", ".", "append", "(", "container", ".", "getDescription", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"", "{n\"", ")", ";", "if", "(", "oldEntries", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"", "ttt\"", ")", ";", "buffer", ".", "append", "(", "\"<null>n\"", ")", ";", "}", "else", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "oldEntries", ".", "length", ";", "j", "++", ")", "{", "buffer", ".", "append", "(", "\"", "ttt\"", ")", ";", "buffer", ".", "append", "(", "oldEntries", "[", "j", "]", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "}", "buffer", ".", "append", "(", "\"", "tt}\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", ")", "+", "\"\"", "+", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "toString", "(", "respectiveContainers", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "Displayable", "(", ")", "{", "public", "String", "displayString", "(", "Object", "o", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"tt\"", ")", ";", "if", "(", "o", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"<null>\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "buffer", ".", "append", "(", "container", ".", "getDescription", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"", "{n\"", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "newEntries", ".", "length", ";", "j", "++", ")", "{", "buffer", ".", "append", "(", "\"", "ttt\"", ")", ";", "buffer", ".", "append", "(", "newEntries", "[", "j", "]", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "buffer", ".", "append", "(", "\"", "tt}\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", ")", "+", "\"nt}\"", ")", ";", "}", "void", "verbose_missbehaving_container", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "IClasspathEntry", "[", "]", "classpathEntries", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", "+", "'\\n'", "+", "\"\"", "+", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "toString", "(", "classpathEntries", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "Displayable", "(", ")", "{", "public", "String", "displayString", "(", "Object", "o", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"tt\"", ")", ";", "if", "(", "o", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"<null>\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "buffer", ".", "append", "(", "o", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", ")", "+", "\"nt}\"", ")", ";", "}", "void", "verbose_missbehaving_container_null_entries", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", "+", "'\\n'", "+", "\"\"", ")", ";", "}", "private", "void", "containerRemoveInitializationInProgress", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Map", "initializations", "=", "(", "Map", ")", "this", ".", "containerInitializationInProgress", ".", "get", "(", ")", ";", "if", "(", "initializations", "==", "null", ")", "return", ";", "HashSet", "projectInitializations", "=", "(", "HashSet", ")", "initializations", ".", "get", "(", "project", ")", ";", "if", "(", "projectInitializations", "==", "null", ")", "return", ";", "projectInitializations", ".", "remove", "(", "containerPath", ")", ";", "if", "(", "projectInitializations", ".", "size", "(", ")", "==", "0", ")", "initializations", ".", "remove", "(", "project", ")", ";", "if", "(", "initializations", ".", "size", "(", ")", "==", "0", ")", "this", ".", "containerInitializationInProgress", ".", "set", "(", "null", ")", ";", "}", "private", "synchronized", "void", "containersReset", "(", "String", "[", "]", "containerIDs", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "containerIDs", ".", "length", ";", "i", "++", ")", "{", "String", "containerID", "=", "containerIDs", "[", "i", "]", ";", "Iterator", "projectIterator", "=", "this", ".", "containers", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "projectIterator", ".", "hasNext", "(", ")", ")", "{", "Map", "projectContainers", "=", "(", "Map", ")", "projectIterator", ".", "next", "(", ")", ";", "if", "(", "projectContainers", "!=", "null", ")", "{", "Iterator", "containerIterator", "=", "projectContainers", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "containerIterator", ".", "hasNext", "(", ")", ")", "{", "IPath", "containerPath", "=", "(", "IPath", ")", "containerIterator", ".", "next", "(", ")", ";", "if", "(", "containerID", ".", "equals", "(", "containerPath", ".", "segment", "(", "0", ")", ")", ")", "{", "projectContainers", ".", "put", "(", "containerPath", ",", "null", ")", ";", "}", "}", "}", "}", "}", "}", "public", "static", "IJavaElement", "create", "(", "IResource", "resource", ",", "IJavaProject", "project", ")", "{", "if", "(", "resource", "==", "null", ")", "{", "return", "null", ";", "}", "int", "type", "=", "resource", ".", "getType", "(", ")", ";", "switch", "(", "type", ")", "{", "case", "IResource", ".", "PROJECT", ":", "return", "JavaCore", ".", "create", "(", "(", "IProject", ")", "resource", ")", ";", "case", "IResource", ".", "FILE", ":", "return", "create", "(", "(", "IFile", ")", "resource", ",", "project", ")", ";", "case", "IResource", ".", "FOLDER", ":", "return", "create", "(", "(", "IFolder", ")", "resource", ",", "project", ")", ";", "case", "IResource", ".", "ROOT", ":", "return", "JavaCore", ".", "create", "(", "(", "IWorkspaceRoot", ")", "resource", ")", ";", "default", ":", "return", "null", ";", "}", "}", "public", "static", "IJavaElement", "create", "(", "IFile", "file", ",", "IJavaProject", "project", ")", "{", "if", "(", "file", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "project", "==", "null", ")", "{", "project", "=", "JavaCore", ".", "create", "(", "file", ".", "getProject", "(", ")", ")", ";", "}", "if", "(", "file", ".", "getFileExtension", "(", ")", "!=", "null", ")", "{", "String", "name", "=", "file", ".", "getName", "(", ")", ";", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "name", ")", ")", "return", "createCompilationUnitFrom", "(", "file", ",", "project", ")", ";", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "name", ")", ")", "return", "createClassFileFrom", "(", "file", ",", "project", ")", ";", "return", "createJarPackageFragmentRootFrom", "(", "file", ",", "project", ")", ";", "}", "return", "null", ";", "}", "public", "static", "IJavaElement", "create", "(", "IFolder", "folder", ",", "IJavaProject", "project", ")", "{", "if", "(", "folder", "==", "null", ")", "{", "return", "null", ";", "}", "IJavaElement", "element", ";", "if", "(", "project", "==", "null", ")", "{", "project", "=", "JavaCore", ".", "create", "(", "folder", ".", "getProject", "(", ")", ")", ";", "element", "=", "determineIfOnClasspath", "(", "folder", ",", "project", ")", ";", "if", "(", "element", "==", "null", ")", "{", "IJavaProject", "[", "]", "projects", ";", "try", "{", "projects", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProjects", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "project", "=", "projects", "[", "i", "]", ";", "element", "=", "determineIfOnClasspath", "(", "folder", ",", "project", ")", ";", "if", "(", "element", "!=", "null", ")", "break", ";", "}", "}", "}", "else", "{", "element", "=", "determineIfOnClasspath", "(", "folder", ",", "project", ")", ";", "}", "return", "element", ";", "}", "public", "static", "IClassFile", "createClassFileFrom", "(", "IFile", "file", ",", "IJavaProject", "project", ")", "{", "if", "(", "file", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "project", "==", "null", ")", "{", "project", "=", "JavaCore", ".", "create", "(", "file", ".", "getProject", "(", ")", ")", ";", "}", "IPackageFragment", "pkg", "=", "(", "IPackageFragment", ")", "determineIfOnClasspath", "(", "file", ",", "project", ")", ";", "if", "(", "pkg", "==", "null", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "project", ".", "getPackageFragmentRoot", "(", "file", ".", "getParent", "(", ")", ")", ";", "pkg", "=", "root", ".", "getPackageFragment", "(", "CharOperation", ".", "NO_STRINGS", ")", ";", "}", "return", "pkg", ".", "getClassFile", "(", "file", ".", "getName", "(", ")", ")", ";", "}", "public", "static", "ICompilationUnit", "createCompilationUnitFrom", "(", "IFile", "file", ",", "IJavaProject", "project", ")", "{", "if", "(", "file", "==", "null", ")", "return", "null", ";", "if", "(", "project", "==", "null", ")", "{", "project", "=", "JavaCore", ".", "create", "(", "file", ".", "getProject", "(", ")", ")", ";", "}", "IPackageFragment", "pkg", "=", "(", "IPackageFragment", ")", "determineIfOnClasspath", "(", "file", ",", "project", ")", ";", "if", "(", "pkg", "==", "null", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "project", ".", "getPackageFragmentRoot", "(", "file", ".", "getParent", "(", ")", ")", ";", "pkg", "=", "root", ".", "getPackageFragment", "(", "CharOperation", ".", "NO_STRINGS", ")", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"):", "\"", "+", "file", ".", "getFullPath", "(", ")", ")", ";", "}", "}", "return", "pkg", ".", "getCompilationUnit", "(", "file", ".", "getName", "(", ")", ")", ";", "}", "public", "static", "IPackageFragmentRoot", "createJarPackageFragmentRootFrom", "(", "IFile", "file", ",", "IJavaProject", "project", ")", "{", "if", "(", "file", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "project", "==", "null", ")", "{", "project", "=", "JavaCore", ".", "create", "(", "file", ".", "getProject", "(", ")", ")", ";", "}", "IPath", "resourcePath", "=", "file", ".", "getFullPath", "(", ")", ";", "try", "{", "IClasspathEntry", "entry", "=", "(", "(", "JavaProject", ")", "project", ")", ".", "getClasspathEntryFor", "(", "resourcePath", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "return", "project", ".", "getPackageFragmentRoot", "(", "file", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "return", "null", ";", "}", "public", "static", "IJavaElement", "determineIfOnClasspath", "(", "IResource", "resource", ",", "IJavaProject", "project", ")", "{", "IPath", "resourcePath", "=", "resource", ".", "getFullPath", "(", ")", ";", "boolean", "isExternal", "=", "ExternalFoldersManager", ".", "isInternalPathForExternalFolder", "(", "resourcePath", ")", ";", "if", "(", "isExternal", ")", "resourcePath", "=", "resource", ".", "getLocation", "(", ")", ";", "try", "{", "JavaProjectElementInfo", "projectInfo", "=", "(", "JavaProjectElementInfo", ")", "getJavaModelManager", "(", ")", ".", "getInfo", "(", "project", ")", ";", "ProjectCache", "projectCache", "=", "projectInfo", "==", "null", "?", "null", ":", "projectInfo", ".", "projectCache", ";", "HashtableOfArrayToObject", "allPkgFragmentsCache", "=", "projectCache", "==", "null", "?", "null", ":", "projectCache", ".", "allPkgFragmentsCache", ";", "boolean", "isJavaLike", "=", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "resourcePath", ".", "lastSegment", "(", ")", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "isJavaLike", "?", "project", ".", "getRawClasspath", "(", ")", ":", "(", "(", "JavaProject", ")", "project", ")", ".", "getResolvedClasspath", "(", ")", ";", "int", "length", "=", "entries", ".", "length", ";", "if", "(", "length", ">", "0", ")", "{", "String", "sourceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "String", "complianceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "entries", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_PROJECT", ")", "continue", ";", "IPath", "rootPath", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "rootPath", ".", "equals", "(", "resourcePath", ")", ")", "{", "if", "(", "isJavaLike", ")", "return", "null", ";", "return", "project", ".", "getPackageFragmentRoot", "(", "resource", ")", ";", "}", "else", "if", "(", "rootPath", ".", "isPrefixOf", "(", "resourcePath", ")", ")", "{", "if", "(", "!", "Util", ".", "isExcluded", "(", "resource", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullInclusionPatternChars", "(", ")", ",", "(", "(", "ClasspathEntry", ")", "entry", ")", ".", "fullExclusionPatternChars", "(", ")", ")", ")", "{", "PackageFragmentRoot", "root", "=", "isExternal", "?", "new", "ExternalPackageFragmentRoot", "(", "rootPath", ",", "(", "JavaProject", ")", "project", ")", ":", "(", "PackageFragmentRoot", ")", "(", "(", "JavaProject", ")", "project", ")", ".", "getFolderPackageFragmentRoot", "(", "rootPath", ")", ";", "if", "(", "root", "==", "null", ")", "return", "null", ";", "IPath", "pkgPath", "=", "resourcePath", ".", "removeFirstSegments", "(", "rootPath", ".", "segmentCount", "(", ")", ")", ";", "if", "(", "resource", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", ")", "{", "pkgPath", "=", "pkgPath", ".", "removeLastSegments", "(", "1", ")", ";", "}", "String", "[", "]", "pkgName", "=", "pkgPath", ".", "segments", "(", ")", ";", "if", "(", "allPkgFragmentsCache", "!=", "null", "&&", "allPkgFragmentsCache", ".", "containsKey", "(", "pkgName", ")", ")", "return", "root", ".", "getPackageFragment", "(", "pkgName", ")", ";", "if", "(", "pkgName", ".", "length", "!=", "0", "&&", "JavaConventions", ".", "validatePackageName", "(", "Util", ".", "packageName", "(", "pkgPath", ",", "sourceLevel", ",", "complianceLevel", ")", ",", "sourceLevel", ",", "complianceLevel", ")", ".", "getSeverity", "(", ")", "==", "IStatus", ".", "ERROR", ")", "{", "return", "null", ";", "}", "return", "root", ".", "getPackageFragment", "(", "pkgName", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "JavaModelException", "npe", ")", "{", "return", "null", ";", "}", "return", "null", ";", "}", "private", "static", "JavaModelManager", "MANAGER", "=", "new", "JavaModelManager", "(", ")", ";", "private", "JavaModelCache", "cache", ";", "private", "ThreadLocal", "temporaryCache", "=", "new", "ThreadLocal", "(", ")", ";", "protected", "HashSet", "elementsOutOfSynchWithBuffers", "=", "new", "HashSet", "(", "11", ")", ";", "public", "DeltaProcessingState", "deltaState", "=", "new", "DeltaProcessingState", "(", ")", ";", "public", "IndexManager", "indexManager", "=", "null", ";", "protected", "Map", "perProjectInfos", "=", "new", "HashMap", "(", "5", ")", ";", "protected", "Map", "perWorkingCopyInfos", "=", "new", "HashMap", "(", "5", ")", ";", "protected", "WeakHashMap", "searchScopes", "=", "new", "WeakHashMap", "(", ")", ";", "public", "static", "class", "PerProjectInfo", "{", "private", "static", "final", "int", "JAVADOC_CACHE_INITIAL_SIZE", "=", "10", ";", "static", "final", "IJavaModelStatus", "NEED_RESOLUTION", "=", "new", "JavaModelStatus", "(", ")", ";", "public", "IProject", "project", ";", "public", "Object", "savedState", ";", "public", "boolean", "triedRead", ";", "public", "IClasspathEntry", "[", "]", "rawClasspath", ";", "public", "IClasspathEntry", "[", "]", "referencedEntries", ";", "public", "IJavaModelStatus", "rawClasspathStatus", ";", "public", "int", "rawTimeStamp", "=", "0", ";", "public", "boolean", "writtingRawClasspath", "=", "false", ";", "public", "IClasspathEntry", "[", "]", "resolvedClasspath", ";", "public", "IJavaModelStatus", "unresolvedEntryStatus", ";", "public", "Map", "rootPathToRawEntries", ";", "public", "Map", "rootPathToResolvedEntries", ";", "public", "IPath", "outputLocation", ";", "public", "IEclipsePreferences", "preferences", ";", "public", "Hashtable", "options", ";", "public", "Hashtable", "secondaryTypes", ";", "public", "LRUCache", "javadocCache", ";", "public", "PerProjectInfo", "(", "IProject", "project", ")", "{", "this", ".", "triedRead", "=", "false", ";", "this", ".", "savedState", "=", "null", ";", "this", ".", "project", "=", "project", ";", "this", ".", "javadocCache", "=", "new", "LRUCache", "(", "JAVADOC_CACHE_INITIAL_SIZE", ")", ";", "}", "public", "synchronized", "IClasspathEntry", "[", "]", "getResolvedClasspath", "(", ")", "{", "if", "(", "this", ".", "unresolvedEntryStatus", "==", "NEED_RESOLUTION", ")", "return", "null", ";", "return", "this", ".", "resolvedClasspath", ";", "}", "public", "void", "forgetExternalTimestampsAndIndexes", "(", ")", "{", "IClasspathEntry", "[", "]", "classpath", "=", "this", ".", "resolvedClasspath", ";", "if", "(", "classpath", "==", "null", ")", "return", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "IndexManager", "indexManager", "=", "manager", ".", "indexManager", ";", "Map", "externalTimeStamps", "=", "manager", ".", "deltaState", ".", "getExternalLibTimeStamps", "(", ")", ";", "HashMap", "rootInfos", "=", "JavaModelManager", ".", "getDeltaState", "(", ")", ".", "otherRoots", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "classpath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "rootInfos", ".", "get", "(", "path", ")", "==", "null", ")", "{", "externalTimeStamps", ".", "remove", "(", "path", ")", ";", "indexManager", ".", "removeIndex", "(", "path", ")", ";", "}", "}", "}", "}", "public", "void", "rememberExternalLibTimestamps", "(", ")", "{", "IClasspathEntry", "[", "]", "classpath", "=", "this", ".", "resolvedClasspath", ";", "if", "(", "classpath", "==", "null", ")", "return", ";", "Map", "externalTimeStamps", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "deltaState", ".", "getExternalLibTimeStamps", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "classpath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "i", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "externalTimeStamps", ".", "get", "(", "path", ")", "==", "null", ")", "{", "Object", "target", "=", "JavaModel", ".", "getExternalTarget", "(", "path", ",", "true", ")", ";", "if", "(", "target", "instanceof", "File", ")", "{", "long", "timestamp", "=", "DeltaProcessor", ".", "getTimeStamp", "(", "(", "java", ".", "io", ".", "File", ")", "target", ")", ";", "externalTimeStamps", ".", "put", "(", "path", ",", "new", "Long", "(", "timestamp", ")", ")", ";", "}", "}", "}", "}", "}", "public", "synchronized", "ClasspathChange", "resetResolvedClasspath", "(", ")", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "resetClasspathListCache", "(", ")", ";", "return", "setResolvedClasspath", "(", "null", ",", "null", ",", "null", ",", "null", ",", "this", ".", "rawTimeStamp", ",", "true", ")", ";", "}", "private", "ClasspathChange", "setClasspath", "(", "IClasspathEntry", "[", "]", "newRawClasspath", ",", "IClasspathEntry", "[", "]", "referencedEntries", ",", "IPath", "newOutputLocation", ",", "IJavaModelStatus", "newRawClasspathStatus", ",", "IClasspathEntry", "[", "]", "newResolvedClasspath", ",", "Map", "newRootPathToRawEntries", ",", "Map", "newRootPathToResolvedEntries", ",", "IJavaModelStatus", "newUnresolvedEntryStatus", ",", "boolean", "addClasspathChange", ")", "{", "ClasspathChange", "classpathChange", "=", "addClasspathChange", "?", "addClasspathChange", "(", ")", ":", "null", ";", "if", "(", "referencedEntries", "!=", "null", ")", "this", ".", "referencedEntries", "=", "referencedEntries", ";", "if", "(", "this", ".", "referencedEntries", "==", "null", ")", "this", ".", "referencedEntries", "=", "ClasspathEntry", ".", "NO_ENTRIES", ";", "this", ".", "rawClasspath", "=", "newRawClasspath", ";", "this", ".", "outputLocation", "=", "newOutputLocation", ";", "this", ".", "rawClasspathStatus", "=", "newRawClasspathStatus", ";", "this", ".", "resolvedClasspath", "=", "newResolvedClasspath", ";", "this", ".", "rootPathToRawEntries", "=", "newRootPathToRawEntries", ";", "this", ".", "rootPathToResolvedEntries", "=", "newRootPathToResolvedEntries", ";", "this", ".", "unresolvedEntryStatus", "=", "newUnresolvedEntryStatus", ";", "this", ".", "javadocCache", "=", "new", "LRUCache", "(", "JAVADOC_CACHE_INITIAL_SIZE", ")", ";", "return", "classpathChange", ";", "}", "protected", "ClasspathChange", "addClasspathChange", "(", ")", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "ClasspathChange", "classpathChange", "=", "manager", ".", "deltaState", ".", "addClasspathChange", "(", "this", ".", "project", ",", "this", ".", "rawClasspath", ",", "this", ".", "outputLocation", ",", "this", ".", "resolvedClasspath", ")", ";", "return", "classpathChange", ";", "}", "public", "ClasspathChange", "setRawClasspath", "(", "IClasspathEntry", "[", "]", "newRawClasspath", ",", "IPath", "newOutputLocation", ",", "IJavaModelStatus", "newRawClasspathStatus", ")", "{", "return", "setRawClasspath", "(", "newRawClasspath", ",", "null", ",", "newOutputLocation", ",", "newRawClasspathStatus", ")", ";", "}", "public", "synchronized", "ClasspathChange", "setRawClasspath", "(", "IClasspathEntry", "[", "]", "newRawClasspath", ",", "IClasspathEntry", "[", "]", "referencedEntries", ",", "IPath", "newOutputLocation", ",", "IJavaModelStatus", "newRawClasspathStatus", ")", "{", "this", ".", "rawTimeStamp", "++", ";", "return", "setClasspath", "(", "newRawClasspath", ",", "referencedEntries", ",", "newOutputLocation", ",", "newRawClasspathStatus", ",", "null", ",", "null", ",", "null", ",", "null", ",", "true", ")", ";", "}", "public", "ClasspathChange", "setResolvedClasspath", "(", "IClasspathEntry", "[", "]", "newResolvedClasspath", ",", "Map", "newRootPathToRawEntries", ",", "Map", "newRootPathToResolvedEntries", ",", "IJavaModelStatus", "newUnresolvedEntryStatus", ",", "int", "timeStamp", ",", "boolean", "addClasspathChange", ")", "{", "return", "setResolvedClasspath", "(", "newResolvedClasspath", ",", "null", ",", "newRootPathToRawEntries", ",", "newRootPathToResolvedEntries", ",", "newUnresolvedEntryStatus", ",", "timeStamp", ",", "addClasspathChange", ")", ";", "}", "public", "synchronized", "ClasspathChange", "setResolvedClasspath", "(", "IClasspathEntry", "[", "]", "newResolvedClasspath", ",", "IClasspathEntry", "[", "]", "referencedEntries", ",", "Map", "newRootPathToRawEntries", ",", "Map", "newRootPathToResolvedEntries", ",", "IJavaModelStatus", "newUnresolvedEntryStatus", ",", "int", "timeStamp", ",", "boolean", "addClasspathChange", ")", "{", "if", "(", "this", ".", "rawTimeStamp", "!=", "timeStamp", ")", "return", "null", ";", "return", "setClasspath", "(", "this", ".", "rawClasspath", ",", "referencedEntries", ",", "this", ".", "outputLocation", ",", "this", ".", "rawClasspathStatus", ",", "newResolvedClasspath", ",", "newRootPathToRawEntries", ",", "newRootPathToResolvedEntries", ",", "newUnresolvedEntryStatus", ",", "addClasspathChange", ")", ";", "}", "public", "synchronized", "IClasspathEntry", "[", "]", "[", "]", "readAndCacheClasspath", "(", "JavaProject", "javaProject", ")", "{", "IClasspathEntry", "[", "]", "[", "]", "classpath", ";", "IJavaModelStatus", "status", ";", "try", "{", "classpath", "=", "javaProject", ".", "readFileEntriesWithException", "(", "null", ")", ";", "status", "=", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "classpath", "=", "new", "IClasspathEntry", "[", "]", "[", "]", "{", "JavaProject", ".", "INVALID_CLASSPATH", ",", "ClasspathEntry", ".", "NO_ENTRIES", "}", ";", "status", "=", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH_FILE_FORMAT", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotReadClasspathFile", ",", "javaProject", ".", "getElementName", "(", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "classpath", "=", "new", "IClasspathEntry", "[", "]", "[", "]", "{", "JavaProject", ".", "INVALID_CLASSPATH", ",", "ClasspathEntry", ".", "NO_ENTRIES", "}", ";", "if", "(", "Messages", ".", "file_badFormat", ".", "equals", "(", "e", ".", "getMessage", "(", ")", ")", ")", "status", "=", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH_FILE_FORMAT", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_xmlFormatError", ",", "javaProject", ".", "getElementName", "(", ")", ",", "Messages", ".", "file_badFormat", ")", ")", ";", "else", "status", "=", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH_FILE_FORMAT", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_cannotReadClasspathFile", ",", "javaProject", ".", "getElementName", "(", ")", ")", ")", ";", "}", "catch", "(", "ClasspathEntry", ".", "AssertionFailedException", "e", ")", "{", "classpath", "=", "new", "IClasspathEntry", "[", "]", "[", "]", "{", "JavaProject", ".", "INVALID_CLASSPATH", ",", "ClasspathEntry", ".", "NO_ENTRIES", "}", ";", "status", "=", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CLASSPATH_FILE_FORMAT", ",", "Messages", ".", "bind", "(", "Messages", ".", "classpath_illegalEntryInClasspathFile", ",", "new", "String", "[", "]", "{", "javaProject", ".", "getElementName", "(", ")", ",", "e", ".", "getMessage", "(", ")", "}", ")", ")", ";", "}", "int", "rawClasspathLength", "=", "classpath", "[", "0", "]", ".", "length", ";", "IPath", "output", "=", "null", ";", "if", "(", "rawClasspathLength", ">", "0", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "0", "]", "[", "rawClasspathLength", "-", "1", "]", ";", "if", "(", "entry", ".", "getContentKind", "(", ")", "==", "ClasspathEntry", ".", "K_OUTPUT", ")", "{", "output", "=", "entry", ".", "getPath", "(", ")", ";", "IClasspathEntry", "[", "]", "copy", "=", "new", "IClasspathEntry", "[", "rawClasspathLength", "-", "1", "]", ";", "System", ".", "arraycopy", "(", "classpath", "[", "0", "]", ",", "0", ",", "copy", ",", "0", ",", "copy", ".", "length", ")", ";", "classpath", "[", "0", "]", "=", "copy", ";", "}", "}", "setRawClasspath", "(", "classpath", "[", "0", "]", ",", "classpath", "[", "1", "]", ",", "output", ",", "status", ")", ";", "return", "classpath", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"Info", "for", "\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "project", ".", "getFullPath", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "rawClasspath", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"", "<null>n\"", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "rawClasspath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "rawClasspath", "[", "i", "]", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "}", "buffer", ".", "append", "(", "\"\"", ")", ";", "IClasspathEntry", "[", "]", "resolvedCP", "=", "this", ".", "resolvedClasspath", ";", "if", "(", "resolvedCP", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"", "<null>n\"", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "resolvedCP", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "buffer", ".", "append", "(", "resolvedCP", "[", "i", "]", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "}", "buffer", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "unresolvedEntryStatus", "==", "NEED_RESOLUTION", ")", "buffer", ".", "append", "(", "\"\"", ")", ";", "else", "buffer", ".", "append", "(", "this", ".", "unresolvedEntryStatus", "==", "null", "?", "\"<null>n\"", ":", "this", ".", "unresolvedEntryStatus", ".", "toString", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "if", "(", "this", ".", "outputLocation", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"<null>\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "outputLocation", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "public", "boolean", "writeAndCacheClasspath", "(", "JavaProject", "javaProject", ",", "final", "IClasspathEntry", "[", "]", "newRawClasspath", ",", "IClasspathEntry", "[", "]", "newReferencedEntries", ",", "final", "IPath", "newOutputLocation", ")", "throws", "JavaModelException", "{", "try", "{", "this", ".", "writtingRawClasspath", "=", "true", ";", "if", "(", "newReferencedEntries", "==", "null", ")", "newReferencedEntries", "=", "this", ".", "referencedEntries", ";", "if", "(", "!", "javaProject", ".", "writeFileEntries", "(", "newRawClasspath", ",", "newReferencedEntries", ",", "newOutputLocation", ")", ")", "{", "return", "false", ";", "}", "setRawClasspath", "(", "newRawClasspath", ",", "newReferencedEntries", ",", "newOutputLocation", ",", "JavaModelStatus", ".", "VERIFIED_OK", ")", ";", "}", "finally", "{", "this", ".", "writtingRawClasspath", "=", "false", ";", "}", "return", "true", ";", "}", "public", "boolean", "writeAndCacheClasspath", "(", "JavaProject", "javaProject", ",", "final", "IClasspathEntry", "[", "]", "newRawClasspath", ",", "final", "IPath", "newOutputLocation", ")", "throws", "JavaModelException", "{", "return", "writeAndCacheClasspath", "(", "javaProject", ",", "newRawClasspath", ",", "null", ",", "newOutputLocation", ")", ";", "}", "}", "public", "static", "class", "PerWorkingCopyInfo", "implements", "IProblemRequestor", "{", "int", "useCount", "=", "0", ";", "IProblemRequestor", "problemRequestor", ";", "CompilationUnit", "workingCopy", ";", "public", "PerWorkingCopyInfo", "(", "CompilationUnit", "workingCopy", ",", "IProblemRequestor", "problemRequestor", ")", "{", "this", ".", "workingCopy", "=", "workingCopy", ";", "this", ".", "problemRequestor", "=", "problemRequestor", ";", "}", "public", "void", "acceptProblem", "(", "IProblem", "problem", ")", "{", "IProblemRequestor", "requestor", "=", "getProblemRequestor", "(", ")", ";", "if", "(", "requestor", "==", "null", ")", "return", ";", "requestor", ".", "acceptProblem", "(", "problem", ")", ";", "}", "public", "void", "beginReporting", "(", ")", "{", "IProblemRequestor", "requestor", "=", "getProblemRequestor", "(", ")", ";", "if", "(", "requestor", "==", "null", ")", "return", ";", "requestor", ".", "beginReporting", "(", ")", ";", "}", "public", "void", "endReporting", "(", ")", "{", "IProblemRequestor", "requestor", "=", "getProblemRequestor", "(", ")", ";", "if", "(", "requestor", "==", "null", ")", "return", ";", "requestor", ".", "endReporting", "(", ")", ";", "}", "public", "IProblemRequestor", "getProblemRequestor", "(", ")", "{", "if", "(", "this", ".", "problemRequestor", "==", "null", "&&", "this", ".", "workingCopy", ".", "owner", "!=", "null", ")", "{", "return", "this", ".", "workingCopy", ".", "owner", ".", "getProblemRequestor", "(", "this", ".", "workingCopy", ")", ";", "}", "return", "this", ".", "problemRequestor", ";", "}", "public", "ICompilationUnit", "getWorkingCopy", "(", ")", "{", "return", "this", ".", "workingCopy", ";", "}", "public", "boolean", "isActive", "(", ")", "{", "IProblemRequestor", "requestor", "=", "getProblemRequestor", "(", ")", ";", "return", "requestor", "!=", "null", "&&", "requestor", ".", "isActive", "(", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"Info", "for", "\"", ")", ";", "buffer", ".", "append", "(", "(", "(", "JavaElement", ")", "this", ".", "workingCopy", ")", ".", "toStringWithAncestors", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "useCount", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "problemRequestor", ")", ";", "if", "(", "this", ".", "problemRequestor", "==", "null", ")", "{", "IProblemRequestor", "requestor", "=", "getProblemRequestor", "(", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "requestor", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "public", "static", "boolean", "VERBOSE", "=", "false", ";", "public", "static", "boolean", "CP_RESOLVE_VERBOSE", "=", "false", ";", "public", "static", "boolean", "CP_RESOLVE_VERBOSE_ADVANCED", "=", "false", ";", "public", "static", "boolean", "CP_RESOLVE_VERBOSE_FAILURE", "=", "false", ";", "public", "static", "boolean", "ZIP_ACCESS_VERBOSE", "=", "false", ";", "private", "ThreadLocal", "zipFiles", "=", "new", "ThreadLocal", "(", ")", ";", "private", "UserLibraryManager", "userLibraryManager", ";", "private", "Set", "nonChainingJars", ";", "private", "Set", "invalidArchives", ";", "public", "static", "class", "EclipsePreferencesListener", "implements", "IEclipsePreferences", ".", "IPreferenceChangeListener", "{", "public", "void", "preferenceChange", "(", "IEclipsePreferences", ".", "PreferenceChangeEvent", "event", ")", "{", "String", "propertyName", "=", "event", ".", "getKey", "(", ")", ";", "if", "(", "propertyName", ".", "startsWith", "(", "JavaCore", ".", "PLUGIN_ID", ")", ")", "{", "if", "(", "propertyName", ".", "startsWith", "(", "CP_VARIABLE_PREFERENCES_PREFIX", ")", ")", "{", "String", "varName", "=", "propertyName", ".", "substring", "(", "CP_VARIABLE_PREFERENCES_PREFIX", ".", "length", "(", ")", ")", ";", "JavaModelManager", "manager", "=", "getJavaModelManager", "(", ")", ";", "if", "(", "manager", ".", "variablesWithInitializer", ".", "contains", "(", "varName", ")", ")", "{", "String", "oldValue", "=", "(", "String", ")", "event", ".", "getOldValue", "(", ")", ";", "if", "(", "oldValue", "==", "null", ")", "{", "manager", ".", "variablesWithInitializer", ".", "remove", "(", "varName", ")", ";", "}", "else", "{", "manager", ".", "getInstancePreferences", "(", ")", ".", "put", "(", "varName", ",", "oldValue", ")", ";", "}", "}", "else", "{", "String", "newValue", "=", "(", "String", ")", "event", ".", "getNewValue", "(", ")", ";", "IPath", "newPath", ";", "if", "(", "newValue", "!=", "null", "&&", "!", "(", "newValue", "=", "newValue", ".", "trim", "(", ")", ")", ".", "equals", "(", "CP_ENTRY_IGNORE", ")", ")", "{", "newPath", "=", "new", "Path", "(", "newValue", ")", ";", "}", "else", "{", "newPath", "=", "null", ";", "}", "try", "{", "SetVariablesOperation", "operation", "=", "new", "SetVariablesOperation", "(", "new", "String", "[", "]", "{", "varName", "}", ",", "new", "IPath", "[", "]", "{", "newPath", "}", ",", "false", ")", ";", "operation", ".", "runOperation", "(", "null", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", "+", "varName", "+", "\"", "to", "\"", "+", "newPath", ")", ";", "}", "}", "}", "else", "if", "(", "propertyName", ".", "startsWith", "(", "CP_CONTAINER_PREFERENCES_PREFIX", ")", ")", "{", "recreatePersistedContainer", "(", "propertyName", ",", "(", "String", ")", "event", ".", "getNewValue", "(", ")", ",", "false", ")", ";", "}", "else", "if", "(", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_RESOURCE_COPY_FILTER", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_DUPLICATE_RESOURCE", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_JAVA_BUILD_INVALID_CLASSPATH", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_INCOMPLETE_CLASSPATH", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_CIRCULAR_CLASSPATH", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_INCOMPATIBLE_JDK_LEVEL", ")", "||", "propertyName", ".", "equals", "(", "JavaCore", ".", "CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ")", ")", "{", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "IJavaModel", "model", "=", "manager", ".", "getJavaModel", "(", ")", ";", "IJavaProject", "[", "]", "projects", ";", "try", "{", "projects", "=", "model", ".", "getJavaProjects", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "pl", "=", "projects", ".", "length", ";", "i", "<", "pl", ";", "i", "++", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "projects", "[", "i", "]", ";", "manager", ".", "deltaState", ".", "addClasspathValidation", "(", "javaProject", ")", ";", "try", "{", "javaProject", ".", "getProject", "(", ")", ".", "touch", "(", "null", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "else", "if", "(", "propertyName", ".", "startsWith", "(", "CP_USERLIBRARY_PREFERENCES_PREFIX", ")", ")", "{", "String", "libName", "=", "propertyName", ".", "substring", "(", "CP_USERLIBRARY_PREFERENCES_PREFIX", ".", "length", "(", ")", ")", ";", "UserLibraryManager", "manager", "=", "JavaModelManager", ".", "getUserLibraryManager", "(", ")", ";", "manager", ".", "updateUserLibrary", "(", "libName", ",", "(", "String", ")", "event", ".", "getNewValue", "(", ")", ")", ";", "}", "}", "try", "{", "IJavaProject", "[", "]", "projects", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProjects", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "(", "(", "JavaProject", ")", "projects", "[", "i", "]", ")", ".", "resetCaches", "(", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "EclipsePreferencesListener", "instancePreferencesListener", "=", "new", "EclipsePreferencesListener", "(", ")", ";", "IEclipsePreferences", ".", "INodeChangeListener", "instanceNodeListener", "=", "new", "IEclipsePreferences", ".", "INodeChangeListener", "(", ")", "{", "public", "void", "added", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "}", "public", "void", "removed", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "if", "(", "event", ".", "getChild", "(", ")", "==", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ")", "{", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", "=", "InstanceScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ".", "addPreferenceChangeListener", "(", "new", "EclipsePreferencesListener", "(", ")", ")", ";", "}", "}", "}", ";", "IEclipsePreferences", ".", "INodeChangeListener", "defaultNodeListener", "=", "new", "IEclipsePreferences", ".", "INodeChangeListener", "(", ")", "{", "public", "void", "added", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "}", "public", "void", "removed", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "if", "(", "event", ".", "getChild", "(", ")", "==", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", ")", "{", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", "=", "DefaultScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "}", "}", "}", ";", "IEclipsePreferences", ".", "IPreferenceChangeListener", "propertyListener", ";", "IEclipsePreferences", ".", "IPreferenceChangeListener", "resourcesPropertyListener", ";", "private", "JavaModelManager", "(", ")", "{", "if", "(", "Platform", ".", "isRunning", "(", ")", ")", "{", "this", ".", "indexManager", "=", "new", "IndexManager", "(", ")", ";", "this", ".", "nonChainingJars", "=", "loadClasspathListCache", "(", "NON_CHAINING_JARS_CACHE", ")", ";", "this", ".", "invalidArchives", "=", "loadClasspathListCache", "(", "INVALID_ARCHIVES_CACHE", ")", ";", "String", "includeContainerReferencedLib", "=", "System", ".", "getProperty", "(", "RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS", ")", ";", "this", ".", "resolveReferencedLibrariesForContainers", "=", "TRUE", ".", "equalsIgnoreCase", "(", "includeContainerReferencedLib", ")", ";", "}", "}", "private", "void", "addDeprecatedOptions", "(", "Hashtable", "options", ")", "{", "options", ".", "put", "(", "JavaCore", ".", "COMPILER_PB_INVALID_IMPORT", ",", "JavaCore", ".", "ERROR", ")", ";", "options", ".", "put", "(", "JavaCore", ".", "COMPILER_PB_UNREACHABLE_CODE", ",", "JavaCore", ".", "ERROR", ")", ";", "}", "public", "void", "addNonChainingJar", "(", "IPath", "path", ")", "{", "if", "(", "this", ".", "nonChainingJars", "!=", "null", ")", "this", ".", "nonChainingJars", ".", "add", "(", "path", ")", ";", "}", "public", "void", "addInvalidArchive", "(", "IPath", "path", ")", "{", "if", "(", "this", ".", "invalidArchives", "==", "null", ")", "{", "this", ".", "invalidArchives", "=", "Collections", ".", "synchronizedSet", "(", "new", "HashSet", "(", ")", ")", ";", "}", "if", "(", "this", ".", "invalidArchives", "!=", "null", ")", "{", "this", ".", "invalidArchives", ".", "add", "(", "path", ")", ";", "}", "}", "public", "void", "cacheZipFiles", "(", "Object", "owner", ")", "{", "ZipCache", "zipCache", "=", "(", "ZipCache", ")", "this", ".", "zipFiles", ".", "get", "(", ")", ";", "if", "(", "zipCache", "!=", "null", ")", "{", "return", ";", "}", "this", ".", "zipFiles", ".", "set", "(", "new", "ZipCache", "(", "owner", ")", ")", ";", "}", "public", "void", "closeZipFile", "(", "ZipFile", "zipFile", ")", "{", "if", "(", "zipFile", "==", "null", ")", "return", ";", "if", "(", "this", ".", "zipFiles", ".", "get", "(", ")", "!=", "null", ")", "{", "return", ";", "}", "try", "{", "if", "(", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "zipFile", ".", "getName", "(", ")", ")", ";", "}", "zipFile", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "public", "void", "configurePluginDebugOptions", "(", ")", "{", "if", "(", "JavaCore", ".", "getPlugin", "(", ")", ".", "isDebugging", "(", ")", ")", "{", "String", "option", "=", "Platform", ".", "getDebugOption", "(", "BUFFER_MANAGER_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "BufferManager", ".", "VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "BUILDER_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaBuilder", ".", "DEBUG", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "COMPILER_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "Compiler", ".", "DEBUG", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "BUILDER_STATS_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaBuilder", ".", "SHOW_STATS", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "COMPLETION_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "CompletionEngine", ".", "DEBUG", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "CP_RESOLVE_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "CP_RESOLVE_ADVANCED_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_ADVANCED", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "CP_RESOLVE_FAILURE_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "DELTA_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "DeltaProcessor", ".", "DEBUG", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "DELTA_DEBUG_VERBOSE", ")", ";", "if", "(", "option", "!=", "null", ")", "DeltaProcessor", ".", "VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "HIERARCHY_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "TypeHierarchy", ".", "DEBUG", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "INDEX_MANAGER_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JobManager", ".", "VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "INDEX_MANAGER_ADVANCED_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "IndexManager", ".", "DEBUG", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "JAVAMODEL_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaModelManager", ".", "VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "JAVAMODELCACHE_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaModelCache", ".", "VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "POST_ACTION_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaModelOperation", ".", "POST_ACTION_VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "RESOLUTION_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "NameLookup", ".", "VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "SEARCH_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "BasicSearchEngine", ".", "VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "SELECTION_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "SelectionEngine", ".", "DEBUG", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "ZIP_ACCESS_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "SOURCE_MAPPER_DEBUG_VERBOSE", ")", ";", "if", "(", "option", "!=", "null", ")", "SourceMapper", ".", "VERBOSE", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "option", "=", "Platform", ".", "getDebugOption", "(", "FORMATTER_DEBUG", ")", ";", "if", "(", "option", "!=", "null", ")", "DefaultCodeFormatter", ".", "DEBUG", "=", "option", ".", "equalsIgnoreCase", "(", "TRUE", ")", ";", "}", "if", "(", "PerformanceStats", ".", "ENABLED", ")", "{", "CompletionEngine", ".", "PERF", "=", "PerformanceStats", ".", "isEnabled", "(", "COMPLETION_PERF", ")", ";", "SelectionEngine", ".", "PERF", "=", "PerformanceStats", ".", "isEnabled", "(", "SELECTION_PERF", ")", ";", "DeltaProcessor", ".", "PERF", "=", "PerformanceStats", ".", "isEnabled", "(", "DELTA_LISTENER_PERF", ")", ";", "JavaModelManager", ".", "PERF_VARIABLE_INITIALIZER", "=", "PerformanceStats", ".", "isEnabled", "(", "VARIABLE_INITIALIZER_PERF", ")", ";", "JavaModelManager", ".", "PERF_CONTAINER_INITIALIZER", "=", "PerformanceStats", ".", "isEnabled", "(", "CONTAINER_INITIALIZER_PERF", ")", ";", "ReconcileWorkingCopyOperation", ".", "PERF", "=", "PerformanceStats", ".", "isEnabled", "(", "RECONCILE_PERF", ")", ";", "}", "}", "public", "AbstractAnnotationProcessorManager", "createAnnotationProcessorManager", "(", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "annotationProcessorManagerFactory", "==", "null", ")", "{", "IExtensionPoint", "extension", "=", "Platform", ".", "getExtensionRegistry", "(", ")", ".", "getExtensionPoint", "(", "JavaCore", ".", "PLUGIN_ID", ",", "ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID", ")", ";", "if", "(", "extension", "==", "null", ")", "return", "null", ";", "IExtension", "[", "]", "extensions", "=", "extension", ".", "getExtensions", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extensions", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", ">", "0", ")", "{", "Util", ".", "log", "(", "null", ",", "\"\"", "+", "extensions", "[", "i", "]", ".", "getUniqueIdentifier", "(", ")", ")", ";", "break", ";", "}", "IConfigurationElement", "[", "]", "configElements", "=", "extensions", "[", "i", "]", ".", "getConfigurationElements", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "configElements", ".", "length", ";", "j", "++", ")", "{", "final", "IConfigurationElement", "configElement", "=", "configElements", "[", "j", "]", ";", "if", "(", "\"\"", ".", "equals", "(", "configElement", ".", "getName", "(", ")", ")", ")", "{", "this", ".", "annotationProcessorManagerFactory", "=", "configElement", ";", "break", ";", "}", "}", "}", "}", "}", "if", "(", "this", ".", "annotationProcessorManagerFactory", "==", "null", ")", "{", "return", "null", ";", "}", "final", "AbstractAnnotationProcessorManager", "[", "]", "apm", "=", "new", "AbstractAnnotationProcessorManager", "[", "1", "]", ";", "apm", "[", "0", "]", "=", "null", ";", "final", "IConfigurationElement", "factory", "=", "this", ".", "annotationProcessorManagerFactory", ";", "SafeRunner", ".", "run", "(", "new", "ISafeRunnable", "(", ")", "{", "public", "void", "handleException", "(", "Throwable", "exception", ")", "{", "Util", ".", "log", "(", "exception", ",", "\"\"", ")", ";", "}", "public", "void", "run", "(", ")", "throws", "Exception", "{", "Object", "executableExtension", "=", "factory", ".", "createExecutableExtension", "(", "\"class\"", ")", ";", "if", "(", "executableExtension", "instanceof", "AbstractAnnotationProcessorManager", ")", "{", "apm", "[", "0", "]", "=", "(", "AbstractAnnotationProcessorManager", ")", "executableExtension", ";", "}", "}", "}", ")", ";", "return", "apm", "[", "0", "]", ";", "}", "public", "int", "discardPerWorkingCopyInfo", "(", "CompilationUnit", "workingCopy", ")", "throws", "JavaModelException", "{", "JavaElementDeltaBuilder", "deltaBuilder", "=", "null", ";", "if", "(", "workingCopy", ".", "isPrimary", "(", ")", "&&", "workingCopy", ".", "hasUnsavedChanges", "(", ")", ")", "{", "deltaBuilder", "=", "new", "JavaElementDeltaBuilder", "(", "workingCopy", ")", ";", "}", "PerWorkingCopyInfo", "info", "=", "null", ";", "synchronized", "(", "this", ".", "perWorkingCopyInfos", ")", "{", "WorkingCopyOwner", "owner", "=", "workingCopy", ".", "owner", ";", "Map", "workingCopyToInfos", "=", "(", "Map", ")", "this", ".", "perWorkingCopyInfos", ".", "get", "(", "owner", ")", ";", "if", "(", "workingCopyToInfos", "==", "null", ")", "return", "-", "1", ";", "info", "=", "(", "PerWorkingCopyInfo", ")", "workingCopyToInfos", ".", "get", "(", "workingCopy", ")", ";", "if", "(", "info", "==", "null", ")", "return", "-", "1", ";", "if", "(", "--", "info", ".", "useCount", "==", "0", ")", "{", "workingCopyToInfos", ".", "remove", "(", "workingCopy", ")", ";", "if", "(", "workingCopyToInfos", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "perWorkingCopyInfos", ".", "remove", "(", "owner", ")", ";", "}", "}", "}", "if", "(", "info", ".", "useCount", "==", "0", ")", "{", "removeInfoAndChildren", "(", "workingCopy", ")", ";", "workingCopy", ".", "closeBuffer", "(", ")", ";", "if", "(", "deltaBuilder", "!=", "null", ")", "{", "deltaBuilder", ".", "buildDeltas", "(", ")", ";", "if", "(", "deltaBuilder", ".", "delta", "!=", "null", ")", "{", "getDeltaProcessor", "(", ")", ".", "registerJavaModelDelta", "(", "deltaBuilder", ".", "delta", ")", ";", "}", "}", "}", "return", "info", ".", "useCount", ";", "}", "public", "void", "doneSaving", "(", "ISaveContext", "context", ")", "{", "}", "public", "void", "flushZipFiles", "(", "Object", "owner", ")", "{", "ZipCache", "zipCache", "=", "(", "ZipCache", ")", "this", ".", "zipFiles", ".", "get", "(", ")", ";", "if", "(", "zipCache", "==", "null", ")", "{", "return", ";", "}", "if", "(", "zipCache", ".", "owner", "==", "owner", ")", "{", "this", ".", "zipFiles", ".", "set", "(", "null", ")", ";", "zipCache", ".", "flush", "(", ")", ";", "}", "}", "public", "synchronized", "boolean", "forceBatchInitializations", "(", "boolean", "initAfterLoad", ")", "{", "switch", "(", "this", ".", "batchContainerInitializations", ")", "{", "case", "NO_BATCH_INITIALIZATION", ":", "this", ".", "batchContainerInitializations", "=", "NEED_BATCH_INITIALIZATION", ";", "return", "true", ";", "case", "BATCH_INITIALIZATION_FINISHED", ":", "if", "(", "initAfterLoad", ")", "return", "false", ";", "this", ".", "batchContainerInitializations", "=", "NEED_BATCH_INITIALIZATION", ";", "return", "true", ";", "}", "return", "false", ";", "}", "private", "synchronized", "boolean", "batchContainerInitializations", "(", ")", "{", "switch", "(", "this", ".", "batchContainerInitializations", ")", "{", "case", "NEED_BATCH_INITIALIZATION", ":", "this", ".", "batchContainerInitializations", "=", "BATCH_INITIALIZATION_IN_PROGRESS", ";", "return", "true", ";", "case", "BATCH_INITIALIZATION_IN_PROGRESS", ":", "return", "true", ";", "}", "return", "false", ";", "}", "private", "synchronized", "void", "batchInitializationFinished", "(", ")", "{", "this", ".", "batchContainerInitializations", "=", "BATCH_INITIALIZATION_FINISHED", ";", "}", "public", "IClasspathContainer", "getClasspathContainer", "(", "final", "IPath", "containerPath", ",", "final", "IJavaProject", "project", ")", "throws", "JavaModelException", "{", "IClasspathContainer", "container", "=", "containerGet", "(", "project", ",", "containerPath", ")", ";", "if", "(", "container", "==", "null", ")", "{", "if", "(", "batchContainerInitializations", "(", ")", ")", "{", "try", "{", "container", "=", "initializeAllContainers", "(", "project", ",", "containerPath", ")", ";", "}", "finally", "{", "batchInitializationFinished", "(", ")", ";", "}", "}", "else", "{", "container", "=", "initializeContainer", "(", "project", ",", "containerPath", ")", ";", "containerBeingInitializedRemove", "(", "project", ",", "containerPath", ")", ";", "SetContainerOperation", "operation", "=", "new", "SetContainerOperation", "(", "containerPath", ",", "new", "IJavaProject", "[", "]", "{", "project", "}", ",", "new", "IClasspathContainer", "[", "]", "{", "container", "}", ")", ";", "operation", ".", "runOperation", "(", "null", ")", ";", "}", "}", "return", "container", ";", "}", "public", "IClasspathEntry", "[", "]", "getReferencedClasspathEntries", "(", "IClasspathEntry", "libraryEntry", ",", "IJavaProject", "project", ")", "{", "IClasspathEntry", "[", "]", "referencedEntries", "=", "(", "(", "ClasspathEntry", ")", "libraryEntry", ")", ".", "resolvedChainedLibraries", "(", ")", ";", "if", "(", "project", "==", "null", ")", "return", "referencedEntries", ";", "PerProjectInfo", "perProjectInfo", "=", "getPerProjectInfo", "(", "project", ".", "getProject", "(", ")", ",", "false", ")", ";", "if", "(", "perProjectInfo", "==", "null", ")", "return", "referencedEntries", ";", "List", "pathToReferencedEntries", "=", "new", "ArrayList", "(", "referencedEntries", ".", "length", ")", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "referencedEntries", ".", "length", ";", "index", "++", ")", "{", "if", "(", "pathToReferencedEntries", ".", "contains", "(", "referencedEntries", "[", "index", "]", ".", "getPath", "(", ")", ")", ")", "continue", ";", "IClasspathEntry", "persistedEntry", "=", "null", ";", "if", "(", "(", "persistedEntry", "=", "(", "IClasspathEntry", ")", "perProjectInfo", ".", "rootPathToResolvedEntries", ".", "get", "(", "referencedEntries", "[", "index", "]", ".", "getPath", "(", ")", ")", ")", "!=", "null", ")", "{", "referencedEntries", "[", "index", "]", "=", "persistedEntry", ";", "}", "pathToReferencedEntries", ".", "add", "(", "referencedEntries", "[", "index", "]", ".", "getPath", "(", ")", ")", ";", "}", "return", "referencedEntries", ";", "}", "public", "DeltaProcessor", "getDeltaProcessor", "(", ")", "{", "return", "this", ".", "deltaState", ".", "getDeltaProcessor", "(", ")", ";", "}", "public", "static", "DeltaProcessingState", "getDeltaState", "(", ")", "{", "return", "MANAGER", ".", "deltaState", ";", "}", "protected", "HashSet", "getElementsOutOfSynchWithBuffers", "(", ")", "{", "return", "this", ".", "elementsOutOfSynchWithBuffers", ";", "}", "public", "static", "ExternalFoldersManager", "getExternalManager", "(", ")", "{", "return", "MANAGER", ".", "externalFoldersManager", ";", "}", "public", "static", "IndexManager", "getIndexManager", "(", ")", "{", "return", "MANAGER", ".", "indexManager", ";", "}", "public", "synchronized", "Object", "getInfo", "(", "IJavaElement", "element", ")", "{", "HashMap", "tempCache", "=", "(", "HashMap", ")", "this", ".", "temporaryCache", ".", "get", "(", ")", ";", "if", "(", "tempCache", "!=", "null", ")", "{", "Object", "result", "=", "tempCache", ".", "get", "(", "element", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "}", "return", "this", ".", "cache", ".", "getInfo", "(", "element", ")", ";", "}", "public", "synchronized", "IJavaElement", "getExistingElement", "(", "IJavaElement", "element", ")", "{", "return", "this", ".", "cache", ".", "getExistingElement", "(", "element", ")", ";", "}", "public", "HashSet", "getExternalWorkingCopyProjects", "(", ")", "{", "synchronized", "(", "this", ".", "perWorkingCopyInfos", ")", "{", "HashSet", "result", "=", "null", ";", "Iterator", "values", "=", "this", ".", "perWorkingCopyInfos", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "values", ".", "hasNext", "(", ")", ")", "{", "Map", "ownerCopies", "=", "(", "Map", ")", "values", ".", "next", "(", ")", ";", "Iterator", "workingCopies", "=", "ownerCopies", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "workingCopies", ".", "hasNext", "(", ")", ")", "{", "ICompilationUnit", "workingCopy", "=", "(", "ICompilationUnit", ")", "workingCopies", ".", "next", "(", ")", ";", "IJavaProject", "project", "=", "workingCopy", ".", "getJavaProject", "(", ")", ";", "if", "(", "project", ".", "getElementName", "(", ")", ".", "equals", "(", "ExternalJavaProject", ".", "EXTERNAL_PROJECT_NAME", ")", ")", "{", "if", "(", "result", "==", "null", ")", "result", "=", "new", "HashSet", "(", ")", ";", "result", ".", "add", "(", "project", ")", ";", "}", "}", "}", "return", "result", ";", "}", "}", "public", "IEclipsePreferences", "getInstancePreferences", "(", ")", "{", "return", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ";", "}", "public", "Hashtable", "getDefaultOptions", "(", ")", "{", "Hashtable", "defaultOptions", "=", "new", "Hashtable", "(", "10", ")", ";", "IEclipsePreferences", "defaultPreferences", "=", "getDefaultPreferences", "(", ")", ";", "Iterator", "iterator", "=", "this", ".", "optionNames", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "String", "propertyName", "=", "(", "String", ")", "iterator", ".", "next", "(", ")", ";", "String", "value", "=", "defaultPreferences", ".", "get", "(", "propertyName", ",", "null", ")", ";", "if", "(", "value", "!=", "null", ")", "defaultOptions", ".", "put", "(", "propertyName", ",", "value", ")", ";", "}", "defaultOptions", ".", "put", "(", "JavaCore", ".", "CORE_ENCODING", ",", "JavaCore", ".", "getEncoding", "(", ")", ")", ";", "addDeprecatedOptions", "(", "defaultOptions", ")", ";", "return", "defaultOptions", ";", "}", "public", "IEclipsePreferences", "getDefaultPreferences", "(", ")", "{", "return", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", ";", "}", "public", "final", "JavaModel", "getJavaModel", "(", ")", "{", "return", "this", ".", "javaModel", ";", "}", "public", "final", "static", "JavaModelManager", "getJavaModelManager", "(", ")", "{", "return", "MANAGER", ";", "}", "public", "Object", "getLastBuiltState", "(", "IProject", "project", ",", "IProgressMonitor", "monitor", ")", "{", "if", "(", "!", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "project", "+", "\"\"", ")", ";", "return", "null", ";", "}", "PerProjectInfo", "info", "=", "getPerProjectInfo", "(", "project", ",", "true", ")", ";", "if", "(", "!", "info", ".", "triedRead", ")", "{", "info", ".", "triedRead", "=", "true", ";", "try", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "subTask", "(", "Messages", ".", "bind", "(", "Messages", ".", "build_readStateProgress", ",", "project", ".", "getName", "(", ")", ")", ")", ";", "info", ".", "savedState", "=", "readState", "(", "project", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "info", ".", "savedState", ";", "}", "public", "String", "getOption", "(", "String", "optionName", ")", "{", "if", "(", "JavaCore", ".", "CORE_ENCODING", ".", "equals", "(", "optionName", ")", ")", "{", "return", "JavaCore", ".", "getEncoding", "(", ")", ";", "}", "if", "(", "isDeprecatedOption", "(", "optionName", ")", ")", "{", "return", "JavaCore", ".", "ERROR", ";", "}", "int", "optionLevel", "=", "getOptionLevel", "(", "optionName", ")", ";", "if", "(", "optionLevel", "!=", "UNKNOWN_OPTION", ")", "{", "IPreferencesService", "service", "=", "Platform", ".", "getPreferencesService", "(", ")", ";", "String", "value", "=", "service", ".", "get", "(", "optionName", ",", "null", ",", "this", ".", "preferencesLookup", ")", ";", "if", "(", "value", "==", "null", "&&", "optionLevel", "==", "DEPRECATED_OPTION", ")", "{", "String", "[", "]", "compatibleOptions", "=", "(", "String", "[", "]", ")", "this", ".", "deprecatedOptions", ".", "get", "(", "optionName", ")", ";", "value", "=", "service", ".", "get", "(", "compatibleOptions", "[", "0", "]", ",", "null", ",", "this", ".", "preferencesLookup", ")", ";", "}", "return", "value", "==", "null", "?", "null", ":", "value", ".", "trim", "(", ")", ";", "}", "return", "null", ";", "}", "public", "String", "getOption", "(", "String", "optionName", ",", "boolean", "inheritJavaCoreOptions", ",", "IEclipsePreferences", "projectPreferences", ")", "{", "switch", "(", "getOptionLevel", "(", "optionName", ")", ")", "{", "case", "VALID_OPTION", ":", "String", "javaCoreDefault", "=", "inheritJavaCoreOptions", "?", "JavaCore", ".", "getOption", "(", "optionName", ")", ":", "null", ";", "if", "(", "projectPreferences", "==", "null", ")", "return", "javaCoreDefault", ";", "String", "value", "=", "projectPreferences", ".", "get", "(", "optionName", ",", "javaCoreDefault", ")", ";", "return", "value", "==", "null", "?", "null", ":", "value", ".", "trim", "(", ")", ";", "case", "DEPRECATED_OPTION", ":", "String", "oldValue", "=", "projectPreferences", ".", "get", "(", "optionName", ",", "null", ")", ";", "if", "(", "oldValue", "!=", "null", ")", "{", "return", "oldValue", ".", "trim", "(", ")", ";", "}", "String", "[", "]", "compatibleOptions", "=", "(", "String", "[", "]", ")", "this", ".", "deprecatedOptions", ".", "get", "(", "optionName", ")", ";", "String", "newDefault", "=", "inheritJavaCoreOptions", "?", "JavaCore", ".", "getOption", "(", "compatibleOptions", "[", "0", "]", ")", ":", "null", ";", "String", "newValue", "=", "projectPreferences", ".", "get", "(", "compatibleOptions", "[", "0", "]", ",", "newDefault", ")", ";", "return", "newValue", "==", "null", "?", "null", ":", "newValue", ".", "trim", "(", ")", ";", "}", "return", "null", ";", "}", "public", "boolean", "knowsOption", "(", "String", "optionName", ")", "{", "boolean", "knownOption", "=", "this", ".", "optionNames", ".", "contains", "(", "optionName", ")", ";", "if", "(", "!", "knownOption", ")", "{", "knownOption", "=", "this", ".", "deprecatedOptions", ".", "get", "(", "optionName", ")", "!=", "null", ";", "}", "return", "knownOption", ";", "}", "public", "int", "getOptionLevel", "(", "String", "optionName", ")", "{", "if", "(", "this", ".", "optionNames", ".", "contains", "(", "optionName", ")", ")", "{", "return", "VALID_OPTION", ";", "}", "if", "(", "this", ".", "deprecatedOptions", ".", "get", "(", "optionName", ")", "!=", "null", ")", "{", "return", "DEPRECATED_OPTION", ";", "}", "return", "UNKNOWN_OPTION", ";", "}", "public", "Hashtable", "getOptions", "(", ")", "{", "Hashtable", "cachedOptions", ";", "if", "(", "(", "cachedOptions", "=", "this", ".", "optionsCache", ")", "!=", "null", ")", "{", "return", "new", "Hashtable", "(", "cachedOptions", ")", ";", "}", "if", "(", "!", "Platform", ".", "isRunning", "(", ")", ")", "{", "this", ".", "optionsCache", "=", "getDefaultOptionsNoInitialization", "(", ")", ";", "return", "new", "Hashtable", "(", "this", ".", "optionsCache", ")", ";", "}", "Hashtable", "options", "=", "new", "Hashtable", "(", "10", ")", ";", "IPreferencesService", "service", "=", "Platform", ".", "getPreferencesService", "(", ")", ";", "Iterator", "iterator", "=", "this", ".", "optionNames", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "String", "propertyName", "=", "(", "String", ")", "iterator", ".", "next", "(", ")", ";", "String", "propertyValue", "=", "service", ".", "get", "(", "propertyName", ",", "null", ",", "this", ".", "preferencesLookup", ")", ";", "if", "(", "propertyValue", "!=", "null", ")", "{", "options", ".", "put", "(", "propertyName", ",", "propertyValue", ")", ";", "}", "}", "Iterator", "deprecatedEntries", "=", "this", ".", "deprecatedOptions", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "deprecatedEntries", ".", "hasNext", "(", ")", ")", "{", "Entry", "entry", "=", "(", "Entry", ")", "deprecatedEntries", ".", "next", "(", ")", ";", "String", "propertyName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "String", "propertyValue", "=", "service", ".", "get", "(", "propertyName", ",", "null", ",", "this", ".", "preferencesLookup", ")", ";", "if", "(", "propertyValue", "!=", "null", ")", "{", "options", ".", "put", "(", "propertyName", ",", "propertyValue", ")", ";", "String", "[", "]", "compatibleOptions", "=", "(", "String", "[", "]", ")", "entry", ".", "getValue", "(", ")", ";", "for", "(", "int", "co", "=", "0", ",", "length", "=", "compatibleOptions", ".", "length", ";", "co", "<", "length", ";", "co", "++", ")", "{", "String", "compatibleOption", "=", "compatibleOptions", "[", "co", "]", ";", "if", "(", "!", "options", ".", "containsKey", "(", "compatibleOption", ")", ")", "options", ".", "put", "(", "compatibleOption", ",", "propertyValue", ")", ";", "}", "}", "}", "options", ".", "put", "(", "JavaCore", ".", "CORE_ENCODING", ",", "JavaCore", ".", "getEncoding", "(", ")", ")", ";", "addDeprecatedOptions", "(", "options", ")", ";", "Util", ".", "fixTaskTags", "(", "options", ")", ";", "this", ".", "optionsCache", "=", "new", "Hashtable", "(", "options", ")", ";", "return", "options", ";", "}", "private", "Hashtable", "getDefaultOptionsNoInitialization", "(", ")", "{", "Map", "defaultOptionsMap", "=", "new", "CompilerOptions", "(", ")", ".", "getMap", "(", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_LOCAL_VARIABLE_ATTR", ",", "JavaCore", ".", "GENERATE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_CODEGEN_UNUSED_LOCAL", ",", "JavaCore", ".", "PRESERVE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_TAGS", ",", "JavaCore", ".", "DEFAULT_TASK_TAGS", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_PRIORITIES", ",", "JavaCore", ".", "DEFAULT_TASK_PRIORITIES", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_TASK_CASE_SENSITIVE", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_DOC_COMMENT_SUPPORT", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "COMPILER_PB_FORBIDDEN_REFERENCE", ",", "JavaCore", ".", "ERROR", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_RESOURCE_COPY_FILTER", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_INVALID_CLASSPATH", ",", "JavaCore", ".", "ABORT", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_DUPLICATE_RESOURCE", ",", "JavaCore", ".", "WARNING", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER", ",", "JavaCore", ".", "CLEAN", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_JAVA_BUILD_ORDER", ",", "JavaCore", ".", "IGNORE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_INCOMPLETE_CLASSPATH", ",", "JavaCore", ".", "ERROR", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_CIRCULAR_CLASSPATH", ",", "JavaCore", ".", "ERROR", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_INCOMPATIBLE_JDK_LEVEL", ",", "JavaCore", ".", "IGNORE", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE", ",", "JavaCore", ".", "WARNING", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "putAll", "(", "DefaultCodeFormatterConstants", ".", "getEclipseDefaultSettings", "(", ")", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_VISIBILITY_CHECK", ",", "JavaCore", ".", "DISABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_DEPRECATION_CHECK", ",", "JavaCore", ".", "DISABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_IMPLICIT_QUALIFICATION", ",", "JavaCore", ".", "DISABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_FIELD_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_STATIC_FIELD_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_STATIC_FINAL_FIELD_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_LOCAL_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_ARGUMENT_PREFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_FIELD_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_STATIC_FIELD_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_LOCAL_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_ARGUMENT_SUFFIXES", ",", "\"\"", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_FORBIDDEN_REFERENCE_CHECK", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_DISCOURAGED_REFERENCE_CHECK", ",", "JavaCore", ".", "DISABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_CAMEL_CASE_MATCH", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "CODEASSIST_SUGGEST_STATIC_IMPORTS", ",", "JavaCore", ".", "ENABLED", ")", ";", "defaultOptionsMap", ".", "put", "(", "JavaCore", ".", "TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC", ",", "\"50\"", ")", ";", "return", "new", "Hashtable", "(", "defaultOptionsMap", ")", ";", "}", "public", "PerProjectInfo", "getPerProjectInfo", "(", "IProject", "project", ",", "boolean", "create", ")", "{", "synchronized", "(", "this", ".", "perProjectInfos", ")", "{", "PerProjectInfo", "info", "=", "(", "PerProjectInfo", ")", "this", ".", "perProjectInfos", ".", "get", "(", "project", ")", ";", "if", "(", "info", "==", "null", "&&", "create", ")", "{", "info", "=", "new", "PerProjectInfo", "(", "project", ")", ";", "this", ".", "perProjectInfos", ".", "put", "(", "project", ",", "info", ")", ";", "}", "return", "info", ";", "}", "}", "public", "PerProjectInfo", "getPerProjectInfoCheckExistence", "(", "IProject", "project", ")", "throws", "JavaModelException", "{", "JavaModelManager", ".", "PerProjectInfo", "info", "=", "getPerProjectInfo", "(", "project", ",", "false", ")", ";", "if", "(", "info", "==", "null", ")", "{", "if", "(", "!", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "throw", "(", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "project", ")", ")", ".", "newNotPresentException", "(", ")", ";", "}", "info", "=", "getPerProjectInfo", "(", "project", ",", "true", ")", ";", "}", "return", "info", ";", "}", "public", "PerWorkingCopyInfo", "getPerWorkingCopyInfo", "(", "CompilationUnit", "workingCopy", ",", "boolean", "create", ",", "boolean", "recordUsage", ",", "IProblemRequestor", "problemRequestor", ")", "{", "synchronized", "(", "this", ".", "perWorkingCopyInfos", ")", "{", "WorkingCopyOwner", "owner", "=", "workingCopy", ".", "owner", ";", "Map", "workingCopyToInfos", "=", "(", "Map", ")", "this", ".", "perWorkingCopyInfos", ".", "get", "(", "owner", ")", ";", "if", "(", "workingCopyToInfos", "==", "null", "&&", "create", ")", "{", "workingCopyToInfos", "=", "new", "HashMap", "(", ")", ";", "this", ".", "perWorkingCopyInfos", ".", "put", "(", "owner", ",", "workingCopyToInfos", ")", ";", "}", "PerWorkingCopyInfo", "info", "=", "workingCopyToInfos", "==", "null", "?", "null", ":", "(", "PerWorkingCopyInfo", ")", "workingCopyToInfos", ".", "get", "(", "workingCopy", ")", ";", "if", "(", "info", "==", "null", "&&", "create", ")", "{", "info", "=", "new", "PerWorkingCopyInfo", "(", "workingCopy", ",", "problemRequestor", ")", ";", "workingCopyToInfos", ".", "put", "(", "workingCopy", ",", "info", ")", ";", "}", "if", "(", "info", "!=", "null", "&&", "recordUsage", ")", "info", ".", "useCount", "++", ";", "return", "info", ";", "}", "}", "public", "IClasspathContainer", "getPreviousSessionContainer", "(", "IPath", "containerPath", ",", "IJavaProject", "project", ")", "{", "Map", "previousContainerValues", "=", "(", "Map", ")", "this", ".", "previousSessionContainers", ".", "get", "(", "project", ")", ";", "if", "(", "previousContainerValues", "!=", "null", ")", "{", "IClasspathContainer", "previousContainer", "=", "(", "IClasspathContainer", ")", "previousContainerValues", ".", "get", "(", "containerPath", ")", ";", "if", "(", "previousContainer", "!=", "null", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_ADVANCED", ")", "verbose_reentering_project_container_access", "(", "containerPath", ",", "project", ",", "previousContainer", ")", ";", "return", "previousContainer", ";", "}", "}", "return", "null", ";", "}", "private", "void", "verbose_reentering_project_container_access", "(", "IPath", "containerPath", ",", "IJavaProject", "project", ",", "IClasspathContainer", "previousContainer", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", ")", ";", "buffer", ".", "append", "(", "\"\"", "+", "containerPath", "+", "'\\n'", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "previousContainer", ".", "getDescription", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"", "{n\"", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "previousContainer", ".", "getClasspathEntries", "(", ")", ";", "if", "(", "entries", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "entries", ".", "length", ";", "j", "++", ")", "{", "buffer", ".", "append", "(", "\"", "tt\"", ")", ";", "buffer", ".", "append", "(", "entries", "[", "j", "]", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "}", "buffer", ".", "append", "(", "\"", "t}\"", ")", ";", "Util", ".", "verbose", "(", "buffer", ".", "toString", "(", ")", ")", ";", "new", "Exception", "(", "\"\"", ")", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "public", "IPath", "getPreviousSessionVariable", "(", "String", "variableName", ")", "{", "IPath", "previousPath", "=", "(", "IPath", ")", "this", ".", "previousSessionVariables", ".", "get", "(", "variableName", ")", ";", "if", "(", "previousPath", "!=", "null", ")", "{", "if", "(", "CP_RESOLVE_VERBOSE_ADVANCED", ")", "verbose_reentering_variable_access", "(", "variableName", ",", "previousPath", ")", ";", "return", "previousPath", ";", "}", "return", "null", ";", "}", "private", "void", "verbose_reentering_variable_access", "(", "String", "variableName", ",", "IPath", "previousPath", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tvariable:", "\"", "+", "variableName", "+", "'\\n'", "+", "\"\"", "+", "previousPath", ")", ";", "new", "Exception", "(", "\"\"", ")", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "public", "HashMap", "getTemporaryCache", "(", ")", "{", "HashMap", "result", "=", "(", "HashMap", ")", "this", ".", "temporaryCache", ".", "get", "(", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "new", "HashMap", "(", ")", ";", "this", ".", "temporaryCache", ".", "set", "(", "result", ")", ";", "}", "return", "result", ";", "}", "private", "File", "getVariableAndContainersFile", "(", ")", "{", "return", "JavaCore", ".", "getPlugin", "(", ")", ".", "getStateLocation", "(", ")", ".", "append", "(", "\"\"", ")", ".", "toFile", "(", ")", ";", "}", "public", "static", "String", "[", "]", "getRegisteredVariableNames", "(", ")", "{", "Plugin", "jdtCorePlugin", "=", "JavaCore", ".", "getPlugin", "(", ")", ";", "if", "(", "jdtCorePlugin", "==", "null", ")", "return", "null", ";", "ArrayList", "variableList", "=", "new", "ArrayList", "(", "5", ")", ";", "IExtensionPoint", "extension", "=", "Platform", ".", "getExtensionRegistry", "(", ")", ".", "getExtensionPoint", "(", "JavaCore", ".", "PLUGIN_ID", ",", "JavaModelManager", ".", "CPVARIABLE_INITIALIZER_EXTPOINT_ID", ")", ";", "if", "(", "extension", "!=", "null", ")", "{", "IExtension", "[", "]", "extensions", "=", "extension", ".", "getExtensions", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extensions", ".", "length", ";", "i", "++", ")", "{", "IConfigurationElement", "[", "]", "configElements", "=", "extensions", "[", "i", "]", ".", "getConfigurationElements", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "configElements", ".", "length", ";", "j", "++", ")", "{", "String", "varAttribute", "=", "configElements", "[", "j", "]", ".", "getAttribute", "(", "\"variable\"", ")", ";", "if", "(", "varAttribute", "!=", "null", ")", "variableList", ".", "add", "(", "varAttribute", ")", ";", "}", "}", "}", "String", "[", "]", "variableNames", "=", "new", "String", "[", "variableList", ".", "size", "(", ")", "]", ";", "variableList", ".", "toArray", "(", "variableNames", ")", ";", "return", "variableNames", ";", "}", "public", "static", "String", "[", "]", "getRegisteredContainerIDs", "(", ")", "{", "Plugin", "jdtCorePlugin", "=", "JavaCore", ".", "getPlugin", "(", ")", ";", "if", "(", "jdtCorePlugin", "==", "null", ")", "return", "null", ";", "ArrayList", "containerIDList", "=", "new", "ArrayList", "(", "5", ")", ";", "IExtensionPoint", "extension", "=", "Platform", ".", "getExtensionRegistry", "(", ")", ".", "getExtensionPoint", "(", "JavaCore", ".", "PLUGIN_ID", ",", "JavaModelManager", ".", "CPCONTAINER_INITIALIZER_EXTPOINT_ID", ")", ";", "if", "(", "extension", "!=", "null", ")", "{", "IExtension", "[", "]", "extensions", "=", "extension", ".", "getExtensions", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "extensions", ".", "length", ";", "i", "++", ")", "{", "IConfigurationElement", "[", "]", "configElements", "=", "extensions", "[", "i", "]", ".", "getConfigurationElements", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "configElements", ".", "length", ";", "j", "++", ")", "{", "String", "idAttribute", "=", "configElements", "[", "j", "]", ".", "getAttribute", "(", "\"id\"", ")", ";", "if", "(", "idAttribute", "!=", "null", ")", "containerIDList", ".", "add", "(", "idAttribute", ")", ";", "}", "}", "}", "String", "[", "]", "containerIDs", "=", "new", "String", "[", "containerIDList", ".", "size", "(", ")", "]", ";", "containerIDList", ".", "toArray", "(", "containerIDs", ")", ";", "return", "containerIDs", ";", "}", "public", "IClasspathEntry", "resolveVariableEntry", "(", "IClasspathEntry", "entry", ",", "boolean", "usePreviousSession", ")", "{", "if", "(", "entry", ".", "getEntryKind", "(", ")", "!=", "IClasspathEntry", ".", "CPE_VARIABLE", ")", "return", "entry", ";", "IPath", "resolvedPath", "=", "getResolvedVariablePath", "(", "entry", ".", "getPath", "(", ")", ",", "usePreviousSession", ")", ";", "if", "(", "resolvedPath", "==", "null", ")", "return", "null", ";", "resolvedPath", "=", "ClasspathEntry", ".", "resolveDotDot", "(", "null", ",", "resolvedPath", ")", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "resolvedPath", ",", "false", ")", ";", "if", "(", "target", "==", "null", ")", "return", "null", ";", "if", "(", "target", "instanceof", "IResource", ")", "{", "IResource", "resolvedResource", "=", "(", "IResource", ")", "target", ";", "switch", "(", "resolvedResource", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "PROJECT", ":", "return", "JavaCore", ".", "newProjectEntry", "(", "resolvedPath", ",", "entry", ".", "getAccessRules", "(", ")", ",", "entry", ".", "combineAccessRules", "(", ")", ",", "entry", ".", "getExtraAttributes", "(", ")", ",", "entry", ".", "isExported", "(", ")", ")", ";", "case", "IResource", ".", "FILE", ":", "return", "JavaCore", ".", "newLibraryEntry", "(", "resolvedPath", ",", "getResolvedVariablePath", "(", "entry", ".", "getSourceAttachmentPath", "(", ")", ",", "usePreviousSession", ")", ",", "getResolvedVariablePath", "(", "entry", ".", "getSourceAttachmentRootPath", "(", ")", ",", "usePreviousSession", ")", ",", "entry", ".", "getAccessRules", "(", ")", ",", "entry", ".", "getExtraAttributes", "(", ")", ",", "entry", ".", "isExported", "(", ")", ")", ";", "case", "IResource", ".", "FOLDER", ":", "return", "JavaCore", ".", "newLibraryEntry", "(", "resolvedPath", ",", "getResolvedVariablePath", "(", "entry", ".", "getSourceAttachmentPath", "(", ")", ",", "usePreviousSession", ")", ",", "getResolvedVariablePath", "(", "entry", ".", "getSourceAttachmentRootPath", "(", ")", ",", "usePreviousSession", ")", ",", "entry", ".", "getAccessRules", "(", ")", ",", "entry", ".", "getExtraAttributes", "(", ")", ",", "entry", ".", "isExported", "(", ")", ")", ";", "}", "}", "if", "(", "target", "instanceof", "File", ")", "{", "File", "externalFile", "=", "JavaModel", ".", "getFile", "(", "target", ")", ";", "if", "(", "externalFile", "!=", "null", ")", "{", "return", "JavaCore", ".", "newLibraryEntry", "(", "resolvedPath", ",", "getResolvedVariablePath", "(", "entry", ".", "getSourceAttachmentPath", "(", ")", ",", "usePreviousSession", ")", ",", "getResolvedVariablePath", "(", "entry", ".", "getSourceAttachmentRootPath", "(", ")", ",", "usePreviousSession", ")", ",", "entry", ".", "getAccessRules", "(", ")", ",", "entry", ".", "getExtraAttributes", "(", ")", ",", "entry", ".", "isExported", "(", ")", ")", ";", "}", "else", "{", "if", "(", "resolvedPath", ".", "isAbsolute", "(", ")", ")", "{", "return", "JavaCore", ".", "newLibraryEntry", "(", "resolvedPath", ",", "getResolvedVariablePath", "(", "entry", ".", "getSourceAttachmentPath", "(", ")", ",", "usePreviousSession", ")", ",", "getResolvedVariablePath", "(", "entry", ".", "getSourceAttachmentRootPath", "(", ")", ",", "usePreviousSession", ")", ",", "entry", ".", "getAccessRules", "(", ")", ",", "entry", ".", "getExtraAttributes", "(", ")", ",", "entry", ".", "isExported", "(", ")", ")", ";", "}", "}", "}", "return", "null", ";", "}", "public", "IPath", "getResolvedVariablePath", "(", "IPath", "variablePath", ",", "boolean", "usePreviousSession", ")", "{", "if", "(", "variablePath", "==", "null", ")", "return", "null", ";", "int", "count", "=", "variablePath", ".", "segmentCount", "(", ")", ";", "if", "(", "count", "==", "0", ")", "return", "null", ";", "String", "variableName", "=", "variablePath", ".", "segment", "(", "0", ")", ";", "IPath", "resolvedPath", "=", "usePreviousSession", "?", "getPreviousSessionVariable", "(", "variableName", ")", ":", "JavaCore", ".", "getClasspathVariable", "(", "variableName", ")", ";", "if", "(", "resolvedPath", "==", "null", ")", "return", "null", ";", "if", "(", "count", ">", "1", ")", "{", "resolvedPath", "=", "resolvedPath", ".", "append", "(", "variablePath", ".", "removeFirstSegments", "(", "1", ")", ")", ";", "}", "return", "resolvedPath", ";", "}", "private", "File", "getSerializationFile", "(", "IProject", "project", ")", "{", "if", "(", "!", "project", ".", "exists", "(", ")", ")", "return", "null", ";", "IPath", "workingLocation", "=", "project", ".", "getWorkingLocation", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "return", "workingLocation", ".", "append", "(", "\"state.dat\"", ")", ".", "toFile", "(", ")", ";", "}", "public", "static", "UserLibraryManager", "getUserLibraryManager", "(", ")", "{", "if", "(", "MANAGER", ".", "userLibraryManager", "==", "null", ")", "{", "UserLibraryManager", "libraryManager", "=", "new", "UserLibraryManager", "(", ")", ";", "synchronized", "(", "MANAGER", ")", "{", "if", "(", "MANAGER", ".", "userLibraryManager", "==", "null", ")", "{", "MANAGER", ".", "userLibraryManager", "=", "libraryManager", ";", "}", "}", "}", "return", "MANAGER", ".", "userLibraryManager", ";", "}", "public", "ICompilationUnit", "[", "]", "getWorkingCopies", "(", "WorkingCopyOwner", "owner", ",", "boolean", "addPrimary", ")", "{", "synchronized", "(", "this", ".", "perWorkingCopyInfos", ")", "{", "ICompilationUnit", "[", "]", "primaryWCs", "=", "addPrimary", "&&", "owner", "!=", "DefaultWorkingCopyOwner", ".", "PRIMARY", "?", "getWorkingCopies", "(", "DefaultWorkingCopyOwner", ".", "PRIMARY", ",", "false", ")", ":", "null", ";", "Map", "workingCopyToInfos", "=", "(", "Map", ")", "this", ".", "perWorkingCopyInfos", ".", "get", "(", "owner", ")", ";", "if", "(", "workingCopyToInfos", "==", "null", ")", "return", "primaryWCs", ";", "int", "primaryLength", "=", "primaryWCs", "==", "null", "?", "0", ":", "primaryWCs", ".", "length", ";", "int", "size", "=", "workingCopyToInfos", ".", "size", "(", ")", ";", "ICompilationUnit", "[", "]", "result", "=", "new", "ICompilationUnit", "[", "primaryLength", "+", "size", "]", ";", "int", "index", "=", "0", ";", "if", "(", "primaryWCs", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "primaryLength", ";", "i", "++", ")", "{", "ICompilationUnit", "primaryWorkingCopy", "=", "primaryWCs", "[", "i", "]", ";", "ICompilationUnit", "workingCopy", "=", "LanguageSupportFactory", ".", "newCompilationUnit", "(", "(", "PackageFragment", ")", "primaryWorkingCopy", ".", "getParent", "(", ")", ",", "primaryWorkingCopy", ".", "getElementName", "(", ")", ",", "owner", ")", ";", "if", "(", "!", "workingCopyToInfos", ".", "containsKey", "(", "workingCopy", ")", ")", "result", "[", "index", "++", "]", "=", "primaryWorkingCopy", ";", "}", "if", "(", "index", "!=", "primaryLength", ")", "System", ".", "arraycopy", "(", "result", ",", "0", ",", "result", "=", "new", "ICompilationUnit", "[", "index", "+", "size", "]", ",", "0", ",", "index", ")", ";", "}", "Iterator", "iterator", "=", "workingCopyToInfos", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "result", "[", "index", "++", "]", "=", "(", "(", "JavaModelManager", ".", "PerWorkingCopyInfo", ")", "iterator", ".", "next", "(", ")", ")", ".", "getWorkingCopy", "(", ")", ";", "}", "return", "result", ";", "}", "}", "public", "JavaWorkspaceScope", "getWorkspaceScope", "(", ")", "{", "if", "(", "this", ".", "workspaceScope", "==", "null", ")", "{", "this", ".", "workspaceScope", "=", "new", "JavaWorkspaceScope", "(", ")", ";", "}", "return", "this", ".", "workspaceScope", ";", "}", "public", "void", "verifyArchiveContent", "(", "IPath", "path", ")", "throws", "CoreException", "{", "if", "(", "isInvalidArchive", "(", "path", ")", ")", "{", "throw", "new", "CoreException", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "-", "1", ",", "Messages", ".", "status_IOException", ",", "new", "ZipException", "(", ")", ")", ")", ";", "}", "ZipFile", "file", "=", "getZipFile", "(", "path", ")", ";", "closeZipFile", "(", "file", ")", ";", "}", "public", "ZipFile", "getZipFile", "(", "IPath", "path", ")", "throws", "CoreException", "{", "if", "(", "isInvalidArchive", "(", "path", ")", ")", "throw", "new", "CoreException", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "-", "1", ",", "Messages", ".", "status_IOException", ",", "new", "ZipException", "(", ")", ")", ")", ";", "ZipCache", "zipCache", ";", "ZipFile", "zipFile", ";", "if", "(", "(", "zipCache", "=", "(", "ZipCache", ")", "this", ".", "zipFiles", ".", "get", "(", ")", ")", "!=", "null", "&&", "(", "zipFile", "=", "zipCache", ".", "getCache", "(", "path", ")", ")", "!=", "null", ")", "{", "return", "zipFile", ";", "}", "File", "localFile", "=", "null", ";", "IWorkspaceRoot", "root", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "IResource", "file", "=", "root", ".", "findMember", "(", "path", ")", ";", "if", "(", "file", "!=", "null", ")", "{", "URI", "location", ";", "if", "(", "file", ".", "getType", "(", ")", "!=", "IResource", ".", "FILE", "||", "(", "location", "=", "file", ".", "getLocationURI", "(", ")", ")", "==", "null", ")", "{", "throw", "new", "CoreException", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "-", "1", ",", "Messages", ".", "bind", "(", "Messages", ".", "file_notFound", ",", "path", ".", "toString", "(", ")", ")", ",", "null", ")", ")", ";", "}", "localFile", "=", "Util", ".", "toLocalFile", "(", "location", ",", "null", ")", ";", "if", "(", "localFile", "==", "null", ")", "throw", "new", "CoreException", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "-", "1", ",", "Messages", ".", "bind", "(", "Messages", ".", "file_notFound", ",", "path", ".", "toString", "(", ")", ")", ",", "null", ")", ")", ";", "}", "else", "{", "localFile", "=", "path", ".", "toFile", "(", ")", ";", "}", "try", "{", "if", "(", "ZIP_ACCESS_VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "localFile", ")", ";", "}", "zipFile", "=", "new", "ZipFile", "(", "localFile", ")", ";", "if", "(", "zipCache", "!=", "null", ")", "{", "zipCache", ".", "setCache", "(", "path", ",", "zipFile", ")", ";", "}", "return", "zipFile", ";", "}", "catch", "(", "IOException", "e", ")", "{", "addInvalidArchive", "(", "path", ")", ";", "throw", "new", "CoreException", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "-", "1", ",", "Messages", ".", "status_IOException", ",", "e", ")", ")", ";", "}", "}", "public", "boolean", "hasTemporaryCache", "(", ")", "{", "return", "this", ".", "temporaryCache", ".", "get", "(", ")", "!=", "null", ";", "}", "private", "IClasspathContainer", "initializeAllContainers", "(", "IJavaProject", "javaProjectToInit", ",", "IPath", "containerToInit", ")", "throws", "JavaModelException", "{", "if", "(", "CP_RESOLVE_VERBOSE_ADVANCED", ")", "verbose_batching_containers_initialization", "(", "javaProjectToInit", ",", "containerToInit", ")", ";", "final", "HashMap", "allContainerPaths", "=", "new", "HashMap", "(", ")", ";", "IProject", "[", "]", "projects", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProjects", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IProject", "project", "=", "projects", "[", "i", "]", ";", "if", "(", "!", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "continue", ";", "IJavaProject", "javaProject", "=", "new", "JavaProject", "(", "project", ",", "getJavaModel", "(", ")", ")", ";", "HashSet", "paths", "=", "(", "HashSet", ")", "allContainerPaths", ".", "get", "(", "javaProject", ")", ";", "IClasspathEntry", "[", "]", "rawClasspath", "=", "javaProject", ".", "getRawClasspath", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "length2", "=", "rawClasspath", ".", "length", ";", "j", "<", "length2", ";", "j", "++", ")", "{", "IClasspathEntry", "entry", "=", "rawClasspath", "[", "j", "]", ";", "IPath", "path", "=", "entry", ".", "getPath", "(", ")", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_CONTAINER", "&&", "containerGet", "(", "javaProject", ",", "path", ")", "==", "null", ")", "{", "if", "(", "paths", "==", "null", ")", "{", "paths", "=", "new", "HashSet", "(", ")", ";", "allContainerPaths", ".", "put", "(", "javaProject", ",", "paths", ")", ";", "}", "paths", ".", "add", "(", "path", ")", ";", "}", "}", "}", "if", "(", "javaProjectToInit", "!=", "null", ")", "{", "HashSet", "containerPaths", "=", "(", "HashSet", ")", "allContainerPaths", ".", "get", "(", "javaProjectToInit", ")", ";", "if", "(", "containerPaths", "==", "null", ")", "{", "containerPaths", "=", "new", "HashSet", "(", ")", ";", "allContainerPaths", ".", "put", "(", "javaProjectToInit", ",", "containerPaths", ")", ";", "}", "containerPaths", ".", "add", "(", "containerToInit", ")", ";", "}", "boolean", "ok", "=", "false", ";", "try", "{", "IWorkspaceRunnable", "runnable", "=", "new", "IWorkspaceRunnable", "(", ")", "{", "public", "void", "run", "(", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "try", "{", "Set", "entrySet", "=", "allContainerPaths", ".", "entrySet", "(", ")", ";", "int", "length", "=", "entrySet", ".", "size", "(", ")", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "beginTask", "(", "\"\"", ",", "length", ")", ";", "Map", ".", "Entry", "[", "]", "entries", "=", "new", "Map", ".", "Entry", "[", "length", "]", ";", "entrySet", ".", "toArray", "(", "entries", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "Map", ".", "Entry", "entry", "=", "entries", "[", "i", "]", ";", "IJavaProject", "javaProject", "=", "(", "IJavaProject", ")", "entry", ".", "getKey", "(", ")", ";", "HashSet", "pathSet", "=", "(", "HashSet", ")", "entry", ".", "getValue", "(", ")", ";", "if", "(", "pathSet", "==", "null", ")", "continue", ";", "int", "length2", "=", "pathSet", ".", "size", "(", ")", ";", "IPath", "[", "]", "paths", "=", "new", "IPath", "[", "length2", "]", ";", "pathSet", ".", "toArray", "(", "paths", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length2", ";", "j", "++", ")", "{", "IPath", "path", "=", "paths", "[", "j", "]", ";", "initializeContainer", "(", "javaProject", ",", "path", ")", ";", "IClasspathContainer", "container", "=", "containerBeingInitializedGet", "(", "javaProject", ",", "path", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "containerPut", "(", "javaProject", ",", "path", ",", "container", ")", ";", "}", "}", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "worked", "(", "1", ")", ";", "}", "Map", "perProjectContainers", "=", "(", "Map", ")", "JavaModelManager", ".", "this", ".", "containersBeingInitialized", ".", "get", "(", ")", ";", "if", "(", "perProjectContainers", "!=", "null", ")", "{", "Iterator", "entriesIterator", "=", "perProjectContainers", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entriesIterator", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entriesIterator", ".", "next", "(", ")", ";", "IJavaProject", "project", "=", "(", "IJavaProject", ")", "entry", ".", "getKey", "(", ")", ";", "HashMap", "perPathContainers", "=", "(", "HashMap", ")", "entry", ".", "getValue", "(", ")", ";", "Iterator", "containersIterator", "=", "perPathContainers", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "containersIterator", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "containerEntry", "=", "(", "Map", ".", "Entry", ")", "containersIterator", ".", "next", "(", ")", ";", "IPath", "containerPath", "=", "(", "IPath", ")", "containerEntry", ".", "getKey", "(", ")", ";", "IClasspathContainer", "container", "=", "(", "IClasspathContainer", ")", "containerEntry", ".", "getValue", "(", ")", ";", "SetContainerOperation", "operation", "=", "new", "SetContainerOperation", "(", "containerPath", ",", "new", "IJavaProject", "[", "]", "{", "project", "}", ",", "new", "IClasspathContainer", "[", "]", "{", "container", "}", ")", ";", "operation", ".", "runOperation", "(", "monitor", ")", ";", "}", "}", "JavaModelManager", ".", "this", ".", "containersBeingInitialized", ".", "set", "(", "null", ")", ";", "}", "}", "finally", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "done", "(", ")", ";", "}", "}", "}", ";", "IProgressMonitor", "monitor", "=", "this", ".", "batchContainerInitializationsProgress", ";", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "if", "(", "workspace", ".", "isTreeLocked", "(", ")", ")", "runnable", ".", "run", "(", "monitor", ")", ";", "else", "workspace", ".", "run", "(", "runnable", ",", "null", ",", "IWorkspace", ".", "AVOID_UPDATE", ",", "monitor", ")", ";", "ok", "=", "true", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "finally", "{", "if", "(", "!", "ok", ")", "{", "this", ".", "containerInitializationInProgress", ".", "set", "(", "null", ")", ";", "}", "}", "return", "containerGet", "(", "javaProjectToInit", ",", "containerToInit", ")", ";", "}", "private", "void", "verbose_batching_containers_initialization", "(", "IJavaProject", "javaProjectToInit", ",", "IPath", "containerToInit", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"\"", "+", "(", "javaProjectToInit", "==", "null", "?", "\"null\"", ":", "javaProjectToInit", ".", "getElementName", "(", ")", ")", "+", "'\\n'", "+", "\"\"", "+", "containerToInit", ")", ";", "}", "IClasspathContainer", "initializeContainer", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "throws", "JavaModelException", "{", "IProgressMonitor", "monitor", "=", "this", ".", "batchContainerInitializationsProgress", ";", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "IClasspathContainer", "container", "=", "null", ";", "final", "ClasspathContainerInitializer", "initializer", "=", "JavaCore", ".", "getClasspathContainerInitializer", "(", "containerPath", ".", "segment", "(", "0", ")", ")", ";", "if", "(", "initializer", "!=", "null", ")", "{", "if", "(", "CP_RESOLVE_VERBOSE", ")", "verbose_triggering_container_initialization", "(", "project", ",", "containerPath", ",", "initializer", ")", ";", "if", "(", "CP_RESOLVE_VERBOSE_ADVANCED", ")", "verbose_triggering_container_initialization_invocation_trace", "(", ")", ";", "PerformanceStats", "stats", "=", "null", ";", "if", "(", "JavaModelManager", ".", "PERF_CONTAINER_INITIALIZER", ")", "{", "stats", "=", "PerformanceStats", ".", "getStats", "(", "JavaModelManager", ".", "CONTAINER_INITIALIZER_PERF", ",", "this", ")", ";", "stats", ".", "startRun", "(", "containerPath", "+", "\"", "of", "\"", "+", "project", ".", "getPath", "(", ")", ")", ";", "}", "containerPut", "(", "project", ",", "containerPath", ",", "CONTAINER_INITIALIZATION_IN_PROGRESS", ")", ";", "boolean", "ok", "=", "false", ";", "try", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "subTask", "(", "Messages", ".", "bind", "(", "Messages", ".", "javamodel_configuring", ",", "initializer", ".", "getDescription", "(", "containerPath", ",", "project", ")", ")", ")", ";", "initializer", ".", "initialize", "(", "containerPath", ",", "project", ")", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "subTask", "(", "\"\"", ")", ";", "container", "=", "containerBeingInitializedGet", "(", "project", ",", "containerPath", ")", ";", "if", "(", "container", "==", "null", "&&", "containerGet", "(", "project", ",", "containerPath", ")", "==", "CONTAINER_INITIALIZATION_IN_PROGRESS", ")", "{", "container", "=", "initializer", ".", "getFailureContainer", "(", "containerPath", ",", "project", ")", ";", "if", "(", "container", "==", "null", ")", "{", "if", "(", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_container_null_failure_container", "(", "project", ",", "containerPath", ",", "initializer", ")", ";", "return", "null", ";", "}", "if", "(", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_container_using_failure_container", "(", "project", ",", "containerPath", ",", "initializer", ")", ";", "containerPut", "(", "project", ",", "containerPath", ",", "container", ")", ";", "}", "ok", "=", "true", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "e", "instanceof", "JavaModelException", ")", "{", "throw", "(", "JavaModelException", ")", "e", ";", "}", "else", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "e", ".", "printStackTrace", "(", ")", ";", "throw", "e", ";", "}", "catch", "(", "Error", "e", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "e", ".", "printStackTrace", "(", ")", ";", "throw", "e", ";", "}", "finally", "{", "if", "(", "JavaModelManager", ".", "PERF_CONTAINER_INITIALIZER", ")", "{", "stats", ".", "endRun", "(", ")", ";", "}", "if", "(", "!", "ok", ")", "{", "containerRemoveInitializationInProgress", "(", "project", ",", "containerPath", ")", ";", "if", "(", "CP_RESOLVE_VERBOSE", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_container_initialization_failed", "(", "project", ",", "containerPath", ",", "container", ",", "initializer", ")", ";", "}", "}", "if", "(", "CP_RESOLVE_VERBOSE_ADVANCED", ")", "verbose_container_value_after_initialization", "(", "project", ",", "containerPath", ",", "container", ")", ";", "}", "else", "{", "container", "=", "(", "new", "ClasspathContainerInitializer", "(", ")", "{", "public", "void", "initialize", "(", "IPath", "path", ",", "IJavaProject", "javaProject", ")", "throws", "CoreException", "{", "}", "}", ")", ".", "getFailureContainer", "(", "containerPath", ",", "project", ")", ";", "if", "(", "CP_RESOLVE_VERBOSE_ADVANCED", "||", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_no_container_initializer_found", "(", "project", ",", "containerPath", ")", ";", "}", "return", "container", ";", "}", "private", "void", "verbose_no_container_initializer_found", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", ")", ";", "}", "private", "void", "verbose_container_value_after_initialization", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "IClasspathContainer", "container", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", ")", ";", "buffer", ".", "append", "(", "\"\"", "+", "containerPath", "+", "'\\n'", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "buffer", ".", "append", "(", "\"tcontainer:", "\"", "+", "container", ".", "getDescription", "(", ")", "+", "\"", "{n\"", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "container", ".", "getClasspathEntries", "(", ")", ";", "if", "(", "entries", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entries", ".", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "\"tt\"", "+", "entries", "[", "i", "]", "+", "'\\n'", ")", ";", "}", "}", "buffer", ".", "append", "(", "\"t}\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "}", "Util", ".", "verbose", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "private", "void", "verbose_container_initialization_failed", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "IClasspathContainer", "container", ",", "ClasspathContainerInitializer", "initializer", ")", "{", "if", "(", "container", "==", "CONTAINER_INITIALIZATION_IN_PROGRESS", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", "+", "'\\n'", "+", "\"\"", "+", "initializer", ")", ";", "}", "else", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", "+", "'\\n'", "+", "\"\"", "+", "initializer", ")", ";", "}", "}", "private", "void", "verbose_container_null_failure_container", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "ClasspathContainerInitializer", "initializer", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", "+", "'\\n'", "+", "\"\"", "+", "initializer", ")", ";", "}", "private", "void", "verbose_container_using_failure_container", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "ClasspathContainerInitializer", "initializer", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", "+", "'\\n'", "+", "\"\"", "+", "initializer", ")", ";", "}", "private", "void", "verbose_triggering_container_initialization", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "ClasspathContainerInitializer", "initializer", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "project", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "containerPath", "+", "'\\n'", "+", "\"\"", "+", "initializer", ")", ";", "}", "private", "void", "verbose_triggering_container_initialization_invocation_trace", "(", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"\"", ")", ";", "new", "Exception", "(", "\"\"", ")", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "public", "void", "initializePreferences", "(", ")", "{", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", "=", "InstanceScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", "=", "DefaultScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "this", ".", "instanceNodeListener", "=", "new", "IEclipsePreferences", ".", "INodeChangeListener", "(", ")", "{", "public", "void", "added", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "}", "public", "void", "removed", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "if", "(", "event", ".", "getChild", "(", ")", "==", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ")", "{", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", "=", "InstanceScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ".", "addPreferenceChangeListener", "(", "new", "EclipsePreferencesListener", "(", ")", ")", ";", "}", "}", "}", ";", "(", "(", "IEclipsePreferences", ")", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ".", "parent", "(", ")", ")", ".", "addNodeChangeListener", "(", "this", ".", "instanceNodeListener", ")", ";", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ".", "addPreferenceChangeListener", "(", "this", ".", "instancePreferencesListener", "=", "new", "EclipsePreferencesListener", "(", ")", ")", ";", "this", ".", "defaultNodeListener", "=", "new", "IEclipsePreferences", ".", "INodeChangeListener", "(", ")", "{", "public", "void", "added", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "}", "public", "void", "removed", "(", "IEclipsePreferences", ".", "NodeChangeEvent", "event", ")", "{", "if", "(", "event", ".", "getChild", "(", ")", "==", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", ")", "{", "JavaModelManager", ".", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", "=", "DefaultScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "}", "}", "}", ";", "(", "(", "IEclipsePreferences", ")", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", ".", "parent", "(", ")", ")", ".", "addNodeChangeListener", "(", "this", ".", "defaultNodeListener", ")", ";", "}", "public", "synchronized", "char", "[", "]", "intern", "(", "char", "[", "]", "array", ")", "{", "return", "this", ".", "charArraySymbols", ".", "add", "(", "array", ")", ";", "}", "public", "synchronized", "String", "intern", "(", "String", "s", ")", "{", "return", "(", "String", ")", "this", ".", "stringSymbols", ".", "add", "(", "new", "String", "(", "s", ")", ")", ";", "}", "private", "HashSet", "getClasspathBeingResolved", "(", ")", "{", "HashSet", "result", "=", "(", "HashSet", ")", "this", ".", "classpathsBeingResolved", ".", "get", "(", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "new", "HashSet", "(", ")", ";", "this", ".", "classpathsBeingResolved", ".", "set", "(", "result", ")", ";", "}", "return", "result", ";", "}", "public", "boolean", "isClasspathBeingResolved", "(", "IJavaProject", "project", ")", "{", "return", "getClasspathBeingResolved", "(", ")", ".", "contains", "(", "project", ")", ";", "}", "private", "boolean", "isDeprecatedOption", "(", "String", "optionName", ")", "{", "return", "JavaCore", ".", "COMPILER_PB_INVALID_IMPORT", ".", "equals", "(", "optionName", ")", "||", "JavaCore", ".", "COMPILER_PB_UNREACHABLE_CODE", ".", "equals", "(", "optionName", ")", ";", "}", "public", "boolean", "isNonChainingJar", "(", "IPath", "path", ")", "{", "return", "this", ".", "nonChainingJars", "!=", "null", "&&", "this", ".", "nonChainingJars", ".", "contains", "(", "path", ")", ";", "}", "public", "boolean", "isInvalidArchive", "(", "IPath", "path", ")", "{", "return", "this", ".", "invalidArchives", "!=", "null", "&&", "this", ".", "invalidArchives", ".", "contains", "(", "path", ")", ";", "}", "public", "void", "setClasspathBeingResolved", "(", "IJavaProject", "project", ",", "boolean", "classpathIsResolved", ")", "{", "if", "(", "classpathIsResolved", ")", "{", "getClasspathBeingResolved", "(", ")", ".", "add", "(", "project", ")", ";", "}", "else", "{", "getClasspathBeingResolved", "(", ")", ".", "remove", "(", "project", ")", ";", "}", "}", "private", "Set", "loadClasspathListCache", "(", "String", "cacheName", ")", "{", "Set", "pathCache", "=", "new", "HashSet", "(", ")", ";", "File", "cacheFile", "=", "getClasspathListFile", "(", "cacheName", ")", ";", "DataInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "DataInputStream", "(", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "cacheFile", ")", ")", ")", ";", "int", "size", "=", "in", ".", "readInt", "(", ")", ";", "while", "(", "size", "--", ">", "0", ")", "{", "String", "path", "=", "in", ".", "readUTF", "(", ")", ";", "pathCache", ".", "add", "(", "Path", ".", "fromPortableString", "(", "path", ")", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "cacheFile", ".", "exists", "(", ")", ")", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "try", "{", "in", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "return", "Collections", ".", "synchronizedSet", "(", "pathCache", ")", ";", "}", "private", "File", "getClasspathListFile", "(", "String", "fileName", ")", "{", "return", "JavaCore", ".", "getPlugin", "(", ")", ".", "getStateLocation", "(", ")", ".", "append", "(", "fileName", ")", ".", "toFile", "(", ")", ";", "}", "private", "Set", "getNonChainingJarsCache", "(", ")", "throws", "CoreException", "{", "if", "(", "this", ".", "nonChainingJars", "!=", "null", "&&", "this", ".", "nonChainingJars", ".", "size", "(", ")", ">", "0", ")", "{", "return", "this", ".", "nonChainingJars", ";", "}", "Set", "result", "=", "new", "HashSet", "(", ")", ";", "IJavaProject", "[", "]", "projects", "=", "getJavaModel", "(", ")", ".", "getJavaProjects", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaProject", "javaProject", "=", "projects", "[", "i", "]", ";", "IClasspathEntry", "[", "]", "classpath", "=", "(", "(", "JavaProject", ")", "javaProject", ")", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "length2", "=", "classpath", ".", "length", ";", "j", "<", "length2", ";", "j", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "j", "]", ";", "IPath", "path", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", "&&", "!", "result", ".", "contains", "(", "path", "=", "entry", ".", "getPath", "(", ")", ")", "&&", "ClasspathEntry", ".", "resolvedChainedLibraries", "(", "path", ")", ".", "length", "==", "0", ")", "{", "result", ".", "add", "(", "path", ")", ";", "}", "}", "}", "this", ".", "nonChainingJars", "=", "Collections", ".", "synchronizedSet", "(", "result", ")", ";", "return", "this", ".", "nonChainingJars", ";", "}", "private", "Set", "getClasspathListCache", "(", "String", "cacheName", ")", "throws", "CoreException", "{", "if", "(", "cacheName", "==", "NON_CHAINING_JARS_CACHE", ")", "return", "getNonChainingJarsCache", "(", ")", ";", "else", "if", "(", "cacheName", "==", "INVALID_ARCHIVES_CACHE", ")", "return", "this", ".", "invalidArchives", ";", "else", "return", "null", ";", "}", "public", "void", "loadVariablesAndContainers", "(", ")", "throws", "CoreException", "{", "QualifiedName", "qName", "=", "new", "QualifiedName", "(", "JavaCore", ".", "PLUGIN_ID", ",", "\"variables\"", ")", ";", "String", "xmlString", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getPersistentProperty", "(", "qName", ")", ";", "try", "{", "if", "(", "xmlString", "!=", "null", ")", "{", "StringReader", "reader", "=", "new", "StringReader", "(", "xmlString", ")", ";", "Element", "cpElement", ";", "try", "{", "DocumentBuilder", "parser", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ".", "newDocumentBuilder", "(", ")", ";", "cpElement", "=", "parser", ".", "parse", "(", "new", "InputSource", "(", "reader", ")", ")", ".", "getDocumentElement", "(", ")", ";", "}", "catch", "(", "SAXException", "e", ")", "{", "return", ";", "}", "catch", "(", "ParserConfigurationException", "e", ")", "{", "return", ";", "}", "finally", "{", "reader", ".", "close", "(", ")", ";", "}", "if", "(", "cpElement", "==", "null", ")", "return", ";", "if", "(", "!", "cpElement", ".", "getNodeName", "(", ")", ".", "equalsIgnoreCase", "(", "\"variables\"", ")", ")", "{", "return", ";", "}", "NodeList", "list", "=", "cpElement", ".", "getChildNodes", "(", ")", ";", "int", "length", "=", "list", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "++", "i", ")", "{", "Node", "node", "=", "list", ".", "item", "(", "i", ")", ";", "short", "type", "=", "node", ".", "getNodeType", "(", ")", ";", "if", "(", "type", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "Element", "element", "=", "(", "Element", ")", "node", ";", "if", "(", "element", ".", "getNodeName", "(", ")", ".", "equalsIgnoreCase", "(", "\"variable\"", ")", ")", "{", "variablePut", "(", "element", ".", "getAttribute", "(", "\"name\"", ")", ",", "new", "Path", "(", "element", ".", "getAttribute", "(", "\"path\"", ")", ")", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "}", "finally", "{", "if", "(", "xmlString", "!=", "null", ")", "{", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "setPersistentProperty", "(", "qName", ",", "null", ")", ";", "}", "}", "loadVariablesAndContainers", "(", "getDefaultPreferences", "(", ")", ")", ";", "loadVariablesAndContainers", "(", "getInstancePreferences", "(", ")", ")", ";", "File", "file", "=", "getVariableAndContainersFile", "(", ")", ";", "DataInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "DataInputStream", "(", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "file", ")", ")", ")", ";", "switch", "(", "in", ".", "readInt", "(", ")", ")", "{", "case", "2", ":", "new", "VariablesAndContainersLoadHelper", "(", "in", ")", ".", "load", "(", ")", ";", "break", ";", "case", "1", ":", "int", "size", "=", "in", ".", "readInt", "(", ")", ";", "while", "(", "size", "--", ">", "0", ")", "{", "String", "varName", "=", "in", ".", "readUTF", "(", ")", ";", "String", "pathString", "=", "in", ".", "readUTF", "(", ")", ";", "if", "(", "CP_ENTRY_IGNORE", ".", "equals", "(", "pathString", ")", ")", "continue", ";", "IPath", "varPath", "=", "Path", ".", "fromPortableString", "(", "pathString", ")", ";", "this", ".", "variables", ".", "put", "(", "varName", ",", "varPath", ")", ";", "this", ".", "previousSessionVariables", ".", "put", "(", "varName", ",", "varPath", ")", ";", "}", "IJavaModel", "model", "=", "getJavaModel", "(", ")", ";", "int", "projectSize", "=", "in", ".", "readInt", "(", ")", ";", "while", "(", "projectSize", "--", ">", "0", ")", "{", "String", "projectName", "=", "in", ".", "readUTF", "(", ")", ";", "IJavaProject", "project", "=", "model", ".", "getJavaProject", "(", "projectName", ")", ";", "int", "containerSize", "=", "in", ".", "readInt", "(", ")", ";", "while", "(", "containerSize", "--", ">", "0", ")", "{", "IPath", "containerPath", "=", "Path", ".", "fromPortableString", "(", "in", ".", "readUTF", "(", ")", ")", ";", "int", "length", "=", "in", ".", "readInt", "(", ")", ";", "byte", "[", "]", "containerString", "=", "new", "byte", "[", "length", "]", ";", "in", ".", "readFully", "(", "containerString", ")", ";", "recreatePersistedContainer", "(", "project", ",", "containerPath", ",", "new", "String", "(", "containerString", ")", ",", "true", ")", ";", "}", "}", "break", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "file", ".", "exists", "(", ")", ")", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "if", "(", "file", ".", "exists", "(", ")", ")", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "try", "{", "in", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "String", "[", "]", "registeredVariables", "=", "getRegisteredVariableNames", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "registeredVariables", ".", "length", ";", "i", "++", ")", "{", "String", "varName", "=", "registeredVariables", "[", "i", "]", ";", "this", ".", "variables", ".", "put", "(", "varName", ",", "null", ")", ";", "}", "containersReset", "(", "getRegisteredContainerIDs", "(", ")", ")", ";", "}", "private", "void", "loadVariablesAndContainers", "(", "IEclipsePreferences", "preferences", ")", "{", "try", "{", "String", "[", "]", "propertyNames", "=", "preferences", ".", "keys", "(", ")", ";", "int", "variablePrefixLength", "=", "CP_VARIABLE_PREFERENCES_PREFIX", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "propertyNames", ".", "length", ";", "i", "++", ")", "{", "String", "propertyName", "=", "propertyNames", "[", "i", "]", ";", "if", "(", "propertyName", ".", "startsWith", "(", "CP_VARIABLE_PREFERENCES_PREFIX", ")", ")", "{", "String", "varName", "=", "propertyName", ".", "substring", "(", "variablePrefixLength", ")", ";", "String", "propertyValue", "=", "preferences", ".", "get", "(", "propertyName", ",", "null", ")", ";", "if", "(", "propertyValue", "!=", "null", ")", "{", "String", "pathString", "=", "propertyValue", ".", "trim", "(", ")", ";", "if", "(", "CP_ENTRY_IGNORE", ".", "equals", "(", "pathString", ")", ")", "{", "preferences", ".", "remove", "(", "propertyName", ")", ";", "continue", ";", "}", "IPath", "varPath", "=", "new", "Path", "(", "pathString", ")", ";", "this", ".", "variables", ".", "put", "(", "varName", ",", "varPath", ")", ";", "this", ".", "previousSessionVariables", ".", "put", "(", "varName", ",", "varPath", ")", ";", "}", "}", "else", "if", "(", "propertyName", ".", "startsWith", "(", "CP_CONTAINER_PREFERENCES_PREFIX", ")", ")", "{", "String", "propertyValue", "=", "preferences", ".", "get", "(", "propertyName", ",", "null", ")", ";", "if", "(", "propertyValue", "!=", "null", ")", "{", "preferences", ".", "remove", "(", "propertyName", ")", ";", "recreatePersistedContainer", "(", "propertyName", ",", "propertyValue", ",", "true", ")", ";", "}", "}", "}", "}", "catch", "(", "BackingStoreException", "e1", ")", "{", "}", "}", "private", "static", "final", "class", "PersistedClasspathContainer", "implements", "IClasspathContainer", "{", "private", "final", "IPath", "containerPath", ";", "private", "final", "IClasspathEntry", "[", "]", "entries", ";", "private", "final", "IJavaProject", "project", ";", "PersistedClasspathContainer", "(", "IJavaProject", "project", ",", "IPath", "containerPath", ",", "IClasspathEntry", "[", "]", "entries", ")", "{", "super", "(", ")", ";", "this", ".", "containerPath", "=", "containerPath", ";", "this", ".", "entries", "=", "entries", ";", "this", ".", "project", "=", "project", ";", "}", "public", "IClasspathEntry", "[", "]", "getClasspathEntries", "(", ")", "{", "return", "this", ".", "entries", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "\"\"", "+", "this", ".", "containerPath", "+", "\"\"", "+", "this", ".", "project", ".", "getElementName", "(", ")", "+", "\"]]\"", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "0", ";", "}", "public", "IPath", "getPath", "(", ")", "{", "return", "this", ".", "containerPath", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "getDescription", "(", ")", ";", "}", "}", "private", "final", "class", "VariablesAndContainersLoadHelper", "{", "private", "static", "final", "int", "ARRAY_INCREMENT", "=", "200", ";", "private", "IClasspathEntry", "[", "]", "allClasspathEntries", ";", "private", "int", "allClasspathEntryCount", ";", "private", "final", "Map", "allPaths", ";", "private", "String", "[", "]", "allStrings", ";", "private", "int", "allStringsCount", ";", "private", "final", "DataInputStream", "in", ";", "VariablesAndContainersLoadHelper", "(", "DataInputStream", "in", ")", "{", "super", "(", ")", ";", "this", ".", "allClasspathEntries", "=", "null", ";", "this", ".", "allClasspathEntryCount", "=", "0", ";", "this", ".", "allPaths", "=", "new", "HashMap", "(", ")", ";", "this", ".", "allStrings", "=", "null", ";", "this", ".", "allStringsCount", "=", "0", ";", "this", ".", "in", "=", "in", ";", "}", "void", "load", "(", ")", "throws", "IOException", "{", "loadProjects", "(", "getJavaModel", "(", ")", ")", ";", "loadVariables", "(", ")", ";", "}", "private", "IAccessRule", "loadAccessRule", "(", ")", "throws", "IOException", "{", "int", "problemId", "=", "loadInt", "(", ")", ";", "IPath", "pattern", "=", "loadPath", "(", ")", ";", "return", "new", "ClasspathAccessRule", "(", "pattern", ".", "toString", "(", ")", ".", "toCharArray", "(", ")", ",", "problemId", ")", ";", "}", "private", "IAccessRule", "[", "]", "loadAccessRules", "(", ")", "throws", "IOException", "{", "int", "count", "=", "loadInt", "(", ")", ";", "if", "(", "count", "==", "0", ")", "return", "ClasspathEntry", ".", "NO_ACCESS_RULES", ";", "IAccessRule", "[", "]", "rules", "=", "new", "IAccessRule", "[", "count", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "rules", "[", "i", "]", "=", "loadAccessRule", "(", ")", ";", "return", "rules", ";", "}", "private", "IClasspathAttribute", "loadAttribute", "(", ")", "throws", "IOException", "{", "String", "name", "=", "loadString", "(", ")", ";", "String", "value", "=", "loadString", "(", ")", ";", "return", "new", "ClasspathAttribute", "(", "name", ",", "value", ")", ";", "}", "private", "IClasspathAttribute", "[", "]", "loadAttributes", "(", ")", "throws", "IOException", "{", "int", "count", "=", "loadInt", "(", ")", ";", "if", "(", "count", "==", "0", ")", "return", "ClasspathEntry", ".", "NO_EXTRA_ATTRIBUTES", ";", "IClasspathAttribute", "[", "]", "attributes", "=", "new", "IClasspathAttribute", "[", "count", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "attributes", "[", "i", "]", "=", "loadAttribute", "(", ")", ";", "return", "attributes", ";", "}", "private", "boolean", "loadBoolean", "(", ")", "throws", "IOException", "{", "return", "this", ".", "in", ".", "readBoolean", "(", ")", ";", "}", "private", "IClasspathEntry", "[", "]", "loadClasspathEntries", "(", ")", "throws", "IOException", "{", "int", "count", "=", "loadInt", "(", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "new", "IClasspathEntry", "[", "count", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "entries", "[", "i", "]", "=", "loadClasspathEntry", "(", ")", ";", "return", "entries", ";", "}", "private", "IClasspathEntry", "loadClasspathEntry", "(", ")", "throws", "IOException", "{", "int", "id", "=", "loadInt", "(", ")", ";", "if", "(", "id", "<", "0", "||", "id", ">", "this", ".", "allClasspathEntryCount", ")", "throw", "new", "IOException", "(", "\"\"", ")", ";", "if", "(", "id", "<", "this", ".", "allClasspathEntryCount", ")", "return", "this", ".", "allClasspathEntries", "[", "id", "]", ";", "int", "contentKind", "=", "loadInt", "(", ")", ";", "int", "entryKind", "=", "loadInt", "(", ")", ";", "IPath", "path", "=", "loadPath", "(", ")", ";", "IPath", "[", "]", "inclusionPatterns", "=", "loadPaths", "(", ")", ";", "IPath", "[", "]", "exclusionPatterns", "=", "loadPaths", "(", ")", ";", "IPath", "sourceAttachmentPath", "=", "loadPath", "(", ")", ";", "IPath", "sourceAttachmentRootPath", "=", "loadPath", "(", ")", ";", "IPath", "specificOutputLocation", "=", "loadPath", "(", ")", ";", "boolean", "isExported", "=", "loadBoolean", "(", ")", ";", "IAccessRule", "[", "]", "accessRules", "=", "loadAccessRules", "(", ")", ";", "boolean", "combineAccessRules", "=", "loadBoolean", "(", ")", ";", "IClasspathAttribute", "[", "]", "extraAttributes", "=", "loadAttributes", "(", ")", ";", "IClasspathEntry", "entry", "=", "new", "ClasspathEntry", "(", "contentKind", ",", "entryKind", ",", "path", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "sourceAttachmentPath", ",", "sourceAttachmentRootPath", ",", "specificOutputLocation", ",", "isExported", ",", "accessRules", ",", "combineAccessRules", ",", "extraAttributes", ")", ";", "IClasspathEntry", "[", "]", "array", "=", "this", ".", "allClasspathEntries", ";", "if", "(", "array", "==", "null", "||", "id", "==", "array", ".", "length", ")", "{", "array", "=", "new", "IClasspathEntry", "[", "id", "+", "ARRAY_INCREMENT", "]", ";", "if", "(", "id", "!=", "0", ")", "System", ".", "arraycopy", "(", "this", ".", "allClasspathEntries", ",", "0", ",", "array", ",", "0", ",", "id", ")", ";", "this", ".", "allClasspathEntries", "=", "array", ";", "}", "array", "[", "id", "]", "=", "entry", ";", "this", ".", "allClasspathEntryCount", "=", "id", "+", "1", ";", "return", "entry", ";", "}", "private", "void", "loadContainers", "(", "IJavaProject", "project", ")", "throws", "IOException", "{", "boolean", "projectIsAccessible", "=", "project", ".", "getProject", "(", ")", ".", "isAccessible", "(", ")", ";", "int", "count", "=", "loadInt", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "IPath", "path", "=", "loadPath", "(", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "loadClasspathEntries", "(", ")", ";", "if", "(", "!", "projectIsAccessible", ")", "continue", ";", "IClasspathContainer", "container", "=", "new", "PersistedClasspathContainer", "(", "project", ",", "path", ",", "entries", ")", ";", "containerPut", "(", "project", ",", "path", ",", "container", ")", ";", "Map", "oldContainers", "=", "(", "Map", ")", "JavaModelManager", ".", "this", ".", "previousSessionContainers", ".", "get", "(", "project", ")", ";", "if", "(", "oldContainers", "==", "null", ")", "{", "oldContainers", "=", "new", "HashMap", "(", ")", ";", "JavaModelManager", ".", "this", ".", "previousSessionContainers", ".", "put", "(", "project", ",", "oldContainers", ")", ";", "}", "oldContainers", ".", "put", "(", "path", ",", "container", ")", ";", "}", "}", "private", "int", "loadInt", "(", ")", "throws", "IOException", "{", "return", "this", ".", "in", ".", "readInt", "(", ")", ";", "}", "private", "IPath", "loadPath", "(", ")", "throws", "IOException", "{", "if", "(", "loadBoolean", "(", ")", ")", "return", "null", ";", "String", "portableString", "=", "loadString", "(", ")", ";", "IPath", "path", "=", "(", "IPath", ")", "this", ".", "allPaths", ".", "get", "(", "portableString", ")", ";", "if", "(", "path", "==", "null", ")", "{", "path", "=", "Path", ".", "fromPortableString", "(", "portableString", ")", ";", "this", ".", "allPaths", ".", "put", "(", "portableString", ",", "path", ")", ";", "}", "return", "path", ";", "}", "private", "IPath", "[", "]", "loadPaths", "(", ")", "throws", "IOException", "{", "int", "count", "=", "loadInt", "(", ")", ";", "IPath", "[", "]", "pathArray", "=", "new", "IPath", "[", "count", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "pathArray", "[", "i", "]", "=", "loadPath", "(", ")", ";", "return", "pathArray", ";", "}", "private", "void", "loadProjects", "(", "IJavaModel", "model", ")", "throws", "IOException", "{", "int", "count", "=", "loadInt", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "String", "projectName", "=", "loadString", "(", ")", ";", "loadContainers", "(", "model", ".", "getJavaProject", "(", "projectName", ")", ")", ";", "}", "}", "private", "String", "loadString", "(", ")", "throws", "IOException", "{", "int", "id", "=", "loadInt", "(", ")", ";", "if", "(", "id", "<", "0", "||", "id", ">", "this", ".", "allStringsCount", ")", "throw", "new", "IOException", "(", "\"\"", ")", ";", "if", "(", "id", "<", "this", ".", "allStringsCount", ")", "return", "this", ".", "allStrings", "[", "id", "]", ";", "String", "string", "=", "this", ".", "in", ".", "readUTF", "(", ")", ";", "String", "[", "]", "array", "=", "this", ".", "allStrings", ";", "if", "(", "array", "==", "null", "||", "id", "==", "array", ".", "length", ")", "{", "array", "=", "new", "String", "[", "id", "+", "ARRAY_INCREMENT", "]", ";", "if", "(", "id", "!=", "0", ")", "System", ".", "arraycopy", "(", "this", ".", "allStrings", ",", "0", ",", "array", ",", "0", ",", "id", ")", ";", "this", ".", "allStrings", "=", "array", ";", "}", "array", "[", "id", "]", "=", "string", ";", "this", ".", "allStringsCount", "=", "id", "+", "1", ";", "return", "string", ";", "}", "private", "void", "loadVariables", "(", ")", "throws", "IOException", "{", "int", "size", "=", "loadInt", "(", ")", ";", "Map", "loadedVars", "=", "new", "HashMap", "(", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "++", "i", ")", "{", "String", "varName", "=", "loadString", "(", ")", ";", "IPath", "varPath", "=", "loadPath", "(", ")", ";", "if", "(", "varPath", "!=", "null", ")", "loadedVars", ".", "put", "(", "varName", ",", "varPath", ")", ";", "}", "JavaModelManager", ".", "this", ".", "previousSessionVariables", ".", "putAll", "(", "loadedVars", ")", ";", "JavaModelManager", ".", "this", ".", "variables", ".", "putAll", "(", "loadedVars", ")", ";", "}", "}", "protected", "synchronized", "Object", "peekAtInfo", "(", "IJavaElement", "element", ")", "{", "HashMap", "tempCache", "=", "(", "HashMap", ")", "this", ".", "temporaryCache", ".", "get", "(", ")", ";", "if", "(", "tempCache", "!=", "null", ")", "{", "Object", "result", "=", "tempCache", ".", "get", "(", "element", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "}", "return", "this", ".", "cache", ".", "peekAtInfo", "(", "element", ")", ";", "}", "public", "void", "prepareToSave", "(", "ISaveContext", "context", ")", "{", "}", "protected", "synchronized", "void", "putInfos", "(", "IJavaElement", "openedElement", ",", "Map", "newElements", ")", "{", "Object", "existingInfo", "=", "this", ".", "cache", ".", "peekAtInfo", "(", "openedElement", ")", ";", "if", "(", "openedElement", "instanceof", "IParent", ")", "{", "closeChildren", "(", "existingInfo", ")", ";", "}", "for", "(", "Iterator", "it", "=", "newElements", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "it", ".", "next", "(", ")", ";", "IJavaElement", "element", "=", "(", "IJavaElement", ")", "entry", ".", "getKey", "(", ")", ";", "if", "(", "element", "instanceof", "JarPackageFragmentRoot", ")", "{", "Object", "info", "=", "entry", ".", "getValue", "(", ")", ";", "it", ".", "remove", "(", ")", ";", "this", ".", "cache", ".", "putInfo", "(", "element", ",", "info", ")", ";", "}", "}", "Iterator", "iterator", "=", "newElements", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iterator", ".", "next", "(", ")", ";", "this", ".", "cache", ".", "putInfo", "(", "(", "IJavaElement", ")", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "private", "void", "closeChildren", "(", "Object", "info", ")", "{", "if", "(", "info", "instanceof", "JavaElementInfo", ")", "{", "IJavaElement", "[", "]", "children", "=", "(", "(", "JavaElementInfo", ")", "info", ")", ".", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "size", "=", "children", ".", "length", ";", "i", "<", "size", ";", "++", "i", ")", "{", "JavaElement", "child", "=", "(", "JavaElement", ")", "children", "[", "i", "]", ";", "try", "{", "child", ".", "close", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "}", "protected", "synchronized", "void", "putJarTypeInfo", "(", "IJavaElement", "type", ",", "Object", "info", ")", "{", "this", ".", "cache", ".", "jarTypeCache", ".", "put", "(", "type", ",", "info", ")", ";", "}", "protected", "Object", "readState", "(", "IProject", "project", ")", "throws", "CoreException", "{", "File", "file", "=", "getSerializationFile", "(", "project", ")", ";", "if", "(", "file", "!=", "null", "&&", "file", ".", "exists", "(", ")", ")", "{", "try", "{", "DataInputStream", "in", "=", "new", "DataInputStream", "(", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "file", ")", ")", ")", ";", "try", "{", "String", "pluginID", "=", "in", ".", "readUTF", "(", ")", ";", "if", "(", "!", "pluginID", ".", "equals", "(", "JavaCore", ".", "PLUGIN_ID", ")", ")", "throw", "new", "IOException", "(", "Messages", ".", "build_wrongFileFormat", ")", ";", "String", "kind", "=", "in", ".", "readUTF", "(", ")", ";", "if", "(", "!", "kind", ".", "equals", "(", "\"STATE\"", ")", ")", "throw", "new", "IOException", "(", "Messages", ".", "build_wrongFileFormat", ")", ";", "if", "(", "in", ".", "readBoolean", "(", ")", ")", "return", "JavaBuilder", ".", "readState", "(", "project", ",", "in", ")", ";", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "project", ".", "getName", "(", ")", ")", ";", "}", "finally", "{", "in", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "CoreException", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "Platform", ".", "PLUGIN_ERROR", ",", "\"\"", "+", "project", ".", "getName", "(", ")", ",", "e", ")", ")", ";", "}", "}", "else", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "{", "if", "(", "file", "==", "null", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "project", ")", ";", "else", "System", ".", "out", ".", "println", "(", "\"\"", "+", "file", ".", "getPath", "(", ")", "+", "\"\"", ")", ";", "}", "return", "null", ";", "}", "public", "static", "void", "recreatePersistedContainer", "(", "String", "propertyName", ",", "String", "containerString", ",", "boolean", "addToContainerValues", ")", "{", "int", "containerPrefixLength", "=", "CP_CONTAINER_PREFERENCES_PREFIX", ".", "length", "(", ")", ";", "int", "index", "=", "propertyName", ".", "indexOf", "(", "'|'", ",", "containerPrefixLength", ")", ";", "if", "(", "containerString", "!=", "null", ")", "containerString", "=", "containerString", ".", "trim", "(", ")", ";", "if", "(", "index", ">", "0", ")", "{", "String", "projectName", "=", "propertyName", ".", "substring", "(", "containerPrefixLength", ",", "index", ")", ".", "trim", "(", ")", ";", "IJavaProject", "project", "=", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProject", "(", "projectName", ")", ";", "IPath", "containerPath", "=", "new", "Path", "(", "propertyName", ".", "substring", "(", "index", "+", "1", ")", ".", "trim", "(", ")", ")", ";", "recreatePersistedContainer", "(", "project", ",", "containerPath", ",", "containerString", ",", "addToContainerValues", ")", ";", "}", "}", "private", "static", "void", "recreatePersistedContainer", "(", "final", "IJavaProject", "project", ",", "final", "IPath", "containerPath", ",", "String", "containerString", ",", "boolean", "addToContainerValues", ")", "{", "if", "(", "!", "project", ".", "getProject", "(", ")", ".", "isAccessible", "(", ")", ")", "return", ";", "if", "(", "containerString", "==", "null", ")", "{", "getJavaModelManager", "(", ")", ".", "containerPut", "(", "project", ",", "containerPath", ",", "null", ")", ";", "}", "else", "{", "IClasspathEntry", "[", "]", "entries", ";", "try", "{", "entries", "=", "(", "(", "JavaProject", ")", "project", ")", ".", "decodeClasspath", "(", "containerString", ",", "null", ")", "[", "0", "]", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", "+", "containerString", ")", ";", "entries", "=", "JavaProject", ".", "INVALID_CLASSPATH", ";", "}", "if", "(", "entries", "!=", "JavaProject", ".", "INVALID_CLASSPATH", ")", "{", "final", "IClasspathEntry", "[", "]", "containerEntries", "=", "entries", ";", "IClasspathContainer", "container", "=", "new", "IClasspathContainer", "(", ")", "{", "public", "IClasspathEntry", "[", "]", "getClasspathEntries", "(", ")", "{", "return", "containerEntries", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "\"\"", "+", "containerPath", "+", "\"\"", "+", "project", ".", "getElementName", "(", ")", "+", "\"]\"", ";", "}", "public", "int", "getKind", "(", ")", "{", "return", "0", ";", "}", "public", "IPath", "getPath", "(", ")", "{", "return", "containerPath", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "getDescription", "(", ")", ";", "}", "}", ";", "if", "(", "addToContainerValues", ")", "{", "getJavaModelManager", "(", ")", ".", "containerPut", "(", "project", ",", "containerPath", ",", "container", ")", ";", "}", "Map", "projectContainers", "=", "(", "Map", ")", "getJavaModelManager", "(", ")", ".", "previousSessionContainers", ".", "get", "(", "project", ")", ";", "if", "(", "projectContainers", "==", "null", ")", "{", "projectContainers", "=", "new", "HashMap", "(", "1", ")", ";", "getJavaModelManager", "(", ")", ".", "previousSessionContainers", ".", "put", "(", "project", ",", "projectContainers", ")", ";", "}", "projectContainers", ".", "put", "(", "containerPath", ",", "container", ")", ";", "}", "}", "}", "public", "void", "rememberScope", "(", "AbstractSearchScope", "scope", ")", "{", "this", ".", "searchScopes", ".", "put", "(", "scope", ",", "null", ")", ";", "}", "public", "synchronized", "Object", "removeInfoAndChildren", "(", "JavaElement", "element", ")", "throws", "JavaModelException", "{", "Object", "info", "=", "this", ".", "cache", ".", "peekAtInfo", "(", "element", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "boolean", "wasVerbose", "=", "false", ";", "try", "{", "if", "(", "JavaModelCache", ".", "VERBOSE", ")", "{", "String", "elementType", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "elementType", "=", "\"project\"", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "elementType", "=", "\"root\"", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "elementType", "=", "\"package\"", ";", "break", ";", "case", "IJavaElement", ".", "CLASS_FILE", ":", "elementType", "=", "\"class", "file\"", ";", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "elementType", "=", "\"\"", ";", "break", ";", "default", ":", "elementType", "=", "\"element\"", ";", "}", "System", ".", "out", ".", "println", "(", "Thread", ".", "currentThread", "(", ")", "+", "\"", "CLOSING", "\"", "+", "elementType", "+", "\"", "\"", "+", "element", ".", "toStringWithAncestors", "(", ")", ")", ";", "wasVerbose", "=", "true", ";", "JavaModelCache", ".", "VERBOSE", "=", "false", ";", "}", "element", ".", "closing", "(", "info", ")", ";", "if", "(", "element", "instanceof", "IParent", ")", "{", "closeChildren", "(", "info", ")", ";", "}", "this", ".", "cache", ".", "removeInfo", "(", "element", ")", ";", "if", "(", "wasVerbose", ")", "{", "System", ".", "out", ".", "println", "(", "this", ".", "cache", ".", "toStringFillingRation", "(", "\"->", "\"", ")", ")", ";", "}", "}", "finally", "{", "JavaModelCache", ".", "VERBOSE", "=", "wasVerbose", ";", "}", "return", "info", ";", "}", "return", "null", ";", "}", "public", "void", "removePerProjectInfo", "(", "JavaProject", "javaProject", ",", "boolean", "removeExtJarInfo", ")", "{", "synchronized", "(", "this", ".", "perProjectInfos", ")", "{", "IProject", "project", "=", "javaProject", ".", "getProject", "(", ")", ";", "PerProjectInfo", "info", "=", "(", "PerProjectInfo", ")", "this", ".", "perProjectInfos", ".", "get", "(", "project", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "this", ".", "perProjectInfos", ".", "remove", "(", "project", ")", ";", "if", "(", "removeExtJarInfo", ")", "{", "info", ".", "forgetExternalTimestampsAndIndexes", "(", ")", ";", "}", "}", "}", "resetClasspathListCache", "(", ")", ";", "}", "public", "void", "resetProjectOptions", "(", "JavaProject", "javaProject", ")", "{", "synchronized", "(", "this", ".", "perProjectInfos", ")", "{", "IProject", "project", "=", "javaProject", ".", "getProject", "(", ")", ";", "PerProjectInfo", "info", "=", "(", "PerProjectInfo", ")", "this", ".", "perProjectInfos", ".", "get", "(", "project", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "info", ".", "options", "=", "null", ";", "}", "}", "}", "public", "void", "resetProjectPreferences", "(", "JavaProject", "javaProject", ")", "{", "synchronized", "(", "this", ".", "perProjectInfos", ")", "{", "IProject", "project", "=", "javaProject", ".", "getProject", "(", ")", ";", "PerProjectInfo", "info", "=", "(", "PerProjectInfo", ")", "this", ".", "perProjectInfos", ".", "get", "(", "project", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "info", ".", "preferences", "=", "null", ";", "}", "}", "}", "public", "static", "final", "void", "doNotUse", "(", ")", "{", "MANAGER", ".", "deltaState", ".", "doNotUse", "(", ")", ";", "MANAGER", "=", "new", "JavaModelManager", "(", ")", ";", "}", "protected", "synchronized", "void", "resetJarTypeCache", "(", ")", "{", "this", ".", "cache", ".", "resetJarTypeCache", "(", ")", ";", "}", "public", "void", "resetClasspathListCache", "(", ")", "{", "if", "(", "this", ".", "nonChainingJars", "!=", "null", ")", "this", ".", "nonChainingJars", ".", "clear", "(", ")", ";", "if", "(", "this", ".", "invalidArchives", "!=", "null", ")", "this", ".", "invalidArchives", ".", "clear", "(", ")", ";", "}", "public", "void", "resetTemporaryCache", "(", ")", "{", "this", ".", "temporaryCache", ".", "set", "(", "null", ")", ";", "}", "public", "void", "rollback", "(", "ISaveContext", "context", ")", "{", "}", "private", "void", "saveState", "(", "PerProjectInfo", "info", ",", "ISaveContext", "context", ")", "throws", "CoreException", "{", "if", "(", "context", ".", "getKind", "(", ")", "==", "ISaveContext", ".", "SNAPSHOT", ")", "return", ";", "if", "(", "info", ".", "triedRead", ")", "saveBuiltState", "(", "info", ")", ";", "}", "private", "void", "saveBuiltState", "(", "PerProjectInfo", "info", ")", "throws", "CoreException", "{", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "build_saveStateProgress", ",", "info", ".", "project", ".", "getName", "(", ")", ")", ")", ";", "File", "file", "=", "getSerializationFile", "(", "info", ".", "project", ")", ";", "if", "(", "file", "==", "null", ")", "return", ";", "long", "t", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "{", "DataOutputStream", "out", "=", "new", "DataOutputStream", "(", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "file", ")", ")", ")", ";", "try", "{", "out", ".", "writeUTF", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "out", ".", "writeUTF", "(", "\"STATE\"", ")", ";", "if", "(", "info", ".", "savedState", "==", "null", ")", "{", "out", ".", "writeBoolean", "(", "false", ")", ";", "}", "else", "{", "out", ".", "writeBoolean", "(", "true", ")", ";", "JavaBuilder", ".", "writeState", "(", "info", ".", "savedState", ",", "out", ")", ";", "}", "}", "finally", "{", "out", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "RuntimeException", "e", ")", "{", "try", "{", "file", ".", "delete", "(", ")", ";", "}", "catch", "(", "SecurityException", "se", ")", "{", "}", "throw", "new", "CoreException", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "Platform", ".", "PLUGIN_ERROR", ",", "Messages", ".", "bind", "(", "Messages", ".", "build_cannotSaveState", ",", "info", ".", "project", ".", "getName", "(", ")", ")", ",", "e", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "try", "{", "file", ".", "delete", "(", ")", ";", "}", "catch", "(", "SecurityException", "se", ")", "{", "}", "throw", "new", "CoreException", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "Platform", ".", "PLUGIN_ERROR", ",", "Messages", ".", "bind", "(", "Messages", ".", "build_cannotSaveState", ",", "info", ".", "project", ".", "getName", "(", ")", ")", ",", "e", ")", ")", ";", "}", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "{", "t", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "t", ";", "System", ".", "out", ".", "println", "(", "Messages", ".", "bind", "(", "Messages", ".", "build_saveStateComplete", ",", "String", ".", "valueOf", "(", "t", ")", ")", ")", ";", "}", "}", "private", "void", "saveClasspathListCache", "(", "String", "cacheName", ")", "throws", "CoreException", "{", "File", "file", "=", "getClasspathListFile", "(", "cacheName", ")", ";", "DataOutputStream", "out", "=", "null", ";", "try", "{", "out", "=", "new", "DataOutputStream", "(", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "file", ")", ")", ")", ";", "Set", "pathCache", "=", "getClasspathListCache", "(", "cacheName", ")", ";", "synchronized", "(", "pathCache", ")", "{", "out", ".", "writeInt", "(", "pathCache", ".", "size", "(", ")", ")", ";", "Iterator", "entries", "=", "pathCache", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "IPath", "path", "=", "(", "IPath", ")", "entries", ".", "next", "(", ")", ";", "out", ".", "writeUTF", "(", "path", ".", "toPortableString", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "IStatus", "status", "=", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "IStatus", ".", "ERROR", ",", "\"\"", ",", "e", ")", ";", "throw", "new", "CoreException", "(", "status", ")", ";", "}", "finally", "{", "if", "(", "out", "!=", "null", ")", "{", "try", "{", "out", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}", "private", "void", "saveVariablesAndContainers", "(", "ISaveContext", "context", ")", "throws", "CoreException", "{", "File", "file", "=", "getVariableAndContainersFile", "(", ")", ";", "DataOutputStream", "out", "=", "null", ";", "try", "{", "out", "=", "new", "DataOutputStream", "(", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "file", ")", ")", ")", ";", "out", ".", "writeInt", "(", "VARIABLES_AND_CONTAINERS_FILE_VERSION", ")", ";", "new", "VariablesAndContainersSaveHelper", "(", "out", ")", ".", "save", "(", "context", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "IStatus", "status", "=", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "JavaCore", ".", "PLUGIN_ID", ",", "IStatus", ".", "ERROR", ",", "\"\"", ",", "e", ")", ";", "throw", "new", "CoreException", "(", "status", ")", ";", "}", "finally", "{", "if", "(", "out", "!=", "null", ")", "{", "try", "{", "out", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}", "private", "final", "class", "VariablesAndContainersSaveHelper", "{", "private", "final", "HashtableOfObjectToInt", "classpathEntryIds", ";", "private", "final", "DataOutputStream", "out", ";", "private", "final", "HashtableOfObjectToInt", "stringIds", ";", "VariablesAndContainersSaveHelper", "(", "DataOutputStream", "out", ")", "{", "super", "(", ")", ";", "this", ".", "classpathEntryIds", "=", "new", "HashtableOfObjectToInt", "(", ")", ";", "this", ".", "out", "=", "out", ";", "this", ".", "stringIds", "=", "new", "HashtableOfObjectToInt", "(", ")", ";", "}", "void", "save", "(", "ISaveContext", "context", ")", "throws", "IOException", ",", "JavaModelException", "{", "saveProjects", "(", "getJavaModel", "(", ")", ".", "getJavaProjects", "(", ")", ")", ";", "HashMap", "varsToSave", "=", "null", ";", "Iterator", "iterator", "=", "JavaModelManager", ".", "this", ".", "variables", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "IEclipsePreferences", "defaultPreferences", "=", "getDefaultPreferences", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "iterator", ".", "next", "(", ")", ";", "String", "varName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "if", "(", "defaultPreferences", ".", "get", "(", "CP_VARIABLE_PREFERENCES_PREFIX", "+", "varName", ",", "null", ")", "!=", "null", "||", "CP_ENTRY_IGNORE_PATH", ".", "equals", "(", "entry", ".", "getValue", "(", ")", ")", ")", "{", "if", "(", "varsToSave", "==", "null", ")", "varsToSave", "=", "new", "HashMap", "(", "JavaModelManager", ".", "this", ".", "variables", ")", ";", "varsToSave", ".", "remove", "(", "varName", ")", ";", "}", "}", "saveVariables", "(", "varsToSave", "!=", "null", "?", "varsToSave", ":", "JavaModelManager", ".", "this", ".", "variables", ")", ";", "}", "private", "void", "saveAccessRule", "(", "ClasspathAccessRule", "rule", ")", "throws", "IOException", "{", "saveInt", "(", "rule", ".", "problemId", ")", ";", "savePath", "(", "rule", ".", "getPattern", "(", ")", ")", ";", "}", "private", "void", "saveAccessRules", "(", "IAccessRule", "[", "]", "rules", ")", "throws", "IOException", "{", "int", "count", "=", "rules", "==", "null", "?", "0", ":", "rules", ".", "length", ";", "saveInt", "(", "count", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "saveAccessRule", "(", "(", "ClasspathAccessRule", ")", "rules", "[", "i", "]", ")", ";", "}", "private", "void", "saveAttribute", "(", "IClasspathAttribute", "attribute", ")", "throws", "IOException", "{", "saveString", "(", "attribute", ".", "getName", "(", ")", ")", ";", "saveString", "(", "attribute", ".", "getValue", "(", ")", ")", ";", "}", "private", "void", "saveAttributes", "(", "IClasspathAttribute", "[", "]", "attributes", ")", "throws", "IOException", "{", "int", "count", "=", "attributes", "==", "null", "?", "0", ":", "attributes", ".", "length", ";", "saveInt", "(", "count", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "saveAttribute", "(", "attributes", "[", "i", "]", ")", ";", "}", "private", "void", "saveClasspathEntries", "(", "IClasspathEntry", "[", "]", "entries", ")", "throws", "IOException", "{", "int", "count", "=", "entries", "==", "null", "?", "0", ":", "entries", ".", "length", ";", "saveInt", "(", "count", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "saveClasspathEntry", "(", "entries", "[", "i", "]", ")", ";", "}", "private", "void", "saveClasspathEntry", "(", "IClasspathEntry", "entry", ")", "throws", "IOException", "{", "if", "(", "saveNewId", "(", "entry", ",", "this", ".", "classpathEntryIds", ")", ")", "{", "saveInt", "(", "entry", ".", "getContentKind", "(", ")", ")", ";", "saveInt", "(", "entry", ".", "getEntryKind", "(", ")", ")", ";", "savePath", "(", "entry", ".", "getPath", "(", ")", ")", ";", "savePaths", "(", "entry", ".", "getInclusionPatterns", "(", ")", ")", ";", "savePaths", "(", "entry", ".", "getExclusionPatterns", "(", ")", ")", ";", "savePath", "(", "entry", ".", "getSourceAttachmentPath", "(", ")", ")", ";", "savePath", "(", "entry", ".", "getSourceAttachmentRootPath", "(", ")", ")", ";", "savePath", "(", "entry", ".", "getOutputLocation", "(", ")", ")", ";", "this", ".", "out", ".", "writeBoolean", "(", "entry", ".", "isExported", "(", ")", ")", ";", "saveAccessRules", "(", "entry", ".", "getAccessRules", "(", ")", ")", ";", "this", ".", "out", ".", "writeBoolean", "(", "entry", ".", "combineAccessRules", "(", ")", ")", ";", "saveAttributes", "(", "entry", ".", "getExtraAttributes", "(", ")", ")", ";", "}", "}", "private", "void", "saveContainers", "(", "IJavaProject", "project", ",", "Map", "containerMap", ")", "throws", "IOException", "{", "saveInt", "(", "containerMap", ".", "size", "(", ")", ")", ";", "for", "(", "Iterator", "i", "=", "containerMap", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Entry", "entry", "=", "(", "Entry", ")", "i", ".", "next", "(", ")", ";", "IPath", "path", "=", "(", "IPath", ")", "entry", ".", "getKey", "(", ")", ";", "IClasspathContainer", "container", "=", "(", "IClasspathContainer", ")", "entry", ".", "getValue", "(", ")", ";", "IClasspathEntry", "[", "]", "cpEntries", "=", "null", ";", "if", "(", "container", "==", "null", ")", "{", "container", "=", "getPreviousSessionContainer", "(", "path", ",", "project", ")", ";", "}", "if", "(", "container", "!=", "null", ")", "cpEntries", "=", "container", ".", "getClasspathEntries", "(", ")", ";", "savePath", "(", "path", ")", ";", "saveClasspathEntries", "(", "cpEntries", ")", ";", "}", "}", "private", "void", "saveInt", "(", "int", "value", ")", "throws", "IOException", "{", "this", ".", "out", ".", "writeInt", "(", "value", ")", ";", "}", "private", "boolean", "saveNewId", "(", "Object", "key", ",", "HashtableOfObjectToInt", "map", ")", "throws", "IOException", "{", "int", "id", "=", "map", ".", "get", "(", "key", ")", ";", "if", "(", "id", "==", "-", "1", ")", "{", "int", "newId", "=", "map", ".", "size", "(", ")", ";", "map", ".", "put", "(", "key", ",", "newId", ")", ";", "saveInt", "(", "newId", ")", ";", "return", "true", ";", "}", "else", "{", "saveInt", "(", "id", ")", ";", "return", "false", ";", "}", "}", "private", "void", "savePath", "(", "IPath", "path", ")", "throws", "IOException", "{", "if", "(", "path", "==", "null", ")", "{", "this", ".", "out", ".", "writeBoolean", "(", "true", ")", ";", "}", "else", "{", "this", ".", "out", ".", "writeBoolean", "(", "false", ")", ";", "saveString", "(", "path", ".", "toPortableString", "(", ")", ")", ";", "}", "}", "private", "void", "savePaths", "(", "IPath", "[", "]", "paths", ")", "throws", "IOException", "{", "int", "count", "=", "paths", "==", "null", "?", "0", ":", "paths", ".", "length", ";", "saveInt", "(", "count", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "savePath", "(", "paths", "[", "i", "]", ")", ";", "}", "private", "void", "saveProjects", "(", "IJavaProject", "[", "]", "projects", ")", "throws", "IOException", ",", "JavaModelException", "{", "int", "count", "=", "projects", ".", "length", ";", "saveInt", "(", "count", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "IJavaProject", "project", "=", "projects", "[", "i", "]", ";", "saveString", "(", "project", ".", "getElementName", "(", ")", ")", ";", "Map", "containerMap", "=", "(", "Map", ")", "JavaModelManager", ".", "this", ".", "containers", ".", "get", "(", "project", ")", ";", "if", "(", "containerMap", "==", "null", ")", "{", "containerMap", "=", "Collections", ".", "EMPTY_MAP", ";", "}", "else", "{", "containerMap", "=", "new", "HashMap", "(", "containerMap", ")", ";", "}", "saveContainers", "(", "project", ",", "containerMap", ")", ";", "}", "}", "private", "void", "saveString", "(", "String", "string", ")", "throws", "IOException", "{", "if", "(", "saveNewId", "(", "string", ",", "this", ".", "stringIds", ")", ")", "this", ".", "out", ".", "writeUTF", "(", "string", ")", ";", "}", "private", "void", "saveVariables", "(", "Map", "map", ")", "throws", "IOException", "{", "saveInt", "(", "map", ".", "size", "(", ")", ")", ";", "for", "(", "Iterator", "i", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Entry", "entry", "=", "(", "Entry", ")", "i", ".", "next", "(", ")", ";", "String", "varName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "IPath", "varPath", "=", "(", "IPath", ")", "entry", ".", "getValue", "(", ")", ";", "saveString", "(", "varName", ")", ";", "savePath", "(", "varPath", ")", ";", "}", "}", "}", "private", "void", "traceVariableAndContainers", "(", "String", "action", ",", "long", "start", ")", "{", "Long", "delta", "=", "new", "Long", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", ";", "Long", "length", "=", "new", "Long", "(", "getVariableAndContainersFile", "(", ")", ".", "length", "(", ")", ")", ";", "String", "pattern", "=", "\"\"", ";", "String", "message", "=", "MessageFormat", ".", "format", "(", "pattern", ",", "new", "Object", "[", "]", "{", "action", ",", "length", ",", "delta", "}", ")", ";", "System", ".", "out", ".", "println", "(", "message", ")", ";", "}", "public", "void", "saving", "(", "ISaveContext", "context", ")", "throws", "CoreException", "{", "long", "start", "=", "-", "1", ";", "if", "(", "VERBOSE", ")", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "saveVariablesAndContainers", "(", "context", ")", ";", "if", "(", "VERBOSE", ")", "traceVariableAndContainers", "(", "\"Saved\"", ",", "start", ")", ";", "switch", "(", "context", ".", "getKind", "(", ")", ")", "{", "case", "ISaveContext", ".", "FULL_SAVE", ":", "{", "saveClasspathListCache", "(", "NON_CHAINING_JARS_CACHE", ")", ";", "saveClasspathListCache", "(", "INVALID_ARCHIVES_CACHE", ")", ";", "context", ".", "needDelta", "(", ")", ";", "IndexManager", "manager", "=", "this", ".", "indexManager", ";", "if", "(", "manager", "!=", "null", "&&", "this", ".", "workspaceScope", "!=", "null", ")", "{", "manager", ".", "cleanUpIndexes", "(", ")", ";", "}", "}", "case", "ISaveContext", ".", "SNAPSHOT", ":", "{", "this", ".", "externalFoldersManager", ".", "cleanUp", "(", "null", ")", ";", "}", "}", "IProject", "savedProject", "=", "context", ".", "getProject", "(", ")", ";", "if", "(", "savedProject", "!=", "null", ")", "{", "if", "(", "!", "JavaProject", ".", "hasJavaNature", "(", "savedProject", ")", ")", "return", ";", "PerProjectInfo", "info", "=", "getPerProjectInfo", "(", "savedProject", ",", "true", ")", ";", "saveState", "(", "info", ",", "context", ")", ";", "return", ";", "}", "ArrayList", "vStats", "=", "null", ";", "ArrayList", "values", "=", "null", ";", "synchronized", "(", "this", ".", "perProjectInfos", ")", "{", "values", "=", "new", "ArrayList", "(", "this", ".", "perProjectInfos", ".", "values", "(", ")", ")", ";", "}", "Iterator", "iterator", "=", "values", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "try", "{", "PerProjectInfo", "info", "=", "(", "PerProjectInfo", ")", "iterator", ".", "next", "(", ")", ";", "saveState", "(", "info", ",", "context", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "vStats", "==", "null", ")", "vStats", "=", "new", "ArrayList", "(", ")", ";", "vStats", ".", "add", "(", "e", ".", "getStatus", "(", ")", ")", ";", "}", "}", "if", "(", "vStats", "!=", "null", ")", "{", "IStatus", "[", "]", "stats", "=", "new", "IStatus", "[", "vStats", ".", "size", "(", ")", "]", ";", "vStats", ".", "toArray", "(", "stats", ")", ";", "throw", "new", "CoreException", "(", "new", "MultiStatus", "(", "JavaCore", ".", "PLUGIN_ID", ",", "IStatus", ".", "ERROR", ",", "stats", ",", "Messages", ".", "build_cannotSaveStates", ",", "null", ")", ")", ";", "}", "this", ".", "deltaState", ".", "saveExternalLibTimeStamps", "(", ")", ";", "}", "public", "void", "secondaryTypeAdding", "(", "String", "path", ",", "char", "[", "]", "typeName", ",", "char", "[", "]", "packageName", ")", "{", "if", "(", "VERBOSE", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "path", ")", ";", "buffer", ".", "append", "(", "','", ")", ";", "buffer", ".", "append", "(", "'['", ")", ";", "buffer", ".", "append", "(", "new", "String", "(", "packageName", ")", ")", ";", "buffer", ".", "append", "(", "'.'", ")", ";", "buffer", ".", "append", "(", "new", "String", "(", "typeName", ")", ")", ";", "buffer", ".", "append", "(", "']'", ")", ";", "buffer", ".", "append", "(", "')'", ")", ";", "Util", ".", "verbose", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "IWorkspaceRoot", "wRoot", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "IResource", "resource", "=", "wRoot", ".", "findMember", "(", "path", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "path", ")", "&&", "resource", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", ")", "{", "IProject", "project", "=", "resource", ".", "getProject", "(", ")", ";", "try", "{", "PerProjectInfo", "projectInfo", "=", "getPerProjectInfoCheckExistence", "(", "project", ")", ";", "HashMap", "indexedSecondaryTypes", "=", "null", ";", "if", "(", "projectInfo", ".", "secondaryTypes", "==", "null", ")", "{", "projectInfo", ".", "secondaryTypes", "=", "new", "Hashtable", "(", "3", ")", ";", "indexedSecondaryTypes", "=", "new", "HashMap", "(", "3", ")", ";", "projectInfo", ".", "secondaryTypes", ".", "put", "(", "INDEXED_SECONDARY_TYPES", ",", "indexedSecondaryTypes", ")", ";", "}", "else", "{", "indexedSecondaryTypes", "=", "(", "HashMap", ")", "projectInfo", ".", "secondaryTypes", ".", "get", "(", "INDEXED_SECONDARY_TYPES", ")", ";", "if", "(", "indexedSecondaryTypes", "==", "null", ")", "{", "indexedSecondaryTypes", "=", "new", "HashMap", "(", "3", ")", ";", "projectInfo", ".", "secondaryTypes", ".", "put", "(", "INDEXED_SECONDARY_TYPES", ",", "indexedSecondaryTypes", ")", ";", "}", "}", "HashMap", "allTypes", "=", "(", "HashMap", ")", "indexedSecondaryTypes", ".", "get", "(", "resource", ")", ";", "if", "(", "allTypes", "==", "null", ")", "{", "allTypes", "=", "new", "HashMap", "(", "3", ")", ";", "indexedSecondaryTypes", ".", "put", "(", "resource", ",", "allTypes", ")", ";", "}", "ICompilationUnit", "unit", "=", "JavaModelManager", ".", "createCompilationUnitFrom", "(", "(", "IFile", ")", "resource", ",", "null", ")", ";", "if", "(", "unit", "!=", "null", ")", "{", "String", "typeString", "=", "new", "String", "(", "typeName", ")", ";", "IType", "type", "=", "unit", ".", "getType", "(", "typeString", ")", ";", "String", "packageString", "=", "type", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ";", "HashMap", "packageTypes", "=", "(", "HashMap", ")", "allTypes", ".", "get", "(", "packageString", ")", ";", "if", "(", "packageTypes", "==", "null", ")", "{", "packageTypes", "=", "new", "HashMap", "(", "3", ")", ";", "allTypes", ".", "put", "(", "packageString", ",", "packageTypes", ")", ";", "}", "packageTypes", ".", "put", "(", "typeString", ",", "type", ")", ";", "}", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "Iterator", "entries", "=", "indexedSecondaryTypes", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "IFile", "file", "=", "(", "IFile", ")", "entry", ".", "getKey", "(", ")", ";", "Util", ".", "verbose", "(", "\"tt+", "\"", "+", "file", ".", "getFullPath", "(", ")", "+", "':'", "+", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "jme", ")", "{", "}", "}", "}", "}", "public", "Map", "secondaryTypes", "(", "IJavaProject", "project", ",", "boolean", "waitForIndexes", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "VERBOSE", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "project", ".", "getElementName", "(", ")", ")", ";", "buffer", ".", "append", "(", "','", ")", ";", "buffer", ".", "append", "(", "waitForIndexes", ")", ";", "buffer", ".", "append", "(", "')'", ")", ";", "Util", ".", "verbose", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "final", "PerProjectInfo", "projectInfo", "=", "getPerProjectInfoCheckExistence", "(", "project", ".", "getProject", "(", ")", ")", ";", "Map", "indexingSecondaryCache", "=", "projectInfo", ".", "secondaryTypes", "==", "null", "?", "null", ":", "(", "Map", ")", "projectInfo", ".", "secondaryTypes", ".", "get", "(", "INDEXED_SECONDARY_TYPES", ")", ";", "if", "(", "projectInfo", ".", "secondaryTypes", "!=", "null", "&&", "indexingSecondaryCache", "==", "null", ")", "{", "return", "projectInfo", ".", "secondaryTypes", ";", "}", "if", "(", "projectInfo", ".", "secondaryTypes", "==", "null", ")", "{", "return", "secondaryTypesSearching", "(", "project", ",", "waitForIndexes", ",", "monitor", ",", "projectInfo", ")", ";", "}", "boolean", "indexing", "=", "this", ".", "indexManager", ".", "awaitingJobsCount", "(", ")", ">", "0", ";", "if", "(", "indexing", ")", "{", "if", "(", "!", "waitForIndexes", ")", "{", "return", "projectInfo", ".", "secondaryTypes", ";", "}", "while", "(", "this", ".", "indexManager", ".", "awaitingJobsCount", "(", ")", ">", "0", ")", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "{", "return", "projectInfo", ".", "secondaryTypes", ";", "}", "try", "{", "Thread", ".", "sleep", "(", "10", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "return", "projectInfo", ".", "secondaryTypes", ";", "}", "}", "}", "return", "secondaryTypesMerging", "(", "projectInfo", ".", "secondaryTypes", ")", ";", "}", "private", "Hashtable", "secondaryTypesMerging", "(", "Hashtable", "secondaryTypes", ")", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "Util", ".", "verbose", "(", "\"\"", ")", ";", "Iterator", "entries", "=", "secondaryTypes", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "String", "packName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "Util", ".", "verbose", "(", "\"tt+", "\"", "+", "packName", "+", "':'", "+", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "HashMap", "indexedSecondaryTypes", "=", "(", "HashMap", ")", "secondaryTypes", ".", "remove", "(", "INDEXED_SECONDARY_TYPES", ")", ";", "if", "(", "indexedSecondaryTypes", "==", "null", ")", "{", "return", "secondaryTypes", ";", "}", "Iterator", "entries", "=", "indexedSecondaryTypes", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "IFile", "file", "=", "(", "IFile", ")", "entry", ".", "getKey", "(", ")", ";", "secondaryTypesRemoving", "(", "secondaryTypes", ",", "file", ")", ";", "HashMap", "fileSecondaryTypes", "=", "(", "HashMap", ")", "entry", ".", "getValue", "(", ")", ";", "Iterator", "entries2", "=", "fileSecondaryTypes", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries2", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry2", "=", "(", "Map", ".", "Entry", ")", "entries2", ".", "next", "(", ")", ";", "String", "packageName", "=", "(", "String", ")", "entry2", ".", "getKey", "(", ")", ";", "HashMap", "cachedTypes", "=", "(", "HashMap", ")", "secondaryTypes", ".", "get", "(", "packageName", ")", ";", "if", "(", "cachedTypes", "==", "null", ")", "{", "secondaryTypes", ".", "put", "(", "packageName", ",", "entry2", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "HashMap", "types", "=", "(", "HashMap", ")", "entry2", ".", "getValue", "(", ")", ";", "Iterator", "entries3", "=", "types", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries3", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry3", "=", "(", "Map", ".", "Entry", ")", "entries3", ".", "next", "(", ")", ";", "String", "typeName", "=", "(", "String", ")", "entry3", ".", "getKey", "(", ")", ";", "cachedTypes", ".", "put", "(", "typeName", ",", "entry3", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "}", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "entries", "=", "secondaryTypes", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "String", "packName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "Util", ".", "verbose", "(", "\"tt+", "\"", "+", "packName", "+", "':'", "+", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "return", "secondaryTypes", ";", "}", "private", "Map", "secondaryTypesSearching", "(", "IJavaProject", "project", ",", "boolean", "waitForIndexes", ",", "IProgressMonitor", "monitor", ",", "final", "PerProjectInfo", "projectInfo", ")", "throws", "JavaModelException", "{", "if", "(", "VERBOSE", "||", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "project", ".", "getElementName", "(", ")", ")", ";", "buffer", ".", "append", "(", "','", ")", ";", "buffer", ".", "append", "(", "waitForIndexes", ")", ";", "buffer", ".", "append", "(", "')'", ")", ";", "Util", ".", "verbose", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "final", "Hashtable", "secondaryTypes", "=", "new", "Hashtable", "(", "3", ")", ";", "IRestrictedAccessTypeRequestor", "nameRequestor", "=", "new", "IRestrictedAccessTypeRequestor", "(", ")", "{", "public", "void", "acceptType", "(", "int", "modifiers", ",", "char", "[", "]", "packageName", ",", "char", "[", "]", "simpleTypeName", ",", "char", "[", "]", "[", "]", "enclosingTypeNames", ",", "String", "path", ",", "AccessRestriction", "access", ")", "{", "String", "key", "=", "packageName", "==", "null", "?", "\"\"", ":", "new", "String", "(", "packageName", ")", ";", "HashMap", "types", "=", "(", "HashMap", ")", "secondaryTypes", ".", "get", "(", "key", ")", ";", "if", "(", "types", "==", "null", ")", "types", "=", "new", "HashMap", "(", "3", ")", ";", "types", ".", "put", "(", "new", "String", "(", "simpleTypeName", ")", ",", "path", ")", ";", "secondaryTypes", ".", "put", "(", "key", ",", "types", ")", ";", "}", "}", ";", "IPackageFragmentRoot", "[", "]", "allRoots", "=", "project", ".", "getAllPackageFragmentRoots", "(", ")", ";", "int", "length", "=", "allRoots", ".", "length", ",", "size", "=", "0", ";", "IPackageFragmentRoot", "[", "]", "allSourceFolders", "=", "new", "IPackageFragmentRoot", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "allRoots", "[", "i", "]", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_SOURCE", ")", "{", "allSourceFolders", "[", "size", "++", "]", "=", "allRoots", "[", "i", "]", ";", "}", "}", "if", "(", "size", "<", "length", ")", "{", "System", ".", "arraycopy", "(", "allSourceFolders", ",", "0", ",", "allSourceFolders", "=", "new", "IPackageFragmentRoot", "[", "size", "]", ",", "0", ",", "size", ")", ";", "}", "new", "BasicSearchEngine", "(", ")", ".", "searchAllSecondaryTypeNames", "(", "allSourceFolders", ",", "nameRequestor", ",", "waitForIndexes", ",", "monitor", ")", ";", "Iterator", "packages", "=", "secondaryTypes", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "packages", ".", "hasNext", "(", ")", ")", "{", "HashMap", "types", "=", "(", "HashMap", ")", "packages", ".", "next", "(", ")", ";", "Iterator", "names", "=", "types", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "names", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "names", ".", "next", "(", ")", ";", "String", "typeName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "String", "path", "=", "(", "String", ")", "entry", ".", "getValue", "(", ")", ";", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "path", ")", ")", "{", "IFile", "file", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getFile", "(", "new", "Path", "(", "path", ")", ")", ";", "ICompilationUnit", "unit", "=", "JavaModelManager", ".", "createCompilationUnitFrom", "(", "file", ",", "null", ")", ";", "IType", "type", "=", "unit", ".", "getType", "(", "typeName", ")", ";", "types", ".", "put", "(", "typeName", ",", "type", ")", ";", "}", "else", "{", "names", ".", "remove", "(", ")", ";", "}", "}", "}", "if", "(", "projectInfo", ".", "secondaryTypes", "==", "null", "||", "projectInfo", ".", "secondaryTypes", ".", "get", "(", "INDEXED_SECONDARY_TYPES", ")", "!=", "null", ")", "{", "projectInfo", ".", "secondaryTypes", "=", "secondaryTypes", ";", "if", "(", "VERBOSE", "||", "BasicSearchEngine", ".", "VERBOSE", ")", "{", "System", ".", "out", ".", "print", "(", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "Iterator", "entries", "=", "secondaryTypes", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "String", "qualifiedName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "Util", ".", "verbose", "(", "\"tt-", "\"", "+", "qualifiedName", "+", "'-'", "+", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "return", "projectInfo", ".", "secondaryTypes", ";", "}", "public", "void", "secondaryTypesRemoving", "(", "IFile", "file", ",", "boolean", "cleanIndexCache", ")", "{", "if", "(", "VERBOSE", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "file", ".", "getName", "(", ")", ")", ";", "buffer", ".", "append", "(", "')'", ")", ";", "Util", ".", "verbose", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "file", "!=", "null", ")", "{", "PerProjectInfo", "projectInfo", "=", "getPerProjectInfo", "(", "file", ".", "getProject", "(", ")", ",", "false", ")", ";", "if", "(", "projectInfo", "!=", "null", "&&", "projectInfo", ".", "secondaryTypes", "!=", "null", ")", "{", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "file", ".", "getProject", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "secondaryTypesRemoving", "(", "projectInfo", ".", "secondaryTypes", ",", "file", ")", ";", "HashMap", "indexingCache", "=", "(", "HashMap", ")", "projectInfo", ".", "secondaryTypes", ".", "get", "(", "INDEXED_SECONDARY_TYPES", ")", ";", "if", "(", "!", "cleanIndexCache", ")", "{", "if", "(", "indexingCache", "==", "null", ")", "{", "projectInfo", ".", "secondaryTypes", ".", "put", "(", "INDEXED_SECONDARY_TYPES", ",", "new", "HashMap", "(", ")", ")", ";", "}", "return", ";", "}", "if", "(", "indexingCache", "!=", "null", ")", "{", "Set", "keys", "=", "indexingCache", ".", "keySet", "(", ")", ";", "int", "filesSize", "=", "keys", ".", "size", "(", ")", ",", "filesCount", "=", "0", ";", "IFile", "[", "]", "removed", "=", "null", ";", "Iterator", "cachedFiles", "=", "keys", ".", "iterator", "(", ")", ";", "while", "(", "cachedFiles", ".", "hasNext", "(", ")", ")", "{", "IFile", "cachedFile", "=", "(", "IFile", ")", "cachedFiles", ".", "next", "(", ")", ";", "if", "(", "file", ".", "equals", "(", "cachedFile", ")", ")", "{", "if", "(", "removed", "==", "null", ")", "removed", "=", "new", "IFile", "[", "filesSize", "]", ";", "filesSize", "--", ";", "removed", "[", "filesCount", "++", "]", "=", "cachedFile", ";", "}", "}", "if", "(", "removed", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "filesCount", ";", "i", "++", ")", "{", "indexingCache", ".", "remove", "(", "removed", "[", "i", "]", ")", ";", "}", "}", "}", "}", "}", "}", "private", "void", "secondaryTypesRemoving", "(", "Hashtable", "secondaryTypesMap", ",", "IFile", "file", ")", "{", "if", "(", "VERBOSE", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "Iterator", "entries", "=", "secondaryTypesMap", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "String", "qualifiedName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "buffer", ".", "append", "(", "qualifiedName", "+", "':'", "+", "entry", ".", "getValue", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "','", ")", ";", "buffer", ".", "append", "(", "file", ".", "getFullPath", "(", ")", ")", ";", "buffer", ".", "append", "(", "')'", ")", ";", "Util", ".", "verbose", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}", "Set", "packageEntries", "=", "secondaryTypesMap", ".", "entrySet", "(", ")", ";", "int", "packagesSize", "=", "packageEntries", ".", "size", "(", ")", ",", "removedPackagesCount", "=", "0", ";", "String", "[", "]", "removedPackages", "=", "null", ";", "Iterator", "packages", "=", "packageEntries", ".", "iterator", "(", ")", ";", "while", "(", "packages", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "packages", ".", "next", "(", ")", ";", "String", "packName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "if", "(", "packName", "!=", "INDEXED_SECONDARY_TYPES", ")", "{", "HashMap", "types", "=", "(", "HashMap", ")", "entry", ".", "getValue", "(", ")", ";", "Set", "nameEntries", "=", "types", ".", "entrySet", "(", ")", ";", "int", "namesSize", "=", "nameEntries", ".", "size", "(", ")", ",", "removedNamesCount", "=", "0", ";", "String", "[", "]", "removedNames", "=", "null", ";", "Iterator", "names", "=", "nameEntries", ".", "iterator", "(", ")", ";", "while", "(", "names", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry2", "=", "(", "Map", ".", "Entry", ")", "names", ".", "next", "(", ")", ";", "String", "typeName", "=", "(", "String", ")", "entry2", ".", "getKey", "(", ")", ";", "JavaElement", "type", "=", "(", "JavaElement", ")", "entry2", ".", "getValue", "(", ")", ";", "if", "(", "file", ".", "equals", "(", "type", ".", "resource", "(", ")", ")", ")", "{", "if", "(", "removedNames", "==", "null", ")", "removedNames", "=", "new", "String", "[", "namesSize", "]", ";", "namesSize", "--", ";", "removedNames", "[", "removedNamesCount", "++", "]", "=", "typeName", ";", "}", "}", "if", "(", "removedNames", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "removedNamesCount", ";", "i", "++", ")", "{", "types", ".", "remove", "(", "removedNames", "[", "i", "]", ")", ";", "}", "}", "if", "(", "types", ".", "size", "(", ")", "==", "0", ")", "{", "if", "(", "removedPackages", "==", "null", ")", "removedPackages", "=", "new", "String", "[", "packagesSize", "]", ";", "packagesSize", "--", ";", "removedPackages", "[", "removedPackagesCount", "++", "]", "=", "packName", ";", "}", "}", "}", "if", "(", "removedPackages", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "removedPackagesCount", ";", "i", "++", ")", "{", "secondaryTypesMap", ".", "remove", "(", "removedPackages", "[", "i", "]", ")", ";", "}", "}", "if", "(", "VERBOSE", ")", "{", "Util", ".", "verbose", "(", "\"\"", ")", ";", "Iterator", "entries", "=", "secondaryTypesMap", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "entries", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "entries", ".", "next", "(", ")", ";", "String", "qualifiedName", "=", "(", "String", ")", "entry", ".", "getKey", "(", ")", ";", "Util", ".", "verbose", "(", "\"tt+", "\"", "+", "qualifiedName", "+", "':'", "+", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "protected", "void", "setBuildOrder", "(", "String", "[", "]", "javaBuildOrder", ")", "throws", "JavaModelException", "{", "if", "(", "!", "JavaCore", ".", "COMPUTE", ".", "equals", "(", "JavaCore", ".", "getOption", "(", "JavaCore", ".", "CORE_JAVA_BUILD_ORDER", ")", ")", ")", "return", ";", "if", "(", "javaBuildOrder", "==", "null", "||", "javaBuildOrder", ".", "length", "<=", "1", ")", "return", ";", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "IWorkspaceDescription", "description", "=", "workspace", ".", "getDescription", "(", ")", ";", "String", "[", "]", "wksBuildOrder", "=", "description", ".", "getBuildOrder", "(", ")", ";", "String", "[", "]", "newOrder", ";", "if", "(", "wksBuildOrder", "==", "null", ")", "{", "newOrder", "=", "javaBuildOrder", ";", "}", "else", "{", "int", "javaCount", "=", "javaBuildOrder", ".", "length", ";", "HashMap", "newSet", "=", "new", "HashMap", "(", "javaCount", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "javaCount", ";", "i", "++", ")", "{", "newSet", ".", "put", "(", "javaBuildOrder", "[", "i", "]", ",", "javaBuildOrder", "[", "i", "]", ")", ";", "}", "int", "removed", "=", "0", ";", "int", "oldCount", "=", "wksBuildOrder", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "oldCount", ";", "i", "++", ")", "{", "if", "(", "newSet", ".", "containsKey", "(", "wksBuildOrder", "[", "i", "]", ")", ")", "{", "wksBuildOrder", "[", "i", "]", "=", "null", ";", "removed", "++", ";", "}", "}", "newOrder", "=", "new", "String", "[", "oldCount", "-", "removed", "+", "javaCount", "]", ";", "System", ".", "arraycopy", "(", "javaBuildOrder", ",", "0", ",", "newOrder", ",", "0", ",", "javaCount", ")", ";", "int", "index", "=", "javaCount", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "oldCount", ";", "i", "++", ")", "{", "if", "(", "wksBuildOrder", "[", "i", "]", "!=", "null", ")", "{", "newOrder", "[", "index", "++", "]", "=", "wksBuildOrder", "[", "i", "]", ";", "}", "}", "}", "description", ".", "setBuildOrder", "(", "newOrder", ")", ";", "try", "{", "workspace", ".", "setDescription", "(", "description", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "public", "void", "setLastBuiltState", "(", "IProject", "project", ",", "Object", "state", ")", "{", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "PerProjectInfo", "info", "=", "getPerProjectInfo", "(", "project", ",", "true", ")", ";", "info", ".", "triedRead", "=", "true", ";", "info", ".", "savedState", "=", "state", ";", "}", "if", "(", "state", "==", "null", ")", "{", "try", "{", "File", "file", "=", "getSerializationFile", "(", "project", ")", ";", "if", "(", "file", "!=", "null", "&&", "file", ".", "exists", "(", ")", ")", "file", ".", "delete", "(", ")", ";", "}", "catch", "(", "SecurityException", "se", ")", "{", "}", "}", "}", "public", "boolean", "storePreference", "(", "String", "optionName", ",", "String", "optionValue", ",", "IEclipsePreferences", "eclipsePreferences", ")", "{", "int", "optionLevel", "=", "this", ".", "getOptionLevel", "(", "optionName", ")", ";", "if", "(", "optionLevel", "==", "UNKNOWN_OPTION", ")", "return", "false", ";", "switch", "(", "optionLevel", ")", "{", "case", "JavaModelManager", ".", "VALID_OPTION", ":", "if", "(", "optionValue", "==", "null", ")", "{", "eclipsePreferences", ".", "remove", "(", "optionName", ")", ";", "}", "else", "{", "eclipsePreferences", ".", "put", "(", "optionName", ",", "optionValue", ")", ";", "}", "break", ";", "case", "JavaModelManager", ".", "DEPRECATED_OPTION", ":", "eclipsePreferences", ".", "remove", "(", "optionName", ")", ";", "String", "[", "]", "compatibleOptions", "=", "(", "String", "[", "]", ")", "this", ".", "deprecatedOptions", ".", "get", "(", "optionName", ")", ";", "for", "(", "int", "co", "=", "0", ",", "length", "=", "compatibleOptions", ".", "length", ";", "co", "<", "length", ";", "co", "++", ")", "{", "if", "(", "optionValue", "==", "null", ")", "{", "eclipsePreferences", ".", "remove", "(", "compatibleOptions", "[", "co", "]", ")", ";", "}", "else", "{", "eclipsePreferences", ".", "put", "(", "compatibleOptions", "[", "co", "]", ",", "optionValue", ")", ";", "}", "}", "break", ";", "default", ":", "return", "false", ";", "}", "return", "true", ";", "}", "public", "void", "setOptions", "(", "Hashtable", "newOptions", ")", "{", "Hashtable", "cachedValue", "=", "newOptions", "==", "null", "?", "null", ":", "new", "Hashtable", "(", "newOptions", ")", ";", "IEclipsePreferences", "defaultPreferences", "=", "getDefaultPreferences", "(", ")", ";", "IEclipsePreferences", "instancePreferences", "=", "getInstancePreferences", "(", ")", ";", "if", "(", "newOptions", "==", "null", ")", "{", "try", "{", "instancePreferences", ".", "clear", "(", ")", ";", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "}", "}", "else", "{", "Enumeration", "keys", "=", "newOptions", ".", "keys", "(", ")", ";", "while", "(", "keys", ".", "hasMoreElements", "(", ")", ")", "{", "String", "key", "=", "(", "String", ")", "keys", ".", "nextElement", "(", ")", ";", "int", "optionLevel", "=", "getOptionLevel", "(", "key", ")", ";", "if", "(", "optionLevel", "==", "UNKNOWN_OPTION", ")", "continue", ";", "if", "(", "key", ".", "equals", "(", "JavaCore", ".", "CORE_ENCODING", ")", ")", "{", "if", "(", "cachedValue", "!=", "null", ")", "{", "cachedValue", ".", "put", "(", "key", ",", "JavaCore", ".", "getEncoding", "(", ")", ")", ";", "}", "continue", ";", "}", "String", "value", "=", "(", "String", ")", "newOptions", ".", "get", "(", "key", ")", ";", "String", "defaultValue", "=", "defaultPreferences", ".", "get", "(", "key", ",", "null", ")", ";", "if", "(", "defaultValue", "!=", "null", "&&", "defaultValue", ".", "equals", "(", "value", ")", ")", "{", "value", "=", "null", ";", "}", "storePreference", "(", "key", ",", "value", ",", "instancePreferences", ")", ";", "}", "try", "{", "instancePreferences", ".", "flush", "(", ")", ";", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "}", "}", "Util", ".", "fixTaskTags", "(", "cachedValue", ")", ";", "this", ".", "optionsCache", "=", "cachedValue", ";", "}", "public", "void", "startup", "(", ")", "throws", "CoreException", "{", "try", "{", "configurePluginDebugOptions", "(", ")", ";", "this", ".", "cache", "=", "new", "JavaModelCache", "(", ")", ";", "JavaCore", ".", "getPlugin", "(", ")", ".", "getStateLocation", "(", ")", ";", "initializePreferences", "(", ")", ";", "this", ".", "propertyListener", "=", "new", "IEclipsePreferences", ".", "IPreferenceChangeListener", "(", ")", "{", "public", "void", "preferenceChange", "(", "PreferenceChangeEvent", "event", ")", "{", "JavaModelManager", ".", "this", ".", "optionsCache", "=", "null", ";", "}", "}", ";", "InstanceScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ".", "addPreferenceChangeListener", "(", "this", ".", "propertyListener", ")", ";", "this", ".", "resourcesPropertyListener", "=", "new", "IEclipsePreferences", ".", "IPreferenceChangeListener", "(", ")", "{", "public", "void", "preferenceChange", "(", "PreferenceChangeEvent", "event", ")", "{", "if", "(", "ResourcesPlugin", ".", "PREF_ENCODING", ".", "equals", "(", "event", ".", "getKey", "(", ")", ")", ")", "{", "JavaModelManager", ".", "this", ".", "optionsCache", "=", "null", ";", "}", "}", "}", ";", "String", "resourcesPluginId", "=", "ResourcesPlugin", ".", "getPlugin", "(", ")", ".", "getBundle", "(", ")", ".", "getSymbolicName", "(", ")", ";", "InstanceScope", ".", "INSTANCE", ".", "getNode", "(", "resourcesPluginId", ")", ".", "addPreferenceChangeListener", "(", "this", ".", "resourcesPropertyListener", ")", ";", "Platform", ".", "getContentTypeManager", "(", ")", ".", "addContentTypeChangeListener", "(", "this", ")", ";", "long", "start", "=", "-", "1", ";", "if", "(", "VERBOSE", ")", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "loadVariablesAndContainers", "(", ")", ";", "if", "(", "VERBOSE", ")", "traceVariableAndContainers", "(", "\"Loaded\"", ",", "start", ")", ";", "this", ".", "deltaState", ".", "initializeRootsWithPreviousSession", "(", ")", ";", "final", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "workspace", ".", "addResourceChangeListener", "(", "this", ".", "deltaState", ",", "IResourceChangeEvent", ".", "PRE_BUILD", "|", "IResourceChangeEvent", ".", "POST_BUILD", "|", "IResourceChangeEvent", ".", "POST_CHANGE", "|", "IResourceChangeEvent", ".", "PRE_DELETE", "|", "IResourceChangeEvent", ".", "PRE_CLOSE", "|", "IResourceChangeEvent", ".", "PRE_REFRESH", ")", ";", "startIndexing", "(", ")", ";", "Job", "processSavedState", "=", "new", "Job", "(", "Messages", ".", "savedState_jobName", ")", "{", "protected", "IStatus", "run", "(", "IProgressMonitor", "monitor", ")", "{", "try", "{", "workspace", ".", "run", "(", "new", "IWorkspaceRunnable", "(", ")", "{", "public", "void", "run", "(", "IProgressMonitor", "progress", ")", "throws", "CoreException", "{", "ISavedState", "savedState", "=", "workspace", ".", "addSaveParticipant", "(", "JavaCore", ".", "PLUGIN_ID", ",", "JavaModelManager", ".", "this", ")", ";", "if", "(", "savedState", "!=", "null", ")", "{", "JavaModelManager", ".", "this", ".", "deltaState", ".", "getDeltaProcessor", "(", ")", ".", "overridenEventType", "=", "IResourceChangeEvent", ".", "POST_CHANGE", ";", "savedState", ".", "processResourceChangeEvents", "(", "JavaModelManager", ".", "this", ".", "deltaState", ")", ";", "}", "}", "}", ",", "monitor", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "return", "e", ".", "getStatus", "(", ")", ";", "}", "return", "Status", ".", "OK_STATUS", ";", "}", "}", ";", "processSavedState", ".", "setSystem", "(", "true", ")", ";", "processSavedState", ".", "setPriority", "(", "Job", ".", "SHORT", ")", ";", "processSavedState", ".", "schedule", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "shutdown", "(", ")", ";", "throw", "e", ";", "}", "}", "private", "void", "startIndexing", "(", ")", "{", "if", "(", "this", ".", "indexManager", "!=", "null", ")", "this", ".", "indexManager", ".", "reset", "(", ")", ";", "}", "public", "void", "shutdown", "(", ")", "{", "IEclipsePreferences", "preferences", "=", "InstanceScope", ".", "INSTANCE", ".", "getNode", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "try", "{", "preferences", ".", "flush", "(", ")", ";", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "workspace", ".", "removeResourceChangeListener", "(", "this", ".", "deltaState", ")", ";", "workspace", ".", "removeSaveParticipant", "(", "JavaCore", ".", "PLUGIN_ID", ")", ";", "Platform", ".", "getContentTypeManager", "(", ")", ".", "removeContentTypeChangeListener", "(", "this", ")", ";", "if", "(", "this", ".", "indexManager", "!=", "null", ")", "{", "this", ".", "indexManager", ".", "shutdown", "(", ")", ";", "}", "preferences", ".", "removePreferenceChangeListener", "(", "this", ".", "propertyListener", ")", ";", "(", "(", "IEclipsePreferences", ")", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", ".", "parent", "(", ")", ")", ".", "removeNodeChangeListener", "(", "this", ".", "defaultNodeListener", ")", ";", "this", ".", "preferencesLookup", "[", "PREF_DEFAULT", "]", "=", "null", ";", "(", "(", "IEclipsePreferences", ")", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ".", "parent", "(", ")", ")", ".", "removeNodeChangeListener", "(", "this", ".", "instanceNodeListener", ")", ";", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", ".", "removePreferenceChangeListener", "(", "this", ".", "instancePreferencesListener", ")", ";", "this", ".", "preferencesLookup", "[", "PREF_INSTANCE", "]", "=", "null", ";", "String", "resourcesPluginId", "=", "ResourcesPlugin", ".", "getPlugin", "(", ")", ".", "getBundle", "(", ")", ".", "getSymbolicName", "(", ")", ";", "InstanceScope", ".", "INSTANCE", ".", "getNode", "(", "resourcesPluginId", ")", ".", "removePreferenceChangeListener", "(", "this", ".", "resourcesPropertyListener", ")", ";", "try", "{", "Job", ".", "getJobManager", "(", ")", ".", "join", "(", "JavaCore", ".", "PLUGIN_ID", ",", "null", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "public", "synchronized", "IPath", "variableGet", "(", "String", "variableName", ")", "{", "HashSet", "initializations", "=", "variableInitializationInProgress", "(", ")", ";", "if", "(", "initializations", ".", "contains", "(", "variableName", ")", ")", "{", "return", "VARIABLE_INITIALIZATION_IN_PROGRESS", ";", "}", "return", "(", "IPath", ")", "this", ".", "variables", ".", "get", "(", "variableName", ")", ";", "}", "private", "synchronized", "IPath", "variableGetDefaultToPreviousSession", "(", "String", "variableName", ")", "{", "IPath", "variablePath", "=", "(", "IPath", ")", "this", ".", "variables", ".", "get", "(", "variableName", ")", ";", "if", "(", "variablePath", "==", "null", ")", "return", "getPreviousSessionVariable", "(", "variableName", ")", ";", "return", "variablePath", ";", "}", "private", "HashSet", "variableInitializationInProgress", "(", ")", "{", "HashSet", "initializations", "=", "(", "HashSet", ")", "this", ".", "variableInitializationInProgress", ".", "get", "(", ")", ";", "if", "(", "initializations", "==", "null", ")", "{", "initializations", "=", "new", "HashSet", "(", ")", ";", "this", ".", "variableInitializationInProgress", ".", "set", "(", "initializations", ")", ";", "}", "return", "initializations", ";", "}", "public", "synchronized", "String", "[", "]", "variableNames", "(", ")", "{", "int", "length", "=", "this", ".", "variables", ".", "size", "(", ")", ";", "String", "[", "]", "result", "=", "new", "String", "[", "length", "]", ";", "Iterator", "vars", "=", "this", ".", "variables", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "int", "index", "=", "0", ";", "while", "(", "vars", ".", "hasNext", "(", ")", ")", "{", "result", "[", "index", "++", "]", "=", "(", "String", ")", "vars", ".", "next", "(", ")", ";", "}", "return", "result", ";", "}", "public", "synchronized", "void", "variablePut", "(", "String", "variableName", ",", "IPath", "variablePath", ")", "{", "HashSet", "initializations", "=", "variableInitializationInProgress", "(", ")", ";", "if", "(", "variablePath", "==", "VARIABLE_INITIALIZATION_IN_PROGRESS", ")", "{", "initializations", ".", "add", "(", "variableName", ")", ";", "return", ";", "}", "else", "{", "initializations", ".", "remove", "(", "variableName", ")", ";", "if", "(", "variablePath", "==", "null", ")", "{", "this", ".", "variables", ".", "put", "(", "variableName", ",", "CP_ENTRY_IGNORE_PATH", ")", ";", "this", ".", "variablesWithInitializer", ".", "remove", "(", "variableName", ")", ";", "this", ".", "deprecatedVariables", ".", "remove", "(", "variableName", ")", ";", "}", "else", "{", "this", ".", "variables", ".", "put", "(", "variableName", ",", "variablePath", ")", ";", "}", "this", ".", "previousSessionVariables", ".", "remove", "(", "variableName", ")", ";", "}", "}", "public", "void", "variablePreferencesPut", "(", "String", "variableName", ",", "IPath", "variablePath", ")", "{", "String", "variableKey", "=", "CP_VARIABLE_PREFERENCES_PREFIX", "+", "variableName", ";", "if", "(", "variablePath", "==", "null", ")", "{", "getInstancePreferences", "(", ")", ".", "remove", "(", "variableKey", ")", ";", "}", "else", "{", "getInstancePreferences", "(", ")", ".", "put", "(", "variableKey", ",", "variablePath", ".", "toString", "(", ")", ")", ";", "}", "try", "{", "getInstancePreferences", "(", ")", ".", "flush", "(", ")", ";", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "}", "}", "public", "boolean", "variablePutIfInitializingWithSameValue", "(", "String", "[", "]", "variableNames", ",", "IPath", "[", "]", "variablePaths", ")", "{", "if", "(", "variableNames", ".", "length", "!=", "1", ")", "return", "false", ";", "String", "variableName", "=", "variableNames", "[", "0", "]", ";", "IPath", "oldPath", "=", "variableGetDefaultToPreviousSession", "(", "variableName", ")", ";", "if", "(", "oldPath", "==", "null", ")", "return", "false", ";", "IPath", "newPath", "=", "variablePaths", "[", "0", "]", ";", "if", "(", "!", "oldPath", ".", "equals", "(", "newPath", ")", ")", "return", "false", ";", "variablePut", "(", "variableName", ",", "newPath", ")", ";", "return", "true", ";", "}", "public", "void", "contentTypeChanged", "(", "ContentTypeChangeEvent", "event", ")", "{", "Util", ".", "resetJavaLikeExtensions", "(", ")", ";", "IJavaProject", "[", "]", "projects", ";", "try", "{", "projects", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", ".", "getJavaProjects", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaProject", "project", "=", "projects", "[", "i", "]", ";", "final", "PerProjectInfo", "projectInfo", "=", "getPerProjectInfo", "(", "project", ".", "getProject", "(", ")", ",", "false", ")", ";", "if", "(", "projectInfo", "!=", "null", ")", "{", "projectInfo", ".", "secondaryTypes", "=", "null", ";", "}", "}", "}", "public", "synchronized", "String", "cacheToString", "(", "String", "prefix", ")", "{", "return", "this", ".", "cache", ".", "toStringFillingRation", "(", "prefix", ")", ";", "}", "public", "Stats", "debugNewOpenableCacheStats", "(", ")", "{", "return", "this", ".", "cache", ".", "openableCache", ".", "new", "Stats", "(", ")", ";", "}", "public", "int", "getOpenableCacheSize", "(", ")", "{", "return", "this", ".", "cache", ".", "openableCache", ".", "getSpaceLimit", "(", ")", ";", "}", "}", "</s>" ]
3,775
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Signature", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "ISourceField", ";", "public", "class", "SourceFieldElementInfo", "extends", "AnnotatableInfo", "implements", "ISourceField", "{", "protected", "char", "[", "]", "typeName", ";", "protected", "char", "[", "]", "initializationSource", ";", "public", "char", "[", "]", "getInitializationSource", "(", ")", "{", "return", "this", ".", "initializationSource", ";", "}", "public", "char", "[", "]", "getTypeName", "(", ")", "{", "return", "this", ".", "typeName", ";", "}", "protected", "String", "getTypeSignature", "(", ")", "{", "return", "Signature", ".", "createTypeSignature", "(", "this", ".", "typeName", ",", "false", ")", ";", "}", "protected", "void", "setTypeName", "(", "char", "[", "]", "typeName", ")", "{", "this", ".", "typeName", "=", "typeName", ";", "}", "}", "</s>" ]
3,776
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "*", ";", "import", "org", ".", "codehaus", ".", "jdt", ".", "groovy", ".", "integration", ".", "LanguageSupportFactory", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "ISchedulingRule", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "MultiRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AST", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AbstractTypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Javadoc", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "MethodDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "Name", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "PackageDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SimpleName", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "SuffixConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "DeleteEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "InsertEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "MultiTextEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "ReplaceEdit", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "public", "class", "CopyResourceElementsOperation", "extends", "MultiOperation", "implements", "SuffixConstants", "{", "protected", "ArrayList", "createdElements", ";", "protected", "Map", "deltasPerProject", "=", "new", "HashMap", "(", "1", ")", ";", "protected", "ASTParser", "parser", ";", "public", "CopyResourceElementsOperation", "(", "IJavaElement", "[", "]", "resourcesToCopy", ",", "IJavaElement", "[", "]", "destContainers", ",", "boolean", "force", ")", "{", "super", "(", "resourcesToCopy", ",", "destContainers", ",", "force", ")", ";", "initializeASTParser", "(", ")", ";", "}", "private", "void", "initializeASTParser", "(", ")", "{", "this", ".", "parser", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS4", ")", ";", "}", "private", "IResource", "[", "]", "collectResourcesOfInterest", "(", "IPackageFragment", "source", ")", "throws", "JavaModelException", "{", "IJavaElement", "[", "]", "children", "=", "source", ".", "getChildren", "(", ")", ";", "int", "childOfInterest", "=", "IJavaElement", ".", "COMPILATION_UNIT", ";", "if", "(", "source", ".", "getKind", "(", ")", "==", "IPackageFragmentRoot", ".", "K_BINARY", ")", "{", "childOfInterest", "=", "IJavaElement", ".", "CLASS_FILE", ";", "}", "ArrayList", "correctKindChildren", "=", "new", "ArrayList", "(", "children", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "IJavaElement", "child", "=", "children", "[", "i", "]", ";", "if", "(", "child", ".", "getElementType", "(", ")", "==", "childOfInterest", ")", "{", "correctKindChildren", ".", "add", "(", "(", "(", "JavaElement", ")", "child", ")", ".", "resource", "(", ")", ")", ";", "}", "}", "Object", "[", "]", "nonJavaResources", "=", "source", ".", "getNonJavaResources", "(", ")", ";", "int", "actualNonJavaResourceCount", "=", "0", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "nonJavaResources", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "nonJavaResources", "[", "i", "]", "instanceof", "IResource", ")", "actualNonJavaResourceCount", "++", ";", "}", "IResource", "[", "]", "actualNonJavaResources", "=", "new", "IResource", "[", "actualNonJavaResourceCount", "]", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "nonJavaResources", ".", "length", ",", "index", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "nonJavaResources", "[", "i", "]", "instanceof", "IResource", ")", "actualNonJavaResources", "[", "index", "++", "]", "=", "(", "IResource", ")", "nonJavaResources", "[", "i", "]", ";", "}", "if", "(", "actualNonJavaResourceCount", "!=", "0", ")", "{", "int", "correctKindChildrenSize", "=", "correctKindChildren", ".", "size", "(", ")", ";", "IResource", "[", "]", "result", "=", "new", "IResource", "[", "correctKindChildrenSize", "+", "actualNonJavaResourceCount", "]", ";", "correctKindChildren", ".", "toArray", "(", "result", ")", ";", "System", ".", "arraycopy", "(", "actualNonJavaResources", ",", "0", ",", "result", ",", "correctKindChildrenSize", ",", "actualNonJavaResourceCount", ")", ";", "return", "result", ";", "}", "else", "{", "IResource", "[", "]", "result", "=", "new", "IResource", "[", "correctKindChildren", ".", "size", "(", ")", "]", ";", "correctKindChildren", ".", "toArray", "(", "result", ")", ";", "return", "result", ";", "}", "}", "private", "boolean", "createNeededPackageFragments", "(", "IContainer", "sourceFolder", ",", "PackageFragmentRoot", "root", ",", "String", "[", "]", "newFragName", ",", "boolean", "moveFolder", ")", "throws", "JavaModelException", "{", "boolean", "containsReadOnlyPackageFragment", "=", "false", ";", "IContainer", "parentFolder", "=", "(", "IContainer", ")", "root", ".", "resource", "(", ")", ";", "JavaElementDelta", "projectDelta", "=", "null", ";", "String", "[", "]", "sideEffectPackageName", "=", "null", ";", "char", "[", "]", "[", "]", "inclusionPatterns", "=", "root", ".", "fullInclusionPatternChars", "(", ")", ";", "char", "[", "]", "[", "]", "exclusionPatterns", "=", "root", ".", "fullExclusionPatternChars", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newFragName", ".", "length", ";", "i", "++", ")", "{", "String", "subFolderName", "=", "newFragName", "[", "i", "]", ";", "sideEffectPackageName", "=", "Util", ".", "arrayConcat", "(", "sideEffectPackageName", ",", "subFolderName", ")", ";", "IResource", "subFolder", "=", "parentFolder", ".", "findMember", "(", "subFolderName", ")", ";", "if", "(", "subFolder", "==", "null", ")", "{", "if", "(", "!", "(", "moveFolder", "&&", "i", "==", "newFragName", ".", "length", "-", "1", ")", ")", "{", "createFolder", "(", "parentFolder", ",", "subFolderName", ",", "this", ".", "force", ")", ";", "}", "parentFolder", "=", "parentFolder", ".", "getFolder", "(", "new", "Path", "(", "subFolderName", ")", ")", ";", "sourceFolder", "=", "sourceFolder", ".", "getFolder", "(", "new", "Path", "(", "subFolderName", ")", ")", ";", "if", "(", "Util", ".", "isReadOnly", "(", "sourceFolder", ")", ")", "{", "containsReadOnlyPackageFragment", "=", "true", ";", "}", "IPackageFragment", "sideEffectPackage", "=", "root", ".", "getPackageFragment", "(", "sideEffectPackageName", ")", ";", "if", "(", "i", "<", "newFragName", ".", "length", "-", "1", "&&", "!", "Util", ".", "isExcluded", "(", "parentFolder", ",", "inclusionPatterns", ",", "exclusionPatterns", ")", ")", "{", "if", "(", "projectDelta", "==", "null", ")", "{", "projectDelta", "=", "getDeltaFor", "(", "root", ".", "getJavaProject", "(", ")", ")", ";", "}", "projectDelta", ".", "added", "(", "sideEffectPackage", ")", ";", "}", "this", ".", "createdElements", ".", "add", "(", "sideEffectPackage", ")", ";", "}", "else", "{", "parentFolder", "=", "(", "IContainer", ")", "subFolder", ";", "}", "}", "return", "containsReadOnlyPackageFragment", ";", "}", "private", "JavaElementDelta", "getDeltaFor", "(", "IJavaProject", "javaProject", ")", "{", "JavaElementDelta", "delta", "=", "(", "JavaElementDelta", ")", "this", ".", "deltasPerProject", ".", "get", "(", "javaProject", ")", ";", "if", "(", "delta", "==", "null", ")", "{", "delta", "=", "new", "JavaElementDelta", "(", "javaProject", ")", ";", "this", ".", "deltasPerProject", ".", "put", "(", "javaProject", ",", "delta", ")", ";", "}", "return", "delta", ";", "}", "protected", "String", "getMainTaskName", "(", ")", "{", "return", "Messages", ".", "operation_copyResourceProgress", ";", "}", "protected", "ISchedulingRule", "getSchedulingRule", "(", ")", "{", "if", "(", "this", ".", "elementsToProcess", "==", "null", ")", "return", "null", ";", "int", "length", "=", "this", ".", "elementsToProcess", ".", "length", ";", "if", "(", "length", "==", "1", ")", "return", "getSchedulingRule", "(", "this", ".", "elementsToProcess", "[", "0", "]", ")", ";", "ISchedulingRule", "[", "]", "rules", "=", "new", "ISchedulingRule", "[", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ISchedulingRule", "rule", "=", "getSchedulingRule", "(", "this", ".", "elementsToProcess", "[", "i", "]", ")", ";", "if", "(", "rule", "!=", "null", ")", "{", "rules", "[", "index", "++", "]", "=", "rule", ";", "}", "}", "if", "(", "index", "!=", "length", ")", "System", ".", "arraycopy", "(", "rules", ",", "0", ",", "rules", "=", "new", "ISchedulingRule", "[", "index", "]", ",", "0", ",", "index", ")", ";", "return", "new", "MultiRule", "(", "rules", ")", ";", "}", "private", "ISchedulingRule", "getSchedulingRule", "(", "IJavaElement", "element", ")", "{", "if", "(", "element", "==", "null", ")", "return", "null", ";", "IResource", "sourceResource", "=", "getResource", "(", "element", ")", ";", "IResource", "destContainer", "=", "getResource", "(", "getDestinationParent", "(", "element", ")", ")", ";", "if", "(", "!", "(", "destContainer", "instanceof", "IContainer", ")", ")", "{", "return", "null", ";", "}", "String", "newName", ";", "try", "{", "newName", "=", "getNewNameFor", "(", "element", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "if", "(", "newName", "==", "null", ")", "newName", "=", "element", ".", "getElementName", "(", ")", ";", "IResource", "destResource", ";", "String", "sourceEncoding", "=", "null", ";", "if", "(", "sourceResource", ".", "getType", "(", ")", "==", "IResource", ".", "FILE", ")", "{", "destResource", "=", "(", "(", "IContainer", ")", "destContainer", ")", ".", "getFile", "(", "new", "Path", "(", "newName", ")", ")", ";", "try", "{", "sourceEncoding", "=", "(", "(", "IFile", ")", "sourceResource", ")", ".", "getCharset", "(", "false", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "}", "}", "else", "{", "destResource", "=", "(", "(", "IContainer", ")", "destContainer", ")", ".", "getFolder", "(", "new", "Path", "(", "newName", ")", ")", ";", "}", "IResourceRuleFactory", "factory", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRuleFactory", "(", ")", ";", "ISchedulingRule", "rule", ";", "if", "(", "isMove", "(", ")", ")", "{", "rule", "=", "factory", ".", "moveRule", "(", "sourceResource", ",", "destResource", ")", ";", "}", "else", "{", "rule", "=", "factory", ".", "copyRule", "(", "sourceResource", ",", "destResource", ")", ";", "}", "if", "(", "sourceEncoding", "!=", "null", ")", "{", "rule", "=", "new", "MultiRule", "(", "new", "ISchedulingRule", "[", "]", "{", "rule", ",", "factory", ".", "charsetRule", "(", "destResource", ")", "}", ")", ";", "}", "return", "rule", ";", "}", "private", "IResource", "getResource", "(", "IJavaElement", "element", ")", "{", "if", "(", "element", "==", "null", ")", "return", "null", ";", "if", "(", "element", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", "{", "String", "pkgName", "=", "element", ".", "getElementName", "(", ")", ";", "int", "firstDot", "=", "pkgName", ".", "indexOf", "(", "'.'", ")", ";", "if", "(", "firstDot", "!=", "-", "1", ")", "{", "element", "=", "(", "(", "IPackageFragmentRoot", ")", "element", ".", "getParent", "(", ")", ")", ".", "getPackageFragment", "(", "pkgName", ".", "substring", "(", "0", ",", "firstDot", ")", ")", ";", "}", "}", "return", "element", ".", "getResource", "(", ")", ";", "}", "protected", "void", "prepareDeltas", "(", "IJavaElement", "sourceElement", ",", "IJavaElement", "destinationElement", ",", "boolean", "isMove", ")", "{", "if", "(", "Util", ".", "isExcluded", "(", "sourceElement", ")", "||", "Util", ".", "isExcluded", "(", "destinationElement", ")", ")", "return", ";", "IJavaProject", "destProject", "=", "destinationElement", ".", "getJavaProject", "(", ")", ";", "if", "(", "isMove", ")", "{", "IJavaProject", "sourceProject", "=", "sourceElement", ".", "getJavaProject", "(", ")", ";", "getDeltaFor", "(", "sourceProject", ")", ".", "movedFrom", "(", "sourceElement", ",", "destinationElement", ")", ";", "getDeltaFor", "(", "destProject", ")", ".", "movedTo", "(", "destinationElement", ",", "sourceElement", ")", ";", "}", "else", "{", "getDeltaFor", "(", "destProject", ")", ".", "added", "(", "destinationElement", ")", ";", "}", "}", "private", "void", "processCompilationUnitResource", "(", "ICompilationUnit", "source", ",", "PackageFragment", "dest", ")", "throws", "JavaModelException", "{", "String", "newCUName", "=", "getNewNameFor", "(", "source", ")", ";", "String", "destName", "=", "(", "newCUName", "!=", "null", ")", "?", "newCUName", ":", "source", ".", "getElementName", "(", ")", ";", "TextEdit", "edit", "=", "updateContent", "(", "source", ",", "dest", ",", "newCUName", ")", ";", "IFile", "sourceResource", "=", "(", "IFile", ")", "source", ".", "getResource", "(", ")", ";", "String", "sourceEncoding", "=", "null", ";", "try", "{", "sourceEncoding", "=", "sourceResource", ".", "getCharset", "(", "false", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "}", "IContainer", "destFolder", "=", "(", "IContainer", ")", "dest", ".", "getResource", "(", ")", ";", "IFile", "destFile", "=", "destFolder", ".", "getFile", "(", "new", "Path", "(", "destName", ")", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", "destCU", "=", "LanguageSupportFactory", ".", "newCompilationUnit", "(", "dest", ",", "destName", ",", "DefaultWorkingCopyOwner", ".", "PRIMARY", ")", ";", "if", "(", "!", "destFile", ".", "equals", "(", "sourceResource", ")", ")", "{", "try", "{", "if", "(", "!", "destCU", ".", "isWorkingCopy", "(", ")", ")", "{", "if", "(", "destFile", ".", "exists", "(", ")", ")", "{", "if", "(", "this", ".", "force", ")", "{", "deleteResource", "(", "destFile", ",", "IResource", ".", "KEEP_HISTORY", ")", ";", "destCU", ".", "close", "(", ")", ";", "}", "else", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "destFile", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ")", ")", ";", "}", "}", "int", "flags", "=", "this", ".", "force", "?", "IResource", ".", "FORCE", ":", "IResource", ".", "NONE", ";", "if", "(", "isMove", "(", ")", ")", "{", "flags", "|=", "IResource", ".", "KEEP_HISTORY", ";", "sourceResource", ".", "move", "(", "destFile", ".", "getFullPath", "(", ")", ",", "flags", ",", "getSubProgressMonitor", "(", "1", ")", ")", ";", "}", "else", "{", "if", "(", "edit", "!=", "null", ")", "flags", "|=", "IResource", ".", "KEEP_HISTORY", ";", "sourceResource", ".", "copy", "(", "destFile", ".", "getFullPath", "(", ")", ",", "flags", ",", "getSubProgressMonitor", "(", "1", ")", ")", ";", "}", "setAttribute", "(", "HAS_MODIFIED_RESOURCE_ATTR", ",", "TRUE", ")", ";", "}", "else", "{", "destCU", ".", "getBuffer", "(", ")", ".", "setContents", "(", "source", ".", "getBuffer", "(", ")", ".", "getContents", "(", ")", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "if", "(", "edit", "!=", "null", ")", "{", "boolean", "wasReadOnly", "=", "destFile", ".", "isReadOnly", "(", ")", ";", "try", "{", "saveContent", "(", "dest", ",", "destName", ",", "edit", ",", "sourceEncoding", ",", "destFile", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "e", "instanceof", "JavaModelException", ")", "throw", "(", "JavaModelException", ")", "e", ";", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "finally", "{", "Util", ".", "setReadOnly", "(", "destFile", ",", "wasReadOnly", ")", ";", "}", "}", "prepareDeltas", "(", "source", ",", "destCU", ",", "isMove", "(", ")", ")", ";", "if", "(", "newCUName", "!=", "null", ")", "{", "String", "oldName", "=", "Util", ".", "getNameWithoutJavaLikeExtension", "(", "source", ".", "getElementName", "(", ")", ")", ";", "String", "newName", "=", "Util", ".", "getNameWithoutJavaLikeExtension", "(", "newCUName", ")", ";", "prepareDeltas", "(", "source", ".", "getType", "(", "oldName", ")", ",", "destCU", ".", "getType", "(", "newName", ")", ",", "isMove", "(", ")", ")", ";", "}", "}", "else", "{", "if", "(", "!", "this", ".", "force", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "destFile", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ")", ")", ";", "}", "if", "(", "edit", "!=", "null", ")", "{", "saveContent", "(", "dest", ",", "destName", ",", "edit", ",", "sourceEncoding", ",", "destFile", ")", ";", "}", "}", "}", "protected", "void", "processDeltas", "(", ")", "{", "for", "(", "Iterator", "deltas", "=", "this", ".", "deltasPerProject", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "deltas", ".", "hasNext", "(", ")", ";", ")", "{", "addDelta", "(", "(", "IJavaElementDelta", ")", "deltas", ".", "next", "(", ")", ")", ";", "}", "}", "protected", "void", "processElement", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "IJavaElement", "dest", "=", "getDestinationParent", "(", "element", ")", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "processCompilationUnitResource", "(", "(", "ICompilationUnit", ")", "element", ",", "(", "PackageFragment", ")", "dest", ")", ";", "this", ".", "createdElements", ".", "add", "(", "(", "(", "IPackageFragment", ")", "dest", ")", ".", "getCompilationUnit", "(", "element", ".", "getElementName", "(", ")", ")", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "processPackageFragmentResource", "(", "(", "PackageFragment", ")", "element", ",", "(", "PackageFragmentRoot", ")", "dest", ",", "getNewNameFor", "(", "element", ")", ")", ";", "break", ";", "default", ":", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ")", ";", "}", "}", "protected", "void", "processElements", "(", ")", "throws", "JavaModelException", "{", "this", ".", "createdElements", "=", "new", "ArrayList", "(", "this", ".", "elementsToProcess", ".", "length", ")", ";", "try", "{", "super", ".", "processElements", "(", ")", ";", "}", "catch", "(", "JavaModelException", "jme", ")", "{", "throw", "jme", ";", "}", "finally", "{", "this", ".", "resultElements", "=", "new", "IJavaElement", "[", "this", ".", "createdElements", ".", "size", "(", ")", "]", ";", "this", ".", "createdElements", ".", "toArray", "(", "this", ".", "resultElements", ")", ";", "processDeltas", "(", ")", ";", "}", "}", "private", "void", "processPackageFragmentResource", "(", "PackageFragment", "source", ",", "PackageFragmentRoot", "root", ",", "String", "newName", ")", "throws", "JavaModelException", "{", "try", "{", "String", "[", "]", "newFragName", "=", "(", "newName", "==", "null", ")", "?", "source", ".", "names", ":", "Util", ".", "getTrimmedSimpleNames", "(", "newName", ")", ";", "PackageFragment", "newFrag", "=", "root", ".", "getPackageFragment", "(", "newFragName", ")", ";", "IResource", "[", "]", "resources", "=", "collectResourcesOfInterest", "(", "source", ")", ";", "boolean", "shouldMoveFolder", "=", "isMove", "(", ")", "&&", "!", "newFrag", ".", "resource", "(", ")", ".", "exists", "(", ")", ";", "IFolder", "srcFolder", "=", "(", "IFolder", ")", "source", ".", "resource", "(", ")", ";", "IPath", "destPath", "=", "newFrag", ".", "getPath", "(", ")", ";", "if", "(", "shouldMoveFolder", ")", "{", "if", "(", "srcFolder", ".", "getFullPath", "(", ")", ".", "isPrefixOf", "(", "destPath", ")", ")", "{", "shouldMoveFolder", "=", "false", ";", "}", "else", "{", "IResource", "[", "]", "members", "=", "srcFolder", ".", "members", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "members", ".", "length", ";", "i", "++", ")", "{", "if", "(", "members", "[", "i", "]", "instanceof", "IFolder", ")", "{", "shouldMoveFolder", "=", "false", ";", "break", ";", "}", "}", "}", "}", "boolean", "containsReadOnlySubPackageFragments", "=", "createNeededPackageFragments", "(", "(", "IContainer", ")", "source", ".", "parent", ".", "resource", "(", ")", ",", "root", ",", "newFragName", ",", "shouldMoveFolder", ")", ";", "boolean", "sourceIsReadOnly", "=", "Util", ".", "isReadOnly", "(", "srcFolder", ")", ";", "if", "(", "shouldMoveFolder", ")", "{", "if", "(", "sourceIsReadOnly", ")", "{", "Util", ".", "setReadOnly", "(", "srcFolder", ",", "false", ")", ";", "}", "srcFolder", ".", "move", "(", "destPath", ",", "this", ".", "force", ",", "true", ",", "getSubProgressMonitor", "(", "1", ")", ")", ";", "if", "(", "sourceIsReadOnly", ")", "{", "Util", ".", "setReadOnly", "(", "srcFolder", ",", "true", ")", ";", "}", "setAttribute", "(", "HAS_MODIFIED_RESOURCE_ATTR", ",", "TRUE", ")", ";", "}", "else", "{", "if", "(", "resources", ".", "length", ">", "0", ")", "{", "if", "(", "isRename", "(", ")", ")", "{", "if", "(", "!", "destPath", ".", "equals", "(", "source", ".", "getPath", "(", ")", ")", ")", "{", "moveResources", "(", "resources", ",", "destPath", ")", ";", "}", "}", "else", "if", "(", "isMove", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "resources", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "IResource", "destinationResource", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "findMember", "(", "destPath", ".", "append", "(", "resources", "[", "i", "]", ".", "getName", "(", ")", ")", ")", ";", "if", "(", "destinationResource", "!=", "null", ")", "{", "if", "(", "this", ".", "force", ")", "{", "deleteResource", "(", "destinationResource", ",", "IResource", ".", "KEEP_HISTORY", ")", ";", "}", "else", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "destinationResource", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ")", ")", ";", "}", "}", "}", "moveResources", "(", "resources", ",", "destPath", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "max", "=", "resources", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "IResource", "destinationResource", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "findMember", "(", "destPath", ".", "append", "(", "resources", "[", "i", "]", ".", "getName", "(", ")", ")", ")", ";", "if", "(", "destinationResource", "!=", "null", ")", "{", "if", "(", "this", ".", "force", ")", "{", "deleteResource", "(", "destinationResource", ",", "IResource", ".", "KEEP_HISTORY", ")", ";", "}", "else", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "destinationResource", ".", "getFullPath", "(", ")", ".", "toString", "(", ")", ")", ")", ")", ";", "}", "}", "}", "copyResources", "(", "resources", ",", "destPath", ")", ";", "}", "}", "}", "if", "(", "!", "Util", ".", "equalArraysOrNull", "(", "newFragName", ",", "source", ".", "names", ")", ")", "{", "char", "[", "]", "[", "]", "inclusionPatterns", "=", "root", ".", "fullInclusionPatternChars", "(", ")", ";", "char", "[", "]", "[", "]", "exclusionPatterns", "=", "root", ".", "fullExclusionPatternChars", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "resources", ".", "length", ";", "i", "++", ")", "{", "String", "resourceName", "=", "resources", "[", "i", "]", ".", "getName", "(", ")", ";", "if", "(", "Util", ".", "isJavaLikeFileName", "(", "resourceName", ")", ")", "{", "ICompilationUnit", "cu", "=", "newFrag", ".", "getCompilationUnit", "(", "resourceName", ")", ";", "if", "(", "Util", ".", "isExcluded", "(", "cu", ".", "getPath", "(", ")", ",", "inclusionPatterns", ",", "exclusionPatterns", ",", "false", ")", ")", "continue", ";", "this", ".", "parser", ".", "setSource", "(", "cu", ")", ";", "CompilationUnit", "astCU", "=", "(", "CompilationUnit", ")", "this", ".", "parser", ".", "createAST", "(", "this", ".", "progressMonitor", ")", ";", "AST", "ast", "=", "astCU", ".", "getAST", "(", ")", ";", "ASTRewrite", "rewrite", "=", "ASTRewrite", ".", "create", "(", "ast", ")", ";", "updatePackageStatement", "(", "astCU", ",", "newFragName", ",", "rewrite", ",", "cu", ")", ";", "TextEdit", "edits", "=", "rewrite", ".", "rewriteAST", "(", ")", ";", "applyTextEdit", "(", "cu", ",", "edits", ")", ";", "cu", ".", "save", "(", "null", ",", "false", ")", ";", "}", "}", "}", "boolean", "isEmpty", "=", "true", ";", "if", "(", "isMove", "(", ")", ")", "{", "updateReadOnlyPackageFragmentsForMove", "(", "(", "IContainer", ")", "source", ".", "parent", ".", "resource", "(", ")", ",", "root", ",", "newFragName", ",", "sourceIsReadOnly", ")", ";", "if", "(", "srcFolder", ".", "exists", "(", ")", ")", "{", "IResource", "[", "]", "remaining", "=", "srcFolder", ".", "members", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "remaining", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IResource", "file", "=", "remaining", "[", "i", "]", ";", "if", "(", "file", "instanceof", "IFile", ")", "{", "if", "(", "Util", ".", "isReadOnly", "(", "file", ")", ")", "{", "Util", ".", "setReadOnly", "(", "file", ",", "false", ")", ";", "}", "deleteResource", "(", "file", ",", "IResource", ".", "FORCE", "|", "IResource", ".", "KEEP_HISTORY", ")", ";", "}", "else", "{", "isEmpty", "=", "false", ";", "}", "}", "}", "if", "(", "isEmpty", ")", "{", "IResource", "rootResource", ";", "if", "(", "destPath", ".", "isPrefixOf", "(", "srcFolder", ".", "getFullPath", "(", ")", ")", ")", "{", "rootResource", "=", "newFrag", ".", "resource", "(", ")", ";", "}", "else", "{", "rootResource", "=", "source", ".", "parent", ".", "resource", "(", ")", ";", "}", "deleteEmptyPackageFragment", "(", "source", ",", "false", ",", "rootResource", ")", ";", "}", "}", "else", "if", "(", "containsReadOnlySubPackageFragments", ")", "{", "updateReadOnlyPackageFragmentsForCopy", "(", "(", "IContainer", ")", "source", ".", "parent", ".", "resource", "(", ")", ",", "root", ",", "newFragName", ")", ";", "}", "if", "(", "isEmpty", "&&", "isMove", "(", ")", "&&", "!", "(", "Util", ".", "isExcluded", "(", "source", ")", "||", "Util", ".", "isExcluded", "(", "newFrag", ")", ")", ")", "{", "IJavaProject", "sourceProject", "=", "source", ".", "getJavaProject", "(", ")", ";", "getDeltaFor", "(", "sourceProject", ")", ".", "movedFrom", "(", "source", ",", "newFrag", ")", ";", "IJavaProject", "destProject", "=", "newFrag", ".", "getJavaProject", "(", ")", ";", "getDeltaFor", "(", "destProject", ")", ".", "movedTo", "(", "newFrag", ",", "source", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "throw", "new", "JavaModelException", "(", "ce", ")", ";", "}", "}", "private", "void", "saveContent", "(", "PackageFragment", "dest", ",", "String", "destName", ",", "TextEdit", "edits", ",", "String", "sourceEncoding", ",", "IFile", "destFile", ")", "throws", "JavaModelException", "{", "try", "{", "if", "(", "sourceEncoding", "!=", "null", ")", "destFile", ".", "setCharset", "(", "sourceEncoding", ",", "this", ".", "progressMonitor", ")", ";", "}", "catch", "(", "CoreException", "ce", ")", "{", "}", "Util", ".", "setReadOnly", "(", "destFile", ",", "false", ")", ";", "ICompilationUnit", "destCU", "=", "dest", ".", "getCompilationUnit", "(", "destName", ")", ";", "applyTextEdit", "(", "destCU", ",", "edits", ")", ";", "destCU", ".", "save", "(", "getSubProgressMonitor", "(", "1", ")", ",", "this", ".", "force", ")", ";", "}", "private", "TextEdit", "updateContent", "(", "ICompilationUnit", "cu", ",", "PackageFragment", "dest", ",", "String", "newName", ")", "throws", "JavaModelException", "{", "String", "[", "]", "currPackageName", "=", "(", "(", "PackageFragment", ")", "cu", ".", "getParent", "(", ")", ")", ".", "names", ";", "String", "[", "]", "destPackageName", "=", "dest", ".", "names", ";", "if", "(", "Util", ".", "equalArraysOrNull", "(", "currPackageName", ",", "destPackageName", ")", "&&", "newName", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "cu", ".", "makeConsistent", "(", "this", ".", "progressMonitor", ")", ";", "if", "(", "LanguageSupportFactory", ".", "isInterestingSourceFile", "(", "cu", ".", "getElementName", "(", ")", ")", ")", "{", "return", "updateNonJavaContent", "(", "cu", ",", "destPackageName", ",", "currPackageName", ",", "newName", ")", ";", "}", "this", ".", "parser", ".", "setSource", "(", "cu", ")", ";", "CompilationUnit", "astCU", "=", "(", "CompilationUnit", ")", "this", ".", "parser", ".", "createAST", "(", "this", ".", "progressMonitor", ")", ";", "AST", "ast", "=", "astCU", ".", "getAST", "(", ")", ";", "ASTRewrite", "rewrite", "=", "ASTRewrite", ".", "create", "(", "ast", ")", ";", "updateTypeName", "(", "cu", ",", "astCU", ",", "cu", ".", "getElementName", "(", ")", ",", "newName", ",", "rewrite", ")", ";", "updatePackageStatement", "(", "astCU", ",", "destPackageName", ",", "rewrite", ",", "cu", ")", ";", "return", "rewrite", ".", "rewriteAST", "(", ")", ";", "}", "}", "private", "TextEdit", "updateNonJavaContent", "(", "ICompilationUnit", "cu", ",", "String", "[", "]", "destPackageName", ",", "String", "[", "]", "currPackageName", ",", "String", "newName", ")", "throws", "JavaModelException", "{", "IPackageDeclaration", "[", "]", "packageDecls", "=", "cu", ".", "getPackageDeclarations", "(", ")", ";", "boolean", "doPackage", "=", "!", "Util", ".", "equalArraysOrNull", "(", "currPackageName", ",", "destPackageName", ")", ";", "boolean", "doName", "=", "newName", "!=", "null", ";", "MultiTextEdit", "multiEdit", "=", "new", "MultiTextEdit", "(", ")", ";", "if", "(", "doPackage", ")", "{", "if", "(", "packageDecls", ".", "length", "==", "1", ")", "{", "ISourceRange", "packageRange", "=", "packageDecls", "[", "0", "]", ".", "getSourceRange", "(", ")", ";", "if", "(", "destPackageName", "==", "null", "||", "destPackageName", ".", "length", "==", "0", ")", "{", "multiEdit", ".", "addChild", "(", "new", "DeleteEdit", "(", "packageRange", ".", "getOffset", "(", ")", ",", "packageRange", ".", "getLength", "(", ")", ")", ")", ";", "}", "else", "{", "multiEdit", ".", "addChild", "(", "new", "ReplaceEdit", "(", "packageRange", ".", "getOffset", "(", ")", ",", "packageRange", ".", "getLength", "(", ")", ",", "\"package", "\"", "+", "Util", ".", "concatWith", "(", "destPackageName", ",", "'.'", ")", ")", ")", ";", "}", "}", "else", "{", "multiEdit", ".", "addChild", "(", "new", "InsertEdit", "(", "0", ",", "\"package", "\"", "+", "Util", ".", "concatWith", "(", "destPackageName", ",", "'.'", ")", "+", "\"n\"", ")", ")", ";", "}", "}", "if", "(", "doName", ")", "{", "int", "dotIndex", "=", "cu", ".", "getElementName", "(", ")", ".", "indexOf", "(", "'.'", ")", ";", "dotIndex", "=", "dotIndex", "==", "-", "1", "?", "cu", ".", "getElementName", "(", ")", ".", "length", "(", ")", ":", "dotIndex", ";", "String", "oldTypeName", "=", "cu", ".", "getElementName", "(", ")", ".", "substring", "(", "0", ",", "dotIndex", ")", ";", "dotIndex", "=", "newName", ".", "indexOf", "(", "'.'", ")", ";", "dotIndex", "=", "dotIndex", "==", "-", "1", "?", "newName", ".", "length", "(", ")", ":", "dotIndex", ";", "String", "newTypeName", "=", "newName", ".", "substring", "(", "0", ",", "dotIndex", ")", ";", "IType", "type", "=", "cu", ".", "getType", "(", "oldTypeName", ")", ";", "if", "(", "type", ".", "exists", "(", ")", ")", "{", "ISourceRange", "nameRange", "=", "type", ".", "getNameRange", "(", ")", ";", "if", "(", "nameRange", ".", "getOffset", "(", ")", ">", "0", "&&", "nameRange", ".", "getLength", "(", ")", ">", "0", "&&", "oldTypeName", ".", "length", "(", ")", "==", "nameRange", ".", "getLength", "(", ")", ")", "{", "multiEdit", ".", "addChild", "(", "new", "ReplaceEdit", "(", "nameRange", ".", "getOffset", "(", ")", ",", "nameRange", ".", "getLength", "(", ")", ",", "newTypeName", ")", ")", ";", "}", "IJavaElement", "[", "]", "children", "=", "type", ".", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "if", "(", "children", "[", "i", "]", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "METHOD", ")", "{", "IMethod", "method", "=", "(", "IMethod", ")", "children", "[", "i", "]", ";", "if", "(", "method", ".", "isConstructor", "(", ")", ")", "{", "nameRange", "=", "method", ".", "getNameRange", "(", ")", ";", "if", "(", "nameRange", ".", "getOffset", "(", ")", ">", "0", "&&", "nameRange", ".", "getLength", "(", ")", ">", "0", ")", "{", "multiEdit", ".", "addChild", "(", "new", "ReplaceEdit", "(", "nameRange", ".", "getOffset", "(", ")", ",", "nameRange", ".", "getLength", "(", ")", ",", "newTypeName", ")", ")", ";", "}", "}", "}", "}", "}", "}", "return", "multiEdit", ";", "}", "private", "void", "updatePackageStatement", "(", "CompilationUnit", "astCU", ",", "String", "[", "]", "pkgName", ",", "ASTRewrite", "rewriter", ",", "ICompilationUnit", "cu", ")", "throws", "JavaModelException", "{", "boolean", "defaultPackage", "=", "pkgName", ".", "length", "==", "0", ";", "AST", "ast", "=", "astCU", ".", "getAST", "(", ")", ";", "if", "(", "defaultPackage", ")", "{", "PackageDeclaration", "pkg", "=", "astCU", ".", "getPackage", "(", ")", ";", "if", "(", "pkg", "!=", "null", ")", "{", "int", "pkgStart", ";", "Javadoc", "javadoc", "=", "pkg", ".", "getJavadoc", "(", ")", ";", "if", "(", "javadoc", "!=", "null", ")", "{", "pkgStart", "=", "javadoc", ".", "getStartPosition", "(", ")", "+", "javadoc", ".", "getLength", "(", ")", "+", "1", ";", "}", "else", "{", "pkgStart", "=", "pkg", ".", "getStartPosition", "(", ")", ";", "}", "int", "extendedStart", "=", "astCU", ".", "getExtendedStartPosition", "(", "pkg", ")", ";", "if", "(", "pkgStart", "!=", "extendedStart", ")", "{", "String", "commentSource", "=", "cu", ".", "getSource", "(", ")", ".", "substring", "(", "extendedStart", ",", "pkgStart", ")", ";", "ASTNode", "comment", "=", "rewriter", ".", "createStringPlaceholder", "(", "commentSource", ",", "ASTNode", ".", "PACKAGE_DECLARATION", ")", ";", "rewriter", ".", "set", "(", "astCU", ",", "CompilationUnit", ".", "PACKAGE_PROPERTY", ",", "comment", ",", "null", ")", ";", "}", "else", "{", "rewriter", ".", "set", "(", "astCU", ",", "CompilationUnit", ".", "PACKAGE_PROPERTY", ",", "null", ",", "null", ")", ";", "}", "}", "}", "else", "{", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "PackageDeclaration", "pkg", "=", "astCU", ".", "getPackage", "(", ")", ";", "if", "(", "pkg", "!=", "null", ")", "{", "Name", "name", "=", "ast", ".", "newName", "(", "pkgName", ")", ";", "rewriter", ".", "set", "(", "pkg", ",", "PackageDeclaration", ".", "NAME_PROPERTY", ",", "name", ",", "null", ")", ";", "}", "else", "{", "pkg", "=", "ast", ".", "newPackageDeclaration", "(", ")", ";", "pkg", ".", "setName", "(", "ast", ".", "newName", "(", "pkgName", ")", ")", ";", "rewriter", ".", "set", "(", "astCU", ",", "CompilationUnit", ".", "PACKAGE_PROPERTY", ",", "pkg", ",", "null", ")", ";", "}", "}", "}", "private", "void", "updateReadOnlyPackageFragmentsForCopy", "(", "IContainer", "sourceFolder", ",", "PackageFragmentRoot", "root", ",", "String", "[", "]", "newFragName", ")", "{", "IContainer", "parentFolder", "=", "(", "IContainer", ")", "root", ".", "resource", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "newFragName", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "subFolderName", "=", "newFragName", "[", "i", "]", ";", "parentFolder", "=", "parentFolder", ".", "getFolder", "(", "new", "Path", "(", "subFolderName", ")", ")", ";", "sourceFolder", "=", "sourceFolder", ".", "getFolder", "(", "new", "Path", "(", "subFolderName", ")", ")", ";", "if", "(", "sourceFolder", ".", "exists", "(", ")", "&&", "Util", ".", "isReadOnly", "(", "sourceFolder", ")", ")", "{", "Util", ".", "setReadOnly", "(", "parentFolder", ",", "true", ")", ";", "}", "}", "}", "private", "void", "updateReadOnlyPackageFragmentsForMove", "(", "IContainer", "sourceFolder", ",", "PackageFragmentRoot", "root", ",", "String", "[", "]", "newFragName", ",", "boolean", "sourceFolderIsReadOnly", ")", "{", "IContainer", "parentFolder", "=", "(", "IContainer", ")", "root", ".", "resource", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "newFragName", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "subFolderName", "=", "newFragName", "[", "i", "]", ";", "parentFolder", "=", "parentFolder", ".", "getFolder", "(", "new", "Path", "(", "subFolderName", ")", ")", ";", "sourceFolder", "=", "sourceFolder", ".", "getFolder", "(", "new", "Path", "(", "subFolderName", ")", ")", ";", "if", "(", "(", "sourceFolder", ".", "exists", "(", ")", "&&", "Util", ".", "isReadOnly", "(", "sourceFolder", ")", ")", "||", "(", "i", "==", "length", "-", "1", "&&", "sourceFolderIsReadOnly", ")", ")", "{", "Util", ".", "setReadOnly", "(", "parentFolder", ",", "true", ")", ";", "Util", ".", "setReadOnly", "(", "sourceFolder", ",", "false", ")", ";", "}", "}", "}", "private", "void", "updateTypeName", "(", "ICompilationUnit", "cu", ",", "CompilationUnit", "astCU", ",", "String", "oldName", ",", "String", "newName", ",", "ASTRewrite", "rewriter", ")", "throws", "JavaModelException", "{", "if", "(", "newName", "!=", "null", ")", "{", "String", "oldTypeName", "=", "Util", ".", "getNameWithoutJavaLikeExtension", "(", "oldName", ")", ";", "String", "newTypeName", "=", "Util", ".", "getNameWithoutJavaLikeExtension", "(", "newName", ")", ";", "AST", "ast", "=", "astCU", ".", "getAST", "(", ")", ";", "IType", "[", "]", "types", "=", "cu", ".", "getTypes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "max", "=", "types", ".", "length", ";", "i", "<", "max", ";", "i", "++", ")", "{", "IType", "currentType", "=", "types", "[", "i", "]", ";", "if", "(", "currentType", ".", "getElementName", "(", ")", ".", "equals", "(", "oldTypeName", ")", ")", "{", "AbstractTypeDeclaration", "typeNode", "=", "(", "AbstractTypeDeclaration", ")", "(", "(", "JavaElement", ")", "currentType", ")", ".", "findNode", "(", "astCU", ")", ";", "if", "(", "typeNode", "!=", "null", ")", "{", "rewriter", ".", "replace", "(", "typeNode", ".", "getName", "(", ")", ",", "ast", ".", "newSimpleName", "(", "newTypeName", ")", ",", "null", ")", ";", "Iterator", "bodyDeclarations", "=", "typeNode", ".", "bodyDeclarations", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "bodyDeclarations", ".", "hasNext", "(", ")", ")", "{", "Object", "bodyDeclaration", "=", "bodyDeclarations", ".", "next", "(", ")", ";", "if", "(", "bodyDeclaration", "instanceof", "MethodDeclaration", ")", "{", "MethodDeclaration", "methodDeclaration", "=", "(", "MethodDeclaration", ")", "bodyDeclaration", ";", "if", "(", "methodDeclaration", ".", "isConstructor", "(", ")", ")", "{", "SimpleName", "methodName", "=", "methodDeclaration", ".", "getName", "(", ")", ";", "if", "(", "methodName", ".", "getIdentifier", "(", ")", ".", "equals", "(", "oldTypeName", ")", ")", "{", "rewriter", ".", "replace", "(", "methodName", ",", "ast", ".", "newSimpleName", "(", "newTypeName", ")", ",", "null", ")", ";", "}", "}", "}", "}", "}", "}", "}", "}", "}", "protected", "IJavaModelStatus", "verify", "(", ")", "{", "IJavaModelStatus", "status", "=", "super", ".", "verify", "(", ")", ";", "if", "(", "!", "status", ".", "isOK", "(", ")", ")", "{", "return", "status", ";", "}", "if", "(", "this", ".", "renamingsList", "!=", "null", "&&", "this", ".", "renamingsList", ".", "length", "!=", "this", ".", "elementsToProcess", ".", "length", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INDEX_OUT_OF_BOUNDS", ")", ";", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "protected", "void", "verify", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "if", "(", "element", "==", "null", "||", "!", "element", ".", "exists", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "ELEMENT_DOES_NOT_EXIST", ",", "element", ")", ";", "if", "(", "element", ".", "isReadOnly", "(", ")", "&&", "(", "isRename", "(", ")", "||", "isMove", "(", ")", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "READ_ONLY", ",", "element", ")", ";", "IResource", "resource", "=", "(", "(", "JavaElement", ")", "element", ")", ".", "resource", "(", ")", ";", "if", "(", "resource", "instanceof", "IFolder", ")", "{", "if", "(", "resource", ".", "isLinked", "(", ")", ")", "{", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_RESOURCE", ",", "element", ")", ";", "}", "}", "int", "elementType", "=", "element", ".", "getElementType", "(", ")", ";", "if", "(", "elementType", "==", "IJavaElement", ".", "COMPILATION_UNIT", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", "compilationUnit", "=", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "CompilationUnit", ")", "element", ";", "if", "(", "isMove", "(", ")", "&&", "compilationUnit", ".", "isWorkingCopy", "(", ")", "&&", "!", "compilationUnit", ".", "isPrimary", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ";", "}", "else", "if", "(", "elementType", "!=", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", "{", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ";", "}", "JavaElement", "dest", "=", "(", "JavaElement", ")", "getDestinationParent", "(", "element", ")", ";", "verifyDestination", "(", "element", ",", "dest", ")", ";", "if", "(", "this", ".", "renamings", "!=", "null", ")", "{", "verifyRenaming", "(", "element", ")", ";", "}", "}", "}", "</s>" ]
3,777
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Assert", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "public", "class", "ImportDeclaration", "extends", "SourceRefElement", "implements", "IImportDeclaration", "{", "protected", "String", "name", ";", "protected", "boolean", "isOnDemand", ";", "protected", "ImportDeclaration", "(", "ImportContainer", "parent", ",", "String", "name", ",", "boolean", "isOnDemand", ")", "{", "super", "(", "parent", ")", ";", "this", ".", "name", "=", "name", ";", "this", ".", "isOnDemand", "=", "isOnDemand", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "ImportDeclaration", ")", ")", "return", "false", ";", "return", "super", ".", "equals", "(", "o", ")", ";", "}", "public", "String", "getElementName", "(", ")", "{", "if", "(", "this", ".", "isOnDemand", ")", "return", "this", ".", "name", "+", "\".*\"", ";", "return", "this", ".", "name", ";", "}", "public", "String", "getNameWithoutStar", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "IMPORT_DECLARATION", ";", "}", "public", "int", "getFlags", "(", ")", "throws", "JavaModelException", "{", "ImportDeclarationElementInfo", "info", "=", "(", "ImportDeclarationElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "getModifiers", "(", ")", ";", "}", "protected", "void", "getHandleMemento", "(", "StringBuffer", "buff", ")", "{", "(", "(", "JavaElement", ")", "getParent", "(", ")", ")", ".", "getHandleMemento", "(", "buff", ")", ";", "escapeMementoName", "(", "buff", ",", "getElementName", "(", ")", ")", ";", "if", "(", "this", ".", "occurrenceCount", ">", "1", ")", "{", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "}", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "Assert", ".", "isTrue", "(", "false", ",", "\"\"", ")", ";", "return", "0", ";", "}", "public", "ISourceRange", "getNameRange", "(", ")", "throws", "JavaModelException", "{", "ImportDeclarationElementInfo", "info", "=", "(", "ImportDeclarationElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "getNameRange", "(", ")", ";", "}", "public", "IJavaElement", "getPrimaryElement", "(", "boolean", "checkOwner", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "this", ".", "parent", ".", "getParent", "(", ")", ";", "if", "(", "checkOwner", "&&", "cu", ".", "isPrimary", "(", ")", ")", "return", "this", ";", "return", "cu", ".", "getImport", "(", "getElementName", "(", ")", ")", ";", "}", "public", "boolean", "isOnDemand", "(", ")", "{", "return", "this", ".", "isOnDemand", ";", "}", "public", "String", "readableName", "(", ")", "{", "return", "null", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "buffer", ".", "append", "(", "\"import", "\"", ")", ";", "toStringName", "(", "buffer", ")", ";", "if", "(", "info", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"", "(not", "open)\"", ")", ";", "}", "}", "}", "</s>" ]
3,778
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AbstractTypeDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SimpleName", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "CreateTypeOperation", "extends", "CreateTypeMemberOperation", "{", "public", "CreateTypeOperation", "(", "IJavaElement", "parentElement", ",", "String", "source", ",", "boolean", "force", ")", "{", "super", "(", "parentElement", ",", "source", ",", "force", ")", ";", "}", "protected", "ASTNode", "generateElementAST", "(", "ASTRewrite", "rewriter", ",", "ICompilationUnit", "cu", ")", "throws", "JavaModelException", "{", "ASTNode", "node", "=", "super", ".", "generateElementAST", "(", "rewriter", ",", "cu", ")", ";", "if", "(", "!", "(", "node", "instanceof", "AbstractTypeDeclaration", ")", ")", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CONTENTS", ")", ")", ";", "return", "node", ";", "}", "protected", "IJavaElement", "generateResultHandle", "(", ")", "{", "IJavaElement", "parent", "=", "getParentElement", "(", ")", ";", "switch", "(", "parent", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "return", "(", "(", "ICompilationUnit", ")", "parent", ")", ".", "getType", "(", "getASTNodeName", "(", ")", ")", ";", "case", "IJavaElement", ".", "TYPE", ":", "return", "(", "(", "IType", ")", "parent", ")", ".", "getType", "(", "getASTNodeName", "(", ")", ")", ";", "}", "return", "null", ";", "}", "public", "String", "getMainTaskName", "(", ")", "{", "return", "Messages", ".", "operation_createTypeProgress", ";", "}", "protected", "IType", "getType", "(", ")", "{", "IJavaElement", "parent", "=", "getParentElement", "(", ")", ";", "if", "(", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "return", "(", "IType", ")", "parent", ";", "}", "return", "null", ";", "}", "protected", "IJavaModelStatus", "verifyNameCollision", "(", ")", "{", "IJavaElement", "parent", "=", "getParentElement", "(", ")", ";", "switch", "(", "parent", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "String", "typeName", "=", "getASTNodeName", "(", ")", ";", "if", "(", "(", "(", "ICompilationUnit", ")", "parent", ")", ".", "getType", "(", "typeName", ")", ".", "exists", "(", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "typeName", ")", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "typeName", "=", "getASTNodeName", "(", ")", ";", "if", "(", "(", "(", "IType", ")", "parent", ")", ".", "getType", "(", "typeName", ")", ".", "exists", "(", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "typeName", ")", ")", ";", "}", "break", ";", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "public", "IJavaModelStatus", "verify", "(", ")", "{", "IJavaModelStatus", "status", "=", "super", ".", "verify", "(", ")", ";", "if", "(", "!", "status", ".", "isOK", "(", ")", ")", "return", "status", ";", "try", "{", "IJavaElement", "parent", "=", "getParentElement", "(", ")", ";", "if", "(", "this", ".", "anchorElement", "!=", "null", "&&", "this", ".", "anchorElement", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "FIELD", "&&", "parent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", "&&", "(", "(", "IType", ")", "parent", ")", ".", "isEnum", "(", ")", ")", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_SIBLING", ",", "this", ".", "anchorElement", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "e", ".", "getJavaModelStatus", "(", ")", ";", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "private", "String", "getASTNodeName", "(", ")", "{", "return", "(", "(", "AbstractTypeDeclaration", ")", "this", ".", "createdNode", ")", ".", "getName", "(", ")", ".", "getIdentifier", "(", ")", ";", "}", "protected", "SimpleName", "rename", "(", "ASTNode", "node", ",", "SimpleName", "newName", ")", "{", "AbstractTypeDeclaration", "type", "=", "(", "AbstractTypeDeclaration", ")", "node", ";", "SimpleName", "oldName", "=", "type", ".", "getName", "(", ")", ";", "type", ".", "setName", "(", "newName", ")", ";", "return", "oldName", ";", "}", "}", "</s>" ]
3,779
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ILocalVariable", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMemberValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ITypeParameter", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaCore", ";", "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", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "env", ".", "IBinaryType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ".", "PerProjectInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "class", "BinaryMethod", "extends", "BinaryMember", "implements", "IMethod", "{", "protected", "String", "[", "]", "parameterTypes", ";", "protected", "String", "[", "]", "erasedParamaterTypes", ";", "protected", "String", "[", "]", "parameterNames", ";", "protected", "String", "[", "]", "exceptionTypes", ";", "protected", "String", "returnType", ";", "protected", "BinaryMethod", "(", "JavaElement", "parent", ",", "String", "name", ",", "String", "[", "]", "paramTypes", ")", "{", "super", "(", "parent", ",", "name", ")", ";", "if", "(", "paramTypes", "==", "null", ")", "{", "this", ".", "parameterTypes", "=", "CharOperation", ".", "NO_STRINGS", ";", "}", "else", "{", "this", ".", "parameterTypes", "=", "paramTypes", ";", "}", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "BinaryMethod", ")", ")", "return", "false", ";", "return", "super", ".", "equals", "(", "o", ")", "&&", "Util", ".", "equalArraysOrNull", "(", "getErasedParameterTypes", "(", ")", ",", "(", "(", "BinaryMethod", ")", "o", ")", ".", "getErasedParameterTypes", "(", ")", ")", ";", "}", "public", "IAnnotation", "[", "]", "getAnnotations", "(", ")", "throws", "JavaModelException", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "IBinaryAnnotation", "[", "]", "binaryAnnotations", "=", "info", ".", "getAnnotations", "(", ")", ";", "return", "getAnnotations", "(", "binaryAnnotations", ",", "info", ".", "getTagBits", "(", ")", ")", ";", "}", "public", "ILocalVariable", "[", "]", "getParameters", "(", ")", "throws", "JavaModelException", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "int", "length", "=", "this", ".", "parameterTypes", ".", "length", ";", "if", "(", "length", "==", "0", ")", "{", "return", "LocalVariable", ".", "NO_LOCAL_VARIABLES", ";", "}", "ILocalVariable", "[", "]", "localVariables", "=", "new", "ILocalVariable", "[", "length", "]", ";", "char", "[", "]", "[", "]", "argumentNames", "=", "info", ".", "getArgumentNames", "(", ")", ";", "if", "(", "argumentNames", "==", "null", "||", "argumentNames", ".", "length", "<", "length", ")", "{", "argumentNames", "=", "new", "char", "[", "length", "]", "[", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length", ";", "j", "++", ")", "{", "argumentNames", "[", "j", "]", "=", "(", "\"arg\"", "+", "j", ")", ".", "toCharArray", "(", ")", ";", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "LocalVariable", "localVariable", "=", "new", "LocalVariable", "(", "this", ",", "new", "String", "(", "argumentNames", "[", "i", "]", ")", ",", "0", ",", "-", "1", ",", "0", ",", "-", "1", ",", "this", ".", "parameterTypes", "[", "i", "]", ",", "null", ",", "-", "1", ",", "true", ")", ";", "localVariables", "[", "i", "]", "=", "localVariable", ";", "IAnnotation", "[", "]", "annotations", "=", "getAnnotations", "(", "localVariable", ",", "info", ".", "getParameterAnnotations", "(", "i", ")", ",", "info", ".", "getTagBits", "(", ")", ")", ";", "localVariable", ".", "annotations", "=", "annotations", ";", "}", "return", "localVariables", ";", "}", "private", "IAnnotation", "[", "]", "getAnnotations", "(", "JavaElement", "annotationParent", ",", "IBinaryAnnotation", "[", "]", "binaryAnnotations", ",", "long", "tagBits", ")", "{", "IAnnotation", "[", "]", "standardAnnotations", "=", "getStandardAnnotations", "(", "tagBits", ")", ";", "if", "(", "binaryAnnotations", "==", "null", ")", "return", "standardAnnotations", ";", "int", "length", "=", "binaryAnnotations", ".", "length", ";", "int", "standardLength", "=", "standardAnnotations", ".", "length", ";", "IAnnotation", "[", "]", "annotations", "=", "new", "IAnnotation", "[", "length", "+", "standardLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "annotations", "[", "i", "]", "=", "Util", ".", "getAnnotation", "(", "annotationParent", ",", "binaryAnnotations", "[", "i", "]", ",", "null", ")", ";", "}", "System", ".", "arraycopy", "(", "standardAnnotations", ",", "0", ",", "annotations", ",", "length", ",", "standardLength", ")", ";", "return", "annotations", ";", "}", "public", "IMemberValuePair", "getDefaultValue", "(", ")", "throws", "JavaModelException", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "Object", "defaultValue", "=", "info", ".", "getDefaultValue", "(", ")", ";", "if", "(", "defaultValue", "==", "null", ")", "return", "null", ";", "MemberValuePair", "memberValuePair", "=", "new", "MemberValuePair", "(", "getElementName", "(", ")", ")", ";", "memberValuePair", ".", "value", "=", "Util", ".", "getAnnotationMemberValue", "(", "this", ",", "memberValuePair", ",", "defaultValue", ")", ";", "return", "memberValuePair", ";", "}", "public", "String", "[", "]", "getExceptionTypes", "(", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "exceptionTypes", "==", "null", ")", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "char", "[", "]", "genericSignature", "=", "info", ".", "getGenericSignature", "(", ")", ";", "if", "(", "genericSignature", "!=", "null", ")", "{", "char", "[", "]", "dotBasedSignature", "=", "CharOperation", ".", "replaceOnCopy", "(", "genericSignature", ",", "'/'", ",", "'.'", ")", ";", "this", ".", "exceptionTypes", "=", "Signature", ".", "getThrownExceptionTypes", "(", "new", "String", "(", "dotBasedSignature", ")", ")", ";", "}", "if", "(", "this", ".", "exceptionTypes", "==", "null", "||", "this", ".", "exceptionTypes", ".", "length", "==", "0", ")", "{", "char", "[", "]", "[", "]", "eTypeNames", "=", "info", ".", "getExceptionTypeNames", "(", ")", ";", "if", "(", "eTypeNames", "==", "null", "||", "eTypeNames", ".", "length", "==", "0", ")", "{", "this", ".", "exceptionTypes", "=", "CharOperation", ".", "NO_STRINGS", ";", "}", "else", "{", "eTypeNames", "=", "ClassFile", ".", "translatedNames", "(", "eTypeNames", ")", ";", "this", ".", "exceptionTypes", "=", "new", "String", "[", "eTypeNames", ".", "length", "]", ";", "for", "(", "int", "j", "=", "0", ",", "length", "=", "eTypeNames", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "int", "nameLength", "=", "eTypeNames", "[", "j", "]", ".", "length", ";", "char", "[", "]", "convertedName", "=", "new", "char", "[", "nameLength", "+", "2", "]", ";", "System", ".", "arraycopy", "(", "eTypeNames", "[", "j", "]", ",", "0", ",", "convertedName", ",", "1", ",", "nameLength", ")", ";", "convertedName", "[", "0", "]", "=", "'L'", ";", "convertedName", "[", "nameLength", "+", "1", "]", "=", "';'", ";", "this", ".", "exceptionTypes", "[", "j", "]", "=", "new", "String", "(", "convertedName", ")", ";", "}", "}", "}", "}", "return", "this", ".", "exceptionTypes", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "METHOD", ";", "}", "public", "int", "getFlags", "(", ")", "throws", "JavaModelException", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "getModifiers", "(", ")", ";", "}", "protected", "void", "getHandleMemento", "(", "StringBuffer", "buff", ")", "{", "(", "(", "JavaElement", ")", "getParent", "(", ")", ")", ".", "getHandleMemento", "(", "buff", ")", ";", "char", "delimiter", "=", "getHandleMementoDelimiter", "(", ")", ";", "buff", ".", "append", "(", "delimiter", ")", ";", "escapeMementoName", "(", "buff", ",", "getElementName", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "parameterTypes", ".", "length", ";", "i", "++", ")", "{", "buff", ".", "append", "(", "delimiter", ")", ";", "escapeMementoName", "(", "buff", ",", "this", ".", "parameterTypes", "[", "i", "]", ")", ";", "}", "if", "(", "this", ".", "occurrenceCount", ">", "1", ")", "{", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "}", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JavaElement", ".", "JEM_METHOD", ";", "}", "public", "String", "getKey", "(", "boolean", "forceOpen", ")", "throws", "JavaModelException", "{", "return", "getKey", "(", "this", ",", "forceOpen", ")", ";", "}", "public", "int", "getNumberOfParameters", "(", ")", "{", "return", "this", ".", "parameterTypes", "==", "null", "?", "0", ":", "this", ".", "parameterTypes", ".", "length", ";", "}", "public", "String", "[", "]", "getParameterNames", "(", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "parameterNames", "!=", "null", ")", "return", "this", ".", "parameterNames", ";", "IType", "type", "=", "(", "IType", ")", "getParent", "(", ")", ";", "SourceMapper", "mapper", "=", "getSourceMapper", "(", ")", ";", "if", "(", "mapper", "!=", "null", ")", "{", "char", "[", "]", "[", "]", "paramNames", "=", "mapper", ".", "getMethodParameterNames", "(", "this", ")", ";", "if", "(", "paramNames", "==", "null", ")", "{", "IBinaryType", "info", "=", "(", "IBinaryType", ")", "(", "(", "BinaryType", ")", "getDeclaringType", "(", ")", ")", ".", "getElementInfo", "(", ")", ";", "char", "[", "]", "source", "=", "mapper", ".", "findSource", "(", "type", ",", "info", ")", ";", "if", "(", "source", "!=", "null", ")", "{", "mapper", ".", "mapSource", "(", "type", ",", "source", ",", "info", ")", ";", "}", "paramNames", "=", "mapper", ".", "getMethodParameterNames", "(", "this", ")", ";", "}", "if", "(", "paramNames", "!=", "null", ")", "{", "String", "[", "]", "names", "=", "new", "String", "[", "paramNames", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paramNames", ".", "length", ";", "i", "++", ")", "{", "names", "[", "i", "]", "=", "new", "String", "(", "paramNames", "[", "i", "]", ")", ";", "}", "return", "this", ".", "parameterNames", "=", "names", ";", "}", "}", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "int", "paramCount", "=", "Signature", ".", "getParameterCount", "(", "new", "String", "(", "info", ".", "getMethodDescriptor", "(", ")", ")", ")", ";", "if", "(", "this", ".", "isConstructor", "(", ")", ")", "{", "final", "IType", "declaringType", "=", "this", ".", "getDeclaringType", "(", ")", ";", "if", "(", "declaringType", ".", "isMember", "(", ")", "&&", "!", "Flags", ".", "isStatic", "(", "declaringType", ".", "getFlags", "(", ")", ")", ")", "{", "paramCount", "--", ";", "}", "}", "if", "(", "paramCount", "!=", "0", ")", "{", "int", "modifiers", "=", "getFlags", "(", ")", ";", "if", "(", "(", "modifiers", "&", "ClassFileConstants", ".", "AccSynthetic", ")", "!=", "0", ")", "{", "return", "this", ".", "parameterNames", "=", "getRawParameterNames", "(", "paramCount", ")", ";", "}", "JavadocContents", "javadocContents", "=", "null", ";", "IType", "declaringType", "=", "getDeclaringType", "(", ")", ";", "PerProjectInfo", "projectInfo", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getPerProjectInfoCheckExistence", "(", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ")", ";", "synchronized", "(", "projectInfo", ".", "javadocCache", ")", "{", "javadocContents", "=", "(", "JavadocContents", ")", "projectInfo", ".", "javadocCache", ".", "get", "(", "declaringType", ")", ";", "if", "(", "javadocContents", "==", "null", ")", "{", "projectInfo", ".", "javadocCache", ".", "put", "(", "declaringType", ",", "BinaryType", ".", "EMPTY_JAVADOC", ")", ";", "}", "}", "String", "methodDoc", "=", "null", ";", "if", "(", "javadocContents", "==", "null", ")", "{", "long", "timeOut", "=", "50", ";", "try", "{", "String", "option", "=", "getJavaProject", "(", ")", ".", "getOption", "(", "JavaCore", ".", "TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC", ",", "true", ")", ";", "if", "(", "option", "!=", "null", ")", "{", "timeOut", "=", "Long", ".", "parseLong", "(", "option", ")", ";", "}", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "}", "if", "(", "timeOut", "==", "0", ")", "{", "return", "getRawParameterNames", "(", "paramCount", ")", ";", "}", "final", "class", "ParametersNameCollector", "{", "String", "javadoc", ";", "public", "void", "setJavadoc", "(", "String", "s", ")", "{", "this", ".", "javadoc", "=", "s", ";", "}", "public", "String", "getJavadoc", "(", ")", "{", "return", "this", ".", "javadoc", ";", "}", "}", "final", "ParametersNameCollector", "nameCollector", "=", "new", "ParametersNameCollector", "(", ")", ";", "Thread", "collect", "=", "new", "Thread", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "nameCollector", ".", "setJavadoc", "(", "BinaryMethod", ".", "this", ".", "getAttachedJavadoc", "(", "null", ")", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "synchronized", "(", "nameCollector", ")", "{", "nameCollector", ".", "notify", "(", ")", ";", "}", "}", "}", ";", "collect", ".", "start", "(", ")", ";", "synchronized", "(", "nameCollector", ")", "{", "try", "{", "nameCollector", ".", "wait", "(", "timeOut", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}", "methodDoc", "=", "nameCollector", ".", "getJavadoc", "(", ")", ";", "}", "else", "if", "(", "javadocContents", "!=", "BinaryType", ".", "EMPTY_JAVADOC", ")", "{", "try", "{", "methodDoc", "=", "javadocContents", ".", "getMethodDoc", "(", "this", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "javadocContents", "=", "null", ";", "}", "}", "if", "(", "methodDoc", "!=", "null", ")", "{", "final", "int", "indexOfOpenParen", "=", "methodDoc", ".", "indexOf", "(", "'('", ")", ";", "if", "(", "indexOfOpenParen", "!=", "-", "1", ")", "{", "final", "int", "indexOfClosingParen", "=", "methodDoc", ".", "indexOf", "(", "')'", ",", "indexOfOpenParen", ")", ";", "if", "(", "indexOfClosingParen", "!=", "-", "1", ")", "{", "final", "char", "[", "]", "paramsSource", "=", "CharOperation", ".", "replace", "(", "methodDoc", ".", "substring", "(", "indexOfOpenParen", "+", "1", ",", "indexOfClosingParen", ")", ".", "toCharArray", "(", ")", ",", "\"&nbsp;\"", ".", "toCharArray", "(", ")", ",", "new", "char", "[", "]", "{", "'", "'", "}", ")", ";", "final", "char", "[", "]", "[", "]", "params", "=", "splitParameters", "(", "paramsSource", ",", "paramCount", ")", ";", "final", "int", "paramsLength", "=", "params", ".", "length", ";", "String", "[", "]", "names", "=", "new", "String", "[", "paramsLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paramsLength", ";", "i", "++", ")", "{", "final", "char", "[", "]", "param", "=", "params", "[", "i", "]", ";", "int", "indexOfSpace", "=", "CharOperation", ".", "lastIndexOf", "(", "'", "'", ",", "param", ")", ";", "if", "(", "indexOfSpace", "!=", "-", "1", ")", "{", "names", "[", "i", "]", "=", "String", ".", "valueOf", "(", "param", ",", "indexOfSpace", "+", "1", ",", "param", ".", "length", "-", "indexOfSpace", "-", "1", ")", ";", "}", "else", "{", "names", "[", "i", "]", "=", "\"arg\"", "+", "i", ";", "}", "}", "return", "this", ".", "parameterNames", "=", "names", ";", "}", "}", "}", "char", "[", "]", "[", "]", "argumentNames", "=", "info", ".", "getArgumentNames", "(", ")", ";", "if", "(", "argumentNames", "!=", "null", "&&", "argumentNames", ".", "length", "==", "paramCount", ")", "{", "String", "[", "]", "names", "=", "new", "String", "[", "paramCount", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paramCount", ";", "i", "++", ")", "{", "names", "[", "i", "]", "=", "new", "String", "(", "argumentNames", "[", "i", "]", ")", ";", "}", "return", "this", ".", "parameterNames", "=", "names", ";", "}", "}", "return", "getRawParameterNames", "(", "paramCount", ")", ";", "}", "private", "char", "[", "]", "[", "]", "splitParameters", "(", "char", "[", "]", "parametersSource", ",", "int", "paramCount", ")", "{", "char", "[", "]", "[", "]", "params", "=", "new", "char", "[", "paramCount", "]", "[", "]", ";", "int", "paramIndex", "=", "0", ";", "int", "index", "=", "0", ";", "int", "balance", "=", "0", ";", "int", "length", "=", "parametersSource", ".", "length", ";", "int", "start", "=", "0", ";", "while", "(", "index", "<", "length", ")", "{", "switch", "(", "parametersSource", "[", "index", "]", ")", "{", "case", "'<'", ":", "balance", "++", ";", "index", "++", ";", "while", "(", "index", "<", "length", "&&", "parametersSource", "[", "index", "]", "!=", "'>'", ")", "{", "index", "++", ";", "}", "break", ";", "case", "'>'", ":", "balance", "--", ";", "index", "++", ";", "break", ";", "case", "','", ":", "if", "(", "balance", "==", "0", "&&", "paramIndex", "<", "paramCount", ")", "{", "params", "[", "paramIndex", "++", "]", "=", "CharOperation", ".", "subarray", "(", "parametersSource", ",", "start", ",", "index", ")", ";", "start", "=", "index", "+", "1", ";", "}", "index", "++", ";", "break", ";", "case", "'&'", ":", "if", "(", "(", "index", "+", "4", ")", "<", "length", ")", "{", "if", "(", "parametersSource", "[", "index", "+", "1", "]", "==", "'l'", "&&", "parametersSource", "[", "index", "+", "2", "]", "==", "'t'", "&&", "parametersSource", "[", "index", "+", "3", "]", "==", "';'", ")", "{", "balance", "++", ";", "index", "+=", "4", ";", "}", "else", "if", "(", "parametersSource", "[", "index", "+", "1", "]", "==", "'g'", "&&", "parametersSource", "[", "index", "+", "2", "]", "==", "'t'", "&&", "parametersSource", "[", "index", "+", "3", "]", "==", "';'", ")", "{", "balance", "--", ";", "index", "+=", "4", ";", "}", "else", "{", "index", "++", ";", "}", "}", "else", "{", "index", "++", ";", "}", "break", ";", "default", ":", "index", "++", ";", "}", "}", "if", "(", "paramIndex", "<", "paramCount", ")", "{", "params", "[", "paramIndex", "++", "]", "=", "CharOperation", ".", "subarray", "(", "parametersSource", ",", "start", ",", "index", ")", ";", "}", "if", "(", "paramIndex", "!=", "paramCount", ")", "{", "System", ".", "arraycopy", "(", "params", ",", "0", ",", "(", "params", "=", "new", "char", "[", "paramIndex", "]", "[", "]", ")", ",", "0", ",", "paramIndex", ")", ";", "}", "return", "params", ";", "}", "public", "String", "[", "]", "getParameterTypes", "(", ")", "{", "return", "this", ".", "parameterTypes", ";", "}", "private", "String", "[", "]", "getErasedParameterTypes", "(", ")", "{", "if", "(", "this", ".", "erasedParamaterTypes", "==", "null", ")", "{", "int", "paramCount", "=", "this", ".", "parameterTypes", ".", "length", ";", "String", "[", "]", "erasedTypes", "=", "new", "String", "[", "paramCount", "]", ";", "boolean", "erasureNeeded", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paramCount", ";", "i", "++", ")", "{", "String", "parameterType", "=", "this", ".", "parameterTypes", "[", "i", "]", ";", "if", "(", "(", "erasedTypes", "[", "i", "]", "=", "Signature", ".", "getTypeErasure", "(", "parameterType", ")", ")", "!=", "parameterType", ")", "erasureNeeded", "=", "true", ";", "}", "this", ".", "erasedParamaterTypes", "=", "erasureNeeded", "?", "erasedTypes", ":", "this", ".", "parameterTypes", ";", "}", "return", "this", ".", "erasedParamaterTypes", ";", "}", "private", "String", "getErasedParameterType", "(", "int", "index", ")", "{", "return", "getErasedParameterTypes", "(", ")", "[", "index", "]", ";", "}", "public", "ITypeParameter", "getTypeParameter", "(", "String", "typeParameterName", ")", "{", "return", "new", "TypeParameter", "(", "this", ",", "typeParameterName", ")", ";", "}", "public", "ITypeParameter", "[", "]", "getTypeParameters", "(", ")", "throws", "JavaModelException", "{", "String", "[", "]", "typeParameterSignatures", "=", "getTypeParameterSignatures", "(", ")", ";", "int", "length", "=", "typeParameterSignatures", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "TypeParameter", ".", "NO_TYPE_PARAMETERS", ";", "ITypeParameter", "[", "]", "typeParameters", "=", "new", "ITypeParameter", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "typeParameterSignatures", ".", "length", ";", "i", "++", ")", "{", "String", "typeParameterName", "=", "Signature", ".", "getTypeVariable", "(", "typeParameterSignatures", "[", "i", "]", ")", ";", "typeParameters", "[", "i", "]", "=", "new", "TypeParameter", "(", "this", ",", "typeParameterName", ")", ";", "}", "return", "typeParameters", ";", "}", "public", "String", "[", "]", "getTypeParameterSignatures", "(", ")", "throws", "JavaModelException", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "char", "[", "]", "genericSignature", "=", "info", ".", "getGenericSignature", "(", ")", ";", "if", "(", "genericSignature", "==", "null", ")", "return", "CharOperation", ".", "NO_STRINGS", ";", "char", "[", "]", "dotBasedSignature", "=", "CharOperation", ".", "replaceOnCopy", "(", "genericSignature", ",", "'/'", ",", "'.'", ")", ";", "char", "[", "]", "[", "]", "typeParams", "=", "Signature", ".", "getTypeParameters", "(", "dotBasedSignature", ")", ";", "return", "CharOperation", ".", "toStrings", "(", "typeParams", ")", ";", "}", "public", "String", "[", "]", "getRawParameterNames", "(", ")", "throws", "JavaModelException", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "int", "paramCount", "=", "Signature", ".", "getParameterCount", "(", "new", "String", "(", "info", ".", "getMethodDescriptor", "(", ")", ")", ")", ";", "return", "getRawParameterNames", "(", "paramCount", ")", ";", "}", "private", "String", "[", "]", "getRawParameterNames", "(", "int", "paramCount", ")", "{", "String", "[", "]", "result", "=", "new", "String", "[", "paramCount", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paramCount", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "\"arg\"", "+", "i", ";", "}", "return", "result", ";", "}", "public", "String", "getReturnType", "(", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "returnType", "==", "null", ")", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "this", ".", "returnType", "=", "getReturnType", "(", "info", ")", ";", "}", "return", "this", ".", "returnType", ";", "}", "private", "String", "getReturnType", "(", "IBinaryMethod", "info", ")", "{", "char", "[", "]", "genericSignature", "=", "info", ".", "getGenericSignature", "(", ")", ";", "char", "[", "]", "signature", "=", "genericSignature", "==", "null", "?", "info", ".", "getMethodDescriptor", "(", ")", ":", "genericSignature", ";", "char", "[", "]", "dotBasedSignature", "=", "CharOperation", ".", "replaceOnCopy", "(", "signature", ",", "'/'", ",", "'.'", ")", ";", "String", "returnTypeName", "=", "Signature", ".", "getReturnType", "(", "new", "String", "(", "dotBasedSignature", ")", ")", ";", "return", "new", "String", "(", "ClassFile", ".", "translatedName", "(", "returnTypeName", ".", "toCharArray", "(", ")", ")", ")", ";", "}", "public", "String", "getSignature", "(", ")", "throws", "JavaModelException", "{", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "return", "new", "String", "(", "info", ".", "getMethodDescriptor", "(", ")", ")", ";", "}", "public", "int", "hashCode", "(", ")", "{", "int", "hash", "=", "super", ".", "hashCode", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "parameterTypes", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "hash", "=", "Util", ".", "combineHashCodes", "(", "hash", ",", "getErasedParameterType", "(", "i", ")", ".", "hashCode", "(", ")", ")", ";", "}", "return", "hash", ";", "}", "public", "boolean", "isConstructor", "(", ")", "throws", "JavaModelException", "{", "if", "(", "!", "getElementName", "(", ")", ".", "equals", "(", "this", ".", "parent", ".", "getElementName", "(", ")", ")", ")", "{", "return", "false", ";", "}", "IBinaryMethod", "info", "=", "(", "IBinaryMethod", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "isConstructor", "(", ")", ";", "}", "public", "boolean", "isMainMethod", "(", ")", "throws", "JavaModelException", "{", "return", "this", ".", "isMainMethod", "(", "this", ")", ";", "}", "public", "boolean", "isResolved", "(", ")", "{", "return", "false", ";", "}", "public", "boolean", "isSimilar", "(", "IMethod", "method", ")", "{", "return", "areSimilarMethods", "(", "getElementName", "(", ")", ",", "getParameterTypes", "(", ")", ",", "method", ".", "getElementName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ",", "null", ")", ";", "}", "public", "String", "readableName", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "super", ".", "readableName", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"(\"", ")", ";", "String", "[", "]", "paramTypes", "=", "this", ".", "parameterTypes", ";", "int", "length", ";", "if", "(", "paramTypes", "!=", "null", "&&", "(", "length", "=", "paramTypes", ".", "length", ")", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "paramTypes", "[", "i", "]", ")", ")", ";", "if", "(", "i", "<", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "}", "}", "buffer", ".", "append", "(", "\")\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "public", "JavaElement", "resolved", "(", "Binding", "binding", ")", "{", "SourceRefElement", "resolvedHandle", "=", "new", "ResolvedBinaryMethod", "(", "this", ".", "parent", ",", "this", ".", "name", ",", "this", ".", "parameterTypes", ",", "new", "String", "(", "binding", ".", "computeUniqueKey", "(", ")", ")", ")", ";", "resolvedHandle", ".", "occurrenceCount", "=", "this", ".", "occurrenceCount", ";", "return", "resolvedHandle", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "if", "(", "info", "==", "null", ")", "{", "toStringName", "(", "buffer", ")", ";", "buffer", ".", "append", "(", "\"", "(not", "open)\"", ")", ";", "}", "else", "if", "(", "info", "==", "NO_INFO", ")", "{", "toStringName", "(", "buffer", ")", ";", "}", "else", "{", "IBinaryMethod", "methodInfo", "=", "(", "IBinaryMethod", ")", "info", ";", "int", "flags", "=", "methodInfo", ".", "getModifiers", "(", ")", ";", "if", "(", "Flags", ".", "isStatic", "(", "flags", ")", ")", "{", "buffer", ".", "append", "(", "\"static", "\"", ")", ";", "}", "if", "(", "!", "methodInfo", ".", "isConstructor", "(", ")", ")", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "getReturnType", "(", "methodInfo", ")", ")", ")", ";", "buffer", ".", "append", "(", "'", "'", ")", ";", "}", "toStringName", "(", "buffer", ",", "flags", ")", ";", "}", "}", "protected", "void", "toStringName", "(", "StringBuffer", "buffer", ")", "{", "toStringName", "(", "buffer", ",", "0", ")", ";", "}", "protected", "void", "toStringName", "(", "StringBuffer", "buffer", ",", "int", "flags", ")", "{", "buffer", ".", "append", "(", "getElementName", "(", ")", ")", ";", "buffer", ".", "append", "(", "'('", ")", ";", "String", "[", "]", "parameters", "=", "getParameterTypes", "(", ")", ";", "int", "length", ";", "if", "(", "parameters", "!=", "null", "&&", "(", "length", "=", "parameters", ".", "length", ")", ">", "0", ")", "{", "boolean", "isVarargs", "=", "Flags", ".", "isVarargs", "(", "flags", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "try", "{", "if", "(", "i", "<", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "parameters", "[", "i", "]", ")", ")", ";", "buffer", ".", "append", "(", "\",", "\"", ")", ";", "}", "else", "if", "(", "isVarargs", ")", "{", "String", "parameter", "=", "parameters", "[", "i", "]", ".", "substring", "(", "1", ")", ";", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "parameter", ")", ")", ";", "buffer", ".", "append", "(", "\"", "...\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "parameters", "[", "i", "]", ")", ")", ";", "}", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "parameters", "[", "i", "]", ")", ";", "}", "}", "}", "buffer", ".", "append", "(", "')'", ")", ";", "if", "(", "this", ".", "occurrenceCount", ">", "1", ")", "{", "buffer", ".", "append", "(", "\"#\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "}", "}", "public", "String", "getAttachedJavadoc", "(", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "JavadocContents", "javadocContents", "=", "(", "(", "BinaryType", ")", "this", ".", "getDeclaringType", "(", ")", ")", ".", "getJavadocContents", "(", "monitor", ")", ";", "if", "(", "javadocContents", "==", "null", ")", "return", "null", ";", "return", "javadocContents", ".", "getMethodDoc", "(", "this", ")", ";", "}", "}", "</s>" ]
3,780
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "public", "interface", "INamingRequestor", "{", "void", "acceptNameWithPrefixAndSuffix", "(", "char", "[", "]", "name", ",", "boolean", "isFirstPrefix", ",", "boolean", "isFirstSuffix", ",", "int", "reusedCharacters", ")", ";", "void", "acceptNameWithPrefix", "(", "char", "[", "]", "name", ",", "boolean", "isFirstPrefix", ",", "int", "reusedCharacters", ")", ";", "void", "acceptNameWithSuffix", "(", "char", "[", "]", "name", ",", "boolean", "isFirstSuffix", ",", "int", "reusedCharacters", ")", ";", "void", "acceptNameWithoutPrefixAndSuffix", "(", "char", "[", "]", "name", ",", "int", "reusedCharacters", ")", ";", "}", "</s>" ]
3,781
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "*", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IContainer", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFolder", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceChangeEvent", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceDelta", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResourceDeltaVisitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspaceRoot", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspaceRunnable", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "WorkspaceJob", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "SourceElementParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "JavaModelManager", ".", "PerProjectInfo", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "builder", ".", "JavaBuilder", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "hierarchy", ".", "TypeHierarchy", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "AbstractSearchScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "JavaWorkspaceScope", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "search", ".", "indexing", ".", "IndexManager", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "DeltaProcessor", "{", "static", "class", "OutputsInfo", "{", "int", "outputCount", ";", "IPath", "[", "]", "paths", ";", "int", "[", "]", "traverseModes", ";", "OutputsInfo", "(", "IPath", "[", "]", "paths", ",", "int", "[", "]", "traverseModes", ",", "int", "outputCount", ")", "{", "this", ".", "paths", "=", "paths", ";", "this", ".", "traverseModes", "=", "traverseModes", ";", "this", ".", "outputCount", "=", "outputCount", ";", "}", "public", "String", "toString", "(", ")", "{", "if", "(", "this", ".", "paths", "==", "null", ")", "return", "\"<none>\"", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "outputCount", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "\"path=\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "paths", "[", "i", "]", ".", "toString", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"n->traverse=\"", ")", ";", "switch", "(", "this", ".", "traverseModes", "[", "i", "]", ")", "{", "case", "BINARY", ":", "buffer", ".", "append", "(", "\"BINARY\"", ")", ";", "break", ";", "case", "IGNORE", ":", "buffer", ".", "append", "(", "\"IGNORE\"", ")", ";", "break", ";", "case", "SOURCE", ":", "buffer", ".", "append", "(", "\"SOURCE\"", ")", ";", "break", ";", "default", ":", "buffer", ".", "append", "(", "\"<unknown>\"", ")", ";", "}", "if", "(", "i", "+", "1", "<", "this", ".", "outputCount", ")", "{", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "public", "static", "class", "RootInfo", "{", "char", "[", "]", "[", "]", "inclusionPatterns", ";", "char", "[", "]", "[", "]", "exclusionPatterns", ";", "public", "JavaProject", "project", ";", "IPath", "rootPath", ";", "int", "entryKind", ";", "IPackageFragmentRoot", "root", ";", "IPackageFragmentRoot", "cache", ";", "RootInfo", "(", "JavaProject", "project", ",", "IPath", "rootPath", ",", "char", "[", "]", "[", "]", "inclusionPatterns", ",", "char", "[", "]", "[", "]", "exclusionPatterns", ",", "int", "entryKind", ")", "{", "this", ".", "project", "=", "project", ";", "this", ".", "rootPath", "=", "rootPath", ";", "this", ".", "inclusionPatterns", "=", "inclusionPatterns", ";", "this", ".", "exclusionPatterns", "=", "exclusionPatterns", ";", "this", ".", "entryKind", "=", "entryKind", ";", "this", ".", "cache", "=", "getPackageFragmentRoot", "(", ")", ";", "}", "public", "IPackageFragmentRoot", "getPackageFragmentRoot", "(", ")", "{", "IPackageFragmentRoot", "tRoot", "=", "null", ";", "Object", "target", "=", "JavaModel", ".", "getTarget", "(", "this", ".", "rootPath", ",", "false", ")", ";", "if", "(", "target", "instanceof", "IResource", ")", "{", "tRoot", "=", "this", ".", "project", ".", "getPackageFragmentRoot", "(", "(", "IResource", ")", "target", ")", ";", "}", "else", "{", "tRoot", "=", "this", ".", "project", ".", "getPackageFragmentRoot", "(", "this", ".", "rootPath", ".", "toOSString", "(", ")", ")", ";", "}", "return", "tRoot", ";", "}", "public", "IPackageFragmentRoot", "getPackageFragmentRoot", "(", "IResource", "resource", ")", "{", "if", "(", "this", ".", "root", "==", "null", ")", "{", "if", "(", "resource", "!=", "null", ")", "{", "this", ".", "root", "=", "this", ".", "project", ".", "getPackageFragmentRoot", "(", "resource", ")", ";", "}", "else", "{", "this", ".", "root", "=", "getPackageFragmentRoot", "(", ")", ";", "}", "}", "if", "(", "this", ".", "root", "!=", "null", ")", "this", ".", "cache", "=", "this", ".", "root", ";", "return", "this", ".", "root", ";", "}", "boolean", "isRootOfProject", "(", "IPath", "path", ")", "{", "return", "this", ".", "rootPath", ".", "equals", "(", "path", ")", "&&", "this", ".", "project", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ".", "isPrefixOf", "(", "path", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"project=\"", ")", ";", "if", "(", "this", ".", "project", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"null\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "project", ".", "getElementName", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "\"npath=\"", ")", ";", "if", "(", "this", ".", "rootPath", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"null\"", ")", ";", "}", "else", "{", "buffer", ".", "append", "(", "this", ".", "rootPath", ".", "toString", "(", ")", ")", ";", "}", "buffer", ".", "append", "(", "\"nincluding=\"", ")", ";", "if", "(", "this", ".", "inclusionPatterns", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"null\"", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "inclusionPatterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "new", "String", "(", "this", ".", "inclusionPatterns", "[", "i", "]", ")", ")", ";", "if", "(", "i", "<", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "\"|\"", ")", ";", "}", "}", "}", "buffer", ".", "append", "(", "\"nexcluding=\"", ")", ";", "if", "(", "this", ".", "exclusionPatterns", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"null\"", ")", ";", "}", "else", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "exclusionPatterns", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "new", "String", "(", "this", ".", "exclusionPatterns", "[", "i", "]", ")", ")", ";", "if", "(", "i", "<", "length", "-", "1", ")", "{", "buffer", ".", "append", "(", "\"|\"", ")", ";", "}", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "private", "final", "static", "int", "IGNORE", "=", "0", ";", "private", "final", "static", "int", "SOURCE", "=", "1", ";", "private", "final", "static", "int", "BINARY", "=", "2", ";", "private", "final", "static", "String", "EXTERNAL_JAR_ADDED", "=", "\"\"", ";", "private", "final", "static", "String", "EXTERNAL_JAR_CHANGED", "=", "\"\"", ";", "private", "final", "static", "String", "EXTERNAL_JAR_REMOVED", "=", "\"\"", ";", "private", "final", "static", "String", "EXTERNAL_JAR_UNCHANGED", "=", "\"\"", ";", "private", "final", "static", "String", "INTERNAL_JAR_IGNORE", "=", "\"\"", ";", "private", "final", "static", "int", "NON_JAVA_RESOURCE", "=", "-", "1", ";", "public", "static", "boolean", "DEBUG", "=", "false", ";", "public", "static", "boolean", "VERBOSE", "=", "false", ";", "public", "static", "boolean", "PERF", "=", "false", ";", "public", "static", "final", "int", "DEFAULT_CHANGE_EVENT", "=", "0", ";", "public", "static", "long", "getTimeStamp", "(", "File", "file", ")", "{", "return", "file", ".", "lastModified", "(", ")", "+", "file", ".", "length", "(", ")", ";", "}", "private", "DeltaProcessingState", "state", ";", "JavaModelManager", "manager", ";", "private", "JavaElementDelta", "currentDelta", ";", "private", "Openable", "currentElement", ";", "public", "ArrayList", "javaModelDeltas", "=", "new", "ArrayList", "(", ")", ";", "public", "HashMap", "reconcileDeltas", "=", "new", "HashMap", "(", ")", ";", "private", "boolean", "isFiring", "=", "true", ";", "private", "final", "ModelUpdater", "modelUpdater", "=", "new", "ModelUpdater", "(", ")", ";", "public", "HashSet", "projectCachesToReset", "=", "new", "HashSet", "(", ")", ";", "public", "Map", "oldRoots", ";", "public", "int", "overridenEventType", "=", "-", "1", ";", "private", "SourceElementParser", "sourceElementParserCache", ";", "public", "DeltaProcessor", "(", "DeltaProcessingState", "state", ",", "JavaModelManager", "manager", ")", "{", "this", ".", "state", "=", "state", ";", "this", ".", "manager", "=", "manager", ";", "}", "private", "void", "addDependentProjects", "(", "IJavaProject", "project", ",", "HashMap", "projectDependencies", ",", "HashSet", "result", ")", "{", "IJavaProject", "[", "]", "dependents", "=", "(", "IJavaProject", "[", "]", ")", "projectDependencies", ".", "get", "(", "project", ")", ";", "if", "(", "dependents", "==", "null", ")", "return", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "dependents", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaProject", "dependent", "=", "dependents", "[", "i", "]", ";", "if", "(", "result", ".", "contains", "(", "dependent", ")", ")", "continue", ";", "result", ".", "add", "(", "dependent", ")", ";", "addDependentProjects", "(", "dependent", ",", "projectDependencies", ",", "result", ")", ";", "}", "}", "private", "void", "addToParentInfo", "(", "Openable", "child", ")", "{", "Openable", "parent", "=", "(", "Openable", ")", "child", ".", "getParent", "(", ")", ";", "if", "(", "parent", "!=", "null", "&&", "parent", ".", "isOpen", "(", ")", ")", "{", "try", "{", "OpenableElementInfo", "info", "=", "(", "OpenableElementInfo", ")", "parent", ".", "getElementInfo", "(", ")", ";", "if", "(", "child", "instanceof", "IPackageFragmentRoot", ")", "addPackageFragmentRoot", "(", "info", ",", "(", "IPackageFragmentRoot", ")", "child", ")", ";", "else", "info", ".", "addChild", "(", "child", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "private", "void", "addPackageFragmentRoot", "(", "OpenableElementInfo", "parent", ",", "IPackageFragmentRoot", "child", ")", "throws", "JavaModelException", "{", "IJavaElement", "[", "]", "roots", "=", "parent", ".", "getChildren", "(", ")", ";", "if", "(", "roots", ".", "length", ">", "0", ")", "{", "IClasspathEntry", "[", "]", "resolvedClasspath", "=", "(", "(", "JavaProject", ")", "child", ".", "getJavaProject", "(", ")", ")", ".", "getResolvedClasspath", "(", ")", ";", "IPath", "currentEntryPath", "=", "child", ".", "getResolvedClasspathEntry", "(", ")", ".", "getPath", "(", ")", ";", "int", "indexToInsert", "=", "-", "1", ";", "int", "lastComparedIndex", "=", "-", "1", ";", "int", "i", "=", "0", ",", "j", "=", "0", ";", "for", "(", ";", "i", "<", "roots", ".", "length", "&&", "j", "<", "resolvedClasspath", ".", "length", ";", ")", "{", "IClasspathEntry", "classpathEntry", "=", "resolvedClasspath", "[", "j", "]", ";", "if", "(", "lastComparedIndex", "!=", "j", "&&", "currentEntryPath", ".", "equals", "(", "classpathEntry", ".", "getPath", "(", ")", ")", ")", "{", "indexToInsert", "=", "i", ";", "break", ";", "}", "lastComparedIndex", "=", "j", ";", "IClasspathEntry", "rootEntry", "=", "(", "(", "IPackageFragmentRoot", ")", "roots", "[", "i", "]", ")", ".", "getResolvedClasspathEntry", "(", ")", ";", "if", "(", "rootEntry", ".", "getPath", "(", ")", ".", "equals", "(", "classpathEntry", ".", "getPath", "(", ")", ")", ")", "i", "++", ";", "else", "j", "++", ";", "}", "for", "(", ";", "i", "<", "roots", ".", "length", ";", "i", "++", ")", "{", "if", "(", "roots", "[", "i", "]", ".", "equals", "(", "child", ")", ")", "{", "return", ";", "}", "if", "(", "!", "(", "(", "IPackageFragmentRoot", ")", "roots", "[", "i", "]", ")", ".", "getResolvedClasspathEntry", "(", ")", ".", "getPath", "(", ")", ".", "equals", "(", "currentEntryPath", ")", ")", "break", ";", "}", "if", "(", "indexToInsert", ">=", "0", ")", "{", "int", "newSize", "=", "roots", ".", "length", "+", "1", ";", "IPackageFragmentRoot", "[", "]", "newChildren", "=", "new", "IPackageFragmentRoot", "[", "newSize", "]", ";", "if", "(", "indexToInsert", ">", "0", ")", "System", ".", "arraycopy", "(", "roots", ",", "0", ",", "newChildren", ",", "0", ",", "indexToInsert", ")", ";", "newChildren", "[", "indexToInsert", "]", "=", "child", ";", "System", ".", "arraycopy", "(", "roots", ",", "indexToInsert", ",", "newChildren", ",", "indexToInsert", "+", "1", ",", "(", "newSize", "-", "indexToInsert", "-", "1", ")", ")", ";", "parent", ".", "setChildren", "(", "newChildren", ")", ";", "return", ";", "}", "}", "parent", ".", "addChild", "(", "child", ")", ";", "}", "private", "void", "checkProjectsAndClasspathChanges", "(", "IResourceDelta", "delta", ")", "{", "IResource", "resource", "=", "delta", ".", "getResource", "(", ")", ";", "IResourceDelta", "[", "]", "children", "=", "null", ";", "switch", "(", "resource", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "ROOT", ":", "this", ".", "state", ".", "getOldJavaProjecNames", "(", ")", ";", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "break", ";", "case", "IResource", ".", "PROJECT", ":", "IProject", "project", "=", "(", "IProject", ")", "resource", ";", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "project", ")", ";", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "ADDED", ":", "this", ".", "manager", ".", "forceBatchInitializations", "(", "false", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "javaProject", ")", ";", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "addToParentInfo", "(", "javaProject", ")", ";", "readRawClasspath", "(", "javaProject", ")", ";", "checkProjectReferenceChange", "(", "project", ",", "javaProject", ")", ";", "checkExternalFolderChange", "(", "project", ",", "javaProject", ")", ";", "}", "this", ".", "state", ".", "rootsAreStale", "=", "true", ";", "break", ";", "case", "IResourceDelta", ".", "CHANGED", ":", "if", "(", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "OPEN", ")", "!=", "0", ")", "{", "this", ".", "manager", ".", "forceBatchInitializations", "(", "false", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "javaProject", ")", ";", "if", "(", "project", ".", "isOpen", "(", ")", ")", "{", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "addToParentInfo", "(", "javaProject", ")", ";", "readRawClasspath", "(", "javaProject", ")", ";", "checkProjectReferenceChange", "(", "project", ",", "javaProject", ")", ";", "checkExternalFolderChange", "(", "project", ",", "javaProject", ")", ";", "}", "}", "else", "{", "try", "{", "javaProject", ".", "close", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "removeFromParentInfo", "(", "javaProject", ")", ";", "this", ".", "manager", ".", "removePerProjectInfo", "(", "javaProject", ",", "false", ")", ";", "this", ".", "manager", ".", "containerRemove", "(", "javaProject", ")", ";", "}", "this", ".", "state", ".", "rootsAreStale", "=", "true", ";", "}", "else", "if", "(", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "DESCRIPTION", ")", "!=", "0", ")", "{", "boolean", "wasJavaProject", "=", "this", ".", "state", ".", "findJavaProject", "(", "project", ".", "getName", "(", ")", ")", "!=", "null", ";", "boolean", "isJavaProject", "=", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ";", "if", "(", "wasJavaProject", "!=", "isJavaProject", ")", "{", "this", ".", "manager", ".", "forceBatchInitializations", "(", "false", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "javaProject", ")", ";", "if", "(", "isJavaProject", ")", "{", "addToParentInfo", "(", "javaProject", ")", ";", "readRawClasspath", "(", "javaProject", ")", ";", "checkProjectReferenceChange", "(", "project", ",", "javaProject", ")", ";", "checkExternalFolderChange", "(", "project", ",", "javaProject", ")", ";", "}", "else", "{", "this", ".", "manager", ".", "removePerProjectInfo", "(", "javaProject", ",", "true", ")", ";", "this", ".", "manager", ".", "containerRemove", "(", "javaProject", ")", ";", "try", "{", "javaProject", ".", "close", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "removeFromParentInfo", "(", "javaProject", ")", ";", "}", "this", ".", "state", ".", "rootsAreStale", "=", "true", ";", "}", "else", "{", "if", "(", "isJavaProject", ")", "{", "addToParentInfo", "(", "javaProject", ")", ";", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "}", "}", "}", "else", "{", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "addToParentInfo", "(", "javaProject", ")", ";", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "}", "}", "break", ";", "case", "IResourceDelta", ".", "REMOVED", ":", "this", ".", "manager", ".", "forceBatchInitializations", "(", "false", ")", ";", "this", ".", "manager", ".", "removePerProjectInfo", "(", "javaProject", ",", "true", ")", ";", "this", ".", "manager", ".", "containerRemove", "(", "javaProject", ")", ";", "this", ".", "state", ".", "rootsAreStale", "=", "true", ";", "break", ";", "}", "break", ";", "case", "IResource", ".", "FOLDER", ":", "if", "(", "delta", ".", "getKind", "(", ")", "==", "IResourceDelta", ".", "CHANGED", ")", "{", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "}", "break", ";", "case", "IResource", ".", "FILE", ":", "IFile", "file", "=", "(", "IFile", ")", "resource", ";", "int", "kind", "=", "delta", ".", "getKind", "(", ")", ";", "RootInfo", "rootInfo", ";", "if", "(", "file", ".", "getName", "(", ")", ".", "equals", "(", "JavaProject", ".", "CLASSPATH_FILENAME", ")", ")", "{", "this", ".", "manager", ".", "forceBatchInitializations", "(", "false", ")", ";", "switch", "(", "kind", ")", "{", "case", "IResourceDelta", ".", "CHANGED", ":", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "(", "flags", "&", "IResourceDelta", ".", "CONTENT", ")", "==", "0", "&&", "(", "flags", "&", "IResourceDelta", ".", "ENCODING", ")", "==", "0", "&&", "(", "flags", "&", "IResourceDelta", ".", "MOVED_FROM", ")", "==", "0", ")", "{", "break", ";", "}", "case", "IResourceDelta", ".", "ADDED", ":", "case", "IResourceDelta", ".", "REMOVED", ":", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "file", ".", "getProject", "(", ")", ")", ";", "readRawClasspath", "(", "javaProject", ")", ";", "break", ";", "}", "this", ".", "state", ".", "rootsAreStale", "=", "true", ";", "}", "else", "if", "(", "(", "rootInfo", "=", "rootInfo", "(", "file", ".", "getFullPath", "(", ")", ",", "kind", ")", ")", "!=", "null", "&&", "rootInfo", ".", "entryKind", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "file", ".", "getProject", "(", ")", ")", ";", "javaProject", ".", "resetResolvedClasspath", "(", ")", ";", "this", ".", "state", ".", "rootsAreStale", "=", "true", ";", "}", "break", ";", "}", "if", "(", "children", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "checkProjectsAndClasspathChanges", "(", "children", "[", "i", "]", ")", ";", "}", "}", "}", "private", "void", "checkExternalFolderChange", "(", "IProject", "project", ",", "JavaProject", "javaProject", ")", "{", "ClasspathChange", "change", "=", "this", ".", "state", ".", "getClasspathChange", "(", "project", ")", ";", "this", ".", "state", ".", "addExternalFolderChange", "(", "javaProject", ",", "change", "==", "null", "?", "null", ":", "change", ".", "oldResolvedClasspath", ")", ";", "}", "private", "void", "checkProjectReferenceChange", "(", "IProject", "project", ",", "JavaProject", "javaProject", ")", "{", "ClasspathChange", "change", "=", "this", ".", "state", ".", "getClasspathChange", "(", "project", ")", ";", "this", ".", "state", ".", "addProjectReferenceChange", "(", "javaProject", ",", "change", "==", "null", "?", "null", ":", "change", ".", "oldResolvedClasspath", ")", ";", "}", "private", "void", "readRawClasspath", "(", "JavaProject", "javaProject", ")", "{", "try", "{", "PerProjectInfo", "perProjectInfo", "=", "javaProject", ".", "getPerProjectInfo", "(", ")", ";", "if", "(", "!", "perProjectInfo", ".", "writtingRawClasspath", ")", "perProjectInfo", ".", "readAndCacheClasspath", "(", "javaProject", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "VERBOSE", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "private", "void", "checkSourceAttachmentChange", "(", "IResourceDelta", "delta", ",", "IResource", "res", ")", "{", "IPath", "rootPath", "=", "(", "IPath", ")", "this", ".", "state", ".", "sourceAttachments", ".", "get", "(", "externalPath", "(", "res", ")", ")", ";", "if", "(", "rootPath", "!=", "null", ")", "{", "RootInfo", "rootInfo", "=", "rootInfo", "(", "rootPath", ",", "delta", ".", "getKind", "(", ")", ")", ";", "if", "(", "rootInfo", "!=", "null", ")", "{", "IJavaProject", "projectOfRoot", "=", "rootInfo", ".", "project", ";", "IPackageFragmentRoot", "root", "=", "null", ";", "try", "{", "root", "=", "projectOfRoot", ".", "findPackageFragmentRoot", "(", "rootPath", ")", ";", "if", "(", "root", "!=", "null", ")", "{", "root", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "if", "(", "root", "==", "null", ")", "return", ";", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "ADDED", ":", "currentDelta", "(", ")", ".", "sourceAttached", "(", "root", ")", ";", "break", ";", "case", "IResourceDelta", ".", "CHANGED", ":", "currentDelta", "(", ")", ".", "sourceDetached", "(", "root", ")", ";", "currentDelta", "(", ")", ".", "sourceAttached", "(", "root", ")", ";", "break", ";", "case", "IResourceDelta", ".", "REMOVED", ":", "currentDelta", "(", ")", ".", "sourceDetached", "(", "root", ")", ";", "break", ";", "}", "}", "}", "}", "private", "void", "close", "(", "Openable", "element", ")", "{", "try", "{", "element", ".", "close", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "private", "void", "contentChanged", "(", "Openable", "element", ")", "{", "boolean", "isPrimary", "=", "false", ";", "boolean", "isPrimaryWorkingCopy", "=", "false", ";", "if", "(", "element", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "COMPILATION_UNIT", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "element", ";", "isPrimary", "=", "cu", ".", "isPrimary", "(", ")", ";", "isPrimaryWorkingCopy", "=", "isPrimary", "&&", "cu", ".", "isWorkingCopy", "(", ")", ";", "}", "if", "(", "isPrimaryWorkingCopy", ")", "{", "currentDelta", "(", ")", ".", "changed", "(", "element", ",", "IJavaElementDelta", ".", "F_PRIMARY_RESOURCE", ")", ";", "}", "else", "{", "close", "(", "element", ")", ";", "int", "flags", "=", "IJavaElementDelta", ".", "F_CONTENT", ";", "if", "(", "element", "instanceof", "JarPackageFragmentRoot", ")", "{", "flags", "|=", "IJavaElementDelta", ".", "F_ARCHIVE_CONTENT_CHANGED", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "element", ".", "getJavaProject", "(", ")", ")", ";", "}", "if", "(", "isPrimary", ")", "{", "flags", "|=", "IJavaElementDelta", ".", "F_PRIMARY_RESOURCE", ";", "}", "currentDelta", "(", ")", ".", "changed", "(", "element", ",", "flags", ")", ";", "}", "}", "private", "Openable", "createElement", "(", "IResource", "resource", ",", "int", "elementType", ",", "RootInfo", "rootInfo", ")", "{", "if", "(", "resource", "==", "null", ")", "return", "null", ";", "IPath", "path", "=", "resource", ".", "getFullPath", "(", ")", ";", "IJavaElement", "element", "=", "null", ";", "switch", "(", "elementType", ")", "{", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "if", "(", "resource", "instanceof", "IProject", ")", "{", "popUntilPrefixOf", "(", "path", ")", ";", "if", "(", "this", ".", "currentElement", "!=", "null", "&&", "this", ".", "currentElement", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "JAVA_PROJECT", "&&", "(", "(", "IJavaProject", ")", "this", ".", "currentElement", ")", ".", "getProject", "(", ")", ".", "equals", "(", "resource", ")", ")", "{", "return", "this", ".", "currentElement", ";", "}", "if", "(", "rootInfo", "!=", "null", "&&", "rootInfo", ".", "project", ".", "getProject", "(", ")", ".", "equals", "(", "resource", ")", ")", "{", "element", "=", "rootInfo", ".", "project", ";", "break", ";", "}", "IProject", "proj", "=", "(", "IProject", ")", "resource", ";", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "proj", ")", ")", "{", "element", "=", "JavaCore", ".", "create", "(", "proj", ")", ";", "}", "else", "{", "element", "=", "this", ".", "state", ".", "findJavaProject", "(", "proj", ".", "getName", "(", ")", ")", ";", "}", "}", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "element", "=", "rootInfo", "==", "null", "?", "JavaCore", ".", "create", "(", "resource", ")", ":", "rootInfo", ".", "getPackageFragmentRoot", "(", "resource", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "if", "(", "rootInfo", "!=", "null", ")", "{", "if", "(", "rootInfo", ".", "project", ".", "contains", "(", "resource", ")", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "rootInfo", ".", "getPackageFragmentRoot", "(", "null", ")", ";", "IPath", "pkgPath", "=", "path", ".", "removeFirstSegments", "(", "root", ".", "resource", "(", ")", ".", "getFullPath", "(", ")", ".", "segmentCount", "(", ")", ")", ";", "String", "[", "]", "pkgName", "=", "pkgPath", ".", "segments", "(", ")", ";", "element", "=", "root", ".", "getPackageFragment", "(", "pkgName", ")", ";", "}", "}", "else", "{", "popUntilPrefixOf", "(", "path", ")", ";", "if", "(", "this", ".", "currentElement", "==", "null", ")", "{", "element", "=", "JavaCore", ".", "create", "(", "resource", ")", ";", "}", "else", "{", "PackageFragmentRoot", "root", "=", "this", ".", "currentElement", ".", "getPackageFragmentRoot", "(", ")", ";", "if", "(", "root", "==", "null", ")", "{", "element", "=", "JavaCore", ".", "create", "(", "resource", ")", ";", "}", "else", "if", "(", "(", "(", "JavaProject", ")", "root", ".", "getJavaProject", "(", ")", ")", ".", "contains", "(", "resource", ")", ")", "{", "IPath", "pkgPath", "=", "path", ".", "removeFirstSegments", "(", "root", ".", "getPath", "(", ")", ".", "segmentCount", "(", ")", ")", ";", "String", "[", "]", "pkgName", "=", "pkgPath", ".", "segments", "(", ")", ";", "element", "=", "root", ".", "getPackageFragment", "(", "pkgName", ")", ";", "}", "}", "}", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "case", "IJavaElement", ".", "CLASS_FILE", ":", "popUntilPrefixOf", "(", "path", ")", ";", "if", "(", "this", ".", "currentElement", "==", "null", ")", "{", "element", "=", "rootInfo", "==", "null", "?", "JavaCore", ".", "create", "(", "resource", ")", ":", "JavaModelManager", ".", "create", "(", "resource", ",", "rootInfo", ".", "project", ")", ";", "}", "else", "{", "IPackageFragment", "pkgFragment", "=", "null", ";", "switch", "(", "this", ".", "currentElement", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "this", ".", "currentElement", ";", "IPath", "rootPath", "=", "root", ".", "getPath", "(", ")", ";", "IPath", "pkgPath", "=", "path", ".", "removeLastSegments", "(", "1", ")", ";", "String", "[", "]", "pkgName", "=", "pkgPath", ".", "removeFirstSegments", "(", "rootPath", ".", "segmentCount", "(", ")", ")", ".", "segments", "(", ")", ";", "pkgFragment", "=", "root", ".", "getPackageFragment", "(", "pkgName", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "Openable", "pkg", "=", "this", ".", "currentElement", ";", "if", "(", "pkg", ".", "getPath", "(", ")", ".", "equals", "(", "path", ".", "removeLastSegments", "(", "1", ")", ")", ")", "{", "pkgFragment", "=", "(", "IPackageFragment", ")", "pkg", ";", "}", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "case", "IJavaElement", ".", "CLASS_FILE", ":", "pkgFragment", "=", "(", "IPackageFragment", ")", "this", ".", "currentElement", ".", "getParent", "(", ")", ";", "break", ";", "}", "if", "(", "pkgFragment", "==", "null", ")", "{", "element", "=", "rootInfo", "==", "null", "?", "JavaCore", ".", "create", "(", "resource", ")", ":", "JavaModelManager", ".", "create", "(", "resource", ",", "rootInfo", ".", "project", ")", ";", "}", "else", "{", "if", "(", "elementType", "==", "IJavaElement", ".", "COMPILATION_UNIT", ")", "{", "String", "fileName", "=", "path", ".", "lastSegment", "(", ")", ";", "element", "=", "pkgFragment", ".", "getCompilationUnit", "(", "fileName", ")", ";", "}", "else", "{", "String", "fileName", "=", "path", ".", "lastSegment", "(", ")", ";", "element", "=", "pkgFragment", ".", "getClassFile", "(", "fileName", ")", ";", "}", "}", "}", "break", ";", "}", "if", "(", "element", "==", "null", ")", "return", "null", ";", "this", ".", "currentElement", "=", "(", "Openable", ")", "element", ";", "return", "this", ".", "currentElement", ";", "}", "public", "void", "checkExternalArchiveChanges", "(", "IJavaElement", "[", "]", "elementsScope", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "checkExternalArchiveChanges", "(", "elementsScope", ",", "false", ",", "monitor", ")", ";", "}", "private", "void", "checkExternalArchiveChanges", "(", "IJavaElement", "[", "]", "elementsScope", ",", "boolean", "asynchronous", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "throw", "new", "OperationCanceledException", "(", ")", ";", "try", "{", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "beginTask", "(", "\"\"", ",", "1", ")", ";", "boolean", "hasExternalWorkingCopyProject", "=", "false", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "elementsScope", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElement", "element", "=", "elementsScope", "[", "i", "]", ";", "this", ".", "state", ".", "addForRefresh", "(", "elementsScope", "[", "i", "]", ")", ";", "if", "(", "element", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "JAVA_MODEL", ")", "{", "HashSet", "projects", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getExternalWorkingCopyProjects", "(", ")", ";", "if", "(", "projects", "!=", "null", ")", "{", "hasExternalWorkingCopyProject", "=", "true", ";", "Iterator", "iterator", "=", "projects", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "JavaProject", "project", "=", "(", "JavaProject", ")", "iterator", ".", "next", "(", ")", ";", "project", ".", "resetCaches", "(", ")", ";", "}", "}", "}", "}", "HashSet", "elementsToRefresh", "=", "this", ".", "state", ".", "removeExternalElementsToRefresh", "(", ")", ";", "boolean", "hasDelta", "=", "elementsToRefresh", "!=", "null", "&&", "createExternalArchiveDelta", "(", "elementsToRefresh", ",", "monitor", ")", ";", "if", "(", "hasDelta", ")", "{", "IJavaElementDelta", "[", "]", "projectDeltas", "=", "this", ".", "currentDelta", ".", "getAffectedChildren", "(", ")", ";", "final", "int", "length", "=", "projectDeltas", ".", "length", ";", "final", "IProject", "[", "]", "projectsToTouch", "=", "new", "IProject", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElementDelta", "delta", "=", "projectDeltas", "[", "i", "]", ";", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "delta", ".", "getElement", "(", ")", ";", "projectsToTouch", "[", "i", "]", "=", "javaProject", ".", "getProject", "(", ")", ";", "}", "if", "(", "projectsToTouch", ".", "length", ">", "0", ")", "{", "if", "(", "asynchronous", ")", "{", "WorkspaceJob", "touchJob", "=", "new", "WorkspaceJob", "(", "Messages", ".", "updating_external_archives_jobName", ")", "{", "public", "IStatus", "runInWorkspace", "(", "IProgressMonitor", "progressMonitor", ")", "throws", "CoreException", "{", "try", "{", "if", "(", "progressMonitor", "!=", "null", ")", "progressMonitor", ".", "beginTask", "(", "\"\"", ",", "projectsToTouch", ".", "length", ")", ";", "touchProjects", "(", "projectsToTouch", ",", "progressMonitor", ")", ";", "}", "finally", "{", "if", "(", "progressMonitor", "!=", "null", ")", "progressMonitor", ".", "done", "(", ")", ";", "}", "return", "Status", ".", "OK_STATUS", ";", "}", "public", "boolean", "belongsTo", "(", "Object", "family", ")", "{", "return", "ResourcesPlugin", ".", "FAMILY_MANUAL_REFRESH", "==", "family", ";", "}", "}", ";", "touchJob", ".", "schedule", "(", ")", ";", "}", "else", "{", "IWorkspaceRunnable", "runnable", "=", "new", "IWorkspaceRunnable", "(", ")", "{", "public", "void", "run", "(", "IProgressMonitor", "progressMonitor", ")", "throws", "CoreException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projectsToTouch", ".", "length", ";", "i", "++", ")", "{", "IProject", "project", "=", "projectsToTouch", "[", "i", "]", ";", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "project", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "project", ".", "touch", "(", "progressMonitor", ")", ";", "}", "}", "}", ";", "try", "{", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "run", "(", "runnable", ",", "monitor", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "}", "if", "(", "this", ".", "currentDelta", "!=", "null", ")", "{", "fire", "(", "this", ".", "currentDelta", ",", "DEFAULT_CHANGE_EVENT", ")", ";", "}", "}", "else", "if", "(", "hasExternalWorkingCopyProject", ")", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "resetJarTypeCache", "(", ")", ";", "}", "}", "finally", "{", "this", ".", "currentDelta", "=", "null", ";", "if", "(", "monitor", "!=", "null", ")", "monitor", ".", "done", "(", ")", ";", "}", "}", "protected", "void", "touchProjects", "(", "final", "IProject", "[", "]", "projectsToTouch", ",", "IProgressMonitor", "progressMonitor", ")", "throws", "CoreException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projectsToTouch", ".", "length", ";", "i", "++", ")", "{", "IProgressMonitor", "monitor", "=", "progressMonitor", "==", "null", "?", "null", ":", "new", "SubProgressMonitor", "(", "progressMonitor", ",", "1", ")", ";", "IProject", "project", "=", "projectsToTouch", "[", "i", "]", ";", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "project", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "project", ".", "touch", "(", "monitor", ")", ";", "}", "}", "private", "boolean", "createExternalArchiveDelta", "(", "HashSet", "refreshedElements", ",", "IProgressMonitor", "monitor", ")", "{", "HashMap", "externalArchivesStatus", "=", "new", "HashMap", "(", ")", ";", "boolean", "hasDelta", "=", "false", ";", "HashSet", "archivePathsToRefresh", "=", "new", "HashSet", "(", ")", ";", "Iterator", "iterator", "=", "refreshedElements", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "IJavaElement", "element", "=", "(", "IJavaElement", ")", "iterator", ".", "next", "(", ")", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "archivePathsToRefresh", ".", "add", "(", "element", ".", "getPath", "(", ")", ")", ";", "break", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "element", ";", "if", "(", "!", "JavaProject", ".", "hasJavaNature", "(", "javaProject", ".", "getProject", "(", ")", ")", ")", "{", "break", ";", "}", "IClasspathEntry", "[", "]", "classpath", ";", "try", "{", "classpath", "=", "javaProject", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "cpLength", "=", "classpath", ".", "length", ";", "j", "<", "cpLength", ";", "j", "++", ")", "{", "if", "(", "classpath", "[", "j", "]", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "archivePathsToRefresh", ".", "add", "(", "classpath", "[", "j", "]", ".", "getPath", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "break", ";", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "Iterator", "projectNames", "=", "this", ".", "state", ".", "getOldJavaProjecNames", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "projectNames", ".", "hasNext", "(", ")", ")", "{", "String", "projectName", "=", "(", "String", ")", "projectNames", ".", "next", "(", ")", ";", "IProject", "project", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProject", "(", "projectName", ")", ";", "if", "(", "!", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "continue", ";", "}", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "project", ")", ";", "try", "{", "classpath", "=", "javaProject", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "k", "=", "0", ",", "cpLength", "=", "classpath", ".", "length", ";", "k", "<", "cpLength", ";", "k", "++", ")", "{", "if", "(", "classpath", "[", "k", "]", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "archivePathsToRefresh", ".", "add", "(", "classpath", "[", "k", "]", ".", "getPath", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e2", ")", "{", "continue", ";", "}", "}", "break", ";", "}", "}", "Iterator", "projectNames", "=", "this", ".", "state", ".", "getOldJavaProjecNames", "(", ")", ".", "iterator", "(", ")", ";", "IWorkspaceRoot", "wksRoot", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "while", "(", "projectNames", ".", "hasNext", "(", ")", ")", "{", "if", "(", "monitor", "!=", "null", "&&", "monitor", ".", "isCanceled", "(", ")", ")", "break", ";", "String", "projectName", "=", "(", "String", ")", "projectNames", ".", "next", "(", ")", ";", "IProject", "project", "=", "wksRoot", ".", "getProject", "(", "projectName", ")", ";", "if", "(", "!", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "continue", ";", "}", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "project", ")", ";", "IClasspathEntry", "[", "]", "entries", ";", "try", "{", "entries", "=", "javaProject", ".", "getResolvedClasspath", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e1", ")", "{", "continue", ";", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "entries", ".", "length", ";", "j", "++", ")", "{", "if", "(", "entries", "[", "j", "]", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", "{", "IPath", "entryPath", "=", "entries", "[", "j", "]", ".", "getPath", "(", ")", ";", "if", "(", "!", "archivePathsToRefresh", ".", "contains", "(", "entryPath", ")", ")", "continue", ";", "String", "status", "=", "(", "String", ")", "externalArchivesStatus", ".", "get", "(", "entryPath", ")", ";", "if", "(", "status", "==", "null", ")", "{", "Object", "targetLibrary", "=", "JavaModel", ".", "getTarget", "(", "entryPath", ",", "true", ")", ";", "if", "(", "targetLibrary", "==", "null", ")", "{", "if", "(", "this", ".", "state", ".", "getExternalLibTimeStamps", "(", ")", ".", "remove", "(", "entryPath", ")", "!=", "null", "&&", "this", ".", "state", ".", "roots", ".", "get", "(", "entryPath", ")", "!=", "null", ")", "{", "externalArchivesStatus", ".", "put", "(", "entryPath", ",", "EXTERNAL_JAR_REMOVED", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "removeIndex", "(", "entryPath", ")", ";", "}", "}", "else", "if", "(", "targetLibrary", "instanceof", "File", ")", "{", "File", "externalFile", "=", "(", "File", ")", "targetLibrary", ";", "Long", "oldTimestamp", "=", "(", "Long", ")", "this", ".", "state", ".", "getExternalLibTimeStamps", "(", ")", ".", "get", "(", "entryPath", ")", ";", "long", "newTimeStamp", "=", "getTimeStamp", "(", "externalFile", ")", ";", "if", "(", "oldTimestamp", "!=", "null", ")", "{", "if", "(", "newTimeStamp", "==", "0", ")", "{", "externalArchivesStatus", ".", "put", "(", "entryPath", ",", "EXTERNAL_JAR_REMOVED", ")", ";", "this", ".", "state", ".", "getExternalLibTimeStamps", "(", ")", ".", "remove", "(", "entryPath", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "removeIndex", "(", "entryPath", ")", ";", "}", "else", "if", "(", "oldTimestamp", ".", "longValue", "(", ")", "!=", "newTimeStamp", ")", "{", "externalArchivesStatus", ".", "put", "(", "entryPath", ",", "EXTERNAL_JAR_CHANGED", ")", ";", "this", ".", "state", ".", "getExternalLibTimeStamps", "(", ")", ".", "put", "(", "entryPath", ",", "new", "Long", "(", "newTimeStamp", ")", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "removeIndex", "(", "entryPath", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "indexLibrary", "(", "entryPath", ",", "project", ".", "getProject", "(", ")", ")", ";", "}", "else", "{", "externalArchivesStatus", ".", "put", "(", "entryPath", ",", "EXTERNAL_JAR_UNCHANGED", ")", ";", "}", "}", "else", "{", "if", "(", "newTimeStamp", "==", "0", ")", "{", "externalArchivesStatus", ".", "put", "(", "entryPath", ",", "EXTERNAL_JAR_UNCHANGED", ")", ";", "}", "else", "{", "externalArchivesStatus", ".", "put", "(", "entryPath", ",", "EXTERNAL_JAR_ADDED", ")", ";", "this", ".", "state", ".", "getExternalLibTimeStamps", "(", ")", ".", "put", "(", "entryPath", ",", "new", "Long", "(", "newTimeStamp", ")", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "removeIndex", "(", "entryPath", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "indexLibrary", "(", "entryPath", ",", "project", ".", "getProject", "(", ")", ")", ";", "}", "}", "}", "else", "{", "externalArchivesStatus", ".", "put", "(", "entryPath", ",", "INTERNAL_JAR_IGNORE", ")", ";", "}", "}", "status", "=", "(", "String", ")", "externalArchivesStatus", ".", "get", "(", "entryPath", ")", ";", "if", "(", "status", "!=", "null", ")", "{", "if", "(", "status", "==", "EXTERNAL_JAR_ADDED", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "javaProject", ".", "getPackageFragmentRoot", "(", "entryPath", ".", "toString", "(", ")", ")", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "root", ".", "getElementName", "(", ")", ")", ";", "}", "elementAdded", "(", "root", ",", "null", ",", "null", ")", ";", "javaProject", ".", "resetResolvedClasspath", "(", ")", ";", "this", ".", "state", ".", "addClasspathValidation", "(", "javaProject", ")", ";", "hasDelta", "=", "true", ";", "}", "else", "if", "(", "status", "==", "EXTERNAL_JAR_CHANGED", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "javaProject", ".", "getPackageFragmentRoot", "(", "entryPath", ".", "toString", "(", ")", ")", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "root", ".", "getElementName", "(", ")", ")", ";", "}", "contentChanged", "(", "root", ")", ";", "javaProject", ".", "resetResolvedClasspath", "(", ")", ";", "hasDelta", "=", "true", ";", "}", "else", "if", "(", "status", "==", "EXTERNAL_JAR_REMOVED", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "javaProject", ".", "getPackageFragmentRoot", "(", "entryPath", ".", "toString", "(", ")", ")", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "root", ".", "getElementName", "(", ")", ")", ";", "}", "elementRemoved", "(", "root", ",", "null", ",", "null", ")", ";", "javaProject", ".", "resetResolvedClasspath", "(", ")", ";", "this", ".", "state", ".", "addClasspathValidation", "(", "javaProject", ")", ";", "hasDelta", "=", "true", ";", "}", "}", "}", "}", "}", "JavaModel", ".", "flushExternalFileCache", "(", ")", ";", "if", "(", "hasDelta", ")", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "resetJarTypeCache", "(", ")", ";", "}", "return", "hasDelta", ";", "}", "private", "JavaElementDelta", "currentDelta", "(", ")", "{", "if", "(", "this", ".", "currentDelta", "==", "null", ")", "{", "this", ".", "currentDelta", "=", "new", "JavaElementDelta", "(", "this", ".", "manager", ".", "getJavaModel", "(", ")", ")", ";", "}", "return", "this", ".", "currentDelta", ";", "}", "private", "void", "deleting", "(", "IProject", "project", ")", "{", "try", "{", "this", ".", "manager", ".", "indexManager", ".", "discardJobs", "(", "project", ".", "getName", "(", ")", ")", ";", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "project", ")", ";", "if", "(", "this", ".", "oldRoots", "==", "null", ")", "{", "this", ".", "oldRoots", "=", "new", "HashMap", "(", ")", ";", "}", "if", "(", "javaProject", ".", "isOpen", "(", ")", ")", "{", "this", ".", "oldRoots", ".", "put", "(", "javaProject", ",", "javaProject", ".", "getPackageFragmentRoots", "(", ")", ")", ";", "}", "else", "{", "this", ".", "oldRoots", ".", "put", "(", "javaProject", ",", "javaProject", ".", "computePackageFragmentRoots", "(", "javaProject", ".", "getResolvedClasspath", "(", ")", ",", "false", ",", "null", ")", ")", ";", "}", "javaProject", ".", "close", "(", ")", ";", "this", ".", "state", ".", "getOldJavaProjecNames", "(", ")", ";", "removeFromParentInfo", "(", "javaProject", ")", ";", "this", ".", "manager", ".", "resetProjectPreferences", "(", "javaProject", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "private", "void", "elementAdded", "(", "Openable", "element", ",", "IResourceDelta", "delta", ",", "RootInfo", "rootInfo", ")", "{", "int", "elementType", "=", "element", ".", "getElementType", "(", ")", ";", "if", "(", "elementType", "==", "IJavaElement", ".", "JAVA_PROJECT", ")", "{", "IProject", "project", ";", "if", "(", "delta", "!=", "null", "&&", "JavaProject", ".", "hasJavaNature", "(", "project", "=", "(", "IProject", ")", "delta", ".", "getResource", "(", ")", ")", ")", "{", "addToParentInfo", "(", "element", ")", ";", "this", ".", "manager", ".", "getPerProjectInfo", "(", "project", ",", "true", ")", ".", "rememberExternalLibTimestamps", "(", ")", ";", "if", "(", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "MOVED_FROM", ")", "!=", "0", ")", "{", "Openable", "movedFromElement", "=", "(", "Openable", ")", "element", ".", "getJavaModel", "(", ")", ".", "getJavaProject", "(", "delta", ".", "getMovedFromPath", "(", ")", ".", "lastSegment", "(", ")", ")", ";", "currentDelta", "(", ")", ".", "movedTo", "(", "element", ",", "movedFromElement", ")", ";", "}", "else", "{", "close", "(", "element", ")", ";", "currentDelta", "(", ")", ".", "added", "(", "element", ")", ";", "}", "this", ".", "state", ".", "updateRoots", "(", "element", ".", "getPath", "(", ")", ",", "delta", ",", "this", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "element", ")", ";", "}", "}", "else", "{", "if", "(", "delta", "==", "null", "||", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "MOVED_FROM", ")", "==", "0", ")", "{", "if", "(", "isPrimaryWorkingCopy", "(", "element", ",", "elementType", ")", ")", "{", "currentDelta", "(", ")", ".", "changed", "(", "element", ",", "IJavaElementDelta", ".", "F_PRIMARY_RESOURCE", ")", ";", "}", "else", "{", "addToParentInfo", "(", "element", ")", ";", "close", "(", "element", ")", ";", "currentDelta", "(", ")", ".", "added", "(", "element", ")", ";", "}", "}", "else", "{", "addToParentInfo", "(", "element", ")", ";", "close", "(", "element", ")", ";", "IPath", "movedFromPath", "=", "delta", ".", "getMovedFromPath", "(", ")", ";", "IResource", "res", "=", "delta", ".", "getResource", "(", ")", ";", "IResource", "movedFromRes", ";", "if", "(", "res", "instanceof", "IFile", ")", "{", "movedFromRes", "=", "res", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getFile", "(", "movedFromPath", ")", ";", "}", "else", "{", "movedFromRes", "=", "res", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getFolder", "(", "movedFromPath", ")", ";", "}", "IPath", "rootPath", "=", "externalPath", "(", "movedFromRes", ")", ";", "RootInfo", "movedFromInfo", "=", "enclosingRootInfo", "(", "rootPath", ",", "IResourceDelta", ".", "REMOVED", ")", ";", "int", "movedFromType", "=", "elementType", "(", "movedFromRes", ",", "IResourceDelta", ".", "REMOVED", ",", "element", ".", "getParent", "(", ")", ".", "getElementType", "(", ")", ",", "movedFromInfo", ")", ";", "this", ".", "currentElement", "=", "null", ";", "Openable", "movedFromElement", "=", "elementType", "!=", "IJavaElement", ".", "JAVA_PROJECT", "&&", "movedFromType", "==", "IJavaElement", ".", "JAVA_PROJECT", "?", "null", ":", "createElement", "(", "movedFromRes", ",", "movedFromType", ",", "movedFromInfo", ")", ";", "if", "(", "movedFromElement", "==", "null", ")", "{", "currentDelta", "(", ")", ".", "added", "(", "element", ")", ";", "}", "else", "{", "currentDelta", "(", ")", ".", "movedTo", "(", "element", ",", "movedFromElement", ")", ";", "}", "}", "switch", "(", "elementType", ")", "{", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "JavaProject", "project", "=", "(", "JavaProject", ")", "element", ".", "getJavaProject", "(", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "project", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "project", "=", "(", "JavaProject", ")", "element", ".", "getJavaProject", "(", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "project", ")", ";", "break", ";", "}", "}", "}", "private", "void", "elementRemoved", "(", "Openable", "element", ",", "IResourceDelta", "delta", ",", "RootInfo", "rootInfo", ")", "{", "int", "elementType", "=", "element", ".", "getElementType", "(", ")", ";", "if", "(", "delta", "==", "null", "||", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "MOVED_TO", ")", "==", "0", ")", "{", "if", "(", "isPrimaryWorkingCopy", "(", "element", ",", "elementType", ")", ")", "{", "currentDelta", "(", ")", ".", "changed", "(", "element", ",", "IJavaElementDelta", ".", "F_PRIMARY_RESOURCE", ")", ";", "}", "else", "{", "close", "(", "element", ")", ";", "removeFromParentInfo", "(", "element", ")", ";", "currentDelta", "(", ")", ".", "removed", "(", "element", ")", ";", "}", "}", "else", "{", "close", "(", "element", ")", ";", "removeFromParentInfo", "(", "element", ")", ";", "IPath", "movedToPath", "=", "delta", ".", "getMovedToPath", "(", ")", ";", "IResource", "res", "=", "delta", ".", "getResource", "(", ")", ";", "IResource", "movedToRes", ";", "switch", "(", "res", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "PROJECT", ":", "movedToRes", "=", "res", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProject", "(", "movedToPath", ".", "lastSegment", "(", ")", ")", ";", "break", ";", "case", "IResource", ".", "FOLDER", ":", "movedToRes", "=", "res", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getFolder", "(", "movedToPath", ")", ";", "break", ";", "case", "IResource", ".", "FILE", ":", "movedToRes", "=", "res", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getFile", "(", "movedToPath", ")", ";", "break", ";", "default", ":", "return", ";", "}", "IPath", "rootPath", "=", "externalPath", "(", "movedToRes", ")", ";", "RootInfo", "movedToInfo", "=", "enclosingRootInfo", "(", "rootPath", ",", "IResourceDelta", ".", "ADDED", ")", ";", "int", "movedToType", "=", "elementType", "(", "movedToRes", ",", "IResourceDelta", ".", "ADDED", ",", "element", ".", "getParent", "(", ")", ".", "getElementType", "(", ")", ",", "movedToInfo", ")", ";", "this", ".", "currentElement", "=", "null", ";", "Openable", "movedToElement", "=", "elementType", "!=", "IJavaElement", ".", "JAVA_PROJECT", "&&", "movedToType", "==", "IJavaElement", ".", "JAVA_PROJECT", "?", "null", ":", "createElement", "(", "movedToRes", ",", "movedToType", ",", "movedToInfo", ")", ";", "if", "(", "movedToElement", "==", "null", ")", "{", "currentDelta", "(", ")", ".", "removed", "(", "element", ")", ";", "}", "else", "{", "currentDelta", "(", ")", ".", "movedFrom", "(", "element", ",", "movedToElement", ")", ";", "}", "}", "switch", "(", "elementType", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "this", ".", "manager", ".", "indexManager", ".", "reset", "(", ")", ";", "break", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "this", ".", "state", ".", "updateRoots", "(", "element", ".", "getPath", "(", ")", ",", "delta", ",", "this", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "JavaProject", "project", "=", "(", "JavaProject", ")", "element", ".", "getJavaProject", "(", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "project", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "project", "=", "(", "JavaProject", ")", "element", ".", "getJavaProject", "(", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "project", ")", ";", "break", ";", "}", "}", "private", "int", "elementType", "(", "IResource", "res", ",", "int", "kind", ",", "int", "parentType", ",", "RootInfo", "rootInfo", ")", "{", "switch", "(", "parentType", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "return", "IJavaElement", ".", "JAVA_PROJECT", ";", "case", "NON_JAVA_RESOURCE", ":", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "if", "(", "rootInfo", "==", "null", ")", "{", "rootInfo", "=", "enclosingRootInfo", "(", "res", ".", "getFullPath", "(", ")", ",", "kind", ")", ";", "}", "if", "(", "rootInfo", "!=", "null", "&&", "rootInfo", ".", "isRootOfProject", "(", "res", ".", "getFullPath", "(", ")", ")", ")", "{", "return", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ";", "}", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "if", "(", "rootInfo", "==", "null", ")", "{", "IPath", "rootPath", "=", "externalPath", "(", "res", ")", ";", "rootInfo", "=", "enclosingRootInfo", "(", "rootPath", ",", "kind", ")", ";", "}", "if", "(", "rootInfo", "==", "null", ")", "{", "return", "NON_JAVA_RESOURCE", ";", "}", "if", "(", "Util", ".", "isExcluded", "(", "res", ",", "rootInfo", ".", "inclusionPatterns", ",", "rootInfo", ".", "exclusionPatterns", ")", ")", "{", "return", "NON_JAVA_RESOURCE", ";", "}", "if", "(", "res", ".", "getType", "(", ")", "==", "IResource", ".", "FOLDER", ")", "{", "if", "(", "parentType", "==", "NON_JAVA_RESOURCE", "&&", "!", "Util", ".", "isExcluded", "(", "res", ".", "getParent", "(", ")", ",", "rootInfo", ".", "inclusionPatterns", ",", "rootInfo", ".", "exclusionPatterns", ")", ")", "{", "return", "NON_JAVA_RESOURCE", ";", "}", "String", "sourceLevel", "=", "rootInfo", ".", "project", "==", "null", "?", "null", ":", "rootInfo", ".", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "String", "complianceLevel", "=", "rootInfo", ".", "project", "==", "null", "?", "null", ":", "rootInfo", ".", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "if", "(", "Util", ".", "isValidFolderNameForPackage", "(", "res", ".", "getName", "(", ")", ",", "sourceLevel", ",", "complianceLevel", ")", ")", "{", "return", "IJavaElement", ".", "PACKAGE_FRAGMENT", ";", "}", "return", "NON_JAVA_RESOURCE", ";", "}", "String", "fileName", "=", "res", ".", "getName", "(", ")", ";", "String", "sourceLevel", "=", "rootInfo", ".", "project", "==", "null", "?", "null", ":", "rootInfo", ".", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "String", "complianceLevel", "=", "rootInfo", ".", "project", "==", "null", "?", "null", ":", "rootInfo", ".", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "if", "(", "Util", ".", "isValidCompilationUnitName", "(", "fileName", ",", "sourceLevel", ",", "complianceLevel", ")", ")", "{", "return", "IJavaElement", ".", "COMPILATION_UNIT", ";", "}", "else", "if", "(", "Util", ".", "isValidClassFileName", "(", "fileName", ",", "sourceLevel", ",", "complianceLevel", ")", ")", "{", "return", "IJavaElement", ".", "CLASS_FILE", ";", "}", "else", "{", "IPath", "rootPath", "=", "externalPath", "(", "res", ")", ";", "if", "(", "(", "rootInfo", "=", "rootInfo", "(", "rootPath", ",", "kind", ")", ")", "!=", "null", "&&", "rootInfo", ".", "project", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ".", "isPrefixOf", "(", "rootPath", ")", ")", "{", "return", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ";", "}", "else", "{", "return", "NON_JAVA_RESOURCE", ";", "}", "}", "default", ":", "return", "NON_JAVA_RESOURCE", ";", "}", "}", "public", "void", "flush", "(", ")", "{", "this", ".", "javaModelDeltas", "=", "new", "ArrayList", "(", ")", ";", "}", "private", "SourceElementParser", "getSourceElementParser", "(", "Openable", "element", ")", "{", "if", "(", "this", ".", "sourceElementParserCache", "==", "null", ")", "this", ".", "sourceElementParserCache", "=", "this", ".", "manager", ".", "indexManager", ".", "getSourceElementParser", "(", "element", ".", "getJavaProject", "(", ")", ",", "null", ")", ";", "return", "this", ".", "sourceElementParserCache", ";", "}", "private", "RootInfo", "enclosingRootInfo", "(", "IPath", "path", ",", "int", "kind", ")", "{", "while", "(", "path", "!=", "null", "&&", "path", ".", "segmentCount", "(", ")", ">", "0", ")", "{", "RootInfo", "rootInfo", "=", "rootInfo", "(", "path", ",", "kind", ")", ";", "if", "(", "rootInfo", "!=", "null", ")", "return", "rootInfo", ";", "path", "=", "path", ".", "removeLastSegments", "(", "1", ")", ";", "}", "return", "null", ";", "}", "private", "IPath", "externalPath", "(", "IResource", "res", ")", "{", "IPath", "resourcePath", "=", "res", ".", "getFullPath", "(", ")", ";", "if", "(", "ExternalFoldersManager", ".", "isInternalPathForExternalFolder", "(", "resourcePath", ")", ")", "return", "res", ".", "getLocation", "(", ")", ";", "return", "resourcePath", ";", "}", "public", "void", "fire", "(", "IJavaElementDelta", "customDelta", ",", "int", "eventType", ")", "{", "if", "(", "!", "this", ".", "isFiring", ")", "return", ";", "if", "(", "DEBUG", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "IJavaElementDelta", "deltaToNotify", ";", "if", "(", "customDelta", "==", "null", ")", "{", "deltaToNotify", "=", "mergeDeltas", "(", "this", ".", "javaModelDeltas", ")", ";", "}", "else", "{", "deltaToNotify", "=", "customDelta", ";", "}", "if", "(", "deltaToNotify", "!=", "null", ")", "{", "Iterator", "scopes", "=", "this", ".", "manager", ".", "searchScopes", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "scopes", ".", "hasNext", "(", ")", ")", "{", "AbstractSearchScope", "scope", "=", "(", "AbstractSearchScope", ")", "scopes", ".", "next", "(", ")", ";", "scope", ".", "processDelta", "(", "deltaToNotify", ",", "eventType", ")", ";", "}", "JavaWorkspaceScope", "workspaceScope", "=", "this", ".", "manager", ".", "workspaceScope", ";", "if", "(", "workspaceScope", "!=", "null", ")", "workspaceScope", ".", "processDelta", "(", "deltaToNotify", ",", "eventType", ")", ";", "}", "IElementChangedListener", "[", "]", "listeners", ";", "int", "[", "]", "listenerMask", ";", "int", "listenerCount", ";", "synchronized", "(", "this", ".", "state", ")", "{", "listeners", "=", "this", ".", "state", ".", "elementChangedListeners", ";", "listenerMask", "=", "this", ".", "state", ".", "elementChangedListenerMasks", ";", "listenerCount", "=", "this", ".", "state", ".", "elementChangedListenerCount", ";", "}", "switch", "(", "eventType", ")", "{", "case", "DEFAULT_CHANGE_EVENT", ":", "case", "ElementChangedEvent", ".", "POST_CHANGE", ":", "firePostChangeDelta", "(", "deltaToNotify", ",", "listeners", ",", "listenerMask", ",", "listenerCount", ")", ";", "fireReconcileDelta", "(", "listeners", ",", "listenerMask", ",", "listenerCount", ")", ";", "break", ";", "}", "}", "private", "void", "firePostChangeDelta", "(", "IJavaElementDelta", "deltaToNotify", ",", "IElementChangedListener", "[", "]", "listeners", ",", "int", "[", "]", "listenerMask", ",", "int", "listenerCount", ")", "{", "if", "(", "DEBUG", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"]:\"", ")", ";", "System", ".", "out", ".", "println", "(", "deltaToNotify", "==", "null", "?", "\"<NONE>\"", ":", "deltaToNotify", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "deltaToNotify", "!=", "null", ")", "{", "flush", "(", ")", ";", "JavaModelOperation", ".", "setAttribute", "(", "JavaModelOperation", ".", "HAS_MODIFIED_RESOURCE_ATTR", ",", "null", ")", ";", "notifyListeners", "(", "deltaToNotify", ",", "ElementChangedEvent", ".", "POST_CHANGE", ",", "listeners", ",", "listenerMask", ",", "listenerCount", ")", ";", "}", "}", "private", "void", "fireReconcileDelta", "(", "IElementChangedListener", "[", "]", "listeners", ",", "int", "[", "]", "listenerMask", ",", "int", "listenerCount", ")", "{", "IJavaElementDelta", "deltaToNotify", "=", "mergeDeltas", "(", "this", ".", "reconcileDeltas", ".", "values", "(", ")", ")", ";", "if", "(", "DEBUG", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"]:\"", ")", ";", "System", ".", "out", ".", "println", "(", "deltaToNotify", "==", "null", "?", "\"<NONE>\"", ":", "deltaToNotify", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "deltaToNotify", "!=", "null", ")", "{", "this", ".", "reconcileDeltas", "=", "new", "HashMap", "(", ")", ";", "notifyListeners", "(", "deltaToNotify", ",", "ElementChangedEvent", ".", "POST_RECONCILE", ",", "listeners", ",", "listenerMask", ",", "listenerCount", ")", ";", "}", "}", "private", "boolean", "isAffectedBy", "(", "IResourceDelta", "rootDelta", ")", "{", "if", "(", "rootDelta", "!=", "null", ")", "{", "class", "FoundRelevantDeltaException", "extends", "RuntimeException", "{", "private", "static", "final", "long", "serialVersionUID", "=", "7137113252936111022L", ";", "}", "try", "{", "rootDelta", ".", "accept", "(", "new", "IResourceDeltaVisitor", "(", ")", "{", "public", "boolean", "visit", "(", "IResourceDelta", "delta", ")", "{", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "ADDED", ":", "case", "IResourceDelta", ".", "REMOVED", ":", "throw", "new", "FoundRelevantDeltaException", "(", ")", ";", "case", "IResourceDelta", ".", "CHANGED", ":", "if", "(", "delta", ".", "getAffectedChildren", "(", ")", ".", "length", "==", "0", "&&", "(", "delta", ".", "getFlags", "(", ")", "&", "~", "(", "IResourceDelta", ".", "SYNC", "|", "IResourceDelta", ".", "MARKERS", ")", ")", "!=", "0", ")", "{", "throw", "new", "FoundRelevantDeltaException", "(", ")", ";", "}", "}", "return", "true", ";", "}", "}", ",", "IContainer", ".", "INCLUDE_HIDDEN", ")", ";", "}", "catch", "(", "FoundRelevantDeltaException", "e", ")", "{", "return", "true", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "}", "return", "false", ";", "}", "private", "boolean", "isPrimaryWorkingCopy", "(", "IJavaElement", "element", ",", "int", "elementType", ")", "{", "if", "(", "elementType", "==", "IJavaElement", ".", "COMPILATION_UNIT", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "element", ";", "return", "cu", ".", "isPrimary", "(", ")", "&&", "cu", ".", "isWorkingCopy", "(", ")", ";", "}", "return", "false", ";", "}", "private", "boolean", "isResFilteredFromOutput", "(", "RootInfo", "rootInfo", ",", "OutputsInfo", "info", ",", "IResource", "res", ",", "int", "elementType", ")", "{", "if", "(", "info", "!=", "null", ")", "{", "JavaProject", "javaProject", "=", "null", ";", "String", "sourceLevel", "=", "null", ";", "String", "complianceLevel", "=", "null", ";", "IPath", "resPath", "=", "res", ".", "getFullPath", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "info", ".", "outputCount", ";", "i", "++", ")", "{", "if", "(", "info", ".", "paths", "[", "i", "]", ".", "isPrefixOf", "(", "resPath", ")", ")", "{", "if", "(", "info", ".", "traverseModes", "[", "i", "]", "!=", "IGNORE", ")", "{", "if", "(", "info", ".", "traverseModes", "[", "i", "]", "==", "SOURCE", "&&", "elementType", "==", "IJavaElement", ".", "CLASS_FILE", ")", "{", "return", "true", ";", "}", "if", "(", "elementType", "==", "IJavaElement", ".", "JAVA_PROJECT", "&&", "res", "instanceof", "IFile", ")", "{", "if", "(", "sourceLevel", "==", "null", ")", "{", "javaProject", "=", "rootInfo", "==", "null", "?", "(", "JavaProject", ")", "createElement", "(", "res", ".", "getProject", "(", ")", ",", "IJavaElement", ".", "JAVA_PROJECT", ",", "null", ")", ":", "rootInfo", ".", "project", ";", "if", "(", "javaProject", "!=", "null", ")", "{", "sourceLevel", "=", "javaProject", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "complianceLevel", "=", "javaProject", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "}", "}", "if", "(", "Util", ".", "isValidClassFileName", "(", "res", ".", "getName", "(", ")", ",", "sourceLevel", ",", "complianceLevel", ")", ")", "{", "return", "true", ";", "}", "}", "}", "else", "{", "return", "true", ";", "}", "}", "}", "}", "return", "false", ";", "}", "private", "IJavaElementDelta", "mergeDeltas", "(", "Collection", "deltas", ")", "{", "if", "(", "deltas", ".", "size", "(", ")", "==", "0", ")", "return", "null", ";", "if", "(", "deltas", ".", "size", "(", ")", "==", "1", ")", "return", "(", "IJavaElementDelta", ")", "deltas", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"MERGING", "\"", "+", "deltas", ".", "size", "(", ")", "+", "\"", "DELTAS", "[\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"]\"", ")", ";", "}", "Iterator", "iterator", "=", "deltas", ".", "iterator", "(", ")", ";", "JavaElementDelta", "rootDelta", "=", "new", "JavaElementDelta", "(", "this", ".", "manager", ".", "javaModel", ")", ";", "boolean", "insertedTree", "=", "false", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "JavaElementDelta", "delta", "=", "(", "JavaElementDelta", ")", "iterator", ".", "next", "(", ")", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "delta", ".", "toString", "(", ")", ")", ";", "}", "IJavaElement", "element", "=", "delta", ".", "getElement", "(", ")", ";", "if", "(", "this", ".", "manager", ".", "javaModel", ".", "equals", "(", "element", ")", ")", "{", "IJavaElementDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "children", ".", "length", ";", "j", "++", ")", "{", "JavaElementDelta", "projectDelta", "=", "(", "JavaElementDelta", ")", "children", "[", "j", "]", ";", "rootDelta", ".", "insertDeltaTree", "(", "projectDelta", ".", "getElement", "(", ")", ",", "projectDelta", ")", ";", "insertedTree", "=", "true", ";", "}", "IResourceDelta", "[", "]", "resourceDeltas", "=", "delta", ".", "getResourceDeltas", "(", ")", ";", "if", "(", "resourceDeltas", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "resourceDeltas", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "rootDelta", ".", "addResourceDelta", "(", "resourceDeltas", "[", "i", "]", ")", ";", "insertedTree", "=", "true", ";", "}", "}", "}", "else", "{", "rootDelta", ".", "insertDeltaTree", "(", "element", ",", "delta", ")", ";", "insertedTree", "=", "true", ";", "}", "}", "if", "(", "insertedTree", ")", "return", "rootDelta", ";", "return", "null", ";", "}", "private", "void", "notifyListeners", "(", "IJavaElementDelta", "deltaToNotify", ",", "int", "eventType", ",", "IElementChangedListener", "[", "]", "listeners", ",", "int", "[", "]", "listenerMask", ",", "int", "listenerCount", ")", "{", "final", "ElementChangedEvent", "extraEvent", "=", "new", "ElementChangedEvent", "(", "deltaToNotify", ",", "eventType", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listenerCount", ";", "i", "++", ")", "{", "if", "(", "(", "listenerMask", "[", "i", "]", "&", "eventType", ")", "!=", "0", ")", "{", "final", "IElementChangedListener", "listener", "=", "listeners", "[", "i", "]", ";", "long", "start", "=", "-", "1", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "print", "(", "\"Listener", "#\"", "+", "(", "i", "+", "1", ")", "+", "\"=\"", "+", "listener", ".", "toString", "(", ")", ")", ";", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "SafeRunner", ".", "run", "(", "new", "ISafeRunnable", "(", ")", "{", "public", "void", "handleException", "(", "Throwable", "exception", ")", "{", "Util", ".", "log", "(", "exception", ",", "\"\"", ")", ";", "}", "public", "void", "run", "(", ")", "throws", "Exception", "{", "PerformanceStats", "stats", "=", "null", ";", "if", "(", "PERF", ")", "{", "stats", "=", "PerformanceStats", ".", "getStats", "(", "JavaModelManager", ".", "DELTA_LISTENER_PERF", ",", "listener", ")", ";", "stats", ".", "startRun", "(", ")", ";", "}", "listener", ".", "elementChanged", "(", "extraEvent", ")", ";", "if", "(", "PERF", ")", "{", "stats", ".", "endRun", "(", ")", ";", "}", "}", "}", ")", ";", "if", "(", "VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"", "->", "\"", "+", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", "+", "\"ms\"", ")", ";", "}", "}", "}", "}", "private", "void", "notifyTypeHierarchies", "(", "IElementChangedListener", "[", "]", "listeners", ",", "int", "listenerCount", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listenerCount", ";", "i", "++", ")", "{", "final", "IElementChangedListener", "listener", "=", "listeners", "[", "i", "]", ";", "if", "(", "!", "(", "listener", "instanceof", "TypeHierarchy", ")", ")", "continue", ";", "SafeRunner", ".", "run", "(", "new", "ISafeRunnable", "(", ")", "{", "public", "void", "handleException", "(", "Throwable", "exception", ")", "{", "Util", ".", "log", "(", "exception", ",", "\"\"", ")", ";", "}", "public", "void", "run", "(", ")", "throws", "Exception", "{", "TypeHierarchy", "typeHierarchy", "=", "(", "TypeHierarchy", ")", "listener", ";", "if", "(", "typeHierarchy", ".", "hasFineGrainChanges", "(", ")", ")", "{", "typeHierarchy", ".", "needsRefresh", "=", "true", ";", "typeHierarchy", ".", "fireChange", "(", ")", ";", "}", "}", "}", ")", ";", "}", "}", "private", "void", "nonJavaResourcesChanged", "(", "Openable", "element", ",", "IResourceDelta", "delta", ")", "throws", "JavaModelException", "{", "if", "(", "element", ".", "isOpen", "(", ")", ")", "{", "JavaElementInfo", "info", "=", "(", "JavaElementInfo", ")", "element", ".", "getElementInfo", "(", ")", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "(", "(", "JavaModelInfo", ")", "info", ")", ".", "nonJavaResources", "=", "null", ";", "if", "(", "!", "ExternalFoldersManager", ".", "isInternalPathForExternalFolder", "(", "delta", ".", "getFullPath", "(", ")", ")", ")", "currentDelta", "(", ")", ".", "addResourceDelta", "(", "delta", ")", ";", "return", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "(", "(", "JavaProjectElementInfo", ")", "info", ")", ".", "setNonJavaResources", "(", "null", ")", ";", "JavaProject", "project", "=", "(", "JavaProject", ")", "element", ";", "PackageFragmentRoot", "projectRoot", "=", "(", "PackageFragmentRoot", ")", "project", ".", "getPackageFragmentRoot", "(", "project", ".", "getProject", "(", ")", ")", ";", "if", "(", "projectRoot", ".", "isOpen", "(", ")", ")", "{", "(", "(", "PackageFragmentRootInfo", ")", "projectRoot", ".", "getElementInfo", "(", ")", ")", ".", "setNonJavaResources", "(", "null", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "(", "(", "PackageFragmentInfo", ")", "info", ")", ".", "setNonJavaResources", "(", "null", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "(", "(", "PackageFragmentRootInfo", ")", "info", ")", ".", "setNonJavaResources", "(", "null", ")", ";", "}", "}", "JavaElementDelta", "current", "=", "currentDelta", "(", ")", ";", "JavaElementDelta", "elementDelta", "=", "current", ".", "find", "(", "element", ")", ";", "if", "(", "elementDelta", "==", "null", ")", "{", "elementDelta", "=", "current", ".", "changed", "(", "element", ",", "IJavaElementDelta", ".", "F_CONTENT", ")", ";", "}", "if", "(", "!", "ExternalFoldersManager", ".", "isInternalPathForExternalFolder", "(", "delta", ".", "getFullPath", "(", ")", ")", ")", "elementDelta", ".", "addResourceDelta", "(", "delta", ")", ";", "}", "private", "RootInfo", "oldRootInfo", "(", "IPath", "path", ",", "JavaProject", "project", ")", "{", "RootInfo", "oldInfo", "=", "(", "RootInfo", ")", "this", ".", "state", ".", "oldRoots", ".", "get", "(", "path", ")", ";", "if", "(", "oldInfo", "==", "null", ")", "return", "null", ";", "if", "(", "oldInfo", ".", "project", ".", "equals", "(", "project", ")", ")", "return", "oldInfo", ";", "ArrayList", "oldInfos", "=", "(", "ArrayList", ")", "this", ".", "state", ".", "oldOtherRoots", ".", "get", "(", "path", ")", ";", "if", "(", "oldInfos", "==", "null", ")", "return", "null", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "oldInfos", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "oldInfo", "=", "(", "RootInfo", ")", "oldInfos", ".", "get", "(", "i", ")", ";", "if", "(", "oldInfo", ".", "project", ".", "equals", "(", "project", ")", ")", "return", "oldInfo", ";", "}", "return", "null", ";", "}", "private", "ArrayList", "otherRootsInfo", "(", "IPath", "path", ",", "int", "kind", ")", "{", "if", "(", "kind", "==", "IResourceDelta", ".", "REMOVED", ")", "{", "return", "(", "ArrayList", ")", "this", ".", "state", ".", "oldOtherRoots", ".", "get", "(", "path", ")", ";", "}", "return", "(", "ArrayList", ")", "this", ".", "state", ".", "otherRoots", ".", "get", "(", "path", ")", ";", "}", "private", "OutputsInfo", "outputsInfo", "(", "RootInfo", "rootInfo", ",", "IResource", "res", ")", "{", "try", "{", "JavaProject", "proj", "=", "rootInfo", "==", "null", "?", "(", "JavaProject", ")", "createElement", "(", "res", ".", "getProject", "(", ")", ",", "IJavaElement", ".", "JAVA_PROJECT", ",", "null", ")", ":", "rootInfo", ".", "project", ";", "if", "(", "proj", "!=", "null", ")", "{", "IPath", "projectOutput", "=", "proj", ".", "getOutputLocation", "(", ")", ";", "int", "traverseMode", "=", "IGNORE", ";", "if", "(", "proj", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ".", "equals", "(", "projectOutput", ")", ")", "{", "return", "new", "OutputsInfo", "(", "new", "IPath", "[", "]", "{", "projectOutput", "}", ",", "new", "int", "[", "]", "{", "SOURCE", "}", ",", "1", ")", ";", "}", "IClasspathEntry", "[", "]", "classpath", "=", "proj", ".", "getResolvedClasspath", "(", ")", ";", "IPath", "[", "]", "outputs", "=", "new", "IPath", "[", "classpath", ".", "length", "+", "1", "]", ";", "int", "[", "]", "traverseModes", "=", "new", "int", "[", "classpath", ".", "length", "+", "1", "]", ";", "int", "outputCount", "=", "1", ";", "outputs", "[", "0", "]", "=", "projectOutput", ";", "traverseModes", "[", "0", "]", "=", "traverseMode", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "classpath", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "i", "]", ";", "IPath", "entryPath", "=", "entry", ".", "getPath", "(", ")", ";", "IPath", "output", "=", "entry", ".", "getOutputLocation", "(", ")", ";", "if", "(", "output", "!=", "null", ")", "{", "outputs", "[", "outputCount", "]", "=", "output", ";", "if", "(", "entryPath", ".", "equals", "(", "output", ")", ")", "{", "traverseModes", "[", "outputCount", "++", "]", "=", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_SOURCE", ")", "?", "SOURCE", ":", "BINARY", ";", "}", "else", "{", "traverseModes", "[", "outputCount", "++", "]", "=", "IGNORE", ";", "}", "}", "if", "(", "entryPath", ".", "equals", "(", "projectOutput", ")", ")", "{", "traverseModes", "[", "0", "]", "=", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_SOURCE", ")", "?", "SOURCE", ":", "BINARY", ";", "}", "}", "return", "new", "OutputsInfo", "(", "outputs", ",", "traverseModes", ",", "outputCount", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "return", "null", ";", "}", "private", "void", "popUntilPrefixOf", "(", "IPath", "path", ")", "{", "while", "(", "this", ".", "currentElement", "!=", "null", ")", "{", "IPath", "currentElementPath", "=", "null", ";", "if", "(", "this", ".", "currentElement", "instanceof", "IPackageFragmentRoot", ")", "{", "currentElementPath", "=", "(", "(", "IPackageFragmentRoot", ")", "this", ".", "currentElement", ")", ".", "getPath", "(", ")", ";", "}", "else", "{", "IResource", "currentElementResource", "=", "this", ".", "currentElement", ".", "resource", "(", ")", ";", "if", "(", "currentElementResource", "!=", "null", ")", "{", "currentElementPath", "=", "currentElementResource", ".", "getFullPath", "(", ")", ";", "}", "}", "if", "(", "currentElementPath", "!=", "null", ")", "{", "if", "(", "this", ".", "currentElement", "instanceof", "IPackageFragment", "&&", "(", "(", "IPackageFragment", ")", "this", ".", "currentElement", ")", ".", "isDefaultPackage", "(", ")", "&&", "currentElementPath", ".", "segmentCount", "(", ")", "!=", "path", ".", "segmentCount", "(", ")", "-", "1", ")", "{", "this", ".", "currentElement", "=", "(", "Openable", ")", "this", ".", "currentElement", ".", "getParent", "(", ")", ";", "}", "if", "(", "currentElementPath", ".", "isPrefixOf", "(", "path", ")", ")", "{", "return", ";", "}", "}", "this", ".", "currentElement", "=", "(", "Openable", ")", "this", ".", "currentElement", ".", "getParent", "(", ")", ";", "}", "}", "private", "IJavaElementDelta", "processResourceDelta", "(", "IResourceDelta", "changes", ")", "{", "try", "{", "IJavaModel", "model", "=", "this", ".", "manager", ".", "getJavaModel", "(", ")", ";", "if", "(", "!", "model", ".", "isOpen", "(", ")", ")", "{", "try", "{", "model", ".", "open", "(", "null", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "VERBOSE", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}", "}", "this", ".", "state", ".", "initializeRoots", "(", "false", ")", ";", "this", ".", "currentElement", "=", "null", ";", "IResourceDelta", "[", "]", "deltas", "=", "changes", ".", "getAffectedChildren", "(", "IResourceDelta", ".", "ADDED", "|", "IResourceDelta", ".", "REMOVED", "|", "IResourceDelta", ".", "CHANGED", ",", "IContainer", ".", "INCLUDE_HIDDEN", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "deltas", ".", "length", ";", "i", "++", ")", "{", "IResourceDelta", "delta", "=", "deltas", "[", "i", "]", ";", "IResource", "res", "=", "delta", ".", "getResource", "(", ")", ";", "RootInfo", "rootInfo", "=", "null", ";", "int", "elementType", ";", "IProject", "proj", "=", "(", "IProject", ")", "res", ";", "boolean", "wasJavaProject", "=", "this", ".", "state", ".", "findJavaProject", "(", "proj", ".", "getName", "(", ")", ")", "!=", "null", ";", "boolean", "isJavaProject", "=", "JavaProject", ".", "hasJavaNature", "(", "proj", ")", ";", "if", "(", "!", "wasJavaProject", "&&", "!", "isJavaProject", ")", "{", "elementType", "=", "NON_JAVA_RESOURCE", ";", "}", "else", "{", "IPath", "rootPath", "=", "externalPath", "(", "res", ")", ";", "rootInfo", "=", "enclosingRootInfo", "(", "rootPath", ",", "delta", ".", "getKind", "(", ")", ")", ";", "if", "(", "rootInfo", "!=", "null", "&&", "rootInfo", ".", "isRootOfProject", "(", "rootPath", ")", ")", "{", "elementType", "=", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ";", "}", "else", "{", "elementType", "=", "IJavaElement", ".", "JAVA_PROJECT", ";", "}", "}", "traverseDelta", "(", "delta", ",", "elementType", ",", "rootInfo", ",", "null", ")", ";", "if", "(", "elementType", "==", "NON_JAVA_RESOURCE", "||", "(", "wasJavaProject", "!=", "isJavaProject", "&&", "(", "delta", ".", "getKind", "(", ")", ")", "==", "IResourceDelta", ".", "CHANGED", ")", ")", "{", "try", "{", "nonJavaResourcesChanged", "(", "(", "JavaModel", ")", "model", ",", "delta", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "resetProjectCaches", "(", ")", ";", "return", "this", ".", "currentDelta", ";", "}", "finally", "{", "this", ".", "currentDelta", "=", "null", ";", "}", "}", "public", "void", "resetProjectCaches", "(", ")", "{", "if", "(", "this", ".", "projectCachesToReset", ".", "size", "(", ")", "==", "0", ")", "return", ";", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "resetJarTypeCache", "(", ")", ";", "Iterator", "iterator", "=", "this", ".", "projectCachesToReset", ".", "iterator", "(", ")", ";", "HashMap", "projectDepencies", "=", "this", ".", "state", ".", "projectDependencies", ";", "HashSet", "affectedDependents", "=", "new", "HashSet", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "JavaProject", "project", "=", "(", "JavaProject", ")", "iterator", ".", "next", "(", ")", ";", "project", ".", "resetCaches", "(", ")", ";", "addDependentProjects", "(", "project", ",", "projectDepencies", ",", "affectedDependents", ")", ";", "}", "iterator", "=", "affectedDependents", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "JavaProject", "project", "=", "(", "JavaProject", ")", "iterator", ".", "next", "(", ")", ";", "project", ".", "resetCaches", "(", ")", ";", "}", "this", ".", "projectCachesToReset", ".", "clear", "(", ")", ";", "}", "public", "void", "registerJavaModelDelta", "(", "IJavaElementDelta", "delta", ")", "{", "this", ".", "javaModelDeltas", ".", "add", "(", "delta", ")", ";", "}", "private", "void", "removeFromParentInfo", "(", "Openable", "child", ")", "{", "Openable", "parent", "=", "(", "Openable", ")", "child", ".", "getParent", "(", ")", ";", "if", "(", "parent", "!=", "null", "&&", "parent", ".", "isOpen", "(", ")", ")", "{", "try", "{", "OpenableElementInfo", "info", "=", "(", "OpenableElementInfo", ")", "parent", ".", "getElementInfo", "(", ")", ";", "info", ".", "removeChild", "(", "child", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "public", "void", "resourceChanged", "(", "IResourceChangeEvent", "event", ")", "{", "int", "eventType", "=", "this", ".", "overridenEventType", "==", "-", "1", "?", "event", ".", "getType", "(", ")", ":", "this", ".", "overridenEventType", ";", "IResource", "resource", "=", "event", ".", "getResource", "(", ")", ";", "IResourceDelta", "delta", "=", "event", ".", "getDelta", "(", ")", ";", "switch", "(", "eventType", ")", "{", "case", "IResourceChangeEvent", ".", "PRE_DELETE", ":", "try", "{", "if", "(", "resource", ".", "getType", "(", ")", "==", "IResource", ".", "PROJECT", "&&", "(", "(", "IProject", ")", "resource", ")", ".", "hasNature", "(", "JavaCore", ".", "NATURE_ID", ")", ")", "{", "deleting", "(", "(", "IProject", ")", "resource", ")", ";", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "}", "return", ";", "case", "IResourceChangeEvent", ".", "PRE_REFRESH", ":", "IProject", "[", "]", "projects", "=", "null", ";", "Object", "o", "=", "event", ".", "getSource", "(", ")", ";", "if", "(", "o", "instanceof", "IProject", ")", "{", "projects", "=", "new", "IProject", "[", "]", "{", "(", "IProject", ")", "o", "}", ";", "}", "else", "if", "(", "o", "instanceof", "IWorkspace", ")", "{", "projects", "=", "(", "(", "IWorkspace", ")", "o", ")", ".", "getRoot", "(", ")", ".", "getProjects", "(", "IContainer", ".", "INCLUDE_HIDDEN", ")", ";", "}", "JavaModelManager", ".", "getExternalManager", "(", ")", ".", "refreshReferences", "(", "projects", ",", "null", ")", ";", "IJavaProject", "[", "]", "javaElements", "=", "new", "IJavaProject", "[", "projects", ".", "length", "]", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "projects", ".", "length", ";", "index", "++", ")", "{", "javaElements", "[", "index", "]", "=", "JavaCore", ".", "create", "(", "projects", "[", "index", "]", ")", ";", "}", "try", "{", "checkExternalArchiveChanges", "(", "javaElements", ",", "true", ",", "null", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "!", "e", ".", "isDoesNotExist", "(", ")", ")", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "return", ";", "case", "IResourceChangeEvent", ".", "POST_CHANGE", ":", "HashSet", "elementsToRefresh", "=", "this", ".", "state", ".", "removeExternalElementsToRefresh", "(", ")", ";", "if", "(", "isAffectedBy", "(", "delta", ")", "||", "elementsToRefresh", "!=", "null", ")", "{", "try", "{", "try", "{", "stopDeltas", "(", ")", ";", "checkProjectsAndClasspathChanges", "(", "delta", ")", ";", "if", "(", "elementsToRefresh", "!=", "null", ")", "{", "createExternalArchiveDelta", "(", "elementsToRefresh", ",", "null", ")", ";", "}", "HashMap", "classpathChanges", "=", "this", ".", "state", ".", "removeAllClasspathChanges", "(", ")", ";", "if", "(", "classpathChanges", ".", "size", "(", ")", ">", "0", ")", "{", "boolean", "hasDelta", "=", "this", ".", "currentDelta", "!=", "null", ";", "JavaElementDelta", "javaDelta", "=", "currentDelta", "(", ")", ";", "Iterator", "changes", "=", "classpathChanges", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "changes", ".", "hasNext", "(", ")", ")", "{", "ClasspathChange", "change", "=", "(", "ClasspathChange", ")", "changes", ".", "next", "(", ")", ";", "int", "result", "=", "change", ".", "generateDelta", "(", "javaDelta", ",", "false", ")", ";", "if", "(", "(", "result", "&", "ClasspathChange", ".", "HAS_DELTA", ")", "!=", "0", ")", "{", "hasDelta", "=", "true", ";", "this", ".", "state", ".", "rootsAreStale", "=", "true", ";", "change", ".", "requestIndexing", "(", ")", ";", "this", ".", "state", ".", "addClasspathValidation", "(", "change", ".", "project", ")", ";", "}", "if", "(", "(", "result", "&", "ClasspathChange", ".", "HAS_PROJECT_CHANGE", ")", "!=", "0", ")", "{", "this", ".", "state", ".", "addProjectReferenceChange", "(", "change", ".", "project", ",", "change", ".", "oldResolvedClasspath", ")", ";", "}", "if", "(", "(", "result", "&", "ClasspathChange", ".", "HAS_LIBRARY_CHANGE", ")", "!=", "0", ")", "{", "this", ".", "state", ".", "addExternalFolderChange", "(", "change", ".", "project", ",", "change", ".", "oldResolvedClasspath", ")", ";", "}", "}", "elementsToRefresh", "=", "this", ".", "state", ".", "removeExternalElementsToRefresh", "(", ")", ";", "if", "(", "elementsToRefresh", "!=", "null", ")", "{", "hasDelta", "|=", "createExternalArchiveDelta", "(", "elementsToRefresh", ",", "null", ")", ";", "}", "if", "(", "!", "hasDelta", ")", "this", ".", "currentDelta", "=", "null", ";", "}", "IJavaElementDelta", "translatedDelta", "=", "processResourceDelta", "(", "delta", ")", ";", "if", "(", "translatedDelta", "!=", "null", ")", "{", "registerJavaModelDelta", "(", "translatedDelta", ")", ";", "}", "}", "finally", "{", "this", ".", "sourceElementParserCache", "=", "null", ";", "startDeltas", "(", ")", ";", "}", "IElementChangedListener", "[", "]", "listeners", ";", "int", "listenerCount", ";", "synchronized", "(", "this", ".", "state", ")", "{", "listeners", "=", "this", ".", "state", ".", "elementChangedListeners", ";", "listenerCount", "=", "this", ".", "state", ".", "elementChangedListenerCount", ";", "}", "notifyTypeHierarchies", "(", "listeners", ",", "listenerCount", ")", ";", "fire", "(", "null", ",", "ElementChangedEvent", ".", "POST_CHANGE", ")", ";", "}", "finally", "{", "this", ".", "state", ".", "resetOldJavaProjectNames", "(", ")", ";", "this", ".", "oldRoots", "=", "null", ";", "}", "}", "return", ";", "case", "IResourceChangeEvent", ".", "PRE_BUILD", ":", "this", ".", "state", ".", "initializeRoots", "(", "false", ")", ";", "boolean", "isAffected", "=", "isAffectedBy", "(", "delta", ")", ";", "boolean", "needCycleValidation", "=", "isAffected", "&&", "validateClasspaths", "(", "delta", ")", ";", "ExternalFolderChange", "[", "]", "folderChanges", "=", "this", ".", "state", ".", "removeExternalFolderChanges", "(", ")", ";", "if", "(", "folderChanges", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "folderChanges", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "try", "{", "folderChanges", "[", "i", "]", ".", "updateExternalFoldersIfNecessary", "(", "false", ",", "null", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "!", "e", ".", "isDoesNotExist", "(", ")", ")", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "}", "}", "ClasspathValidation", "[", "]", "validations", "=", "this", ".", "state", ".", "removeClasspathValidations", "(", ")", ";", "if", "(", "validations", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "validations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "ClasspathValidation", "validation", "=", "validations", "[", "i", "]", ";", "validation", ".", "validate", "(", ")", ";", "}", "}", "ProjectReferenceChange", "[", "]", "projectRefChanges", "=", "this", ".", "state", ".", "removeProjectReferenceChanges", "(", ")", ";", "if", "(", "projectRefChanges", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projectRefChanges", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "try", "{", "projectRefChanges", "[", "i", "]", ".", "updateProjectReferencesIfNecessary", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "if", "(", "!", "e", ".", "isDoesNotExist", "(", ")", ")", "Util", ".", "log", "(", "e", ",", "\"\"", ")", ";", "}", "}", "}", "if", "(", "needCycleValidation", "||", "projectRefChanges", "!=", "null", ")", "{", "try", "{", "JavaProject", ".", "validateCycles", "(", "null", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "if", "(", "isAffected", ")", "{", "JavaModel", ".", "flushExternalFileCache", "(", ")", ";", "JavaBuilder", ".", "buildStarting", "(", ")", ";", "}", "return", ";", "case", "IResourceChangeEvent", ".", "POST_BUILD", ":", "JavaBuilder", ".", "buildFinished", "(", ")", ";", "return", ";", "}", "}", "private", "RootInfo", "rootInfo", "(", "IPath", "path", ",", "int", "kind", ")", "{", "if", "(", "kind", "==", "IResourceDelta", ".", "REMOVED", ")", "{", "return", "(", "RootInfo", ")", "this", ".", "state", ".", "oldRoots", ".", "get", "(", "path", ")", ";", "}", "return", "(", "RootInfo", ")", "this", ".", "state", ".", "roots", ".", "get", "(", "path", ")", ";", "}", "private", "void", "startDeltas", "(", ")", "{", "this", ".", "isFiring", "=", "true", ";", "}", "private", "void", "stopDeltas", "(", ")", "{", "this", ".", "isFiring", "=", "false", ";", "}", "private", "void", "traverseDelta", "(", "IResourceDelta", "delta", ",", "int", "elementType", ",", "RootInfo", "rootInfo", ",", "OutputsInfo", "outputsInfo", ")", "{", "IResource", "res", "=", "delta", ".", "getResource", "(", ")", ";", "if", "(", "this", ".", "currentElement", "==", "null", "&&", "rootInfo", "!=", "null", ")", "{", "this", ".", "currentElement", "=", "rootInfo", ".", "project", ";", "}", "boolean", "processChildren", "=", "true", ";", "if", "(", "res", "instanceof", "IProject", ")", "{", "this", ".", "sourceElementParserCache", "=", "null", ";", "processChildren", "=", "updateCurrentDeltaAndIndex", "(", "delta", ",", "elementType", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", "?", "IJavaElement", ".", "JAVA_PROJECT", ":", "elementType", ",", "rootInfo", ")", ";", "}", "else", "if", "(", "rootInfo", "!=", "null", ")", "{", "processChildren", "=", "updateCurrentDeltaAndIndex", "(", "delta", ",", "elementType", ",", "rootInfo", ")", ";", "}", "else", "{", "processChildren", "=", "true", ";", "}", "if", "(", "outputsInfo", "==", "null", ")", "outputsInfo", "=", "outputsInfo", "(", "rootInfo", ",", "res", ")", ";", "if", "(", "processChildren", ")", "{", "IResourceDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "boolean", "oneChildOnClasspath", "=", "false", ";", "int", "length", "=", "children", ".", "length", ";", "IResourceDelta", "[", "]", "orphanChildren", "=", "null", ";", "Openable", "parent", "=", "null", ";", "boolean", "isValidParent", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IResourceDelta", "child", "=", "children", "[", "i", "]", ";", "IResource", "childRes", "=", "child", ".", "getResource", "(", ")", ";", "checkSourceAttachmentChange", "(", "child", ",", "childRes", ")", ";", "IPath", "childPath", "=", "externalPath", "(", "childRes", ")", ";", "int", "childKind", "=", "child", ".", "getKind", "(", ")", ";", "RootInfo", "childRootInfo", "=", "rootInfo", "(", "childPath", ",", "childKind", ")", ";", "RootInfo", "originalChildRootInfo", "=", "childRootInfo", ";", "if", "(", "childRootInfo", "!=", "null", "&&", "!", "childRootInfo", ".", "isRootOfProject", "(", "childPath", ")", ")", "{", "childRootInfo", "=", "null", ";", "}", "int", "childType", "=", "elementType", "(", "childRes", ",", "childKind", ",", "elementType", ",", "rootInfo", "==", "null", "?", "childRootInfo", ":", "rootInfo", ")", ";", "boolean", "isResFilteredFromOutput", "=", "isResFilteredFromOutput", "(", "rootInfo", ",", "outputsInfo", ",", "childRes", ",", "childType", ")", ";", "boolean", "isNestedRoot", "=", "rootInfo", "!=", "null", "&&", "childRootInfo", "!=", "null", ";", "if", "(", "!", "isResFilteredFromOutput", "&&", "!", "isNestedRoot", ")", "{", "traverseDelta", "(", "child", ",", "childType", ",", "rootInfo", "==", "null", "?", "childRootInfo", ":", "rootInfo", ",", "outputsInfo", ")", ";", "if", "(", "childType", "==", "NON_JAVA_RESOURCE", ")", "{", "if", "(", "rootInfo", "!=", "null", ")", "{", "if", "(", "!", "isValidParent", ")", "continue", ";", "if", "(", "parent", "==", "null", ")", "{", "if", "(", "this", ".", "currentElement", "==", "null", "||", "!", "rootInfo", ".", "project", ".", "equals", "(", "this", ".", "currentElement", ".", "getJavaProject", "(", ")", ")", ")", "{", "this", ".", "currentElement", "=", "rootInfo", ".", "project", ";", "}", "if", "(", "elementType", "==", "IJavaElement", ".", "JAVA_PROJECT", "||", "(", "elementType", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", "&&", "res", "instanceof", "IProject", ")", ")", "{", "parent", "=", "rootInfo", ".", "project", ";", "}", "else", "{", "parent", "=", "createElement", "(", "res", ",", "elementType", ",", "rootInfo", ")", ";", "}", "if", "(", "parent", "==", "null", ")", "{", "isValidParent", "=", "false", ";", "continue", ";", "}", "}", "try", "{", "nonJavaResourcesChanged", "(", "parent", ",", "child", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "else", "{", "if", "(", "orphanChildren", "==", "null", ")", "orphanChildren", "=", "new", "IResourceDelta", "[", "length", "]", ";", "orphanChildren", "[", "i", "]", "=", "child", ";", "}", "}", "else", "{", "if", "(", "rootInfo", "==", "null", "&&", "childRootInfo", "==", "null", ")", "{", "if", "(", "orphanChildren", "==", "null", ")", "orphanChildren", "=", "new", "IResourceDelta", "[", "length", "]", ";", "orphanChildren", "[", "i", "]", "=", "child", ";", "}", "}", "}", "else", "{", "oneChildOnClasspath", "=", "true", ";", "}", "if", "(", "isNestedRoot", "||", "(", "childRootInfo", "==", "null", "&&", "originalChildRootInfo", "!=", "null", ")", ")", "{", "traverseDelta", "(", "child", ",", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ",", "originalChildRootInfo", ",", "null", ")", ";", "}", "ArrayList", "rootList", ";", "if", "(", "(", "rootList", "=", "otherRootsInfo", "(", "childPath", ",", "childKind", ")", ")", "!=", "null", ")", "{", "Iterator", "iterator", "=", "rootList", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "originalChildRootInfo", "=", "(", "RootInfo", ")", "iterator", ".", "next", "(", ")", ";", "this", ".", "currentElement", "=", "null", ";", "traverseDelta", "(", "child", ",", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ",", "originalChildRootInfo", ",", "null", ")", ";", "}", "}", "}", "if", "(", "orphanChildren", "!=", "null", "&&", "(", "oneChildOnClasspath", "||", "res", "instanceof", "IProject", ")", ")", "{", "IProject", "rscProject", "=", "res", ".", "getProject", "(", ")", ";", "JavaProject", "adoptiveProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "rscProject", ")", ";", "if", "(", "adoptiveProject", "!=", "null", "&&", "JavaProject", ".", "hasJavaNature", "(", "rscProject", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "orphanChildren", "[", "i", "]", "!=", "null", ")", "{", "try", "{", "nonJavaResourcesChanged", "(", "adoptiveProject", ",", "orphanChildren", "[", "i", "]", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "}", "}", "}", "}", "private", "void", "validateClasspaths", "(", "IResourceDelta", "delta", ",", "HashSet", "affectedProjects", ")", "{", "IResource", "resource", "=", "delta", ".", "getResource", "(", ")", ";", "boolean", "processChildren", "=", "false", ";", "switch", "(", "resource", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "ROOT", ":", "if", "(", "delta", ".", "getKind", "(", ")", "==", "IResourceDelta", ".", "CHANGED", ")", "{", "processChildren", "=", "true", ";", "}", "break", ";", "case", "IResource", ".", "PROJECT", ":", "IProject", "project", "=", "(", "IProject", ")", "resource", ";", "int", "kind", "=", "delta", ".", "getKind", "(", ")", ";", "boolean", "isJavaProject", "=", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ";", "switch", "(", "kind", ")", "{", "case", "IResourceDelta", ".", "ADDED", ":", "processChildren", "=", "isJavaProject", ";", "affectedProjects", ".", "add", "(", "project", ".", "getFullPath", "(", ")", ")", ";", "break", ";", "case", "IResourceDelta", ".", "CHANGED", ":", "processChildren", "=", "isJavaProject", ";", "if", "(", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "OPEN", ")", "!=", "0", ")", "{", "if", "(", "isJavaProject", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "project", ")", ";", "this", ".", "state", ".", "addClasspathValidation", "(", "javaProject", ")", ";", "}", "affectedProjects", ".", "add", "(", "project", ".", "getFullPath", "(", ")", ")", ";", "}", "else", "if", "(", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "DESCRIPTION", ")", "!=", "0", ")", "{", "boolean", "wasJavaProject", "=", "this", ".", "state", ".", "findJavaProject", "(", "project", ".", "getName", "(", ")", ")", "!=", "null", ";", "if", "(", "wasJavaProject", "!=", "isJavaProject", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "project", ")", ";", "this", ".", "state", ".", "addClasspathValidation", "(", "javaProject", ")", ";", "affectedProjects", ".", "add", "(", "project", ".", "getFullPath", "(", ")", ")", ";", "}", "}", "break", ";", "case", "IResourceDelta", ".", "REMOVED", ":", "affectedProjects", ".", "add", "(", "project", ".", "getFullPath", "(", ")", ")", ";", "break", ";", "}", "break", ";", "case", "IResource", ".", "FILE", ":", "IFile", "file", "=", "(", "IFile", ")", "resource", ";", "String", "fileName", "=", "file", ".", "getName", "(", ")", ";", "RootInfo", "rootInfo", "=", "null", ";", "if", "(", "fileName", ".", "equals", "(", "JavaProject", ".", "CLASSPATH_FILENAME", ")", "||", "(", "(", "rootInfo", "=", "rootInfo", "(", "file", ".", "getFullPath", "(", ")", ",", "delta", ".", "getKind", "(", ")", ")", ")", "!=", "null", "&&", "rootInfo", ".", "entryKind", "==", "IClasspathEntry", ".", "CPE_LIBRARY", ")", ")", "{", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "file", ".", "getProject", "(", ")", ")", ";", "this", ".", "state", ".", "addClasspathValidation", "(", "javaProject", ")", ";", "affectedProjects", ".", "add", "(", "file", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ")", ";", "}", "break", ";", "}", "if", "(", "processChildren", ")", "{", "IResourceDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "validateClasspaths", "(", "children", "[", "i", "]", ",", "affectedProjects", ")", ";", "}", "}", "}", "private", "boolean", "validateClasspaths", "(", "IResourceDelta", "delta", ")", "{", "HashSet", "affectedProjects", "=", "new", "HashSet", "(", "5", ")", ";", "validateClasspaths", "(", "delta", ",", "affectedProjects", ")", ";", "boolean", "needCycleValidation", "=", "false", ";", "if", "(", "!", "affectedProjects", ".", "isEmpty", "(", ")", ")", "{", "IWorkspaceRoot", "workspaceRoot", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "IProject", "[", "]", "projects", "=", "workspaceRoot", ".", "getProjects", "(", ")", ";", "int", "length", "=", "projects", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IProject", "project", "=", "projects", "[", "i", "]", ";", "JavaProject", "javaProject", "=", "(", "JavaProject", ")", "JavaCore", ".", "create", "(", "project", ")", ";", "try", "{", "IPath", "projectPath", "=", "project", ".", "getFullPath", "(", ")", ";", "IClasspathEntry", "[", "]", "classpath", "=", "javaProject", ".", "getResolvedClasspath", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "cpLength", "=", "classpath", ".", "length", ";", "j", "<", "cpLength", ";", "j", "++", ")", "{", "IClasspathEntry", "entry", "=", "classpath", "[", "j", "]", ";", "switch", "(", "entry", ".", "getEntryKind", "(", ")", ")", "{", "case", "IClasspathEntry", ".", "CPE_PROJECT", ":", "if", "(", "affectedProjects", ".", "contains", "(", "entry", ".", "getPath", "(", ")", ")", ")", "{", "this", ".", "state", ".", "addClasspathValidation", "(", "javaProject", ")", ";", "needCycleValidation", "=", "true", ";", "}", "break", ";", "case", "IClasspathEntry", ".", "CPE_LIBRARY", ":", "IPath", "entryPath", "=", "entry", ".", "getPath", "(", ")", ";", "IPath", "libProjectPath", "=", "entryPath", ".", "removeLastSegments", "(", "entryPath", ".", "segmentCount", "(", ")", "-", "1", ")", ";", "if", "(", "!", "libProjectPath", ".", "equals", "(", "projectPath", ")", "&&", "affectedProjects", ".", "contains", "(", "libProjectPath", ")", ")", "{", "this", ".", "state", ".", "addClasspathValidation", "(", "javaProject", ")", ";", "}", "break", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "}", "return", "needCycleValidation", ";", "}", "public", "boolean", "updateCurrentDeltaAndIndex", "(", "IResourceDelta", "delta", ",", "int", "elementType", ",", "RootInfo", "rootInfo", ")", "{", "Openable", "element", ";", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "ADDED", ":", "IResource", "deltaRes", "=", "delta", ".", "getResource", "(", ")", ";", "element", "=", "createElement", "(", "deltaRes", ",", "elementType", ",", "rootInfo", ")", ";", "if", "(", "element", "==", "null", ")", "{", "this", ".", "state", ".", "updateRoots", "(", "deltaRes", ".", "getFullPath", "(", ")", ",", "delta", ",", "this", ")", ";", "return", "rootInfo", "!=", "null", "&&", "rootInfo", ".", "inclusionPatterns", "!=", "null", ";", "}", "updateIndex", "(", "element", ",", "delta", ")", ";", "elementAdded", "(", "element", ",", "delta", ",", "rootInfo", ")", ";", "if", "(", "elementType", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", "this", ".", "state", ".", "addClasspathValidation", "(", "rootInfo", ".", "project", ")", ";", "return", "elementType", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT", ";", "case", "IResourceDelta", ".", "REMOVED", ":", "deltaRes", "=", "delta", ".", "getResource", "(", ")", ";", "element", "=", "createElement", "(", "deltaRes", ",", "elementType", ",", "rootInfo", ")", ";", "if", "(", "element", "==", "null", ")", "{", "this", ".", "state", ".", "updateRoots", "(", "deltaRes", ".", "getFullPath", "(", ")", ",", "delta", ",", "this", ")", ";", "return", "rootInfo", "!=", "null", "&&", "rootInfo", ".", "inclusionPatterns", "!=", "null", ";", "}", "updateIndex", "(", "element", ",", "delta", ")", ";", "elementRemoved", "(", "element", ",", "delta", ",", "rootInfo", ")", ";", "if", "(", "elementType", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", "this", ".", "state", ".", "addClasspathValidation", "(", "rootInfo", ".", "project", ")", ";", "if", "(", "deltaRes", ".", "getType", "(", ")", "==", "IResource", ".", "PROJECT", ")", "{", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "deltaRes", ")", ";", "this", ".", "manager", ".", "setLastBuiltState", "(", "(", "IProject", ")", "deltaRes", ",", "null", ")", ";", "this", ".", "manager", ".", "previousSessionContainers", ".", "remove", "(", "element", ")", ";", "}", "return", "elementType", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT", ";", "case", "IResourceDelta", ".", "CHANGED", ":", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "elementType", "==", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", "&&", "(", "flags", "&", "IResourceDelta", ".", "LOCAL_CHANGED", ")", "!=", "0", ")", "{", "if", "(", "oldRootInfo", "(", "rootInfo", ".", "rootPath", ",", "rootInfo", ".", "project", ")", "==", "null", ")", "{", "break", ";", "}", "deltaRes", "=", "delta", ".", "getResource", "(", ")", ";", "Object", "target", "=", "JavaModel", ".", "getExternalTarget", "(", "deltaRes", ".", "getLocation", "(", ")", ",", "true", ")", ";", "element", "=", "createElement", "(", "deltaRes", ",", "elementType", ",", "rootInfo", ")", ";", "updateIndex", "(", "element", ",", "delta", ")", ";", "if", "(", "target", "!=", "null", ")", "{", "elementAdded", "(", "element", ",", "delta", ",", "rootInfo", ")", ";", "}", "else", "{", "elementRemoved", "(", "element", ",", "delta", ",", "rootInfo", ")", ";", "}", "this", ".", "state", ".", "addClasspathValidation", "(", "rootInfo", ".", "project", ")", ";", "}", "else", "if", "(", "(", "flags", "&", "IResourceDelta", ".", "CONTENT", ")", "!=", "0", "||", "(", "flags", "&", "IResourceDelta", ".", "ENCODING", ")", "!=", "0", ")", "{", "element", "=", "createElement", "(", "delta", ".", "getResource", "(", ")", ",", "elementType", ",", "rootInfo", ")", ";", "if", "(", "element", "==", "null", ")", "return", "false", ";", "updateIndex", "(", "element", ",", "delta", ")", ";", "contentChanged", "(", "element", ")", ";", "}", "else", "if", "(", "elementType", "==", "IJavaElement", ".", "JAVA_PROJECT", ")", "{", "if", "(", "(", "flags", "&", "IResourceDelta", ".", "OPEN", ")", "!=", "0", ")", "{", "IProject", "res", "=", "(", "IProject", ")", "delta", ".", "getResource", "(", ")", ";", "element", "=", "createElement", "(", "res", ",", "elementType", ",", "rootInfo", ")", ";", "if", "(", "element", "==", "null", ")", "{", "this", ".", "state", ".", "updateRoots", "(", "res", ".", "getFullPath", "(", ")", ",", "delta", ",", "this", ")", ";", "return", "false", ";", "}", "if", "(", "res", ".", "isOpen", "(", ")", ")", "{", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "res", ")", ")", "{", "addToParentInfo", "(", "element", ")", ";", "currentDelta", "(", ")", ".", "opened", "(", "element", ")", ";", "this", ".", "state", ".", "updateRoots", "(", "element", ".", "getPath", "(", ")", ",", "delta", ",", "this", ")", ";", "this", ".", "projectCachesToReset", ".", "add", "(", "element", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "indexAll", "(", "res", ")", ";", "}", "}", "else", "{", "boolean", "wasJavaProject", "=", "this", ".", "state", ".", "findJavaProject", "(", "res", ".", "getName", "(", ")", ")", "!=", "null", ";", "if", "(", "wasJavaProject", ")", "{", "close", "(", "element", ")", ";", "removeFromParentInfo", "(", "element", ")", ";", "currentDelta", "(", ")", ".", "closed", "(", "element", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "discardJobs", "(", "element", ".", "getElementName", "(", ")", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "removeIndexFamily", "(", "res", ".", "getFullPath", "(", ")", ")", ";", "}", "}", "return", "false", ";", "}", "if", "(", "(", "flags", "&", "IResourceDelta", ".", "DESCRIPTION", ")", "!=", "0", ")", "{", "IProject", "res", "=", "(", "IProject", ")", "delta", ".", "getResource", "(", ")", ";", "boolean", "wasJavaProject", "=", "this", ".", "state", ".", "findJavaProject", "(", "res", ".", "getName", "(", ")", ")", "!=", "null", ";", "boolean", "isJavaProject", "=", "JavaProject", ".", "hasJavaNature", "(", "res", ")", ";", "if", "(", "wasJavaProject", "!=", "isJavaProject", ")", "{", "element", "=", "createElement", "(", "res", ",", "elementType", ",", "rootInfo", ")", ";", "if", "(", "element", "==", "null", ")", "return", "false", ";", "if", "(", "isJavaProject", ")", "{", "elementAdded", "(", "element", ",", "delta", ",", "rootInfo", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "indexAll", "(", "res", ")", ";", "}", "else", "{", "elementRemoved", "(", "element", ",", "delta", ",", "rootInfo", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "discardJobs", "(", "element", ".", "getElementName", "(", ")", ")", ";", "this", ".", "manager", ".", "indexManager", ".", "removeIndexFamily", "(", "res", ".", "getFullPath", "(", ")", ")", ";", "if", "(", "JavaBuilder", ".", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "res", ")", ";", "this", ".", "manager", ".", "setLastBuiltState", "(", "res", ",", "null", ")", ";", "}", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}", "return", "true", ";", "}", "private", "void", "updateIndex", "(", "Openable", "element", ",", "IResourceDelta", "delta", ")", "{", "IndexManager", "indexManager", "=", "this", ".", "manager", ".", "indexManager", ";", "if", "(", "indexManager", "==", "null", ")", "return", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "ADDED", ":", "indexManager", ".", "indexAll", "(", "element", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ")", ";", "break", ";", "case", "IResourceDelta", ".", "REMOVED", ":", "indexManager", ".", "removeIndexFamily", "(", "element", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ")", ";", "break", ";", "}", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "if", "(", "element", "instanceof", "JarPackageFragmentRoot", ")", "{", "JarPackageFragmentRoot", "root", "=", "(", "JarPackageFragmentRoot", ")", "element", ";", "IPath", "jarPath", "=", "root", ".", "getPath", "(", ")", ";", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "ADDED", ":", "indexManager", ".", "indexLibrary", "(", "jarPath", ",", "root", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ")", ";", "break", ";", "case", "IResourceDelta", ".", "CHANGED", ":", "indexManager", ".", "removeIndex", "(", "jarPath", ")", ";", "indexManager", ".", "indexLibrary", "(", "jarPath", ",", "root", ".", "getJavaProject", "(", ")", ".", "getProject", "(", ")", ")", ";", "break", ";", "case", "IResourceDelta", ".", "REMOVED", ":", "indexManager", ".", "discardJobs", "(", "jarPath", ".", "toString", "(", ")", ")", ";", "indexManager", ".", "removeIndex", "(", "jarPath", ")", ";", "break", ";", "}", "break", ";", "}", "int", "kind", "=", "delta", ".", "getKind", "(", ")", ";", "if", "(", "kind", "==", "IResourceDelta", ".", "ADDED", "||", "kind", "==", "IResourceDelta", ".", "REMOVED", "||", "(", "kind", "==", "IResourceDelta", ".", "CHANGED", "&&", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "LOCAL_CHANGED", ")", "!=", "0", ")", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "element", ";", "updateRootIndex", "(", "root", ",", "CharOperation", ".", "NO_STRINGS", ",", "delta", ")", ";", "break", ";", "}", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "CHANGED", ":", "if", "(", "(", "delta", ".", "getFlags", "(", ")", "&", "IResourceDelta", ".", "LOCAL_CHANGED", ")", "==", "0", ")", "break", ";", "case", "IResourceDelta", ".", "ADDED", ":", "case", "IResourceDelta", ".", "REMOVED", ":", "IPackageFragment", "pkg", "=", "null", ";", "if", "(", "element", "instanceof", "IPackageFragmentRoot", ")", "{", "PackageFragmentRoot", "root", "=", "(", "PackageFragmentRoot", ")", "element", ";", "pkg", "=", "root", ".", "getPackageFragment", "(", "CharOperation", ".", "NO_STRINGS", ")", ";", "}", "else", "{", "pkg", "=", "(", "IPackageFragment", ")", "element", ";", "}", "RootInfo", "rootInfo", "=", "rootInfo", "(", "pkg", ".", "getParent", "(", ")", ".", "getPath", "(", ")", ",", "delta", ".", "getKind", "(", ")", ")", ";", "boolean", "isSource", "=", "rootInfo", "==", "null", "||", "rootInfo", ".", "entryKind", "==", "IClasspathEntry", ".", "CPE_SOURCE", ";", "IResourceDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IResourceDelta", "child", "=", "children", "[", "i", "]", ";", "IResource", "resource", "=", "child", ".", "getResource", "(", ")", ";", "if", "(", "resource", "instanceof", "IFile", ")", "{", "String", "name", "=", "resource", ".", "getName", "(", ")", ";", "if", "(", "isSource", ")", "{", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ".", "isJavaLikeFileName", "(", "name", ")", ")", "{", "Openable", "cu", "=", "(", "Openable", ")", "pkg", ".", "getCompilationUnit", "(", "name", ")", ";", "updateIndex", "(", "cu", ",", "child", ")", ";", "}", "}", "else", "if", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "isClassFileName", "(", "name", ")", ")", "{", "Openable", "classFile", "=", "(", "Openable", ")", "pkg", ".", "getClassFile", "(", "name", ")", ";", "updateIndex", "(", "classFile", ",", "child", ")", ";", "}", "}", "}", "break", ";", "}", "break", ";", "case", "IJavaElement", ".", "CLASS_FILE", ":", "IFile", "file", "=", "(", "IFile", ")", "delta", ".", "getResource", "(", ")", ";", "IJavaProject", "project", "=", "element", ".", "getJavaProject", "(", ")", ";", "PackageFragmentRoot", "root", "=", "element", ".", "getPackageFragmentRoot", "(", ")", ";", "IPath", "binaryFolderPath", "=", "root", ".", "isExternal", "(", ")", "&&", "!", "root", ".", "isArchive", "(", ")", "?", "root", ".", "resource", "(", ")", ".", "getFullPath", "(", ")", ":", "root", ".", "getPath", "(", ")", ";", "try", "{", "if", "(", "binaryFolderPath", ".", "equals", "(", "project", ".", "getOutputLocation", "(", ")", ")", ")", "{", "break", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "CHANGED", ":", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "(", "flags", "&", "IResourceDelta", ".", "CONTENT", ")", "==", "0", "&&", "(", "flags", "&", "IResourceDelta", ".", "ENCODING", ")", "==", "0", ")", "break", ";", "case", "IResourceDelta", ".", "ADDED", ":", "indexManager", ".", "addBinary", "(", "file", ",", "binaryFolderPath", ")", ";", "break", ";", "case", "IResourceDelta", ".", "REMOVED", ":", "String", "containerRelativePath", "=", "Util", ".", "relativePath", "(", "file", ".", "getFullPath", "(", ")", ",", "binaryFolderPath", ".", "segmentCount", "(", ")", ")", ";", "indexManager", ".", "remove", "(", "containerRelativePath", ",", "binaryFolderPath", ")", ";", "break", ";", "}", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "file", "=", "(", "IFile", ")", "delta", ".", "getResource", "(", ")", ";", "switch", "(", "delta", ".", "getKind", "(", ")", ")", "{", "case", "IResourceDelta", ".", "CHANGED", ":", "int", "flags", "=", "delta", ".", "getFlags", "(", ")", ";", "if", "(", "(", "flags", "&", "IResourceDelta", ".", "CONTENT", ")", "==", "0", "&&", "(", "flags", "&", "IResourceDelta", ".", "ENCODING", ")", "==", "0", ")", "break", ";", "case", "IResourceDelta", ".", "ADDED", ":", "indexManager", ".", "addSource", "(", "file", ",", "file", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ",", "getSourceElementParser", "(", "element", ")", ")", ";", "this", ".", "manager", ".", "secondaryTypesRemoving", "(", "file", ",", "false", ")", ";", "break", ";", "case", "IResourceDelta", ".", "REMOVED", ":", "indexManager", ".", "remove", "(", "Util", ".", "relativePath", "(", "file", ".", "getFullPath", "(", ")", ",", "1", ")", ",", "file", ".", "getProject", "(", ")", ".", "getFullPath", "(", ")", ")", ";", "this", ".", "manager", ".", "secondaryTypesRemoving", "(", "file", ",", "true", ")", ";", "break", ";", "}", "}", "}", "public", "void", "updateJavaModel", "(", "IJavaElementDelta", "customDelta", ")", "{", "if", "(", "customDelta", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "javaModelDeltas", ".", "size", "(", ")", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IJavaElementDelta", "delta", "=", "(", "IJavaElementDelta", ")", "this", ".", "javaModelDeltas", ".", "get", "(", "i", ")", ";", "this", ".", "modelUpdater", ".", "processJavaDelta", "(", "delta", ")", ";", "}", "}", "else", "{", "this", ".", "modelUpdater", ".", "processJavaDelta", "(", "customDelta", ")", ";", "}", "}", "private", "void", "updateRootIndex", "(", "PackageFragmentRoot", "root", ",", "String", "[", "]", "pkgName", ",", "IResourceDelta", "delta", ")", "{", "Openable", "pkg", "=", "root", ".", "getPackageFragment", "(", "pkgName", ")", ";", "updateIndex", "(", "pkg", ",", "delta", ")", ";", "IResourceDelta", "[", "]", "children", "=", "delta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IResourceDelta", "child", "=", "children", "[", "i", "]", ";", "IResource", "resource", "=", "child", ".", "getResource", "(", ")", ";", "if", "(", "resource", "instanceof", "IFolder", ")", "{", "String", "[", "]", "subpkgName", "=", "Util", ".", "arrayConcat", "(", "pkgName", ",", "resource", ".", "getName", "(", ")", ")", ";", "updateRootIndex", "(", "root", ",", "subpkgName", ",", "child", ")", ";", "}", "}", "}", "}", "</s>" ]
3,782
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathContainer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IClasspathEntry", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaProject", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "SetContainerOperation", "extends", "ChangeClasspathOperation", "{", "IPath", "containerPath", ";", "IJavaProject", "[", "]", "affectedProjects", ";", "IClasspathContainer", "[", "]", "respectiveContainers", ";", "public", "SetContainerOperation", "(", "IPath", "containerPath", ",", "IJavaProject", "[", "]", "affectedProjects", ",", "IClasspathContainer", "[", "]", "respectiveContainers", ")", "{", "super", "(", "new", "IJavaElement", "[", "]", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getJavaModel", "(", ")", "}", ",", "!", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "isTreeLocked", "(", ")", ")", ";", "this", ".", "containerPath", "=", "containerPath", ";", "this", ".", "affectedProjects", "=", "affectedProjects", ";", "this", ".", "respectiveContainers", "=", "respectiveContainers", ";", "}", "protected", "void", "executeOperation", "(", ")", "throws", "JavaModelException", "{", "checkCanceled", "(", ")", ";", "try", "{", "beginTask", "(", "\"\"", ",", "1", ")", ";", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", ")", "verbose_set_container", "(", ")", ";", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_ADVANCED", ")", "verbose_set_container_invocation_trace", "(", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "if", "(", "manager", ".", "containerPutIfInitializingWithSameEntries", "(", "this", ".", "containerPath", ",", "this", ".", "affectedProjects", ",", "this", ".", "respectiveContainers", ")", ")", "return", ";", "final", "int", "projectLength", "=", "this", ".", "affectedProjects", ".", "length", ";", "final", "IJavaProject", "[", "]", "modifiedProjects", ";", "System", ".", "arraycopy", "(", "this", ".", "affectedProjects", ",", "0", ",", "modifiedProjects", "=", "new", "IJavaProject", "[", "projectLength", "]", ",", "0", ",", "projectLength", ")", ";", "int", "remaining", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projectLength", ";", "i", "++", ")", "{", "if", "(", "isCanceled", "(", ")", ")", "return", ";", "JavaProject", "affectedProject", "=", "(", "JavaProject", ")", "this", ".", "affectedProjects", "[", "i", "]", ";", "IClasspathContainer", "newContainer", "=", "this", ".", "respectiveContainers", "[", "i", "]", ";", "if", "(", "newContainer", "==", "null", ")", "newContainer", "=", "JavaModelManager", ".", "CONTAINER_INITIALIZATION_IN_PROGRESS", ";", "boolean", "found", "=", "false", ";", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "affectedProject", ".", "getProject", "(", ")", ")", ")", "{", "IClasspathEntry", "[", "]", "rawClasspath", "=", "affectedProject", ".", "getRawClasspath", "(", ")", ";", "for", "(", "int", "j", "=", "0", ",", "cpLength", "=", "rawClasspath", ".", "length", ";", "j", "<", "cpLength", ";", "j", "++", ")", "{", "IClasspathEntry", "entry", "=", "rawClasspath", "[", "j", "]", ";", "if", "(", "entry", ".", "getEntryKind", "(", ")", "==", "IClasspathEntry", ".", "CPE_CONTAINER", "&&", "entry", ".", "getPath", "(", ")", ".", "equals", "(", "this", ".", "containerPath", ")", ")", "{", "found", "=", "true", ";", "break", ";", "}", "}", "}", "if", "(", "!", "found", ")", "{", "modifiedProjects", "[", "i", "]", "=", "null", ";", "manager", ".", "containerPut", "(", "affectedProject", ",", "this", ".", "containerPath", ",", "newContainer", ")", ";", "continue", ";", "}", "IClasspathContainer", "oldContainer", "=", "manager", ".", "containerGet", "(", "affectedProject", ",", "this", ".", "containerPath", ")", ";", "if", "(", "oldContainer", "==", "JavaModelManager", ".", "CONTAINER_INITIALIZATION_IN_PROGRESS", ")", "{", "oldContainer", "=", "null", ";", "}", "if", "(", "(", "oldContainer", "!=", "null", "&&", "oldContainer", ".", "equals", "(", "this", ".", "respectiveContainers", "[", "i", "]", ")", ")", "||", "(", "oldContainer", "==", "this", ".", "respectiveContainers", "[", "i", "]", ")", ")", "{", "modifiedProjects", "[", "i", "]", "=", "null", ";", "continue", ";", "}", "remaining", "++", ";", "manager", ".", "containerPut", "(", "affectedProject", ",", "this", ".", "containerPath", ",", "newContainer", ")", ";", "}", "if", "(", "remaining", "==", "0", ")", "return", ";", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projectLength", ";", "i", "++", ")", "{", "if", "(", "isCanceled", "(", ")", ")", "return", ";", "JavaProject", "affectedProject", "=", "(", "JavaProject", ")", "modifiedProjects", "[", "i", "]", ";", "if", "(", "affectedProject", "==", "null", ")", "continue", ";", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_ADVANCED", ")", "verbose_update_project", "(", "affectedProject", ")", ";", "ClasspathChange", "classpathChange", "=", "affectedProject", ".", "getPerProjectInfo", "(", ")", ".", "resetResolvedClasspath", "(", ")", ";", "classpathChanged", "(", "classpathChange", ",", "i", "==", "0", ")", ";", "if", "(", "this", ".", "canChangeResources", ")", "{", "try", "{", "affectedProject", ".", "getProject", "(", ")", ".", "touch", "(", "this", ".", "progressMonitor", ")", ";", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "!", "ExternalJavaProject", ".", "EXTERNAL_PROJECT_NAME", ".", "equals", "(", "affectedProject", ".", "getElementName", "(", ")", ")", ")", "throw", "e", ";", "}", "}", "}", "}", "catch", "(", "CoreException", "e", ")", "{", "if", "(", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE", "||", "JavaModelManager", ".", "CP_RESOLVE_VERBOSE_FAILURE", ")", "verbose_failure", "(", "e", ")", ";", "if", "(", "e", "instanceof", "JavaModelException", ")", "{", "throw", "(", "JavaModelException", ")", "e", ";", "}", "else", "{", "throw", "new", "JavaModelException", "(", "e", ")", ";", "}", "}", "finally", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "projectLength", ";", "i", "++", ")", "{", "if", "(", "this", ".", "respectiveContainers", "[", "i", "]", "==", "null", ")", "{", "manager", ".", "containerPut", "(", "this", ".", "affectedProjects", "[", "i", "]", ",", "this", ".", "containerPath", ",", "null", ")", ";", "}", "}", "}", "}", "finally", "{", "done", "(", ")", ";", "}", "}", "private", "void", "verbose_failure", "(", "CoreException", "e", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"\"", "+", "this", ".", "containerPath", ",", "System", ".", "err", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "private", "void", "verbose_update_project", "(", "JavaProject", "affectedProject", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"tproject:", "\"", "+", "affectedProject", ".", "getElementName", "(", ")", "+", "'\\n'", "+", "\"\"", "+", "this", ".", "containerPath", ")", ";", "}", "private", "void", "verbose_set_container", "(", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"\"", "+", "this", ".", "containerPath", "+", "'\\n'", "+", "\"tprojects:", "{\"", "+", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "toString", "(", "this", ".", "affectedProjects", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "Displayable", "(", ")", "{", "public", "String", "displayString", "(", "Object", "o", ")", "{", "return", "(", "(", "IJavaProject", ")", "o", ")", ".", "getElementName", "(", ")", ";", "}", "}", ")", "+", "\"\"", "+", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "toString", "(", "this", ".", "respectiveContainers", ",", "new", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ".", "Displayable", "(", ")", "{", "public", "String", "displayString", "(", "Object", "o", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"tt\"", ")", ";", "if", "(", "o", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"<null>\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "IClasspathContainer", "container", "=", "(", "IClasspathContainer", ")", "o", ";", "buffer", ".", "append", "(", "container", ".", "getDescription", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"", "{n\"", ")", ";", "IClasspathEntry", "[", "]", "entries", "=", "container", ".", "getClasspathEntries", "(", ")", ";", "if", "(", "entries", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "entries", ".", "length", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "\"", "ttt\"", ")", ";", "buffer", ".", "append", "(", "entries", "[", "i", "]", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "}", "}", "buffer", ".", "append", "(", "\"", "tt}\"", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", ")", "+", "\"nt}\"", ")", ";", "}", "private", "void", "verbose_set_container_invocation_trace", "(", ")", "{", "Util", ".", "verbose", "(", "\"\"", "+", "\"\"", ")", ";", "new", "Exception", "(", "\"\"", ")", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "}", "</s>" ]
3,783
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IField", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IType", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "FieldDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "SimpleName", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "VariableDeclarationFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "CreateFieldOperation", "extends", "CreateTypeMemberOperation", "{", "public", "CreateFieldOperation", "(", "IType", "parentElement", ",", "String", "source", ",", "boolean", "force", ")", "{", "super", "(", "parentElement", ",", "source", ",", "force", ")", ";", "}", "protected", "ASTNode", "generateElementAST", "(", "ASTRewrite", "rewriter", ",", "ICompilationUnit", "cu", ")", "throws", "JavaModelException", "{", "ASTNode", "node", "=", "super", ".", "generateElementAST", "(", "rewriter", ",", "cu", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "!=", "ASTNode", ".", "FIELD_DECLARATION", ")", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_CONTENTS", ")", ")", ";", "return", "node", ";", "}", "protected", "IJavaElement", "generateResultHandle", "(", ")", "{", "return", "getType", "(", ")", ".", "getField", "(", "getASTNodeName", "(", ")", ")", ";", "}", "public", "String", "getMainTaskName", "(", ")", "{", "return", "Messages", ".", "operation_createFieldProgress", ";", "}", "private", "VariableDeclarationFragment", "getFragment", "(", "ASTNode", "node", ")", "{", "Iterator", "fragments", "=", "(", "(", "FieldDeclaration", ")", "node", ")", ".", "fragments", "(", ")", ".", "iterator", "(", ")", ";", "if", "(", "this", ".", "anchorElement", "!=", "null", ")", "{", "VariableDeclarationFragment", "fragment", "=", "null", ";", "String", "fragmentName", "=", "this", ".", "anchorElement", ".", "getElementName", "(", ")", ";", "while", "(", "fragments", ".", "hasNext", "(", ")", ")", "{", "fragment", "=", "(", "VariableDeclarationFragment", ")", "fragments", ".", "next", "(", ")", ";", "if", "(", "fragment", ".", "getName", "(", ")", ".", "getIdentifier", "(", ")", ".", "equals", "(", "fragmentName", ")", ")", "{", "return", "fragment", ";", "}", "}", "return", "fragment", ";", "}", "else", "{", "return", "(", "VariableDeclarationFragment", ")", "fragments", ".", "next", "(", ")", ";", "}", "}", "protected", "void", "initializeDefaultPosition", "(", ")", "{", "IType", "parentElement", "=", "getType", "(", ")", ";", "try", "{", "IField", "[", "]", "fields", "=", "parentElement", ".", "getFields", "(", ")", ";", "if", "(", "fields", "!=", "null", "&&", "fields", ".", "length", ">", "0", ")", "{", "final", "IField", "lastField", "=", "fields", "[", "fields", ".", "length", "-", "1", "]", ";", "if", "(", "parentElement", ".", "isEnum", "(", ")", ")", "{", "IField", "field", "=", "lastField", ";", "if", "(", "!", "field", ".", "isEnumConstant", "(", ")", ")", "{", "createAfter", "(", "lastField", ")", ";", "}", "}", "else", "{", "createAfter", "(", "lastField", ")", ";", "}", "}", "else", "{", "IJavaElement", "[", "]", "elements", "=", "parentElement", ".", "getChildren", "(", ")", ";", "if", "(", "elements", "!=", "null", "&&", "elements", ".", "length", ">", "0", ")", "{", "createBefore", "(", "elements", "[", "0", "]", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "protected", "IJavaModelStatus", "verifyNameCollision", "(", ")", "{", "if", "(", "this", ".", "createdNode", "!=", "null", ")", "{", "IType", "type", "=", "getType", "(", ")", ";", "String", "fieldName", "=", "getASTNodeName", "(", ")", ";", "if", "(", "type", ".", "getField", "(", "fieldName", ")", ".", "exists", "(", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "Messages", ".", "bind", "(", "Messages", ".", "status_nameCollision", ",", "fieldName", ")", ")", ";", "}", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "private", "String", "getASTNodeName", "(", ")", "{", "if", "(", "this", ".", "alteredName", "!=", "null", ")", "return", "this", ".", "alteredName", ";", "return", "getFragment", "(", "this", ".", "createdNode", ")", ".", "getName", "(", ")", ".", "getIdentifier", "(", ")", ";", "}", "protected", "SimpleName", "rename", "(", "ASTNode", "node", ",", "SimpleName", "newName", ")", "{", "VariableDeclarationFragment", "fragment", "=", "getFragment", "(", "node", ")", ";", "SimpleName", "oldName", "=", "fragment", ".", "getName", "(", ")", ";", "fragment", ".", "setName", "(", "newName", ")", ";", "return", "oldName", ";", "}", "}", "</s>" ]
3,784
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "public", "class", "ResolvedSourceType", "extends", "SourceType", "{", "private", "String", "uniqueKey", ";", "public", "ResolvedSourceType", "(", "JavaElement", "parent", ",", "String", "name", ",", "String", "uniqueKey", ")", "{", "super", "(", "parent", ",", "name", ")", ";", "this", ".", "uniqueKey", "=", "uniqueKey", ";", "}", "public", "String", "getFullyQualifiedParameterizedName", "(", ")", "throws", "JavaModelException", "{", "return", "getFullyQualifiedParameterizedName", "(", "getFullyQualifiedName", "(", "'.'", ")", ",", "this", ".", "uniqueKey", ")", ";", "}", "public", "String", "getKey", "(", ")", "{", "return", "this", ".", "uniqueKey", ";", "}", "public", "boolean", "isResolved", "(", ")", "{", "return", "true", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "super", ".", "toStringInfo", "(", "tab", ",", "buffer", ",", "info", ",", "showResolvedInfo", ")", ";", "if", "(", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "\"", "{key=\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "getKey", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"}\"", ")", ";", "}", "}", "public", "JavaElement", "unresolved", "(", ")", "{", "SourceRefElement", "handle", "=", "new", "SourceType", "(", "this", ".", "parent", ",", "this", ".", "name", ")", ";", "handle", ".", "occurrenceCount", "=", "this", ".", "occurrenceCount", ";", "return", "handle", ";", "}", "}", "</s>" ]
3,785
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "public", "class", "BecomeWorkingCopyOperation", "extends", "JavaModelOperation", "{", "IProblemRequestor", "problemRequestor", ";", "public", "BecomeWorkingCopyOperation", "(", "CompilationUnit", "workingCopy", ",", "IProblemRequestor", "problemRequestor", ")", "{", "super", "(", "new", "IJavaElement", "[", "]", "{", "workingCopy", "}", ")", ";", "this", ".", "problemRequestor", "=", "problemRequestor", ";", "}", "protected", "void", "executeOperation", "(", ")", "throws", "JavaModelException", "{", "CompilationUnit", "workingCopy", "=", "getWorkingCopy", "(", ")", ";", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getPerWorkingCopyInfo", "(", "workingCopy", ",", "true", ",", "true", ",", "this", ".", "problemRequestor", ")", ";", "workingCopy", ".", "openWhenClosed", "(", "workingCopy", ".", "createElementInfo", "(", ")", ",", "this", ".", "progressMonitor", ")", ";", "if", "(", "!", "workingCopy", ".", "isPrimary", "(", ")", ")", "{", "JavaElementDelta", "delta", "=", "new", "JavaElementDelta", "(", "getJavaModel", "(", ")", ")", ";", "delta", ".", "added", "(", "workingCopy", ")", ";", "addDelta", "(", "delta", ")", ";", "}", "else", "{", "if", "(", "workingCopy", ".", "getResource", "(", ")", ".", "isAccessible", "(", ")", ")", "{", "JavaElementDelta", "delta", "=", "new", "JavaElementDelta", "(", "getJavaModel", "(", ")", ")", ";", "delta", ".", "changed", "(", "workingCopy", ",", "IJavaElementDelta", ".", "F_PRIMARY_WORKING_COPY", ")", ";", "addDelta", "(", "delta", ")", ";", "}", "else", "{", "JavaElementDelta", "delta", "=", "new", "JavaElementDelta", "(", "getJavaModel", "(", ")", ")", ";", "delta", ".", "added", "(", "workingCopy", ",", "IJavaElementDelta", ".", "F_PRIMARY_WORKING_COPY", ")", ";", "addDelta", "(", "delta", ")", ";", "}", "}", "this", ".", "resultElements", "=", "new", "IJavaElement", "[", "]", "{", "workingCopy", "}", ";", "}", "protected", "CompilationUnit", "getWorkingCopy", "(", ")", "{", "return", "(", "CompilationUnit", ")", "getElementToProcess", "(", ")", ";", "}", "public", "boolean", "isReadOnly", "(", ")", "{", "return", "true", ";", "}", "}", "</s>" ]
3,786
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "public", "abstract", "class", "MultiOperation", "extends", "JavaModelOperation", "{", "protected", "Map", "insertBeforeElements", "=", "new", "HashMap", "(", "1", ")", ";", "protected", "Map", "newParents", ";", "protected", "Map", "renamings", ";", "protected", "String", "[", "]", "renamingsList", "=", "null", ";", "protected", "MultiOperation", "(", "IJavaElement", "[", "]", "elementsToProcess", ",", "boolean", "force", ")", "{", "super", "(", "elementsToProcess", ",", "force", ")", ";", "}", "protected", "MultiOperation", "(", "IJavaElement", "[", "]", "elementsToProcess", ",", "IJavaElement", "[", "]", "parentElements", ",", "boolean", "force", ")", "{", "super", "(", "elementsToProcess", ",", "parentElements", ",", "force", ")", ";", "this", ".", "newParents", "=", "new", "HashMap", "(", "elementsToProcess", ".", "length", ")", ";", "if", "(", "elementsToProcess", ".", "length", "==", "parentElements", ".", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elementsToProcess", ".", "length", ";", "i", "++", ")", "{", "this", ".", "newParents", ".", "put", "(", "elementsToProcess", "[", "i", "]", ",", "parentElements", "[", "i", "]", ")", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elementsToProcess", ".", "length", ";", "i", "++", ")", "{", "this", ".", "newParents", ".", "put", "(", "elementsToProcess", "[", "i", "]", ",", "parentElements", "[", "0", "]", ")", ";", "}", "}", "}", "protected", "void", "error", "(", "int", "code", ",", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "code", ",", "element", ")", ")", ";", "}", "protected", "void", "executeOperation", "(", ")", "throws", "JavaModelException", "{", "processElements", "(", ")", ";", "}", "protected", "IJavaElement", "getDestinationParent", "(", "IJavaElement", "child", ")", "{", "return", "(", "IJavaElement", ")", "this", ".", "newParents", ".", "get", "(", "child", ")", ";", "}", "protected", "abstract", "String", "getMainTaskName", "(", ")", ";", "protected", "String", "getNewNameFor", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "String", "newName", "=", "null", ";", "if", "(", "this", ".", "renamings", "!=", "null", ")", "newName", "=", "(", "String", ")", "this", ".", "renamings", ".", "get", "(", "element", ")", ";", "if", "(", "newName", "==", "null", "&&", "element", "instanceof", "IMethod", "&&", "(", "(", "IMethod", ")", "element", ")", ".", "isConstructor", "(", ")", ")", "newName", "=", "getDestinationParent", "(", "element", ")", ".", "getElementName", "(", ")", ";", "return", "newName", ";", "}", "private", "void", "initializeRenamings", "(", ")", "{", "if", "(", "this", ".", "renamingsList", "!=", "null", "&&", "this", ".", "renamingsList", ".", "length", "==", "this", ".", "elementsToProcess", ".", "length", ")", "{", "this", ".", "renamings", "=", "new", "HashMap", "(", "this", ".", "renamingsList", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "renamingsList", ".", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "renamingsList", "[", "i", "]", "!=", "null", ")", "{", "this", ".", "renamings", ".", "put", "(", "this", ".", "elementsToProcess", "[", "i", "]", ",", "this", ".", "renamingsList", "[", "i", "]", ")", ";", "}", "}", "}", "}", "protected", "boolean", "isMove", "(", ")", "{", "return", "false", ";", "}", "protected", "boolean", "isRename", "(", ")", "{", "return", "false", ";", "}", "protected", "abstract", "void", "processElement", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", ";", "protected", "void", "processElements", "(", ")", "throws", "JavaModelException", "{", "try", "{", "beginTask", "(", "getMainTaskName", "(", ")", ",", "this", ".", "elementsToProcess", ".", "length", ")", ";", "IJavaModelStatus", "[", "]", "errors", "=", "new", "IJavaModelStatus", "[", "3", "]", ";", "int", "errorsCounter", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "elementsToProcess", ".", "length", ";", "i", "++", ")", "{", "try", "{", "verify", "(", "this", ".", "elementsToProcess", "[", "i", "]", ")", ";", "processElement", "(", "this", ".", "elementsToProcess", "[", "i", "]", ")", ";", "}", "catch", "(", "JavaModelException", "jme", ")", "{", "if", "(", "errorsCounter", "==", "errors", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "errors", ",", "0", ",", "(", "errors", "=", "new", "IJavaModelStatus", "[", "errorsCounter", "*", "2", "]", ")", ",", "0", ",", "errorsCounter", ")", ";", "}", "errors", "[", "errorsCounter", "++", "]", "=", "jme", ".", "getJavaModelStatus", "(", ")", ";", "}", "finally", "{", "worked", "(", "1", ")", ";", "}", "}", "if", "(", "errorsCounter", "==", "1", ")", "{", "throw", "new", "JavaModelException", "(", "errors", "[", "0", "]", ")", ";", "}", "else", "if", "(", "errorsCounter", ">", "1", ")", "{", "if", "(", "errorsCounter", "!=", "errors", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "errors", ",", "0", ",", "(", "errors", "=", "new", "IJavaModelStatus", "[", "errorsCounter", "]", ")", ",", "0", ",", "errorsCounter", ")", ";", "}", "throw", "new", "JavaModelException", "(", "JavaModelStatus", ".", "newMultiStatus", "(", "errors", ")", ")", ";", "}", "}", "finally", "{", "done", "(", ")", ";", "}", "}", "public", "void", "setInsertBefore", "(", "IJavaElement", "modifiedElement", ",", "IJavaElement", "newSibling", ")", "{", "this", ".", "insertBeforeElements", ".", "put", "(", "modifiedElement", ",", "newSibling", ")", ";", "}", "public", "void", "setRenamings", "(", "String", "[", "]", "renamingsList", ")", "{", "this", ".", "renamingsList", "=", "renamingsList", ";", "initializeRenamings", "(", ")", ";", "}", "protected", "abstract", "void", "verify", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", ";", "protected", "void", "verifyDestination", "(", "IJavaElement", "element", ",", "IJavaElement", "destination", ")", "throws", "JavaModelException", "{", "if", "(", "destination", "==", "null", "||", "!", "destination", ".", "exists", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "ELEMENT_DOES_NOT_EXIST", ",", "destination", ")", ";", "int", "destType", "=", "destination", ".", "getElementType", "(", ")", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "PACKAGE_DECLARATION", ":", "case", "IJavaElement", ".", "IMPORT_DECLARATION", ":", "if", "(", "destType", "!=", "IJavaElement", ".", "COMPILATION_UNIT", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_DESTINATION", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "TYPE", ":", "if", "(", "destType", "!=", "IJavaElement", ".", "COMPILATION_UNIT", "&&", "destType", "!=", "IJavaElement", ".", "TYPE", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_DESTINATION", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "METHOD", ":", "case", "IJavaElement", ".", "FIELD", ":", "case", "IJavaElement", ".", "INITIALIZER", ":", "if", "(", "destType", "!=", "IJavaElement", ".", "TYPE", "||", "destination", "instanceof", "BinaryType", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_DESTINATION", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "if", "(", "destType", "!=", "IJavaElement", ".", "PACKAGE_FRAGMENT", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_DESTINATION", ",", "element", ")", ";", "else", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "element", ";", "if", "(", "isMove", "(", ")", "&&", "cu", ".", "isWorkingCopy", "(", ")", "&&", "!", "cu", ".", "isPrimary", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ";", "}", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "IPackageFragment", "fragment", "=", "(", "IPackageFragment", ")", "element", ";", "IJavaElement", "parent", "=", "fragment", ".", "getParent", "(", ")", ";", "if", "(", "parent", ".", "isReadOnly", "(", ")", ")", "error", "(", "IJavaModelStatusConstants", ".", "READ_ONLY", ",", "element", ")", ";", "else", "if", "(", "destType", "!=", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ")", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_DESTINATION", ",", "element", ")", ";", "break", ";", "default", ":", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_ELEMENT_TYPES", ",", "element", ")", ";", "}", "}", "protected", "void", "verifyRenaming", "(", "IJavaElement", "element", ")", "throws", "JavaModelException", "{", "String", "newName", "=", "getNewNameFor", "(", "element", ")", ";", "boolean", "isValid", "=", "true", ";", "IJavaProject", "project", "=", "element", ".", "getJavaProject", "(", ")", ";", "String", "sourceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_SOURCE", ",", "true", ")", ";", "String", "complianceLevel", "=", "project", ".", "getOption", "(", "JavaCore", ".", "COMPILER_COMPLIANCE", ",", "true", ")", ";", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "if", "(", "(", "(", "IPackageFragment", ")", "element", ")", ".", "isDefaultPackage", "(", ")", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NAME_COLLISION", ",", "element", ")", ")", ";", "}", "isValid", "=", "JavaConventions", ".", "validatePackageName", "(", "newName", ",", "sourceLevel", ",", "complianceLevel", ")", ".", "getSeverity", "(", ")", "!=", "IStatus", ".", "ERROR", ";", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "isValid", "=", "JavaConventions", ".", "validateCompilationUnitName", "(", "newName", ",", "sourceLevel", ",", "complianceLevel", ")", ".", "getSeverity", "(", ")", "!=", "IStatus", ".", "ERROR", ";", "break", ";", "case", "IJavaElement", ".", "INITIALIZER", ":", "isValid", "=", "false", ";", "break", ";", "default", ":", "isValid", "=", "JavaConventions", ".", "validateIdentifier", "(", "newName", ",", "sourceLevel", ",", "complianceLevel", ")", ".", "getSeverity", "(", ")", "!=", "IStatus", ".", "ERROR", ";", "break", ";", "}", "if", "(", "!", "isValid", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_NAME", ",", "element", ",", "newName", ")", ")", ";", "}", "}", "protected", "void", "verifySibling", "(", "IJavaElement", "element", ",", "IJavaElement", "destination", ")", "throws", "JavaModelException", "{", "IJavaElement", "insertBeforeElement", "=", "(", "IJavaElement", ")", "this", ".", "insertBeforeElements", ".", "get", "(", "element", ")", ";", "if", "(", "insertBeforeElement", "!=", "null", ")", "{", "if", "(", "!", "insertBeforeElement", ".", "exists", "(", ")", "||", "!", "insertBeforeElement", ".", "getParent", "(", ")", ".", "equals", "(", "destination", ")", ")", "{", "error", "(", "IJavaModelStatusConstants", ".", "INVALID_SIBLING", ",", "insertBeforeElement", ")", ";", "}", "}", "}", "}", "</s>" ]
3,787
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "MoveResourceElementsOperation", "extends", "CopyResourceElementsOperation", "{", "public", "MoveResourceElementsOperation", "(", "IJavaElement", "[", "]", "elementsToMove", ",", "IJavaElement", "[", "]", "destContainers", ",", "boolean", "force", ")", "{", "super", "(", "elementsToMove", ",", "destContainers", ",", "force", ")", ";", "}", "protected", "String", "getMainTaskName", "(", ")", "{", "return", "Messages", ".", "operation_moveResourceProgress", ";", "}", "protected", "boolean", "isMove", "(", ")", "{", "return", "true", ";", "}", "}", "</s>" ]
3,788
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "Binding", ";", "public", "class", "SourceField", "extends", "NamedMember", "implements", "IField", "{", "protected", "SourceField", "(", "JavaElement", "parent", ",", "String", "name", ")", "{", "super", "(", "parent", ",", "name", ")", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "SourceField", ")", ")", "return", "false", ";", "return", "super", ".", "equals", "(", "o", ")", ";", "}", "public", "ASTNode", "findNode", "(", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", "ast", ")", "{", "ASTNode", "node", "=", "super", ".", "findNode", "(", "ast", ")", ";", "if", "(", "node", "==", "null", ")", "return", "null", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "ASTNode", ".", "ENUM_CONSTANT_DECLARATION", ")", "{", "return", "node", ";", "}", "return", "node", ".", "getParent", "(", ")", ";", "}", "public", "Object", "getConstant", "(", ")", "throws", "JavaModelException", "{", "Object", "constant", "=", "null", ";", "SourceFieldElementInfo", "info", "=", "(", "SourceFieldElementInfo", ")", "getElementInfo", "(", ")", ";", "final", "char", "[", "]", "constantSourceChars", "=", "info", ".", "initializationSource", ";", "if", "(", "constantSourceChars", "==", "null", ")", "{", "return", "null", ";", "}", "String", "constantSource", "=", "new", "String", "(", "constantSourceChars", ")", ";", "String", "signature", "=", "info", ".", "getTypeSignature", "(", ")", ";", "try", "{", "if", "(", "signature", ".", "equals", "(", "Signature", ".", "SIG_INT", ")", ")", "{", "constant", "=", "new", "Integer", "(", "constantSource", ")", ";", "}", "else", "if", "(", "signature", ".", "equals", "(", "Signature", ".", "SIG_SHORT", ")", ")", "{", "constant", "=", "new", "Short", "(", "constantSource", ")", ";", "}", "else", "if", "(", "signature", ".", "equals", "(", "Signature", ".", "SIG_BYTE", ")", ")", "{", "constant", "=", "new", "Byte", "(", "constantSource", ")", ";", "}", "else", "if", "(", "signature", ".", "equals", "(", "Signature", ".", "SIG_BOOLEAN", ")", ")", "{", "constant", "=", "Boolean", ".", "valueOf", "(", "constantSource", ")", ";", "}", "else", "if", "(", "signature", ".", "equals", "(", "Signature", ".", "SIG_CHAR", ")", ")", "{", "if", "(", "constantSourceChars", ".", "length", "!=", "3", ")", "{", "return", "null", ";", "}", "constant", "=", "new", "Character", "(", "constantSourceChars", "[", "1", "]", ")", ";", "}", "else", "if", "(", "signature", ".", "equals", "(", "Signature", ".", "SIG_DOUBLE", ")", ")", "{", "constant", "=", "new", "Double", "(", "constantSource", ")", ";", "}", "else", "if", "(", "signature", ".", "equals", "(", "Signature", ".", "SIG_FLOAT", ")", ")", "{", "constant", "=", "new", "Float", "(", "constantSource", ")", ";", "}", "else", "if", "(", "signature", ".", "equals", "(", "Signature", ".", "SIG_LONG", ")", ")", "{", "if", "(", "constantSource", ".", "endsWith", "(", "\"L\"", ")", "||", "constantSource", ".", "endsWith", "(", "\"l\"", ")", ")", "{", "int", "index", "=", "constantSource", ".", "lastIndexOf", "(", "\"L\"", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "constant", "=", "new", "Long", "(", "constantSource", ".", "substring", "(", "0", ",", "index", ")", ")", ";", "}", "else", "{", "constant", "=", "new", "Long", "(", "constantSource", ".", "substring", "(", "0", ",", "constantSource", ".", "lastIndexOf", "(", "\"l\"", ")", ")", ")", ";", "}", "}", "else", "{", "constant", "=", "new", "Long", "(", "constantSource", ")", ";", "}", "}", "else", "if", "(", "signature", ".", "equals", "(", "\"QString;\"", ")", ")", "{", "constant", "=", "constantSource", ";", "}", "else", "if", "(", "signature", ".", "equals", "(", "\"\"", ")", ")", "{", "constant", "=", "constantSource", ";", "}", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "null", ";", "}", "return", "constant", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "FIELD", ";", "}", "public", "String", "getKey", "(", ")", "{", "try", "{", "return", "getKey", "(", "this", ",", "false", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JavaElement", ".", "JEM_FIELD", ";", "}", "public", "IJavaElement", "getPrimaryElement", "(", "boolean", "checkOwner", ")", "{", "if", "(", "checkOwner", ")", "{", "CompilationUnit", "cu", "=", "(", "CompilationUnit", ")", "getAncestor", "(", "COMPILATION_UNIT", ")", ";", "if", "(", "cu", ".", "isPrimary", "(", ")", ")", "return", "this", ";", "}", "IJavaElement", "primaryParent", "=", "this", ".", "parent", ".", "getPrimaryElement", "(", "false", ")", ";", "return", "(", "(", "IType", ")", "primaryParent", ")", ".", "getField", "(", "this", ".", "name", ")", ";", "}", "public", "String", "getTypeSignature", "(", ")", "throws", "JavaModelException", "{", "SourceFieldElementInfo", "info", "=", "(", "SourceFieldElementInfo", ")", "getElementInfo", "(", ")", ";", "return", "info", ".", "getTypeSignature", "(", ")", ";", "}", "public", "boolean", "isEnumConstant", "(", ")", "throws", "JavaModelException", "{", "return", "Flags", ".", "isEnum", "(", "getFlags", "(", ")", ")", ";", "}", "public", "boolean", "isResolved", "(", ")", "{", "return", "false", ";", "}", "public", "JavaElement", "resolved", "(", "Binding", "binding", ")", "{", "SourceRefElement", "resolvedHandle", "=", "new", "ResolvedSourceField", "(", "this", ".", "parent", ",", "this", ".", "name", ",", "new", "String", "(", "binding", ".", "computeUniqueKey", "(", ")", ")", ")", ";", "resolvedHandle", ".", "occurrenceCount", "=", "this", ".", "occurrenceCount", ";", "return", "resolvedHandle", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "if", "(", "info", "==", "null", ")", "{", "toStringName", "(", "buffer", ")", ";", "buffer", ".", "append", "(", "\"", "(not", "open)\"", ")", ";", "}", "else", "if", "(", "info", "==", "NO_INFO", ")", "{", "toStringName", "(", "buffer", ")", ";", "}", "else", "{", "try", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "getTypeSignature", "(", ")", ")", ")", ";", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "toStringName", "(", "buffer", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "buffer", ".", "append", "(", "\"\"", "+", "getElementName", "(", ")", ")", ";", "}", "}", "}", "}", "</s>" ]
3,789
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "public", "class", "TypeParameterElementInfo", "extends", "SourceRefElementInfo", "{", "public", "int", "nameStart", "=", "-", "1", ";", "public", "int", "nameEnd", "=", "-", "1", ";", "public", "char", "[", "]", "[", "]", "bounds", ";", "public", "char", "[", "]", "[", "]", "boundsSignatures", ";", "}", "</s>" ]
3,790
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "jobs", ".", "ISchedulingRule", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatus", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "AST", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ASTParser", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "ChildListPropertyDescriptor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "CompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "StructuralPropertyDescriptor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ASTRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "dom", ".", "rewrite", ".", "ListRewrite", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "import", "org", ".", "eclipse", ".", "text", ".", "edits", ".", "TextEdit", ";", "public", "abstract", "class", "CreateElementInCUOperation", "extends", "JavaModelOperation", "{", "protected", "CompilationUnit", "cuAST", ";", "protected", "static", "final", "int", "INSERT_LAST", "=", "1", ";", "protected", "static", "final", "int", "INSERT_AFTER", "=", "2", ";", "protected", "static", "final", "int", "INSERT_BEFORE", "=", "3", ";", "protected", "int", "insertionPolicy", "=", "INSERT_LAST", ";", "protected", "IJavaElement", "anchorElement", "=", "null", ";", "protected", "boolean", "creationOccurred", "=", "true", ";", "public", "CreateElementInCUOperation", "(", "IJavaElement", "parentElement", ")", "{", "super", "(", "null", ",", "new", "IJavaElement", "[", "]", "{", "parentElement", "}", ")", ";", "initializeDefaultPosition", "(", ")", ";", "}", "protected", "void", "checkCanceled", "(", ")", "{", "if", "(", "!", "this", ".", "isNested", ")", "{", "super", ".", "checkCanceled", "(", ")", ";", "}", "}", "public", "void", "createAfter", "(", "IJavaElement", "sibling", ")", "{", "setRelativePosition", "(", "sibling", ",", "INSERT_AFTER", ")", ";", "}", "public", "void", "createBefore", "(", "IJavaElement", "sibling", ")", "{", "setRelativePosition", "(", "sibling", ",", "INSERT_BEFORE", ")", ";", "}", "protected", "void", "executeOperation", "(", ")", "throws", "JavaModelException", "{", "try", "{", "beginTask", "(", "getMainTaskName", "(", ")", ",", "getMainAmountOfWork", "(", ")", ")", ";", "JavaElementDelta", "delta", "=", "newJavaElementDelta", "(", ")", ";", "ICompilationUnit", "unit", "=", "getCompilationUnit", "(", ")", ";", "generateNewCompilationUnitAST", "(", "unit", ")", ";", "if", "(", "this", ".", "creationOccurred", ")", "{", "unit", ".", "save", "(", "null", ",", "false", ")", ";", "boolean", "isWorkingCopy", "=", "unit", ".", "isWorkingCopy", "(", ")", ";", "if", "(", "!", "isWorkingCopy", ")", "setAttribute", "(", "HAS_MODIFIED_RESOURCE_ATTR", ",", "TRUE", ")", ";", "worked", "(", "1", ")", ";", "this", ".", "resultElements", "=", "generateResultHandles", "(", ")", ";", "if", "(", "!", "isWorkingCopy", "&&", "!", "Util", ".", "isExcluded", "(", "unit", ")", "&&", "unit", ".", "getParent", "(", ")", ".", "exists", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "resultElements", ".", "length", ";", "i", "++", ")", "{", "delta", ".", "added", "(", "this", ".", "resultElements", "[", "i", "]", ")", ";", "}", "addDelta", "(", "delta", ")", ";", "}", "}", "}", "finally", "{", "done", "(", ")", ";", "}", "}", "protected", "abstract", "StructuralPropertyDescriptor", "getChildPropertyDescriptor", "(", "ASTNode", "parent", ")", ";", "protected", "abstract", "ASTNode", "generateElementAST", "(", "ASTRewrite", "rewriter", ",", "ICompilationUnit", "cu", ")", "throws", "JavaModelException", ";", "protected", "void", "generateNewCompilationUnitAST", "(", "ICompilationUnit", "cu", ")", "throws", "JavaModelException", "{", "this", ".", "cuAST", "=", "parse", "(", "cu", ")", ";", "AST", "ast", "=", "this", ".", "cuAST", ".", "getAST", "(", ")", ";", "ASTRewrite", "rewriter", "=", "ASTRewrite", ".", "create", "(", "ast", ")", ";", "ASTNode", "child", "=", "generateElementAST", "(", "rewriter", ",", "cu", ")", ";", "if", "(", "child", "!=", "null", ")", "{", "ASTNode", "parent", "=", "(", "(", "JavaElement", ")", "getParentElement", "(", ")", ")", ".", "findNode", "(", "this", ".", "cuAST", ")", ";", "if", "(", "parent", "==", "null", ")", "parent", "=", "this", ".", "cuAST", ";", "insertASTNode", "(", "rewriter", ",", "parent", ",", "child", ")", ";", "TextEdit", "edits", "=", "rewriter", ".", "rewriteAST", "(", ")", ";", "applyTextEdit", "(", "cu", ",", "edits", ")", ";", "}", "worked", "(", "1", ")", ";", "}", "protected", "abstract", "IJavaElement", "generateResultHandle", "(", ")", ";", "protected", "IJavaElement", "[", "]", "generateResultHandles", "(", ")", "{", "return", "new", "IJavaElement", "[", "]", "{", "generateResultHandle", "(", ")", "}", ";", "}", "protected", "ICompilationUnit", "getCompilationUnit", "(", ")", "{", "return", "getCompilationUnitFor", "(", "getParentElement", "(", ")", ")", ";", "}", "protected", "int", "getMainAmountOfWork", "(", ")", "{", "return", "2", ";", "}", "public", "abstract", "String", "getMainTaskName", "(", ")", ";", "protected", "ISchedulingRule", "getSchedulingRule", "(", ")", "{", "IResource", "resource", "=", "getCompilationUnit", "(", ")", ".", "getResource", "(", ")", ";", "IWorkspace", "workspace", "=", "resource", ".", "getWorkspace", "(", ")", ";", "return", "workspace", ".", "getRuleFactory", "(", ")", ".", "modifyRule", "(", "resource", ")", ";", "}", "protected", "void", "initializeDefaultPosition", "(", ")", "{", "}", "protected", "void", "insertASTNode", "(", "ASTRewrite", "rewriter", ",", "ASTNode", "parent", ",", "ASTNode", "child", ")", "throws", "JavaModelException", "{", "StructuralPropertyDescriptor", "propertyDescriptor", "=", "getChildPropertyDescriptor", "(", "parent", ")", ";", "if", "(", "propertyDescriptor", "instanceof", "ChildListPropertyDescriptor", ")", "{", "ChildListPropertyDescriptor", "childListPropertyDescriptor", "=", "(", "ChildListPropertyDescriptor", ")", "propertyDescriptor", ";", "ListRewrite", "rewrite", "=", "rewriter", ".", "getListRewrite", "(", "parent", ",", "childListPropertyDescriptor", ")", ";", "switch", "(", "this", ".", "insertionPolicy", ")", "{", "case", "INSERT_BEFORE", ":", "ASTNode", "element", "=", "(", "(", "JavaElement", ")", "this", ".", "anchorElement", ")", ".", "findNode", "(", "this", ".", "cuAST", ")", ";", "if", "(", "childListPropertyDescriptor", ".", "getElementType", "(", ")", ".", "isAssignableFrom", "(", "element", ".", "getClass", "(", ")", ")", ")", "rewrite", ".", "insertBefore", "(", "child", ",", "element", ",", "null", ")", ";", "else", "rewrite", ".", "insertLast", "(", "child", ",", "null", ")", ";", "break", ";", "case", "INSERT_AFTER", ":", "element", "=", "(", "(", "JavaElement", ")", "this", ".", "anchorElement", ")", ".", "findNode", "(", "this", ".", "cuAST", ")", ";", "if", "(", "childListPropertyDescriptor", ".", "getElementType", "(", ")", ".", "isAssignableFrom", "(", "element", ".", "getClass", "(", ")", ")", ")", "rewrite", ".", "insertAfter", "(", "child", ",", "element", ",", "null", ")", ";", "else", "rewrite", ".", "insertLast", "(", "child", ",", "null", ")", ";", "break", ";", "case", "INSERT_LAST", ":", "rewrite", ".", "insertLast", "(", "child", ",", "null", ")", ";", "break", ";", "}", "}", "else", "{", "rewriter", ".", "set", "(", "parent", ",", "propertyDescriptor", ",", "child", ",", "null", ")", ";", "}", "}", "protected", "CompilationUnit", "parse", "(", "ICompilationUnit", "cu", ")", "throws", "JavaModelException", "{", "cu", ".", "makeConsistent", "(", "this", ".", "progressMonitor", ")", ";", "ASTParser", "parser", "=", "ASTParser", ".", "newParser", "(", "AST", ".", "JLS4", ")", ";", "parser", ".", "setSource", "(", "cu", ")", ";", "return", "(", "CompilationUnit", ")", "parser", ".", "createAST", "(", "this", ".", "progressMonitor", ")", ";", "}", "protected", "void", "setAlteredName", "(", "String", "newName", ")", "{", "}", "protected", "void", "setRelativePosition", "(", "IJavaElement", "sibling", ",", "int", "policy", ")", "throws", "IllegalArgumentException", "{", "if", "(", "sibling", "==", "null", ")", "{", "this", ".", "anchorElement", "=", "null", ";", "this", ".", "insertionPolicy", "=", "INSERT_LAST", ";", "}", "else", "{", "this", ".", "anchorElement", "=", "sibling", ";", "this", ".", "insertionPolicy", "=", "policy", ";", "}", "}", "public", "IJavaModelStatus", "verify", "(", ")", "{", "if", "(", "getParentElement", "(", ")", "==", "null", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "NO_ELEMENTS_TO_PROCESS", ")", ";", "}", "if", "(", "this", ".", "anchorElement", "!=", "null", ")", "{", "IJavaElement", "domPresentParent", "=", "this", ".", "anchorElement", ".", "getParent", "(", ")", ";", "if", "(", "domPresentParent", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "IMPORT_CONTAINER", ")", "{", "domPresentParent", "=", "domPresentParent", ".", "getParent", "(", ")", ";", "}", "if", "(", "!", "domPresentParent", ".", "equals", "(", "getParentElement", "(", ")", ")", ")", "{", "return", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_SIBLING", ",", "this", ".", "anchorElement", ")", ";", "}", "}", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "}", "</s>" ]
3,791
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ASTNode", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ArrayInitializer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "ClassLiteralAccess", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Expression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Literal", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "NullLiteral", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "OperatorIds", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "QualifiedNameReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "SingleNameReference", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "UnaryExpression", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ExtraCompilerModifiers", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "parser", ".", "RecoveryScanner", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "MementoTokenizer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "LocalVariable", "extends", "SourceRefElement", "implements", "ILocalVariable", "{", "public", "static", "final", "ILocalVariable", "[", "]", "NO_LOCAL_VARIABLES", "=", "new", "ILocalVariable", "[", "0", "]", ";", "String", "name", ";", "public", "int", "declarationSourceStart", ",", "declarationSourceEnd", ";", "public", "int", "nameStart", ",", "nameEnd", ";", "String", "typeSignature", ";", "public", "IAnnotation", "[", "]", "annotations", ";", "private", "int", "flags", ";", "private", "boolean", "isParameter", ";", "public", "LocalVariable", "(", "JavaElement", "parent", ",", "String", "name", ",", "int", "declarationSourceStart", ",", "int", "declarationSourceEnd", ",", "int", "nameStart", ",", "int", "nameEnd", ",", "String", "typeSignature", ",", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", "[", "]", "astAnnotations", ",", "int", "flags", ",", "boolean", "isParameter", ")", "{", "super", "(", "parent", ")", ";", "this", ".", "name", "=", "name", ";", "this", ".", "declarationSourceStart", "=", "declarationSourceStart", ";", "this", ".", "declarationSourceEnd", "=", "declarationSourceEnd", ";", "this", ".", "nameStart", "=", "nameStart", ";", "this", ".", "nameEnd", "=", "nameEnd", ";", "this", ".", "typeSignature", "=", "typeSignature", ";", "this", ".", "annotations", "=", "getAnnotations", "(", "astAnnotations", ")", ";", "this", ".", "flags", "=", "flags", ";", "this", ".", "isParameter", "=", "isParameter", ";", "}", "protected", "void", "closing", "(", "Object", "info", ")", "{", "}", "protected", "Object", "createElementInfo", "(", ")", "{", "return", "null", ";", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "LocalVariable", ")", ")", "return", "false", ";", "LocalVariable", "other", "=", "(", "LocalVariable", ")", "o", ";", "return", "this", ".", "declarationSourceStart", "==", "other", ".", "declarationSourceStart", "&&", "this", ".", "declarationSourceEnd", "==", "other", ".", "declarationSourceEnd", "&&", "this", ".", "nameStart", "==", "other", ".", "nameStart", "&&", "this", ".", "nameEnd", "==", "other", ".", "nameEnd", "&&", "super", ".", "equals", "(", "o", ")", ";", "}", "public", "boolean", "exists", "(", ")", "{", "return", "this", ".", "parent", ".", "exists", "(", ")", ";", "}", "protected", "void", "generateInfos", "(", "Object", "info", ",", "HashMap", "newElements", ",", "IProgressMonitor", "pm", ")", "{", "}", "public", "IAnnotation", "getAnnotation", "(", "String", "annotationName", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "this", ".", "annotations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IAnnotation", "annotation", "=", "this", ".", "annotations", "[", "i", "]", ";", "if", "(", "annotation", ".", "getElementName", "(", ")", ".", "equals", "(", "annotationName", ")", ")", "return", "annotation", ";", "}", "return", "super", ".", "getAnnotation", "(", "annotationName", ")", ";", "}", "public", "IAnnotation", "[", "]", "getAnnotations", "(", ")", "throws", "JavaModelException", "{", "return", "this", ".", "annotations", ";", "}", "private", "IAnnotation", "[", "]", "getAnnotations", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", "[", "]", "astAnnotations", ")", "{", "int", "length", ";", "if", "(", "astAnnotations", "==", "null", "||", "(", "length", "=", "astAnnotations", ".", "length", ")", "==", "0", ")", "return", "Annotation", ".", "NO_ANNOTATIONS", ";", "IAnnotation", "[", "]", "result", "=", "new", "IAnnotation", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "getAnnotation", "(", "astAnnotations", "[", "i", "]", ",", "this", ")", ";", "}", "return", "result", ";", "}", "private", "IAnnotation", "getAnnotation", "(", "final", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", "annotation", ",", "JavaElement", "parentElement", ")", "{", "final", "int", "typeStart", "=", "annotation", ".", "type", ".", "sourceStart", "(", ")", ";", "final", "int", "typeEnd", "=", "annotation", ".", "type", ".", "sourceEnd", "(", ")", ";", "final", "int", "sourceStart", "=", "annotation", ".", "sourceStart", "(", ")", ";", "final", "int", "sourceEnd", "=", "annotation", ".", "declarationSourceEnd", ";", "class", "LocalVarAnnotation", "extends", "Annotation", "{", "IMemberValuePair", "[", "]", "memberValuePairs", ";", "public", "LocalVarAnnotation", "(", "JavaElement", "localVar", ",", "String", "elementName", ")", "{", "super", "(", "localVar", ",", "elementName", ")", ";", "}", "public", "IMemberValuePair", "[", "]", "getMemberValuePairs", "(", ")", "throws", "JavaModelException", "{", "return", "this", ".", "memberValuePairs", ";", "}", "public", "ISourceRange", "getNameRange", "(", ")", "throws", "JavaModelException", "{", "return", "new", "SourceRange", "(", "typeStart", ",", "typeEnd", "-", "typeStart", "+", "1", ")", ";", "}", "public", "ISourceRange", "getSourceRange", "(", ")", "throws", "JavaModelException", "{", "return", "new", "SourceRange", "(", "sourceStart", ",", "sourceEnd", "-", "sourceStart", "+", "1", ")", ";", "}", "public", "boolean", "exists", "(", ")", "{", "return", "this", ".", "parent", ".", "exists", "(", ")", ";", "}", "}", "String", "annotationName", "=", "new", "String", "(", "CharOperation", ".", "concatWith", "(", "annotation", ".", "type", ".", "getTypeName", "(", ")", ",", "'.'", ")", ")", ";", "LocalVarAnnotation", "localVarAnnotation", "=", "new", "LocalVarAnnotation", "(", "parentElement", ",", "annotationName", ")", ";", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MemberValuePair", "[", "]", "astMemberValuePairs", "=", "annotation", ".", "memberValuePairs", "(", ")", ";", "int", "length", ";", "IMemberValuePair", "[", "]", "memberValuePairs", ";", "if", "(", "astMemberValuePairs", "==", "null", "||", "(", "length", "=", "astMemberValuePairs", ".", "length", ")", "==", "0", ")", "{", "memberValuePairs", "=", "Annotation", ".", "NO_MEMBER_VALUE_PAIRS", ";", "}", "else", "{", "memberValuePairs", "=", "new", "IMemberValuePair", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "MemberValuePair", "astMemberValuePair", "=", "astMemberValuePairs", "[", "i", "]", ";", "MemberValuePair", "memberValuePair", "=", "new", "MemberValuePair", "(", "new", "String", "(", "astMemberValuePair", ".", "name", ")", ")", ";", "memberValuePair", ".", "value", "=", "getAnnotationMemberValue", "(", "memberValuePair", ",", "astMemberValuePair", ".", "value", ",", "localVarAnnotation", ")", ";", "memberValuePairs", "[", "i", "]", "=", "memberValuePair", ";", "}", "}", "localVarAnnotation", ".", "memberValuePairs", "=", "memberValuePairs", ";", "return", "localVarAnnotation", ";", "}", "private", "Object", "getAnnotationMemberValue", "(", "MemberValuePair", "memberValuePair", ",", "Expression", "expression", ",", "JavaElement", "parentElement", ")", "{", "if", "(", "expression", "instanceof", "NullLiteral", ")", "{", "return", "null", ";", "}", "else", "if", "(", "expression", "instanceof", "Literal", ")", "{", "(", "(", "Literal", ")", "expression", ")", ".", "computeConstant", "(", ")", ";", "return", "Util", ".", "getAnnotationMemberValue", "(", "memberValuePair", ",", "expression", ".", "constant", ")", ";", "}", "else", "if", "(", "expression", "instanceof", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", ")", "{", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_ANNOTATION", ";", "return", "getAnnotation", "(", "(", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "Annotation", ")", "expression", ",", "parentElement", ")", ";", "}", "else", "if", "(", "expression", "instanceof", "ClassLiteralAccess", ")", "{", "ClassLiteralAccess", "classLiteral", "=", "(", "ClassLiteralAccess", ")", "expression", ";", "char", "[", "]", "typeName", "=", "CharOperation", ".", "concatWith", "(", "classLiteral", ".", "type", ".", "getTypeName", "(", ")", ",", "'.'", ")", ";", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_CLASS", ";", "return", "new", "String", "(", "typeName", ")", ";", "}", "else", "if", "(", "expression", "instanceof", "QualifiedNameReference", ")", "{", "char", "[", "]", "qualifiedName", "=", "CharOperation", ".", "concatWith", "(", "(", "(", "QualifiedNameReference", ")", "expression", ")", ".", "tokens", ",", "'.'", ")", ";", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_QUALIFIED_NAME", ";", "return", "new", "String", "(", "qualifiedName", ")", ";", "}", "else", "if", "(", "expression", "instanceof", "SingleNameReference", ")", "{", "char", "[", "]", "simpleName", "=", "(", "(", "SingleNameReference", ")", "expression", ")", ".", "token", ";", "if", "(", "simpleName", "==", "RecoveryScanner", ".", "FAKE_IDENTIFIER", ")", "{", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_UNKNOWN", ";", "return", "null", ";", "}", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_SIMPLE_NAME", ";", "return", "new", "String", "(", "simpleName", ")", ";", "}", "else", "if", "(", "expression", "instanceof", "ArrayInitializer", ")", "{", "memberValuePair", ".", "valueKind", "=", "-", "1", ";", "Expression", "[", "]", "expressions", "=", "(", "(", "ArrayInitializer", ")", "expression", ")", ".", "expressions", ";", "int", "length", "=", "expressions", "==", "null", "?", "0", ":", "expressions", ".", "length", ";", "Object", "[", "]", "values", "=", "new", "Object", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "previousValueKind", "=", "memberValuePair", ".", "valueKind", ";", "Object", "value", "=", "getAnnotationMemberValue", "(", "memberValuePair", ",", "expressions", "[", "i", "]", ",", "parentElement", ")", ";", "if", "(", "previousValueKind", "!=", "-", "1", "&&", "memberValuePair", ".", "valueKind", "!=", "previousValueKind", ")", "{", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_UNKNOWN", ";", "}", "values", "[", "i", "]", "=", "value", ";", "}", "if", "(", "memberValuePair", ".", "valueKind", "==", "-", "1", ")", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_UNKNOWN", ";", "return", "values", ";", "}", "else", "if", "(", "expression", "instanceof", "UnaryExpression", ")", "{", "UnaryExpression", "unaryExpression", "=", "(", "UnaryExpression", ")", "expression", ";", "if", "(", "(", "unaryExpression", ".", "bits", "&", "ASTNode", ".", "OperatorMASK", ")", ">>", "ASTNode", ".", "OperatorSHIFT", "==", "OperatorIds", ".", "MINUS", ")", "{", "if", "(", "unaryExpression", ".", "expression", "instanceof", "Literal", ")", "{", "Literal", "subExpression", "=", "(", "Literal", ")", "unaryExpression", ".", "expression", ";", "subExpression", ".", "computeConstant", "(", ")", ";", "return", "Util", ".", "getNegativeAnnotationMemberValue", "(", "memberValuePair", ",", "subExpression", ".", "constant", ")", ";", "}", "}", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_UNKNOWN", ";", "return", "null", ";", "}", "else", "{", "memberValuePair", ".", "valueKind", "=", "IMemberValuePair", ".", "K_UNKNOWN", ";", "return", "null", ";", "}", "}", "public", "IJavaElement", "getHandleFromMemento", "(", "String", "token", ",", "MementoTokenizer", "memento", ",", "WorkingCopyOwner", "owner", ")", "{", "switch", "(", "token", ".", "charAt", "(", "0", ")", ")", "{", "case", "JEM_COUNT", ":", "return", "getHandleUpdatingCountFromMemento", "(", "memento", ",", "owner", ")", ";", "}", "return", "this", ";", "}", "protected", "void", "getHandleMemento", "(", "StringBuffer", "buff", ")", "{", "(", "(", "JavaElement", ")", "getParent", "(", ")", ")", ".", "getHandleMemento", "(", "buff", ")", ";", "buff", ".", "append", "(", "getHandleMementoDelimiter", "(", ")", ")", ";", "buff", ".", "append", "(", "this", ".", "name", ")", ";", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "declarationSourceStart", ")", ";", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "declarationSourceEnd", ")", ";", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "nameStart", ")", ";", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "nameEnd", ")", ";", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "escapeMementoName", "(", "buff", ",", "this", ".", "typeSignature", ")", ";", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "flags", ")", ";", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "isParameter", ")", ";", "if", "(", "this", ".", "occurrenceCount", ">", "1", ")", "{", "buff", ".", "append", "(", "JEM_COUNT", ")", ";", "buff", ".", "append", "(", "this", ".", "occurrenceCount", ")", ";", "}", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "return", "JavaElement", ".", "JEM_LOCALVARIABLE", ";", "}", "public", "IResource", "getCorrespondingResource", "(", ")", "{", "return", "null", ";", "}", "public", "IMember", "getDeclaringMember", "(", ")", "{", "return", "(", "IMember", ")", "this", ".", "parent", ";", "}", "public", "String", "getElementName", "(", ")", "{", "return", "this", ".", "name", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "LOCAL_VARIABLE", ";", "}", "public", "int", "getFlags", "(", ")", "{", "if", "(", "this", ".", "flags", "==", "-", "1", ")", "{", "SourceMapper", "mapper", "=", "getSourceMapper", "(", ")", ";", "if", "(", "mapper", "!=", "null", ")", "{", "try", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "getClassFile", "(", ")", ";", "if", "(", "classFile", "!=", "null", ")", "{", "classFile", ".", "getBuffer", "(", ")", ";", "return", "mapper", ".", "getFlags", "(", "this", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "return", "0", ";", "}", "return", "this", ".", "flags", "&", "ExtraCompilerModifiers", ".", "AccJustFlag", ";", "}", "public", "IClassFile", "getClassFile", "(", ")", "{", "IJavaElement", "element", "=", "getParent", "(", ")", ";", "while", "(", "element", "instanceof", "IMember", ")", "{", "element", "=", "element", ".", "getParent", "(", ")", ";", "}", "if", "(", "element", "instanceof", "IClassFile", ")", "{", "return", "(", "IClassFile", ")", "element", ";", "}", "return", "null", ";", "}", "public", "ISourceRange", "getNameRange", "(", ")", "{", "if", "(", "this", ".", "nameEnd", "==", "-", "1", ")", "{", "SourceMapper", "mapper", "=", "getSourceMapper", "(", ")", ";", "if", "(", "mapper", "!=", "null", ")", "{", "try", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "getClassFile", "(", ")", ";", "if", "(", "classFile", "!=", "null", ")", "{", "classFile", ".", "getBuffer", "(", ")", ";", "return", "mapper", ".", "getNameRange", "(", "this", ")", ";", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "return", "SourceMapper", ".", "UNKNOWN_RANGE", ";", "}", "return", "new", "SourceRange", "(", "this", ".", "nameStart", ",", "this", ".", "nameEnd", "-", "this", ".", "nameStart", "+", "1", ")", ";", "}", "public", "IPath", "getPath", "(", ")", "{", "return", "this", ".", "parent", ".", "getPath", "(", ")", ";", "}", "public", "IResource", "resource", "(", ")", "{", "return", "this", ".", "parent", ".", "resource", "(", ")", ";", "}", "public", "String", "getSource", "(", ")", "throws", "JavaModelException", "{", "IOpenable", "openable", "=", "this", ".", "parent", ".", "getOpenableParent", "(", ")", ";", "IBuffer", "buffer", "=", "openable", ".", "getBuffer", "(", ")", ";", "if", "(", "buffer", "==", "null", ")", "{", "return", "null", ";", "}", "ISourceRange", "range", "=", "getSourceRange", "(", ")", ";", "int", "offset", "=", "range", ".", "getOffset", "(", ")", ";", "int", "length", "=", "range", ".", "getLength", "(", ")", ";", "if", "(", "offset", "==", "-", "1", "||", "length", "==", "0", ")", "{", "return", "null", ";", "}", "try", "{", "return", "buffer", ".", "getText", "(", "offset", ",", "length", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "return", "null", ";", "}", "}", "public", "ISourceRange", "getSourceRange", "(", ")", "throws", "JavaModelException", "{", "if", "(", "this", ".", "declarationSourceEnd", "==", "-", "1", ")", "{", "SourceMapper", "mapper", "=", "getSourceMapper", "(", ")", ";", "if", "(", "mapper", "!=", "null", ")", "{", "ClassFile", "classFile", "=", "(", "ClassFile", ")", "getClassFile", "(", ")", ";", "if", "(", "classFile", "!=", "null", ")", "{", "classFile", ".", "getBuffer", "(", ")", ";", "return", "mapper", ".", "getSourceRange", "(", "this", ")", ";", "}", "}", "return", "SourceMapper", ".", "UNKNOWN_RANGE", ";", "}", "return", "new", "SourceRange", "(", "this", ".", "declarationSourceStart", ",", "this", ".", "declarationSourceEnd", "-", "this", ".", "declarationSourceStart", "+", "1", ")", ";", "}", "public", "ITypeRoot", "getTypeRoot", "(", ")", "{", "return", "this", ".", "getDeclaringMember", "(", ")", ".", "getTypeRoot", "(", ")", ";", "}", "public", "String", "getTypeSignature", "(", ")", "{", "return", "this", ".", "typeSignature", ";", "}", "public", "IResource", "getUnderlyingResource", "(", ")", "throws", "JavaModelException", "{", "return", "this", ".", "parent", ".", "getUnderlyingResource", "(", ")", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "Util", ".", "combineHashCodes", "(", "this", ".", "parent", ".", "hashCode", "(", ")", ",", "this", ".", "nameStart", ")", ";", "}", "public", "boolean", "isParameter", "(", ")", "{", "return", "this", ".", "isParameter", ";", "}", "public", "boolean", "isStructureKnown", "(", ")", "throws", "JavaModelException", "{", "return", "true", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "if", "(", "info", "!=", "NO_INFO", ")", "{", "buffer", ".", "append", "(", "Signature", ".", "toString", "(", "getTypeSignature", "(", ")", ")", ")", ";", "buffer", ".", "append", "(", "\"", "\"", ")", ";", "}", "toStringName", "(", "buffer", ")", ";", "}", "}", "</s>" ]
3,792
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IFolder", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IProject", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IResource", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IWorkspace", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "ResourcesPlugin", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Assert", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IPath", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IProgressMonitor", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "IStatus", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "Path", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "MementoTokenizer", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Messages", ";", "public", "class", "JavaModel", "extends", "Openable", "implements", "IJavaModel", "{", "public", "static", "HashSet", "existingExternalFiles", "=", "new", "HashSet", "(", ")", ";", "public", "static", "HashSet", "existingExternalConfirmedFiles", "=", "new", "HashSet", "(", ")", ";", "protected", "JavaModel", "(", ")", "throws", "Error", "{", "super", "(", "null", ")", ";", "}", "protected", "boolean", "buildStructure", "(", "OpenableElementInfo", "info", ",", "IProgressMonitor", "pm", ",", "Map", "newElements", ",", "IResource", "underlyingResource", ")", "{", "IProject", "[", "]", "projects", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProjects", "(", ")", ";", "int", "length", "=", "projects", ".", "length", ";", "IJavaElement", "[", "]", "children", "=", "new", "IJavaElement", "[", "length", "]", ";", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IProject", "project", "=", "projects", "[", "i", "]", ";", "if", "(", "JavaProject", ".", "hasJavaNature", "(", "project", ")", ")", "{", "children", "[", "index", "++", "]", "=", "getJavaProject", "(", "project", ")", ";", "}", "}", "if", "(", "index", "<", "length", ")", "System", ".", "arraycopy", "(", "children", ",", "0", ",", "children", "=", "new", "IJavaElement", "[", "index", "]", ",", "0", ",", "index", ")", ";", "info", ".", "setChildren", "(", "children", ")", ";", "newElements", ".", "put", "(", "this", ",", "info", ")", ";", "return", "true", ";", "}", "public", "boolean", "contains", "(", "IResource", "resource", ")", "{", "switch", "(", "resource", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "ROOT", ":", "case", "IResource", ".", "PROJECT", ":", "return", "true", ";", "}", "IJavaProject", "[", "]", "projects", ";", "try", "{", "projects", "=", "getJavaProjects", "(", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "projects", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "JavaProject", "project", "=", "(", "JavaProject", ")", "projects", "[", "i", "]", ";", "if", "(", "!", "project", ".", "contains", "(", "resource", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "public", "void", "copy", "(", "IJavaElement", "[", "]", "elements", ",", "IJavaElement", "[", "]", "containers", ",", "IJavaElement", "[", "]", "siblings", ",", "String", "[", "]", "renamings", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "elements", "!=", "null", "&&", "elements", ".", "length", ">", "0", "&&", "elements", "[", "0", "]", "!=", "null", "&&", "elements", "[", "0", "]", ".", "getElementType", "(", ")", "<", "IJavaElement", ".", "TYPE", ")", "{", "runOperation", "(", "new", "CopyResourceElementsOperation", "(", "elements", ",", "containers", ",", "force", ")", ",", "elements", ",", "siblings", ",", "renamings", ",", "monitor", ")", ";", "}", "else", "{", "runOperation", "(", "new", "CopyElementsOperation", "(", "elements", ",", "containers", ",", "force", ")", ",", "elements", ",", "siblings", ",", "renamings", ",", "monitor", ")", ";", "}", "}", "protected", "Object", "createElementInfo", "(", ")", "{", "return", "new", "JavaModelInfo", "(", ")", ";", "}", "public", "void", "delete", "(", "IJavaElement", "[", "]", "elements", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "elements", "!=", "null", "&&", "elements", ".", "length", ">", "0", "&&", "elements", "[", "0", "]", "!=", "null", "&&", "elements", "[", "0", "]", ".", "getElementType", "(", ")", "<", "IJavaElement", ".", "TYPE", ")", "{", "new", "DeleteResourceElementsOperation", "(", "elements", ",", "force", ")", ".", "runOperation", "(", "monitor", ")", ";", "}", "else", "{", "new", "DeleteElementsOperation", "(", "elements", ",", "force", ")", ".", "runOperation", "(", "monitor", ")", ";", "}", "}", "public", "boolean", "equals", "(", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "JavaModel", ")", ")", "return", "false", ";", "return", "super", ".", "equals", "(", "o", ")", ";", "}", "public", "int", "getElementType", "(", ")", "{", "return", "JAVA_MODEL", ";", "}", "public", "static", "void", "flushExternalFileCache", "(", ")", "{", "existingExternalFiles", "=", "new", "HashSet", "(", ")", ";", "existingExternalConfirmedFiles", "=", "new", "HashSet", "(", ")", ";", "}", "public", "IJavaElement", "getHandleFromMemento", "(", "String", "token", ",", "MementoTokenizer", "memento", ",", "WorkingCopyOwner", "owner", ")", "{", "switch", "(", "token", ".", "charAt", "(", "0", ")", ")", "{", "case", "JEM_JAVAPROJECT", ":", "if", "(", "!", "memento", ".", "hasMoreTokens", "(", ")", ")", "return", "this", ";", "String", "projectName", "=", "memento", ".", "nextToken", "(", ")", ";", "JavaElement", "project", "=", "(", "JavaElement", ")", "getJavaProject", "(", "projectName", ")", ";", "return", "project", ".", "getHandleFromMemento", "(", "memento", ",", "owner", ")", ";", "}", "return", "null", ";", "}", "protected", "void", "getHandleMemento", "(", "StringBuffer", "buff", ")", "{", "buff", ".", "append", "(", "getElementName", "(", ")", ")", ";", "}", "protected", "char", "getHandleMementoDelimiter", "(", ")", "{", "Assert", ".", "isTrue", "(", "false", ",", "\"\"", ")", ";", "return", "0", ";", "}", "public", "IJavaProject", "getJavaProject", "(", "String", "projectName", ")", "{", "return", "new", "JavaProject", "(", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getProject", "(", "projectName", ")", ",", "this", ")", ";", "}", "public", "IJavaProject", "getJavaProject", "(", "IResource", "resource", ")", "{", "switch", "(", "resource", ".", "getType", "(", ")", ")", "{", "case", "IResource", ".", "FOLDER", ":", "return", "new", "JavaProject", "(", "(", "(", "IFolder", ")", "resource", ")", ".", "getProject", "(", ")", ",", "this", ")", ";", "case", "IResource", ".", "FILE", ":", "return", "new", "JavaProject", "(", "(", "(", "IFile", ")", "resource", ")", ".", "getProject", "(", ")", ",", "this", ")", ";", "case", "IResource", ".", "PROJECT", ":", "return", "new", "JavaProject", "(", "(", "IProject", ")", "resource", ",", "this", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "Messages", ".", "element_invalidResourceForProject", ")", ";", "}", "}", "public", "IJavaProject", "[", "]", "getJavaProjects", "(", ")", "throws", "JavaModelException", "{", "ArrayList", "list", "=", "getChildrenOfType", "(", "JAVA_PROJECT", ")", ";", "IJavaProject", "[", "]", "array", "=", "new", "IJavaProject", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "array", ")", ";", "return", "array", ";", "}", "public", "Object", "[", "]", "getNonJavaResources", "(", ")", "throws", "JavaModelException", "{", "return", "(", "(", "JavaModelInfo", ")", "getElementInfo", "(", ")", ")", ".", "getNonJavaResources", "(", ")", ";", "}", "public", "IPath", "getPath", "(", ")", "{", "return", "Path", ".", "ROOT", ";", "}", "public", "IResource", "resource", "(", "PackageFragmentRoot", "root", ")", "{", "return", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ";", "}", "public", "IResource", "getUnderlyingResource", "(", ")", "{", "return", "null", ";", "}", "public", "IWorkspace", "getWorkspace", "(", ")", "{", "return", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "}", "public", "void", "move", "(", "IJavaElement", "[", "]", "elements", ",", "IJavaElement", "[", "]", "containers", ",", "IJavaElement", "[", "]", "siblings", ",", "String", "[", "]", "renamings", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "elements", "!=", "null", "&&", "elements", ".", "length", ">", "0", "&&", "elements", "[", "0", "]", "!=", "null", "&&", "elements", "[", "0", "]", ".", "getElementType", "(", ")", "<", "IJavaElement", ".", "TYPE", ")", "{", "runOperation", "(", "new", "MoveResourceElementsOperation", "(", "elements", ",", "containers", ",", "force", ")", ",", "elements", ",", "siblings", ",", "renamings", ",", "monitor", ")", ";", "}", "else", "{", "runOperation", "(", "new", "MoveElementsOperation", "(", "elements", ",", "containers", ",", "force", ")", ",", "elements", ",", "siblings", ",", "renamings", ",", "monitor", ")", ";", "}", "}", "public", "void", "refreshExternalArchives", "(", "IJavaElement", "[", "]", "elementsScope", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "if", "(", "elementsScope", "==", "null", ")", "{", "elementsScope", "=", "new", "IJavaElement", "[", "]", "{", "this", "}", ";", "}", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getDeltaProcessor", "(", ")", ".", "checkExternalArchiveChanges", "(", "elementsScope", ",", "monitor", ")", ";", "}", "public", "void", "rename", "(", "IJavaElement", "[", "]", "elements", ",", "IJavaElement", "[", "]", "destinations", ",", "String", "[", "]", "renamings", ",", "boolean", "force", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "MultiOperation", "op", ";", "if", "(", "elements", "!=", "null", "&&", "elements", ".", "length", ">", "0", "&&", "elements", "[", "0", "]", "!=", "null", "&&", "elements", "[", "0", "]", ".", "getElementType", "(", ")", "<", "IJavaElement", ".", "TYPE", ")", "{", "op", "=", "new", "RenameResourceElementsOperation", "(", "elements", ",", "destinations", ",", "renamings", ",", "force", ")", ";", "}", "else", "{", "op", "=", "new", "RenameElementsOperation", "(", "elements", ",", "destinations", ",", "renamings", ",", "force", ")", ";", "}", "op", ".", "runOperation", "(", "monitor", ")", ";", "}", "protected", "void", "runOperation", "(", "MultiOperation", "op", ",", "IJavaElement", "[", "]", "elements", ",", "IJavaElement", "[", "]", "siblings", ",", "String", "[", "]", "renamings", ",", "IProgressMonitor", "monitor", ")", "throws", "JavaModelException", "{", "op", ".", "setRenamings", "(", "renamings", ")", ";", "if", "(", "siblings", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "op", ".", "setInsertBefore", "(", "elements", "[", "i", "]", ",", "siblings", "[", "i", "]", ")", ";", "}", "}", "op", ".", "runOperation", "(", "monitor", ")", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "tabString", "(", "tab", ")", ")", ";", "buffer", ".", "append", "(", "\"Java", "Model\"", ")", ";", "if", "(", "info", "==", "null", ")", "{", "buffer", ".", "append", "(", "\"", "(not", "open)\"", ")", ";", "}", "}", "public", "static", "Object", "getTarget", "(", "IPath", "path", ",", "boolean", "checkResourceExistence", ")", "{", "Object", "target", "=", "getWorkspaceTarget", "(", "path", ")", ";", "if", "(", "target", "!=", "null", ")", "return", "target", ";", "return", "getExternalTarget", "(", "path", ",", "checkResourceExistence", ")", ";", "}", "public", "static", "IResource", "getWorkspaceTarget", "(", "IPath", "path", ")", "{", "if", "(", "path", "==", "null", "||", "path", ".", "getDevice", "(", ")", "!=", "null", ")", "return", "null", ";", "IWorkspace", "workspace", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ";", "if", "(", "workspace", "==", "null", ")", "return", "null", ";", "return", "workspace", ".", "getRoot", "(", ")", ".", "findMember", "(", "path", ")", ";", "}", "public", "static", "Object", "getExternalTarget", "(", "IPath", "path", ",", "boolean", "checkResourceExistence", ")", "{", "if", "(", "path", "==", "null", ")", "return", "null", ";", "ExternalFoldersManager", "externalFoldersManager", "=", "JavaModelManager", ".", "getExternalManager", "(", ")", ";", "Object", "linkedFolder", "=", "externalFoldersManager", ".", "getFolder", "(", "path", ")", ";", "if", "(", "linkedFolder", "!=", "null", ")", "{", "if", "(", "checkResourceExistence", ")", "{", "File", "externalFile", "=", "new", "File", "(", "path", ".", "toOSString", "(", ")", ")", ";", "if", "(", "!", "externalFile", ".", "isDirectory", "(", ")", ")", "{", "return", "null", ";", "}", "}", "return", "linkedFolder", ";", "}", "File", "externalFile", "=", "new", "File", "(", "path", ".", "toOSString", "(", ")", ")", ";", "if", "(", "!", "checkResourceExistence", ")", "{", "return", "externalFile", ";", "}", "else", "if", "(", "existingExternalFilesContains", "(", "externalFile", ")", ")", "{", "return", "externalFile", ";", "}", "else", "{", "if", "(", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "path", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "externalFile", ".", "isFile", "(", ")", ")", "{", "existingExternalFilesAdd", "(", "externalFile", ")", ";", "return", "externalFile", ";", "}", "}", "return", "null", ";", "}", "private", "synchronized", "static", "void", "existingExternalFilesAdd", "(", "File", "externalFile", ")", "{", "existingExternalFiles", ".", "add", "(", "externalFile", ")", ";", "}", "private", "synchronized", "static", "boolean", "existingExternalFilesContains", "(", "File", "externalFile", ")", "{", "return", "existingExternalFiles", ".", "contains", "(", "externalFile", ")", ";", "}", "public", "static", "boolean", "isFile", "(", "Object", "target", ")", "{", "return", "getFile", "(", "target", ")", "!=", "null", ";", "}", "public", "static", "synchronized", "File", "getFile", "(", "Object", "target", ")", "{", "if", "(", "existingExternalConfirmedFiles", ".", "contains", "(", "target", ")", ")", "return", "(", "File", ")", "target", ";", "if", "(", "target", "instanceof", "File", ")", "{", "File", "f", "=", "(", "File", ")", "target", ";", "if", "(", "f", ".", "isFile", "(", ")", ")", "{", "existingExternalConfirmedFiles", ".", "add", "(", "f", ")", ";", "return", "f", ";", "}", "}", "return", "null", ";", "}", "protected", "IStatus", "validateExistence", "(", "IResource", "underlyingResource", ")", "{", "return", "JavaModelStatus", ".", "VERIFIED_OK", ";", "}", "}", "</s>" ]
3,793
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "Flags", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ICompilationUnit", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IField", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMethod", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IPackageFragment", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "ISourceRange", ";", "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", ".", "*", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "ISelectionRequestor", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "codeassist", ".", "SelectionEngine", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "AbstractVariableDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "ast", ".", "LocalDeclaration", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "classfmt", ".", "ClassFileConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "FieldBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "LocalTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "LocalVariableBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "MethodBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ParameterizedTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "ReferenceBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "SourceTypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "lookup", ".", "TypeVariableBinding", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "HandleFactory", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "SelectionRequestor", "implements", "ISelectionRequestor", "{", "protected", "NameLookup", "nameLookup", ";", "protected", "Openable", "openable", ";", "protected", "IJavaElement", "[", "]", "elements", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "protected", "int", "elementIndex", "=", "-", "1", ";", "protected", "HandleFactory", "handleFactory", "=", "new", "HandleFactory", "(", ")", ";", "public", "SelectionRequestor", "(", "NameLookup", "nameLookup", ",", "Openable", "openable", ")", "{", "super", "(", ")", ";", "this", ".", "nameLookup", "=", "nameLookup", ";", "this", ".", "openable", "=", "openable", ";", "}", "private", "void", "acceptBinaryMethod", "(", "IType", "type", ",", "IMethod", "method", ",", "char", "[", "]", "uniqueKey", ",", "boolean", "isConstructor", ")", "{", "try", "{", "if", "(", "!", "isConstructor", "||", "(", "(", "JavaElement", ")", "method", ")", ".", "getClassFile", "(", ")", ".", "getBuffer", "(", ")", "==", "null", ")", "{", "if", "(", "uniqueKey", "!=", "null", ")", "{", "ResolvedBinaryMethod", "resolvedMethod", "=", "new", "ResolvedBinaryMethod", "(", "(", "JavaElement", ")", "method", ".", "getParent", "(", ")", ",", "method", ".", "getElementName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedMethod", ".", "occurrenceCount", "=", "method", ".", "getOccurrenceCount", "(", ")", ";", "method", "=", "resolvedMethod", ";", "}", "addElement", "(", "method", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "method", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "else", "{", "ISourceRange", "range", "=", "method", ".", "getSourceRange", "(", ")", ";", "if", "(", "range", ".", "getOffset", "(", ")", "!=", "-", "1", "&&", "range", ".", "getLength", "(", ")", "!=", "0", ")", "{", "if", "(", "uniqueKey", "!=", "null", ")", "{", "ResolvedBinaryMethod", "resolvedMethod", "=", "new", "ResolvedBinaryMethod", "(", "(", "JavaElement", ")", "method", ".", "getParent", "(", ")", ",", "method", ".", "getElementName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedMethod", ".", "occurrenceCount", "=", "method", ".", "getOccurrenceCount", "(", ")", ";", "method", "=", "resolvedMethod", ";", "}", "addElement", "(", "method", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "method", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "else", "{", "addElement", "(", "type", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "type", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "protected", "void", "acceptBinaryMethod", "(", "IType", "type", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "String", "[", "]", "parameterSignatures", ",", "char", "[", "]", "[", "]", "typeParameterNames", ",", "char", "[", "]", "[", "]", "[", "]", "typeParameterBoundNames", ",", "char", "[", "]", "uniqueKey", ",", "boolean", "isConstructor", ")", "{", "IMethod", "method", "=", "type", ".", "getMethod", "(", "new", "String", "(", "selector", ")", ",", "parameterSignatures", ")", ";", "if", "(", "method", ".", "exists", "(", ")", ")", "{", "if", "(", "typeParameterNames", "!=", "null", "&&", "typeParameterNames", ".", "length", "!=", "0", ")", "{", "IMethod", "[", "]", "methods", "=", "type", ".", "findMethods", "(", "method", ")", ";", "if", "(", "methods", "!=", "null", "&&", "methods", ".", "length", ">", "1", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methods", ".", "length", ";", "i", "++", ")", "{", "if", "(", "areTypeParametersCompatible", "(", "methods", "[", "i", "]", ",", "typeParameterNames", ",", "typeParameterBoundNames", ")", ")", "{", "acceptBinaryMethod", "(", "type", ",", "method", ",", "uniqueKey", ",", "isConstructor", ")", ";", "}", "}", "return", ";", "}", "}", "acceptBinaryMethod", "(", "type", ",", "method", ",", "uniqueKey", ",", "isConstructor", ")", ";", "}", "}", "public", "void", "acceptType", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "typeName", ",", "int", "modifiers", ",", "boolean", "isDeclaration", ",", "char", "[", "]", "uniqueKey", ",", "int", "start", ",", "int", "end", ")", "{", "int", "acceptFlags", "=", "0", ";", "int", "kind", "=", "modifiers", "&", "(", "ClassFileConstants", ".", "AccInterface", "|", "ClassFileConstants", ".", "AccEnum", "|", "ClassFileConstants", ".", "AccAnnotation", ")", ";", "switch", "(", "kind", ")", "{", "case", "ClassFileConstants", ".", "AccAnnotation", ":", "case", "ClassFileConstants", ".", "AccAnnotation", "|", "ClassFileConstants", ".", "AccInterface", ":", "acceptFlags", "=", "NameLookup", ".", "ACCEPT_ANNOTATIONS", ";", "break", ";", "case", "ClassFileConstants", ".", "AccEnum", ":", "acceptFlags", "=", "NameLookup", ".", "ACCEPT_ENUMS", ";", "break", ";", "case", "ClassFileConstants", ".", "AccInterface", ":", "acceptFlags", "=", "NameLookup", ".", "ACCEPT_INTERFACES", ";", "break", ";", "default", ":", "acceptFlags", "=", "NameLookup", ".", "ACCEPT_CLASSES", ";", "break", ";", "}", "IType", "type", "=", "null", ";", "if", "(", "isDeclaration", ")", "{", "type", "=", "resolveTypeByLocation", "(", "packageName", ",", "typeName", ",", "acceptFlags", ",", "start", ",", "end", ")", ";", "}", "else", "{", "type", "=", "resolveType", "(", "packageName", ",", "typeName", ",", "acceptFlags", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "String", "key", "=", "uniqueKey", "==", "null", "?", "type", ".", "getKey", "(", ")", ":", "new", "String", "(", "uniqueKey", ")", ";", "if", "(", "type", ".", "isBinary", "(", ")", ")", "{", "ResolvedBinaryType", "resolvedType", "=", "new", "ResolvedBinaryType", "(", "(", "JavaElement", ")", "type", ".", "getParent", "(", ")", ",", "type", ".", "getElementName", "(", ")", ",", "key", ")", ";", "resolvedType", ".", "occurrenceCount", "=", "type", ".", "getOccurrenceCount", "(", ")", ";", "type", "=", "resolvedType", ";", "}", "else", "{", "ResolvedSourceType", "resolvedType", "=", "new", "ResolvedSourceType", "(", "(", "JavaElement", ")", "type", ".", "getParent", "(", ")", ",", "type", ".", "getElementName", "(", ")", ",", "key", ")", ";", "resolvedType", ".", "occurrenceCount", "=", "type", ".", "getOccurrenceCount", "(", ")", ";", "type", "=", "resolvedType", ";", "}", "}", "}", "if", "(", "type", "!=", "null", ")", "{", "addElement", "(", "type", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "type", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "public", "void", "acceptType", "(", "IType", "type", ")", "{", "String", "key", "=", "type", ".", "getKey", "(", ")", ";", "if", "(", "type", ".", "isBinary", "(", ")", ")", "{", "ResolvedBinaryType", "resolvedType", "=", "new", "ResolvedBinaryType", "(", "(", "JavaElement", ")", "type", ".", "getParent", "(", ")", ",", "type", ".", "getElementName", "(", ")", ",", "key", ")", ";", "resolvedType", ".", "occurrenceCount", "=", "type", ".", "getOccurrenceCount", "(", ")", ";", "type", "=", "resolvedType", ";", "}", "else", "{", "ResolvedSourceType", "resolvedType", "=", "new", "ResolvedSourceType", "(", "(", "JavaElement", ")", "type", ".", "getParent", "(", ")", ",", "type", ".", "getElementName", "(", ")", ",", "key", ")", ";", "resolvedType", ".", "occurrenceCount", "=", "type", ".", "getOccurrenceCount", "(", ")", ";", "type", "=", "resolvedType", ";", "}", "addElement", "(", "type", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "type", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "public", "void", "acceptError", "(", "CategorizedProblem", "error", ")", "{", "}", "public", "void", "acceptField", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "name", ",", "boolean", "isDeclaration", ",", "char", "[", "]", "uniqueKey", ",", "int", "start", ",", "int", "end", ")", "{", "if", "(", "isDeclaration", ")", "{", "IType", "type", "=", "resolveTypeByLocation", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "NameLookup", ".", "ACCEPT_ALL", ",", "start", ",", "end", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "try", "{", "IField", "[", "]", "fields", "=", "type", ".", "getFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "IField", "field", "=", "fields", "[", "i", "]", ";", "ISourceRange", "range", "=", "field", ".", "getNameRange", "(", ")", ";", "if", "(", "range", ".", "getOffset", "(", ")", "<=", "start", "&&", "range", ".", "getOffset", "(", ")", "+", "range", ".", "getLength", "(", ")", ">=", "end", "&&", "field", ".", "getElementName", "(", ")", ".", "equals", "(", "new", "String", "(", "name", ")", ")", ")", "{", "addElement", "(", "fields", "[", "i", "]", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "field", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "return", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", ";", "}", "}", "}", "else", "{", "IType", "type", "=", "resolveType", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "NameLookup", ".", "ACCEPT_ALL", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "IField", "field", "=", "type", ".", "getField", "(", "new", "String", "(", "name", ")", ")", ";", "if", "(", "field", ".", "exists", "(", ")", ")", "{", "if", "(", "uniqueKey", "!=", "null", ")", "{", "if", "(", "field", ".", "isBinary", "(", ")", ")", "{", "ResolvedBinaryField", "resolvedField", "=", "new", "ResolvedBinaryField", "(", "(", "JavaElement", ")", "field", ".", "getParent", "(", ")", ",", "field", ".", "getElementName", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedField", ".", "occurrenceCount", "=", "field", ".", "getOccurrenceCount", "(", ")", ";", "field", "=", "resolvedField", ";", "}", "else", "{", "ResolvedSourceField", "resolvedField", "=", "new", "ResolvedSourceField", "(", "(", "JavaElement", ")", "field", ".", "getParent", "(", ")", ",", "field", ".", "getElementName", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedField", ".", "occurrenceCount", "=", "field", ".", "getOccurrenceCount", "(", ")", ";", "field", "=", "resolvedField", ";", "}", "}", "addElement", "(", "field", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "field", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "}", "public", "void", "acceptLocalField", "(", "FieldBinding", "fieldBinding", ")", "{", "IJavaElement", "res", ";", "if", "(", "fieldBinding", ".", "declaringClass", "instanceof", "ParameterizedTypeBinding", ")", "{", "LocalTypeBinding", "localTypeBinding", "=", "(", "LocalTypeBinding", ")", "(", "(", "ParameterizedTypeBinding", ")", "fieldBinding", ".", "declaringClass", ")", ".", "genericType", "(", ")", ";", "res", "=", "findLocalElement", "(", "localTypeBinding", ".", "sourceStart", "(", ")", ")", ";", "}", "else", "{", "SourceTypeBinding", "typeBinding", "=", "(", "SourceTypeBinding", ")", "fieldBinding", ".", "declaringClass", ";", "res", "=", "findLocalElement", "(", "typeBinding", ".", "sourceStart", "(", ")", ")", ";", "}", "if", "(", "res", "!=", "null", "&&", "res", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "IType", "type", "=", "(", "IType", ")", "res", ";", "IField", "field", "=", "type", ".", "getField", "(", "new", "String", "(", "fieldBinding", ".", "name", ")", ")", ";", "if", "(", "field", ".", "exists", "(", ")", ")", "{", "char", "[", "]", "uniqueKey", "=", "fieldBinding", ".", "computeUniqueKey", "(", ")", ";", "if", "(", "field", ".", "isBinary", "(", ")", ")", "{", "ResolvedBinaryField", "resolvedField", "=", "new", "ResolvedBinaryField", "(", "(", "JavaElement", ")", "field", ".", "getParent", "(", ")", ",", "field", ".", "getElementName", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedField", ".", "occurrenceCount", "=", "field", ".", "getOccurrenceCount", "(", ")", ";", "field", "=", "resolvedField", ";", "}", "else", "{", "ResolvedSourceField", "resolvedField", "=", "new", "ResolvedSourceField", "(", "(", "JavaElement", ")", "field", ".", "getParent", "(", ")", ",", "field", ".", "getElementName", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedField", ".", "occurrenceCount", "=", "field", ".", "getOccurrenceCount", "(", ")", ";", "field", "=", "resolvedField", ";", "}", "addElement", "(", "field", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "field", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "public", "void", "acceptLocalMethod", "(", "MethodBinding", "methodBinding", ")", "{", "IJavaElement", "res", "=", "findLocalElement", "(", "methodBinding", ".", "sourceStart", "(", ")", ")", ";", "if", "(", "res", "!=", "null", ")", "{", "if", "(", "res", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "METHOD", ")", "{", "IMethod", "method", "=", "(", "IMethod", ")", "res", ";", "char", "[", "]", "uniqueKey", "=", "methodBinding", ".", "computeUniqueKey", "(", ")", ";", "if", "(", "method", ".", "isBinary", "(", ")", ")", "{", "ResolvedBinaryMethod", "resolvedRes", "=", "new", "ResolvedBinaryMethod", "(", "(", "JavaElement", ")", "res", ".", "getParent", "(", ")", ",", "method", ".", "getElementName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedRes", ".", "occurrenceCount", "=", "method", ".", "getOccurrenceCount", "(", ")", ";", "res", "=", "resolvedRes", ";", "}", "else", "{", "ResolvedSourceMethod", "resolvedRes", "=", "new", "ResolvedSourceMethod", "(", "(", "JavaElement", ")", "res", ".", "getParent", "(", ")", ",", "method", ".", "getElementName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedRes", ".", "occurrenceCount", "=", "method", ".", "getOccurrenceCount", "(", ")", ";", "res", "=", "resolvedRes", ";", "}", "addElement", "(", "res", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "res", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "else", "if", "(", "methodBinding", ".", "selector", "==", "TypeConstants", ".", "INIT", "&&", "res", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "res", "=", "(", "(", "JavaElement", ")", "res", ")", ".", "resolved", "(", "methodBinding", ".", "declaringClass", ")", ";", "addElement", "(", "res", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "res", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "public", "void", "acceptLocalType", "(", "TypeBinding", "typeBinding", ")", "{", "IJavaElement", "res", "=", "null", ";", "if", "(", "typeBinding", "instanceof", "ParameterizedTypeBinding", ")", "{", "LocalTypeBinding", "localTypeBinding", "=", "(", "LocalTypeBinding", ")", "(", "(", "ParameterizedTypeBinding", ")", "typeBinding", ")", ".", "genericType", "(", ")", ";", "res", "=", "findLocalElement", "(", "localTypeBinding", ".", "sourceStart", "(", ")", ")", ";", "}", "else", "if", "(", "typeBinding", "instanceof", "SourceTypeBinding", ")", "{", "res", "=", "findLocalElement", "(", "(", "(", "SourceTypeBinding", ")", "typeBinding", ")", ".", "sourceStart", "(", ")", ")", ";", "}", "if", "(", "res", "!=", "null", "&&", "res", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "res", "=", "(", "(", "JavaElement", ")", "res", ")", ".", "resolved", "(", "typeBinding", ")", ";", "addElement", "(", "res", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "res", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "public", "void", "acceptLocalTypeParameter", "(", "TypeVariableBinding", "typeVariableBinding", ")", "{", "IJavaElement", "res", ";", "if", "(", "typeVariableBinding", ".", "declaringElement", "instanceof", "ParameterizedTypeBinding", ")", "{", "LocalTypeBinding", "localTypeBinding", "=", "(", "LocalTypeBinding", ")", "(", "(", "ParameterizedTypeBinding", ")", "typeVariableBinding", ".", "declaringElement", ")", ".", "genericType", "(", ")", ";", "res", "=", "findLocalElement", "(", "localTypeBinding", ".", "sourceStart", "(", ")", ")", ";", "}", "else", "{", "SourceTypeBinding", "typeBinding", "=", "(", "SourceTypeBinding", ")", "typeVariableBinding", ".", "declaringElement", ";", "res", "=", "findLocalElement", "(", "typeBinding", ".", "sourceStart", "(", ")", ")", ";", "}", "if", "(", "res", "!=", "null", "&&", "res", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "TYPE", ")", "{", "IType", "type", "=", "(", "IType", ")", "res", ";", "ITypeParameter", "typeParameter", "=", "type", ".", "getTypeParameter", "(", "new", "String", "(", "typeVariableBinding", ".", "sourceName", ")", ")", ";", "if", "(", "typeParameter", ".", "exists", "(", ")", ")", "{", "addElement", "(", "typeParameter", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "typeParameter", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "public", "void", "acceptLocalMethodTypeParameter", "(", "TypeVariableBinding", "typeVariableBinding", ")", "{", "MethodBinding", "methodBinding", "=", "(", "MethodBinding", ")", "typeVariableBinding", ".", "declaringElement", ";", "IJavaElement", "res", "=", "findLocalElement", "(", "methodBinding", ".", "sourceStart", "(", ")", ")", ";", "if", "(", "res", "!=", "null", "&&", "res", ".", "getElementType", "(", ")", "==", "IJavaElement", ".", "METHOD", ")", "{", "IMethod", "method", "=", "(", "IMethod", ")", "res", ";", "ITypeParameter", "typeParameter", "=", "method", ".", "getTypeParameter", "(", "new", "String", "(", "typeVariableBinding", ".", "sourceName", ")", ")", ";", "if", "(", "typeParameter", ".", "exists", "(", ")", ")", "{", "addElement", "(", "typeParameter", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "typeParameter", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "public", "void", "acceptLocalVariable", "(", "LocalVariableBinding", "binding", ")", "{", "LocalDeclaration", "local", "=", "binding", ".", "declaration", ";", "IJavaElement", "parent", "=", "findLocalElement", "(", "local", ".", "sourceStart", ")", ";", "LocalVariable", "localVar", "=", "null", ";", "if", "(", "parent", "!=", "null", ")", "{", "localVar", "=", "new", "LocalVariable", "(", "(", "JavaElement", ")", "parent", ",", "new", "String", "(", "local", ".", "name", ")", ",", "local", ".", "declarationSourceStart", ",", "local", ".", "declarationSourceEnd", ",", "local", ".", "sourceStart", ",", "local", ".", "sourceEnd", ",", "Util", ".", "typeSignature", "(", "local", ".", "type", ")", ",", "local", ".", "annotations", ",", "local", ".", "modifiers", ",", "local", ".", "getKind", "(", ")", "==", "AbstractVariableDeclaration", ".", "PARAMETER", ")", ";", "}", "if", "(", "localVar", "!=", "null", ")", "{", "addElement", "(", "localVar", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "localVar", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "public", "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", ")", "{", "IJavaElement", "[", "]", "previousElement", "=", "this", ".", "elements", ";", "int", "previousElementIndex", "=", "this", ".", "elementIndex", ";", "this", ".", "elements", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "this", ".", "elementIndex", "=", "-", "1", ";", "if", "(", "isDeclaration", ")", "{", "IType", "type", "=", "resolveTypeByLocation", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "NameLookup", ".", "ACCEPT_ALL", ",", "start", ",", "end", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "acceptMethodDeclaration", "(", "type", ",", "selector", ",", "start", ",", "end", ")", ";", "}", "}", "else", "{", "IType", "type", "=", "resolveType", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "NameLookup", ".", "ACCEPT_ALL", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "if", "(", "type", ".", "isBinary", "(", ")", ")", "{", "IType", "declaringDeclaringType", "=", "type", ".", "getDeclaringType", "(", ")", ";", "boolean", "isStatic", "=", "false", ";", "try", "{", "isStatic", "=", "Flags", ".", "isStatic", "(", "type", ".", "getFlags", "(", ")", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "if", "(", "declaringDeclaringType", "!=", "null", "&&", "isConstructor", "&&", "!", "isStatic", ")", "{", "int", "length", "=", "parameterPackageNames", ".", "length", ";", "System", ".", "arraycopy", "(", "parameterPackageNames", ",", "0", ",", "parameterPackageNames", "=", "new", "char", "[", "length", "+", "1", "]", "[", "]", ",", "1", ",", "length", ")", ";", "System", ".", "arraycopy", "(", "parameterTypeNames", ",", "0", ",", "parameterTypeNames", "=", "new", "char", "[", "length", "+", "1", "]", "[", "]", ",", "1", ",", "length", ")", ";", "System", ".", "arraycopy", "(", "parameterSignatures", ",", "0", ",", "parameterSignatures", "=", "new", "String", "[", "length", "+", "1", "]", ",", "1", ",", "length", ")", ";", "parameterPackageNames", "[", "0", "]", "=", "declaringDeclaringType", ".", "getPackageFragment", "(", ")", ".", "getElementName", "(", ")", ".", "toCharArray", "(", ")", ";", "parameterTypeNames", "[", "0", "]", "=", "declaringDeclaringType", ".", "getTypeQualifiedName", "(", ")", ".", "toCharArray", "(", ")", ";", "parameterSignatures", "[", "0", "]", "=", "Signature", ".", "getTypeErasure", "(", "enclosingDeclaringTypeSignature", ")", ";", "}", "acceptBinaryMethod", "(", "type", ",", "selector", ",", "parameterPackageNames", ",", "parameterTypeNames", ",", "parameterSignatures", ",", "typeParameterNames", ",", "typeParameterBoundNames", ",", "uniqueKey", ",", "isConstructor", ")", ";", "}", "else", "{", "acceptSourceMethod", "(", "type", ",", "selector", ",", "parameterPackageNames", ",", "parameterTypeNames", ",", "parameterSignatures", ",", "typeParameterNames", ",", "typeParameterBoundNames", ",", "uniqueKey", ")", ";", "}", "}", "}", "if", "(", "previousElementIndex", ">", "-", "1", ")", "{", "int", "elementsLength", "=", "this", ".", "elementIndex", "+", "previousElementIndex", "+", "2", ";", "if", "(", "elementsLength", ">", "this", ".", "elements", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "elements", ",", "0", ",", "this", ".", "elements", "=", "new", "IJavaElement", "[", "elementsLength", "*", "2", "+", "1", "]", ",", "0", ",", "this", ".", "elementIndex", "+", "1", ")", ";", "}", "System", ".", "arraycopy", "(", "previousElement", ",", "0", ",", "this", ".", "elements", ",", "this", ".", "elementIndex", "+", "1", ",", "previousElementIndex", "+", "1", ")", ";", "this", ".", "elementIndex", "+=", "previousElementIndex", "+", "1", ";", "}", "}", "public", "void", "acceptPackage", "(", "char", "[", "]", "packageName", ")", "{", "IPackageFragment", "[", "]", "pkgs", "=", "this", ".", "nameLookup", ".", "findPackageFragments", "(", "new", "String", "(", "packageName", ")", ",", "false", ")", ";", "if", "(", "pkgs", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ",", "length", "=", "pkgs", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "addElement", "(", "pkgs", "[", "i", "]", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "pkgs", "[", "i", "]", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "protected", "void", "acceptSourceMethod", "(", "IType", "type", ",", "char", "[", "]", "selector", ",", "char", "[", "]", "[", "]", "parameterPackageNames", ",", "char", "[", "]", "[", "]", "parameterTypeNames", ",", "String", "[", "]", "parameterSignatures", ",", "char", "[", "]", "[", "]", "typeParameterNames", ",", "char", "[", "]", "[", "]", "[", "]", "typeParameterBoundNames", ",", "char", "[", "]", "uniqueKey", ")", "{", "String", "name", "=", "new", "String", "(", "selector", ")", ";", "IMethod", "[", "]", "methods", "=", "null", ";", "try", "{", "methods", "=", "type", ".", "getMethods", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methods", ".", "length", ";", "i", "++", ")", "{", "if", "(", "methods", "[", "i", "]", ".", "getElementName", "(", ")", ".", "equals", "(", "name", ")", "&&", "methods", "[", "i", "]", ".", "getParameterTypes", "(", ")", ".", "length", "==", "parameterTypeNames", ".", "length", ")", "{", "IMethod", "method", "=", "methods", "[", "i", "]", ";", "if", "(", "uniqueKey", "!=", "null", ")", "{", "ResolvedSourceMethod", "resolvedMethod", "=", "new", "ResolvedSourceMethod", "(", "(", "JavaElement", ")", "method", ".", "getParent", "(", ")", ",", "method", ".", "getElementName", "(", ")", ",", "method", ".", "getParameterTypes", "(", ")", ",", "new", "String", "(", "uniqueKey", ")", ")", ";", "resolvedMethod", ".", "occurrenceCount", "=", "method", ".", "getOccurrenceCount", "(", ")", ";", "method", "=", "resolvedMethod", ";", "}", "addElement", "(", "method", ")", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", ";", "}", "if", "(", "this", ".", "elementIndex", "==", "-", "1", ")", "{", "addElement", "(", "type", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "type", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "return", ";", "}", "if", "(", "this", ".", "elementIndex", "==", "0", ")", "{", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "this", ".", "elements", "[", "0", "]", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "return", ";", "}", "IJavaElement", "[", "]", "matches", "=", "this", ".", "elements", ";", "int", "matchesIndex", "=", "this", ".", "elementIndex", ";", "this", ".", "elements", "=", "JavaElement", ".", "NO_ELEMENTS", ";", "this", ".", "elementIndex", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "matchesIndex", ";", "i", "++", ")", "{", "IMethod", "method", "=", "(", "IMethod", ")", "matches", "[", "i", "]", ";", "String", "[", "]", "signatures", "=", "method", ".", "getParameterTypes", "(", ")", ";", "boolean", "match", "=", "true", ";", "for", "(", "int", "p", "=", "0", ";", "p", "<", "signatures", ".", "length", ";", "p", "++", ")", "{", "String", "simpleName", "=", "Signature", ".", "getSimpleName", "(", "Signature", ".", "toString", "(", "Signature", ".", "getTypeErasure", "(", "signatures", "[", "p", "]", ")", ")", ")", ";", "char", "[", "]", "simpleParameterName", "=", "CharOperation", ".", "lastSegment", "(", "parameterTypeNames", "[", "p", "]", ",", "'.'", ")", ";", "if", "(", "!", "simpleName", ".", "equals", "(", "new", "String", "(", "simpleParameterName", ")", ")", ")", "{", "match", "=", "false", ";", "break", ";", "}", "}", "if", "(", "match", "&&", "!", "areTypeParametersCompatible", "(", "method", ",", "typeParameterNames", ",", "typeParameterBoundNames", ")", ")", "{", "match", "=", "false", ";", "}", "if", "(", "match", ")", "{", "addElement", "(", "method", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "method", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "protected", "void", "acceptMethodDeclaration", "(", "IType", "type", ",", "char", "[", "]", "selector", ",", "int", "start", ",", "int", "end", ")", "{", "String", "name", "=", "new", "String", "(", "selector", ")", ";", "IMethod", "[", "]", "methods", "=", "null", ";", "try", "{", "methods", "=", "type", ".", "getMethods", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methods", ".", "length", ";", "i", "++", ")", "{", "ISourceRange", "range", "=", "methods", "[", "i", "]", ".", "getNameRange", "(", ")", ";", "if", "(", "range", ".", "getOffset", "(", ")", "<=", "start", "&&", "range", ".", "getOffset", "(", ")", "+", "range", ".", "getLength", "(", ")", ">=", "end", "&&", "methods", "[", "i", "]", ".", "getElementName", "(", ")", ".", "equals", "(", "name", ")", ")", "{", "addElement", "(", "methods", "[", "i", "]", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "this", ".", "elements", "[", "0", "]", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "return", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", ";", "}", "addElement", "(", "type", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "type", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "return", ";", "}", "public", "void", "acceptTypeParameter", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "typeParameterName", ",", "boolean", "isDeclaration", ",", "int", "start", ",", "int", "end", ")", "{", "IType", "type", ";", "if", "(", "isDeclaration", ")", "{", "type", "=", "resolveTypeByLocation", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "NameLookup", ".", "ACCEPT_ALL", ",", "start", ",", "end", ")", ";", "}", "else", "{", "type", "=", "resolveType", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "NameLookup", ".", "ACCEPT_ALL", ")", ";", "}", "if", "(", "type", "!=", "null", ")", "{", "ITypeParameter", "typeParameter", "=", "type", ".", "getTypeParameter", "(", "new", "String", "(", "typeParameterName", ")", ")", ";", "if", "(", "typeParameter", "==", "null", ")", "{", "addElement", "(", "type", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "type", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "else", "{", "addElement", "(", "typeParameter", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "typeParameter", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "public", "void", "acceptMethodTypeParameter", "(", "char", "[", "]", "declaringTypePackageName", ",", "char", "[", "]", "declaringTypeName", ",", "char", "[", "]", "selector", ",", "int", "selectorStart", ",", "int", "selectorEnd", ",", "char", "[", "]", "typeParameterName", ",", "boolean", "isDeclaration", ",", "int", "start", ",", "int", "end", ")", "{", "IType", "type", "=", "resolveTypeByLocation", "(", "declaringTypePackageName", ",", "declaringTypeName", ",", "NameLookup", ".", "ACCEPT_ALL", ",", "selectorStart", ",", "selectorEnd", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "IMethod", "method", "=", "null", ";", "String", "name", "=", "new", "String", "(", "selector", ")", ";", "IMethod", "[", "]", "methods", "=", "null", ";", "try", "{", "methods", "=", "type", ".", "getMethods", "(", ")", ";", "done", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methods", ".", "length", ";", "i", "++", ")", "{", "ISourceRange", "range", "=", "methods", "[", "i", "]", ".", "getNameRange", "(", ")", ";", "if", "(", "range", ".", "getOffset", "(", ")", ">=", "selectorStart", "&&", "range", ".", "getOffset", "(", ")", "+", "range", ".", "getLength", "(", ")", "<=", "selectorEnd", "&&", "methods", "[", "i", "]", ".", "getElementName", "(", ")", ".", "equals", "(", "name", ")", ")", "{", "method", "=", "methods", "[", "i", "]", ";", "break", "done", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "if", "(", "method", "==", "null", ")", "{", "addElement", "(", "type", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "type", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "else", "{", "ITypeParameter", "typeParameter", "=", "method", ".", "getTypeParameter", "(", "new", "String", "(", "typeParameterName", ")", ")", ";", "if", "(", "typeParameter", "==", "null", ")", "{", "addElement", "(", "method", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "method", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "else", "{", "addElement", "(", "typeParameter", ")", ";", "if", "(", "SelectionEngine", ".", "DEBUG", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "System", ".", "out", ".", "print", "(", "typeParameter", ".", "toString", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\")\"", ")", ";", "}", "}", "}", "}", "}", "protected", "void", "addElement", "(", "IJavaElement", "element", ")", "{", "int", "elementLength", "=", "this", ".", "elementIndex", "+", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elementLength", ";", "i", "++", ")", "{", "if", "(", "this", ".", "elements", "[", "i", "]", ".", "equals", "(", "element", ")", ")", "{", "return", ";", "}", "}", "if", "(", "elementLength", "==", "this", ".", "elements", ".", "length", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "elements", ",", "0", ",", "this", ".", "elements", "=", "new", "IJavaElement", "[", "(", "elementLength", "*", "2", ")", "+", "1", "]", ",", "0", ",", "elementLength", ")", ";", "}", "this", ".", "elements", "[", "++", "this", ".", "elementIndex", "]", "=", "element", ";", "}", "private", "boolean", "areTypeParametersCompatible", "(", "IMethod", "method", ",", "char", "[", "]", "[", "]", "typeParameterNames", ",", "char", "[", "]", "[", "]", "[", "]", "typeParameterBoundNames", ")", "{", "try", "{", "ITypeParameter", "[", "]", "typeParameters", "=", "method", ".", "getTypeParameters", "(", ")", ";", "int", "length1", "=", "typeParameters", "==", "null", "?", "0", ":", "typeParameters", ".", "length", ";", "int", "length2", "=", "typeParameterNames", "==", "null", "?", "0", ":", "typeParameterNames", ".", "length", ";", "if", "(", "length1", "!=", "length2", ")", "{", "return", "false", ";", "}", "else", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "length1", ";", "j", "++", ")", "{", "ITypeParameter", "typeParameter", "=", "typeParameters", "[", "j", "]", ";", "String", "typeParameterName", "=", "typeParameter", ".", "getElementName", "(", ")", ";", "if", "(", "!", "typeParameterName", ".", "equals", "(", "new", "String", "(", "typeParameterNames", "[", "j", "]", ")", ")", ")", "{", "return", "false", ";", "}", "String", "[", "]", "bounds", "=", "typeParameter", ".", "getBounds", "(", ")", ";", "int", "boundCount", "=", "typeParameterBoundNames", "[", "j", "]", "==", "null", "?", "0", ":", "typeParameterBoundNames", "[", "j", "]", ".", "length", ";", "if", "(", "bounds", ".", "length", "!=", "boundCount", ")", "{", "return", "false", ";", "}", "else", "{", "for", "(", "int", "k", "=", "0", ";", "k", "<", "boundCount", ";", "k", "++", ")", "{", "String", "simpleName", "=", "Signature", ".", "getSimpleName", "(", "bounds", "[", "k", "]", ")", ";", "int", "index", "=", "simpleName", ".", "indexOf", "(", "'<'", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "simpleName", "=", "simpleName", ".", "substring", "(", "0", ",", "index", ")", ";", "}", "if", "(", "!", "simpleName", ".", "equals", "(", "new", "String", "(", "typeParameterBoundNames", "[", "j", "]", "[", "k", "]", ")", ")", ")", "{", "return", "false", ";", "}", "}", "}", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "protected", "IJavaElement", "findLocalElement", "(", "int", "pos", ")", "{", "IJavaElement", "res", "=", "null", ";", "if", "(", "this", ".", "openable", "instanceof", "ICompilationUnit", ")", "{", "ICompilationUnit", "cu", "=", "(", "ICompilationUnit", ")", "this", ".", "openable", ";", "try", "{", "res", "=", "cu", ".", "getElementAt", "(", "pos", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "else", "if", "(", "this", ".", "openable", "instanceof", "ClassFile", ")", "{", "ClassFile", "cf", "=", "(", "ClassFile", ")", "this", ".", "openable", ";", "try", "{", "res", "=", "cf", ".", "getElementAtConsideringSibling", "(", "pos", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "return", "res", ";", "}", "public", "IJavaElement", "findMethodFromBinding", "(", "MethodBinding", "method", ",", "String", "[", "]", "signatures", ",", "ReferenceBinding", "declaringClass", ")", "{", "IType", "foundType", "=", "this", ".", "resolveType", "(", "declaringClass", ".", "qualifiedPackageName", "(", ")", ",", "declaringClass", ".", "qualifiedSourceName", "(", ")", ",", "NameLookup", ".", "ACCEPT_CLASSES", "&", "NameLookup", ".", "ACCEPT_INTERFACES", ")", ";", "if", "(", "foundType", "!=", "null", ")", "{", "if", "(", "foundType", "instanceof", "BinaryType", ")", "{", "try", "{", "return", "Util", ".", "findMethod", "(", "foundType", ",", "method", ".", "selector", ",", "signatures", ",", "method", ".", "isConstructor", "(", ")", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "}", "else", "{", "return", "foundType", ".", "getMethod", "(", "new", "String", "(", "method", ".", "selector", ")", ",", "signatures", ")", ";", "}", "}", "return", "null", ";", "}", "public", "IJavaElement", "[", "]", "getElements", "(", ")", "{", "int", "elementLength", "=", "this", ".", "elementIndex", "+", "1", ";", "if", "(", "this", ".", "elements", ".", "length", "!=", "elementLength", ")", "{", "System", ".", "arraycopy", "(", "this", ".", "elements", ",", "0", ",", "this", ".", "elements", "=", "new", "IJavaElement", "[", "elementLength", "]", ",", "0", ",", "elementLength", ")", ";", "}", "return", "this", ".", "elements", ";", "}", "protected", "IType", "resolveType", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "typeName", ",", "int", "acceptFlags", ")", "{", "IType", "type", "=", "null", ";", "if", "(", "this", ".", "openable", "instanceof", "CompilationUnit", "&&", "(", "(", "CompilationUnit", ")", "this", ".", "openable", ")", ".", "isWorkingCopy", "(", ")", ")", "{", "CompilationUnit", "wc", "=", "(", "CompilationUnit", ")", "this", ".", "openable", ";", "try", "{", "if", "(", "(", "(", "packageName", "==", "null", "||", "packageName", ".", "length", "==", "0", ")", "&&", "wc", ".", "getPackageDeclarations", "(", ")", ".", "length", "==", "0", ")", "||", "(", "!", "(", "packageName", "==", "null", "||", "packageName", ".", "length", "==", "0", ")", "&&", "wc", ".", "getPackageDeclaration", "(", "new", "String", "(", "packageName", ")", ")", ".", "exists", "(", ")", ")", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "typeName", ")", ";", "if", "(", "compoundName", ".", "length", ">", "0", ")", "{", "type", "=", "wc", ".", "getType", "(", "new", "String", "(", "compoundName", "[", "0", "]", ")", ")", ";", "for", "(", "int", "i", "=", "1", ",", "length", "=", "compoundName", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "type", "=", "type", ".", "getType", "(", "new", "String", "(", "compoundName", "[", "i", "]", ")", ")", ";", "}", "}", "if", "(", "type", "!=", "null", "&&", "!", "type", ".", "exists", "(", ")", ")", "{", "type", "=", "null", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "if", "(", "type", "==", "null", ")", "{", "IPackageFragment", "[", "]", "pkgs", "=", "this", ".", "nameLookup", ".", "findPackageFragments", "(", "(", "packageName", "==", "null", "||", "packageName", ".", "length", "==", "0", ")", "?", "IPackageFragment", ".", "DEFAULT_PACKAGE_NAME", ":", "new", "String", "(", "packageName", ")", ",", "false", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "pkgs", "==", "null", "?", "0", ":", "pkgs", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "type", "=", "this", ".", "nameLookup", ".", "findType", "(", "new", "String", "(", "typeName", ")", ",", "pkgs", "[", "i", "]", ",", "false", ",", "acceptFlags", ",", "true", ")", ";", "if", "(", "type", "!=", "null", ")", "break", ";", "}", "if", "(", "type", "==", "null", ")", "{", "String", "pName", "=", "IPackageFragment", ".", "DEFAULT_PACKAGE_NAME", ";", "if", "(", "packageName", "!=", "null", ")", "{", "pName", "=", "new", "String", "(", "packageName", ")", ";", "}", "if", "(", "this", ".", "openable", "!=", "null", "&&", "this", ".", "openable", ".", "getParent", "(", ")", ".", "getElementName", "(", ")", ".", "equals", "(", "pName", ")", ")", "{", "String", "tName", "=", "new", "String", "(", "typeName", ")", ";", "tName", "=", "tName", ".", "replace", "(", "'.'", ",", "'$'", ")", ";", "IType", "[", "]", "allTypes", "=", "null", ";", "try", "{", "ArrayList", "list", "=", "this", ".", "openable", ".", "getChildrenOfType", "(", "IJavaElement", ".", "TYPE", ")", ";", "allTypes", "=", "new", "IType", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "allTypes", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "allTypes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "allTypes", "[", "i", "]", ".", "getTypeQualifiedName", "(", ")", ".", "equals", "(", "tName", ")", ")", "{", "return", "allTypes", "[", "i", "]", ";", "}", "}", "}", "}", "}", "return", "type", ";", "}", "protected", "IType", "resolveTypeByLocation", "(", "char", "[", "]", "packageName", ",", "char", "[", "]", "typeName", ",", "int", "acceptFlags", ",", "int", "start", ",", "int", "end", ")", "{", "IType", "type", "=", "null", ";", "if", "(", "this", ".", "openable", "instanceof", "CompilationUnit", "&&", "(", "(", "CompilationUnit", ")", "this", ".", "openable", ")", ".", "isOpen", "(", ")", ")", "{", "CompilationUnit", "wc", "=", "(", "CompilationUnit", ")", "this", ".", "openable", ";", "try", "{", "if", "(", "(", "(", "packageName", "==", "null", "||", "packageName", ".", "length", "==", "0", ")", "&&", "wc", ".", "getPackageDeclarations", "(", ")", ".", "length", "==", "0", ")", "||", "(", "!", "(", "packageName", "==", "null", "||", "packageName", ".", "length", "==", "0", ")", "&&", "wc", ".", "getPackageDeclaration", "(", "new", "String", "(", "packageName", ")", ")", ".", "exists", "(", ")", ")", ")", "{", "char", "[", "]", "[", "]", "compoundName", "=", "CharOperation", ".", "splitOn", "(", "'.'", ",", "typeName", ")", ";", "if", "(", "compoundName", ".", "length", ">", "0", ")", "{", "IType", "[", "]", "tTypes", "=", "wc", ".", "getTypes", "(", ")", ";", "int", "i", "=", "0", ";", "int", "depth", "=", "0", ";", "done", ":", "while", "(", "i", "<", "tTypes", ".", "length", ")", "{", "ISourceRange", "range", "=", "tTypes", "[", "i", "]", ".", "getSourceRange", "(", ")", ";", "if", "(", "range", ".", "getOffset", "(", ")", "<=", "start", "&&", "range", ".", "getOffset", "(", ")", "+", "range", ".", "getLength", "(", ")", ">=", "end", "&&", "tTypes", "[", "i", "]", ".", "getElementName", "(", ")", ".", "equals", "(", "new", "String", "(", "compoundName", "[", "depth", "]", ")", ")", ")", "{", "if", "(", "depth", "==", "compoundName", ".", "length", "-", "1", ")", "{", "type", "=", "tTypes", "[", "i", "]", ";", "break", "done", ";", "}", "tTypes", "=", "tTypes", "[", "i", "]", ".", "getTypes", "(", ")", ";", "i", "=", "0", ";", "depth", "++", ";", "continue", "done", ";", "}", "i", "++", ";", "}", "}", "if", "(", "type", "!=", "null", "&&", "!", "type", ".", "exists", "(", ")", ")", "{", "type", "=", "null", ";", "}", "}", "}", "catch", "(", "JavaModelException", "e", ")", "{", "}", "}", "if", "(", "type", "==", "null", ")", "{", "IPackageFragment", "[", "]", "pkgs", "=", "this", ".", "nameLookup", ".", "findPackageFragments", "(", "(", "packageName", "==", "null", "||", "packageName", ".", "length", "==", "0", ")", "?", "IPackageFragment", ".", "DEFAULT_PACKAGE_NAME", ":", "new", "String", "(", "packageName", ")", ",", "false", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "pkgs", "==", "null", "?", "0", ":", "pkgs", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "type", "=", "this", ".", "nameLookup", ".", "findType", "(", "new", "String", "(", "typeName", ")", ",", "pkgs", "[", "i", "]", ",", "false", ",", "acceptFlags", ",", "true", ")", ";", "if", "(", "type", "!=", "null", ")", "break", ";", "}", "if", "(", "type", "==", "null", ")", "{", "String", "pName", "=", "IPackageFragment", ".", "DEFAULT_PACKAGE_NAME", ";", "if", "(", "packageName", "!=", "null", ")", "{", "pName", "=", "new", "String", "(", "packageName", ")", ";", "}", "if", "(", "this", ".", "openable", "!=", "null", "&&", "this", ".", "openable", ".", "getParent", "(", ")", ".", "getElementName", "(", ")", ".", "equals", "(", "pName", ")", ")", "{", "String", "tName", "=", "new", "String", "(", "typeName", ")", ";", "tName", "=", "tName", ".", "replace", "(", "'.'", ",", "'$'", ")", ";", "IType", "[", "]", "allTypes", "=", "null", ";", "try", "{", "ArrayList", "list", "=", "this", ".", "openable", ".", "getChildrenOfType", "(", "IJavaElement", ".", "TYPE", ")", ";", "allTypes", "=", "new", "IType", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "allTypes", ")", ";", "}", "catch", "(", "JavaModelException", "e", ")", "{", "return", "null", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "allTypes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "allTypes", "[", "i", "]", ".", "getTypeQualifiedName", "(", ")", ".", "equals", "(", "tName", ")", ")", "{", "return", "allTypes", "[", "i", "]", ";", "}", "}", "}", "}", "}", "return", "type", ";", "}", "}", "</s>" ]
3,794
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "public", "class", "SourceMethodWithChildrenInfo", "extends", "SourceMethodInfo", "{", "protected", "IJavaElement", "[", "]", "children", ";", "public", "SourceMethodWithChildrenInfo", "(", "IJavaElement", "[", "]", "children", ")", "{", "this", ".", "children", "=", "children", ";", "}", "public", "IJavaElement", "[", "]", "getChildren", "(", ")", "{", "return", "this", ".", "children", ";", "}", "}", "</s>" ]
3,795
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "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", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IAnnotation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElementDelta", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IParent", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "compiler", ".", "CharOperation", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "JavaElementDeltaBuilder", "{", "IJavaElement", "javaElement", ";", "int", "maxDepth", "=", "Integer", ".", "MAX_VALUE", ";", "Map", "infos", ";", "Map", "annotationInfos", ";", "Map", "oldPositions", ";", "Map", "newPositions", ";", "public", "JavaElementDelta", "delta", "=", "null", ";", "HashSet", "added", ";", "HashSet", "removed", ";", "static", "class", "ListItem", "{", "public", "IJavaElement", "previous", ";", "public", "IJavaElement", "next", ";", "public", "ListItem", "(", "IJavaElement", "previous", ",", "IJavaElement", "next", ")", "{", "this", ".", "previous", "=", "previous", ";", "this", ".", "next", "=", "next", ";", "}", "}", "public", "JavaElementDeltaBuilder", "(", "IJavaElement", "javaElement", ")", "{", "this", ".", "javaElement", "=", "javaElement", ";", "initialize", "(", ")", ";", "recordElementInfo", "(", "javaElement", ",", "(", "JavaModel", ")", "this", ".", "javaElement", ".", "getJavaModel", "(", ")", ",", "0", ")", ";", "}", "public", "JavaElementDeltaBuilder", "(", "IJavaElement", "javaElement", ",", "int", "maxDepth", ")", "{", "this", ".", "javaElement", "=", "javaElement", ";", "this", ".", "maxDepth", "=", "maxDepth", ";", "initialize", "(", ")", ";", "recordElementInfo", "(", "javaElement", ",", "(", "JavaModel", ")", "this", ".", "javaElement", ".", "getJavaModel", "(", ")", ",", "0", ")", ";", "}", "private", "void", "added", "(", "IJavaElement", "element", ")", "{", "this", ".", "added", ".", "add", "(", "element", ")", ";", "ListItem", "current", "=", "getNewPosition", "(", "element", ")", ";", "ListItem", "previous", "=", "null", ",", "next", "=", "null", ";", "if", "(", "current", ".", "previous", "!=", "null", ")", "previous", "=", "getNewPosition", "(", "current", ".", "previous", ")", ";", "if", "(", "current", ".", "next", "!=", "null", ")", "next", "=", "getNewPosition", "(", "current", ".", "next", ")", ";", "if", "(", "previous", "!=", "null", ")", "previous", ".", "next", "=", "current", ".", "next", ";", "if", "(", "next", "!=", "null", ")", "next", ".", "previous", "=", "current", ".", "previous", ";", "}", "public", "void", "buildDeltas", "(", ")", "{", "this", ".", "delta", "=", "new", "JavaElementDelta", "(", "this", ".", "javaElement", ")", ";", "if", "(", "this", ".", "javaElement", ".", "getElementType", "(", ")", ">=", "IJavaElement", ".", "COMPILATION_UNIT", ")", "{", "this", ".", "delta", ".", "fineGrained", "(", ")", ";", "}", "recordNewPositions", "(", "this", ".", "javaElement", ",", "0", ")", ";", "findAdditions", "(", "this", ".", "javaElement", ",", "0", ")", ";", "findDeletions", "(", ")", ";", "findChangesInPositioning", "(", "this", ".", "javaElement", ",", "0", ")", ";", "trimDelta", "(", "this", ".", "delta", ")", ";", "if", "(", "this", ".", "delta", ".", "getAffectedChildren", "(", ")", ".", "length", "==", "0", ")", "{", "this", ".", "delta", ".", "contentChanged", "(", ")", ";", "}", "}", "private", "boolean", "equals", "(", "char", "[", "]", "[", "]", "[", "]", "first", ",", "char", "[", "]", "[", "]", "[", "]", "second", ")", "{", "if", "(", "first", "==", "second", ")", "return", "true", ";", "if", "(", "first", "==", "null", "||", "second", "==", "null", ")", "return", "false", ";", "if", "(", "first", ".", "length", "!=", "second", ".", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "first", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "if", "(", "!", "CharOperation", ".", "equals", "(", "first", "[", "i", "]", ",", "second", "[", "i", "]", ")", ")", "return", "false", ";", "return", "true", ";", "}", "private", "void", "findAdditions", "(", "IJavaElement", "newElement", ",", "int", "depth", ")", "{", "JavaElementInfo", "oldInfo", "=", "getElementInfo", "(", "newElement", ")", ";", "if", "(", "oldInfo", "==", "null", "&&", "depth", "<", "this", ".", "maxDepth", ")", "{", "this", ".", "delta", ".", "added", "(", "newElement", ")", ";", "added", "(", "newElement", ")", ";", "}", "else", "{", "removeElementInfo", "(", "newElement", ")", ";", "}", "if", "(", "depth", ">=", "this", ".", "maxDepth", ")", "{", "this", ".", "delta", ".", "changed", "(", "newElement", ",", "IJavaElementDelta", ".", "F_CONTENT", ")", ";", "return", ";", "}", "JavaElementInfo", "newInfo", "=", "null", ";", "try", "{", "newInfo", "=", "(", "JavaElementInfo", ")", "(", "(", "JavaElement", ")", "newElement", ")", ".", "getElementInfo", "(", ")", ";", "}", "catch", "(", "JavaModelException", "npe", ")", "{", "return", ";", "}", "findContentChange", "(", "oldInfo", ",", "newInfo", ",", "newElement", ")", ";", "if", "(", "oldInfo", "!=", "null", "&&", "newElement", "instanceof", "IParent", ")", "{", "IJavaElement", "[", "]", "children", "=", "newInfo", ".", "getChildren", "(", ")", ";", "if", "(", "children", "!=", "null", ")", "{", "int", "length", "=", "children", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "findAdditions", "(", "children", "[", "i", "]", ",", "depth", "+", "1", ")", ";", "}", "}", "}", "}", "private", "void", "findChangesInPositioning", "(", "IJavaElement", "element", ",", "int", "depth", ")", "{", "if", "(", "depth", ">=", "this", ".", "maxDepth", "||", "this", ".", "added", ".", "contains", "(", "element", ")", "||", "this", ".", "removed", ".", "contains", "(", "element", ")", ")", "return", ";", "if", "(", "!", "isPositionedCorrectly", "(", "element", ")", ")", "{", "this", ".", "delta", ".", "changed", "(", "element", ",", "IJavaElementDelta", ".", "F_REORDER", ")", ";", "}", "if", "(", "element", "instanceof", "IParent", ")", "{", "JavaElementInfo", "info", "=", "null", ";", "try", "{", "info", "=", "(", "JavaElementInfo", ")", "(", "(", "JavaElement", ")", "element", ")", ".", "getElementInfo", "(", ")", ";", "}", "catch", "(", "JavaModelException", "npe", ")", "{", "return", ";", "}", "IJavaElement", "[", "]", "children", "=", "info", ".", "getChildren", "(", ")", ";", "if", "(", "children", "!=", "null", ")", "{", "int", "length", "=", "children", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "findChangesInPositioning", "(", "children", "[", "i", "]", ",", "depth", "+", "1", ")", ";", "}", "}", "}", "}", "private", "void", "findAnnotationChanges", "(", "IAnnotation", "[", "]", "oldAnnotations", ",", "IAnnotation", "[", "]", "newAnnotations", ",", "IJavaElement", "parent", ")", "{", "ArrayList", "annotationDeltas", "=", "null", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "newAnnotations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IAnnotation", "newAnnotation", "=", "newAnnotations", "[", "i", "]", ";", "Object", "oldInfo", "=", "this", ".", "annotationInfos", ".", "remove", "(", "newAnnotation", ")", ";", "if", "(", "oldInfo", "==", "null", ")", "{", "JavaElementDelta", "annotationDelta", "=", "new", "JavaElementDelta", "(", "newAnnotation", ")", ";", "annotationDelta", ".", "added", "(", ")", ";", "if", "(", "annotationDeltas", "==", "null", ")", "annotationDeltas", "=", "new", "ArrayList", "(", ")", ";", "annotationDeltas", ".", "add", "(", "annotationDelta", ")", ";", "continue", ";", "}", "else", "{", "AnnotationInfo", "newInfo", "=", "null", ";", "try", "{", "newInfo", "=", "(", "AnnotationInfo", ")", "(", "(", "JavaElement", ")", "newAnnotation", ")", ".", "getElementInfo", "(", ")", ";", "}", "catch", "(", "JavaModelException", "npe", ")", "{", "return", ";", "}", "if", "(", "!", "Util", ".", "equalArraysOrNull", "(", "(", "(", "AnnotationInfo", ")", "oldInfo", ")", ".", "members", ",", "newInfo", ".", "members", ")", ")", "{", "JavaElementDelta", "annotationDelta", "=", "new", "JavaElementDelta", "(", "newAnnotation", ")", ";", "annotationDelta", ".", "changed", "(", "IJavaElementDelta", ".", "F_CONTENT", ")", ";", "if", "(", "annotationDeltas", "==", "null", ")", "annotationDeltas", "=", "new", "ArrayList", "(", ")", ";", "annotationDeltas", ".", "add", "(", "annotationDelta", ")", ";", "}", "}", "}", "for", "(", "int", "i", "=", "0", ",", "length", "=", "oldAnnotations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "IAnnotation", "oldAnnotation", "=", "oldAnnotations", "[", "i", "]", ";", "if", "(", "this", ".", "annotationInfos", ".", "remove", "(", "oldAnnotation", ")", "!=", "null", ")", "{", "JavaElementDelta", "annotationDelta", "=", "new", "JavaElementDelta", "(", "oldAnnotation", ")", ";", "annotationDelta", ".", "removed", "(", ")", ";", "if", "(", "annotationDeltas", "==", "null", ")", "annotationDeltas", "=", "new", "ArrayList", "(", ")", ";", "annotationDeltas", ".", "add", "(", "annotationDelta", ")", ";", "}", "}", "if", "(", "annotationDeltas", "==", "null", ")", "return", ";", "int", "size", "=", "annotationDeltas", ".", "size", "(", ")", ";", "if", "(", "size", ">", "0", ")", "{", "JavaElementDelta", "parentDelta", "=", "this", ".", "delta", ".", "changed", "(", "parent", ",", "IJavaElementDelta", ".", "F_ANNOTATIONS", ")", ";", "parentDelta", ".", "annotationDeltas", "=", "(", "IJavaElementDelta", "[", "]", ")", "annotationDeltas", ".", "toArray", "(", "new", "IJavaElementDelta", "[", "size", "]", ")", ";", "}", "}", "private", "void", "findContentChange", "(", "JavaElementInfo", "oldInfo", ",", "JavaElementInfo", "newInfo", ",", "IJavaElement", "newElement", ")", "{", "if", "(", "oldInfo", "instanceof", "MemberElementInfo", "&&", "newInfo", "instanceof", "MemberElementInfo", ")", "{", "if", "(", "(", "(", "MemberElementInfo", ")", "oldInfo", ")", ".", "getModifiers", "(", ")", "!=", "(", "(", "MemberElementInfo", ")", "newInfo", ")", ".", "getModifiers", "(", ")", ")", "{", "this", ".", "delta", ".", "changed", "(", "newElement", ",", "IJavaElementDelta", ".", "F_MODIFIERS", ")", ";", "}", "if", "(", "oldInfo", "instanceof", "AnnotatableInfo", "&&", "newInfo", "instanceof", "AnnotatableInfo", ")", "{", "findAnnotationChanges", "(", "(", "(", "AnnotatableInfo", ")", "oldInfo", ")", ".", "annotations", ",", "(", "(", "AnnotatableInfo", ")", "newInfo", ")", ".", "annotations", ",", "newElement", ")", ";", "}", "if", "(", "oldInfo", "instanceof", "SourceMethodElementInfo", "&&", "newInfo", "instanceof", "SourceMethodElementInfo", ")", "{", "SourceMethodElementInfo", "oldSourceMethodInfo", "=", "(", "SourceMethodElementInfo", ")", "oldInfo", ";", "SourceMethodElementInfo", "newSourceMethodInfo", "=", "(", "SourceMethodElementInfo", ")", "newInfo", ";", "if", "(", "!", "CharOperation", ".", "equals", "(", "oldSourceMethodInfo", ".", "getReturnTypeName", "(", ")", ",", "newSourceMethodInfo", ".", "getReturnTypeName", "(", ")", ")", "||", "!", "CharOperation", ".", "equals", "(", "oldSourceMethodInfo", ".", "getTypeParameterNames", "(", ")", ",", "newSourceMethodInfo", ".", "getTypeParameterNames", "(", ")", ")", "||", "!", "equals", "(", "oldSourceMethodInfo", ".", "getTypeParameterBounds", "(", ")", ",", "newSourceMethodInfo", ".", "getTypeParameterBounds", "(", ")", ")", ")", "{", "this", ".", "delta", ".", "changed", "(", "newElement", ",", "IJavaElementDelta", ".", "F_CONTENT", ")", ";", "}", "}", "else", "if", "(", "oldInfo", "instanceof", "SourceFieldElementInfo", "&&", "newInfo", "instanceof", "SourceFieldElementInfo", ")", "{", "if", "(", "!", "CharOperation", ".", "equals", "(", "(", "(", "SourceFieldElementInfo", ")", "oldInfo", ")", ".", "getTypeName", "(", ")", ",", "(", "(", "SourceFieldElementInfo", ")", "newInfo", ")", ".", "getTypeName", "(", ")", ")", ")", "{", "this", ".", "delta", ".", "changed", "(", "newElement", ",", "IJavaElementDelta", ".", "F_CONTENT", ")", ";", "}", "}", "else", "if", "(", "oldInfo", "instanceof", "SourceTypeElementInfo", "&&", "newInfo", "instanceof", "SourceTypeElementInfo", ")", "{", "SourceTypeElementInfo", "oldSourceTypeInfo", "=", "(", "SourceTypeElementInfo", ")", "oldInfo", ";", "SourceTypeElementInfo", "newSourceTypeInfo", "=", "(", "SourceTypeElementInfo", ")", "newInfo", ";", "if", "(", "!", "CharOperation", ".", "equals", "(", "oldSourceTypeInfo", ".", "getSuperclassName", "(", ")", ",", "newSourceTypeInfo", ".", "getSuperclassName", "(", ")", ")", "||", "!", "CharOperation", ".", "equals", "(", "oldSourceTypeInfo", ".", "getInterfaceNames", "(", ")", ",", "newSourceTypeInfo", ".", "getInterfaceNames", "(", ")", ")", ")", "{", "this", ".", "delta", ".", "changed", "(", "newElement", ",", "IJavaElementDelta", ".", "F_SUPER_TYPES", ")", ";", "}", "if", "(", "!", "CharOperation", ".", "equals", "(", "oldSourceTypeInfo", ".", "getTypeParameterNames", "(", ")", ",", "newSourceTypeInfo", ".", "getTypeParameterNames", "(", ")", ")", "||", "!", "equals", "(", "oldSourceTypeInfo", ".", "getTypeParameterBounds", "(", ")", ",", "newSourceTypeInfo", ".", "getTypeParameterBounds", "(", ")", ")", ")", "{", "this", ".", "delta", ".", "changed", "(", "newElement", ",", "IJavaElementDelta", ".", "F_CONTENT", ")", ";", "}", "HashMap", "oldTypeCategories", "=", "oldSourceTypeInfo", ".", "categories", ";", "HashMap", "newTypeCategories", "=", "newSourceTypeInfo", ".", "categories", ";", "if", "(", "oldTypeCategories", "!=", "null", ")", "{", "Set", "elements", ";", "if", "(", "newTypeCategories", "!=", "null", ")", "{", "elements", "=", "new", "HashSet", "(", "oldTypeCategories", ".", "keySet", "(", ")", ")", ";", "elements", ".", "addAll", "(", "newTypeCategories", ".", "keySet", "(", ")", ")", ";", "}", "else", "elements", "=", "oldTypeCategories", ".", "keySet", "(", ")", ";", "Iterator", "iterator", "=", "elements", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "IJavaElement", "element", "=", "(", "IJavaElement", ")", "iterator", ".", "next", "(", ")", ";", "String", "[", "]", "oldCategories", "=", "(", "String", "[", "]", ")", "oldTypeCategories", ".", "get", "(", "element", ")", ";", "String", "[", "]", "newCategories", "=", "newTypeCategories", "==", "null", "?", "null", ":", "(", "String", "[", "]", ")", "newTypeCategories", ".", "get", "(", "element", ")", ";", "if", "(", "!", "Util", ".", "equalArraysOrNull", "(", "oldCategories", ",", "newCategories", ")", ")", "{", "this", ".", "delta", ".", "changed", "(", "element", ",", "IJavaElementDelta", ".", "F_CATEGORIES", ")", ";", "}", "}", "}", "else", "if", "(", "newTypeCategories", "!=", "null", ")", "{", "Iterator", "elements", "=", "newTypeCategories", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "elements", ".", "hasNext", "(", ")", ")", "{", "IJavaElement", "element", "=", "(", "IJavaElement", ")", "elements", ".", "next", "(", ")", ";", "this", ".", "delta", ".", "changed", "(", "element", ",", "IJavaElementDelta", ".", "F_CATEGORIES", ")", ";", "}", "}", "}", "}", "}", "private", "void", "findDeletions", "(", ")", "{", "Iterator", "iter", "=", "this", ".", "infos", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "IJavaElement", "element", "=", "(", "IJavaElement", ")", "iter", ".", "next", "(", ")", ";", "this", ".", "delta", ".", "removed", "(", "element", ")", ";", "removed", "(", "element", ")", ";", "}", "}", "private", "JavaElementInfo", "getElementInfo", "(", "IJavaElement", "element", ")", "{", "return", "(", "JavaElementInfo", ")", "this", ".", "infos", ".", "get", "(", "element", ")", ";", "}", "private", "ListItem", "getNewPosition", "(", "IJavaElement", "element", ")", "{", "return", "(", "ListItem", ")", "this", ".", "newPositions", ".", "get", "(", "element", ")", ";", "}", "private", "ListItem", "getOldPosition", "(", "IJavaElement", "element", ")", "{", "return", "(", "ListItem", ")", "this", ".", "oldPositions", ".", "get", "(", "element", ")", ";", "}", "private", "void", "initialize", "(", ")", "{", "this", ".", "infos", "=", "new", "HashMap", "(", "20", ")", ";", "this", ".", "oldPositions", "=", "new", "HashMap", "(", "20", ")", ";", "this", ".", "newPositions", "=", "new", "HashMap", "(", "20", ")", ";", "this", ".", "oldPositions", ".", "put", "(", "this", ".", "javaElement", ",", "new", "ListItem", "(", "null", ",", "null", ")", ")", ";", "this", ".", "newPositions", ".", "put", "(", "this", ".", "javaElement", ",", "new", "ListItem", "(", "null", ",", "null", ")", ")", ";", "this", ".", "added", "=", "new", "HashSet", "(", "5", ")", ";", "this", ".", "removed", "=", "new", "HashSet", "(", "5", ")", ";", "}", "private", "void", "insertPositions", "(", "IJavaElement", "[", "]", "elements", ",", "boolean", "isNew", ")", "{", "int", "length", "=", "elements", ".", "length", ";", "IJavaElement", "previous", "=", "null", ",", "current", "=", "null", ",", "next", "=", "(", "length", ">", "0", ")", "?", "elements", "[", "0", "]", ":", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "previous", "=", "current", ";", "current", "=", "next", ";", "next", "=", "(", "i", "+", "1", "<", "length", ")", "?", "elements", "[", "i", "+", "1", "]", ":", "null", ";", "if", "(", "isNew", ")", "{", "this", ".", "newPositions", ".", "put", "(", "current", ",", "new", "ListItem", "(", "previous", ",", "next", ")", ")", ";", "}", "else", "{", "this", ".", "oldPositions", ".", "put", "(", "current", ",", "new", "ListItem", "(", "previous", ",", "next", ")", ")", ";", "}", "}", "}", "private", "boolean", "isPositionedCorrectly", "(", "IJavaElement", "element", ")", "{", "ListItem", "oldListItem", "=", "getOldPosition", "(", "element", ")", ";", "if", "(", "oldListItem", "==", "null", ")", "return", "false", ";", "ListItem", "newListItem", "=", "getNewPosition", "(", "element", ")", ";", "if", "(", "newListItem", "==", "null", ")", "return", "false", ";", "IJavaElement", "oldPrevious", "=", "oldListItem", ".", "previous", ";", "IJavaElement", "newPrevious", "=", "newListItem", ".", "previous", ";", "if", "(", "oldPrevious", "==", "null", ")", "{", "return", "newPrevious", "==", "null", ";", "}", "else", "{", "return", "oldPrevious", ".", "equals", "(", "newPrevious", ")", ";", "}", "}", "private", "void", "recordElementInfo", "(", "IJavaElement", "element", ",", "JavaModel", "model", ",", "int", "depth", ")", "{", "if", "(", "depth", ">=", "this", ".", "maxDepth", ")", "{", "return", ";", "}", "JavaElementInfo", "info", "=", "(", "JavaElementInfo", ")", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "getInfo", "(", "element", ")", ";", "if", "(", "info", "==", "null", ")", "return", ";", "this", ".", "infos", ".", "put", "(", "element", ",", "info", ")", ";", "if", "(", "element", "instanceof", "IParent", ")", "{", "IJavaElement", "[", "]", "children", "=", "info", ".", "getChildren", "(", ")", ";", "if", "(", "children", "!=", "null", ")", "{", "insertPositions", "(", "children", ",", "false", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "recordElementInfo", "(", "children", "[", "i", "]", ",", "model", ",", "depth", "+", "1", ")", ";", "}", "}", "IAnnotation", "[", "]", "annotations", "=", "null", ";", "if", "(", "info", "instanceof", "AnnotatableInfo", ")", "annotations", "=", "(", "(", "AnnotatableInfo", ")", "info", ")", ".", "annotations", ";", "if", "(", "annotations", "!=", "null", ")", "{", "if", "(", "this", ".", "annotationInfos", "==", "null", ")", "this", ".", "annotationInfos", "=", "new", "HashMap", "(", ")", ";", "JavaModelManager", "manager", "=", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "annotations", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "this", ".", "annotationInfos", ".", "put", "(", "annotations", "[", "i", "]", ",", "manager", ".", "getInfo", "(", "annotations", "[", "i", "]", ")", ")", ";", "}", "}", "}", "private", "void", "recordNewPositions", "(", "IJavaElement", "newElement", ",", "int", "depth", ")", "{", "if", "(", "depth", "<", "this", ".", "maxDepth", "&&", "newElement", "instanceof", "IParent", ")", "{", "JavaElementInfo", "info", "=", "null", ";", "try", "{", "info", "=", "(", "JavaElementInfo", ")", "(", "(", "JavaElement", ")", "newElement", ")", ".", "getElementInfo", "(", ")", ";", "}", "catch", "(", "JavaModelException", "npe", ")", "{", "return", ";", "}", "IJavaElement", "[", "]", "children", "=", "info", ".", "getChildren", "(", ")", ";", "if", "(", "children", "!=", "null", ")", "{", "insertPositions", "(", "children", ",", "true", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "recordNewPositions", "(", "children", "[", "i", "]", ",", "depth", "+", "1", ")", ";", "}", "}", "}", "}", "private", "void", "removed", "(", "IJavaElement", "element", ")", "{", "this", ".", "removed", ".", "add", "(", "element", ")", ";", "ListItem", "current", "=", "getOldPosition", "(", "element", ")", ";", "ListItem", "previous", "=", "null", ",", "next", "=", "null", ";", "if", "(", "current", ".", "previous", "!=", "null", ")", "previous", "=", "getOldPosition", "(", "current", ".", "previous", ")", ";", "if", "(", "current", ".", "next", "!=", "null", ")", "next", "=", "getOldPosition", "(", "current", ".", "next", ")", ";", "if", "(", "previous", "!=", "null", ")", "previous", ".", "next", "=", "current", ".", "next", ";", "if", "(", "next", "!=", "null", ")", "next", ".", "previous", "=", "current", ".", "previous", ";", "}", "private", "void", "removeElementInfo", "(", "IJavaElement", "element", ")", "{", "this", ".", "infos", ".", "remove", "(", "element", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "delta", "==", "null", "?", "\"<null>\"", ":", "this", ".", "delta", ".", "toString", "(", ")", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "private", "void", "trimDelta", "(", "JavaElementDelta", "elementDelta", ")", "{", "if", "(", "elementDelta", ".", "getKind", "(", ")", "==", "IJavaElementDelta", ".", "REMOVED", ")", "{", "IJavaElementDelta", "[", "]", "children", "=", "elementDelta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "elementDelta", ".", "removeAffectedChild", "(", "(", "JavaElementDelta", ")", "children", "[", "i", "]", ")", ";", "}", "}", "else", "{", "IJavaElementDelta", "[", "]", "children", "=", "elementDelta", ".", "getAffectedChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "length", "=", "children", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "trimDelta", "(", "(", "JavaElementDelta", ")", "children", "[", "i", "]", ")", ";", "}", "}", "}", "}", "</s>" ]
3,796
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IMemberValuePair", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "MemberValuePair", "implements", "IMemberValuePair", "{", "String", "memberName", ";", "public", "Object", "value", ";", "public", "int", "valueKind", "=", "K_UNKNOWN", ";", "public", "MemberValuePair", "(", "String", "memberName", ")", "{", "this", ".", "memberName", "=", "memberName", ";", "}", "public", "MemberValuePair", "(", "String", "memberName", ",", "Object", "value", ",", "int", "valueKind", ")", "{", "this", "(", "memberName", ")", ";", "this", ".", "value", "=", "value", ";", "this", ".", "valueKind", "=", "valueKind", ";", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "!", "(", "obj", "instanceof", "MemberValuePair", ")", ")", "{", "return", "false", ";", "}", "MemberValuePair", "other", "=", "(", "MemberValuePair", ")", "obj", ";", "return", "this", ".", "valueKind", "==", "other", ".", "valueKind", "&&", "this", ".", "memberName", ".", "equals", "(", "other", ".", "memberName", ")", "&&", "(", "this", ".", "value", "==", "other", ".", "value", "||", "(", "this", ".", "value", "!=", "null", "&&", "this", ".", "value", ".", "equals", "(", "other", ".", "value", ")", ")", "||", "(", "this", ".", "value", "instanceof", "Object", "[", "]", "&&", "other", ".", "value", "instanceof", "Object", "[", "]", "&&", "Util", ".", "equalArraysOrNull", "(", "(", "Object", "[", "]", ")", "this", ".", "value", ",", "(", "Object", "[", "]", ")", "other", ".", "value", ")", ")", ")", ";", "}", "public", "String", "getMemberName", "(", ")", "{", "return", "this", ".", "memberName", ";", "}", "public", "Object", "getValue", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "int", "getValueKind", "(", ")", "{", "return", "this", ".", "valueKind", ";", "}", "public", "int", "hashCode", "(", ")", "{", "final", "int", "prime", "=", "31", ";", "int", "result", "=", "1", ";", "result", "=", "prime", "*", "result", "+", "(", "(", "this", ".", "memberName", "==", "null", ")", "?", "0", ":", "this", ".", "memberName", ".", "hashCode", "(", ")", ")", ";", "result", "=", "prime", "*", "result", "+", "(", "(", "this", ".", "value", "==", "null", ")", "?", "0", ":", "this", ".", "value", ".", "hashCode", "(", ")", ")", ";", "result", "=", "prime", "*", "result", "+", "this", ".", "valueKind", ";", "return", "result", ";", "}", "}", "</s>" ]
3,797
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaElement", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "LRUCache", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ".", "util", ".", "Util", ";", "public", "class", "JavaModelCache", "{", "public", "static", "boolean", "VERBOSE", "=", "false", ";", "public", "static", "final", "int", "DEFAULT_PROJECT_SIZE", "=", "5", ";", "public", "static", "final", "int", "DEFAULT_ROOT_SIZE", "=", "50", ";", "public", "static", "final", "int", "DEFAULT_PKG_SIZE", "=", "500", ";", "public", "static", "final", "int", "DEFAULT_OPENABLE_SIZE", "=", "250", ";", "public", "static", "final", "int", "DEFAULT_CHILDREN_SIZE", "=", "250", "*", "20", ";", "public", "static", "final", "String", "RATIO_PROPERTY", "=", "\"\"", ";", "public", "static", "final", "Object", "NON_EXISTING_JAR_TYPE_INFO", "=", "new", "Object", "(", ")", ";", "protected", "double", "memoryRatio", "=", "-", "1", ";", "protected", "Object", "modelInfo", ";", "protected", "HashMap", "projectCache", ";", "protected", "ElementCache", "rootCache", ";", "protected", "ElementCache", "pkgCache", ";", "protected", "ElementCache", "openableCache", ";", "protected", "Map", "childrenCache", ";", "protected", "LRUCache", "jarTypeCache", ";", "public", "JavaModelCache", "(", ")", "{", "double", "ratio", "=", "getMemoryRatio", "(", ")", ";", "double", "openableRatio", "=", "getOpenableRatio", "(", ")", ";", "this", ".", "projectCache", "=", "new", "HashMap", "(", "DEFAULT_PROJECT_SIZE", ")", ";", "if", "(", "VERBOSE", ")", "{", "this", ".", "rootCache", "=", "new", "VerboseElementCache", "(", "(", "int", ")", "(", "DEFAULT_ROOT_SIZE", "*", "ratio", ")", ",", "\"Root", "cache\"", ")", ";", "this", ".", "pkgCache", "=", "new", "VerboseElementCache", "(", "(", "int", ")", "(", "DEFAULT_PKG_SIZE", "*", "ratio", ")", ",", "\"\"", ")", ";", "this", ".", "openableCache", "=", "new", "VerboseElementCache", "(", "(", "int", ")", "(", "DEFAULT_OPENABLE_SIZE", "*", "ratio", "*", "openableRatio", ")", ",", "\"\"", ")", ";", "}", "else", "{", "this", ".", "rootCache", "=", "new", "ElementCache", "(", "(", "int", ")", "(", "DEFAULT_ROOT_SIZE", "*", "ratio", ")", ")", ";", "this", ".", "pkgCache", "=", "new", "ElementCache", "(", "(", "int", ")", "(", "DEFAULT_PKG_SIZE", "*", "ratio", ")", ")", ";", "this", ".", "openableCache", "=", "new", "ElementCache", "(", "(", "int", ")", "(", "DEFAULT_OPENABLE_SIZE", "*", "ratio", "*", "openableRatio", ")", ")", ";", "}", "this", ".", "childrenCache", "=", "new", "HashMap", "(", "(", "int", ")", "(", "DEFAULT_CHILDREN_SIZE", "*", "ratio", "*", "openableRatio", ")", ")", ";", "resetJarTypeCache", "(", ")", ";", "}", "private", "double", "getOpenableRatio", "(", ")", "{", "String", "property", "=", "System", ".", "getProperty", "(", "RATIO_PROPERTY", ")", ";", "if", "(", "property", "!=", "null", ")", "{", "try", "{", "return", "Double", ".", "parseDouble", "(", "property", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "Util", ".", "log", "(", "e", ",", "\"\"", "+", "RATIO_PROPERTY", "+", "\":", "\"", "+", "property", ")", ";", "}", "}", "return", "1.0", ";", "}", "public", "Object", "getInfo", "(", "IJavaElement", "element", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "return", "this", ".", "modelInfo", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "return", "this", ".", "projectCache", ".", "get", "(", "element", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "return", "this", ".", "rootCache", ".", "get", "(", "element", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "return", "this", ".", "pkgCache", ".", "get", "(", "element", ")", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "case", "IJavaElement", ".", "CLASS_FILE", ":", "return", "this", ".", "openableCache", ".", "get", "(", "element", ")", ";", "case", "IJavaElement", ".", "TYPE", ":", "Object", "result", "=", "this", ".", "jarTypeCache", ".", "get", "(", "element", ")", ";", "if", "(", "result", "!=", "null", ")", "return", "result", ";", "else", "return", "this", ".", "childrenCache", ".", "get", "(", "element", ")", ";", "default", ":", "return", "this", ".", "childrenCache", ".", "get", "(", "element", ")", ";", "}", "}", "public", "IJavaElement", "getExistingElement", "(", "IJavaElement", "element", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "return", "element", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "return", "element", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "return", "(", "IJavaElement", ")", "this", ".", "rootCache", ".", "getKey", "(", "element", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "return", "(", "IJavaElement", ")", "this", ".", "pkgCache", ".", "getKey", "(", "element", ")", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "case", "IJavaElement", ".", "CLASS_FILE", ":", "return", "(", "IJavaElement", ")", "this", ".", "openableCache", ".", "getKey", "(", "element", ")", ";", "case", "IJavaElement", ".", "TYPE", ":", "return", "element", ";", "default", ":", "return", "element", ";", "}", "}", "protected", "double", "getMemoryRatio", "(", ")", "{", "if", "(", "(", "int", ")", "this", ".", "memoryRatio", "==", "-", "1", ")", "{", "long", "maxMemory", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "maxMemory", "(", ")", ";", "this", ".", "memoryRatio", "=", "maxMemory", "==", "Long", ".", "MAX_VALUE", "?", "4d", ":", "(", "(", "double", ")", "maxMemory", ")", "/", "(", "64", "*", "0x100000", ")", ";", "}", "return", "this", ".", "memoryRatio", ";", "}", "protected", "Object", "peekAtInfo", "(", "IJavaElement", "element", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "return", "this", ".", "modelInfo", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "return", "this", ".", "projectCache", ".", "get", "(", "element", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "return", "this", ".", "rootCache", ".", "peek", "(", "element", ")", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "return", "this", ".", "pkgCache", ".", "peek", "(", "element", ")", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "case", "IJavaElement", ".", "CLASS_FILE", ":", "return", "this", ".", "openableCache", ".", "peek", "(", "element", ")", ";", "case", "IJavaElement", ".", "TYPE", ":", "Object", "result", "=", "this", ".", "jarTypeCache", ".", "peek", "(", "element", ")", ";", "if", "(", "result", "!=", "null", ")", "return", "result", ";", "else", "return", "this", ".", "childrenCache", ".", "get", "(", "element", ")", ";", "default", ":", "return", "this", ".", "childrenCache", ".", "get", "(", "element", ")", ";", "}", "}", "protected", "void", "putInfo", "(", "IJavaElement", "element", ",", "Object", "info", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "this", ".", "modelInfo", "=", "info", ";", "break", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "this", ".", "projectCache", ".", "put", "(", "element", ",", "info", ")", ";", "this", ".", "rootCache", ".", "ensureSpaceLimit", "(", "info", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "this", ".", "rootCache", ".", "put", "(", "element", ",", "info", ")", ";", "this", ".", "pkgCache", ".", "ensureSpaceLimit", "(", "info", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "this", ".", "pkgCache", ".", "put", "(", "element", ",", "info", ")", ";", "this", ".", "openableCache", ".", "ensureSpaceLimit", "(", "info", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "case", "IJavaElement", ".", "CLASS_FILE", ":", "this", ".", "openableCache", ".", "put", "(", "element", ",", "info", ")", ";", "break", ";", "default", ":", "this", ".", "childrenCache", ".", "put", "(", "element", ",", "info", ")", ";", "}", "}", "protected", "void", "removeInfo", "(", "JavaElement", "element", ")", "{", "switch", "(", "element", ".", "getElementType", "(", ")", ")", "{", "case", "IJavaElement", ".", "JAVA_MODEL", ":", "this", ".", "modelInfo", "=", "null", ";", "break", ";", "case", "IJavaElement", ".", "JAVA_PROJECT", ":", "this", ".", "projectCache", ".", "remove", "(", "element", ")", ";", "this", ".", "rootCache", ".", "resetSpaceLimit", "(", "(", "int", ")", "(", "DEFAULT_ROOT_SIZE", "*", "getMemoryRatio", "(", ")", ")", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT_ROOT", ":", "this", ".", "rootCache", ".", "remove", "(", "element", ")", ";", "this", ".", "pkgCache", ".", "resetSpaceLimit", "(", "(", "int", ")", "(", "DEFAULT_PKG_SIZE", "*", "getMemoryRatio", "(", ")", ")", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "PACKAGE_FRAGMENT", ":", "this", ".", "pkgCache", ".", "remove", "(", "element", ")", ";", "this", ".", "openableCache", ".", "resetSpaceLimit", "(", "(", "int", ")", "(", "DEFAULT_OPENABLE_SIZE", "*", "getMemoryRatio", "(", ")", "*", "getOpenableRatio", "(", ")", ")", ",", "element", ")", ";", "break", ";", "case", "IJavaElement", ".", "COMPILATION_UNIT", ":", "case", "IJavaElement", ".", "CLASS_FILE", ":", "this", ".", "openableCache", ".", "remove", "(", "element", ")", ";", "break", ";", "default", ":", "this", ".", "childrenCache", ".", "remove", "(", "element", ")", ";", "}", "}", "protected", "void", "resetJarTypeCache", "(", ")", "{", "this", ".", "jarTypeCache", "=", "new", "LRUCache", "(", "(", "int", ")", "(", "DEFAULT_OPENABLE_SIZE", "*", "getMemoryRatio", "(", ")", ")", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "toStringFillingRation", "(", "\"\"", ")", ";", "}", "public", "String", "toStringFillingRation", "(", "String", "prefix", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "buffer", ".", "append", "(", "prefix", ")", ";", "buffer", ".", "append", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "projectCache", ".", "size", "(", ")", ")", ";", "buffer", ".", "append", "(", "\"", "projectsn\"", ")", ";", "buffer", ".", "append", "(", "prefix", ")", ";", "buffer", ".", "append", "(", "this", ".", "rootCache", ".", "toStringFillingRation", "(", "\"Root", "cache\"", ")", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "buffer", ".", "append", "(", "prefix", ")", ";", "buffer", ".", "append", "(", "this", ".", "pkgCache", ".", "toStringFillingRation", "(", "\"\"", ")", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "buffer", ".", "append", "(", "prefix", ")", ";", "buffer", ".", "append", "(", "this", ".", "openableCache", ".", "toStringFillingRation", "(", "\"\"", ")", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "buffer", ".", "append", "(", "prefix", ")", ";", "buffer", ".", "append", "(", "this", ".", "jarTypeCache", ".", "toStringFillingRation", "(", "\"\"", ")", ")", ";", "buffer", ".", "append", "(", "'\\n'", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}", "}", "</s>" ]
3,798
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "public", "class", "ResolvedBinaryType", "extends", "BinaryType", "{", "private", "String", "uniqueKey", ";", "public", "ResolvedBinaryType", "(", "JavaElement", "parent", ",", "String", "name", ",", "String", "uniqueKey", ")", "{", "super", "(", "parent", ",", "name", ")", ";", "this", ".", "uniqueKey", "=", "uniqueKey", ";", "}", "public", "String", "getFullyQualifiedParameterizedName", "(", ")", "throws", "JavaModelException", "{", "return", "getFullyQualifiedParameterizedName", "(", "getFullyQualifiedName", "(", "'.'", ")", ",", "this", ".", "uniqueKey", ")", ";", "}", "public", "String", "getKey", "(", ")", "{", "return", "this", ".", "uniqueKey", ";", "}", "public", "boolean", "isResolved", "(", ")", "{", "return", "true", ";", "}", "protected", "void", "toStringInfo", "(", "int", "tab", ",", "StringBuffer", "buffer", ",", "Object", "info", ",", "boolean", "showResolvedInfo", ")", "{", "super", ".", "toStringInfo", "(", "tab", ",", "buffer", ",", "info", ",", "showResolvedInfo", ")", ";", "if", "(", "showResolvedInfo", ")", "{", "buffer", ".", "append", "(", "\"", "{key=\"", ")", ";", "buffer", ".", "append", "(", "this", ".", "uniqueKey", ")", ";", "buffer", ".", "append", "(", "\"}\"", ")", ";", "}", "}", "public", "JavaElement", "unresolved", "(", ")", "{", "SourceRefElement", "handle", "=", "new", "BinaryType", "(", "this", ".", "parent", ",", "this", ".", "name", ")", ";", "handle", ".", "occurrenceCount", "=", "this", ".", "occurrenceCount", ";", "return", "handle", ";", "}", "}", "</s>" ]
3,799
[ "<s>", "package", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "core", ";", "import", "java", ".", "io", ".", "ByteArrayInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipEntry", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipFile", ";", "import", "org", ".", "eclipse", ".", "core", ".", "resources", ".", "IStorage", ";", "import", "org", ".", "eclipse", ".", "core", ".", "runtime", ".", "CoreException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJarEntryResource", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "IJavaModelStatusConstants", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "core", ".", "JavaModelException", ";", "import", "org", ".", "eclipse", ".", "jdt", ".", "internal", ".", "compiler", ".", "util", ".", "Util", ";", "public", "class", "JarEntryFile", "extends", "JarEntryResource", "{", "private", "static", "final", "IJarEntryResource", "[", "]", "NO_CHILDREN", "=", "new", "IJarEntryResource", "[", "0", "]", ";", "public", "JarEntryFile", "(", "String", "simpleName", ")", "{", "super", "(", "simpleName", ")", ";", "}", "public", "JarEntryResource", "clone", "(", "Object", "newParent", ")", "{", "JarEntryFile", "file", "=", "new", "JarEntryFile", "(", "this", ".", "simpleName", ")", ";", "file", ".", "setParent", "(", "newParent", ")", ";", "return", "file", ";", "}", "public", "InputStream", "getContents", "(", ")", "throws", "CoreException", "{", "ZipFile", "zipFile", "=", "null", ";", "try", "{", "zipFile", "=", "getZipFile", "(", ")", ";", "if", "(", "JavaModelManager", ".", "ZIP_ACCESS_VERBOSE", ")", "{", "System", ".", "out", ".", "println", "(", "\"(\"", "+", "Thread", ".", "currentThread", "(", ")", "+", "\"\"", "+", "zipFile", ".", "getName", "(", ")", ")", ";", "}", "String", "entryName", "=", "getEntryName", "(", ")", ";", "ZipEntry", "zipEntry", "=", "zipFile", ".", "getEntry", "(", "entryName", ")", ";", "if", "(", "zipEntry", "==", "null", ")", "{", "throw", "new", "JavaModelException", "(", "new", "JavaModelStatus", "(", "IJavaModelStatusConstants", ".", "INVALID_PATH", ",", "entryName", ")", ")", ";", "}", "byte", "[", "]", "contents", "=", "Util", ".", "getZipEntryByteContent", "(", "zipEntry", ",", "zipFile", ")", ";", "return", "new", "ByteArrayInputStream", "(", "contents", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JavaModelException", "(", "e", ",", "IJavaModelStatusConstants", ".", "IO_EXCEPTION", ")", ";", "}", "finally", "{", "JavaModelManager", ".", "getJavaModelManager", "(", ")", ".", "closeZipFile", "(", "zipFile", ")", ";", "}", "}", "public", "IJarEntryResource", "[", "]", "getChildren", "(", ")", "{", "return", "NO_CHILDREN", ";", "}", "public", "boolean", "isFile", "(", ")", "{", "return", "true", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "getEntryName", "(", ")", "+", "\"]\"", ";", "}", "}", "</s>" ]